architext 0.0.3 → 0.0.5
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 +56 -1
- package/README.md +94 -12
- package/README.zh-CN.md +94 -12
- package/dist/index.js +43 -39
- package/dist/templates/en/briefs/_base.md +44 -11
- package/dist/templates/en/briefs/_modules.md +31 -4
- package/dist/templates/en/docs/global/api_snapshot.json +24 -0
- package/dist/templates/en/docs/global/command_api.json +26 -0
- package/dist/templates/en/docs/global/env_registry.json +12 -0
- package/dist/templates/en/docs/global/map.json +5 -0
- package/dist/templates/en/docs/global/public_api.json +12 -0
- package/dist/templates/en/docs/prompts/audit.md +80 -94
- package/dist/templates/en/docs/prompts/code.md +100 -109
- package/dist/templates/en/docs/prompts/edit.md +52 -47
- package/dist/templates/en/docs/prompts/fix.md +49 -42
- package/dist/templates/en/docs/prompts/help.md +23 -31
- package/dist/templates/en/docs/prompts/inherit.md +110 -116
- package/dist/templates/en/docs/prompts/map.md +47 -69
- package/dist/templates/en/docs/prompts/plan.md +160 -171
- package/dist/templates/en/docs/prompts/recover.md +48 -0
- package/dist/templates/en/docs/prompts/ref.md +163 -0
- package/dist/templates/en/docs/prompts/remove.md +55 -107
- package/dist/templates/en/docs/prompts/revise.md +63 -106
- package/dist/templates/en/docs/prompts/scope.md +77 -117
- package/dist/templates/en/docs/prompts/start.md +93 -139
- package/dist/templates/en/docs/shared/verify-result-handling.md +6 -0
- package/dist/templates/en/docs/templates/design.template.md +77 -0
- package/dist/templates/en/docs/templates/spec.template.md +60 -25
- package/dist/templates/en/rules/00_system.md +36 -79
- package/dist/templates/en/rules/01_workflow.md +59 -57
- package/dist/templates/en/rules/03_data_governance.md +46 -42
- package/dist/templates/en/skills/archi-data-sync/SKILL.md +83 -0
- package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +166 -151
- package/dist/templates/en/skills/archi-design-patterns/SKILL.md +140 -0
- package/dist/templates/en/skills/archi-feature-relations/SKILL.md +118 -0
- package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +2 -1
- package/dist/templates/en/skills/archi-plan-options/SKILL.md +4 -3
- package/dist/templates/en/skills/archi-silent-audit/SKILL.md +118 -0
- package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
- package/dist/templates/zh/briefs/_base.md +46 -14
- package/dist/templates/zh/briefs/_modules.md +29 -2
- package/dist/templates/zh/docs/global/api_snapshot.json +24 -0
- package/dist/templates/zh/docs/global/command_api.json +26 -0
- package/dist/templates/zh/docs/global/data_snapshot.json +0 -1
- package/dist/templates/zh/docs/global/design_tokens.json +0 -1
- package/dist/templates/zh/docs/global/dictionary.json +1 -1
- package/dist/templates/zh/docs/global/env_registry.json +12 -0
- package/dist/templates/zh/docs/global/error_codes.json +0 -8
- package/dist/templates/zh/docs/global/map.json +28 -3
- package/dist/templates/zh/docs/global/public_api.json +12 -0
- package/dist/templates/zh/docs/global/vision.md +1 -1
- package/dist/templates/zh/docs/prompts/audit.md +43 -57
- package/dist/templates/zh/docs/prompts/code.md +68 -77
- package/dist/templates/zh/docs/prompts/edit.md +44 -39
- package/dist/templates/zh/docs/prompts/fix.md +33 -26
- package/dist/templates/zh/docs/prompts/help.md +13 -21
- package/dist/templates/zh/docs/prompts/inherit.md +81 -87
- package/dist/templates/zh/docs/prompts/map.md +23 -45
- package/dist/templates/zh/docs/prompts/plan.md +134 -146
- package/dist/templates/zh/docs/prompts/recover.md +48 -0
- package/dist/templates/zh/docs/prompts/ref.md +163 -0
- package/dist/templates/zh/docs/prompts/remove.md +31 -83
- package/dist/templates/zh/docs/prompts/revise.md +43 -84
- package/dist/templates/zh/docs/prompts/scope.md +53 -93
- package/dist/templates/zh/docs/prompts/start.md +75 -121
- package/dist/templates/zh/docs/shared/verify-result-handling.md +6 -0
- package/dist/templates/zh/docs/templates/design.template.md +77 -0
- package/dist/templates/zh/docs/templates/spec.template.md +60 -25
- package/dist/templates/zh/rules/00_system.md +37 -80
- package/dist/templates/zh/rules/01_workflow.md +60 -58
- package/dist/templates/zh/rules/02_tech_stack.md +7 -6
- package/dist/templates/zh/rules/03_data_governance.md +43 -39
- package/dist/templates/zh/rules/99_context_glue.md +2 -2
- package/dist/templates/zh/skills/archi-data-sync/SKILL.md +83 -0
- package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +70 -56
- package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +140 -0
- package/dist/templates/zh/skills/archi-feature-relations/SKILL.md +118 -0
- package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
- package/dist/templates/zh/skills/archi-plan-options/SKILL.md +26 -25
- package/dist/templates/zh/skills/archi-silent-audit/SKILL.md +118 -0
- package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
- package/package.json +1 -1
- package/dist/templates/zh-Hant/briefs/_base.md +0 -115
- package/dist/templates/zh-Hant/briefs/_modules.md +0 -173
- package/dist/templates/zh-Hant/docs/global/data_snapshot.json +0 -31
- package/dist/templates/zh-Hant/docs/global/design_tokens.json +0 -135
- package/dist/templates/zh-Hant/docs/global/dictionary.json +0 -35
- package/dist/templates/zh-Hant/docs/global/error_codes.json +0 -19
- package/dist/templates/zh-Hant/docs/global/map.json +0 -94
- package/dist/templates/zh-Hant/docs/global/roadmap.json +0 -39
- package/dist/templates/zh-Hant/docs/global/vision.md +0 -82
- package/dist/templates/zh-Hant/docs/prompts/audit.md +0 -150
- package/dist/templates/zh-Hant/docs/prompts/code.md +0 -160
- package/dist/templates/zh-Hant/docs/prompts/edit.md +0 -87
- package/dist/templates/zh-Hant/docs/prompts/fix.md +0 -86
- package/dist/templates/zh-Hant/docs/prompts/help.md +0 -69
- package/dist/templates/zh-Hant/docs/prompts/inherit.md +0 -270
- package/dist/templates/zh-Hant/docs/prompts/map.md +0 -131
- package/dist/templates/zh-Hant/docs/prompts/plan.md +0 -252
- package/dist/templates/zh-Hant/docs/prompts/remove.md +0 -162
- package/dist/templates/zh-Hant/docs/prompts/revise.md +0 -160
- package/dist/templates/zh-Hant/docs/prompts/scope.md +0 -198
- package/dist/templates/zh-Hant/docs/prompts/start.md +0 -258
- package/dist/templates/zh-Hant/docs/templates/plan.template.json +0 -88
- package/dist/templates/zh-Hant/docs/templates/scope-brief.template.md +0 -58
- package/dist/templates/zh-Hant/docs/templates/spec.template.md +0 -51
- package/dist/templates/zh-Hant/docs/templates/ui.template.md +0 -51
- package/dist/templates/zh-Hant/rules/00_system.md +0 -123
- package/dist/templates/zh-Hant/rules/01_workflow.md +0 -93
- package/dist/templates/zh-Hant/rules/02_tech_stack.md +0 -192
- package/dist/templates/zh-Hant/rules/03_data_governance.md +0 -102
- package/dist/templates/zh-Hant/rules/04_cli_tools.md +0 -50
- package/dist/templates/zh-Hant/rules/90_custom_rules.md +0 -21
- package/dist/templates/zh-Hant/rules/99_context_glue.md +0 -53
- package/dist/templates/zh-Hant/skills/archi-decompose-roadmap/SKILL.md +0 -293
- package/dist/templates/zh-Hant/skills/archi-interview-protocol/SKILL.md +0 -86
- package/dist/templates/zh-Hant/skills/archi-plan-options/SKILL.md +0 -364
- package/dist/templates/zh-Hant/skills/archi-ui-wireframe/SKILL.md +0 -337
|
@@ -1,93 +0,0 @@
|
|
|
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`。
|
|
@@ -1,192 +0,0 @@
|
|
|
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:** [例如:多角色後台管理系統,需細粒度權限控制]
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: JSON 資料檔案的 AI 協作治理規則。定義全域資料檔案的讀寫規範、更新時機與格式約束。
|
|
3
|
-
globs: "**/*.json"
|
|
4
|
-
applyTo: "**/*.json"
|
|
5
|
-
alwaysApply: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Data Governance Protocol
|
|
9
|
-
|
|
10
|
-
> **Role**: 資料管家。確保全域 JSON 資料檔案的一致性、完整性與可追溯性。
|
|
11
|
-
|
|
12
|
-
## 1. 資料檔案清單
|
|
13
|
-
|
|
14
|
-
| 檔案 | 型別 | 讀取時機 | 寫入時機 |
|
|
15
|
-
|:---|:---|:---|:---|
|
|
16
|
-
| `roadmap.json` | 路線圖 | `/archi.plan`, `/archi.code` 開始時 | `/archi.start` 建立; AI 直接編輯或 `npx archi task` 更新狀態 |
|
|
17
|
-
| `map.json` | 架構地圖 | 觸碰程式碼時 (via context_glue) | `/archi.plan` Step 3 (全域同步); `/archi.inherit` Step 3.6; `/archi.map` |
|
|
18
|
-
| `dictionary.json` | 術語字典 | 生成變數名稱時 | `/archi.plan` Step 3; code/fix 後 step_5 自動追加 |
|
|
19
|
-
| `design_tokens.json` | 設計令牌 [?UI] | 生成 UI 程式碼時 | `/archi.start` 建立; 設計變更時更新 |
|
|
20
|
-
| `data_snapshot.json` | 資料快照 [?Data] | `/archi.plan` Q1 設計; `/archi.code` 實作時 | Plan 階段設計 Schema; Code 階段同步實際變更 |
|
|
21
|
-
| `error_codes.json` | 錯誤碼契約 | 撰寫錯誤處理時 | `/archi.plan` Step 3; code/fix 後 step_5 自動追加 |
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
## 2. 通用規則
|
|
26
|
-
|
|
27
|
-
### 2.1 格式約束
|
|
28
|
-
|
|
29
|
-
- **JSON Only**: 全域資料的唯一真理源是 `.json` 檔案。`.md` 視圖由 `npx archi render` 自動產生,禁直接編輯 `.md` 視圖。
|
|
30
|
-
- **Schema Stability**: 分兩檔管理:
|
|
31
|
-
- **Tier 1 (嚴格)**: `roadmap.json`, `plan.json` — CLI 渲染/命令直接依賴,結構由 Zod Schema 校驗,禁隨意變更欄位。
|
|
32
|
-
- **Tier 2 (寬鬆)**: `dictionary.json`, `error_codes.json`, `data_snapshot.json`, `design_tokens.json`, `map.json` — 僅校驗頂層 key 存在。若現有欄位無法充分描述需記錄的內容,可自行擴展欄位(新增 key 或在陣列 item 中新增屬性),無需修改 CLI。
|
|
33
|
-
- **Valid JSON**: 寫入後須保證合法 JSON (無尾逗號、無註解)。
|
|
34
|
-
|
|
35
|
-
### 2.2 讀寫紀律
|
|
36
|
-
|
|
37
|
-
| 情境 | 規則 |
|
|
38
|
-
|:---|:---|
|
|
39
|
-
| 需要查閱資料 | 讀取 `.json` 檔案,禁讀 `.md` 視圖 (可能過期) |
|
|
40
|
-
| 需要更新 Roadmap 任務狀態 | 優先使用 `npx archi task <ID> --status <s>`; 批次更新時可直接編輯 JSON |
|
|
41
|
-
| 需要更新其他資料檔案 | AI 直接編輯 `.json` 檔案 |
|
|
42
|
-
| 更新後 | 執行 `npx archi render` 重新產生 `.md` 視圖 |
|
|
43
|
-
|
|
44
|
-
---
|
|
45
|
-
|
|
46
|
-
## 3. 檔案專項規則
|
|
47
|
-
|
|
48
|
-
### `roadmap.json`
|
|
49
|
-
|
|
50
|
-
- **結構**: `phases[] → tasks[]`,每個 task 須有 `id`, `title`, `status`, `deps`。
|
|
51
|
-
- **Status 值**: `pending` | `active` | `done` | `blocked`。
|
|
52
|
-
- **依賴完整性**: `deps` 中引用的 ID 須存在於 tasks 中。
|
|
53
|
-
- **Slug 規則**: `slug` 用於 tasks 資料夾命名,格式為 `Snake_Case`。
|
|
54
|
-
|
|
55
|
-
### `map.json`
|
|
56
|
-
|
|
57
|
-
- **Directory Mapping**: 須反映真實實體檔案樹。
|
|
58
|
-
- **Logical Topology**: 須註冊每個 Task Module 的職責。
|
|
59
|
-
- **Feature Relations**(欄位 `featureRelations`): 記錄聚合型 Task 與其來源的聯動關係。每條結構為 `{ aggregator, sources, evidence, checkNote }`;由 AI 在 `/archi.plan`(規劃聚合型 Task 時)或 `/archi.inherit`(逆向掃描時)寫入,無需使用者手動維護。
|
|
60
|
-
- **自我校正**: 若程式碼引用違反拓撲定義的層級關係,須報錯並停止產生。
|
|
61
|
-
- **可擴展**: 若現有欄位不足以描述專案架構,可在 item 中自行新增欄位(如 `tags`、`owner`),或新增頂層 key。
|
|
62
|
-
|
|
63
|
-
### `dictionary.json`
|
|
64
|
-
|
|
65
|
-
- **命名權威**: 本檔案是命名的最高法律。
|
|
66
|
-
- **Boundary**: 僅註冊**專案業務域**內容。Architext 框架自身概念(scripts、scaffold、roadmap、plan 等)禁註冊。
|
|
67
|
-
- **entities**: 產生變數名稱前須查閱 `entities[].codeName`;禁使用 `forbiddenSynonyms` 中的詞。
|
|
68
|
-
- **verbs**: 業務動作命名須查閱 `verbs[].codeName`,保持全專案動詞一致。
|
|
69
|
-
- **utilities**: 封裝的共用工具(如 logger、AppError、fetchClient)須註冊;AI 須用已註冊工具替代原始 API(參照 `replaces` 欄位)。
|
|
70
|
-
- **components** [?UI]: 建立新元件前須搜尋現有元件,優先複用。
|
|
71
|
-
- **可擴展**: 若現有欄位不足以描述某個術語/工具,可在對應陣列 item 中自行新增欄位(如 `tags`、`scope`、`deprecated`),也可新增頂層陣列(如 `enums`、`constants`)。
|
|
72
|
-
|
|
73
|
-
### `design_tokens.json` [?UI]
|
|
74
|
-
|
|
75
|
-
- **Token Only**: 樣式嚴格使用 Token;禁硬編碼 Hex/px/rem。
|
|
76
|
-
- **Dark Mode**: 須同時定義 `light` 和 `dark` 值。
|
|
77
|
-
- **可擴展**: 若現有 Token 結構不足以覆蓋專案需求(如 `motion`、`breakpoints`、`z-index`),可自行新增屬性。
|
|
78
|
-
|
|
79
|
-
### `data_snapshot.json` [?Data]
|
|
80
|
-
|
|
81
|
-
- **結構**: `models[]`(名稱、欄位、型別、約束)+ `relationships[]`(模型間關係:1:1/1:N/M:N/self-ref)。
|
|
82
|
-
- **Design First**: Plan 階段須定義模型結構和欄位型別,禁寫 "TBD",須精確到欄位名與型別。
|
|
83
|
-
- **Sync Back**: Code 階段完成後,須將實際變更同步回此檔案。
|
|
84
|
-
- **可擴展**: 若現有欄位不足以描述資料模型(如需記錄 `indexes`、`triggers`、`seedData`),可在 model item 或頂層自行新增欄位。
|
|
85
|
-
|
|
86
|
-
### `error_codes.json`
|
|
87
|
-
|
|
88
|
-
- **Boundary**: 僅註冊**專案業務域**錯誤。框架基礎設施(scripts/validate、dev-up、dev-reset 等)的錯誤由腳本自身 exit code + stderr 處理,禁註冊到此檔案。
|
|
89
|
-
- **結構**: `protocolMapping [?API]`(狀態碼→行為映射)+ `businessErrors`(業務錯誤註冊表)。
|
|
90
|
-
- **Code Format**: `ERR_[MODULE]_[REASON]` (如 `ERR_AUTH_INVALID_TOKEN`)。
|
|
91
|
-
- **statusCode**: 按專案型別填寫(HTTP status / Exit code / 留空)。
|
|
92
|
-
- **Design Before Code**: 撰寫錯誤處理程式碼前須先在此註冊錯誤碼,含 `message` 和 `recovery`。
|
|
93
|
-
- **可擴展**: 若現有欄位不足以描述錯誤資訊(如需記錄 `severity`、`retryable`、`httpBody`),可在 item 中自行新增欄位。
|
|
94
|
-
|
|
95
|
-
---
|
|
96
|
-
|
|
97
|
-
## 4. Plan JSON (`plan.json`)
|
|
98
|
-
|
|
99
|
-
- **位置**: `tasks/<ID>_<Slug>/plan.json`
|
|
100
|
-
- **Checkbox 更新**: AI 在 `/archi.code` 中完成步驟後直接將 `done` 設為 `true`。
|
|
101
|
-
- **追加規則**: `/archi.edit` 追加新 Phase 時保留已完成歷史。
|
|
102
|
-
- **驗證**: 完成後執行 `npx archi plan <ID>` 驗證完成度。
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: CLI Reference Manual. Working directory rule and command syntax for npx archi task/plan/render.
|
|
3
|
-
globs: **/*
|
|
4
|
-
applyTo: **/*
|
|
5
|
-
alwaysApply: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# CLI Reference
|
|
9
|
-
|
|
10
|
-
> **Role**: 命令速查手冊。提供 `npx archi` 系列命令的語法與參數,供 Terminal Gate 執行時查閱。
|
|
11
|
-
|
|
12
|
-
## ⛔ Working Directory Gate
|
|
13
|
-
|
|
14
|
-
**執行任何 `npx archi` 命令前須通過此檢查,否則停止**:
|
|
15
|
-
|
|
16
|
-
| 檢查項 | 通過條件 |
|
|
17
|
-
|:---|:---|
|
|
18
|
-
| 當前目錄 | 須為專案根目錄(`[[__DOCS_DIR__]]/` 所在目錄) |
|
|
19
|
-
| 不確定時 | 先確認當前目錄,禁猜測 |
|
|
20
|
-
| 子目錄中 | 須 `cd` 到根目錄後再執行 |
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 命令語法
|
|
25
|
-
|
|
26
|
-
### `npx archi task`
|
|
27
|
-
|
|
28
|
-
| 子命令 | 用途 | 範例 |
|
|
29
|
-
|:---|:---|:---|
|
|
30
|
-
| `npx archi task` | 列出所有任務及進度 | `npx archi task` |
|
|
31
|
-
| `npx archi task <ID> --status <s>` | 更新任務狀態 | `npx archi task INF-001 --status done` |
|
|
32
|
-
| `npx archi task --check` | 檢查 Roadmap 一致性 | `npx archi task --check` |
|
|
33
|
-
|
|
34
|
-
**合法狀態值**: `pending` / `active` / `done` / `blocked`
|
|
35
|
-
|
|
36
|
-
### `npx archi plan`
|
|
37
|
-
|
|
38
|
-
| 子命令 | 用途 | 範例 |
|
|
39
|
-
|:---|:---|:---|
|
|
40
|
-
| `npx archi plan <ID>` | 檢查 Task 的 Plan 完成度 | `npx archi plan SUB-01` |
|
|
41
|
-
|
|
42
|
-
自動識別 Manual Verification 區域並排除在自動化統計外。
|
|
43
|
-
|
|
44
|
-
### `npx archi render`
|
|
45
|
-
|
|
46
|
-
| 子命令 | 用途 | 範例 |
|
|
47
|
-
|:---|:---|:---|
|
|
48
|
-
| `npx archi render` | 將所有 JSON 資料檔案渲染為人類可讀的 `.md` 視圖 | `npx archi render` |
|
|
49
|
-
|
|
50
|
-
> `.md` 視圖是自動產生的,禁直接編輯。修改須透過 `.json` 來源檔案進行。
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Project Specific Rules & Constraints. High-priority user overrides, team preferences, and business-specific invariants that supersede general defaults.
|
|
3
|
-
globs: **/*
|
|
4
|
-
applyTo: **/*
|
|
5
|
-
alwaysApply: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Custom Project Rules (用戶自定義規則)
|
|
9
|
-
|
|
10
|
-
> **Priority:** [High]
|
|
11
|
-
> **Role:** 本專案的「特殊家規」。當通用的 `02_tech_stack` 無法覆蓋某些細節,或有特殊業務約束時,以此文件為準。
|
|
12
|
-
|
|
13
|
-
## 1. Team Conventions (團隊習慣)
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
## 2. Business Constraints (業務硬約束)
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
## 3. Specific Anti-Patterns (本專案黑名單)
|
|
20
|
-
|
|
21
|
-
## 4. ...
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: Context Navigation & Document Indexing. Bridges source code to documentation using the Map registry. Essential for locating specs and plans.
|
|
3
|
-
globs: **/*
|
|
4
|
-
applyTo: **/*
|
|
5
|
-
alwaysApply: true
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# Context Glue Protocol
|
|
9
|
-
|
|
10
|
-
> **Role**: 上下文導航儀。防止 AI 失憶,透過查閱地圖 (Map Look-up) 確定程式碼對應的業務文件。
|
|
11
|
-
|
|
12
|
-
## 1. Context Discovery
|
|
13
|
-
|
|
14
|
-
讀取或編輯程式碼檔案時,須執行以下尋址步驟:
|
|
15
|
-
|
|
16
|
-
**Step 1: Check Global Map**
|
|
17
|
-
- 讀取 `[[__DOCS_DIR__]]/global/map.json`。
|
|
18
|
-
- 在 `directoryMapping` / `logicalTopology` 中查找當前檔案所屬模組。
|
|
19
|
-
- 載入該模組註冊的 Docs Link (Spec/UI/Plan)。
|
|
20
|
-
|
|
21
|
-
**Step 2: Check Explicit Context**
|
|
22
|
-
- 場景: 新建立的檔案或 Map 尚未更新。
|
|
23
|
-
- 檢查使用者 Prompt 中是否顯式指定了文件路徑,如有則須載入。
|
|
24
|
-
|
|
25
|
-
**Step 3: Fallback**
|
|
26
|
-
- Map 中未註冊且使用者未指定 → **STOP & ASK**。
|
|
27
|
-
- 提示: 「未找到當前程式碼對應的 Spec 文件。請告知路徑,或運行 `/archi.map` 更新架構地圖。」
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
## 2. Mandatory Loading Rules
|
|
32
|
-
|
|
33
|
-
| 程式碼型別 | 必讀上下文 | 真理來源 |
|
|
34
|
-
|:---|:---|:---|
|
|
35
|
-
| **Business Logic** (Tasks/Entities) | Spec Document | `[[__DOCS_DIR__]]/global/map.json` → Module Entry |
|
|
36
|
-
| **UI Components** (Pages/Widgets) [?UI] | UI Document + `[[__DOCS_DIR__]]/global/design_tokens.json` | `[[__DOCS_DIR__]]/global/map.json` + Global Rules |
|
|
37
|
-
| **Data Schema** (ORM/SQL/Models) [?Data] | Data Snapshot | `[[__DOCS_DIR__]]/global/data_snapshot.json` |
|
|
38
|
-
| **Config / Infra** (Package.json...) | Tech Stack | `02_tech_stack.md` |
|
|
39
|
-
|
|
40
|
-
---
|
|
41
|
-
|
|
42
|
-
## 3. Anti-Hallucination
|
|
43
|
-
|
|
44
|
-
- 程式碼是文件的下游產物。
|
|
45
|
-
- 禁在未讀取 Spec 的情況下憑變數名猜測業務邏輯。
|
|
46
|
-
- 發現程式碼與文件不符時: 不擅自修復文件或程式碼,須暫停並報告不一致性。
|
|
47
|
-
|
|
48
|
-
---
|
|
49
|
-
|
|
50
|
-
## 4. Maintenance Hook
|
|
51
|
-
|
|
52
|
-
- **Trigger**: 建立新檔案或新模組時。
|
|
53
|
-
- **Action**: 須自動更新 `map.json`,建立程式碼路徑與文件路徑的映射;映射關係不明確時才詢問使用者確認。
|