@fission-ai/openspec 0.23.0 → 1.0.1

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 (191) hide show
  1. package/README.md +111 -382
  2. package/dist/cli/index.js +120 -6
  3. package/dist/commands/workflow/index.d.ts +17 -0
  4. package/dist/commands/workflow/index.js +12 -0
  5. package/dist/commands/workflow/instructions.d.ts +29 -0
  6. package/dist/commands/workflow/instructions.js +381 -0
  7. package/dist/commands/workflow/new-change.d.ts +11 -0
  8. package/dist/commands/workflow/new-change.js +44 -0
  9. package/dist/commands/workflow/schemas.d.ts +10 -0
  10. package/dist/commands/workflow/schemas.js +34 -0
  11. package/dist/commands/workflow/shared.d.ts +52 -0
  12. package/dist/commands/workflow/shared.js +111 -0
  13. package/dist/commands/workflow/status.d.ts +14 -0
  14. package/dist/commands/workflow/status.js +58 -0
  15. package/dist/commands/workflow/templates.d.ts +16 -0
  16. package/dist/commands/workflow/templates.js +68 -0
  17. package/dist/core/artifact-graph/instruction-loader.d.ts +5 -1
  18. package/dist/core/artifact-graph/instruction-loader.js +8 -19
  19. package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
  20. package/dist/core/command-generation/adapters/amazon-q.js +26 -0
  21. package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
  22. package/dist/core/command-generation/adapters/antigravity.js +26 -0
  23. package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
  24. package/dist/core/command-generation/adapters/auggie.js +27 -0
  25. package/dist/core/command-generation/adapters/claude.d.ts +13 -0
  26. package/dist/core/command-generation/adapters/claude.js +50 -0
  27. package/dist/core/command-generation/adapters/cline.d.ts +14 -0
  28. package/dist/core/command-generation/adapters/cline.js +27 -0
  29. package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
  30. package/dist/core/command-generation/adapters/codebuddy.js +28 -0
  31. package/dist/core/command-generation/adapters/codex.d.ts +13 -0
  32. package/dist/core/command-generation/adapters/codex.js +27 -0
  33. package/dist/core/command-generation/adapters/continue.d.ts +13 -0
  34. package/dist/core/command-generation/adapters/continue.js +28 -0
  35. package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
  36. package/dist/core/command-generation/adapters/costrict.js +27 -0
  37. package/dist/core/command-generation/adapters/crush.d.ts +13 -0
  38. package/dist/core/command-generation/adapters/crush.js +30 -0
  39. package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
  40. package/dist/core/command-generation/adapters/cursor.js +44 -0
  41. package/dist/core/command-generation/adapters/factory.d.ts +13 -0
  42. package/dist/core/command-generation/adapters/factory.js +27 -0
  43. package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
  44. package/dist/core/command-generation/adapters/gemini.js +26 -0
  45. package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
  46. package/dist/core/command-generation/adapters/github-copilot.js +26 -0
  47. package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
  48. package/dist/core/command-generation/adapters/iflow.js +29 -0
  49. package/dist/core/command-generation/adapters/index.d.ts +27 -0
  50. package/dist/core/command-generation/adapters/index.js +27 -0
  51. package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
  52. package/dist/core/command-generation/adapters/kilocode.js +23 -0
  53. package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
  54. package/dist/core/command-generation/adapters/opencode.js +26 -0
  55. package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
  56. package/dist/core/command-generation/adapters/qoder.js +30 -0
  57. package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
  58. package/dist/core/command-generation/adapters/qwen.js +26 -0
  59. package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
  60. package/dist/core/command-generation/adapters/roocode.js +27 -0
  61. package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
  62. package/dist/core/command-generation/adapters/windsurf.js +51 -0
  63. package/dist/core/command-generation/generator.d.ts +21 -0
  64. package/dist/core/command-generation/generator.js +27 -0
  65. package/dist/core/command-generation/index.d.ts +22 -0
  66. package/dist/core/command-generation/index.js +24 -0
  67. package/dist/core/command-generation/registry.d.ts +36 -0
  68. package/dist/core/command-generation/registry.js +88 -0
  69. package/dist/core/command-generation/types.d.ts +55 -0
  70. package/dist/core/command-generation/types.js +8 -0
  71. package/dist/core/config.d.ts +1 -0
  72. package/dist/core/config.js +21 -21
  73. package/dist/core/init.d.ts +16 -36
  74. package/dist/core/init.js +323 -534
  75. package/dist/core/legacy-cleanup.d.ts +162 -0
  76. package/dist/core/legacy-cleanup.js +501 -0
  77. package/dist/core/project-config.js +2 -2
  78. package/dist/core/shared/index.d.ts +8 -0
  79. package/dist/core/shared/index.js +8 -0
  80. package/dist/core/shared/skill-generation.d.ts +41 -0
  81. package/dist/core/shared/skill-generation.js +76 -0
  82. package/dist/core/shared/tool-detection.d.ts +66 -0
  83. package/dist/core/shared/tool-detection.js +140 -0
  84. package/dist/core/templates/index.d.ts +7 -16
  85. package/dist/core/templates/index.js +8 -36
  86. package/dist/core/templates/skill-templates.d.ts +13 -0
  87. package/dist/core/templates/skill-templates.js +634 -44
  88. package/dist/core/update.d.ts +38 -0
  89. package/dist/core/update.js +280 -62
  90. package/dist/prompts/searchable-multi-select.d.ts +27 -0
  91. package/dist/prompts/searchable-multi-select.js +149 -0
  92. package/dist/ui/ascii-patterns.d.ts +16 -0
  93. package/dist/ui/ascii-patterns.js +133 -0
  94. package/dist/ui/welcome-screen.d.ts +10 -0
  95. package/dist/ui/welcome-screen.js +146 -0
  96. package/dist/utils/change-utils.d.ts +3 -3
  97. package/dist/utils/change-utils.js +3 -3
  98. package/dist/utils/file-system.d.ts +11 -0
  99. package/dist/utils/file-system.js +65 -2
  100. package/dist/utils/index.d.ts +1 -0
  101. package/dist/utils/index.js +2 -0
  102. package/package.json +1 -1
  103. package/dist/commands/artifact-workflow.d.ts +0 -17
  104. package/dist/commands/artifact-workflow.js +0 -915
  105. package/dist/core/configurators/agents.d.ts +0 -8
  106. package/dist/core/configurators/agents.js +0 -15
  107. package/dist/core/configurators/base.d.ts +0 -7
  108. package/dist/core/configurators/base.js +0 -2
  109. package/dist/core/configurators/claude.d.ts +0 -8
  110. package/dist/core/configurators/claude.js +0 -15
  111. package/dist/core/configurators/cline.d.ts +0 -8
  112. package/dist/core/configurators/cline.js +0 -15
  113. package/dist/core/configurators/codebuddy.d.ts +0 -8
  114. package/dist/core/configurators/codebuddy.js +0 -15
  115. package/dist/core/configurators/costrict.d.ts +0 -8
  116. package/dist/core/configurators/costrict.js +0 -15
  117. package/dist/core/configurators/iflow.d.ts +0 -8
  118. package/dist/core/configurators/iflow.js +0 -15
  119. package/dist/core/configurators/qoder.d.ts +0 -30
  120. package/dist/core/configurators/qoder.js +0 -42
  121. package/dist/core/configurators/qwen.d.ts +0 -24
  122. package/dist/core/configurators/qwen.js +0 -37
  123. package/dist/core/configurators/registry.d.ts +0 -9
  124. package/dist/core/configurators/registry.js +0 -43
  125. package/dist/core/configurators/slash/amazon-q.d.ts +0 -9
  126. package/dist/core/configurators/slash/amazon-q.js +0 -46
  127. package/dist/core/configurators/slash/antigravity.d.ts +0 -9
  128. package/dist/core/configurators/slash/antigravity.js +0 -23
  129. package/dist/core/configurators/slash/auggie.d.ts +0 -9
  130. package/dist/core/configurators/slash/auggie.js +0 -31
  131. package/dist/core/configurators/slash/base.d.ts +0 -19
  132. package/dist/core/configurators/slash/base.js +0 -69
  133. package/dist/core/configurators/slash/claude.d.ts +0 -9
  134. package/dist/core/configurators/slash/claude.js +0 -37
  135. package/dist/core/configurators/slash/cline.d.ts +0 -9
  136. package/dist/core/configurators/slash/cline.js +0 -23
  137. package/dist/core/configurators/slash/codebuddy.d.ts +0 -9
  138. package/dist/core/configurators/slash/codebuddy.js +0 -34
  139. package/dist/core/configurators/slash/codex.d.ts +0 -14
  140. package/dist/core/configurators/slash/codex.js +0 -109
  141. package/dist/core/configurators/slash/continue.d.ts +0 -9
  142. package/dist/core/configurators/slash/continue.js +0 -46
  143. package/dist/core/configurators/slash/costrict.d.ts +0 -9
  144. package/dist/core/configurators/slash/costrict.js +0 -31
  145. package/dist/core/configurators/slash/crush.d.ts +0 -9
  146. package/dist/core/configurators/slash/crush.js +0 -37
  147. package/dist/core/configurators/slash/cursor.d.ts +0 -9
  148. package/dist/core/configurators/slash/cursor.js +0 -37
  149. package/dist/core/configurators/slash/factory.d.ts +0 -10
  150. package/dist/core/configurators/slash/factory.js +0 -35
  151. package/dist/core/configurators/slash/gemini.d.ts +0 -9
  152. package/dist/core/configurators/slash/gemini.js +0 -22
  153. package/dist/core/configurators/slash/github-copilot.d.ts +0 -9
  154. package/dist/core/configurators/slash/github-copilot.js +0 -34
  155. package/dist/core/configurators/slash/iflow.d.ts +0 -9
  156. package/dist/core/configurators/slash/iflow.js +0 -37
  157. package/dist/core/configurators/slash/kilocode.d.ts +0 -9
  158. package/dist/core/configurators/slash/kilocode.js +0 -17
  159. package/dist/core/configurators/slash/opencode.d.ts +0 -12
  160. package/dist/core/configurators/slash/opencode.js +0 -72
  161. package/dist/core/configurators/slash/qoder.d.ts +0 -35
  162. package/dist/core/configurators/slash/qoder.js +0 -76
  163. package/dist/core/configurators/slash/qwen.d.ts +0 -32
  164. package/dist/core/configurators/slash/qwen.js +0 -49
  165. package/dist/core/configurators/slash/registry.d.ts +0 -8
  166. package/dist/core/configurators/slash/registry.js +0 -78
  167. package/dist/core/configurators/slash/roocode.d.ts +0 -9
  168. package/dist/core/configurators/slash/roocode.js +0 -23
  169. package/dist/core/configurators/slash/toml-base.d.ts +0 -10
  170. package/dist/core/configurators/slash/toml-base.js +0 -53
  171. package/dist/core/configurators/slash/windsurf.d.ts +0 -9
  172. package/dist/core/configurators/slash/windsurf.js +0 -23
  173. package/dist/core/templates/agents-root-stub.d.ts +0 -2
  174. package/dist/core/templates/agents-root-stub.js +0 -17
  175. package/dist/core/templates/agents-template.d.ts +0 -2
  176. package/dist/core/templates/agents-template.js +0 -458
  177. package/dist/core/templates/claude-template.d.ts +0 -2
  178. package/dist/core/templates/claude-template.js +0 -2
  179. package/dist/core/templates/cline-template.d.ts +0 -2
  180. package/dist/core/templates/cline-template.js +0 -2
  181. package/dist/core/templates/costrict-template.d.ts +0 -2
  182. package/dist/core/templates/costrict-template.js +0 -2
  183. package/dist/core/templates/project-template.d.ts +0 -8
  184. package/dist/core/templates/project-template.js +0 -32
  185. package/dist/core/templates/slash-command-templates.d.ts +0 -4
  186. package/dist/core/templates/slash-command-templates.js +0 -49
  187. package/schemas/tdd/schema.yaml +0 -213
  188. package/schemas/tdd/templates/docs.md +0 -15
  189. package/schemas/tdd/templates/implementation.md +0 -11
  190. package/schemas/tdd/templates/spec.md +0 -11
  191. package/schemas/tdd/templates/test.md +0 -11
