architext 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/CHANGELOG.md +63 -0
  2. package/LICENSE +21 -0
  3. package/README.md +326 -0
  4. package/README.zh-CN.md +326 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +46 -0
  7. package/dist/templates/en/briefs/_base.md +115 -0
  8. package/dist/templates/en/briefs/_modules.md +173 -0
  9. package/dist/templates/en/docs/global/data_snapshot.json +31 -0
  10. package/dist/templates/en/docs/global/design_tokens.json +150 -0
  11. package/dist/templates/en/docs/global/dictionary.json +35 -0
  12. package/dist/templates/en/docs/global/error_codes.json +19 -0
  13. package/dist/templates/en/docs/global/map.json +94 -0
  14. package/dist/templates/en/docs/global/roadmap.json +39 -0
  15. package/dist/templates/en/docs/global/vision.md +82 -0
  16. package/dist/templates/en/docs/prompts/audit.md +150 -0
  17. package/dist/templates/en/docs/prompts/code.md +160 -0
  18. package/dist/templates/en/docs/prompts/edit.md +87 -0
  19. package/dist/templates/en/docs/prompts/fix.md +86 -0
  20. package/dist/templates/en/docs/prompts/help.md +69 -0
  21. package/dist/templates/en/docs/prompts/inherit.md +270 -0
  22. package/dist/templates/en/docs/prompts/map.md +131 -0
  23. package/dist/templates/en/docs/prompts/plan.md +252 -0
  24. package/dist/templates/en/docs/prompts/remove.md +162 -0
  25. package/dist/templates/en/docs/prompts/revise.md +160 -0
  26. package/dist/templates/en/docs/prompts/scope.md +198 -0
  27. package/dist/templates/en/docs/prompts/start.md +258 -0
  28. package/dist/templates/en/docs/templates/plan.template.json +113 -0
  29. package/dist/templates/en/docs/templates/scope-brief.template.md +58 -0
  30. package/dist/templates/en/docs/templates/spec.template.md +51 -0
  31. package/dist/templates/en/docs/templates/ui.template.md +51 -0
  32. package/dist/templates/en/rules/00_system.md +123 -0
  33. package/dist/templates/en/rules/01_workflow.md +93 -0
  34. package/dist/templates/en/rules/02_tech_stack.md +197 -0
  35. package/dist/templates/en/rules/03_data_governance.md +102 -0
  36. package/dist/templates/en/rules/04_cli_tools.md +50 -0
  37. package/dist/templates/en/rules/90_custom_rules.md +22 -0
  38. package/dist/templates/en/rules/99_context_glue.md +53 -0
  39. package/dist/templates/en/skills/archi-decompose-roadmap/SKILL.md +292 -0
  40. package/dist/templates/en/skills/archi-interview-protocol/SKILL.md +86 -0
  41. package/dist/templates/en/skills/archi-plan-options/SKILL.md +364 -0
  42. package/dist/templates/en/skills/archi-ui-wireframe/SKILL.md +342 -0
  43. package/dist/templates/zh/briefs/_base.md +116 -0
  44. package/dist/templates/zh/briefs/_modules.md +173 -0
  45. package/dist/templates/zh/docs/global/data_snapshot.json +31 -0
  46. package/dist/templates/zh/docs/global/design_tokens.json +135 -0
  47. package/dist/templates/zh/docs/global/dictionary.json +35 -0
  48. package/dist/templates/zh/docs/global/error_codes.json +19 -0
  49. package/dist/templates/zh/docs/global/map.json +94 -0
  50. package/dist/templates/zh/docs/global/roadmap.json +39 -0
  51. package/dist/templates/zh/docs/global/vision.md +82 -0
  52. package/dist/templates/zh/docs/prompts/audit.md +150 -0
  53. package/dist/templates/zh/docs/prompts/code.md +160 -0
  54. package/dist/templates/zh/docs/prompts/edit.md +87 -0
  55. package/dist/templates/zh/docs/prompts/fix.md +86 -0
  56. package/dist/templates/zh/docs/prompts/help.md +69 -0
  57. package/dist/templates/zh/docs/prompts/inherit.md +270 -0
  58. package/dist/templates/zh/docs/prompts/map.md +131 -0
  59. package/dist/templates/zh/docs/prompts/plan.md +253 -0
  60. package/dist/templates/zh/docs/prompts/remove.md +162 -0
  61. package/dist/templates/zh/docs/prompts/revise.md +160 -0
  62. package/dist/templates/zh/docs/prompts/scope.md +198 -0
  63. package/dist/templates/zh/docs/prompts/start.md +258 -0
  64. package/dist/templates/zh/docs/templates/plan.template.json +88 -0
  65. package/dist/templates/zh/docs/templates/scope-brief.template.md +58 -0
  66. package/dist/templates/zh/docs/templates/spec.template.md +51 -0
  67. package/dist/templates/zh/docs/templates/ui.template.md +51 -0
  68. package/dist/templates/zh/rules/00_system.md +123 -0
  69. package/dist/templates/zh/rules/01_workflow.md +93 -0
  70. package/dist/templates/zh/rules/02_tech_stack.md +192 -0
  71. package/dist/templates/zh/rules/03_data_governance.md +102 -0
  72. package/dist/templates/zh/rules/04_cli_tools.md +50 -0
  73. package/dist/templates/zh/rules/90_custom_rules.md +21 -0
  74. package/dist/templates/zh/rules/99_context_glue.md +53 -0
  75. package/dist/templates/zh/skills/archi-decompose-roadmap/SKILL.md +293 -0
  76. package/dist/templates/zh/skills/archi-interview-protocol/SKILL.md +86 -0
  77. package/dist/templates/zh/skills/archi-plan-options/SKILL.md +364 -0
  78. package/dist/templates/zh/skills/archi-ui-wireframe/SKILL.md +339 -0
  79. package/dist/templates/zh-Hant/briefs/_base.md +115 -0
  80. package/dist/templates/zh-Hant/briefs/_modules.md +173 -0
  81. package/dist/templates/zh-Hant/docs/global/data_snapshot.json +31 -0
  82. package/dist/templates/zh-Hant/docs/global/design_tokens.json +135 -0
  83. package/dist/templates/zh-Hant/docs/global/dictionary.json +35 -0
  84. package/dist/templates/zh-Hant/docs/global/error_codes.json +19 -0
  85. package/dist/templates/zh-Hant/docs/global/map.json +94 -0
  86. package/dist/templates/zh-Hant/docs/global/roadmap.json +39 -0
  87. package/dist/templates/zh-Hant/docs/global/vision.md +82 -0
  88. package/dist/templates/zh-Hant/docs/prompts/audit.md +150 -0
  89. package/dist/templates/zh-Hant/docs/prompts/code.md +160 -0
  90. package/dist/templates/zh-Hant/docs/prompts/edit.md +87 -0
  91. package/dist/templates/zh-Hant/docs/prompts/fix.md +86 -0
  92. package/dist/templates/zh-Hant/docs/prompts/help.md +69 -0
  93. package/dist/templates/zh-Hant/docs/prompts/inherit.md +270 -0
  94. package/dist/templates/zh-Hant/docs/prompts/map.md +131 -0
  95. package/dist/templates/zh-Hant/docs/prompts/plan.md +252 -0
  96. package/dist/templates/zh-Hant/docs/prompts/remove.md +162 -0
  97. package/dist/templates/zh-Hant/docs/prompts/revise.md +160 -0
  98. package/dist/templates/zh-Hant/docs/prompts/scope.md +198 -0
  99. package/dist/templates/zh-Hant/docs/prompts/start.md +258 -0
  100. package/dist/templates/zh-Hant/docs/templates/plan.template.json +88 -0
  101. package/dist/templates/zh-Hant/docs/templates/scope-brief.template.md +58 -0
  102. package/dist/templates/zh-Hant/docs/templates/spec.template.md +51 -0
  103. package/dist/templates/zh-Hant/docs/templates/ui.template.md +51 -0
  104. package/dist/templates/zh-Hant/rules/00_system.md +123 -0
  105. package/dist/templates/zh-Hant/rules/01_workflow.md +93 -0
  106. package/dist/templates/zh-Hant/rules/02_tech_stack.md +192 -0
  107. package/dist/templates/zh-Hant/rules/03_data_governance.md +102 -0
  108. package/dist/templates/zh-Hant/rules/04_cli_tools.md +50 -0
  109. package/dist/templates/zh-Hant/rules/90_custom_rules.md +21 -0
  110. package/dist/templates/zh-Hant/rules/99_context_glue.md +53 -0
  111. package/dist/templates/zh-Hant/skills/archi-decompose-roadmap/SKILL.md +293 -0
  112. package/dist/templates/zh-Hant/skills/archi-interview-protocol/SKILL.md +86 -0
  113. package/dist/templates/zh-Hant/skills/archi-plan-options/SKILL.md +364 -0
  114. package/dist/templates/zh-Hant/skills/archi-ui-wireframe/SKILL.md +337 -0
  115. package/package.json +85 -0
