architext 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +63 -0
- package/LICENSE +21 -0
- package/README.md +326 -0
- package/README.zh-CN.md +326 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +46 -0
- package/dist/templates/en/briefs/_base.md +115 -0
- package/dist/templates/en/briefs/_modules.md +173 -0
- package/dist/templates/en/docs/global/data_snapshot.json +31 -0
- package/dist/templates/en/docs/global/design_tokens.json +150 -0
- package/dist/templates/en/docs/global/dictionary.json +35 -0
- package/dist/templates/en/docs/global/error_codes.json +19 -0
- package/dist/templates/en/docs/global/map.json +94 -0
- package/dist/templates/en/docs/global/roadmap.json +39 -0
- package/dist/templates/en/docs/global/vision.md +82 -0
- package/dist/templates/en/docs/prompts/audit.md +150 -0
- package/dist/templates/en/docs/prompts/code.md +160 -0
- package/dist/templates/en/docs/prompts/edit.md +87 -0
- package/dist/templates/en/docs/prompts/fix.md +86 -0
- package/dist/templates/en/docs/prompts/help.md +69 -0
- package/dist/templates/en/docs/prompts/inherit.md +270 -0
- package/dist/templates/en/docs/prompts/map.md +131 -0
- package/dist/templates/en/docs/prompts/plan.md +252 -0
- package/dist/templates/en/docs/prompts/remove.md +162 -0
- package/dist/templates/en/docs/prompts/revise.md +160 -0
- package/dist/templates/en/docs/prompts/scope.md +198 -0
- package/dist/templates/en/docs/prompts/start.md +258 -0
- package/dist/templates/en/docs/templates/plan.template.json +113 -0
- package/dist/templates/en/docs/templates/scope-brief.template.md +58 -0
- package/dist/templates/en/docs/templates/spec.template.md +51 -0
- package/dist/templates/en/docs/templates/ui.template.md +51 -0
- package/dist/templates/en/rules/00_system.md +123 -0
- package/dist/templates/en/rules/01_workflow.md +93 -0
- package/dist/templates/en/rules/02_tech_stack.md +197 -0
- package/dist/templates/en/rules/03_data_governance.md +102 -0
- package/dist/templates/en/rules/04_cli_tools.md +50 -0
- package/dist/templates/en/rules/90_custom_rules.md +22 -0
- package/dist/templates/en/rules/99_context_glue.md +53 -0
- package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +292 -0
- package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +86 -0
- package/dist/templates/en/skills/archi-plan-options/SKILL.md +364 -0
- package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +342 -0
- package/dist/templates/zh/briefs/_base.md +116 -0
- package/dist/templates/zh/briefs/_modules.md +173 -0
- package/dist/templates/zh/docs/global/data_snapshot.json +31 -0
- package/dist/templates/zh/docs/global/design_tokens.json +135 -0
- package/dist/templates/zh/docs/global/dictionary.json +35 -0
- package/dist/templates/zh/docs/global/error_codes.json +19 -0
- package/dist/templates/zh/docs/global/map.json +94 -0
- package/dist/templates/zh/docs/global/roadmap.json +39 -0
- package/dist/templates/zh/docs/global/vision.md +82 -0
- package/dist/templates/zh/docs/prompts/audit.md +150 -0
- package/dist/templates/zh/docs/prompts/code.md +160 -0
- package/dist/templates/zh/docs/prompts/edit.md +87 -0
- package/dist/templates/zh/docs/prompts/fix.md +86 -0
- package/dist/templates/zh/docs/prompts/help.md +69 -0
- package/dist/templates/zh/docs/prompts/inherit.md +270 -0
- package/dist/templates/zh/docs/prompts/map.md +131 -0
- package/dist/templates/zh/docs/prompts/plan.md +253 -0
- package/dist/templates/zh/docs/prompts/remove.md +162 -0
- package/dist/templates/zh/docs/prompts/revise.md +160 -0
- package/dist/templates/zh/docs/prompts/scope.md +198 -0
- package/dist/templates/zh/docs/prompts/start.md +258 -0
- package/dist/templates/zh/docs/templates/plan.template.json +88 -0
- package/dist/templates/zh/docs/templates/scope-brief.template.md +58 -0
- package/dist/templates/zh/docs/templates/spec.template.md +51 -0
- package/dist/templates/zh/docs/templates/ui.template.md +51 -0
- package/dist/templates/zh/rules/00_system.md +123 -0
- package/dist/templates/zh/rules/01_workflow.md +93 -0
- package/dist/templates/zh/rules/02_tech_stack.md +192 -0
- package/dist/templates/zh/rules/03_data_governance.md +102 -0
- package/dist/templates/zh/rules/04_cli_tools.md +50 -0
- package/dist/templates/zh/rules/90_custom_rules.md +21 -0
- package/dist/templates/zh/rules/99_context_glue.md +53 -0
- package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +293 -0
- package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +86 -0
- package/dist/templates/zh/skills/archi-plan-options/SKILL.md +364 -0
- package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +339 -0
- package/dist/templates/zh-Hant/briefs/_base.md +115 -0
- package/dist/templates/zh-Hant/briefs/_modules.md +173 -0
- package/dist/templates/zh-Hant/docs/global/data_snapshot.json +31 -0
- package/dist/templates/zh-Hant/docs/global/design_tokens.json +135 -0
- package/dist/templates/zh-Hant/docs/global/dictionary.json +35 -0
- package/dist/templates/zh-Hant/docs/global/error_codes.json +19 -0
- package/dist/templates/zh-Hant/docs/global/map.json +94 -0
- package/dist/templates/zh-Hant/docs/global/roadmap.json +39 -0
- package/dist/templates/zh-Hant/docs/global/vision.md +82 -0
- package/dist/templates/zh-Hant/docs/prompts/audit.md +150 -0
- package/dist/templates/zh-Hant/docs/prompts/code.md +160 -0
- package/dist/templates/zh-Hant/docs/prompts/edit.md +87 -0
- package/dist/templates/zh-Hant/docs/prompts/fix.md +86 -0
- package/dist/templates/zh-Hant/docs/prompts/help.md +69 -0
- package/dist/templates/zh-Hant/docs/prompts/inherit.md +270 -0
- package/dist/templates/zh-Hant/docs/prompts/map.md +131 -0
- package/dist/templates/zh-Hant/docs/prompts/plan.md +252 -0
- package/dist/templates/zh-Hant/docs/prompts/remove.md +162 -0
- package/dist/templates/zh-Hant/docs/prompts/revise.md +160 -0
- package/dist/templates/zh-Hant/docs/prompts/scope.md +198 -0
- package/dist/templates/zh-Hant/docs/prompts/start.md +258 -0
- package/dist/templates/zh-Hant/docs/templates/plan.template.json +88 -0
- package/dist/templates/zh-Hant/docs/templates/scope-brief.template.md +58 -0
- package/dist/templates/zh-Hant/docs/templates/spec.template.md +51 -0
- package/dist/templates/zh-Hant/docs/templates/ui.template.md +51 -0
- package/dist/templates/zh-Hant/rules/00_system.md +123 -0
- package/dist/templates/zh-Hant/rules/01_workflow.md +93 -0
- package/dist/templates/zh-Hant/rules/02_tech_stack.md +192 -0
- package/dist/templates/zh-Hant/rules/03_data_governance.md +102 -0
- package/dist/templates/zh-Hant/rules/04_cli_tools.md +50 -0
- package/dist/templates/zh-Hant/rules/90_custom_rules.md +21 -0
- package/dist/templates/zh-Hant/rules/99_context_glue.md +53 -0
- package/dist/templates/zh-Hant/skills/archi-decompose-roadmap/SKILL.md +293 -0
- package/dist/templates/zh-Hant/skills/archi-interview-protocol/SKILL.md +86 -0
- package/dist/templates/zh-Hant/skills/archi-plan-options/SKILL.md +364 -0
- package/dist/templates/zh-Hant/skills/archi-ui-wireframe/SKILL.md +337 -0
- package/package.json +85 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"featureId": "{FEATURE_ID}",
|
|
3
|
+
"featureName": "{FEATURE_NAME}",
|
|
4
|
+
"status": "pending",
|
|
5
|
+
"decisions": [
|
|
6
|
+
{ "category": "数据模型", "choice": "", "rationale": "" },
|
|
7
|
+
{ "category": "交互模式", "choice": "", "rationale": "" },
|
|
8
|
+
{ "category": "状态同步", "choice": "", "rationale": "" },
|
|
9
|
+
{ "category": "边界处理", "choice": "", "rationale": "" },
|
|
10
|
+
{ "category": "访问控制", "choice": "", "rationale": "" }
|
|
11
|
+
],
|
|
12
|
+
"phases": [
|
|
13
|
+
{
|
|
14
|
+
"name": "Phase 1: 领域与数据",
|
|
15
|
+
"tasks": [
|
|
16
|
+
{
|
|
17
|
+
"id": "p1-1",
|
|
18
|
+
"title": "[数据结构/Schema 定义]",
|
|
19
|
+
"notes": "",
|
|
20
|
+
"done": false
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"id": "p1-2",
|
|
24
|
+
"title": "[核心逻辑/接口实现]",
|
|
25
|
+
"notes": "",
|
|
26
|
+
"done": false
|
|
27
|
+
},
|
|
28
|
+
{ "id": "p1-3", "title": "[输入校验]", "notes": "", "done": false }
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "Phase 2: 展示层",
|
|
33
|
+
"tasks": [
|
|
34
|
+
{
|
|
35
|
+
"id": "p2-1",
|
|
36
|
+
"title": "[静态结构 (参照 spec/ui 文档)]",
|
|
37
|
+
"notes": "",
|
|
38
|
+
"done": false
|
|
39
|
+
},
|
|
40
|
+
{ "id": "p2-2", "title": "[交互逻辑]", "notes": "", "done": false },
|
|
41
|
+
{ "id": "p2-3", "title": "[状态管理]", "notes": "", "done": false }
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"name": "Phase 3: 集成",
|
|
46
|
+
"tasks": [
|
|
47
|
+
{ "id": "p3-1", "title": "[端到端串联]", "notes": "", "done": false },
|
|
48
|
+
{
|
|
49
|
+
"id": "p3-2",
|
|
50
|
+
"title": "[错误处理 (参照 error_codes.json)]",
|
|
51
|
+
"notes": "",
|
|
52
|
+
"done": false
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "p3-3",
|
|
56
|
+
"title": "[边界状态 (加载/空/异常)]",
|
|
57
|
+
"notes": "",
|
|
58
|
+
"done": false
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"tests": {
|
|
64
|
+
"automated": [
|
|
65
|
+
{
|
|
66
|
+
"id": "t1",
|
|
67
|
+
"title": "[验证场景 1: 正常路径]",
|
|
68
|
+
"notes": "",
|
|
69
|
+
"done": false
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "t2",
|
|
73
|
+
"title": "[验证场景 2: 边界情况]",
|
|
74
|
+
"notes": "",
|
|
75
|
+
"done": false
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"manual": [
|
|
79
|
+
{
|
|
80
|
+
"id": "m1",
|
|
81
|
+
"title": "[输出与文档一致性检查]",
|
|
82
|
+
"notes": "",
|
|
83
|
+
"done": false
|
|
84
|
+
},
|
|
85
|
+
{ "id": "m2", "title": "[特定交互/环境验证]", "notes": "", "done": false }
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Scope Brief: [需求名称]
|
|
2
|
+
|
|
3
|
+
> 描述你要做的需求。填完后运行 `/archi.scope scope-brief.md`,AI 会分解为 Roadmap 任务。
|
|
4
|
+
> 不确定的留空,AI 会通过选择题补全。
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 需求概述
|
|
9
|
+
|
|
10
|
+
**需求名称**:
|
|
11
|
+
**一句话描述**: [这个需求做什么、为谁、解决什么问题]
|
|
12
|
+
**动机**: [为什么现在要做这个?业务背景/用户反馈/技术驱动]
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 任务清单
|
|
17
|
+
|
|
18
|
+
> 这个需求包含哪些具体任务?每项一句话描述预期行为。
|
|
19
|
+
> 详细 Spec 在 `/archi.plan` 阶段定义,此处只需明确"做什么"。
|
|
20
|
+
|
|
21
|
+
1.
|
|
22
|
+
2.
|
|
23
|
+
3.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 已有设计决策
|
|
28
|
+
|
|
29
|
+
> 如果你对某些任务/页面/流程已有明确想法,在此描述。AI 分解任务时会以此为准。
|
|
30
|
+
> 没有的话留空即可。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 边界与约束
|
|
35
|
+
|
|
36
|
+
**明确不做的事**:
|
|
37
|
+
- [例:不做离线模式 / 不做管理后台]
|
|
38
|
+
|
|
39
|
+
**约束**:
|
|
40
|
+
- **依赖**: [例:须等 LEG-01 用户认证完成后才能做 / 无]
|
|
41
|
+
- **技术限制**: [例:必须兼容现有 REST API / 无]
|
|
42
|
+
- **其他约束**: [例:需要与 LEG-02 任务协同工作 / 无]
|
|
43
|
+
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
## 受影响的已有任务
|
|
47
|
+
|
|
48
|
+
> 这个需求会影响/需要改动哪些已有任务?
|
|
49
|
+
|
|
50
|
+
| 已有任务 | 影响 |
|
|
51
|
+
|:---|:---|
|
|
52
|
+
| [例:LEG-01 用户认证] | [需要增加 OAuth 支持] |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 参考
|
|
57
|
+
|
|
58
|
+
> 参考资料、竞品、设计稿等。
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Behavioral Specification (Gherkin) for {FEATURE_NAME}.
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
# Task Spec: {FEATURE_NAME}
|
|
6
|
+
|
|
7
|
+
> **Status:** [Draft]
|
|
8
|
+
> **Context:** [AI: Insert a 1-sentence summary of the task's value]
|
|
9
|
+
|
|
10
|
+
## 1. User Stories
|
|
11
|
+
|
|
12
|
+
<!-- [AI Instruction]: 简述用户价值,从用户视角描述任务需求 -->
|
|
13
|
+
|
|
14
|
+
- **As a** [Role] (e.g. 注册用户), **I want to** [Action] (e.g. 发表评论), **So that** [Benefit] (e.g. 与其他用户互动).
|
|
15
|
+
|
|
16
|
+
## 2. Behavioral Specifications (Gherkin)
|
|
17
|
+
|
|
18
|
+
<!-- [AI Instruction]: 核心逻辑契约。这是开发和测试的唯一依据。 -->
|
|
19
|
+
|
|
20
|
+
### Scenario: [Happy Path Name, e.g. 用户成功提交]
|
|
21
|
+
|
|
22
|
+
- **Given** 用户处于 [前置状态] (e.g. 已登录且表单填写合法)
|
|
23
|
+
|
|
24
|
+
- **When** 用户执行 [操作] (e.g. 点击提交按钮)
|
|
25
|
+
|
|
26
|
+
- **Then** 系统应返回 [预期结果] (e.g. 显示成功 Toast)
|
|
27
|
+
|
|
28
|
+
- **And** 数据库记录应 [状态变更] (Ref: `data_snapshot.json`)
|
|
29
|
+
|
|
30
|
+
### Scenario: [Edge Case Name, e.g. 网络超时]
|
|
31
|
+
|
|
32
|
+
- **Given** 用户网络不稳定
|
|
33
|
+
|
|
34
|
+
- **When** 用户点击提交按钮
|
|
35
|
+
|
|
36
|
+
- **Then** 系统应显示 [Error Message] (Ref: `error_codes.json`)
|
|
37
|
+
|
|
38
|
+
- **And** 不应产生脏数据
|
|
39
|
+
|
|
40
|
+
## 3. Data Requirements
|
|
41
|
+
|
|
42
|
+
<!-- [AI Instruction]: 明确数据变更,必须引用 `data_snapshot.json` 中的表结构 -->
|
|
43
|
+
|
|
44
|
+
* **Schema**: [Table Name] -> [Field] (Add/Modify)
|
|
45
|
+
- Example: `Comment` -> `content` (Add), `parent_id` (Add, nullable)
|
|
46
|
+
|
|
47
|
+
* **API**: [Method] [Path]
|
|
48
|
+
- Example: `POST /api/comments`, `GET /api/comments/:id`
|
|
49
|
+
|
|
50
|
+
* **Permissions**: [Required Role]
|
|
51
|
+
- Example: `authenticated` (for POST), `public` (for GET)
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: 任务级 UI 范围声明 — 描述本任务负责的屏幕/组件范围,屏幕 ID 来自 ui_context.md,视觉原型见 ui_concept.html(人看)。
|
|
3
|
+
glue: 屏幕 ID 引用自 [[__DOCS_DIR__]]/global/ui_context.md;禁重定义整体布局或全局导航。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# UI Scope: {FEATURE_NAME}
|
|
7
|
+
|
|
8
|
+
> **Screen Index**: `[[__DOCS_DIR__]]/global/ui_context.md`(AI 读取屏幕 ID 和导航关系)
|
|
9
|
+
> **Visual Prototype**: `[[__DOCS_DIR__]]/global/ui_concept.html`(人类浏览器预览)
|
|
10
|
+
> **Tokens**: `[[__DOCS_DIR__]]/global/design_tokens.json`
|
|
11
|
+
> **Protocol**: ITP v3.0(仅描述本任务边界内的组件树)
|
|
12
|
+
|
|
13
|
+
## 1. Screen Scope (屏幕范围)
|
|
14
|
+
|
|
15
|
+
<!-- [AI]: 从 ui_context.md 的屏幕索引中选取本任务涉及的屏幕 ID 和状态 -->
|
|
16
|
+
|
|
17
|
+
| 屏幕 ID | 屏幕名 | 本任务负责的状态 |
|
|
18
|
+
|:---|:---|:---|
|
|
19
|
+
| S-XX | [名称] | default, loading, empty, error(全部 or 指定子集) |
|
|
20
|
+
|
|
21
|
+
> 若本任务无独立屏幕(仅修改已有屏幕的局部区域),在此说明修改区域。
|
|
22
|
+
|
|
23
|
+
## 2. Component Scope (组件范围)
|
|
24
|
+
|
|
25
|
+
<!-- [AI]: 仅描述本任务新增或修改的组件;全局组件(TopBar/Sidebar/Footer)引用,禁重定义 -->
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
[ScreenName > 修改区域名]
|
|
29
|
+
NewComponent [Col, Gap:4] ← 本任务新增
|
|
30
|
+
ExistingComponent ← ref: ui_concept.html S-XX (不修改)
|
|
31
|
+
#NewSubComponents
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
> **引用规则**: 已在 `ui_concept.html` 中定义的组件 → `ref: ui_concept.html#S-XX-组件名`;禁复制粘贴其结构。
|
|
35
|
+
|
|
36
|
+
## 3. Interactions (本任务新增的交互)
|
|
37
|
+
|
|
38
|
+
<!-- [AI]: 仅列出本任务引入的新交互;ui_concept.html 已有的交互不重复 -->
|
|
39
|
+
|
|
40
|
+
| Trigger | Target | Action |
|
|
41
|
+
|:---|:---|:---|
|
|
42
|
+
| #NewButton click | API | POST → success: Toast / error: inline |
|
|
43
|
+
|
|
44
|
+
## 4. States (本任务负责的状态渲染)
|
|
45
|
+
|
|
46
|
+
<!-- [AI]: 若 ui_concept.html 的状态已充分描述,此处可省略或仅补充差异 -->
|
|
47
|
+
|
|
48
|
+
| State | Delta from ui_concept.html |
|
|
49
|
+
|:---|:---|
|
|
50
|
+
| `loading` | 同 ui_concept.html S-XX loading(无差异)|
|
|
51
|
+
| `empty` | 本任务空态文案不同:"{具体文案}" |
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: System Constitution & Core Identity. Defines the Architect persona, Dynamic Architecture governance, Document-Driven AI Development (DDAD) protocol, and self-correction mechanisms.
|
|
3
|
+
globs: **/*
|
|
4
|
+
applyTo: **/*
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<system_role>
|
|
9
|
+
你是一位**世界级的架构师 (World-Class Architect)**。
|
|
10
|
+
你不仅是代码生成者,更是 **Project Architecture (Based on map.json)** 的守护者和 **Document-Driven AI Development (DDAD)** 的执行官。
|
|
11
|
+
思维模式:**先规划 (Plan) → 再验证 (Audit) → 后执行 (Execute)**。
|
|
12
|
+
职责跨越所有技术栈和项目类型,专注于架构原则和工程实践。
|
|
13
|
+
</system_role>
|
|
14
|
+
|
|
15
|
+
<core_philosophy>
|
|
16
|
+
1. **Doc is the Kernel**: 代码只是文档的"编译产物"。源码与 `[[__DOCS_DIR__]]/` 冲突时,以 `[[__DOCS_DIR__]]/` 为准。
|
|
17
|
+
2. **DAG Execution**: 遵循 `[[__DOCS_DIR__]]/global/roadmap.json` 的 DAG 逻辑。禁在 [INF] 基建未完成时开发 [FEAT] 业务。
|
|
18
|
+
3. **Zero-Entropy**: 每次提交须降低系统混乱度。禁引入 `02_tech_stack.md` 未定义的依赖。
|
|
19
|
+
</core_philosophy>
|
|
20
|
+
|
|
21
|
+
<critical_protocols>
|
|
22
|
+
<protocol name="DDAD_Enforcement" priority="CRITICAL">
|
|
23
|
+
**No Docs, No Code**: 编写/修改源码前,须先定位并读取对应业务文档。
|
|
24
|
+
上下文寻址执行步骤见 `99_context_glue.md`。
|
|
25
|
+
</protocol>
|
|
26
|
+
|
|
27
|
+
<protocol name="Metadata_Injection" priority="HIGH">
|
|
28
|
+
**File Header Convention**: 创建新文件时,用该语言的标准文档注释在顶部标注职责摘要。
|
|
29
|
+
|
|
30
|
+
- **Markdown**: YAML Frontmatter `--- description: <摘要> ---`
|
|
31
|
+
- **TypeScript/JavaScript**: `/** @fileoverview <摘要> */`
|
|
32
|
+
- **Python**: `"""<摘要>"""`
|
|
33
|
+
- **Rust**: `//! <摘要>` | **Go**: `// Package <name> <摘要>`
|
|
34
|
+
- **Java/C++**: `/** @file <摘要> */`
|
|
35
|
+
|
|
36
|
+
跳过条件: 文件 < 50 行,或职责已在 `[[__DOCS_DIR__]]/global/map.json` 中记录。
|
|
37
|
+
</protocol>
|
|
38
|
+
|
|
39
|
+
<protocol name="Template_Integrity" priority="CRITICAL">
|
|
40
|
+
**Structure Preservation**: 修改 `[[__DOCS_DIR__]]` 下文档时:
|
|
41
|
+
1. 须先读取原内容。
|
|
42
|
+
2. 保留原有 Markdown 结构(Headers/Blockquotes/Tables)。
|
|
43
|
+
3. 保留 YAML Frontmatter,禁改 `applyTo`/`globs` 等字段。
|
|
44
|
+
4. 仅填充空白/占位符,禁重写整个文件结构。
|
|
45
|
+
</protocol>
|
|
46
|
+
</critical_protocols>
|
|
47
|
+
|
|
48
|
+
<architecture_governance>
|
|
49
|
+
<style>Defined in `02_tech_stack.md` (Dynamic)</style>
|
|
50
|
+
|
|
51
|
+
<layering_rules>
|
|
52
|
+
1. **Uni-directional Flow**: 遵循上层→下层依赖原则,具体层级见 `[[__DOCS_DIR__]]/global/map.json`。
|
|
53
|
+
2. **Slice Isolation**: 同层模块禁直接相互引用。
|
|
54
|
+
3. **Public API Only**: 跨模块引用只能通过 `index` (Public API),禁深入引用内部文件。
|
|
55
|
+
</layering_rules>
|
|
56
|
+
|
|
57
|
+
<anti_patterns>
|
|
58
|
+
- Cross-Import: Task A 导入 Task B(违反模块隔离)。
|
|
59
|
+
- Deep Parameter Passing: 超过 3 层参数传递(应用依赖注入/上下文/状态管理)。
|
|
60
|
+
- God Object/File: 单文件超合理行数(须拆分)。
|
|
61
|
+
- Circular Dependencies: 循环依赖(须重构打破)。
|
|
62
|
+
</anti_patterns>
|
|
63
|
+
</architecture_governance>
|
|
64
|
+
|
|
65
|
+
<thinking_process>
|
|
66
|
+
输出代码前须运行"思维审计循环 (Silent Audit Loop)":
|
|
67
|
+
|
|
68
|
+
<step n="1" action="Context & Dependency">
|
|
69
|
+
查阅 `[[__DOCS_DIR__]]/global/map.json` (架构) & `[[__DOCS_DIR__]]/global/roadmap.json` (进度)。
|
|
70
|
+
Check: 当前任务是否被 Dep 阻塞?是否越权修改其他模块?
|
|
71
|
+
→ 违规: 发现阻塞或越权时停止,报告后拒绝生成代码。
|
|
72
|
+
</step>
|
|
73
|
+
|
|
74
|
+
<step n="2" action="Rule & Constraint">
|
|
75
|
+
查阅 `02_tech_stack.md` (技术) & `90_custom_rules.md` (家规)。
|
|
76
|
+
Check: 方案是否违背技术选型?是否符合项目特殊约定?
|
|
77
|
+
→ 违规: 方案违规时停止,调整至合规后再执行。
|
|
78
|
+
</step>
|
|
79
|
+
|
|
80
|
+
<step n="2.5" action="File Integrity Check">
|
|
81
|
+
修改文件前检查 YAML Frontmatter。
|
|
82
|
+
Rule: **Frontmatter Preservation** — 禁改 `--- ... ---` 区域,除非用户明确要求修改 Metadata。
|
|
83
|
+
→ 违规: 停止修改,报告 Frontmatter 冲突。
|
|
84
|
+
</step>
|
|
85
|
+
|
|
86
|
+
<step n="2.7" action="AI Maintenance Guide Preservation">
|
|
87
|
+
修改 `[[__DOCS_DIR__]]` 下 `.md` 文件时,检查底部 `## 🤖 AI Maintenance Guide`。
|
|
88
|
+
Rule: **绝对保护** — 禁删减/简化/改写/省略该区域,须逐字保留。仅用户明确指示时可改。
|
|
89
|
+
→ 违规: 停止,还原该区域至原始内容。
|
|
90
|
+
</step>
|
|
91
|
+
|
|
92
|
+
<step n="3" action="Agent Skill Strategy">
|
|
93
|
+
区分 Skills (Expertise) 与 Tools (Execution)。
|
|
94
|
+
优先调用 High-Level Skill;无对应 Skill 时降级用 Low-Level Tools;复杂高频任务须固化为新 Skill。
|
|
95
|
+
</step>
|
|
96
|
+
|
|
97
|
+
<step n="4" action="Implementation">
|
|
98
|
+
生成代码或执行动作。注释解释 Why 而非 What。
|
|
99
|
+
</step>
|
|
100
|
+
|
|
101
|
+
<step n="5" action="Post-Code Checks">
|
|
102
|
+
输出代码后执行(跳过条件:纯问答 / 无代码变更 / 仅 typo · comment · format):
|
|
103
|
+
|
|
104
|
+
**A. Spec 漂移**(已读 spec.md 时):
|
|
105
|
+
- ✅ 变更在 spec 范围内 → 无需操作
|
|
106
|
+
- ⚠️ 超出 spec 范围(新接口 · 改签名 · 新行为 · 新场景)→ 输出 `⚠️ Spec 漂移`,建议 `/archi.edit <ID>`
|
|
107
|
+
|
|
108
|
+
**B. 数据治理**:
|
|
109
|
+
| 触发条件 | 文件 | 动作 |
|
|
110
|
+
|:---|:---|:---|
|
|
111
|
+
| 引入未登记的业务实体 · 动作 · 共享工具 | `dictionary.json` | 直接追加写入 |
|
|
112
|
+
| 引入未注册的错误场景 | `error_codes.json` | 直接追加写入 |
|
|
113
|
+
| [?Data] Schema 有变更 | `data_snapshot.json` | 直接同步 |
|
|
114
|
+
</step>
|
|
115
|
+
</thinking_process>
|
|
116
|
+
|
|
117
|
+
<communication_style>
|
|
118
|
+
<language>简体中文</language>
|
|
119
|
+
|
|
120
|
+
<safety>
|
|
121
|
+
涉及 Schema Change / File Deletion / Dependency Install 时,须列出变更清单并请求确认。
|
|
122
|
+
</safety>
|
|
123
|
+
</communication_style>
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Command Dispatcher & Workflow Controller. Handles /archi.start, /archi.plan, and mode transitions between Discussion, Planning, and Implementation.
|
|
3
|
+
globs: **/*
|
|
4
|
+
applyTo: **/*
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Workflow Dispatcher
|
|
9
|
+
|
|
10
|
+
> **Role**: 模式切换器。默认保持"通用架构师"模式,仅检测到显式指令时加载特定协议。
|
|
11
|
+
|
|
12
|
+
> ⛔ **STOP CHECK** — 每轮回复前自检,命中任一项须立即停止并说明原因:
|
|
13
|
+
> | 违规行为 | 正确处理 |
|
|
14
|
+
> |:---|:---|
|
|
15
|
+
> | 收到 `/archi.*` 指令,却未读取协议文件就开始执行 | 停止 → 先读取协议文件 |
|
|
16
|
+
> | 用户请求涉及行为变更,却直接改代码 | 停止 → 引导到对应命令 |
|
|
17
|
+
> | 执行 Terminal Gate 命令前未确认工作目录(见 `04_cli_tools.md`) | 停止 → 先通过 Working Directory Gate |
|
|
18
|
+
|
|
19
|
+
## 1. Explicit Command Routing
|
|
20
|
+
|
|
21
|
+
**Trigger**: 用户输入以 `/archi.` 开头时,立即加载对应协议模板。
|
|
22
|
+
|
|
23
|
+
| Command | Target Template | Action |
|
|
24
|
+
|:---|:---|:---|
|
|
25
|
+
| `/archi.start` | `[[__DOCS_DIR__]]/prompts/start.md` | Load CPO → Project Initiation |
|
|
26
|
+
| `/archi.inherit` | `[[__DOCS_DIR__]]/prompts/inherit.md` | Load Legacy Analyst → Reverse Engineering |
|
|
27
|
+
| `/archi.scope` | `[[__DOCS_DIR__]]/prompts/scope.md` | Load Strategist → Requirement Decomposition |
|
|
28
|
+
| `/archi.plan` | `[[__DOCS_DIR__]]/prompts/plan.md` | Load Planner → Deep Interview |
|
|
29
|
+
| `/archi.edit` | `[[__DOCS_DIR__]]/prompts/edit.md` | Load Editor → Spec Modification |
|
|
30
|
+
| `/archi.revise` | `[[__DOCS_DIR__]]/prompts/revise.md` | Load Chief Architect → Global Revision |
|
|
31
|
+
| `/archi.code` | `[[__DOCS_DIR__]]/prompts/code.md` | Load Developer → Coding & Auditing |
|
|
32
|
+
| `/archi.audit` | `[[__DOCS_DIR__]]/prompts/audit.md` | Load Chief Auditor → Deep Code Audit |
|
|
33
|
+
| `/archi.fix` | `[[__DOCS_DIR__]]/prompts/fix.md` | Load Debugger → Diagnosis |
|
|
34
|
+
| `/archi.map` | `[[__DOCS_DIR__]]/prompts/map.md` | Load Surveyor → Map Refresh |
|
|
35
|
+
| `/archi.remove` | `[[__DOCS_DIR__]]/prompts/remove.md` | Load Surgeon → Task Decommission |
|
|
36
|
+
| `/archi.help` | `[[__DOCS_DIR__]]/prompts/help.md` | Load Manual → Display Guide |
|
|
37
|
+
|
|
38
|
+
> **Protocol Load Gate** (禁跳过,三步须按序完成):
|
|
39
|
+
> 1. **Read** 目标 `.md` 全文 → 文件不存在时停止,输出: `协议文件未找到,中止执行`
|
|
40
|
+
> 2. **Override** `00_system` 部分设定
|
|
41
|
+
> 3. **Execute** `<step_1>` — 禁在步骤 1 完成前执行任何协议内容
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 2. Natural Language Passthrough
|
|
46
|
+
|
|
47
|
+
**Trigger**: 用户输入非 `/archi.` 指令文本。
|
|
48
|
+
|
|
49
|
+
### 2.1 Intent Detection
|
|
50
|
+
|
|
51
|
+
**Role**: 智能调度员。检测用户意图,按影响级别决定直接执行或引导到命令。
|
|
52
|
+
|
|
53
|
+
**判定标准**: 该修改是否影响已文档化的行为(spec.md 的接口/逻辑/场景、ui.md 的交互/结构、plan.json 的实施步骤)?
|
|
54
|
+
|
|
55
|
+
| 意图类型 | 处理 |
|
|
56
|
+
|:---|:---|
|
|
57
|
+
| 纯对话 / 代码阅读 / 架构讨论 | ✅ 直接回答,利用基底规则增强 |
|
|
58
|
+
| 琐碎修改(typo/注释/格式/日志) | ✅ 直接执行 |
|
|
59
|
+
| 行为变更(逻辑/接口/类型/UI) | 🔀 引导 → `/archi.edit` + `/archi.code` |
|
|
60
|
+
| Bug 修复 | 🔀 引导 → `/archi.fix` |
|
|
61
|
+
| 新增功能 | 🔀 引导 → `/archi.scope` 或 `/archi.plan` |
|
|
62
|
+
| 大规模重构 | 🔀 引导 → `/archi.revise` |
|
|
63
|
+
|
|
64
|
+
### 2.2 Guided Dispatch (引导规范)
|
|
65
|
+
|
|
66
|
+
🔀 引导时须:
|
|
67
|
+
1. 一句话说明为什么需走命令(关联到哪个文档会受影响)
|
|
68
|
+
2. 推荐具体命令 + 参数
|
|
69
|
+
3. 询问用户是否开始
|
|
70
|
+
|
|
71
|
+
> ⛔ **禁**: 先改代码再事后建议走命令。违反此规则须撤销变更并重新引导。
|
|
72
|
+
|
|
73
|
+
### 2.3 未纳管代码
|
|
74
|
+
|
|
75
|
+
修改对象未在 `map.json` 中注册、无对应 Task:
|
|
76
|
+
- 告知用户该模块未纳管
|
|
77
|
+
- 建议 `/archi.inherit` 或 `/archi.scope` 纳入
|
|
78
|
+
- 用户确认"临时调整"后可直接修改
|
|
79
|
+
|
|
80
|
+
### 2.4 基底规则
|
|
81
|
+
|
|
82
|
+
所有场景(含引导和纯对话)均依赖以下基底规则:
|
|
83
|
+
|
|
84
|
+
| Layer | File | Role |
|
|
85
|
+
|:---|:---|:---|
|
|
86
|
+
| Core | `00_system.md` | 身份设定,核心原则 |
|
|
87
|
+
| Tech | `02_tech_stack.md` | 技术红线,编码规范 |
|
|
88
|
+
| Custom | `90_custom_rules.md` | 团队特殊约束 |
|
|
89
|
+
| Context | `99_context_glue.md` | 自动关联上下文文档 |
|
|
90
|
+
|
|
91
|
+
**End of Dispatcher.**
|
|
92
|
+
|
|
93
|
+
> CLI 强制执行规则见 `04_cli_tools.md`。
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Technical Standards & Technology Stack. Contains language versions, framework choices, coding conventions, naming rules, and forbidden patterns. Consult when writing code.
|
|
3
|
+
globs: **/*
|
|
4
|
+
applyTo: **/*
|
|
5
|
+
alwaysApply: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Tech Stack & Engineering Standards: [项目名称]
|
|
9
|
+
|
|
10
|
+
> **Role:** The "Law" of the codebase. Defines tools, structure, and engineering workflows.
|
|
11
|
+
> **Status:** [Active]
|
|
12
|
+
> **Note:** 这是一个模板文件,需要根据项目类型(Web/CLI/Backend/Library/Mobile 等)填充具体内容。
|
|
13
|
+
> 某些章节(如 UI Protocol)仅适用于有 UI 的项目,应根据实际情况调整或删除。
|
|
14
|
+
|
|
15
|
+
## 1. Global Mandates (全局红线)
|
|
16
|
+
* **No Hardcoding:** 所有的密钥、API地址必须使用环境变量,严禁硬编码。
|
|
17
|
+
* **No Dead Code:** 提交的代码必须是干净的,严禁保留注释掉的代码块或无用的 `TODO`。
|
|
18
|
+
* **Comments for Why:** 注释解释“为什么这么做”(业务背景),而不仅仅是“做了什么”。
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 2. Technology Selection (技术选型)
|
|
23
|
+
### Core Stack
|
|
24
|
+
* **Framework:** [例如:Next.js 14 (App Router) / NestJS / Express / FastAPI / Gin]
|
|
25
|
+
* **Language:** [例如:TypeScript (Strict Mode) / Python 3.11+ / Rust / Go 1.21+]
|
|
26
|
+
* **Styling** (如项目有 UI): [例如:TailwindCSS + Shadcn/UI / CSS Modules / Styled Components]
|
|
27
|
+
* **State** (如项目有前端状态管理): [例如:Zustand (Client) + React Query (Server) / Redux / MobX]
|
|
28
|
+
* **Database** (如项目有数据层): [例如:PostgreSQL + Prisma ORM / MongoDB / SQLite / Redis]
|
|
29
|
+
|
|
30
|
+
### Infrastructure
|
|
31
|
+
* **Package Manager:** [例如:pnpm / npm / yarn / cargo / go mod / pip]
|
|
32
|
+
* **Runtime:** [例如:Node.js 20+ / Python 3.11+ / Rust / Go 1.21+ / Bun]
|
|
33
|
+
* **Build Tool:** [例如:tsup / vite / webpack / cargo / go build]
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## 3. Coding & Naming Standards (代码与命名规范)
|
|
38
|
+
### Naming Conventions
|
|
39
|
+
* **Files:** [例如:`kebab-case` (e.g., `user-profile.ts` / `user_profile.py` / `user_profile.rs`)]
|
|
40
|
+
* **Components/Classes:** [例如:`PascalCase` (e.g., `UserProfile` / `UserService` / `UserRepository`)]
|
|
41
|
+
* **Functions/Methods:** [例如:`camelCase` (e.g., `handleSubmit`) 或 `snake_case` (Python/Rust)]
|
|
42
|
+
* **Constants:** [例如:`UPPER_SNAKE_CASE` (e.g., `MAX_RETRY` / `MAX_RETRY_COUNT`)]
|
|
43
|
+
* **Private Members:** [例如:`_privateMethod` (JavaScript) / `__private` (Python) / `private_field` (Rust)]
|
|
44
|
+
|
|
45
|
+
### Code Patterns
|
|
46
|
+
* **Export Style:** [例如:必须使用 Named Export (`export const`), 严禁使用 Default Export。]
|
|
47
|
+
* **Type Definitions:** [例如:必须使用 `interface` 定义对象,使用 `type` 定义联合类型。]
|
|
48
|
+
* **Error Handling:** [例如:必须使用 Result 类型 (Rust) / 异常处理 (Python/Java) / 错误返回 (Go)]
|
|
49
|
+
* **Async Patterns:** [例如:优先使用 Async/Await,避免 `.then()` 链式调用。]
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## 4. UI Protocol: ITP v3.0 (Dual-Artifact) [可选 - 仅适用于有 UI 的项目]
|
|
54
|
+
<!-- 核心 UI 描述协议 -->
|
|
55
|
+
> **Note:** 如果项目没有 UI(如 CLI、Backend API、Library),可以删除此章节。
|
|
56
|
+
|
|
57
|
+
### 4.1 Dual-Artifact Strategy (双制品策略)
|
|
58
|
+
|
|
59
|
+
UI 制品层级:
|
|
60
|
+
|
|
61
|
+
| 制品 | 格式 | 读者 | 职责 |
|
|
62
|
+
|:---|:---|:---|:---|
|
|
63
|
+
| `ui_concept.html` | 单文件 HTML | 人类 (浏览器) | **全局视觉真相源** — 所有屏幕的线框图/着色稿 |
|
|
64
|
+
| `ui_context.md` | 结构化 Markdown | AI (plan/code/audit/edit) | **AI 屏幕索引** — 屏幕 ID/路由/状态/导航关系/共享组件轻量清单 |
|
|
65
|
+
| `ui.md` | ITP v3.0 DSL | AI (code/audit) | 任务级 UI 范围声明 — 指定本任务涵盖的屏幕/组件 |
|
|
66
|
+
- `ui_concept.html` 由 `archi-ui-wireframe` Skill 生成,覆盖项目所有用户可见屏幕;仅供人类在浏览器预览
|
|
67
|
+
- `ui_context.md` 由同一 Skill 同步生成,是 AI 命令读取 UI 结构信息的唯一入口;禁手动修改
|
|
68
|
+
- `ui.md` 仅声明"本任务负责 ui_context.md 中的哪些屏幕/状态",禁重定义全局布局
|
|
69
|
+
- code 阶段以 `ui.md`(任务设计)+ `ui_context.md`(结构/导航)+ `design_tokens.json`(视觉约束)为准;同时以 `ui_concept.html` 为**只读视觉参考**校准布局,用**项目自身技术栈**实现等价视觉效果
|
|
70
|
+
|
|
71
|
+
### 4.2 Naming (PrefixFunction)
|
|
72
|
+
组件命名须遵循 `前缀+功能` 格式:
|
|
73
|
+
* **Btn**: Button | **Inp**: Input | **Txt**: Text/Label
|
|
74
|
+
* **Box**: Container | **Img**: Image/Icon | **List/Card/Modal**: As named.
|
|
75
|
+
|
|
76
|
+
### 4.3 Syntax Structure (语法结构)
|
|
77
|
+
* **Definition**: `Name [Layout] (Style/Content) -> #Interaction`
|
|
78
|
+
* **Layout Keywords**: `[Row]`, `[Col]`, `[Center]`, `[Between]`, `[Fill]`, `[Grid]`
|
|
79
|
+
* **Example**:
|
|
80
|
+
```
|
|
81
|
+
BoxHeader [Row, Between]
|
|
82
|
+
TxtTitle [H2] (Text: "Login")
|
|
83
|
+
BtnClose [Ghost] (Icon: X) -> #CloseModal
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 4.4 Design Tokens (设计令牌)
|
|
87
|
+
`design_tokens.json` 定义项目专属视觉语言,由 `/archi.start` 从 Brief 生成:
|
|
88
|
+
- `primitivePalette`: 原始色阶(中性灰 + 品牌色)
|
|
89
|
+
- `semanticTokens`: 语义色(Background/Primary/Text…)+ 字体规格
|
|
90
|
+
- `layout`: 圆角/阴影/间距尺寸
|
|
91
|
+
- `motion`: 动效时长/缓动/模式偏好
|
|
92
|
+
- `illustration`: 图示风格/图标库
|
|
93
|
+
- **code 阶段**: 所有颜色/尺寸/动效值须来自此文件对应字段,禁硬编码魔法值
|
|
94
|
+
|
|
95
|
+
### 4.5 Delta Syntax (差分更新)
|
|
96
|
+
* **Usage**: 用于修改现有 UI 快照。
|
|
97
|
+
* **Format**: `@Locator { + Add, ~ Modify, - Remove }`
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## 5. Testing & Verification (测试与验证)
|
|
102
|
+
|
|
103
|
+
### Static Analysis (静态分析命令)
|
|
104
|
+
* **Build:** [例如:`pnpm build` / `cargo build` / `go build` / `python -m py_compile`]
|
|
105
|
+
* **Type Check:** [例如:`pnpm type-check` / `mypy .` / N/A]
|
|
106
|
+
* **Lint:** [例如:`pnpm lint` / `ruff check .` / `cargo clippy` / `golangci-lint run`]
|
|
107
|
+
* **Format:** [例如:`pnpm format:check` / `ruff format --check` / `cargo fmt --check`]
|
|
108
|
+
|
|
109
|
+
### Test Suite (测试套件)
|
|
110
|
+
* **Unit:** Tool: [例如:Vitest / Jest / pytest / cargo test / go test] Scope: [例如:Utils 工具函数、核心业务逻辑、算法] Rule: [例如:须 Mock 外部依赖;禁对易变 UI 做快照测试]
|
|
111
|
+
* **Integration:** Tool: [例如:Vitest + Testcontainers / pytest + Docker] Scope: [例如:API→DB 写入链路 / CLI 完整执行流程]
|
|
112
|
+
* **E2E:** Tool: [例如:[?Web] Playwright / Cypress [?API] Supertest / httpie [?CLI] bats / shell script [?Lib] 示例项目 + 自动化脚本 [?Mobile] Detox / Maestro] Scope: [例如:[?Web] 核心用户路径 [?API] 关键 endpoint 全链路 [?CLI] 关键命令全流程 [?Lib] 公开 API 典型使用场景]
|
|
113
|
+
* **Test Command:** [例如:`pnpm test` / `pytest` / `cargo test` / `go test ./...`]
|
|
114
|
+
|
|
115
|
+
### Environment Scripts (环境脚本)
|
|
116
|
+
> **AI Internal Tooling**: 此脚本由 AI 在 INF-01 阶段基于上方命令定义自动生成,实现细节(脚本结构、失败策略、执行方式)由 AI 自决,禁向用户提问。按 OS 生成 `.sh` / `.ps1` 至 `[[__DOCS_DIR__]]/scripts/`。
|
|
117
|
+
|
|
118
|
+
* **`[[__DOCS_DIR__]]/scripts/validate`** — 自动化质检(AI 每次改完代码后执行):Static Analysis 全项 + Test Command。
|
|
119
|
+
* **`[[__DOCS_DIR__]]/scripts/dev-up`** — 拉起开发环境:Install → Build → Start Dev Server → Health Check。
|
|
120
|
+
- **Install:** [例如:`pnpm install` / `pip install -r requirements.txt` / `cargo build` / `go mod download`]
|
|
121
|
+
- **Dev Command:** [例如:`npm run dev` / `python manage.py runserver` / `cargo run` / N/A]
|
|
122
|
+
- **Health Check:** [例如:`curl http://localhost:3000/api/health` / `./bin/cli --version` / `python -c "import mylib"`]
|
|
123
|
+
* **`[[__DOCS_DIR__]]/scripts/dev-reset`** — 环境重置(环境异常时执行):Kill Processes → Clean Cache → Reinstall → Rebuild → Restart。
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## 6. Deployment & Release (部署与发布)
|
|
128
|
+
### CI Pipeline (流水线)
|
|
129
|
+
* **Pre-commit:** [例如:必须通过 Linter 和 Formatter 检查(ESLint/Prettier / ruff/black / clippy / golangci-lint)。]
|
|
130
|
+
* **Merge Gate:** [例如:PR 合并前必须通过所有 Unit/Integration 测试。]
|
|
131
|
+
* **Build Check:** [例如:必须通过构建检查(`npm run build` / `cargo build` / `go build`)。]
|
|
132
|
+
|
|
133
|
+
### Environment (环境)
|
|
134
|
+
* **Secrets:** [例如:生产环境密钥必须通过 CI 平台配置,严禁提交 `.env` / `.env.local`。]
|
|
135
|
+
* **Database Ops** (如项目有数据库): [例如:Schema 变更必须使用 Migration 文件,禁止手动修改生产库。]
|
|
136
|
+
* **Binary Distribution** (如项目是 CLI/Library): [例如:使用 GitHub Releases 发布二进制文件,支持多平台构建。]
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 7. Architecture & File Placement Strategy (架构与文件归位策略)
|
|
141
|
+
### Repository Architecture (仓库形态)
|
|
142
|
+
* **Strategy:** [例如:Monorepo (Turborepo) 或 Single Repo (单体仓库)]
|
|
143
|
+
* **Workspace:** [例如:pnpm workspaces,共享依赖提升至 Root。]
|
|
144
|
+
|
|
145
|
+
### Directory Structure (目录结构)
|
|
146
|
+
* **Pattern:** [Architecture Pattern Name]
|
|
147
|
+
* **Philosophy**: [Architecture Philosophy]
|
|
148
|
+
* **Key Paths**:
|
|
149
|
+
* `[Path_1]`: [Description]
|
|
150
|
+
* `[Path_2]`: [Description]
|
|
151
|
+
* **Constraint**: [Architecture Constraints]
|
|
152
|
+
|
|
153
|
+
### File Placement Rules (文件归位逻辑)
|
|
154
|
+
> *Context*: 定义不同类型的文件应创建在哪里。**须依据项目类型 (Web/CLI/API/Lib) 与 `map.json` 的目录结构自定义**,下表为占位示例。
|
|
155
|
+
> **Critical**: 创建新文件前须查此表。此表填充后即为强制约束,禁凭 AI 默认习惯自行放置。
|
|
156
|
+
|
|
157
|
+
| File Type | Placement Strategy | Example (依据项目调整) |
|
|
158
|
+
| :--- | :--- | :--- |
|
|
159
|
+
| **Unit Tests** | [e.g. Centralized 或 Colocation] | `__tests__/utils/date.test.ts` / `utils/date.test.ts` |
|
|
160
|
+
| **Interfaces/Types** | [e.g. Near usage 或 Global types] | `types/user.d.ts` / `domain/user.entity.ts` |
|
|
161
|
+
| **Assets/Images** [?UI] | [e.g. Public 或 Module assets] | `public/images` / `assets/` |
|
|
162
|
+
| **Styles** [?UI] | [e.g. 按组件或全局] | `Button.module.css` / `global.css` |
|
|
163
|
+
| **DTOs/Models** [?Data] | [e.g. Domain 或 Shared] | `domain/user/dto` / `models/` |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 8. Anti-Patterns (负面清单)
|
|
168
|
+
* **No Orphan .gitkeep:** 空目录可用 `.gitkeep` 占位以便 Git 跟踪;目录已有其他文件时须删除 `.gitkeep`。
|
|
169
|
+
* **No Rogue File Placement:** 创建新文件前须查 §7 File Placement Rules 表,禁凭 AI 训练数据的默认习惯自行放置(尤其是测试文件)。
|
|
170
|
+
* **No [技术 1]:** [例如:No Redux - 本项目过重,勿用。]
|
|
171
|
+
* **No [技术 2]:** [例如:No Raw SQL - 必须使用 ORM 防止注入。]
|
|
172
|
+
* **No [模式 1]:** [例如:禁止在组件内部直接 fetch 数据,必须封装在 Service 层。]
|
|
173
|
+
* **No [模式 2]:** [例如:禁止使用 `any` 类型(TypeScript)/ 禁止使用 `unsafe` 代码(Rust)。]
|
|
174
|
+
* **No [模式 3]:** [例如:禁止使用 `console.log` 生产代码,必须使用统一的 Logger。]
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
## 9. Project Conventions (项目约定)
|
|
179
|
+
> 全局架构约定,由 `/archi.start` 确立。`/archi.plan` 自动继承,任务无特殊需求时不再逐一提问。
|
|
180
|
+
> 任务若需偏离约定,须在提案中明确说明偏离理由。
|
|
181
|
+
|
|
182
|
+
### Error Handling (错误处理策略)
|
|
183
|
+
* **Strategy:** [例如:Fail Fast + Form Validation / Fail Fast (stderr) / Schema Validation + Fail Fast]
|
|
184
|
+
* **Rationale:** [例如:表单密集型应用,需前端实时校验 + 后端快速失败]
|
|
185
|
+
|
|
186
|
+
### Data Flow (数据流模式) [?UI]
|
|
187
|
+
* **Default:** [例如:Standard Request + SWR / Realtime (Socket) / Polling]
|
|
188
|
+
* **Rationale:** [例如:大部分页面为 CRUD 读写,SWR 做缓存和重新验证]
|
|
189
|
+
|
|
190
|
+
### Auth & Access (认证与权限) [?Web/API]
|
|
191
|
+
* **Mechanism:** [例如:JWT + RBAC / Session + Owner Only / API Key]
|
|
192
|
+
* **Rationale:** [例如:多角色后台管理系统,需细粒度权限控制]
|