@@ -1,915 +0,0 @@
1
- /**
2
- * Artifact Workflow CLI Commands (Experimental)
3
- *
4
- * This file contains all artifact workflow commands in isolation for easy removal.
5
- * Commands expose the ArtifactGraph and InstructionLoader APIs to users and agents.
6
- *
7
- * To remove this feature:
8
- * 1. Delete this file
9
- * 2. Remove the registerArtifactWorkflowCommands() call from src/cli/index.ts
10
- */
11
- import ora from 'ora';
12
- import chalk from 'chalk';
13
- import path from 'path';
14
- import * as fs from 'fs';
15
- import { loadChangeContext, formatChangeStatus, generateInstructions, listSchemas, listSchemasWithInfo, getSchemaDir, resolveSchema, ArtifactGraph, } from '../core/artifact-graph/index.js';
16
- import { createChange, validateChangeName } from '../utils/change-utils.js';
17
- import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getBulkArchiveChangeSkillTemplate, getVerifyChangeSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate, getOpsxBulkArchiveCommandTemplate, getOpsxVerifyCommandTemplate } from '../core/templates/skill-templates.js';
18
- import { FileSystemUtils } from '../utils/file-system.js';
19
- import { serializeConfig } from '../core/config-prompts.js';
20
- const DEFAULT_SCHEMA = 'spec-driven';
21
- /**
22
- * Checks if color output is disabled via NO_COLOR env or --no-color flag.
23
- */
24
- function isColorDisabled() {
25
- return process.env.NO_COLOR === '1' || process.env.NO_COLOR === 'true';
26
- }
27
- /**
28
- * Gets the color function based on status.
29
- */
30
- function getStatusColor(status) {
31
- if (isColorDisabled()) {
32
- return (text) => text;
33
- }
34
- switch (status) {
35
- case 'done':
36
- return chalk.green;
37
- case 'ready':
38
- return chalk.yellow;
39
- case 'blocked':
40
- return chalk.red;
41
- }
42
- }
43
- /**
44
- * Gets the status indicator for an artifact.
45
- */
46
- function getStatusIndicator(status) {
47
- const color = getStatusColor(status);
48
- switch (status) {
49
- case 'done':
50
- return color('[x]');
51
- case 'ready':
52
- return color('[ ]');
53
- case 'blocked':
54
- return color('[-]');
55
- }
56
- }
57
- /**
58
- * Validates that a change exists and returns available changes if not.
59
- * Checks directory existence directly to support scaffolded changes (without proposal.md).
60
- */
61
- async function validateChangeExists(changeName, projectRoot) {
62
- const changesPath = path.join(projectRoot, 'openspec', 'changes');
63
- // Get all change directories (not just those with proposal.md)
64
- const getAvailableChanges = async () => {
65
- try {
66
- const entries = await fs.promises.readdir(changesPath, { withFileTypes: true });
67
- return entries
68
- .filter((e) => e.isDirectory() && e.name !== 'archive' && !e.name.startsWith('.'))
69
- .map((e) => e.name);
70
- }
71
- catch {
72
- return [];
73
- }
74
- };
75
- if (!changeName) {
76
- const available = await getAvailableChanges();
77
- if (available.length === 0) {
78
- throw new Error('No changes found. Create one with: openspec new change <name>');
79
- }
80
- throw new Error(`Missing required option --change. Available changes:\n ${available.join('\n ')}`);
81
- }
82
- // Validate change name format to prevent path traversal
83
- const nameValidation = validateChangeName(changeName);
84
- if (!nameValidation.valid) {
85
- throw new Error(`Invalid change name '${changeName}': ${nameValidation.error}`);
86
- }
87
- // Check directory existence directly
88
- const changePath = path.join(changesPath, changeName);
89
- const exists = fs.existsSync(changePath) && fs.statSync(changePath).isDirectory();
90
- if (!exists) {
91
- const available = await getAvailableChanges();
92
- if (available.length === 0) {
93
- throw new Error(`Change '${changeName}' not found. No changes exist. Create one with: openspec new change <name>`);
94
- }
95
- throw new Error(`Change '${changeName}' not found. Available changes:\n ${available.join('\n ')}`);
96
- }
97
- return changeName;
98
- }
99
- /**
100
- * Validates that a schema exists and returns available schemas if not.
101
- *
102
- * @param schemaName - The schema name to validate
103
- * @param projectRoot - Optional project root for project-local schema resolution
104
- */
105
- function validateSchemaExists(schemaName, projectRoot) {
106
- const schemaDir = getSchemaDir(schemaName, projectRoot);
107
- if (!schemaDir) {
108
- const availableSchemas = listSchemas(projectRoot);
109
- throw new Error(`Schema '${schemaName}' not found. Available schemas:\n ${availableSchemas.join('\n ')}`);
110
- }
111
- return schemaName;
112
- }
113
- async function statusCommand(options) {
114
- const spinner = ora('Loading change status...').start();
115
- try {
116
- const projectRoot = process.cwd();
117
- const changeName = await validateChangeExists(options.change, projectRoot);
118
- // Validate schema if explicitly provided
119
- if (options.schema) {
120
- validateSchemaExists(options.schema, projectRoot);
121
- }
122
- // loadChangeContext will auto-detect schema from metadata if not provided
123
- const context = loadChangeContext(projectRoot, changeName, options.schema);
124
- const status = formatChangeStatus(context);
125
- spinner.stop();
126
- if (options.json) {
127
- console.log(JSON.stringify(status, null, 2));
128
- return;
129
- }
130
- printStatusText(status);
131
- }
132
- catch (error) {
133
- spinner.stop();
134
- throw error;
135
- }
136
- }
137
- function printStatusText(status) {
138
- const doneCount = status.artifacts.filter((a) => a.status === 'done').length;
139
- const total = status.artifacts.length;
140
- console.log(`Change: ${status.changeName}`);
141
- console.log(`Schema: ${status.schemaName}`);
142
- console.log(`Progress: ${doneCount}/${total} artifacts complete`);
143
- console.log();
144
- for (const artifact of status.artifacts) {
145
- const indicator = getStatusIndicator(artifact.status);
146
- const color = getStatusColor(artifact.status);
147
- let line = `${indicator} ${artifact.id}`;
148
- if (artifact.status === 'blocked' && artifact.missingDeps && artifact.missingDeps.length > 0) {
149
- line += color(` (blocked by: ${artifact.missingDeps.join(', ')})`);
150
- }
151
- console.log(line);
152
- }
153
- if (status.isComplete) {
154
- console.log();
155
- console.log(chalk.green('All artifacts complete!'));
156
- }
157
- }
158
- async function instructionsCommand(artifactId, options) {
159
- const spinner = ora('Generating instructions...').start();
160
- try {
161
- const projectRoot = process.cwd();
162
- const changeName = await validateChangeExists(options.change, projectRoot);
163
- // Validate schema if explicitly provided
164
- if (options.schema) {
165
- validateSchemaExists(options.schema, projectRoot);
166
- }
167
- // loadChangeContext will auto-detect schema from metadata if not provided
168
- const context = loadChangeContext(projectRoot, changeName, options.schema);
169
- if (!artifactId) {
170
- spinner.stop();
171
- const validIds = context.graph.getAllArtifacts().map((a) => a.id);
172
- throw new Error(`Missing required argument <artifact>. Valid artifacts:\n ${validIds.join('\n ')}`);
173
- }
174
- const artifact = context.graph.getArtifact(artifactId);
175
- if (!artifact) {
176
- spinner.stop();
177
- const validIds = context.graph.getAllArtifacts().map((a) => a.id);
178
- throw new Error(`Artifact '${artifactId}' not found in schema '${context.schemaName}'. Valid artifacts:\n ${validIds.join('\n ')}`);
179
- }
180
- const instructions = generateInstructions(context, artifactId, projectRoot);
181
- const isBlocked = instructions.dependencies.some((d) => !d.done);
182
- spinner.stop();
183
- if (options.json) {
184
- console.log(JSON.stringify(instructions, null, 2));
185
- return;
186
- }
187
- printInstructionsText(instructions, isBlocked);
188
- }
189
- catch (error) {
190
- spinner.stop();
191
- throw error;
192
- }
193
- }
194
- function printInstructionsText(instructions, isBlocked) {
195
- const { artifactId, changeName, schemaName, changeDir, outputPath, description, instruction, template, dependencies, unlocks, } = instructions;
196
- // Opening tag
197
- console.log(`<artifact id="${artifactId}" change="${changeName}" schema="${schemaName}">`);
198
- console.log();
199
- // Warning for blocked artifacts
200
- if (isBlocked) {
201
- const missing = dependencies.filter((d) => !d.done).map((d) => d.id);
202
- console.log('<warning>');
203
- console.log('This artifact has unmet dependencies. Complete them first or proceed with caution.');
204
- console.log(`Missing: ${missing.join(', ')}`);
205
- console.log('</warning>');
206
- console.log();
207
- }
208
- // Task directive
209
- console.log('<task>');
210
- console.log(`Create the ${artifactId} artifact for change "${changeName}".`);
211
- console.log(description);
212
- console.log('</task>');
213
- console.log();
214
- // Context (dependencies)
215
- if (dependencies.length > 0) {
216
- console.log('<context>');
217
- console.log('Read these files for context before creating this artifact:');
218
- console.log();
219
- for (const dep of dependencies) {
220
- const status = dep.done ? 'done' : 'missing';
221
- const fullPath = path.join(changeDir, dep.path);
222
- console.log(`<dependency id="${dep.id}" status="${status}">`);
223
- console.log(` <path>${fullPath}</path>`);
224
- console.log(` <description>${dep.description}</description>`);
225
- console.log('</dependency>');
226
- }
227
- console.log('</context>');
228
- console.log();
229
- }
230
- // Output location
231
- console.log('<output>');
232
- console.log(`Write to: ${path.join(changeDir, outputPath)}`);
233
- console.log('</output>');
234
- console.log();
235
- // Instruction (guidance)
236
- if (instruction) {
237
- console.log('<instruction>');
238
- console.log(instruction.trim());
239
- console.log('</instruction>');
240
- console.log();
241
- }
242
- // Template
243
- console.log('<template>');
244
- console.log(template.trim());
245
- console.log('</template>');
246
- console.log();
247
- // Success criteria placeholder
248
- console.log('<success_criteria>');
249
- console.log('<!-- To be defined in schema validation rules -->');
250
- console.log('</success_criteria>');
251
- console.log();
252
- // Unlocks
253
- if (unlocks.length > 0) {
254
- console.log('<unlocks>');
255
- console.log(`Completing this artifact enables: ${unlocks.join(', ')}`);
256
- console.log('</unlocks>');
257
- console.log();
258
- }
259
- // Closing tag
260
- console.log('</artifact>');
261
- }
262
- /**
263
- * Parses tasks.md content and extracts task items with their completion status.
264
- */
265
- function parseTasksFile(content) {
266
- const tasks = [];
267
- const lines = content.split('\n');
268
- let taskIndex = 0;
269
- for (const line of lines) {
270
- // Match checkbox patterns: - [ ] or - [x] or - [X]
271
- const checkboxMatch = line.match(/^[-*]\s*\[([ xX])\]\s*(.+)$/);
272
- if (checkboxMatch) {
273
- taskIndex++;
274
- const done = checkboxMatch[1].toLowerCase() === 'x';
275
- const description = checkboxMatch[2].trim();
276
- tasks.push({
277
- id: `${taskIndex}`,
278
- description,
279
- done,
280
- });
281
- }
282
- }
283
- return tasks;
284
- }
285
- /**
286
- * Checks if an artifact output exists in the change directory.
287
- * Supports glob patterns (e.g., "specs/*.md") by verifying at least one matching file exists.
288
- */
289
- function artifactOutputExists(changeDir, generates) {
290
- // Normalize the generates path to use platform-specific separators
291
- const normalizedGenerates = generates.split('/').join(path.sep);
292
- const fullPath = path.join(changeDir, normalizedGenerates);
293
- // If it's a glob pattern (contains ** or *), check for matching files
294
- if (generates.includes('*')) {
295
- // Extract the directory part before the glob pattern
296
- const parts = normalizedGenerates.split(path.sep);
297
- const dirParts = [];
298
- let patternPart = '';
299
- for (const part of parts) {
300
- if (part.includes('*')) {
301
- patternPart = part;
302
- break;
303
- }
304
- dirParts.push(part);
305
- }
306
- const dirPath = path.join(changeDir, ...dirParts);
307
- // Check if directory exists
308
- if (!fs.existsSync(dirPath) || !fs.statSync(dirPath).isDirectory()) {
309
- return false;
310
- }
311
- // Extract expected extension from pattern (e.g., "*.md" -> ".md")
312
- const extMatch = patternPart.match(/\*(\.[a-zA-Z0-9]+)$/);
313
- const expectedExt = extMatch ? extMatch[1] : null;
314
- // Recursively check for matching files
315
- const hasMatchingFiles = (dir) => {
316
- try {
317
- const entries = fs.readdirSync(dir, { withFileTypes: true });
318
- for (const entry of entries) {
319
- if (entry.isDirectory()) {
320
- // For ** patterns, recurse into subdirectories
321
- if (generates.includes('**') && hasMatchingFiles(path.join(dir, entry.name))) {
322
- return true;
323
- }
324
- }
325
- else if (entry.isFile()) {
326
- // Check if file matches expected extension (or any file if no extension specified)
327
- if (!expectedExt || entry.name.endsWith(expectedExt)) {
328
- return true;
329
- }
330
- }
331
- }
332
- }
333
- catch {
334
- return false;
335
- }
336
- return false;
337
- };
338
- return hasMatchingFiles(dirPath);
339
- }
340
- return fs.existsSync(fullPath);
341
- }
342
- /**
343
- * Generates apply instructions for implementing tasks from a change.
344
- * Schema-aware: reads apply phase configuration from schema to determine
345
- * required artifacts, tracking file, and instruction.
346
- */
347
- async function generateApplyInstructions(projectRoot, changeName, schemaName) {
348
- // loadChangeContext will auto-detect schema from metadata if not provided
349
- const context = loadChangeContext(projectRoot, changeName, schemaName);
350
- const changeDir = path.join(projectRoot, 'openspec', 'changes', changeName);
351
- // Get the full schema to access the apply phase configuration
352
- const schema = resolveSchema(context.schemaName);
353
- const applyConfig = schema.apply;
354
- // Determine required artifacts and tracking file from schema
355
- // Fallback: if no apply block, require all artifacts
356
- const requiredArtifactIds = applyConfig?.requires ?? schema.artifacts.map((a) => a.id);
357
- const tracksFile = applyConfig?.tracks ?? null;
358
- const schemaInstruction = applyConfig?.instruction ?? null;
359
- // Check which required artifacts are missing
360
- const missingArtifacts = [];
361
- for (const artifactId of requiredArtifactIds) {
362
- const artifact = schema.artifacts.find((a) => a.id === artifactId);
363
- if (artifact && !artifactOutputExists(changeDir, artifact.generates)) {
364
- missingArtifacts.push(artifactId);
365
- }
366
- }
367
- // Build context files from all existing artifacts in schema
368
- const contextFiles = {};
369
- for (const artifact of schema.artifacts) {
370
- if (artifactOutputExists(changeDir, artifact.generates)) {
371
- contextFiles[artifact.id] = path.join(changeDir, artifact.generates);
372
- }
373
- }
374
- // Parse tasks if tracking file exists
375
- let tasks = [];
376
- let tracksFileExists = false;
377
- if (tracksFile) {
378
- const tracksPath = path.join(changeDir, tracksFile);
379
- tracksFileExists = fs.existsSync(tracksPath);
380
- if (tracksFileExists) {
381
- const tasksContent = await fs.promises.readFile(tracksPath, 'utf-8');
382
- tasks = parseTasksFile(tasksContent);
383
- }
384
- }
385
- // Calculate progress
386
- const total = tasks.length;
387
- const complete = tasks.filter((t) => t.done).length;
388
- const remaining = total - complete;
389
- // Determine state and instruction
390
- let state;
391
- let instruction;
392
- if (missingArtifacts.length > 0) {
393
- state = 'blocked';
394
- instruction = `Cannot apply this change yet. Missing artifacts: ${missingArtifacts.join(', ')}.\nUse the openspec-continue-change skill to create the missing artifacts first.`;
395
- }
396
- else if (tracksFile && !tracksFileExists) {
397
- // Tracking file configured but doesn't exist yet
398
- const tracksFilename = path.basename(tracksFile);
399
- state = 'blocked';
400
- instruction = `The ${tracksFilename} file is missing and must be created.\nUse openspec-continue-change to generate the tracking file.`;
401
- }
402
- else if (tracksFile && tracksFileExists && total === 0) {
403
- // Tracking file exists but contains no tasks
404
- const tracksFilename = path.basename(tracksFile);
405
- state = 'blocked';
406
- instruction = `The ${tracksFilename} file exists but contains no tasks.\nAdd tasks to ${tracksFilename} or regenerate it with openspec-continue-change.`;
407
- }
408
- else if (tracksFile && remaining === 0 && total > 0) {
409
- state = 'all_done';
410
- instruction = 'All tasks are complete! This change is ready to be archived.\nConsider running tests and reviewing the changes before archiving.';
411
- }
412
- else if (!tracksFile) {
413
- // No tracking file (e.g., TDD schema) - ready to apply
414
- state = 'ready';
415
- instruction = schemaInstruction?.trim() ?? 'All required artifacts complete. Proceed with implementation.';
416
- }
417
- else {
418
- state = 'ready';
419
- instruction = schemaInstruction?.trim() ?? 'Read context files, work through pending tasks, mark complete as you go.\nPause if you hit blockers or need clarification.';
420
- }
421
- return {
422
- changeName,
423
- changeDir,
424
- schemaName: context.schemaName,
425
- contextFiles,
426
- progress: { total, complete, remaining },
427
- tasks,
428
- state,
429
- missingArtifacts: missingArtifacts.length > 0 ? missingArtifacts : undefined,
430
- instruction,
431
- };
432
- }
433
- async function applyInstructionsCommand(options) {
434
- const spinner = ora('Generating apply instructions...').start();
435
- try {
436
- const projectRoot = process.cwd();
437
- const changeName = await validateChangeExists(options.change, projectRoot);
438
- // Validate schema if explicitly provided
439
- if (options.schema) {
440
- validateSchemaExists(options.schema, projectRoot);
441
- }
442
- // generateApplyInstructions uses loadChangeContext which auto-detects schema
443
- const instructions = await generateApplyInstructions(projectRoot, changeName, options.schema);
444
- spinner.stop();
445
- if (options.json) {
446
- console.log(JSON.stringify(instructions, null, 2));
447
- return;
448
- }
449
- printApplyInstructionsText(instructions);
450
- }
451
- catch (error) {
452
- spinner.stop();
453
- throw error;
454
- }
455
- }
456
- function printApplyInstructionsText(instructions) {
457
- const { changeName, schemaName, contextFiles, progress, tasks, state, missingArtifacts, instruction } = instructions;
458
- console.log(`## Apply: ${changeName}`);
459
- console.log(`Schema: ${schemaName}`);
460
- console.log();
461
- // Warning for blocked state
462
- if (state === 'blocked' && missingArtifacts) {
463
- console.log('### ⚠️ Blocked');
464
- console.log();
465
- console.log(`Missing artifacts: ${missingArtifacts.join(', ')}`);
466
- console.log('Use the openspec-continue-change skill to create these first.');
467
- console.log();
468
- }
469
- // Context files (dynamically from schema)
470
- const contextFileEntries = Object.entries(contextFiles);
471
- if (contextFileEntries.length > 0) {
472
- console.log('### Context Files');
473
- for (const [artifactId, filePath] of contextFileEntries) {
474
- console.log(`- ${artifactId}: ${filePath}`);
475
- }
476
- console.log();
477
- }
478
- // Progress (only show if we have tracking)
479
- if (progress.total > 0 || tasks.length > 0) {
480
- console.log('### Progress');
481
- if (state === 'all_done') {
482
- console.log(`${progress.complete}/${progress.total} complete ✓`);
483
- }
484
- else {
485
- console.log(`${progress.complete}/${progress.total} complete`);
486
- }
487
- console.log();
488
- }
489
- // Tasks
490
- if (tasks.length > 0) {
491
- console.log('### Tasks');
492
- for (const task of tasks) {
493
- const checkbox = task.done ? '[x]' : '[ ]';
494
- console.log(`- ${checkbox} ${task.description}`);
495
- }
496
- console.log();
497
- }
498
- // Instruction
499
- console.log('### Instruction');
500
- console.log(instruction);
501
- }
502
- async function templatesCommand(options) {
503
- const spinner = ora('Loading templates...').start();
504
- try {
505
- const projectRoot = process.cwd();
506
- const schemaName = validateSchemaExists(options.schema ?? DEFAULT_SCHEMA, projectRoot);
507
- const schema = resolveSchema(schemaName, projectRoot);
508
- const graph = ArtifactGraph.fromSchema(schema);
509
- const schemaDir = getSchemaDir(schemaName, projectRoot);
510
- // Determine the source (project, user, or package)
511
- const { getUserSchemasDir, getProjectSchemasDir, } = await import('../core/artifact-graph/resolver.js');
512
- const projectSchemasDir = getProjectSchemasDir(projectRoot);
513
- const userSchemasDir = getUserSchemasDir();
514
- let source;
515
- if (schemaDir.startsWith(projectSchemasDir)) {
516
- source = 'project';
517
- }
518
- else if (schemaDir.startsWith(userSchemasDir)) {
519
- source = 'user';
520
- }
521
- else {
522
- source = 'package';
523
- }
524
- const templates = graph.getAllArtifacts().map((artifact) => ({
525
- artifactId: artifact.id,
526
- templatePath: path.join(schemaDir, 'templates', artifact.template),
527
- source,
528
- }));
529
- spinner.stop();
530
- if (options.json) {
531
- const output = {};
532
- for (const t of templates) {
533
- output[t.artifactId] = { path: t.templatePath, source: t.source };
534
- }
535
- console.log(JSON.stringify(output, null, 2));
536
- return;
537
- }
538
- console.log(`Schema: ${schemaName}`);
539
- console.log(`Source: ${source}`);
540
- console.log();
541
- for (const t of templates) {
542
- console.log(`${t.artifactId}:`);
543
- console.log(` ${t.templatePath}`);
544
- }
545
- }
546
- catch (error) {
547
- spinner.stop();
548
- throw error;
549
- }
550
- }
551
- async function newChangeCommand(name, options) {
552
- if (!name) {
553
- throw new Error('Missing required argument <name>');
554
- }
555
- const validation = validateChangeName(name);
556
- if (!validation.valid) {
557
- throw new Error(validation.error);
558
- }
559
- const projectRoot = process.cwd();
560
- // Validate schema if provided
561
- if (options.schema) {
562
- validateSchemaExists(options.schema, projectRoot);
563
- }
564
- const schemaDisplay = options.schema ? ` with schema '${options.schema}'` : '';
565
- const spinner = ora(`Creating change '${name}'${schemaDisplay}...`).start();
566
- try {
567
- const result = await createChange(projectRoot, name, { schema: options.schema });
568
- // If description provided, create README.md with description
569
- if (options.description) {
570
- const { promises: fs } = await import('fs');
571
- const changeDir = path.join(projectRoot, 'openspec', 'changes', name);
572
- const readmePath = path.join(changeDir, 'README.md');
573
- await fs.writeFile(readmePath, `# ${name}\n\n${options.description}\n`, 'utf-8');
574
- }
575
- spinner.succeed(`Created change '${name}' at openspec/changes/${name}/ (schema: ${result.schema})`);
576
- }
577
- catch (error) {
578
- spinner.fail(`Failed to create change '${name}'`);
579
- throw error;
580
- }
581
- }
582
- // -----------------------------------------------------------------------------
583
- // Artifact Experimental Setup Command
584
- // -----------------------------------------------------------------------------
585
- /**
586
- * Generates Agent Skills and slash commands for the experimental artifact workflow.
587
- * Creates .claude/skills/ directory with SKILL.md files following Agent Skills spec.
588
- * Creates .claude/commands/opsx/ directory with slash command files.
589
- */
590
- async function artifactExperimentalSetupCommand() {
591
- const spinner = ora('Setting up experimental artifact workflow...').start();
592
- try {
593
- const projectRoot = process.cwd();
594
- const skillsDir = path.join(projectRoot, '.claude', 'skills');
595
- const commandsDir = path.join(projectRoot, '.claude', 'commands', 'opsx');
596
- // Get skill templates
597
- const exploreSkill = getExploreSkillTemplate();
598
- const newChangeSkill = getNewChangeSkillTemplate();
599
- const continueChangeSkill = getContinueChangeSkillTemplate();
600
- const applyChangeSkill = getApplyChangeSkillTemplate();
601
- const ffChangeSkill = getFfChangeSkillTemplate();
602
- const syncSpecsSkill = getSyncSpecsSkillTemplate();
603
- const archiveChangeSkill = getArchiveChangeSkillTemplate();
604
- const bulkArchiveChangeSkill = getBulkArchiveChangeSkillTemplate();
605
- const verifyChangeSkill = getVerifyChangeSkillTemplate();
606
- // Get command templates
607
- const exploreCommand = getOpsxExploreCommandTemplate();
608
- const newCommand = getOpsxNewCommandTemplate();
609
- const continueCommand = getOpsxContinueCommandTemplate();
610
- const applyCommand = getOpsxApplyCommandTemplate();
611
- const ffCommand = getOpsxFfCommandTemplate();
612
- const syncCommand = getOpsxSyncCommandTemplate();
613
- const archiveCommand = getOpsxArchiveCommandTemplate();
614
- const bulkArchiveCommand = getOpsxBulkArchiveCommandTemplate();
615
- const verifyCommand = getOpsxVerifyCommandTemplate();
616
- // Create skill directories and SKILL.md files
617
- const skills = [
618
- { template: exploreSkill, dirName: 'openspec-explore' },
619
- { template: newChangeSkill, dirName: 'openspec-new-change' },
620
- { template: continueChangeSkill, dirName: 'openspec-continue-change' },
621
- { template: applyChangeSkill, dirName: 'openspec-apply-change' },
622
- { template: ffChangeSkill, dirName: 'openspec-ff-change' },
623
- { template: syncSpecsSkill, dirName: 'openspec-sync-specs' },
624
- { template: archiveChangeSkill, dirName: 'openspec-archive-change' },
625
- { template: bulkArchiveChangeSkill, dirName: 'openspec-bulk-archive-change' },
626
- { template: verifyChangeSkill, dirName: 'openspec-verify-change' },
627
- ];
628
- const createdSkillFiles = [];
629
- for (const { template, dirName } of skills) {
630
- const skillDir = path.join(skillsDir, dirName);
631
- const skillFile = path.join(skillDir, 'SKILL.md');
632
- // Generate SKILL.md content with YAML frontmatter
633
- const skillContent = `---
634
- name: ${template.name}
635
- description: ${template.description}
636
- ---
637
-
638
- ${template.instructions}
639
- `;
640
- // Write the skill file
641
- await FileSystemUtils.writeFile(skillFile, skillContent);
642
- createdSkillFiles.push(path.relative(projectRoot, skillFile));
643
- }
644
- // Create slash command files
645
- const commands = [
646
- { template: exploreCommand, fileName: 'explore.md' },
647
- { template: newCommand, fileName: 'new.md' },
648
- { template: continueCommand, fileName: 'continue.md' },
649
- { template: applyCommand, fileName: 'apply.md' },
650
- { template: ffCommand, fileName: 'ff.md' },
651
- { template: syncCommand, fileName: 'sync.md' },
652
- { template: archiveCommand, fileName: 'archive.md' },
653
- { template: bulkArchiveCommand, fileName: 'bulk-archive.md' },
654
- { template: verifyCommand, fileName: 'verify.md' },
655
- ];
656
- const createdCommandFiles = [];
657
- for (const { template, fileName } of commands) {
658
- const commandFile = path.join(commandsDir, fileName);
659
- // Generate command content with YAML frontmatter
660
- const commandContent = `---
661
- name: ${template.name}
662
- description: ${template.description}
663
- category: ${template.category}
664
- tags: [${template.tags.join(', ')}]
665
- ---
666
-
667
- ${template.content}
668
- `;
669
- // Write the command file
670
- await FileSystemUtils.writeFile(commandFile, commandContent);
671
- createdCommandFiles.push(path.relative(projectRoot, commandFile));
672
- }
673
- spinner.succeed('Experimental artifact workflow setup complete!');
674
- // Print success message
675
- console.log();
676
- console.log(chalk.bold('🧪 Experimental Artifact Workflow Setup Complete'));
677
- console.log();
678
- console.log(chalk.bold('Skills Created:'));
679
- for (const file of createdSkillFiles) {
680
- console.log(chalk.green(' ✓ ' + file));
681
- }
682
- console.log();
683
- console.log(chalk.bold('Slash Commands Created:'));
684
- for (const file of createdCommandFiles) {
685
- console.log(chalk.green(' ✓ ' + file));
686
- }
687
- console.log();
688
- // Config creation section
689
- console.log('━'.repeat(70));
690
- console.log();
691
- console.log(chalk.bold('📋 Project Configuration (Optional)'));
692
- console.log();
693
- console.log('Configure project defaults for OpenSpec workflows.');
694
- console.log();
695
- // Check if config already exists
696
- const configPath = path.join(projectRoot, 'openspec', 'config.yaml');
697
- const configYmlPath = path.join(projectRoot, 'openspec', 'config.yml');
698
- const configExists = fs.existsSync(configPath) || fs.existsSync(configYmlPath);
699
- if (configExists) {
700
- // Config already exists, skip creation
701
- console.log(chalk.blue('ℹ️ openspec/config.yaml already exists. Skipping config creation.'));
702
- console.log();
703
- console.log(' To update config, edit openspec/config.yaml manually or:');
704
- console.log(' 1. Delete openspec/config.yaml');
705
- console.log(' 2. Run openspec artifact-experimental-setup again');
706
- console.log();
707
- }
708
- else if (!process.stdin.isTTY) {
709
- // Non-interactive mode (CI, automation, piped input)
710
- console.log(chalk.blue('ℹ️ Skipping config prompts (non-interactive mode)'));
711
- console.log();
712
- console.log(' To create config manually, add openspec/config.yaml with:');
713
- console.log(chalk.dim(' schema: spec-driven'));
714
- console.log();
715
- }
716
- else {
717
- // Create config with default schema
718
- const yamlContent = serializeConfig({ schema: DEFAULT_SCHEMA });
719
- try {
720
- await FileSystemUtils.writeFile(configPath, yamlContent);
721
- console.log();
722
- console.log(chalk.green('✓ Created openspec/config.yaml'));
723
- console.log();
724
- console.log(` Default schema: ${chalk.cyan(DEFAULT_SCHEMA)}`);
725
- console.log();
726
- console.log(chalk.dim(' Edit the file to add project context and per-artifact rules.'));
727
- console.log();
728
- // Git commit suggestion
729
- console.log(chalk.bold('To share with team:'));
730
- console.log(chalk.dim(' git add openspec/config.yaml .claude/'));
731
- console.log(chalk.dim(' git commit -m "Setup OpenSpec experimental workflow"'));
732
- console.log();
733
- }
734
- catch (writeError) {
735
- // Handle file write errors
736
- console.error();
737
- console.error(chalk.red('✗ Failed to write openspec/config.yaml'));
738
- console.error(chalk.dim(` ${writeError.message}`));
739
- console.error();
740
- console.error('Fallback: Create config manually:');
741
- console.error(chalk.dim(' 1. Create openspec/config.yaml'));
742
- console.error(chalk.dim(' 2. Copy the following content:'));
743
- console.error();
744
- console.error(chalk.dim(yamlContent));
745
- console.error();
746
- }
747
- }
748
- console.log('━'.repeat(70));
749
- console.log();
750
- console.log(chalk.bold('📖 Usage:'));
751
- console.log();
752
- console.log(' ' + chalk.cyan('Skills') + ' work automatically in compatible editors:');
753
- console.log(' • Claude Code - Auto-detected, ready to use');
754
- console.log(' • Cursor - Enable in Settings → Rules → Import Settings');
755
- console.log(' • Windsurf - Auto-imports from .claude directory');
756
- console.log();
757
- console.log(' Ask Claude naturally:');
758
- console.log(' • "I want to start a new OpenSpec change to add <feature>"');
759
- console.log(' • "Continue working on this change"');
760
- console.log(' • "Implement the tasks for this change"');
761
- console.log();
762
- console.log(' ' + chalk.cyan('Slash Commands') + ' for explicit invocation:');
763
- console.log(' • /opsx:explore - Think through ideas, investigate problems');
764
- console.log(' • /opsx:new - Start a new change');
765
- console.log(' • /opsx:continue - Create the next artifact');
766
- console.log(' • /opsx:apply - Implement tasks');
767
- console.log(' • /opsx:ff - Fast-forward: create all artifacts at once');
768
- console.log(' • /opsx:sync - Sync delta specs to main specs');
769
- console.log(' • /opsx:verify - Verify implementation matches artifacts');
770
- console.log(' • /opsx:archive - Archive a completed change');
771
- console.log();
772
- console.log(chalk.yellow('💡 This is an experimental feature.'));
773
- console.log(' Feedback welcome at: https://github.com/Fission-AI/OpenSpec/issues');
774
- console.log();
775
- }
776
- catch (error) {
777
- spinner.fail('Failed to setup experimental artifact workflow');
778
- throw error;
779
- }
780
- }
781
- async function schemasCommand(options) {
782
- const projectRoot = process.cwd();
783
- const schemas = listSchemasWithInfo(projectRoot);
784
- if (options.json) {
785
- console.log(JSON.stringify(schemas, null, 2));
786
- return;
787
- }
788
- console.log('Available schemas:');
789
- console.log();
790
- for (const schema of schemas) {
791
- let sourceLabel = '';
792
- if (schema.source === 'project') {
793
- sourceLabel = chalk.cyan(' (project)');
794
- }
795
- else if (schema.source === 'user') {
796
- sourceLabel = chalk.dim(' (user override)');
797
- }
798
- console.log(` ${chalk.bold(schema.name)}${sourceLabel}`);
799
- console.log(` ${schema.description}`);
800
- console.log(` Artifacts: ${schema.artifacts.join(' → ')}`);
801
- console.log();
802
- }
803
- }
804
- // -----------------------------------------------------------------------------
805
- // Command Registration
806
- // -----------------------------------------------------------------------------
807
- /**
808
- * Registers all artifact workflow commands on the given program.
809
- * All commands are marked as experimental in their help text.
810
- */
811
- export function registerArtifactWorkflowCommands(program) {
812
- // Status command
813
- program
814
- .command('status')
815
- .description('[Experimental] Display artifact completion status for a change')
816
- .option('--change <id>', 'Change name to show status for')
817
- .option('--schema <name>', 'Schema override (auto-detected from .openspec.yaml)')
818
- .option('--json', 'Output as JSON')
819
- .action(async (options) => {
820
- try {
821
- await statusCommand(options);
822
- }
823
- catch (error) {
824
- console.log();
825
- ora().fail(`Error: ${error.message}`);
826
- process.exit(1);
827
- }
828
- });
829
- // Instructions command
830
- program
831
- .command('instructions [artifact]')
832
- .description('[Experimental] Output enriched instructions for creating an artifact or applying tasks')
833
- .option('--change <id>', 'Change name')
834
- .option('--schema <name>', 'Schema override (auto-detected from .openspec.yaml)')
835
- .option('--json', 'Output as JSON')
836
- .action(async (artifactId, options) => {
837
- try {
838
- // Special case: "apply" is not an artifact, but a command to get apply instructions
839
- if (artifactId === 'apply') {
840
- await applyInstructionsCommand(options);
841
- }
842
- else {
843
- await instructionsCommand(artifactId, options);
844
- }
845
- }
846
- catch (error) {
847
- console.log();
848
- ora().fail(`Error: ${error.message}`);
849
- process.exit(1);
850
- }
851
- });
852
- // Templates command
853
- program
854
- .command('templates')
855
- .description('[Experimental] Show resolved template paths for all artifacts in a schema')
856
- .option('--schema <name>', `Schema to use (default: ${DEFAULT_SCHEMA})`)
857
- .option('--json', 'Output as JSON mapping artifact IDs to template paths')
858
- .action(async (options) => {
859
- try {
860
- await templatesCommand(options);
861
- }
862
- catch (error) {
863
- console.log();
864
- ora().fail(`Error: ${error.message}`);
865
- process.exit(1);
866
- }
867
- });
868
- // Schemas command
869
- program
870
- .command('schemas')
871
- .description('[Experimental] List available workflow schemas with descriptions')
872
- .option('--json', 'Output as JSON (for agent use)')
873
- .action(async (options) => {
874
- try {
875
- await schemasCommand(options);
876
- }
877
- catch (error) {
878
- console.log();
879
- ora().fail(`Error: ${error.message}`);
880
- process.exit(1);
881
- }
882
- });
883
- // New command group with change subcommand
884
- const newCmd = program.command('new').description('[Experimental] Create new items');
885
- newCmd
886
- .command('change <name>')
887
- .description('[Experimental] Create a new change directory')
888
- .option('--description <text>', 'Description to add to README.md')
889
- .option('--schema <name>', `Workflow schema to use (default: ${DEFAULT_SCHEMA})`)
890
- .action(async (name, options) => {
891
- try {
892
- await newChangeCommand(name, options);
893
- }
894
- catch (error) {
895
- console.log();
896
- ora().fail(`Error: ${error.message}`);
897
- process.exit(1);
898
- }
899
- });
900
- // Artifact experimental setup command
901
- program
902
- .command('artifact-experimental-setup')
903
- .description('[Experimental] Setup Agent Skills for the experimental artifact workflow')
904
- .action(async () => {
905
- try {
906
- await artifactExperimentalSetupCommand();
907
- }
908
- catch (error) {
909
- console.log();
910
- ora().fail(`Error: ${error.message}`);
911
- process.exit(1);
912
- }
913
- });
914
- }
915
- //# sourceMappingURL=artifact-workflow.js.map