architext 0.0.4 → 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 +27 -1
- package/README.md +84 -7
- package/README.zh-CN.md +84 -7
- package/dist/index.js +38 -38
- package/dist/templates/en/briefs/_base.md +44 -11
- package/dist/templates/en/briefs/_modules.md +31 -4
- package/dist/templates/en/docs/prompts/audit.md +80 -94
- package/dist/templates/en/docs/prompts/code.md +87 -89
- package/dist/templates/en/docs/prompts/edit.md +47 -51
- 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 +91 -116
- package/dist/templates/en/docs/prompts/map.md +47 -69
- package/dist/templates/en/docs/prompts/plan.md +134 -239
- package/dist/templates/en/docs/prompts/recover.md +19 -34
- package/dist/templates/en/docs/prompts/ref.md +43 -138
- 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 +89 -129
- 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 +12 -12
- package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +3 -34
- package/dist/templates/en/skills/archi-design-patterns/SKILL.md +1 -0
- package/dist/templates/en/skills/archi-feature-relations/SKILL.md +4 -4
- 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 +20 -20
- package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +315 -270
- package/dist/templates/zh/briefs/_base.md +44 -12
- package/dist/templates/zh/briefs/_modules.md +27 -0
- package/dist/templates/zh/docs/prompts/audit.md +42 -56
- package/dist/templates/zh/docs/prompts/code.md +47 -49
- package/dist/templates/zh/docs/prompts/edit.md +38 -42
- package/dist/templates/zh/docs/prompts/fix.md +30 -29
- package/dist/templates/zh/docs/prompts/help.md +13 -21
- package/dist/templates/zh/docs/prompts/inherit.md +59 -83
- package/dist/templates/zh/docs/prompts/map.md +24 -47
- package/dist/templates/zh/docs/prompts/plan.md +92 -197
- package/dist/templates/zh/docs/prompts/recover.md +9 -24
- package/dist/templates/zh/docs/prompts/ref.md +11 -106
- package/dist/templates/zh/docs/prompts/remove.md +31 -71
- package/dist/templates/zh/docs/prompts/revise.md +37 -86
- package/dist/templates/zh/docs/prompts/scope.md +51 -91
- package/dist/templates/zh/docs/prompts/start.md +67 -106
- package/dist/templates/zh/rules/00_system.md +18 -91
- package/dist/templates/zh/rules/01_workflow.md +60 -59
- package/dist/templates/zh/rules/03_data_governance.md +41 -68
- package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +2 -33
- package/dist/templates/zh/skills/archi-design-patterns/SKILL.md +1 -0
- package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +2 -1
- package/dist/templates/zh/skills/archi-plan-options/SKILL.md +1 -0
- package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +317 -269
- package/package.json +1 -1
|
@@ -1,69 +1,61 @@
|
|
|
1
1
|
<protocol_help>
|
|
2
2
|
**Trigger**: `/archi.help [question]`
|
|
3
|
-
**Goal**: Project navigation and
|
|
3
|
+
**Goal**: Project navigation and context Q&A. Analyze project current state, recommend next actions; or answer user questions based on project context.
|
|
4
4
|
|
|
5
5
|
<meta>
|
|
6
6
|
<style>Concise, Contextual, Actionable</style>
|
|
7
7
|
<language>English</language>
|
|
8
8
|
<principles>
|
|
9
|
-
1. **Context-Aware**: Answer based on
|
|
10
|
-
2. **Actionable Output**: Every output must include
|
|
11
|
-
3. **Minimal Token**:
|
|
12
|
-
4. **No Audit**:
|
|
9
|
+
1. **Context-Aware**: Answer based on actual project state; no guessing.
|
|
10
|
+
2. **Actionable Output**: Every output must include executable next-step suggestions (concrete command + params).
|
|
11
|
+
3. **Minimal Token**: Concise output; don't restate known info. Present reasoning and suggestions only.
|
|
12
|
+
4. **No Audit**: Do not do deep audit (that's `/archi.audit`). Focus on navigation and Q&A.
|
|
13
13
|
</principles>
|
|
14
14
|
</meta>
|
|
15
15
|
|
|
16
16
|
<step_1_load_context>
|
|
17
|
-
**Role**: Project Observer
|
|
18
17
|
**Action**:
|
|
19
|
-
1.
|
|
20
|
-
2. Scan
|
|
21
|
-
3. [?question] If user provided a question, locate relevant files by
|
|
18
|
+
1. **Load**: roadmap.json (id/title/status/deps/tag only; skip goal/notes).
|
|
19
|
+
2. **Scan Tasks**: Scan tasks/ — get existing Tasks and doc completeness (has spec.md / ui.md / plan.json).
|
|
20
|
+
3. [?question] If user provided a question, locate and read relevant files by semantics.
|
|
22
21
|
|
|
23
22
|
**Output**: Internal context (not shown to user).
|
|
24
23
|
</step_1_load_context>
|
|
25
24
|
|
|
26
25
|
<step_2_route>
|
|
27
|
-
**
|
|
28
|
-
**Action**: Branch based on input:
|
|
26
|
+
**Action**: Branch by input:
|
|
29
27
|
|
|
30
28
|
| Input | Branch |
|
|
31
29
|
|:---|:---|
|
|
32
30
|
| No args | → step_3_navigate (project navigation) |
|
|
33
|
-
| Has `[question]` | → step_4_answer (
|
|
31
|
+
| Has `[question]` | → step_4_answer (context Q&A) |
|
|
34
32
|
|
|
35
33
|
</step_2_route>
|
|
36
34
|
|
|
37
35
|
<step_3_navigate>
|
|
38
|
-
**Role**: Project Navigator
|
|
39
36
|
**Action**:
|
|
40
37
|
1. **Determine project phase**:
|
|
41
38
|
|
|
42
|
-
| Signal | Phase |
|
|
39
|
+
| Signal | Phase | Suggestion |
|
|
43
40
|
|:---|:---|:---|
|
|
44
41
|
| roadmap.json missing | Not initialized | New project → `/archi.start`; existing code → `/archi.inherit` |
|
|
45
|
-
| Has roadmap but no
|
|
46
|
-
| Has Legacy
|
|
47
|
-
| Has active
|
|
48
|
-
| Has active
|
|
49
|
-
| All tasks done |
|
|
50
|
-
| Has blocked
|
|
51
|
-
|
|
52
|
-
2. **Output
|
|
53
|
-
- One-line summary of current state
|
|
54
|
-
- Recommended next action (with specific command)
|
|
55
|
-
- If multiple paths available, list by priority (max 3)
|
|
42
|
+
| Has roadmap but no tasks/ | Started, not planned | `/archi.scope` to plan new tasks |
|
|
43
|
+
| Has Legacy stub (Spec-Status: Stub) | Inherited, not enriched | `/archi.edit LEG-xx` to enrich spec |
|
|
44
|
+
| Has active task and plan.json complete | Ready to code | `/archi.code <ID>` |
|
|
45
|
+
| Has active task but missing spec/plan | Planning incomplete | `/archi.plan <ID>` to complete |
|
|
46
|
+
| All tasks done | Completed | `/archi.scope` to plan new or release |
|
|
47
|
+
| Has blocked task | Blocked | Show block reason and upstream deps |
|
|
48
|
+
|
|
49
|
+
2. **Output**: One-line state summary + recommended next step (with command) + optional paths (≤3, by priority).
|
|
56
50
|
</step_3_navigate>
|
|
57
51
|
|
|
58
52
|
<step_4_answer>
|
|
59
|
-
**Role**: Project Advisor
|
|
60
53
|
**Action**:
|
|
61
|
-
1. Parse `[question]` semantics
|
|
62
|
-
2.
|
|
63
|
-
3.
|
|
64
|
-
4. If insufficient info to answer, state what's missing instead of fabricating.
|
|
54
|
+
1. Parse `[question]` semantics; locate and read relevant project files.
|
|
55
|
+
2. Answer comprehensively; operational questions must include concrete command suggestions.
|
|
56
|
+
3. When info insufficient, state what's missing; do not fabricate.
|
|
65
57
|
|
|
66
|
-
**Output**: Concise answer based on project context + relevant file
|
|
58
|
+
**Output**: Concise answer based on project context + relevant file refs.
|
|
67
59
|
</step_4_answer>
|
|
68
60
|
|
|
69
61
|
</protocol_help>
|
|
@@ -1,34 +1,29 @@
|
|
|
1
1
|
<protocol_inherit>
|
|
2
2
|
**Trigger**: `/archi.inherit [brief_path]`
|
|
3
3
|
**Phase**: Legacy Adoption
|
|
4
|
-
**Goal**: Reverse-engineer
|
|
4
|
+
**Goal**: Reverse-engineer existing codebase to fill the init-deployed document skeleton (`[[__DOCS_DIR__]]`) with analysis results, bringing project under framework governance. Fills empty placeholders; does not overwrite user's existing content. Optionally provide Brief to supplement vision/roadmap (for skeleton repos with minimal code).
|
|
5
5
|
|
|
6
6
|
<meta>
|
|
7
7
|
<style>Analytical, Systematic, Evidence-Based</style>
|
|
8
8
|
<language>English</language>
|
|
9
9
|
<principles>
|
|
10
|
-
1. **Code-Driven**: Code is the sole source of truth;
|
|
11
|
-
2. **AI-Native Perspective**:
|
|
12
|
-
3. **User Agency First**: AI analysis must be confirmed by
|
|
13
|
-
4. **
|
|
10
|
+
1. **Code-Driven**: Code is the sole source of truth; no speculation on features without evidence.
|
|
11
|
+
2. **AI-Native Perspective**: Analysis from AI Agent perspective. Focus: Context Locality, Type Safety, Module Boundaries.
|
|
12
|
+
3. **User Agency First**: AI analysis must be confirmed by user. When code interpretation is ambiguous, ask user; do not decide unilaterally.
|
|
13
|
+
4. **Thorough Discovery, Layered Recording**: Read all non-third-party business code (exclude node_modules/vendor/dist and other generated artifacts), no file count limit. Record in three tiers: core modules with detailed flow documentation, shared logic with signatures and dependency relationships, pure utilities with signatures and purpose. Better to over-read than to miss — downstream protocols cannot use code that was not recorded.
|
|
14
14
|
5. **Option Z Everywhere**: Supplementary questions must include `[Z] Custom`.
|
|
15
15
|
</principles>
|
|
16
16
|
</meta>
|
|
17
17
|
|
|
18
|
-
<
|
|
18
|
+
<step_0_recon>
|
|
19
19
|
**Role**: Intelligence Analyst
|
|
20
|
-
**Trigger**: Only when user provides `[brief_path]`. Skip if no argument or path invalid.
|
|
21
|
-
**Action**:
|
|
22
|
-
1. Parse `[brief_path]`: if path provided → read that file; if not → look for `project-brief.md` (project root), then `[[__DOCS_DIR__]]/project-brief.md`
|
|
23
|
-
2. If file exists and non-empty: parse Brief sections, extract project identity, core tasks, tech preferences, constraints, supplementary notes (same as start step_0_ingest)
|
|
24
|
-
3. If file missing or empty: skip this step; subsequent steps use code only as input
|
|
25
20
|
|
|
26
|
-
**
|
|
27
|
-
|
|
21
|
+
**Brief detection** (only when user provides `[brief_path]`):
|
|
22
|
+
1. Parse `[brief_path]`: if path provided → read that file; if not → search `project-brief.md` (project root), then `[[__DOCS_DIR__]]/project-brief.md`
|
|
23
|
+
2. If file exists and non-empty: parse Brief sections, extract project identity, core tasks, tech preferences, boundaries, supplementary notes (same as start step_0_ingest)
|
|
24
|
+
3. If file missing or empty: skip Brief; subsequent steps use code only as input
|
|
28
25
|
|
|
29
|
-
|
|
30
|
-
**Role**: Intelligence Analyst
|
|
31
|
-
**Action**:
|
|
26
|
+
**Code reconnaissance**:
|
|
32
27
|
1. Read project root config files (auto-detect type):
|
|
33
28
|
|
|
34
29
|
| Language/Ecosystem | Config Files |
|
|
@@ -41,80 +36,52 @@
|
|
|
41
36
|
| Other | Use root directory config files |
|
|
42
37
|
|
|
43
38
|
2. Read README.md (if exists).
|
|
44
|
-
3. Scan directory structure (
|
|
45
|
-
4. Infer project feature tags (UI / Data / CLI / Lib / API — from directory structure,
|
|
46
|
-
5. Identify entry points and core modules.
|
|
39
|
+
3. Scan directory structure (full depth).
|
|
40
|
+
4. Infer project feature tags (UI / Data / CLI / Lib / API — from directory structure, deps, and config).
|
|
41
|
+
5. Identify entry points and core modules. Trace import chains from entry points to build a module dependency sketch.
|
|
47
42
|
|
|
48
43
|
**Output**: Internal summary (not shown to user), proceed to step_1.
|
|
49
44
|
</step_0_recon>
|
|
50
45
|
|
|
51
46
|
<step_1_analysis>
|
|
52
|
-
**Role**:
|
|
53
|
-
**Scan
|
|
47
|
+
**Role**: Chief Product Strategist (CPO)
|
|
48
|
+
**Scan strategy**: Deep scan — starting from entry files, follow call chains to read all business files. For large modules (>10 files), prioritize files imported by multiple consumers.
|
|
54
49
|
|
|
55
50
|
**Action**:
|
|
56
51
|
1. For each identified functional module:
|
|
57
|
-
-
|
|
52
|
+
- Starting from entry file, follow import/call chains layer by layer until the module's main business logic is covered
|
|
58
53
|
- Extract main flows (user action → system processing → result)
|
|
59
54
|
- Record associated file paths
|
|
60
55
|
2. For shared/infrastructure code (utils, middleware, config):
|
|
61
|
-
|
|
56
|
+
Read all files and record in two tiers:
|
|
57
|
+
- **Medium tier** (business shared logic: auth/validation/error-handling/permission): record responsibility + exported function signatures + dependents
|
|
58
|
+
- **Brief tier** (pure utility functions: format/slugify/logger/helpers): record function name + parameter signature + one-line purpose
|
|
59
|
+
Both tiers write to map.json publicAPI field, ensuring downstream protocols can discover and reuse.
|
|
62
60
|
3. Extract domain terminology and naming conventions from code.
|
|
63
61
|
|
|
64
|
-
**Output**:
|
|
65
|
-
```
|
|
66
|
-
### Codebase Analysis Report
|
|
67
|
-
> **Project**: [Name] | **Type**: [UI/Data/CLI/Lib/API] | **Scale**: ~[file count] files, [dir count] directories
|
|
68
|
-
|
|
69
|
-
**Tech Stack**:
|
|
70
|
-
| Category | Selection |
|
|
71
|
-
|:---|:---|
|
|
72
|
-
| Language | ... |
|
|
73
|
-
| Framework | ... |
|
|
74
|
-
| Build | ... |
|
|
75
|
-
| Testing | ... |
|
|
76
|
-
| Deployment | ... |
|
|
77
|
-
|
|
78
|
-
**Architecture Pattern**: [Inference] — [Evidence]
|
|
79
|
-
|
|
80
|
-
**Functional Module Inventory**:
|
|
81
|
-
| # | Module | Source Location | Responsibility | Key Flows |
|
|
82
|
-
|:---|:---|:---|:---|:---|
|
|
83
|
-
| 1 | [Name] | [Path] | [One sentence] | [Flow1], [Flow2] |
|
|
84
|
-
|
|
85
|
-
**Shared Infrastructure**:
|
|
86
|
-
| Directory | Responsibility |
|
|
87
|
-
|:---|:---|
|
|
88
|
-
| [Path] | [Description] |
|
|
89
|
-
|
|
90
|
-
**Domain Terminology**: [Term list]
|
|
91
|
-
|
|
92
|
-
**Uncertain Items** (if any):
|
|
93
|
-
- [Ambiguous item]
|
|
94
|
-
```
|
|
62
|
+
**Output**: Output structured analysis report to user — include project overview (name/type/scale), tech stack table (language/framework/build/test/deploy), architecture pattern and evidence, functional module list (module/source location/responsibility/key flows), shared infrastructure (directory/responsibility/key exported interfaces), domain terminology, AI uncertain items (if any).
|
|
95
63
|
|
|
96
64
|
**Gate**: User confirms or corrects. Do not proceed to step_2 without confirmation.
|
|
97
65
|
</step_1_analysis>
|
|
98
66
|
|
|
99
67
|
<step_2_supplementary>
|
|
100
|
-
**Role**: Product Consultant
|
|
101
68
|
**Trigger**: Only when step_1 has items AI cannot determine. Skip if no ambiguity.
|
|
102
69
|
|
|
103
70
|
**Action**: Ask ambiguous items in multiple-choice format.
|
|
104
|
-
- 3
|
|
71
|
+
- 3–5 options per question + `[Z] Custom`; AI recommendation marked `[Recommended]`.
|
|
105
72
|
- Total questions capped at 3.
|
|
106
73
|
|
|
107
74
|
Common ambiguities:
|
|
108
75
|
- Architecture pattern cannot be confirmed
|
|
109
|
-
- Certain directory
|
|
110
|
-
- Vision info (North Star
|
|
76
|
+
- Certain directory responsibility unclear
|
|
77
|
+
- Vision info (North Star metric, design philosophy) cannot be inferred from code
|
|
111
78
|
|
|
112
79
|
**Output Format**:
|
|
113
80
|
```
|
|
114
81
|
### Supplementary Confirmation
|
|
115
82
|
|
|
116
|
-
**[Q1] Question
|
|
117
|
-
> Why this
|
|
83
|
+
**[Q1] Question title**
|
|
84
|
+
> Why this info is needed
|
|
118
85
|
|
|
119
86
|
| ID | Option | Description |
|
|
120
87
|
|:---|:---|:---|
|
|
@@ -130,45 +97,45 @@
|
|
|
130
97
|
<step_3_constitution>
|
|
131
98
|
**Role**: Chief Architect
|
|
132
99
|
**Input**: Step 0 Brief parse (if any) + Step 1 analysis report + Step 2 supplements (if any).
|
|
133
|
-
**Action**:
|
|
100
|
+
**Action**: Fill the init-deployed document skeleton in one pass. **With Brief**: Brief takes precedence for vision/roadmap/tech_stack; code still used for map, LEG-xx, directory structure. **Without Brief**: Code only as input (original logic).
|
|
134
101
|
|
|
135
102
|
### Information Routing Rules
|
|
136
103
|
|
|
137
|
-
> Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by
|
|
104
|
+
> Rule files (`02_tech_stack`, `90_custom_rules`, etc.) are already injected into context by IDE; AI knows their paths, write directly.
|
|
138
105
|
|
|
139
|
-
**
|
|
106
|
+
**With Brief** (Brief → target file):
|
|
140
107
|
| Brief content | Target file |
|
|
141
108
|
|:---|:---|
|
|
142
109
|
| Project identity, target users, success metrics, references | `[[__DOCS_DIR__]]/global/vision.md` |
|
|
143
|
-
| Tech stack,
|
|
110
|
+
| Tech stack, deploy target, 3rd-party libs/services | rule file `02_tech_stack` |
|
|
144
111
|
| Core task list | `[[__DOCS_DIR__]]/global/roadmap.json` (phase-1/2, call archi-decompose-roadmap) |
|
|
145
|
-
| Rules/conventions from supplementary notes | rule file `90_custom_rules` |
|
|
112
|
+
| Rules/conventions/preferences from supplementary notes | rule file `90_custom_rules` |
|
|
146
113
|
| Style/tone (UI only) | `design_tokens.json` aestheticDirection etc. |
|
|
147
114
|
|
|
148
|
-
**
|
|
149
|
-
|
|
|
115
|
+
**From code** (always applies):
|
|
116
|
+
| Source | Target file |
|
|
150
117
|
|:---|:---|
|
|
151
|
-
| README
|
|
152
|
-
|
|
|
153
|
-
| Directory structure
|
|
154
|
-
| Domain terminology
|
|
155
|
-
| eslint/prettier
|
|
156
|
-
| Error
|
|
157
|
-
|
|
|
158
|
-
|
|
|
118
|
+
| README description/features | vision.md |
|
|
119
|
+
| Dependencies/config/code patterns | 02_tech_stack |
|
|
120
|
+
| Directory structure/module deps/user journeys | map.json |
|
|
121
|
+
| Domain terminology/naming conventions | dictionary.json |
|
|
122
|
+
| eslint/prettier etc. | 90_custom_rules |
|
|
123
|
+
| Error codes in code | error_codes.json |
|
|
124
|
+
| (UI projects only) CSS variables/theme | design_tokens.json |
|
|
125
|
+
| (Data projects only) Schema/Migration | data_snapshot.json |
|
|
159
126
|
|
|
160
127
|
### 3.1 Vision (`[[__DOCS_DIR__]]/global/vision.md`)
|
|
161
128
|
- **With Brief**: Fill from Brief (same as start); code/README as supplement only
|
|
162
|
-
- **Without Brief**: Derive from README + project config; mark un-inferrable items `(AI
|
|
129
|
+
- **Without Brief**: Derive from README + project config; mark un-inferrable items `(AI completion — user review suggested)`
|
|
163
130
|
- Do not retain template placeholders
|
|
164
131
|
|
|
165
132
|
### 3.2 Tech Stack (rule file `02_tech_stack`)
|
|
166
|
-
- **With Brief**: Brief
|
|
167
|
-
- **Without Brief**: Existing
|
|
168
|
-
-
|
|
133
|
+
- **With Brief**: Brief confirmed → write directly; blank/recommend → AI recommends; code deps as supplement
|
|
134
|
+
- **Without Brief**: Existing deps/config → write directly; visible conventions → write to Coding Standards
|
|
135
|
+
- Fill complete Section 1-8
|
|
169
136
|
|
|
170
137
|
### 3.3 Custom Rules (rule file `90_custom_rules`)
|
|
171
|
-
- **With Brief**: Merge
|
|
138
|
+
- **With Brief**: Merge supplementary notes + code eslint/prettier
|
|
172
139
|
- **Without Brief**: Extract from eslint/prettier/editorconfig; identify team conventions from code patterns
|
|
173
140
|
|
|
174
141
|
### 3.4 Roadmap (`[[__DOCS_DIR__]]/global/roadmap.json`)
|
|
@@ -189,7 +156,7 @@
|
|
|
189
156
|
"tasks": [
|
|
190
157
|
{
|
|
191
158
|
"id": "LEG-01",
|
|
192
|
-
"title": "<Module
|
|
159
|
+
"title": "<Module name>",
|
|
193
160
|
"status": "done",
|
|
194
161
|
"goal": "<One-line summary>. See tasks/LEG-01_<Slug>/spec.md",
|
|
195
162
|
"deps": [],
|
|
@@ -206,9 +173,8 @@
|
|
|
206
173
|
|
|
207
174
|
**Rules**:
|
|
208
175
|
- Functional modules → `phase-0: Legacy`, status `done`, tag `Legacy`, ID prefix `LEG-`
|
|
209
|
-
- Shared/infrastructure code does not enter roadmap; only
|
|
210
|
-
-
|
|
211
|
-
- Dependencies between LEG tasks must be reflected in deps
|
|
176
|
+
- Shared/infrastructure code does not enter roadmap; only map.json directoryMapping
|
|
177
|
+
- Dependencies between LEG tasks must be in deps
|
|
212
178
|
|
|
213
179
|
### 3.5 Task Stub Specs
|
|
214
180
|
|
|
@@ -224,66 +190,75 @@
|
|
|
224
190
|
[One paragraph description]
|
|
225
191
|
|
|
226
192
|
## Key Flows
|
|
227
|
-
1. **[Flow
|
|
228
|
-
2. **[Flow Name]**: [A] → [B] → [C]
|
|
193
|
+
1. **[Flow name]**: [A] → [B] → [C]
|
|
229
194
|
|
|
230
195
|
## Associated Files
|
|
231
196
|
- [Role]: `[Path]`
|
|
232
|
-
- [Role]: `[Path]`
|
|
233
197
|
```
|
|
234
198
|
|
|
235
|
-
>
|
|
199
|
+
> Stub is starting point, not final state. Enrich later via `/archi.edit` (auto-triggers `step_1_5_enrich` flow).
|
|
236
200
|
|
|
237
|
-
### 3.6 map.json
|
|
201
|
+
### 3.6 map.json population
|
|
238
202
|
- `directoryMapping`: Each core directory → `{ "path", "layer", "responsibility", "publicAPI" }`
|
|
239
203
|
- `logicalTopology`: Inter-module dependencies → `{ "from", "to", "type" }` (imports / calls / extends)
|
|
240
204
|
- `criticalUserJourneys`: Core flows → `{ "name", "steps": ["module → module → ..."] }`
|
|
241
|
-
- `featureRelations`: Scan code to identify "aggregator modules" and record
|
|
242
|
-
**Recognition
|
|
243
|
-
Record format: `{ "aggregator"
|
|
205
|
+
- `featureRelations`: Scan code to identify "aggregator modules" and record.
|
|
206
|
+
**Recognition pattern**: Module that iterates/enumerates/dynamic-loads same-type modules, or described as "aggregating/listing/registering all X".
|
|
207
|
+
Record format: `{ "aggregator", "sources", "evidence", "checkNote" }`
|
|
244
208
|
|
|
245
|
-
### 3.7 Other
|
|
209
|
+
### 3.7 Other global docs (as needed)
|
|
246
210
|
- `dictionary.json`: Extract domain terminology from code
|
|
247
|
-
-
|
|
248
|
-
-
|
|
249
|
-
- [?Data] `data_snapshot.json`: Extract from schema/migration
|
|
211
|
+
- (UI projects only) `design_tokens.json`: Extract from CSS variables/theme
|
|
212
|
+
- (Data projects only) `data_snapshot.json`: Extract from schema/migration
|
|
250
213
|
- `error_codes.json`: Extract from error definitions in code
|
|
251
214
|
|
|
252
|
-
**
|
|
215
|
+
UI projects only: **UI concept design (Adopt mode)**: [[SKILL: archi-ui-wireframe|Invoke skill (adopt mode) to reverse-generate UI concept design from code.]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-ui-wireframe/SKILL.md` and follow its Adopt protocol)]]
|
|
216
|
+
- Read route definitions, page components, layout files from code
|
|
217
|
+
- Read design_tokens.json written in step_3 (containing CSS variables/theme extracted from code)
|
|
218
|
+
- When tokens incomplete, triggers skill's built-in guidance flow
|
|
219
|
+
- Write `ui_concept.html` + `ui_context.md`
|
|
220
|
+
- Output UI concept design summary; await user confirmation or feedback for adjustments
|
|
221
|
+
|
|
222
|
+
**Output**: Write all files, run `npx archi render`. Enter step_4_verify.
|
|
253
223
|
</step_3_constitution>
|
|
254
224
|
|
|
255
225
|
<step_4_verify>
|
|
256
226
|
**Role**: Independent Reviewer
|
|
257
|
-
|
|
258
227
|
[[SUBAGENT: archi-silent-audit|mode: init, context: Review step_3 generated global files (vision, tech_stack, roadmap, map, dictionary, stub specs, etc.)]][[NO-SKILL: (Skill not installed: read `[[__DOCS_DIR__]]/skills/archi-silent-audit/SKILL.md`, follow mode: init review dimension table item by item)]]
|
|
259
228
|
|
|
260
229
|
[[INCLUDE: shared/verify-result-handling.md]]
|
|
261
230
|
</step_4_verify>
|
|
262
231
|
|
|
263
232
|
<step_5_signoff>
|
|
264
|
-
**Terminal Gate** (
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
233
|
+
**Terminal Gate** (do not skip): Standard check (task --check + render).
|
|
234
|
+
|
|
235
|
+
**Pre-signoff Checklist** (confirm each item after Gate passes, before Output):
|
|
236
|
+
□ vision.md — filled (without Brief: inferred content annotated `(AI completion — review recommended)`)
|
|
237
|
+
□ 02_tech_stack.md — Sections 1-8 fully filled
|
|
238
|
+
□ roadmap.json — each functional module has a corresponding LEG-xx (status: done, tag: Legacy)
|
|
239
|
+
□ tasks/LEG-xx_<Slug>/spec.md — each LEG has a corresponding Stub spec (with related file list)
|
|
240
|
+
□ map.json — directoryMapping + logicalTopology + criticalUserJourneys + featureRelations all filled
|
|
241
|
+
□ dictionary.json + error_codes.json — extracted from codebase
|
|
242
|
+
□ (UI projects only) design_tokens.json + ui_concept.html + ui_context.md — Adopt mode executed
|
|
243
|
+
□ Step 4 Silent Audit — executed, all CRITICAL issues resolved
|
|
244
|
+
|
|
245
|
+
**Action** (after Checklist confirmed):
|
|
246
|
+
1. Run `npx archi task` to output task overview.
|
|
272
247
|
2. Output summary.
|
|
273
248
|
|
|
274
|
-
**Output**: Reverse-engineering summary
|
|
275
|
-
- **Project
|
|
276
|
-
- **Legacy
|
|
277
|
-
- **Generated
|
|
278
|
-
- **AI
|
|
249
|
+
**Output**: Reverse-engineering summary, including:
|
|
250
|
+
- **Project overview**: Type, scale, core module count
|
|
251
|
+
- **Legacy tasks**: LEG-xx list (ID / name / source location)
|
|
252
|
+
- **Generated docs**: File list
|
|
253
|
+
- **AI completions**: Mark confidence (High/Medium/Low)
|
|
279
254
|
- **Next Steps**:
|
|
280
255
|
|
|
281
|
-
| Priority | Action |
|
|
256
|
+
| Priority | Action | Notes |
|
|
282
257
|
|:---|:---|:---|
|
|
283
|
-
| 1 | Review vision.md | Confirm AI-
|
|
284
|
-
| 2 | `/archi.edit LEG-xx` | Enrich core module stubs into full
|
|
285
|
-
| 3 | `/archi.scope [file_path]` | Plan new
|
|
286
|
-
| 4 | `/archi.plan <task ID>` | Deep-plan individual
|
|
258
|
+
| 1 | Review vision.md | Confirm AI-completed vision description |
|
|
259
|
+
| 2 | `/archi.edit LEG-xx` | Enrich core module stubs into full spec (auto-triggers Enrich flow) |
|
|
260
|
+
| 3 | `/archi.scope [file_path]` | Plan new features/major modules |
|
|
261
|
+
| 4 | `/archi.plan <task ID>` | Deep-plan individual task |
|
|
287
262
|
</step_5_signoff>
|
|
288
263
|
|
|
289
264
|
</protocol_inherit>
|
|
@@ -1,131 +1,109 @@
|
|
|
1
1
|
<protocol_map>
|
|
2
|
-
**Trigger**: `/archi.map`
|
|
3
|
-
**Goal**: Scan actual
|
|
2
|
+
**Trigger**: `/archi.map` | Auto-loaded by Workflow Dispatch on natural language trigger
|
|
3
|
+
**Goal**: Scan project actual directory structure, compare with `map.json`, identify additions/stale/changes; update architecture map after user confirmation.
|
|
4
4
|
|
|
5
5
|
<meta>
|
|
6
6
|
<style>Systematic, Precise, Architecture-Aware</style>
|
|
7
7
|
<language>English</language>
|
|
8
8
|
<principles>
|
|
9
|
-
1. **Scan vs Map**: Actual filesystem is Ground Truth; map.json is
|
|
10
|
-
2. **Smart Granularity**: Directory-level by default;
|
|
11
|
-
3. **Architecture Inference**: New entry
|
|
12
|
-
4. **Batch Confirm**:
|
|
9
|
+
1. **Scan vs Map**: Actual filesystem is Ground Truth; map.json is old snapshot.
|
|
10
|
+
2. **Smart Granularity**: Directory-level by default; when single file has multiple responsibilities, refine to file-level.
|
|
11
|
+
3. **Architecture Inference**: New entry layer/location must reference existing map pattern + `02_tech_stack.md`.
|
|
12
|
+
4. **Batch Confirm**: Show all changes at once; user confirms in batch.
|
|
13
|
+
5. **IDE-Native First**: Leverage IDE native capabilities to drive execution rhythm; this protocol defines quality standards and checkpoints, not fight IDE planning/execution mechanisms.
|
|
13
14
|
</principles>
|
|
14
15
|
</meta>
|
|
15
16
|
|
|
16
17
|
<step_1_scan>
|
|
17
|
-
**Role**: Surveyor
|
|
18
18
|
**Action**:
|
|
19
19
|
1. **Read Map**: Read `[[__DOCS_DIR__]]/global/map.json` — current architecture map.
|
|
20
|
-
2. **Read Tech Stack**: Read `02_tech_stack.md` — directory conventions, architecture
|
|
20
|
+
2. **Read Tech Stack**: Read `02_tech_stack.md` — directory structure conventions, architecture pattern.
|
|
21
21
|
3. **Scan Directory Tree**: Scan project directory structure.
|
|
22
|
-
- **Exclude**: `.git/`, `node_modules/`, `dist/`, `build/`, `[[__DOCS_DIR__]]/`, and paths
|
|
23
|
-
- **Depth**: Follow granularity
|
|
22
|
+
- **Exclude**: `.git/`, `node_modules/`, `dist/`, `build/`, `[[__DOCS_DIR__]]/`, and paths in `.gitignore`.
|
|
23
|
+
- **Depth**: Follow granularity pattern of existing map.json entries.
|
|
24
24
|
|
|
25
|
-
**Output**: Internal data (actual tree + existing map structure)
|
|
25
|
+
**Output**: Internal data (actual dir tree + existing map structure); not shown to user.
|
|
26
26
|
</step_1_scan>
|
|
27
27
|
|
|
28
28
|
<step_2_diff>
|
|
29
|
-
**
|
|
30
|
-
**Action**: Compare actual directory tree against map.json entry by entry, classify into three diff types.
|
|
29
|
+
**Action**: Compare actual dir tree with map.json entry by entry; classify as three diff types.
|
|
31
30
|
|
|
32
31
|
| Diff Type | Criteria | Handling |
|
|
33
32
|
|:---|:---|:---|
|
|
34
|
-
| **New** | Exists
|
|
35
|
-
| **Stale** | In map but no longer exists
|
|
36
|
-
| **
|
|
33
|
+
| **New** | Exists in reality but not in map | Must classify and register |
|
|
34
|
+
| **Stale** | In map but no longer exists | Remove directly |
|
|
35
|
+
| **Suspected Rename** | Map path gone, but new path structure/content highly similar | Mark as rename candidate |
|
|
37
36
|
|
|
38
|
-
### File-
|
|
37
|
+
### File-level detection
|
|
39
38
|
|
|
40
|
-
Quick
|
|
41
|
-
- A file exporting multiple unrelated classes/functions/modules
|
|
42
|
-
- An entry file aggregating multiple sub-module registrations (e.g. route registration, store registration)
|
|
43
|
-
- A file serving multiple Tasks
|
|
39
|
+
Quick scan of files in new directories; identify **single file multi-responsibility** → refine granularity to file-level.
|
|
44
40
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
**Output**: Diff list (internal), proceed to step_3.
|
|
41
|
+
**Output**: Diff list (internal); proceed to step_3.
|
|
48
42
|
</step_2_diff>
|
|
49
43
|
|
|
50
44
|
<step_3_classify>
|
|
51
45
|
**Role**: Chief Architect
|
|
52
|
-
**Action**: Classify new entries by
|
|
46
|
+
**Action**: Classify new entries by architecture.
|
|
53
47
|
|
|
54
|
-
### Classification
|
|
48
|
+
### Classification strategy
|
|
55
49
|
|
|
56
|
-
1. **Pattern
|
|
57
|
-
2. **Tech Stack
|
|
58
|
-
3. **Content
|
|
59
|
-
4. **
|
|
50
|
+
1. **Pattern match**: Reference same-level existing entries in map.json.
|
|
51
|
+
2. **Tech Stack conventions**: Directory structure rules in `02_tech_stack.md`.
|
|
52
|
+
3. **Content inference**: Read file content (imports, exported types).
|
|
53
|
+
4. **Cannot determine**: Mark `[?]` for user to specify.
|
|
60
54
|
|
|
61
|
-
For each new entry
|
|
62
|
-
- `path`: Directory or file path
|
|
63
|
-
- `layer`: Architectural layer
|
|
64
|
-
- `description`: One-line responsibility description
|
|
65
|
-
- `[?file-level]` `contains`: List of sub-responsibilities in the file
|
|
55
|
+
For each new entry fill: `path`, `layer`, `description`, `[?file-level] contains`.
|
|
66
56
|
|
|
67
|
-
**Output**: Classified new entries list (internal)
|
|
57
|
+
**Output**: Classified new entries list (internal); proceed to step_4.
|
|
68
58
|
</step_3_classify>
|
|
69
59
|
|
|
70
60
|
<step_4_propose>
|
|
71
|
-
**
|
|
72
|
-
**Action**: Present the full change manifest to user.
|
|
61
|
+
**Action**: Present full change list to user.
|
|
73
62
|
|
|
74
63
|
**Output**:
|
|
75
64
|
```
|
|
76
65
|
### Architecture Map Change Proposal
|
|
77
66
|
|
|
78
67
|
**Scan scope**: [project root]
|
|
79
|
-
**Current map entries**: N | **After
|
|
68
|
+
**Current map entries**: N | **After change**: M
|
|
80
69
|
|
|
81
70
|
---
|
|
82
71
|
|
|
83
|
-
#### Stale
|
|
84
|
-
| Path | Original
|
|
72
|
+
#### Stale entries (to remove)
|
|
73
|
+
| Path | Original layer |
|
|
85
74
|
|:---|:---|
|
|
86
|
-
| src/legacy/old-module/ | Service Layer |
|
|
87
75
|
|
|
88
|
-
#### New
|
|
76
|
+
#### New entries (to register)
|
|
89
77
|
| Path | Layer | Description | Granularity |
|
|
90
78
|
|:---|:---|:---|:---|
|
|
91
|
-
| src/services/payment/ | Service Layer | Payment service module | Directory |
|
|
92
|
-
| src/utils/validators.ts | Shared Layer | Form + data + API param validation | File |
|
|
93
|
-
| src/routes/api.ts [?] | [to specify] | Aggregates multiple API route registrations | File |
|
|
94
79
|
|
|
95
|
-
####
|
|
96
|
-
| Original
|
|
80
|
+
#### Suspected renames
|
|
81
|
+
| Original path | New path | Confidence |
|
|
97
82
|
|:---|:---|:---|
|
|
98
|
-
| src/helpers/ | src/utils/ | High (file content match) |
|
|
99
83
|
|
|
100
84
|
---
|
|
101
|
-
> Reply **OK** to confirm all; or specify
|
|
102
|
-
> - "src/routes/api.ts belongs to App Layer"
|
|
103
|
-
> - "src/helpers/ is not a rename, keep original entry"
|
|
104
|
-
> - "add src/config/ as Config Layer"
|
|
85
|
+
> Reply **OK** to confirm all; or specify modifications.
|
|
105
86
|
```
|
|
106
87
|
|
|
107
88
|
**Gate**: Proceed to step_5 after user confirms.
|
|
108
89
|
</step_4_propose>
|
|
109
90
|
|
|
110
91
|
<step_5_apply>
|
|
111
|
-
**Role**: System Administrator
|
|
112
92
|
**Action**:
|
|
113
|
-
1. Update
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
93
|
+
1. Update map.json per confirmed list (remove stale, add new, handle renames).
|
|
94
|
+
2. Update `lastUpdated`.
|
|
95
|
+
|
|
96
|
+
**Terminal Gate** (do not skip): Standard check (task --check + render).
|
|
97
|
+
|
|
98
|
+
**Pre-signoff Checklist** (confirm each item before Output):
|
|
99
|
+
□ User explicitly confirmed change list in step_4 (Gate passed before execution)
|
|
100
|
+
□ Stale entries removed from directoryMapping
|
|
101
|
+
□ New entries correctly classified (path + layer + description all filled)
|
|
102
|
+
□ Renamed entries explicitly handled (not silently ignored)
|
|
103
|
+
□ lastUpdated updated
|
|
104
|
+
□ Terminal Gate — task --check + render passed
|
|
123
105
|
|
|
124
|
-
**Output**: Update summary
|
|
125
|
-
- **Removed**: N stale entries
|
|
126
|
-
- **Added**: N entries (M file-level)
|
|
127
|
-
- **Renamed**: N entries
|
|
128
|
-
- **Current map total**: X entries
|
|
106
|
+
**Output**: Update summary — removed N / added N (M file-level) / renamed N / total entries.
|
|
129
107
|
</step_5_apply>
|
|
130
108
|
|
|
131
109
|
</protocol_map>
|