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,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,23 +1,29 @@
|
|
|
1
1
|
<protocol_inherit>
|
|
2
|
-
**Trigger**: `/archi.inherit`
|
|
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
|
-
|
|
20
|
+
|
|
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
|
|
25
|
+
|
|
26
|
+
**Code reconnaissance**:
|
|
21
27
|
1. Read project root config files (auto-detect type):
|
|
22
28
|
|
|
23
29
|
| Language/Ecosystem | Config Files |
|
|
@@ -30,80 +36,52 @@
|
|
|
30
36
|
| Other | Use root directory config files |
|
|
31
37
|
|
|
32
38
|
2. Read README.md (if exists).
|
|
33
|
-
3. Scan directory structure (
|
|
34
|
-
4. Infer project feature tags (UI / Data / CLI / Lib / API — from directory structure,
|
|
35
|
-
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.
|
|
36
42
|
|
|
37
43
|
**Output**: Internal summary (not shown to user), proceed to step_1.
|
|
38
44
|
</step_0_recon>
|
|
39
45
|
|
|
40
46
|
<step_1_analysis>
|
|
41
|
-
**Role**:
|
|
42
|
-
**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.
|
|
43
49
|
|
|
44
50
|
**Action**:
|
|
45
51
|
1. For each identified functional module:
|
|
46
|
-
-
|
|
52
|
+
- Starting from entry file, follow import/call chains layer by layer until the module's main business logic is covered
|
|
47
53
|
- Extract main flows (user action → system processing → result)
|
|
48
54
|
- Record associated file paths
|
|
49
55
|
2. For shared/infrastructure code (utils, middleware, config):
|
|
50
|
-
|
|
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.
|
|
51
60
|
3. Extract domain terminology and naming conventions from code.
|
|
52
61
|
|
|
53
|
-
**Output**:
|
|
54
|
-
```
|
|
55
|
-
### Codebase Analysis Report
|
|
56
|
-
> **Project**: [Name] | **Type**: [UI/Data/CLI/Lib/API] | **Scale**: ~[file count] files, [dir count] directories
|
|
57
|
-
|
|
58
|
-
**Tech Stack**:
|
|
59
|
-
| Category | Selection |
|
|
60
|
-
|:---|:---|
|
|
61
|
-
| Language | ... |
|
|
62
|
-
| Framework | ... |
|
|
63
|
-
| Build | ... |
|
|
64
|
-
| Testing | ... |
|
|
65
|
-
| Deployment | ... |
|
|
66
|
-
|
|
67
|
-
**Architecture Pattern**: [Inference] — [Evidence]
|
|
68
|
-
|
|
69
|
-
**Functional Module Inventory**:
|
|
70
|
-
| # | Module | Source Location | Responsibility | Key Flows |
|
|
71
|
-
|:---|:---|:---|:---|:---|
|
|
72
|
-
| 1 | [Name] | [Path] | [One sentence] | [Flow1], [Flow2] |
|
|
73
|
-
|
|
74
|
-
**Shared Infrastructure**:
|
|
75
|
-
| Directory | Responsibility |
|
|
76
|
-
|:---|:---|
|
|
77
|
-
| [Path] | [Description] |
|
|
78
|
-
|
|
79
|
-
**Domain Terminology**: [Term list]
|
|
80
|
-
|
|
81
|
-
**Uncertain Items** (if any):
|
|
82
|
-
- [Ambiguous item]
|
|
83
|
-
```
|
|
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).
|
|
84
63
|
|
|
85
64
|
**Gate**: User confirms or corrects. Do not proceed to step_2 without confirmation.
|
|
86
65
|
</step_1_analysis>
|
|
87
66
|
|
|
88
67
|
<step_2_supplementary>
|
|
89
|
-
**Role**: Product Consultant
|
|
90
68
|
**Trigger**: Only when step_1 has items AI cannot determine. Skip if no ambiguity.
|
|
91
69
|
|
|
92
70
|
**Action**: Ask ambiguous items in multiple-choice format.
|
|
93
|
-
- 3
|
|
71
|
+
- 3–5 options per question + `[Z] Custom`; AI recommendation marked `[Recommended]`.
|
|
94
72
|
- Total questions capped at 3.
|
|
95
73
|
|
|
96
74
|
Common ambiguities:
|
|
97
75
|
- Architecture pattern cannot be confirmed
|
|
98
|
-
- Certain directory
|
|
99
|
-
- Vision info (North Star
|
|
76
|
+
- Certain directory responsibility unclear
|
|
77
|
+
- Vision info (North Star metric, design philosophy) cannot be inferred from code
|
|
100
78
|
|
|
101
79
|
**Output Format**:
|
|
102
80
|
```
|
|
103
81
|
### Supplementary Confirmation
|
|
104
82
|
|
|
105
|
-
**[Q1] Question
|
|
106
|
-
> Why this
|
|
83
|
+
**[Q1] Question title**
|
|
84
|
+
> Why this info is needed
|
|
107
85
|
|
|
108
86
|
| ID | Option | Description |
|
|
109
87
|
|:---|:---|:---|
|
|
@@ -118,40 +96,53 @@
|
|
|
118
96
|
|
|
119
97
|
<step_3_constitution>
|
|
120
98
|
**Role**: Chief Architect
|
|
121
|
-
**Input**: Step 1 analysis report + Step 2 supplements (if any).
|
|
122
|
-
**Action**:
|
|
99
|
+
**Input**: Step 0 Brief parse (if any) + Step 1 analysis report + Step 2 supplements (if any).
|
|
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).
|
|
123
101
|
|
|
124
102
|
### Information Routing Rules
|
|
125
103
|
|
|
126
|
-
> 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.
|
|
127
105
|
|
|
128
|
-
|
|
106
|
+
**With Brief** (Brief → target file):
|
|
107
|
+
| Brief content | Target file |
|
|
129
108
|
|:---|:---|
|
|
130
|
-
|
|
|
131
|
-
|
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
|
109
|
+
| Project identity, target users, success metrics, references | `[[__DOCS_DIR__]]/global/vision.md` |
|
|
110
|
+
| Tech stack, deploy target, 3rd-party libs/services | rule file `02_tech_stack` |
|
|
111
|
+
| Core task list | `[[__DOCS_DIR__]]/global/roadmap.json` (phase-1/2, call archi-decompose-roadmap) |
|
|
112
|
+
| Rules/conventions/preferences from supplementary notes | rule file `90_custom_rules` |
|
|
113
|
+
| Style/tone (UI only) | `design_tokens.json` aestheticDirection etc. |
|
|
114
|
+
|
|
115
|
+
**From code** (always applies):
|
|
116
|
+
| Source | Target file |
|
|
117
|
+
|:---|:---|
|
|
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 |
|
|
138
126
|
|
|
139
127
|
### 3.1 Vision (`[[__DOCS_DIR__]]/global/vision.md`)
|
|
140
|
-
-
|
|
141
|
-
-
|
|
128
|
+
- **With Brief**: Fill from Brief (same as start); code/README as supplement only
|
|
129
|
+
- **Without Brief**: Derive from README + project config; mark un-inferrable items `(AI completion — user review suggested)`
|
|
142
130
|
- Do not retain template placeholders
|
|
143
131
|
|
|
144
132
|
### 3.2 Tech Stack (rule file `02_tech_stack`)
|
|
145
|
-
-
|
|
146
|
-
-
|
|
147
|
-
-
|
|
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
|
|
148
136
|
|
|
149
137
|
### 3.3 Custom Rules (rule file `90_custom_rules`)
|
|
150
|
-
-
|
|
151
|
-
-
|
|
138
|
+
- **With Brief**: Merge supplementary notes + code eslint/prettier
|
|
139
|
+
- **Without Brief**: Extract from eslint/prettier/editorconfig; identify team conventions from code patterns
|
|
152
140
|
|
|
153
141
|
### 3.4 Roadmap (`[[__DOCS_DIR__]]/global/roadmap.json`)
|
|
154
142
|
|
|
143
|
+
**With Brief**: [[SKILL: archi-decompose-roadmap|Generate phase-1/2 task chain from Brief task list]]; code functional modules → phase-0 LEG-xx (status=done). Merge both.
|
|
144
|
+
**Without Brief**: Code functional modules only → phase-0 LEG-xx; phase-1/2 remain empty skeletons.
|
|
145
|
+
|
|
155
146
|
**Structure**:
|
|
156
147
|
```json
|
|
157
148
|
{
|
|
@@ -165,7 +156,7 @@
|
|
|
165
156
|
"tasks": [
|
|
166
157
|
{
|
|
167
158
|
"id": "LEG-01",
|
|
168
|
-
"title": "<Module
|
|
159
|
+
"title": "<Module name>",
|
|
169
160
|
"status": "done",
|
|
170
161
|
"goal": "<One-line summary>. See tasks/LEG-01_<Slug>/spec.md",
|
|
171
162
|
"deps": [],
|
|
@@ -182,9 +173,8 @@
|
|
|
182
173
|
|
|
183
174
|
**Rules**:
|
|
184
175
|
- Functional modules → `phase-0: Legacy`, status `done`, tag `Legacy`, ID prefix `LEG-`
|
|
185
|
-
- Shared/infrastructure code does not enter roadmap; only
|
|
186
|
-
-
|
|
187
|
-
- 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
|
|
188
178
|
|
|
189
179
|
### 3.5 Task Stub Specs
|
|
190
180
|
|
|
@@ -200,71 +190,75 @@
|
|
|
200
190
|
[One paragraph description]
|
|
201
191
|
|
|
202
192
|
## Key Flows
|
|
203
|
-
1. **[Flow
|
|
204
|
-
2. **[Flow Name]**: [A] → [B] → [C]
|
|
193
|
+
1. **[Flow name]**: [A] → [B] → [C]
|
|
205
194
|
|
|
206
195
|
## Associated Files
|
|
207
196
|
- [Role]: `[Path]`
|
|
208
|
-
- [Role]: `[Path]`
|
|
209
197
|
```
|
|
210
198
|
|
|
211
|
-
>
|
|
199
|
+
> Stub is starting point, not final state. Enrich later via `/archi.edit` (auto-triggers `step_1_5_enrich` flow).
|
|
212
200
|
|
|
213
|
-
### 3.6 map.json
|
|
201
|
+
### 3.6 map.json population
|
|
214
202
|
- `directoryMapping`: Each core directory → `{ "path", "layer", "responsibility", "publicAPI" }`
|
|
215
203
|
- `logicalTopology`: Inter-module dependencies → `{ "from", "to", "type" }` (imports / calls / extends)
|
|
216
204
|
- `criticalUserJourneys`: Core flows → `{ "name", "steps": ["module → module → ..."] }`
|
|
217
|
-
- `featureRelations`: Scan code to identify "aggregator modules" and record
|
|
218
|
-
**Recognition
|
|
219
|
-
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" }`
|
|
220
208
|
|
|
221
|
-
### 3.7 Other
|
|
209
|
+
### 3.7 Other global docs (as needed)
|
|
222
210
|
- `dictionary.json`: Extract domain terminology from code
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
- [?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
|
|
226
213
|
- `error_codes.json`: Extract from error definitions in code
|
|
227
214
|
|
|
228
|
-
**
|
|
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.
|
|
229
223
|
</step_3_constitution>
|
|
230
224
|
|
|
231
|
-
<
|
|
232
|
-
**Role**:
|
|
233
|
-
|
|
234
|
-
1. **Vision Alignment**: Does vision.md match actual code functionality?
|
|
235
|
-
2. **Tech Stack Consistency**: Does rule file `02_tech_stack` match package.json/config?
|
|
236
|
-
3. **Map Coverage**: Does map.json cover all core directories?
|
|
237
|
-
4. **Roadmap Completeness**: Does phase-0 cover all identified functional modules?
|
|
238
|
-
5. **Stub Completeness**: Does every LEG-xx have a corresponding tasks/ directory and spec.md?
|
|
239
|
-
6. **Dictionary Consistency**: No ambiguous or duplicate terms?
|
|
225
|
+
<step_4_verify>
|
|
226
|
+
**Role**: Independent Reviewer
|
|
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)]]
|
|
240
228
|
|
|
241
|
-
|
|
242
|
-
</
|
|
229
|
+
[[INCLUDE: shared/verify-result-handling.md]]
|
|
230
|
+
</step_4_verify>
|
|
243
231
|
|
|
244
232
|
<step_5_signoff>
|
|
245
|
-
**Terminal Gate** (
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
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.
|
|
253
247
|
2. Output summary.
|
|
254
248
|
|
|
255
|
-
**Output**: Reverse-engineering summary
|
|
256
|
-
- **Project
|
|
257
|
-
- **Legacy
|
|
258
|
-
- **Generated
|
|
259
|
-
- **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)
|
|
260
254
|
- **Next Steps**:
|
|
261
255
|
|
|
262
|
-
| Priority | Action |
|
|
256
|
+
| Priority | Action | Notes |
|
|
263
257
|
|:---|:---|:---|
|
|
264
|
-
| 1 | Review vision.md | Confirm AI-
|
|
265
|
-
| 2 | `/archi.edit LEG-xx` | Enrich core module stubs into full
|
|
266
|
-
| 3 | `/archi.scope [file_path]` | Plan new
|
|
267
|
-
| 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 |
|
|
268
262
|
</step_5_signoff>
|
|
269
263
|
|
|
270
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>
|