project-module-architecture

10
0
Source

Project 项目管理模块架构指南,涵盖项目 CRUD、成员管理、项目配置、标签管理、项目迁移。当用户开发项目管理功能、处理项目成员、配置项目属性或实现项目相关逻辑时使用。

Install

mkdir -p .claude/skills/project-module-architecture && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2104" && unzip -o skill.zip -d .claude/skills/project-module-architecture && rm skill.zip

Installs to .claude/skills/project-module-architecture

About this skill

Project 项目管理模块架构指南

模块定位: Project 是 BK-CI 的基础模块,负责项目的创建、管理、权限、配置等功能。所有其他微服务都依赖 Project 模块,项目是 BK-CI 中资源隔离的最小单位。

一、模块整体结构

1.1 子模块划分

src/backend/ci/core/project/
├── api-project/          # API 接口定义层
│   └── src/main/kotlin/com/tencent/devops/project/
│       ├── api/
│       │   ├── op/           # 运维接口(7文件)
│       │   ├── open/         # 开放接口
│       │   ├── service/      # 服务间调用接口(10文件)
│       │   └── user/         # 用户接口(6文件)
│       ├── constant/         # 常量定义
│       └── pojo/             # 数据对象(60+ 文件)
│           ├── code/         # 消息码
│           └── enums/        # 枚举定义
│
├── biz-project/          # 业务逻辑层
│   └── src/main/kotlin/com/tencent/devops/project/
│       ├── config/           # 配置类
│       ├── dao/              # 数据访问层(20+ 文件)
│       ├── dispatch/         # 事件分发
│       ├── jmx/              # JMX 监控
│       ├── listener/         # 事件监听
│       ├── pojo/             # 内部数据对象
│       ├── resources/        # API 实现(25+ 文件)
│       ├── service/          # 业务服务
│       │   ├── impl/         # 服务实现(15+ 文件)
│       │   └── permission/   # 权限服务
│       └── util/             # 工具类
│
├── api-project-sample/   # 示例 API(扩展用)
├── biz-project-sample/   # 示例业务(扩展用)
├── boot-project/         # Spring Boot 启动模块
└── model-project/        # 数据模型层(JOOQ 生成)

1.2 模块职责矩阵

模块职责核心类数量
api-projectREST API 接口定义、POJO100+
biz-project业务逻辑、API 实现120+
model-projectJOOQ 数据模型自动生成

二、核心概念

2.1 项目实体模型

┌─────────────────────────────────────────────────────────────────────────┐
│                           BK-CI 项目模型                                 │
├─────────────────────────────────────────────────────────────────────────┤
│                                                                          │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │                        项目 (Project)                             │   │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────────────────┐   │   │
│  │  │ PROJECT_ID  │  │ project_name│  │ english_name            │   │   │
│  │  │ (UUID,不用) │  │ (项目名称)   │  │ (真正的projectId!)      │   │   │
│  │  └─────────────┘  └─────────────┘  └─────────────────────────┘   │   │
│  │                                                                   │   │
│  │  ⚠️ 注意:其他模块说的 projectId 就是 english_name                │   │
│  │                                                                   │   │
│  │  ┌─────────────────────────────────────────────────────────────┐ │   │
│  │  │                    组织架构信息                              │ │   │
│  │  │  bgId/bgName | deptId/deptName | centerId/centerName        │ │   │
│  │  │  businessLineId/businessLineName                            │ │   │
│  │  └─────────────────────────────────────────────────────────────┘ │   │
│  │                                                                   │   │
│  │  ┌─────────────────────────────────────────────────────────────┐ │   │
│  │  │                    项目属性 (Properties)                     │ │   │
│  │  │  pipelineDialectType | pipelineAsCodeSettings              │ │   │
│  │  │  pipelineLimit | subjectScopes                             │ │   │
│  │  └─────────────────────────────────────────────────────────────┘ │   │
│  └──────────────────────────────────────────────────────────────────┘   │
│                                                                          │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │                     关联资源                                      │   │
│  │  ┌─────────┐  ┌─────────┐  ┌─────────┐  ┌─────────┐            │   │
│  │  │pipeline │  │ repo    │  │ ticket  │  │ env     │  ...       │   │
│  │  └─────────┘  └─────────┘  └─────────┘  └─────────┘            │   │
│  └──────────────────────────────────────────────────────────────────┘   │
│                                                                          │
└─────────────────────────────────────────────────────────────────────────┘

