@zhuan-ai/zhuanspec 1.3.0

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 (210) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +461 -0
  3. package/README.zh.md +434 -0
  4. package/bin/zhuanspec.js +3 -0
  5. package/dist/cli/index.d.ts +2 -0
  6. package/dist/cli/index.js +356 -0
  7. package/dist/commands/artifact-workflow.d.ts +13 -0
  8. package/dist/commands/artifact-workflow.js +916 -0
  9. package/dist/commands/change.d.ts +35 -0
  10. package/dist/commands/change.js +277 -0
  11. package/dist/commands/completion.d.ts +72 -0
  12. package/dist/commands/completion.js +221 -0
  13. package/dist/commands/config.d.ts +8 -0
  14. package/dist/commands/config.js +198 -0
  15. package/dist/commands/show.d.ts +14 -0
  16. package/dist/commands/show.js +132 -0
  17. package/dist/commands/spec.d.ts +15 -0
  18. package/dist/commands/spec.js +225 -0
  19. package/dist/commands/validate.d.ts +24 -0
  20. package/dist/commands/validate.js +294 -0
  21. package/dist/core/archive.d.ts +30 -0
  22. package/dist/core/archive.js +438 -0
  23. package/dist/core/artifact-graph/graph.d.ts +56 -0
  24. package/dist/core/artifact-graph/graph.js +141 -0
  25. package/dist/core/artifact-graph/index.d.ts +7 -0
  26. package/dist/core/artifact-graph/index.js +13 -0
  27. package/dist/core/artifact-graph/instruction-loader.d.ts +134 -0
  28. package/dist/core/artifact-graph/instruction-loader.js +180 -0
  29. package/dist/core/artifact-graph/resolver.d.ts +61 -0
  30. package/dist/core/artifact-graph/resolver.js +187 -0
  31. package/dist/core/artifact-graph/schema.d.ts +13 -0
  32. package/dist/core/artifact-graph/schema.js +108 -0
  33. package/dist/core/artifact-graph/state.d.ts +12 -0
  34. package/dist/core/artifact-graph/state.js +54 -0
  35. package/dist/core/artifact-graph/types.d.ts +45 -0
  36. package/dist/core/artifact-graph/types.js +43 -0
  37. package/dist/core/completions/command-registry.d.ts +7 -0
  38. package/dist/core/completions/command-registry.js +362 -0
  39. package/dist/core/completions/completion-provider.d.ts +60 -0
  40. package/dist/core/completions/completion-provider.js +102 -0
  41. package/dist/core/completions/factory.d.ts +51 -0
  42. package/dist/core/completions/factory.js +57 -0
  43. package/dist/core/completions/generators/zsh-generator.d.ts +58 -0
  44. package/dist/core/completions/generators/zsh-generator.js +319 -0
  45. package/dist/core/completions/installers/zsh-installer.d.ts +136 -0
  46. package/dist/core/completions/installers/zsh-installer.js +449 -0
  47. package/dist/core/completions/types.d.ts +78 -0
  48. package/dist/core/completions/types.js +2 -0
  49. package/dist/core/config-schema.d.ts +76 -0
  50. package/dist/core/config-schema.js +200 -0
  51. package/dist/core/config.d.ts +16 -0
  52. package/dist/core/config.js +29 -0
  53. package/dist/core/configurators/agents.d.ts +8 -0
  54. package/dist/core/configurators/agents.js +15 -0
  55. package/dist/core/configurators/base.d.ts +7 -0
  56. package/dist/core/configurators/base.js +2 -0
  57. package/dist/core/configurators/claude.d.ts +8 -0
  58. package/dist/core/configurators/claude.js +15 -0
  59. package/dist/core/configurators/cline.d.ts +8 -0
  60. package/dist/core/configurators/cline.js +15 -0
  61. package/dist/core/configurators/codebuddy.d.ts +8 -0
  62. package/dist/core/configurators/codebuddy.js +15 -0
  63. package/dist/core/configurators/costrict.d.ts +8 -0
  64. package/dist/core/configurators/costrict.js +15 -0
  65. package/dist/core/configurators/iflow.d.ts +8 -0
  66. package/dist/core/configurators/iflow.js +15 -0
  67. package/dist/core/configurators/qoder.d.ts +30 -0
  68. package/dist/core/configurators/qoder.js +42 -0
  69. package/dist/core/configurators/qwen.d.ts +24 -0
  70. package/dist/core/configurators/qwen.js +37 -0
  71. package/dist/core/configurators/registry.d.ts +9 -0
  72. package/dist/core/configurators/registry.js +43 -0
  73. package/dist/core/configurators/slash/amazon-q.d.ts +9 -0
  74. package/dist/core/configurators/slash/amazon-q.js +46 -0
  75. package/dist/core/configurators/slash/antigravity.d.ts +9 -0
  76. package/dist/core/configurators/slash/antigravity.js +23 -0
  77. package/dist/core/configurators/slash/auggie.d.ts +9 -0
  78. package/dist/core/configurators/slash/auggie.js +31 -0
  79. package/dist/core/configurators/slash/base.d.ts +19 -0
  80. package/dist/core/configurators/slash/base.js +69 -0
  81. package/dist/core/configurators/slash/claude.d.ts +9 -0
  82. package/dist/core/configurators/slash/claude.js +37 -0
  83. package/dist/core/configurators/slash/cline.d.ts +9 -0
  84. package/dist/core/configurators/slash/cline.js +23 -0
  85. package/dist/core/configurators/slash/codebuddy.d.ts +9 -0
  86. package/dist/core/configurators/slash/codebuddy.js +37 -0
  87. package/dist/core/configurators/slash/codex.d.ts +14 -0
  88. package/dist/core/configurators/slash/codex.js +109 -0
  89. package/dist/core/configurators/slash/costrict.d.ts +9 -0
  90. package/dist/core/configurators/slash/costrict.js +31 -0
  91. package/dist/core/configurators/slash/crush.d.ts +9 -0
  92. package/dist/core/configurators/slash/crush.js +37 -0
  93. package/dist/core/configurators/slash/cursor.d.ts +9 -0
  94. package/dist/core/configurators/slash/cursor.js +37 -0
  95. package/dist/core/configurators/slash/factory.d.ts +10 -0
  96. package/dist/core/configurators/slash/factory.js +35 -0
  97. package/dist/core/configurators/slash/gemini.d.ts +9 -0
  98. package/dist/core/configurators/slash/gemini.js +22 -0
  99. package/dist/core/configurators/slash/github-copilot.d.ts +9 -0
  100. package/dist/core/configurators/slash/github-copilot.js +34 -0
  101. package/dist/core/configurators/slash/iflow.d.ts +9 -0
  102. package/dist/core/configurators/slash/iflow.js +37 -0
  103. package/dist/core/configurators/slash/kilocode.d.ts +9 -0
  104. package/dist/core/configurators/slash/kilocode.js +17 -0
  105. package/dist/core/configurators/slash/opencode.d.ts +12 -0
  106. package/dist/core/configurators/slash/opencode.js +72 -0
  107. package/dist/core/configurators/slash/qoder.d.ts +35 -0
  108. package/dist/core/configurators/slash/qoder.js +76 -0
  109. package/dist/core/configurators/slash/qwen.d.ts +32 -0
  110. package/dist/core/configurators/slash/qwen.js +49 -0
  111. package/dist/core/configurators/slash/registry.d.ts +8 -0
  112. package/dist/core/configurators/slash/registry.js +75 -0
  113. package/dist/core/configurators/slash/roocode.d.ts +9 -0
  114. package/dist/core/configurators/slash/roocode.js +23 -0
  115. package/dist/core/configurators/slash/toml-base.d.ts +10 -0
  116. package/dist/core/configurators/slash/toml-base.js +53 -0
  117. package/dist/core/configurators/slash/windsurf.d.ts +9 -0
  118. package/dist/core/configurators/slash/windsurf.js +23 -0
  119. package/dist/core/converters/json-converter.d.ts +6 -0
  120. package/dist/core/converters/json-converter.js +51 -0
  121. package/dist/core/global-config.d.ts +39 -0
  122. package/dist/core/global-config.js +115 -0
  123. package/dist/core/index.d.ts +2 -0
  124. package/dist/core/index.js +3 -0
  125. package/dist/core/init.d.ts +60 -0
  126. package/dist/core/init.js +861 -0
  127. package/dist/core/list.d.ts +9 -0
  128. package/dist/core/list.js +171 -0
  129. package/dist/core/parsers/change-parser.d.ts +13 -0
  130. package/dist/core/parsers/change-parser.js +193 -0
  131. package/dist/core/parsers/markdown-parser.d.ts +22 -0
  132. package/dist/core/parsers/markdown-parser.js +187 -0
  133. package/dist/core/parsers/requirement-blocks.d.ts +37 -0
  134. package/dist/core/parsers/requirement-blocks.js +201 -0
  135. package/dist/core/project-config.d.ts +34 -0
  136. package/dist/core/project-config.js +79 -0
  137. package/dist/core/schemas/base.schema.d.ts +13 -0
  138. package/dist/core/schemas/base.schema.js +13 -0
  139. package/dist/core/schemas/change.schema.d.ts +73 -0
  140. package/dist/core/schemas/change.schema.js +31 -0
  141. package/dist/core/schemas/index.d.ts +4 -0
  142. package/dist/core/schemas/index.js +4 -0
  143. package/dist/core/schemas/spec.schema.d.ts +18 -0
  144. package/dist/core/schemas/spec.schema.js +15 -0
  145. package/dist/core/skill-discovery.d.ts +24 -0
  146. package/dist/core/skill-discovery.js +153 -0
  147. package/dist/core/specs-apply.d.ts +73 -0
  148. package/dist/core/specs-apply.js +384 -0
  149. package/dist/core/styles/palette.d.ts +7 -0
  150. package/dist/core/styles/palette.js +8 -0
  151. package/dist/core/templates/agents-root-stub.d.ts +2 -0
  152. package/dist/core/templates/agents-root-stub.js +17 -0
  153. package/dist/core/templates/agents-template.d.ts +2 -0
  154. package/dist/core/templates/agents-template.js +706 -0
  155. package/dist/core/templates/claude-template.d.ts +2 -0
  156. package/dist/core/templates/claude-template.js +2 -0
  157. package/dist/core/templates/cline-template.d.ts +2 -0
  158. package/dist/core/templates/cline-template.js +2 -0
  159. package/dist/core/templates/costrict-template.d.ts +2 -0
  160. package/dist/core/templates/costrict-template.js +2 -0
  161. package/dist/core/templates/index.d.ts +17 -0
  162. package/dist/core/templates/index.js +37 -0
  163. package/dist/core/templates/project-template.d.ts +8 -0
  164. package/dist/core/templates/project-template.js +32 -0
  165. package/dist/core/templates/skill-templates.d.ts +103 -0
  166. package/dist/core/templates/skill-templates.js +2131 -0
  167. package/dist/core/templates/slash-command-templates.d.ts +4 -0
  168. package/dist/core/templates/slash-command-templates.js +81 -0
  169. package/dist/core/update.d.ts +4 -0
  170. package/dist/core/update.js +88 -0
  171. package/dist/core/validation/constants.d.ts +34 -0
  172. package/dist/core/validation/constants.js +40 -0
  173. package/dist/core/validation/types.d.ts +18 -0
  174. package/dist/core/validation/types.js +2 -0
  175. package/dist/core/validation/validator.d.ts +33 -0
  176. package/dist/core/validation/validator.js +409 -0
  177. package/dist/core/view.d.ts +8 -0
  178. package/dist/core/view.js +168 -0
  179. package/dist/index.d.ts +3 -0
  180. package/dist/index.js +3 -0
  181. package/dist/utils/change-metadata.d.ts +47 -0
  182. package/dist/utils/change-metadata.js +130 -0
  183. package/dist/utils/change-utils.d.ts +51 -0
  184. package/dist/utils/change-utils.js +100 -0
  185. package/dist/utils/file-system.d.ts +19 -0
  186. package/dist/utils/file-system.js +177 -0
  187. package/dist/utils/index.d.ts +4 -0
  188. package/dist/utils/index.js +5 -0
  189. package/dist/utils/interactive.d.ts +18 -0
  190. package/dist/utils/interactive.js +21 -0
  191. package/dist/utils/item-discovery.d.ts +4 -0
  192. package/dist/utils/item-discovery.js +72 -0
  193. package/dist/utils/match.d.ts +3 -0
  194. package/dist/utils/match.js +22 -0
  195. package/dist/utils/shell-detection.d.ts +20 -0
  196. package/dist/utils/shell-detection.js +41 -0
  197. package/dist/utils/task-progress.d.ts +8 -0
  198. package/dist/utils/task-progress.js +36 -0
  199. package/package.json +81 -0
  200. package/schemas/spec-driven/schema.yaml +205 -0
  201. package/schemas/spec-driven/templates/design.md +19 -0
  202. package/schemas/spec-driven/templates/proposal.md +43 -0
  203. package/schemas/spec-driven/templates/spec.md +8 -0
  204. package/schemas/spec-driven/templates/tasks.md +25 -0
  205. package/schemas/tdd/schema.yaml +213 -0
  206. package/schemas/tdd/templates/docs.md +0 -0
  207. package/schemas/tdd/templates/implementation.md +11 -0
  208. package/schemas/tdd/templates/spec.md +11 -0
  209. package/schemas/tdd/templates/test.md +11 -0
  210. package/scripts/postinstall.js +147 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 OpenSpec Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,461 @@
