@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
@@ -0,0 +1,46 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.amazonq/prompts/zhuanspec-proposal.md',
4
+ apply: '.amazonq/prompts/zhuanspec-apply.md',
5
+ archive: '.amazonq/prompts/zhuanspec-archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
10
+ ---
11
+
12
+ The user has requested the following change proposal. Use the zhuanspec instructions to create their change proposal.
13
+
14
+ <UserRequest>
15
+ $ARGUMENTS
16
+ </UserRequest>`,
17
+ apply: `---
18
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
19
+ ---
20
+
21
+ The user wants to apply the following change. Use the zhuanspec instructions to implement the approved change.
22
+
23
+ <ChangeId>
24
+ $ARGUMENTS
25
+ </ChangeId>`,
26
+ archive: `---
27
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
28
+ ---
29
+
30
+ The user wants to archive the following deployed change. Use the zhuanspec instructions to archive the change and update specs.
31
+
32
+ <ChangeId>
33
+ $ARGUMENTS
34
+ </ChangeId>`
35
+ };
36
+ export class AmazonQSlashCommandConfigurator extends SlashCommandConfigurator {
37
+ toolId = 'amazon-q';
38
+ isAvailable = true;
39
+ getRelativePath(id) {
40
+ return FILE_PATHS[id];
41
+ }
42
+ getFrontmatter(id) {
43
+ return FRONTMATTER[id];
44
+ }
45
+ }
46
+ //# sourceMappingURL=amazon-q.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class AntigravitySlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "antigravity";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string | undefined;
8
+ }
9
+ //# sourceMappingURL=antigravity.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.agent/workflows/zhuanspec-proposal.md',
4
+ apply: '.agent/workflows/zhuanspec-apply.md',
5
+ archive: '.agent/workflows/zhuanspec-archive.md'
6
+ };
7
+ const DESCRIPTIONS = {
8
+ proposal: '搭建新的 ZhuanSpec 变更并严格验证。',
9
+ apply: '实施已批准的 ZhuanSpec 变更并保持任务同步。',
10
+ archive: '归档已部署的 ZhuanSpec 变更并更新规范。'
11
+ };
12
+ export class AntigravitySlashCommandConfigurator extends SlashCommandConfigurator {
13
+ toolId = 'antigravity';
14
+ isAvailable = true;
15
+ getRelativePath(id) {
16
+ return FILE_PATHS[id];
17
+ }
18
+ getFrontmatter(id) {
19
+ const description = DESCRIPTIONS[id];
20
+ return `---\ndescription: ${description}\n---`;
21
+ }
22
+ }
23
+ //# sourceMappingURL=antigravity.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class AuggieSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "auggie";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ }
9
+ //# sourceMappingURL=auggie.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.augment/commands/zhuanspec-proposal.md',
4
+ apply: '.augment/commands/zhuanspec-apply.md',
5
+ archive: '.augment/commands/zhuanspec-archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
10
+ argument-hint: feature description or request
11
+ ---`,
12
+ apply: `---
13
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
14
+ argument-hint: change-id
15
+ ---`,
16
+ archive: `---
17
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
18
+ argument-hint: change-id
19
+ ---`
20
+ };
21
+ export class AuggieSlashCommandConfigurator extends SlashCommandConfigurator {
22
+ toolId = 'auggie';
23
+ isAvailable = true;
24
+ getRelativePath(id) {
25
+ return FILE_PATHS[id];
26
+ }
27
+ getFrontmatter(id) {
28
+ return FRONTMATTER[id];
29
+ }
30
+ }
31
+ //# sourceMappingURL=auggie.js.map
@@ -0,0 +1,19 @@
1
+ import { SlashCommandId } from '../../templates/index.js';
2
+ export interface SlashCommandTarget {
3
+ id: SlashCommandId;
4
+ path: string;
5
+ kind: 'slash';
6
+ }
7
+ export declare abstract class SlashCommandConfigurator {
8
+ abstract readonly toolId: string;
9
+ abstract readonly isAvailable: boolean;
10
+ getTargets(): SlashCommandTarget[];
11
+ generateAll(projectPath: string, _zhuanspecDir: string): Promise<string[]>;
12
+ updateExisting(projectPath: string, _zhuanspecDir: string): Promise<string[]>;
13
+ protected abstract getRelativePath(id: SlashCommandId): string;
14
+ protected abstract getFrontmatter(id: SlashCommandId): string | undefined;
15
+ protected getBody(id: SlashCommandId): string;
16
+ resolveAbsolutePath(projectPath: string, id: SlashCommandId): string;
17
+ protected updateBody(filePath: string, body: string): Promise<void>;
18
+ }
19
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1,69 @@
1
+ import { FileSystemUtils } from '../../../utils/file-system.js';
2
+ import { TemplateManager } from '../../templates/index.js';
3
+ import { ZHUANSPEC_MARKERS } from '../../config.js';
4
+ const ALL_COMMANDS = ['proposal', 'apply', 'archive'];
5
+ export class SlashCommandConfigurator {
6
+ getTargets() {
7
+ return ALL_COMMANDS.map((id) => ({
8
+ id,
9
+ path: this.getRelativePath(id),
10
+ kind: 'slash'
11
+ }));
12
+ }
13
+ async generateAll(projectPath, _zhuanspecDir) {
14
+ const createdOrUpdated = [];
15
+ for (const target of this.getTargets()) {
16
+ const body = this.getBody(target.id);
17
+ const filePath = FileSystemUtils.joinPath(projectPath, target.path);
18
+ if (await FileSystemUtils.fileExists(filePath)) {
19
+ await this.updateBody(filePath, body);
20
+ }
21
+ else {
22
+ const frontmatter = this.getFrontmatter(target.id);
23
+ const sections = [];
24
+ if (frontmatter) {
25
+ sections.push(frontmatter.trim());
26
+ }
27
+ sections.push(`${ZHUANSPEC_MARKERS.start}\n${body}\n${ZHUANSPEC_MARKERS.end}`);
28
+ const content = sections.join('\n') + '\n';
29
+ await FileSystemUtils.writeFile(filePath, content);
30
+ }
31
+ createdOrUpdated.push(target.path);
32
+ }
33
+ return createdOrUpdated;
34
+ }
35
+ async updateExisting(projectPath, _zhuanspecDir) {
36
+ const updated = [];
37
+ for (const target of this.getTargets()) {
38
+ const filePath = FileSystemUtils.joinPath(projectPath, target.path);
39
+ if (await FileSystemUtils.fileExists(filePath)) {
40
+ const body = this.getBody(target.id);
41
+ await this.updateBody(filePath, body);
42
+ updated.push(target.path);
43
+ }
44
+ }
45
+ return updated;
46
+ }
47
+ getBody(id) {
48
+ return TemplateManager.getSlashCommandBody(id).trim();
49
+ }
50
+ // Resolve absolute path for a given slash command target. Subclasses may override
51
+ // to redirect to tool-specific locations (e.g., global directories).
52
+ resolveAbsolutePath(projectPath, id) {
53
+ const rel = this.getRelativePath(id);
54
+ return FileSystemUtils.joinPath(projectPath, rel);
55
+ }
56
+ async updateBody(filePath, body) {
57
+ const content = await FileSystemUtils.readFile(filePath);
58
+ const startIndex = content.indexOf(ZHUANSPEC_MARKERS.start);
59
+ const endIndex = content.indexOf(ZHUANSPEC_MARKERS.end);
60
+ if (startIndex === -1 || endIndex === -1 || endIndex <= startIndex) {
61
+ throw new Error(`Missing ZhuanSpec markers in ${filePath}`);
62
+ }
63
+ const before = content.slice(0, startIndex + ZHUANSPEC_MARKERS.start.length);
64
+ const after = content.slice(endIndex);
65
+ const updatedContent = `${before}\n${body}\n${after}`;
66
+ await FileSystemUtils.writeFile(filePath, updatedContent);
67
+ }
68
+ }
69
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class ClaudeSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "claude";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ }
9
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.claude/commands/zhuanspec/proposal.md',
4
+ apply: '.claude/commands/zhuanspec/apply.md',
5
+ archive: '.claude/commands/zhuanspec/archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ name: ZhuanSpec: Proposal
10
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
11
+ category: ZhuanSpec
12
+ tags: [zhuanspec, change]
13
+ ---`,
14
+ apply: `---
15
+ name: ZhuanSpec: Apply
16
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
17
+ category: ZhuanSpec
18
+ tags: [zhuanspec, apply]
19
+ ---`,
20
+ archive: `---
21
+ name: ZhuanSpec: Archive
22
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
23
+ category: ZhuanSpec
24
+ tags: [zhuanspec, archive]
25
+ ---`
26
+ };
27
+ export class ClaudeSlashCommandConfigurator extends SlashCommandConfigurator {
28
+ toolId = 'claude';
29
+ isAvailable = true;
30
+ getRelativePath(id) {
31
+ return FILE_PATHS[id];
32
+ }
33
+ getFrontmatter(id) {
34
+ return FRONTMATTER[id];
35
+ }
36
+ }
37
+ //# sourceMappingURL=claude.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class ClineSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "cline";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string | undefined;
8
+ }
9
+ //# sourceMappingURL=cline.d.ts.map
@@ -0,0 +1,23 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.clinerules/workflows/zhuanspec-proposal.md',
4
+ apply: '.clinerules/workflows/zhuanspec-apply.md',
5
+ archive: '.clinerules/workflows/zhuanspec-archive.md'
6
+ };
7
+ export class ClineSlashCommandConfigurator extends SlashCommandConfigurator {
8
+ toolId = 'cline';
9
+ isAvailable = true;
10
+ getRelativePath(id) {
11
+ return FILE_PATHS[id];
12
+ }
13
+ getFrontmatter(id) {
14
+ const descriptions = {
15
+ proposal: '搭建新的 ZhuanSpec 变更并严格验证。',
16
+ apply: '实施已批准的 ZhuanSpec 变更并保持任务同步。',
17
+ archive: '归档已部署的 ZhuanSpec 变更并更新规范。'
18
+ };
19
+ const description = descriptions[id];
20
+ return `# ZhuanSpec: ${id.charAt(0).toUpperCase() + id.slice(1)}\n\n${description}`;
21
+ }
22
+ }
23
+ //# sourceMappingURL=cline.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class CodeBuddySlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "codebuddy";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ }
9
+ //# sourceMappingURL=codebuddy.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.codebuddy/commands/zhuanspec/proposal.md',
4
+ apply: '.codebuddy/commands/zhuanspec/apply.md',
5
+ archive: '.codebuddy/commands/zhuanspec/archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ name: ZhuanSpec: Proposal
10
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
11
+ category: ZhuanSpec
12
+ tags: [zhuanspec, change]
13
+ ---`,
14
+ apply: `---
15
+ name: ZhuanSpec: Apply
16
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
17
+ category: ZhuanSpec
18
+ tags: [zhuanspec, apply]
19
+ ---`,
20
+ archive: `---
21
+ name: ZhuanSpec: Archive
22
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
23
+ category: ZhuanSpec
24
+ tags: [zhuanspec, archive]
25
+ ---`
26
+ };
27
+ export class CodeBuddySlashCommandConfigurator extends SlashCommandConfigurator {
28
+ toolId = 'codebuddy';
29
+ isAvailable = true;
30
+ getRelativePath(id) {
31
+ return FILE_PATHS[id];
32
+ }
33
+ getFrontmatter(id) {
34
+ return FRONTMATTER[id];
35
+ }
36
+ }
37
+ //# sourceMappingURL=codebuddy.js.map
@@ -0,0 +1,14 @@
1
+ import { SlashCommandConfigurator } from "./base.js";
2
+ import { SlashCommandId } from "../../templates/index.js";
3
+ export declare class CodexSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "codex";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string | undefined;
8
+ private getGlobalPromptsDir;
9
+ generateAll(projectPath: string, _zhuanspecDir: string): Promise<string[]>;
10
+ updateExisting(projectPath: string, _zhuanspecDir: string): Promise<string[]>;
11
+ private updateFullFile;
12
+ resolveAbsolutePath(_projectPath: string, id: SlashCommandId): string;
13
+ }
14
+ //# sourceMappingURL=codex.d.ts.map
@@ -0,0 +1,109 @@
1
+ import path from "path";
2
+ import os from "os";
3
+ import { SlashCommandConfigurator } from "./base.js";
4
+ import { TemplateManager } from "../../templates/index.js";
5
+ import { FileSystemUtils } from "../../../utils/file-system.js";
6
+ import { ZHUANSPEC_MARKERS } from "../../config.js";
7
+ // Use POSIX-style paths for consistent logging across platforms.
8
+ const FILE_PATHS = {
9
+ proposal: ".codex/prompts/zhuanspec-proposal.md",
10
+ apply: ".codex/prompts/zhuanspec-apply.md",
11
+ archive: ".codex/prompts/zhuanspec-archive.md",
12
+ };
13
+ export class CodexSlashCommandConfigurator extends SlashCommandConfigurator {
14
+ toolId = "codex";
15
+ isAvailable = true;
16
+ getRelativePath(id) {
17
+ return FILE_PATHS[id];
18
+ }
19
+ getFrontmatter(id) {
20
+ // Codex supports YAML frontmatter with description and argument-hint fields,
21
+ // plus $ARGUMENTS to capture all arguments as a single string.
22
+ const frontmatter = {
23
+ proposal: `---
24
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
25
+ argument-hint: request or feature description
26
+ ---
27
+
28
+ $ARGUMENTS`,
29
+ apply: `---
30
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
31
+ argument-hint: change-id
32
+ ---
33
+
34
+ $ARGUMENTS`,
35
+ archive: `---
36
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
37
+ argument-hint: change-id
38
+ ---
39
+
40
+ $ARGUMENTS`,
41
+ };
42
+ return frontmatter[id];
43
+ }
44
+ getGlobalPromptsDir() {
45
+ const home = (process.env.CODEX_HOME && process.env.CODEX_HOME.trim())
46
+ ? process.env.CODEX_HOME.trim()
47
+ : FileSystemUtils.joinPath(os.homedir(), ".codex");
48
+ return FileSystemUtils.joinPath(home, "prompts");
49
+ }
50
+ // Codex discovers prompts globally. Generate directly in the global directory
51
+ // and wrap shared body with markers.
52
+ async generateAll(projectPath, _zhuanspecDir) {
53
+ const createdOrUpdated = [];
54
+ for (const target of this.getTargets()) {
55
+ const body = TemplateManager.getSlashCommandBody(target.id).trim();
56
+ const promptsDir = this.getGlobalPromptsDir();
57
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
58
+ await FileSystemUtils.createDirectory(path.dirname(filePath));
59
+ if (await FileSystemUtils.fileExists(filePath)) {
60
+ await this.updateFullFile(filePath, target.id, body);
61
+ }
62
+ else {
63
+ const frontmatter = this.getFrontmatter(target.id);
64
+ const sections = [];
65
+ if (frontmatter)
66
+ sections.push(frontmatter.trim());
67
+ sections.push(`${ZHUANSPEC_MARKERS.start}\n${body}\n${ZHUANSPEC_MARKERS.end}`);
68
+ await FileSystemUtils.writeFile(filePath, sections.join("\n") + "\n");
69
+ }
70
+ createdOrUpdated.push(target.path);
71
+ }
72
+ return createdOrUpdated;
73
+ }
74
+ async updateExisting(projectPath, _zhuanspecDir) {
75
+ const updated = [];
76
+ for (const target of this.getTargets()) {
77
+ const promptsDir = this.getGlobalPromptsDir();
78
+ const filePath = FileSystemUtils.joinPath(promptsDir, path.basename(target.path));
79
+ if (await FileSystemUtils.fileExists(filePath)) {
80
+ const body = TemplateManager.getSlashCommandBody(target.id).trim();
81
+ await this.updateFullFile(filePath, target.id, body);
82
+ updated.push(target.path);
83
+ }
84
+ }
85
+ return updated;
86
+ }
87
+ // Update both frontmatter and body in an existing file
88
+ async updateFullFile(filePath, id, body) {
89
+ const content = await FileSystemUtils.readFile(filePath);
90
+ const startIndex = content.indexOf(ZHUANSPEC_MARKERS.start);
91
+ if (startIndex === -1) {
92
+ throw new Error(`Missing ZhuanSpec start marker in ${filePath}`);
93
+ }
94
+ // Replace everything before the start marker with the new frontmatter
95
+ const frontmatter = this.getFrontmatter(id);
96
+ const sections = [];
97
+ if (frontmatter)
98
+ sections.push(frontmatter.trim());
99
+ sections.push(`${ZHUANSPEC_MARKERS.start}\n${body}\n${ZHUANSPEC_MARKERS.end}`);
100
+ await FileSystemUtils.writeFile(filePath, sections.join("\n") + "\n");
101
+ }
102
+ // Resolve to the global prompts location for configuration detection
103
+ resolveAbsolutePath(_projectPath, id) {
104
+ const promptsDir = this.getGlobalPromptsDir();
105
+ const fileName = path.basename(FILE_PATHS[id]);
106
+ return FileSystemUtils.joinPath(promptsDir, fileName);
107
+ }
108
+ }
109
+ //# sourceMappingURL=codex.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class CostrictSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "costrict";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string | undefined;
8
+ }
9
+ //# sourceMappingURL=costrict.d.ts.map
@@ -0,0 +1,31 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.cospec/zhuanspec/commands/zhuanspec-proposal.md',
4
+ apply: '.cospec/zhuanspec/commands/zhuanspec-apply.md',
5
+ archive: '.cospec/zhuanspec/commands/zhuanspec-archive.md',
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ description: "搭建新的 ZhuanSpec 变更并严格验证。"
10
+ argument-hint: feature description or request
11
+ ---`,
12
+ apply: `---
13
+ description: "实施已批准的 ZhuanSpec 变更并保持任务同步。"
14
+ argument-hint: change-id
15
+ ---`,
16
+ archive: `---
17
+ description: "归档已部署的 ZhuanSpec 变更并更新规范。"
18
+ argument-hint: change-id
19
+ ---`
20
+ };
21
+ export class CostrictSlashCommandConfigurator extends SlashCommandConfigurator {
22
+ toolId = 'costrict';
23
+ isAvailable = true;
24
+ getRelativePath(id) {
25
+ return FILE_PATHS[id];
26
+ }
27
+ getFrontmatter(id) {
28
+ return FRONTMATTER[id];
29
+ }
30
+ }
31
+ //# sourceMappingURL=costrict.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class CrushSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "crush";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ }
9
+ //# sourceMappingURL=crush.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.crush/commands/zhuanspec/proposal.md',
4
+ apply: '.crush/commands/zhuanspec/apply.md',
5
+ archive: '.crush/commands/zhuanspec/archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ name: ZhuanSpec: Proposal
10
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
11
+ category: ZhuanSpec
12
+ tags: [zhuanspec, change]
13
+ ---`,
14
+ apply: `---
15
+ name: ZhuanSpec: Apply
16
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
17
+ category: ZhuanSpec
18
+ tags: [zhuanspec, apply]
19
+ ---`,
20
+ archive: `---
21
+ name: ZhuanSpec: Archive
22
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
23
+ category: ZhuanSpec
24
+ tags: [zhuanspec, archive]
25
+ ---`
26
+ };
27
+ export class CrushSlashCommandConfigurator extends SlashCommandConfigurator {
28
+ toolId = 'crush';
29
+ isAvailable = true;
30
+ getRelativePath(id) {
31
+ return FILE_PATHS[id];
32
+ }
33
+ getFrontmatter(id) {
34
+ return FRONTMATTER[id];
35
+ }
36
+ }
37
+ //# sourceMappingURL=crush.js.map
@@ -0,0 +1,9 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class CursorSlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "cursor";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ }
9
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1,37 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.cursor/commands/zhuanspec-proposal.md',
4
+ apply: '.cursor/commands/zhuanspec-apply.md',
5
+ archive: '.cursor/commands/zhuanspec-archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ name: /zhuanspec-proposal
10
+ id: zhuanspec-proposal
11
+ category: ZhuanSpec
12
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
13
+ ---`,
14
+ apply: `---
15
+ name: /zhuanspec-apply
16
+ id: zhuanspec-apply
17
+ category: ZhuanSpec
18
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
19
+ ---`,
20
+ archive: `---
21
+ name: /zhuanspec-archive
22
+ id: zhuanspec-archive
23
+ category: ZhuanSpec
24
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
25
+ ---`
26
+ };
27
+ export class CursorSlashCommandConfigurator extends SlashCommandConfigurator {
28
+ toolId = 'cursor';
29
+ isAvailable = true;
30
+ getRelativePath(id) {
31
+ return FILE_PATHS[id];
32
+ }
33
+ getFrontmatter(id) {
34
+ return FRONTMATTER[id];
35
+ }
36
+ }
37
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1,10 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ import { SlashCommandId } from '../../templates/index.js';
3
+ export declare class FactorySlashCommandConfigurator extends SlashCommandConfigurator {
4
+ readonly toolId = "factory";
5
+ readonly isAvailable = true;
6
+ protected getRelativePath(id: SlashCommandId): string;
7
+ protected getFrontmatter(id: SlashCommandId): string;
8
+ protected getBody(id: SlashCommandId): string;
9
+ }
10
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1,35 @@
1
+ import { SlashCommandConfigurator } from './base.js';
2
+ const FILE_PATHS = {
3
+ proposal: '.factory/commands/zhuanspec-proposal.md',
4
+ apply: '.factory/commands/zhuanspec-apply.md',
5
+ archive: '.factory/commands/zhuanspec-archive.md'
6
+ };
7
+ const FRONTMATTER = {
8
+ proposal: `---
9
+ description: 搭建新的 ZhuanSpec 变更并严格验证。
10
+ argument-hint: request or feature description
11
+ ---`,
12
+ apply: `---
13
+ description: 实施已批准的 ZhuanSpec 变更并保持任务同步。
14
+ argument-hint: change-id
15
+ ---`,
16
+ archive: `---
17
+ description: 归档已部署的 ZhuanSpec 变更并更新规范。
18
+ argument-hint: change-id
19
+ ---`
20
+ };
21
+ export class FactorySlashCommandConfigurator extends SlashCommandConfigurator {
22
+ toolId = 'factory';
23
+ isAvailable = true;
24
+ getRelativePath(id) {
25
+ return FILE_PATHS[id];
26
+ }
27
+ getFrontmatter(id) {
28
+ return FRONTMATTER[id];
29
+ }
30
+ getBody(id) {
31
+ const baseBody = super.getBody(id);
32
+ return `${baseBody}\n\n$ARGUMENTS`;
33
+ }
34
+ }
35
+ //# sourceMappingURL=factory.js.map