2.2 项目核心字段

字段类型说明
IDLong数据库自增主键
PROJECT_IDString项目唯一标识(UUID,仅内部使用,其他模块不使用此字段
project_nameString项目中文名称(唯一)
english_nameString项目英文标识(唯一,这才是其他模块所说的 projectId)
creatorString创建者
CHANNELString项目渠道(BS/CODECC/AM等)
approval_statusInt审批状态
enabledBoolean是否启用
is_secrecyBoolean是否保密项目
propertiesJSON项目扩展属性
subject_scopesJSON可授权人员范围

⚠️ 重要说明:projectId 的真正含义

T_PROJECT 表中,PROJECT_ID 字段是一个 UUID,但这个字段几乎没有实际用途

对于其他所有微服务(process、auth、repository、artifactory 等)来说,它们接口中的 projectId 参数实际上指的是 T_PROJECT.english_name 字段!

例如:

  • ServiceProcessResource.list(projectId) → 这里的 projectIdenglish_name
  • ServiceAuthResource.validatePermission(projectId) → 这里的 projectId 也是 english_name
  • URL 路径 /api/user/projects/{projectId}/pipelines → 这里的 {projectId}english_name

命名约定

  • 在代码中,projectId / projectCode / englishName 都指同一个东西:T_PROJECT.english_name
  • T_PROJECT.PROJECT_ID(UUID)基本不使用,可以忽略

2.3 项目渠道类型

enum class ProjectChannelCode(val code: String) {
    BS("BS"),           // 蓝盾平台
    CODECC("CODECC"),   // 代码检查
    AM("AM"),           // 应用市场
    GCLOUD("GCLOUD"),   // 游戏云
    GITCI("GITCI"),     // GitCI
    STREAM("STREAM"),   // Stream
    PAAS("PAAS"),       // PaaS
}

2.4 项目审批状态

enum class ProjectApproveStatus(val status: Int) {
    CREATE_PENDING(1),      // 创建审批中
    CREATE_APPROVED(2),     // 创建已通过
    CREATE_REJECTED(3),     // 创建已驳回
    UPDATE_PENDING(4),      // 更新审批中
    UPDATE_APPROVED(5),     // 更新已通过
    UPDATE_REJECTED(6),     // 更新已驳回
}

三、分层架构图

┌─────────────────────────────────────────────────────────────────────────┐
│                              请求入口                                    │
│                    HTTP Request / 服务间调用                             │
└─────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                         API 层 (api-project)                             │
│  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐    │
│  │UserProject   │ │ServiceProject│ │OPProject     │ │OpenProject   │    │
│  │Resource      │ │Resource      │ │Resource      │ │Resource      │    │
│  │(用户项目管理) │ │(服务间调用)   │ │(运维管理)     │ │(开放接口)    │    │
│  └──────────────┘ └──────────────┘ └──────────────┘ └──────────────┘    │
│  ┌──────────────┐ ┌──────────────┐ ┌──────────────┐                     │
│  │ServiceProject│ │OPDataSource  │ │OPSharding    │                     │
│  │TagResource   │ │Resource      │ │RoutingRule   │                     │
│  │(项目标签)     │ │(数据源管理)   │ │(分片路由)     │                     │
│  └──────────────┘ └──────────────┘ └──────────────┘                     │
└─────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                       业务层 (biz-project)                               │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │                      ResourceImpl 实现层                          │   │
│  │  UserProjectResourceImpl | ServiceProjectResourceImpl | ...      │   │
│  └──────────────────────────────────────────────────────────────────┘   │
│                                    │                                     │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │                      Service 层                                   │   │
│  │  AbsProjectServiceImpl       - 项目核心服务(77KB,最大)          │   │
│  │  ProjectApprovalService      - 项目审批服务                       │   │
│  │  ProjectTagService           - 项目标签服务                       │   │
│  │  ProjectPermissionService    - 项目权限服务                       │   │
│  │  ShardingRoutingRuleService  - 分片路由服务                       │   │
│  │  UserLocaleService           - 用户语言服务                       │   │
│  └──────────────────────────────────────────────────────────────────┘   │
│                                    │                                     │
│  ┌──────────────────────────────────────────────────────────────────┐   │
│  │                      Permission 层                                │   │
│  │  ProjectPermissionServiceImpl     - 默认权限实现                  │   │
│  │  RbacProjectPermissionService     - RBAC 权限实现                 │   │
│  │  StreamProjectPermissionServiceImpl - Stream 权限实现             │   │
│  └──────────────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                         DAO 层 (biz-project/dao)                         │
│  ProjectDao (42KB) | ProjectApprovalDao | ShardingRoutingRuleDao        │
│  UserDao | ServiceDao | GrayTestDao | NoticeDao | ...                   │
└─────────────────────────────────────────────────────────────────────────┘
                                    │
                                    ▼
┌─────────────────────────────────────────────────────────────────────────┐
│                      数据层 (model-project + MySQL)                      │
│  数据库:devops_ci_project(共 15+ 张表)                                │
└─────────────────────────────────────────────────────────────────────────┘

四、核心数据库表

4.1 项目核心表

表名说明核心字段
T_PROJECT项目信息表ID, PROJECT_ID, project_name,

Content truncated.

store-module-architecture

TencentBlueKing

Store 研发商店模块架构指南,涵盖插件/模板/镜像管理、版本发布、审核流程、商店市场、扩展点机制。当用户开发研发商店功能、发布插件、管理模板或实现扩展点时使用。

00

00-bkci-global-architecture

TencentBlueKing

BK-CI 全局架构指南,以流水线为核心的模块协作全景图,涵盖完整执行流程、模块依赖关系、数据流向、核心概念。当用户需要理解系统架构、进行跨模块开发、了解模块间协作或规划架构设计时优先阅读。

10

auth-module-architecture

TencentBlueKing

Auth 权限认证模块架构指南,涵盖 IAM 集成、RBAC 权限模型、资源权限校验、权限迁移、OAuth 认证。当用户开发权限功能、配置 IAM 资源、实现权限校验或处理认证流程时使用。

10

go-agent-development

TencentBlueKing

Go Agent 开发指南,涵盖 Agent 架构设计、心跳机制、任务执行、日志上报、升级流程、与 Dispatch 模块交互。当用户开发构建机 Agent、实现任务执行逻辑、处理 Agent 通信或进行 Go 语言开发时使用。

00

supporting-modules-architecture

TencentBlueKing

BK-CI 支撑模块架构指南,涵盖凭证管理(Ticket)、构建机环境(Environment)、通知服务(Notify)、构建日志(Log)、质量红线(Quality)、开放接口(OpenAPI)等支撑性服务模块。当用户开发这些模块功能或需要理解支撑服务架构时使用。

100

git-commit-specification

TencentBlueKing

Git 提交规范,涵盖 commit message 格式(feat/fix/refactor)、Issue 关联、分支命名、PR 提交准备、rebase 使用。当用户提交代码、编写 commit message、创建分支或准备 PR 时使用。

00

You might also like

flutter-development

aj-geddes

Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.

643969

drawio-diagrams-enhanced

jgtolentino

Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.

591705

ui-ux-pro-max

nextlevelbuilder

"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."

318399

godot

bfollington

This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.

340397

nano-banana-pro

garg-aayush

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

452339

fastapi-templates

wshobson

Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.

304231

Stay ahead of the MCP ecosystem

Get weekly updates on new skills and servers.