1
+ <p align="center">
2
+ <a href="https://github.com/Fission-AI/ZhuanSpec">
3
+ <picture>
4
+ <source srcset="assets/openspec_pixel_dark.svg" media="(prefers-color-scheme: dark)">
5
+ <source srcset="assets/openspec_pixel_light.svg" media="(prefers-color-scheme: light)">
6
+ <img src="assets/openspec_pixel_light.svg" alt="ZhuanSpec logo" height="64">
7
+ </picture>
8
+ </a>
9
+
10
+ </p>
11
+ <p align="center">Spec-driven development for AI coding assistants.</p>
12
+ <p align="center">
13
+ <a href="https://github.com/Fission-AI/ZhuanSpec/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/Fission-AI/ZhuanSpec/actions/workflows/ci.yml/badge.svg" /></a>
14
+ <a href="https://www.npmjs.com/package/@fission-ai/zhuanspec"><img alt="npm version" src="https://img.shields.io/npm/v/@fission-ai/zhuanspec?style=flat-square" /></a>
15
+ <a href="https://nodejs.org/"><img alt="node version" src="https://img.shields.io/node/v/@fission-ai/zhuanspec?style=flat-square" /></a>
16
+ <a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" /></a>
17
+ <a href="https://conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square" /></a>
18
+ <a href="https://discord.gg/YctCnvvshC"><img alt="Discord" src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white&style=flat-square" /></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <img src="assets/openspec_dashboard.png" alt="ZhuanSpec dashboard preview" width="90%">
23
+ </p>
24
+
25
+ <p align="center">
26
+ Follow <a href="https://x.com/0xTab">@0xTab on X</a> for updates · Join the <a href="https://discord.gg/YctCnvvshC">ZhuanSpec Discord</a> for help and questions.
27
+ </p>
28
+
29
+ # ZhuanSpec
30
+
31
+ ZhuanSpec aligns humans and AI coding assistants with spec-driven development so you agree on what to build before any code is written. **No API keys required.**
32
+
33
+ ## Why ZhuanSpec?
34
+
35
+ AI coding assistants are powerful but unpredictable when requirements live in chat history. ZhuanSpec adds a lightweight specification workflow that locks intent before implementation, giving you deterministic, reviewable outputs.
36
+
37
+ Key outcomes:
38
+ - Human and AI stakeholders agree on specs before work begins.
39
+ - Structured change folders (proposals, tasks, and spec updates) keep scope explicit and auditable.
40
+ - Shared visibility into what's proposed, active, or archived.
41
+ - Works with the AI tools you already use: custom slash commands where supported, context rules everywhere else.
42
+
43
+ ## How ZhuanSpec compares (at a glance)
44
+
45
+ - **Lightweight**: simple workflow, no API keys, minimal setup.
46
+ - **Brownfield-first**: works great beyond 0→1. ZhuanSpec separates the source of truth from proposals: `zhuanspec/specs/` (current truth) and `zhuanspec/changes/` (proposed updates). This keeps diffs explicit and manageable across features.
47
+ - **Change tracking**: proposals, tasks, and spec deltas live together; archiving merges the approved updates back into specs.
48
+ - **Compared to spec-kit & Kiro**: those shine for brand-new features (0→1). ZhuanSpec also excels when modifying existing behavior (1→n), especially when updates span multiple specs.
49
+
50
+ See the full comparison in [How ZhuanSpec Compares](#how-zhuanspec-compares).
51
+
52
+ ## How It Works
53
+
54
+ ```
55
+ ┌────────────────────┐
56
+ │ Draft Change │
57
+ │ Proposal │
58
+ └────────┬───────────┘
59
+ │ share intent with your AI
60
+
61
+ ┌────────────────────┐
62
+ │ Review & Align │
63
+ │ (edit specs/tasks) │◀──── feedback loop ──────┐
64
+ └────────┬───────────┘ │
65
+ │ approved plan │
66
+ ▼ │
67
+ ┌────────────────────┐ │
68
+ │ Implement Tasks │──────────────────────────┘
69
+ │ (AI writes code) │
70
+ └────────┬───────────┘
71
+ │ ship the change
72
+
73
+ ┌────────────────────┐
74
+ │ Archive & Update │
75
+ │ Specs (source) │
76
+ └────────────────────┘
77
+
78
+ 1. Draft a change proposal that captures the spec updates you want.
79
+ 2. Review the proposal with your AI assistant until everyone agrees.
80
+ 3. Implement tasks that reference the agreed specs.
81
+ 4. Archive the change to merge the approved updates back into the source-of-truth specs.
82
+ ```
83
+
84
+ ## Getting Started
85
+
86
+ ### Supported AI Tools
87
+
88
+ <details>
89
+ <summary><strong>Native Slash Commands</strong> (click to expand)</summary>
90
+
91
+ These tools have built-in ZhuanSpec commands. Select the ZhuanSpec integration when prompted.
92
+
93
+ | Tool | Commands |
94
+ |------|----------|
95
+ | **Amazon Q Developer** | `@zhuanspec-proposal`, `@zhuanspec-apply`, `@zhuanspec-archive` (`.amazonq/prompts/`) |
96
+ | **Antigravity** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.agent/workflows/`) |
97
+ | **Auggie (Augment CLI)** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.augment/commands/`) |
98
+ | **Claude Code** | `/zhuanspec:proposal`, `/zhuanspec:apply`, `/zhuanspec:archive` |
99
+ | **Cline** | Workflows in `.clinerules/workflows/` directory (`.clinerules/workflows/zhuanspec-*.md`) |
100
+ | **CodeBuddy Code (CLI)** | `/zhuanspec:proposal`, `/zhuanspec:apply`, `/zhuanspec:archive` (`.codebuddy/commands/`) — see [docs](https://www.codebuddy.ai/cli) |
101
+ | **Codex** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (global: `~/.codex/prompts`, auto-installed) |
102
+ | **CoStrict** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.cospec/zhuanspec/commands/`) — see [docs](https://costrict.ai)|
103
+ | **Crush** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.crush/commands/zhuanspec/`) |
104
+ | **Cursor** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` |
105
+ | **Factory Droid** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.factory/commands/`) |
106
+ | **Gemini CLI** | `/zhuanspec:proposal`, `/zhuanspec:apply`, `/zhuanspec:archive` (`.gemini/commands/zhuanspec/`) |
107
+ | **GitHub Copilot** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.github/prompts/`) |
108
+ | **iFlow (iflow-cli)** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.iflow/commands/`) |
109
+ | **Kilo Code** | `/zhuanspec-proposal.md`, `/zhuanspec-apply.md`, `/zhuanspec-archive.md` (`.kilocode/workflows/`) |
110
+ | **OpenCode** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` |
111
+ | **Qoder (CLI)** | `/zhuanspec:proposal`, `/zhuanspec:apply`, `/zhuanspec:archive` (`.qoder/commands/zhuanspec/`) — see [docs](https://qoder.com/cli) |
112
+ | **Qwen Code** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.qwen/commands/`) |
113
+ | **RooCode** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.roo/commands/`) |
114
+ | **Windsurf** | `/zhuanspec-proposal`, `/zhuanspec-apply`, `/zhuanspec-archive` (`.windsurf/workflows/`) |
115
+
116
+ Kilo Code discovers team workflows automatically. Save the generated files under `.kilocode/workflows/` and trigger them from the command palette with `/zhuanspec-proposal.md`, `/zhuanspec-apply.md`, or `/zhuanspec-archive.md`.
117
+
118
+ </details>
119
+
120
+ <details>
121
+ <summary><strong>AGENTS.md Compatible</strong> (click to expand)</summary>
122
+
123
+ These tools automatically read workflow instructions from `zhuanspec/AGENTS.md`. Ask them to follow the ZhuanSpec workflow if they need a reminder. Learn more about the [AGENTS.md convention](https://agents.md/).
124
+
125
+ | Tools |
126
+ |-------|
127
+ | Amp • Jules • Others |
128
+
129
+ </details>
130
+
131
+ ### Install & Initialize
132
+
133
+ #### Prerequisites
134
+ - **Node.js >= 20.19.0** - Check your version with `node --version`
135
+
136
+ #### Step 1: Install the CLI globally
137
+
138
+ ```bash
139
+ npm install -g @fission-ai/zhuanspec@latest
140
+ ```
141
+
142
+ Or install from a local tarball (e.g. `distributions/fission-ai-zhuanspec-1.0.0.tgz`): see [Installing ZhuanSpec](#installing-zhuanspec).
143
+
144
+ Verify installation:
145
+ ```bash
146
+ zhuanspec --version
147
+ ```
148
+
149
+ #### Step 2: Initialize ZhuanSpec in your project
150
+
151
+ Navigate to your project directory:
152
+ ```bash
153
+ cd my-project
154
+ ```
155
+
156
+ Run the initialization:
157
+ ```bash
158
+ zhuanspec init
159
+ ```
160
+
161
+ **What happens during initialization:**
162
+ - You'll be prompted to pick any natively supported AI tools (Claude Code, CodeBuddy, Cursor, OpenCode, Qoder,etc.); other assistants always rely on the shared `AGENTS.md` stub
163
+ - ZhuanSpec automatically configures slash commands for the tools you choose and always writes a managed `AGENTS.md` hand-off at the project root
164
+ - A new `zhuanspec/` directory structure is created in your project
165
+
166
+ **After setup:**
167
+ - Primary AI tools can trigger `/zhuanspec` workflows without additional configuration
168
+ - Run `zhuanspec list` to verify the setup and view any active changes
169
+ - If your coding assistant doesn't surface the new slash commands right away, restart it. Slash commands are loaded at startup,
170
+ so a fresh launch ensures they appear
171
+
172
+ ### Optional: Populate Project Context
173
+
174
+ After `zhuanspec init` completes, you'll receive a suggested prompt to help populate your project context:
175
+
176
+ ```text
177
+ Populate your project context:
178
+ "Please read zhuanspec/project.md and help me fill it out with details about my project, tech stack, and conventions"
179
+ ```
180
+
181
+ Use `zhuanspec/project.md` to define project-level conventions, standards, architectural patterns, and other guidelines that should be followed across all changes.
182
+
183
+ ### Create Your First Change
184
+
185
+ Here's a real example showing the complete ZhuanSpec workflow. This works with any AI tool. Those with native slash commands will recognize the shortcuts automatically.
186
+
187
+ #### 1. Draft the Proposal
188
+ Start by asking your AI to create a change proposal:
189
+
190
+ ```text
191
+ You: Create a ZhuanSpec change proposal for adding profile search filters by role and team
192
+ (Shortcut for tools with slash commands: /zhuanspec:proposal Add profile search filters)
193
+
194
+ AI: I'll create a ZhuanSpec change proposal for profile filters.
195
+ *Scaffolds zhuanspec/changes/add-profile-filters/ with proposal.md, tasks.md, spec deltas.*
196
+ ```
197
+
198
+ #### 2. Verify & Review
199
+ Check that the change was created correctly and review the proposal:
200
+
201
+ ```bash
202
+ $ zhuanspec list # Confirm the change folder exists
203
+ $ zhuanspec validate add-profile-filters # Validate spec formatting
204
+ $ zhuanspec show add-profile-filters # Review proposal, tasks, and spec delta
205
+ ```
206
+
207
+ #### 3. Refine the Specs
208
+ Iterate on the specifications until they match your needs:
209
+
210
+ ```text
211
+ You: Can you add acceptance criteria for the role and team filters?
212
+
213
+ AI: I'll update the spec delta with scenarios for role and team filters.
214
+ *Edits zhuanspec/changes/add-profile-filters/specs/profile/spec.md and tasks.md.*
215
+ ```
216
+
217
+ #### 4. Implement the Change
218
+ Once specs look good, start implementation:
219
+
220
+ ```text
221
+ You: The specs look good. Let's implement this change.
222
+ (Shortcut for tools with slash commands: /zhuanspec:apply add-profile-filters)
223
+
224
+ AI: I'll work through the tasks in the add-profile-filters change.
225
+ *Implements tasks from zhuanspec/changes/add-profile-filters/tasks.md*
226
+ *Marks tasks complete: Task 1.1 ✓, Task 1.2 ✓, Task 2.1 ✓...*
227
+ ```
228
+
229
+ #### 5. Archive the Completed Change
230
+ After implementation is complete, archive the change:
231
+
232
+ ```text
233
+ AI: All tasks are complete. The implementation is ready.
234
+
235
+ You: Please archive the change
236
+ (Shortcut for tools with slash commands: /zhuanspec:archive add-profile-filters)
237
+
238
+ AI: I'll archive the add-profile-filters change.
239
+ *Runs: zhuanspec archive add-profile-filters --yes*
240
+ ✓ Change archived successfully. Specs updated. Ready for the next feature!
241
+ ```
242
+
243
+ Or run the command yourself in terminal:
244
+ ```bash
245
+ $ zhuanspec archive add-profile-filters --yes # Archive the completed change without prompts
246
+ ```
247
+
248
+ **Note:** Tools with native slash commands (Claude Code, CodeBuddy, Cursor, Codex, Qoder, RooCode) can use the shortcuts shown. All other tools work with natural language requests to "create a ZhuanSpec proposal", "apply the ZhuanSpec change", or "archive the change".
249
+
250
+ ## Command Reference
251
+
252
+ ### `zhuanspec init`
253
+
254
+ Initialize ZhuanSpec in your project. Creates the directory structure, template files, and configures AI tool integrations.
255
+
256
+ ```bash
257
+ zhuanspec init [path] [options]
258
+ ```
259
+
260
+ **Arguments:**
261
+
262
+ | Argument | Description | Default |
263
+ |----------|-------------|---------|
264
+ | `[path]` | Target project directory | `.` (current directory) |
265
+
266
+ **Options:**
267
+
268
+ | Option | Description | Example |
269
+ |--------|-------------|---------|
270
+ | `--tools <tools>` | Configure AI tools non-interactively. Accepts `all`, `none`, or a comma-separated list of tool IDs | `--tools claude,cursor` |
271
+ | `--business-direction <direction>` | Specify a business direction to use the corresponding microservice architecture document as `project.md` | `--business-direction oms` |
272
+
273
+ **Usage examples:**
274
+
275
+ ```bash
276
+ # Interactive mode (default) — prompts you to select AI tools
277
+ zhuanspec init
278
+
279
+ # Initialize a specific directory
280
+ zhuanspec init ./my-project
281
+
282
+ # Non-interactive mode — configure specific tools without prompts
283
+ zhuanspec init --tools claude,cursor
284
+
285
+ # Configure all available tools
286
+ zhuanspec init --tools all
287
+
288
+ # Initialize with a business direction — uses the architecture doc as project.md
289
+ zhuanspec init --business-direction oms
290
+
291
+ # Combine options
292
+ zhuanspec init --tools claude --business-direction oms
293
+ ```
294
+
295
+ **What `--business-direction` does:**
296
+
297
+ When specified, ZhuanSpec looks for a microservice architecture document named `{direction}_project_architect.md` (e.g., `oms_project_architect.md`) and uses it to directly replace the generated `zhuanspec/project.md`. This is useful for teams that have pre-built service architecture documents and want the AI assistant to understand the full microservice topology from the start.
298
+
299
+ Without this option, `project.md` is generated from the default template with placeholder sections for you to fill in.
300
+
301
+ **What happens during initialization:**
302
+
303
+ 1. Creates the `zhuanspec/` directory structure (`specs/`, `changes/`, `changes/archive/`)
304
+ 2. Generates template files (`AGENTS.md`, `project.md`)
305
+ 3. Configures AI tool integrations and slash commands for the tools you selected
306
+ 4. Writes a managed `AGENTS.md` stub at the project root
307
+
308
+ **Extend mode:** If `zhuanspec/` already exists, init runs in extend mode — it preserves existing files and only adds missing ones or refreshes tool configurations.
309
+
310
+ ### Other Commands
311
+
312
+ ```bash
313
+ zhuanspec list # View active change folders
314
+ zhuanspec view # Interactive dashboard of specs and changes
315
+ zhuanspec show <change> # Display change details (proposal, tasks, spec updates)
316
+ zhuanspec validate <change> # Check spec formatting and structure
317
+ zhuanspec archive <change> [--yes|-y] # Move a completed change into archive/ (non-interactive with --yes)
318
+ ```
319
+
320
+ ## Example: How AI Creates ZhuanSpec Files
321
+
322
+ When you ask your AI assistant to "add two-factor authentication", it creates:
323
+
324
+ ```
325
+ zhuanspec/
326
+ ├── specs/
327
+ │ └── auth/
328
+ │ └── spec.md # Current auth spec (if exists)
329
+ └── changes/
330
+ └── add-2fa/ # AI creates this entire structure
331
+ ├── proposal.md # Why and what changes
332
+ ├── tasks.md # Implementation checklist
333
+ ├── design.md # Technical decisions (optional)
334
+ └── specs/
335
+ └── auth/
336
+ └── spec.md # Delta showing additions
337
+ ```
338
+
339
+ ### AI-Generated Spec (created in `zhuanspec/specs/auth/spec.md`):
340
+
341
+ ```markdown
342
+ # Auth Specification
343
+
344
+ ## Purpose
345
+ Authentication and session management.
346
+
347
+ ## Requirements
348
+ ### Requirement: User Authentication
349
+ The system SHALL issue a JWT on successful login.
350
+
351
+ #### Scenario: Valid credentials
352
+ - WHEN a user submits valid credentials
353
+ - THEN a JWT is returned
354
+ ```
355
+
356
+ ### AI-Generated Change Delta (created in `zhuanspec/changes/add-2fa/specs/auth/spec.md`):
357
+
358
+ ```markdown
359
+ # Delta for Auth
360
+
361
+ ## ADDED Requirements
362
+ ### Requirement: Two-Factor Authentication
363
+ The system MUST require a second factor during login.
364
+
365
+ #### Scenario: OTP required
366
+ - WHEN a user submits valid credentials
367
+ - THEN an OTP challenge is required
368
+ ```
369
+
370
+ ### AI-Generated Tasks (created in `zhuanspec/changes/add-2fa/tasks.md`):
371
+
372
+ ```markdown
373
+ ## 1. Database Setup
374
+ - [ ] 1.1 Add OTP secret column to users table
375
+ - [ ] 1.2 Create OTP verification logs table
376
+
377
+ ## 2. Backend Implementation
378
+ - [ ] 2.1 Add OTP generation endpoint
379
+ - [ ] 2.2 Modify login flow to require OTP
380
+ - [ ] 2.3 Add OTP verification endpoint
381
+
382
+ ## 3. Frontend Updates
383
+ - [ ] 3.1 Create OTP input component
384
+ - [ ] 3.2 Update login flow UI
385
+ ```
386
+
387
+ **Important:** You don't create these files manually. Your AI assistant generates them based on your requirements and the existing codebase.
388
+
389
+ ## Understanding ZhuanSpec Files
390
+
391
+ ### Delta Format
392
+
393
+ Deltas are "patches" that show how specs change:
394
+
395
+ - **`## ADDED Requirements`** - New capabilities
396
+ - **`## MODIFIED Requirements`** - Changed behavior (include complete updated text)
397
+ - **`## REMOVED Requirements`** - Deprecated features
398
+
399
+ **Format requirements:**
400
+ - Use `### Requirement: <name>` for headers
401
+ - Every requirement needs at least one `#### Scenario:` block
402
+ - Use SHALL/MUST in requirement text
403
+
404
+ ## How ZhuanSpec Compares
405
+
406
+ ### vs. spec-kit
407
+ ZhuanSpec’s two-folder model (`zhuanspec/specs/` for the current truth, `zhuanspec/changes/` for proposed updates) keeps state and diffs separate. This scales when you modify existing features or touch multiple specs. spec-kit is strong for greenfield/0→1 but provides less structure for cross-spec updates and evolving features.
408
+
409
+ ### vs. Kiro.dev
410
+ ZhuanSpec groups every change for a feature in one folder (`zhuanspec/changes/feature-name/`), making it easy to track related specs, tasks, and designs together. Kiro spreads updates across multiple spec folders, which can make feature tracking harder.
411
+
412
+ ### vs. No Specs
413
+ Without specs, AI coding assistants generate code from vague prompts, often missing requirements or adding unwanted features. ZhuanSpec brings predictability by agreeing on the desired behavior before any code is written.
414
+
415
+ ## Team Adoption
416
+
417
+ 1. **Initialize ZhuanSpec** – Run `zhuanspec init` in your repo.
418
+ 2. **Start with new features** – Ask your AI to capture upcoming work as change proposals.
419
+ 3. **Grow incrementally** – Each change archives into living specs that document your system.
420
+ 4. **Stay flexible** – Different teammates can use Claude Code, CodeBuddy, Cursor, or any AGENTS.md-compatible tool while sharing the same specs.
421
+
422
+ Run `zhuanspec update` whenever someone switches tools so your agents pick up the latest instructions and slash-command bindings.
423
+
424
+ ## Installing ZhuanSpec
425
+
426
+ ### From npm (recommended)
427
+
428
+ ```bash
429
+ npm install -g @fission-ai/zhuanspec@latest
430
+ ```
431
+
432
+ ### Local installation
433
+
434
+ If you need to install from a local tarball or git repository, see [INSTALLATION.md](./INSTALLATION.md) for detailed instructions.
435
+
436
+ For pre-built packages, use the `.tgz` file from the `distributions/` folder:
437
+
438
+ ```bash
439
+ npm install -g ./distributions/fission-ai-zhuanspec-1.0.0.tgz
440
+ ```
441
+
442
+ ## Updating ZhuanSpec
443
+
444
+ 1. **Upgrade the package**
445
+ ```bash
446
+ npm install -g @fission-ai/zhuanspec@latest
447
+ ```
448
+ 2. **Refresh agent instructions**
449
+ - Run `zhuanspec update` inside each project to regenerate AI guidance and ensure the latest slash commands are active.
450
+
451
+ ## Contributing
452
+
453
+ - Install dependencies: `pnpm install`
454
+ - Build: `pnpm run build`
455
+ - Test: `pnpm test`
456
+ - Develop CLI locally: `pnpm run dev` or `pnpm run dev:cli`
457
+ - Conventional commits (one-line): `type(scope): subject`
458
+
459
+ ## License
460
+
461
+ MIT