@@ -0,0 +1,93 @@
1
+ ---
2
+ description: Command Dispatcher & Workflow Controller. Handles /archi.start, /archi.plan, and mode transitions between Discussion, Planning, and Implementation.
3
+ globs: **/*
4
+ applyTo: **/*
5
+ alwaysApply: true
6
+ ---
7
+
8
+ # Workflow Dispatcher
9
+
10
+ > **Role**: Mode Switcher. Default to "General Architect" mode, only load specific protocol when explicit command is detected.
11
+
12
+ > ⛔ **STOP CHECK** — Self-check before each response; stop immediately and explain if any item is triggered:
13
+ > | Violation | Correct Action |
14
+ > |:---|:---|
15
+ > | Received `/archi.*` command but started executing without loading the protocol file | Stop → Load protocol file first |
16
+ > | User request involves behavior change but code was modified directly | Stop → Route to the appropriate command |
17
+ > | Ran a Terminal Gate command without confirming working directory (see `04_cli_tools.md`) | Stop → Pass Working Directory Gate first |
18
+
19
+ ## 1. Explicit Command Routing
20
+
21
+ **Trigger**: When user input starts with `/archi.`, immediately load the corresponding protocol template.
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** (forbidden to skip; three steps must complete in order):
39
+ > 1. **Read** target `.md` full text → if file not found, stop and output: `Protocol file not found, execution aborted`
40
+ > 2. **Override** `00_system` partial settings
41
+ > 3. **Execute** `<step_1>` — forbidden to execute any protocol content before step 1 is complete
42
+
43
+ ---
44
+
45
+ ## 2. Natural Language Passthrough
46
+
47
+ **Trigger**: User input is not `/archi.` command text.
48
+
49
+ ### 2.1 Intent Detection
50
+
51
+ **Role**: Intelligent Dispatcher. Detect user intent and decide to execute directly or route to a command based on impact level.
52
+
53
+ **Decision Criterion**: Does this change affect documented behavior (interfaces/logic/scenarios in spec.md, interactions/structure in ui.md, implementation steps in plan.json)?
54
+
55
+ | Intent Type | Action |
56
+ |:---|:---|
57
+ | Pure conversation / code reading / architecture discussion | ✅ Answer directly, enhanced by base rules |
58
+ | Trivial edits (typo/comments/formatting/log messages) | ✅ Execute directly |
59
+ | Behavior change (logic/interface/type/UI) | 🔀 Route → `/archi.edit` + `/archi.code` |
60
+ | Bug fix | 🔀 Route → `/archi.fix` |
61
+ | New feature | 🔀 Route → `/archi.scope` or `/archi.plan` |
62
+ | Large-scale refactoring | 🔀 Route → `/archi.revise` |
63
+
64
+ ### 2.2 Guided Dispatch
65
+
66
+ When routing (🔀), must:
67
+ 1. Explain in one sentence why a command is needed (which document would be affected)
68
+ 2. Recommend the specific command + parameters
69
+ 3. Ask the user whether to proceed
70
+
71
+ > ⛔ **Prohibited**: Modifying code first and then suggesting the command as an afterthought. Violations require reverting the change and re-routing.
72
+
73
+ ### 2.3 Unmanaged Code
74
+
75
+ When the target of modification is not registered in `map.json` and has no corresponding Task:
76
+ - Inform the user that the module is not managed
77
+ - Suggest `/archi.inherit` or `/archi.scope` to bring it under management
78
+ - After user confirms "temporary adjustment", proceed with direct modification
79
+
80
+ ### 2.4 Base Rules
81
+
82
+ All scenarios (including routing and pure conversation) rely on the following base rules:
83
+
84
+ | Layer | File | Role |
85
+ |:---|:---|:---|
86
+ | Core | `00_system.md` | Identity, core principles |
87
+ | Tech | `02_tech_stack.md` | Tech red lines, coding standards |
88
+ | Custom | `90_custom_rules.md` | Team-specific constraints |
89
+ | Context | `99_context_glue.md` | Auto-associate context documents |
90
+
91
+ **End of Dispatcher.**
92
+
93
+ > Mandatory CLI execution rules: see `04_cli_tools.md`.
@@ -0,0 +1,197 @@
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: [Project Name]
9
+
10
+ > **Role:** The "Law" of the codebase. Defines tools, structure, and engineering workflows.
11
+ > **Status:** [Active]
12
+ > **Note:** This is a template file. Needs to be filled with specific content based on project type (Web/CLI/Backend/Library/Mobile, etc.).
13
+ > Certain sections (like UI Protocol) apply only to UI projects and should be adjusted or removed as needed.
14
+
15
+ ## 1. Global Mandates
16
+
17
+ * **No Hardcoding:** All secrets and API addresses must use environment variables. Hardcoding is strictly forbidden.
18
+ * **No Dead Code:** Committed code must be clean. Commented-out code blocks or useless `TODO`s are strictly forbidden.
19
+ * **Comments for Why:** Comments explain "Why" (business context), not just "What".
20
+
21
+ ---
22
+
23
+ ## 2. Technology Selection
24
+
25
+ ### Core Stack
26
+ * **Framework:** [e.g. Next.js 14 (App Router) / NestJS / Express / FastAPI / Gin]
27
+ * **Language:** [e.g. TypeScript (Strict Mode) / Python 3.11+ / Rust / Go 1.21+]
28
+ * **Styling** (if project has UI): [e.g. TailwindCSS + Shadcn/UI / CSS Modules / Styled Components]
29
+ * **State** (if project has frontend state management): [e.g. Zustand (Client) + React Query (Server) / Redux / MobX]
30
+ * **Database** (if project has data layer): [e.g. PostgreSQL + Prisma ORM / MongoDB / SQLite / Redis]
31
+
32
+ ### Infrastructure
33
+ * **Package Manager:** [e.g. pnpm / npm / yarn / cargo / go mod / pip]
34
+ * **Runtime:** [e.g. Node.js 20+ / Python 3.11+ / Rust / Go 1.21+ / Bun]
35
+ * **Build Tool:** [e.g. tsup / vite / webpack / cargo / go build]
36
+
37
+ ---
38
+
39
+ ## 3. Coding & Naming Standards
40
+
41
+ ### Naming Conventions
42
+ * **Files:** [e.g. `kebab-case` (e.g., `user-profile.ts` / `user_profile.py` / `user_profile.rs`)]
43
+ * **Components/Classes:** [e.g. `PascalCase` (e.g., `UserProfile` / `UserService` / `UserRepository`)]
44
+ * **Functions/Methods:** [e.g. `camelCase` (e.g., `handleSubmit`) or `snake_case` (Python/Rust)]
45
+ * **Constants:** [e.g. `UPPER_SNAKE_CASE` (e.g., `MAX_RETRY` / `MAX_RETRY_COUNT`)]
46
+ * **Private Members:** [e.g. `_privateMethod` (JavaScript) / `__private` (Python) / `private_field` (Rust)]
47
+
48
+ ### Code Patterns
49
+ * **Export Style:** [e.g. Must use Named Export (`export const`), Default Export is strictly forbidden.]
50
+ * **Type Definitions:** [e.g. Must use `interface` for objects, `type` for unions.]
51
+ * **Error Handling:** [e.g. Must use Result type (Rust) / Exception handling (Python/Java) / Error return (Go)]
52
+ * **Async Patterns:** [e.g. Prefer Async/Await, avoid `.then()` chains.]
53
+
54
+ ---
55
+
56
+ ## 4. UI Protocol: ITP v3.0 (Dual-Artifact) [Optional - Only for UI Projects]
57
+ <!-- Core UI Description Protocol -->
58
+ > **Note:** If project has no UI (e.g. CLI, Backend API, Library), remove this section.
59
+
60
+ ### 4.1 Dual-Artifact Strategy
61
+
62
+ UI artifact hierarchy:
63
+
64
+ | Artifact | Format | Reader | Responsibility |
65
+ |:---|:---|:---|:---|
66
+ | `ui_concept.html` | Single-file HTML | Human (browser) | **Global visual source of truth** — wireframes/styled screens for the entire project |
67
+ | `ui_context.md` | Structured Markdown | AI (plan/code/audit/edit) | **AI screen index** — lightweight list of screen IDs / routes / states / navigation graph / shared components |
68
+ | `ui.md` | ITP v3.0 DSL | AI (code/audit) | Task-level UI scope declaration — which screens/components this task covers |
69
+ - `ui_concept.html` is generated by the `archi-ui-wireframe` Skill, covering all user-visible screens; for human browser preview only
70
+ - `ui_context.md` is generated by the same Skill simultaneously; it is the sole AI entry point for UI structure; do not edit manually
71
+ - `ui.md` only declares "which screens/states in ui_context.md this task is responsible for"; do not redefine global layout
72
+ - Code phase uses `ui.md` (task design) + `ui_context.md` (structure/navigation) + `design_tokens.json` (visual constraints) as source; also uses `ui_concept.html` as **read-only visual reference** to calibrate layout; implement equivalent visual effect with the **project's own tech stack**
73
+
74
+ ### 4.2 Naming (PrefixFunction)
75
+ Component naming must follow `Prefix+Function` format:
76
+ * **Btn**: Button | **Inp**: Input | **Txt**: Text/Label
77
+ * **Box**: Container | **Img**: Image/Icon | **List/Card/Modal**: As named.
78
+
79
+ ### 4.3 Syntax Structure
80
+ * **Definition**: `Name [Layout] (Style/Content) -> #Interaction`
81
+ * **Layout Keywords**: `[Row]`, `[Col]`, `[Center]`, `[Between]`, `[Fill]`, `[Grid]`
82
+ * **Example**:
83
+ ```
84
+ BoxHeader [Row, Between]
85
+ TxtTitle [H2] (Text: "Login")
86
+ BtnClose [Ghost] (Icon: X) -> #CloseModal
87
+ ```
88
+
89
+ ### 4.4 Design Tokens
90
+ `design_tokens.json` defines project-specific visual language, generated by `/archi.start` from the Brief:
91
+ - `primitivePalette`: raw color scales (neutral grays + brand colors)
92
+ - `semanticTokens`: semantic colors (Background/Primary/Text…) + typography specs
93
+ - `layout`: radius / shadow / spacing scales
94
+ - `motion`: duration / easing / preference
95
+ - `illustration`: illustration style / icon library
96
+ - **Code phase**: all color / size / motion values must come from the corresponding fields in this file; no hardcoded magic values
97
+
98
+ ### 4.5 Delta Syntax
99
+ * **Usage**: Used to modify existing UI snapshots.
100
+ * **Format**: `@Locator { + Add, ~ Modify, - Remove }`
101
+
102
+ ---
103
+
104
+ ## 5. Testing & Verification
105
+
106
+ ### Static Analysis (Commands)
107
+ * **Build:** [e.g. `pnpm build` / `cargo build` / `go build` / `python -m py_compile`]
108
+ * **Type Check:** [e.g. `pnpm type-check` / `mypy .` / N/A]
109
+ * **Lint:** [e.g. `pnpm lint` / `ruff check .` / `cargo clippy` / `golangci-lint run`]
110
+ * **Format:** [e.g. `pnpm format:check` / `ruff format --check` / `cargo fmt --check`]
111
+
112
+ ### Test Suite
113
+ * **Unit:** Tool: [e.g. Vitest / Jest / pytest / cargo test / go test] Scope: [e.g. Utils functions, core business logic, algorithms] Rule: [e.g. Must Mock external deps; no snapshot tests for volatile UI]
114
+ * **Integration:** Tool: [e.g. Vitest + Testcontainers / pytest + Docker] Scope: [e.g. API→DB write chain / CLI full execution flow]
115
+ * **E2E:** Tool: [e.g. [?Web] Playwright / Cypress [?API] Supertest / httpie [?CLI] bats / shell script [?Lib] example project + automation script [?Mobile] Detox / Maestro] Scope: [e.g. [?Web] Critical user journeys [?API] Key endpoint full chain [?CLI] Key command full flow [?Lib] Public API typical usage scenarios]
116
+ * **Test Command:** [e.g. `pnpm test` / `pytest` / `cargo test` / `go test ./...`]
117
+
118
+ ### Environment Scripts
119
+ > **AI Internal Tooling**: These scripts are auto-generated by AI during INF-01 based on command definitions above. Implementation details (script structure, failure strategy, execution method) are AI-decided; prohibited from asking user. Generate `.sh` / `.ps1` per OS to `[[__DOCS_DIR__]]/scripts/`.
120
+
121
+ * **`[[__DOCS_DIR__]]/scripts/validate`** — Automated quality check (AI runs after every code change): all Static Analysis items + Test Command.
122
+ * **`[[__DOCS_DIR__]]/scripts/dev-up`** — Bring up dev environment: Install → Build → Start Dev Server → Health Check.
123
+ - **Install:** [e.g. `pnpm install` / `pip install -r requirements.txt` / `cargo build` / `go mod download`]
124
+ - **Dev Command:** [e.g. `npm run dev` / `python manage.py runserver` / `cargo run` / N/A]
125
+ - **Health Check:** [e.g. `curl http://localhost:3000/api/health` / `./bin/cli --version` / `python -c "import mylib"`]
126
+ * **`[[__DOCS_DIR__]]/scripts/dev-reset`** — Environment reset (when environment is broken): Kill Processes → Clean Cache → Reinstall → Rebuild → Restart.
127
+
128
+ ---
129
+
130
+ ## 6. Deployment & Release
131
+
132
+ ### CI Pipeline
133
+ * **Pre-commit:** [e.g. Must pass Linter and Formatter checks (ESLint/Prettier / ruff/black / clippy / golangci-lint).]
134
+ * **Merge Gate:** [e.g. PR must pass all Unit/Integration tests before merge.]
135
+ * **Build Check:** [e.g. Must pass build check (`npm run build` / `cargo build` / `go build`).]
136
+
137
+ ### Environment
138
+ * **Secrets:** [e.g. Production secrets must be configured via CI platform, strictly forbidden to commit `.env` / `.env.local`.]
139
+ * **Database Ops** (if project has DB): [e.g. Schema changes must use Migration files, manual modification of production DB is forbidden.]
140
+ * **Binary Distribution** (if project is CLI/Library): [e.g. Use GitHub Releases to publish binaries, support multi-platform builds.]
141
+
142
+ ---
143
+
144
+ ## 7. Architecture & File Placement Strategy
145
+
146
+ ### Repository Architecture
147
+ * **Strategy:** [e.g. Monorepo (Turborepo) or Single Repo]
148
+ * **Workspace:** [e.g. pnpm workspaces, shared dependencies hoisted to Root.]
149
+
150
+ ### Directory Structure
151
+ * **Pattern:** [Architecture Pattern Name]
152
+ * **Philosophy**: [Architecture Philosophy]
153
+ * **Key Paths**:
154
+ * `[Path_1]`: [Description]
155
+ * `[Path_2]`: [Description]
156
+ * **Constraint**: [Architecture Constraints]
157
+
158
+ ### File Placement Rules
159
+ > *Context*: Defines where different types of files should be created. **Must adapt to project type (Web/CLI/API/Lib) and directory structure in `map.json`**; table below is placeholder.
160
+ > **Critical**: Check this table before creating any new file. Once populated, this table is a hard constraint — placement must not rely on AI's default training bias.
161
+
162
+ | File Type | Placement Strategy | Example (adapt per project) |
163
+ | :--- | :--- | :--- |
164
+ | **Unit Tests** | [e.g. Centralized or Colocation] | `__tests__/utils/date.test.ts` / `utils/date.test.ts` |
165
+ | **Interfaces/Types** | [e.g. Near usage or Global types] | `types/user.d.ts` / `domain/user.entity.ts` |
166
+ | **Assets/Images** [?UI] | [e.g. Public or Module assets] | `public/images` / `assets/` |
167
+ | **Styles** [?UI] | [e.g. Per-component or Global] | `Button.module.css` / `global.css` |
168
+ | **DTOs/Models** [?Data] | [e.g. Domain or Shared] | `domain/user/dto` / `models/` |
169
+
170
+ ---
171
+
172
+ ## 8. Anti-Patterns
173
+ * **No Orphan .gitkeep:** Empty dirs may use `.gitkeep` for Git tracking; remove `.gitkeep` when dir has other files.
174
+ * **No Rogue File Placement:** Check §7 File Placement Rules before creating any new file — placement must not rely on AI training-data defaults (especially for test files).
175
+ * **No [Tech 1]:** [e.g. No Redux - This project is too heavy, do not use.]
176
+ * **No [Tech 2]:** [e.g. No Raw SQL - Must use ORM to prevent injection.]
177
+ * **No [Pattern 1]:** [e.g. Forbidden to fetch data directly inside components, must encapsulate in Service layer.]
178
+ * **No [Pattern 2]:** [e.g. Forbidden to use `any` type (TypeScript) / Forbidden to use `unsafe` code (Rust).]
179
+ * **No [Pattern 3]:** [e.g. Forbidden to use `console.log` in production code, must use unified Logger.]
180
+
181
+ ---
182
+
183
+ ## 9. Project Conventions
184
+ > Global architecture conventions established by `/archi.start`. `/archi.plan` auto-inherits these; no per-task re-asking unless the task has specific needs.
185
+ > If a task needs to deviate from a convention, the deviation rationale must be stated in the proposal.
186
+
187
+ ### Error Handling
188
+ * **Strategy:** [e.g. Fail Fast + Form Validation / Fail Fast (stderr) / Schema Validation + Fail Fast]
189
+ * **Rationale:** [e.g. Form-heavy app requiring frontend validation + backend fail-fast]
190
+
191
+ ### Data Flow [?UI]
192
+ * **Default:** [e.g. Standard Request + SWR / Realtime (Socket) / Polling]
193
+ * **Rationale:** [e.g. Most pages are CRUD; SWR for cache and revalidation]
194
+
195
+ ### Auth & Access [?Web/API]
196
+ * **Mechanism:** [e.g. JWT + RBAC / Session + Owner Only / API Key]
197
+ * **Rationale:** [e.g. Multi-role admin system requiring fine-grained access control]
@@ -0,0 +1,102 @@
1
+ ---
2
+ description: AI collaboration governance rules for JSON data files. Defines read/write specs, update timing & format constraints for global data files.
3
+ globs: "**/*.json"
4
+ applyTo: "**/*.json"
5
+ alwaysApply: true
6
+ ---
7
+
8
+ # Data Governance Protocol
9
+
10
+ > **Role**: Data Steward. Ensure consistency, integrity & traceability of global JSON data files.
11
+
12
+ ## 1. Data File Registry
13
+
14
+ | File | Type | Read When | Write When |
15
+ |:---|:---|:---|:---|
16
+ | `roadmap.json` | Roadmap | `/archi.plan`, `/archi.code` start | `/archi.start` creates; AI direct edit or `npx archi task` updates status |
17
+ | `map.json` | Architecture Map | When touching code (via context_glue) | `/archi.plan` Step 3 (global sync); `/archi.inherit` Step 3.6; `/archi.map` |
18
+ | `dictionary.json` | Glossary | When generating variable names | `/archi.plan` Step 3; step_5 auto-appends after code/fix |
19
+ | `design_tokens.json` | Design Tokens [?UI] | When generating UI code | `/archi.start` creates; update on design changes |
20
+ | `data_snapshot.json` | Data Snapshot [?Data] | `/archi.plan` Q1 design; `/archi.code` implementation | Plan phase designs Schema; Code phase syncs actual changes |
21
+ | `error_codes.json` | Error Contracts | When writing error handling | `/archi.plan` Step 3; step_5 auto-appends after code/fix |
22
+
23
+ ---
24
+
25
+ ## 2. General Rules
26
+
27
+ ### 2.1 Format Constraints
28
+
29
+ - **JSON Only**: The single source of truth for global data is `.json` files. `.md` views are auto-generated by `npx archi render`; prohibited from editing `.md` views directly.
30
+ - **Schema Stability**: Managed in two tiers:
31
+ - **Tier 1 (Strict)**: `roadmap.json`, `plan.json` — CLI rendering/commands depend on these directly; structure is validated by Zod Schema; prohibited from changing fields arbitrarily.
32
+ - **Tier 2 (Flexible)**: `dictionary.json`, `error_codes.json`, `data_snapshot.json`, `design_tokens.json`, `map.json` — Only top-level keys are validated. If existing fields cannot adequately describe what needs to be recorded, you may freely extend fields (add new keys or new properties in array items) without modifying the CLI.
33
+ - **Valid JSON**: Must ensure valid JSON after writing (no trailing commas, no comments).
34
+
35
+ ### 2.2 Read/Write Discipline
36
+
37
+ | Scenario | Rule |
38
+ |:---|:---|
39
+ | Need to consult data | Read `.json` file; prohibited from reading `.md` view (may be stale) |
40
+ | Need to update Roadmap task status | Prefer `npx archi task <ID> --status <s>`; batch updates may edit JSON directly |
41
+ | Need to update other data files | AI directly edits `.json` file |
42
+ | After updates | Run `npx archi render` to regenerate `.md` views |
43
+
44
+ ---
45
+
46
+ ## 3. File-Specific Rules
47
+
48
+ ### `roadmap.json`
49
+
50
+ - **Structure**: `phases[] → tasks[]`, each task must have `id`, `title`, `status`, `deps`.
51
+ - **Status values**: `pending` | `active` | `done` | `blocked`.
52
+ - **Dependency integrity**: IDs in `deps` must exist in tasks.
53
+ - **Slug rule**: `slug` is used for tasks folder naming, format `Snake_Case`.
54
+
55
+ ### `map.json`
56
+
57
+ - **Directory Mapping**: Must reflect the real physical file tree.
58
+ - **Logical Topology**: Must register each Task Module's responsibility.
59
+ - **Feature Relations** (field `featureRelations`): Records linkage relationships between aggregator tasks and their sources. Each entry: `{ aggregator, sources, evidence, checkNote }`. Written by AI during `/archi.plan` (when planning an aggregator task) or `/archi.inherit` (during reverse scanning); no manual maintenance needed.
60
+ - **Self-Correction**: If code references violate the hierarchy defined in topology, must report error and stop generation.
61
+ - **Extensible**: If existing fields cannot adequately describe the project architecture, you may add fields to items (e.g. `tags`, `owner`) or add new top-level keys.
62
+
63
+ ### `dictionary.json`
64
+
65
+ - **Naming Authority**: This file is the supreme law of naming.
66
+ - **Boundary**: Only register **project business domain** content. Architext framework concepts (scripts, scaffold, roadmap, plan, etc.) are prohibited from registration.
67
+ - **entities**: Must consult `entities[].codeName` before generating variable names; prohibited from using words in `forbiddenSynonyms`.
68
+ - **verbs**: Business action naming must consult `verbs[].codeName` for project-wide verb consistency.
69
+ - **utilities**: Shared tools (e.g. logger, AppError, fetchClient) must be registered; AI must use registered utilities instead of raw APIs (refer to `replaces` field).
70
+ - **components** [?UI]: Must search existing components before creating new ones; prioritize reuse.
71
+ - **Extensible**: If existing fields cannot adequately describe a term/tool, you may add fields to array items (e.g. `tags`, `scope`, `deprecated`) or add new top-level arrays (e.g. `enums`, `constants`).
72
+
73
+ ### `design_tokens.json` [?UI]
74
+
75
+ - **Token Only**: Styles must strictly use Tokens; prohibited from hardcoding Hex/px/rem.
76
+ - **Dark Mode**: Must define both `light` and `dark` values.
77
+ - **Extensible**: If existing Token structure cannot cover project needs (e.g. `motion`, `breakpoints`, `z-index`), you may add new properties freely.
78
+
79
+ ### `data_snapshot.json` [?Data]
80
+
81
+ - **Structure**: `models[]` (name, fields, types, constraints) + `relationships[]` (inter-model relations: 1:1/1:N/M:N/self-ref).
82
+ - **Design First**: Plan phase must define model structure and field types; prohibited from writing "TBD"; must be precise to field names and types.
83
+ - **Sync Back**: After Code phase completion, must sync actual changes back to this file.
84
+ - **Extensible**: If existing fields cannot adequately describe data models (e.g. need to record `indexes`, `triggers`, `seedData`), you may add fields to model items or at the top level.
85
+
86
+ ### `error_codes.json`
87
+
88
+ - **Boundary**: Only register **project business domain** errors. Framework infrastructure errors (scripts/validate, dev-up, dev-reset, etc.) are handled by scripts themselves via exit code + stderr; prohibited from registration here.
89
+ - **Structure**: `protocolMapping [?API]` (status code → behavior mapping) + `businessErrors` (business error registry).
90
+ - **Code Format**: `ERR_[MODULE]_[REASON]` (e.g. `ERR_AUTH_INVALID_TOKEN`).
91
+ - **statusCode**: Fill per project type (HTTP status / Exit code / leave empty).
92
+ - **Design Before Code**: Must register error codes here before writing error handling code, including `message` and `recovery`.
93
+ - **Extensible**: If existing fields cannot adequately describe error info (e.g. need to record `severity`, `retryable`, `httpBody`), you may add fields to items freely.
94
+
95
+ ---
96
+
97
+ ## 4. Plan JSON (`plan.json`)
98
+
99
+ - **Location**: `tasks/<ID>_<Slug>/plan.json`
100
+ - **Checkbox Updates**: AI sets `done` to `true` directly after completing steps during `/archi.code`.
101
+ - **Append Rule**: `/archi.edit` appends new Phases while preserving completed history.
102
+ - **Verification**: Run `npx archi plan <ID>` to verify completion after finishing.
@@ -0,0 +1,50 @@
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**: Command quick-reference. Provides syntax and parameters for `npx archi` commands, for use during Terminal Gate execution.
11
+
12
+ ## ⛔ Working Directory Gate
13
+
14
+ **Must pass this check before executing any `npx archi` command, otherwise stop**:
15
+
16
+ | Check | Pass Condition |
17
+ |:---|:---|
18
+ | Current directory | Must be project root (directory containing `[[__DOCS_DIR__]]/`) |
19
+ | If unsure | Confirm current directory first; forbidden to guess |
20
+ | In subdirectory | Must `cd` to root before executing |
21
+
22
+ ---
23
+
24
+ ## Command Syntax
25
+
26
+ ### `npx archi task`
27
+
28
+ | Subcommand | Purpose | Example |
29
+ |:---|:---|:---|
30
+ | `npx archi task` | List all tasks with progress | `npx archi task` |
31
+ | `npx archi task <ID> --status <s>` | Update task status | `npx archi task INF-001 --status done` |
32
+ | `npx archi task --check` | Check Roadmap consistency | `npx archi task --check` |
33
+
34
+ **Valid status values**: `pending` / `active` / `done` / `blocked`
35
+
36
+ ### `npx archi plan`
37
+
38
+ | Subcommand | Purpose | Example |
39
+ |:---|:---|:---|
40
+ | `npx archi plan <ID>` | Check Task's Plan completion | `npx archi plan SUB-01` |
41
+
42
+ Automatically identifies Manual Verification sections and excludes them from automated statistics.
43
+
44
+ ### `npx archi render`
45
+
46
+ | Subcommand | Purpose | Example |
47
+ |:---|:---|:---|
48
+ | `npx archi render` | Render all JSON data files into human-readable `.md` views | `npx archi render` |
49
+
50
+ > `.md` views are auto-generated; forbidden to edit directly. Modifications must go through `.json` source files.
@@ -0,0 +1,22 @@
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:** The "House Rules" of this project. When general `02_tech_stack` cannot cover certain details, or there are specific business constraints, this file prevails.
12
+
13
+ ## 1. Team Conventions
14
+
15
+
16
+ ## 2. Business Constraints
17
+
18
+
19
+ ## 3. Specific Anti-Patterns
20
+
21
+
22
+ ## 4. ...
@@ -0,0 +1,53 @@
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**: Context Navigator. Prevent AI amnesia, use Map Look-up to determine the business document corresponding to the current code.
11
+
12
+ ## 1. Context Discovery
13
+
14
+ When reading or editing code files, must execute the following addressing steps:
15
+
16
+ **Step 1: Check Global Map**
17
+ - Read `[[__DOCS_DIR__]]/global/map.json`.
18
+ - Find the module the current file belongs to in `directoryMapping` / `logicalTopology`.
19
+ - Load the Docs Link (Spec/UI/Plan) registered for that module.
20
+
21
+ **Step 2: Check Explicit Context**
22
+ - Scenario: Newly created file or Map not yet updated.
23
+ - Check if user Prompt explicitly specified a document path, if so must load it.
24
+
25
+ **Step 3: Fallback**
26
+ - Not registered in Map and user did not specify → **STOP & ASK**.
27
+ - Prompt: "Spec document for current code not found. Please provide the path, or run `/archi.map` to update the architecture map."
28
+
29
+ ---
30
+
31
+ ## 2. Mandatory Loading Rules
32
+
33
+ | Code Type | Required Context | Source of Truth |
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
+ - Code is the downstream artifact of documentation.
45
+ - Forbidden to guess business logic based on variable names without reading Spec.
46
+ - When code is found inconsistent with documentation: do not arbitrarily fix either, must pause and report the inconsistency.
47
+
48
+ ---
49
+
50
+ ## 4. Maintenance Hook
51
+
52
+ - **Trigger**: When creating a new file or new module.
53
+ - **Action**: Must automatically update `map.json` to establish mapping between code path and document path; only ask user when the mapping relationship is unclear.