@codewalla_india/openspec 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (333) hide show
  1. package/LICENSE +22 -22
  2. package/README.md +272 -230
  3. package/bin/openspec.js +5 -5
  4. package/dist/cli/index.js +99 -62
  5. package/dist/commands/change.d.ts +0 -2
  6. package/dist/commands/change.js +107 -86
  7. package/dist/commands/config.js +14 -16
  8. package/dist/commands/doctor.js +9 -4
  9. package/dist/commands/feedback.js +79 -30
  10. package/dist/commands/modify.d.ts +26 -0
  11. package/dist/commands/modify.js +147 -0
  12. package/dist/commands/schema.js +170 -91
  13. package/dist/commands/show.js +5 -2
  14. package/dist/commands/spec.js +49 -29
  15. package/dist/commands/store.js +15 -21
  16. package/dist/commands/validate.d.ts +8 -0
  17. package/dist/commands/validate.js +43 -20
  18. package/dist/commands/workflow/index.d.ts +2 -2
  19. package/dist/commands/workflow/index.js +1 -1
  20. package/dist/commands/workflow/instructions.d.ts +6 -26
  21. package/dist/commands/workflow/instructions.js +183 -376
  22. package/dist/commands/workflow/new-change.d.ts +0 -4
  23. package/dist/commands/workflow/new-change.js +10 -28
  24. package/dist/commands/workflow/shared.d.ts +34 -19
  25. package/dist/commands/workflow/shared.js +34 -4
  26. package/dist/commands/workflow/status.js +10 -32
  27. package/dist/commands/workflow/templates.js +15 -5
  28. package/dist/commands/workset.d.ts +2 -2
  29. package/dist/commands/workset.js +19 -22
  30. package/dist/comprehension-quiz/fingerprint.d.ts +39 -0
  31. package/dist/comprehension-quiz/fingerprint.js +84 -0
  32. package/dist/comprehension-quiz/index.d.ts +42 -0
  33. package/dist/comprehension-quiz/index.js +47 -0
  34. package/dist/comprehension-quiz/pass-record.d.ts +44 -0
  35. package/dist/comprehension-quiz/pass-record.js +98 -0
  36. package/dist/comprehension-quiz/providers/anthropic.d.ts +34 -0
  37. package/dist/comprehension-quiz/providers/anthropic.js +53 -0
  38. package/dist/comprehension-quiz/providers/factory.d.ts +44 -0
  39. package/dist/comprehension-quiz/providers/factory.js +174 -0
  40. package/dist/comprehension-quiz/providers/interface.d.ts +59 -0
  41. package/dist/comprehension-quiz/providers/interface.js +63 -0
  42. package/dist/comprehension-quiz/providers/local.d.ts +34 -0
  43. package/dist/comprehension-quiz/providers/local.js +53 -0
  44. package/dist/comprehension-quiz/providers/ollama.d.ts +34 -0
  45. package/dist/comprehension-quiz/providers/ollama.js +53 -0
  46. package/dist/comprehension-quiz/providers/openai.d.ts +34 -0
  47. package/dist/comprehension-quiz/providers/openai.js +53 -0
  48. package/dist/comprehension-quiz/question-generator.d.ts +69 -0
  49. package/dist/comprehension-quiz/question-generator.js +141 -0
  50. package/dist/comprehension-quiz/quiz-executor.d.ts +70 -0
  51. package/dist/comprehension-quiz/quiz-executor.js +165 -0
  52. package/dist/comprehension-quiz/types.d.ts +115 -0
  53. package/dist/comprehension-quiz/types.js +11 -0
  54. package/dist/core/archive.d.ts +14 -1
  55. package/dist/core/archive.js +1350 -190
  56. package/dist/core/artifact-graph/graph.d.ts +28 -9
  57. package/dist/core/artifact-graph/graph.js +94 -43
  58. package/dist/core/artifact-graph/index.d.ts +1 -1
  59. package/dist/core/artifact-graph/index.js +1 -1
  60. package/dist/core/artifact-graph/instruction-loader.d.ts +30 -3
  61. package/dist/core/artifact-graph/instruction-loader.js +70 -12
  62. package/dist/core/artifact-graph/outputs.d.ts +1 -0
  63. package/dist/core/artifact-graph/outputs.js +67 -5
  64. package/dist/core/artifact-graph/resolver.d.ts +14 -0
  65. package/dist/core/artifact-graph/resolver.js +69 -15
  66. package/dist/core/artifact-graph/types.js +21 -3
  67. package/dist/core/available-tools.d.ts +2 -2
  68. package/dist/core/available-tools.js +14 -3
  69. package/dist/core/change-metadata/schema.d.ts +2 -0
  70. package/dist/core/change-metadata/schema.js +13 -0
  71. package/dist/core/change-status-policy.d.ts +10 -1
  72. package/dist/core/change-status-policy.js +30 -2
  73. package/dist/core/command-generation/adapters/amazon-q.d.ts +4 -0
  74. package/dist/core/command-generation/adapters/amazon-q.js +11 -5
  75. package/dist/core/command-generation/adapters/antigravity.js +6 -5
  76. package/dist/core/command-generation/adapters/auggie.js +7 -6
  77. package/dist/core/command-generation/adapters/bob.d.ts +5 -1
  78. package/dist/core/command-generation/adapters/bob.js +11 -10
  79. package/dist/core/command-generation/adapters/claude.d.ts +1 -1
  80. package/dist/core/command-generation/adapters/claude.js +12 -17
  81. package/dist/core/command-generation/adapters/cline.js +5 -5
  82. package/dist/core/command-generation/adapters/codebuddy.js +8 -7
  83. package/dist/core/command-generation/adapters/continue.js +8 -7
  84. package/dist/core/command-generation/adapters/costrict.js +7 -6
  85. package/dist/core/command-generation/adapters/crush.js +9 -9
  86. package/dist/core/command-generation/adapters/cursor.js +8 -8
  87. package/dist/core/command-generation/adapters/devin.d.ts +19 -0
  88. package/dist/core/command-generation/adapters/devin.js +36 -0
  89. package/dist/core/command-generation/adapters/factory.js +7 -6
  90. package/dist/core/command-generation/adapters/gemini.js +40 -5
  91. package/dist/core/command-generation/adapters/github-copilot.js +6 -5
  92. package/dist/core/command-generation/adapters/iflow.js +9 -8
  93. package/dist/core/command-generation/adapters/index.d.ts +4 -2
  94. package/dist/core/command-generation/adapters/index.js +4 -2
  95. package/dist/core/command-generation/adapters/junie.js +6 -5
  96. package/dist/core/command-generation/adapters/kilocode.js +1 -1
  97. package/dist/core/command-generation/adapters/kiro.js +6 -5
  98. package/dist/core/command-generation/adapters/lingma.js +9 -9
  99. package/dist/core/command-generation/adapters/oh-my-pi.d.ts +21 -0
  100. package/dist/core/command-generation/adapters/oh-my-pi.js +42 -0
  101. package/dist/core/command-generation/adapters/opencode.js +6 -8
  102. package/dist/core/command-generation/adapters/pi.d.ts +2 -2
  103. package/dist/core/command-generation/adapters/pi.js +7 -10
  104. package/dist/core/command-generation/adapters/qoder.js +9 -9
  105. package/dist/core/command-generation/adapters/qwen.d.ts +7 -3
  106. package/dist/core/command-generation/adapters/qwen.js +14 -9
  107. package/dist/core/command-generation/adapters/roocode.d.ts +4 -4
  108. package/dist/core/command-generation/adapters/roocode.js +9 -9
  109. package/dist/core/command-generation/adapters/trae.d.ts +13 -0
  110. package/dist/core/command-generation/adapters/trae.js +28 -0
  111. package/dist/core/command-generation/adapters/zcode.d.ts +16 -0
  112. package/dist/core/command-generation/adapters/zcode.js +33 -0
  113. package/dist/core/command-generation/generator.d.ts +8 -0
  114. package/dist/core/command-generation/generator.js +15 -1
  115. package/dist/core/command-generation/index.d.ts +1 -1
  116. package/dist/core/command-generation/index.js +1 -1
  117. package/dist/core/command-generation/invocation.d.ts +73 -0
  118. package/dist/core/command-generation/invocation.js +77 -0
  119. package/dist/core/command-generation/registry.js +8 -4
  120. package/dist/core/command-generation/types.d.ts +9 -2
  121. package/dist/core/command-generation/yaml.d.ts +20 -6
  122. package/dist/core/command-generation/yaml.js +31 -21
  123. package/dist/core/command-surface.d.ts +15 -0
  124. package/dist/core/command-surface.js +33 -0
  125. package/dist/core/completions/command-registry.js +16 -61
  126. package/dist/core/completions/generators/bash-generator.js +41 -41
  127. package/dist/core/completions/generators/fish-generator.js +7 -7
  128. package/dist/core/completions/generators/powershell-generator.js +44 -37
  129. package/dist/core/completions/generators/zsh-generator.js +33 -33
  130. package/dist/core/completions/installers/zsh-installer.d.ts +9 -0
  131. package/dist/core/completions/installers/zsh-installer.js +20 -4
  132. package/dist/core/completions/templates/bash-templates.js +24 -24
  133. package/dist/core/completions/templates/fish-templates.js +38 -38
  134. package/dist/core/completions/templates/powershell-templates.js +28 -28
  135. package/dist/core/completions/templates/zsh-templates.js +39 -39
  136. package/dist/core/config-prompts.d.ts +1 -1
  137. package/dist/core/config-prompts.js +14 -1
  138. package/dist/core/config-schema.d.ts +10 -1
  139. package/dist/core/config-schema.js +67 -1
  140. package/dist/core/config.d.ts +15 -0
  141. package/dist/core/config.js +46 -5
  142. package/dist/core/file-state.js +56 -24
  143. package/dist/core/github-copilot/cloud-agent.d.ts +95 -0
  144. package/dist/core/github-copilot/cloud-agent.js +497 -0
  145. package/dist/core/global-config.d.ts +16 -0
  146. package/dist/core/init.d.ts +58 -0
  147. package/dist/core/init.js +474 -73
  148. package/dist/core/legacy-cleanup.d.ts +59 -0
  149. package/dist/core/legacy-cleanup.js +253 -24
  150. package/dist/core/list.js +23 -16
  151. package/dist/core/migration.d.ts +73 -1
  152. package/dist/core/migration.js +360 -11
  153. package/dist/core/modify/conflict-detector.d.ts +26 -0
  154. package/dist/core/modify/conflict-detector.js +62 -0
  155. package/dist/core/modify/dependency-propagator.d.ts +38 -0
  156. package/dist/core/modify/dependency-propagator.js +103 -0
  157. package/dist/core/modify/history-tracker.d.ts +34 -0
  158. package/dist/core/modify/history-tracker.js +114 -0
  159. package/dist/core/modify/index.d.ts +7 -0
  160. package/dist/core/modify/index.js +7 -0
  161. package/dist/core/onboarding-commands.d.ts +30 -0
  162. package/dist/core/onboarding-commands.js +38 -0
  163. package/dist/core/openspec-root.js +18 -15
  164. package/dist/core/parsers/change-parser.d.ts +17 -2
  165. package/dist/core/parsers/change-parser.js +35 -21
  166. package/dist/core/parsers/code-fence.d.ts +15 -0
  167. package/dist/core/parsers/code-fence.js +49 -0
  168. package/dist/core/parsers/markdown-parser.d.ts +0 -3
  169. package/dist/core/parsers/markdown-parser.js +7 -60
  170. package/dist/core/parsers/requirement-blocks.d.ts +29 -0
  171. package/dist/core/parsers/requirement-blocks.js +150 -31
  172. package/dist/core/parsers/requirement-text.d.ts +48 -0
  173. package/dist/core/parsers/requirement-text.js +98 -0
  174. package/dist/core/parsers/spec-structure.d.ts +1 -1
  175. package/dist/core/parsers/spec-structure.js +20 -30
  176. package/dist/core/profile-sync-drift.d.ts +0 -8
  177. package/dist/core/profile-sync-drift.js +49 -50
  178. package/dist/core/profiles.d.ts +2 -2
  179. package/dist/core/profiles.js +2 -2
  180. package/dist/core/project-config.d.ts +27 -18
  181. package/dist/core/project-config.js +101 -34
  182. package/dist/core/references.js +42 -4
  183. package/dist/core/relationship-health.d.ts +8 -0
  184. package/dist/core/relationship-health.js +13 -0
  185. package/dist/core/root-selection.d.ts +9 -6
  186. package/dist/core/root-selection.js +42 -5
  187. package/dist/core/schemas/base.schema.js +7 -2
  188. package/dist/core/shared/allowed-tools.d.ts +12 -0
  189. package/dist/core/shared/allowed-tools.js +12 -0
  190. package/dist/core/shared/index.d.ts +1 -0
  191. package/dist/core/shared/index.js +1 -0
  192. package/dist/core/shared/skill-content-equivalence.d.ts +7 -0
  193. package/dist/core/shared/skill-content-equivalence.js +41 -0
  194. package/dist/core/shared/skill-generation.js +17 -13
  195. package/dist/core/shared/skill-paths.d.ts +13 -0
  196. package/dist/core/shared/skill-paths.js +23 -0
  197. package/dist/core/shared/tool-detection.d.ts +27 -7
  198. package/dist/core/shared/tool-detection.js +167 -37
  199. package/dist/core/shared-skill-target.d.ts +16 -0
  200. package/dist/core/shared-skill-target.js +156 -0
  201. package/dist/core/specs-apply.d.ts +80 -33
  202. package/dist/core/specs-apply.js +667 -145
  203. package/dist/core/store/git.d.ts +13 -0
  204. package/dist/core/store/git.js +24 -0
  205. package/dist/core/store/operations.js +20 -0
  206. package/dist/core/templates/skill-templates.d.ts +3 -2
  207. package/dist/core/templates/skill-templates.js +3 -2
  208. package/dist/core/templates/workflows/apply-change.d.ts +10 -0
  209. package/dist/core/templates/workflows/apply-change.js +186 -323
  210. package/dist/core/templates/workflows/archive-change.js +387 -260
  211. package/dist/core/templates/workflows/bulk-archive-change.js +655 -475
  212. package/dist/core/templates/workflows/continue-change.js +210 -219
  213. package/dist/core/templates/workflows/explore.js +479 -443
  214. package/dist/core/templates/workflows/feedback.js +97 -97
  215. package/dist/core/templates/workflows/ff-change.js +200 -191
  216. package/dist/core/templates/workflows/modify-change.d.ts +4 -1
  217. package/dist/core/templates/workflows/modify-change.js +237 -115
  218. package/dist/core/templates/workflows/new-change.js +127 -134
  219. package/dist/core/templates/workflows/onboard.js +548 -542
  220. package/dist/core/templates/workflows/propose.js +273 -217
  221. package/dist/core/templates/workflows/store-selection.d.ts +1 -1
  222. package/dist/core/templates/workflows/store-selection.js +1 -1
  223. package/dist/core/templates/workflows/sync-specs.js +500 -273
  224. package/dist/core/templates/workflows/update-change.d.ts +10 -0
  225. package/dist/core/templates/workflows/update-change.js +177 -0
  226. package/dist/core/templates/workflows/verify-change.js +324 -326
  227. package/dist/core/update.d.ts +40 -5
  228. package/dist/core/update.js +411 -96
  229. package/dist/core/validation/constants.d.ts +4 -1
  230. package/dist/core/validation/constants.js +4 -1
  231. package/dist/core/validation/plan-validator.d.ts +8 -0
  232. package/dist/core/validation/plan-validator.js +45 -0
  233. package/dist/core/validation/task-numbering.d.ts +16 -0
  234. package/dist/core/validation/task-numbering.js +57 -0
  235. package/dist/core/validation/validator.d.ts +27 -3
  236. package/dist/core/validation/validator.js +337 -48
  237. package/dist/core/version-check.d.ts +152 -0
  238. package/dist/core/version-check.js +731 -0
  239. package/dist/core/view.js +13 -18
  240. package/dist/prompts/searchable-multi-select.js +1 -1
  241. package/dist/telemetry/caller-detection.d.ts +27 -0
  242. package/dist/telemetry/caller-detection.js +85 -0
  243. package/dist/telemetry/caller-detection.test.d.ts +5 -0
  244. package/dist/telemetry/config.d.ts +48 -2
  245. package/dist/telemetry/config.js +113 -11
  246. package/dist/telemetry/config.test.d.ts +5 -0
  247. package/dist/telemetry/deduplication.d.ts +35 -0
  248. package/dist/telemetry/deduplication.js +82 -0
  249. package/dist/telemetry/deduplication.test.d.ts +5 -0
  250. package/dist/telemetry/identity.d.ts +62 -22
  251. package/dist/telemetry/identity.js +147 -102
  252. package/dist/telemetry/index.d.ts +126 -15
  253. package/dist/telemetry/index.js +569 -37
  254. package/dist/telemetry/sanitization.d.ts +40 -0
  255. package/dist/telemetry/sanitization.js +114 -0
  256. package/dist/telemetry/sanitization.test.d.ts +5 -0
  257. package/dist/telemetry/throttling.d.ts +20 -0
  258. package/dist/telemetry/throttling.js +70 -0
  259. package/dist/ui/welcome-screen.d.ts +9 -1
  260. package/dist/ui/welcome-screen.js +91 -38
  261. package/dist/utils/change-metadata.d.ts +43 -0
  262. package/dist/utils/change-metadata.js +123 -7
  263. package/dist/utils/change-utils.d.ts +10 -4
  264. package/dist/utils/change-utils.js +20 -13
  265. package/dist/utils/ci.d.ts +12 -0
  266. package/dist/utils/ci.js +16 -0
  267. package/dist/utils/command-references.d.ts +92 -6
  268. package/dist/utils/command-references.js +180 -7
  269. package/dist/utils/date.d.ts +8 -0
  270. package/dist/utils/date.js +13 -0
  271. package/dist/utils/file-system.d.ts +10 -0
  272. package/dist/utils/file-system.js +70 -0
  273. package/dist/utils/index.d.ts +1 -1
  274. package/dist/utils/index.js +1 -1
  275. package/dist/utils/interactive.d.ts +23 -0
  276. package/dist/utils/interactive.js +32 -0
  277. package/dist/utils/item-discovery.d.ts +19 -0
  278. package/dist/utils/item-discovery.js +30 -48
  279. package/dist/utils/shell-detection.d.ts +1 -1
  280. package/dist/utils/shell-detection.js +64 -11
  281. package/dist/utils/spec-discovery.d.ts +40 -0
  282. package/dist/utils/spec-discovery.js +115 -0
  283. package/dist/utils/task-progress.d.ts +29 -1
  284. package/dist/utils/task-progress.js +109 -15
  285. package/package.json +96 -84
  286. package/schemas/spec-driven/schema.yaml +252 -184
  287. package/schemas/spec-driven/templates/design.md +19 -19
  288. package/schemas/spec-driven/templates/plan-template.md +91 -0
  289. package/schemas/spec-driven/templates/proposal.md +29 -24
  290. package/schemas/spec-driven/templates/spec.md +11 -8
  291. package/schemas/spec-driven/templates/tasks.md +9 -9
  292. package/scripts/postinstall.js +83 -83
  293. package/dist/core/command-generation/adapters/codex.d.ts +0 -16
  294. package/dist/core/command-generation/adapters/codex.js +0 -39
  295. package/dist/core/command-generation/adapters/windsurf.d.ts +0 -14
  296. package/dist/core/command-generation/adapters/windsurf.js +0 -38
  297. package/dist/core/comprehension/config.d.ts +0 -20
  298. package/dist/core/comprehension/config.js +0 -23
  299. package/dist/core/comprehension/fingerprint.d.ts +0 -14
  300. package/dist/core/comprehension/fingerprint.js +0 -33
  301. package/dist/core/comprehension/index.d.ts +0 -57
  302. package/dist/core/comprehension/index.js +0 -87
  303. package/dist/core/comprehension/pass-record.d.ts +0 -29
  304. package/dist/core/comprehension/pass-record.js +0 -64
  305. package/dist/core/comprehension/stats.d.ts +0 -35
  306. package/dist/core/comprehension/stats.js +0 -133
  307. package/dist/core/templates/workflows/comprehension-guidance.d.ts +0 -9
  308. package/dist/core/templates/workflows/comprehension-guidance.js +0 -71
  309. package/dist/core/templates/workflows/mcp-guidance.d.ts +0 -13
  310. package/dist/core/templates/workflows/mcp-guidance.js +0 -131
  311. package/dist/core/templates/workflows/user-prompt-guidance.d.ts +0 -16
  312. package/dist/core/templates/workflows/user-prompt-guidance.js +0 -48
  313. package/dist/telemetry/caller.d.ts +0 -5
  314. package/dist/telemetry/caller.js +0 -29
  315. package/dist/telemetry/client.d.ts +0 -27
  316. package/dist/telemetry/client.js +0 -127
  317. package/dist/telemetry/command-context.d.ts +0 -13
  318. package/dist/telemetry/command-context.js +0 -59
  319. package/dist/telemetry/comprehension.d.ts +0 -44
  320. package/dist/telemetry/comprehension.js +0 -105
  321. package/dist/telemetry/content.d.ts +0 -10
  322. package/dist/telemetry/content.js +0 -56
  323. package/dist/telemetry/git-stats.d.ts +0 -12
  324. package/dist/telemetry/git-stats.js +0 -69
  325. package/dist/telemetry/identify-cache.d.ts +0 -7
  326. package/dist/telemetry/identify-cache.js +0 -47
  327. package/dist/telemetry/input.d.ts +0 -17
  328. package/dist/telemetry/input.js +0 -68
  329. package/dist/telemetry/marker.d.ts +0 -37
  330. package/dist/telemetry/marker.js +0 -67
  331. package/dist/telemetry/workflow.d.ts +0 -85
  332. package/dist/telemetry/workflow.js +0 -318
  333. package/schemas/spec-driven/templates/plan.md +0 -19
@@ -19,5 +19,18 @@ export declare function gitHasRemote(storeRoot: string): Promise<boolean | null>
19
19
  * network touch. Null when there is no repository or no origin.
20
20
  */
21
21
  export declare function gitOriginUrl(storeRoot: string): Promise<string | null>;
22
+ export interface GitTrackingDrift {
23
+ ahead: number;
24
+ behind: number;
25
+ }
26
+ /**
27
+ * Ahead/behind counts of HEAD against its configured upstream tracking
28
+ * ref, read from local refs only — no fetch, no network. The comparison
29
+ * is therefore against the current local upstream ref (typically last
30
+ * updated by fetch, but it may be a local branch), not the live remote.
31
+ * Null when there is no repository, no upstream, a detached HEAD, or Git
32
+ * is unavailable: the absence of a comparison is not drift.
33
+ */
34
+ export declare function gitTrackingDrift(storeRoot: string): Promise<GitTrackingDrift | null>;
22
35
  export declare function gitDirectoryHasTrackedFiles(storeRoot: string, relativeDir: string): Promise<boolean | null>;
23
36
  //# sourceMappingURL=git.d.ts.map
@@ -130,6 +130,30 @@ export async function gitOriginUrl(storeRoot) {
130
130
  const url = stdout?.trim();
131
131
  return url ? url : null;
132
132
  }
133
+ /**
134
+ * Ahead/behind counts of HEAD against its configured upstream tracking
135
+ * ref, read from local refs only — no fetch, no network. The comparison
136
+ * is therefore against the current local upstream ref (typically last
137
+ * updated by fetch, but it may be a local branch), not the live remote.
138
+ * Null when there is no repository, no upstream, a detached HEAD, or Git
139
+ * is unavailable: the absence of a comparison is not drift.
140
+ */
141
+ export async function gitTrackingDrift(storeRoot) {
142
+ const stdout = await gitProbe(storeRoot, [
143
+ 'rev-list',
144
+ '--left-right',
145
+ '--count',
146
+ '@{upstream}...HEAD',
147
+ ]);
148
+ if (stdout === null)
149
+ return null;
150
+ const match = stdout.trim().match(/^(\d+)\s+(\d+)$/);
151
+ if (!match)
152
+ return null;
153
+ // `--left-right` orders the counts by side of the `...`: left is @{upstream}
154
+ // (commits we lack = behind), right is HEAD (commits upstream lacks = ahead).
155
+ return { behind: Number(match[1]), ahead: Number(match[2]) };
156
+ }
133
157
  export async function gitDirectoryHasTrackedFiles(storeRoot, relativeDir) {
134
158
  const stdout = await gitProbe(storeRoot, ['ls-files', '--', relativeDir]);
135
159
  return stdout === null ? null : stdout.trim().length > 0;
@@ -4,6 +4,7 @@ import * as os from 'node:os';
4
4
  import * as path from 'node:path';
5
5
  import { promisify } from 'node:util';
6
6
  import { FileSystemUtils } from '../../utils/file-system.js';
7
+ import { classifyOpenSpecDir, storePointerProblem, } from '../project-config.js';
7
8
  import { ANCHORED_OPENSPEC_DIRS, DIRECTORY_ANCHOR_FILE_NAME, OPENSPEC_ROOT_DIR, ensureOpenSpecRoot, inspectOpenSpecRoot, rollbackCreatedPaths, } from '../openspec-root.js';
8
9
  import { STORE_METADATA_DIR_NAME, getStoreMetadataDir, getStoreMetadataPath, getStoreRegistryPath, listStoreRegistryEntries, readStoreRegistryState, readOptionalStoreMetadataState, resolveGitStoreBackendConfig, validateStoreId, writeStoreMetadataState, } from './foundation.js';
9
10
  import { StoreError, makeStoreDiagnostic } from './errors.js';
@@ -53,6 +54,23 @@ function alreadyRegisteredDiagnostic(id) {
53
54
  target: 'store.registry',
54
55
  });
55
56
  }
57
+ function assertNotConfigOnlyPointerRoot(storeRoot) {
58
+ const { hasPlanningShape, pointer } = classifyOpenSpecDir(storeRoot);
59
+ if (hasPlanningShape || pointer.filePath === null)
60
+ return;
61
+ if (pointer.malformed) {
62
+ throw new StoreError(`The store declaration in ${pointer.filePath} is invalid (${storePointerProblem(pointer.malformed)}).`, 'invalid_store_pointer', {
63
+ target: 'store.pointer',
64
+ fix: `Fix or remove the store: line in ${pointer.filePath} before registering this path as a store.`,
65
+ });
66
+ }
67
+ if (pointer.value !== undefined) {
68
+ throw new StoreError(`This repo's planning is externalized to store '${pointer.value}' (${pointer.filePath}); it is not itself a store root.`, 'store_root_pointer_declared', {
69
+ target: 'store.pointer',
70
+ fix: 'Register the checkout for the declared store, or remove the store: line first to convert this repo into a local store root.',
71
+ });
72
+ }
73
+ }
56
74
  function createdPath(relativePath, absolutePath, kind) {
57
75
  return {
58
76
  relativePath,
@@ -233,6 +251,7 @@ async function prepareSetupPlan(input) {
233
251
  let metadata = null;
234
252
  let backend;
235
253
  if (kind === 'directory') {
254
+ assertNotConfigOnlyPointerRoot(storeRoot);
236
255
  metadata = await readStoreMetadataForOperation(storeRoot);
237
256
  if (metadata) {
238
257
  if (metadata.id !== id) {
@@ -442,6 +461,7 @@ export async function registerExistingStore(input) {
442
461
  fix: 'Pass an existing store directory.',
443
462
  });
444
463
  }
464
+ assertNotConfigOnlyPointerRoot(storeRoot);
445
465
  const openspecRoot = await inspectOpenSpecRoot(storeRoot);
446
466
  if (!openspecRoot.healthy) {
447
467
  const problems = openspecRoot.diagnostics.map((diagnostic) => diagnostic.message).join(' ') ||
@@ -7,7 +7,9 @@ export type { SkillTemplate, CommandTemplate } from './types.js';
7
7
  export { getExploreSkillTemplate, getOpsxExploreCommandTemplate } from './workflows/explore.js';
8
8
  export { getNewChangeSkillTemplate, getOpsxNewCommandTemplate } from './workflows/new-change.js';
9
9
  export { getContinueChangeSkillTemplate, getOpsxContinueCommandTemplate } from './workflows/continue-change.js';
10
- export { getApplyChangeSkillTemplate, getOpsxApplyCommandTemplate } from './workflows/apply-change.js';
10
+ export { getApplyInstructions, getApplyChangeSkillTemplate, getOpsxApplyCommandTemplate } from './workflows/apply-change.js';
11
+ export { getUpdateChangeSkillTemplate, getOpsxUpdateCommandTemplate } from './workflows/update-change.js';
12
+ export { getModifyChangeSkillTemplate, getOpsxModifyCommandTemplate } from './workflows/modify-change.js';
11
13
  export { getFfChangeSkillTemplate, getOpsxFfCommandTemplate } from './workflows/ff-change.js';
12
14
  export { getSyncSpecsSkillTemplate, getOpsxSyncCommandTemplate } from './workflows/sync-specs.js';
13
15
  export { getArchiveChangeSkillTemplate, getOpsxArchiveCommandTemplate } from './workflows/archive-change.js';
@@ -15,6 +17,5 @@ export { getBulkArchiveChangeSkillTemplate, getOpsxBulkArchiveCommandTemplate }
15
17
  export { getVerifyChangeSkillTemplate, getOpsxVerifyCommandTemplate } from './workflows/verify-change.js';
16
18
  export { getOnboardSkillTemplate, getOpsxOnboardCommandTemplate } from './workflows/onboard.js';
17
19
  export { getOpsxProposeSkillTemplate, getOpsxProposeCommandTemplate } from './workflows/propose.js';
18
- export { getModifyChangeSkillTemplate, getOpsxModifyCommandTemplate } from './workflows/modify-change.js';
19
20
  export { getFeedbackSkillTemplate } from './workflows/feedback.js';
20
21
  //# sourceMappingURL=skill-templates.d.ts.map
@@ -6,7 +6,9 @@
6
6
  export { getExploreSkillTemplate, getOpsxExploreCommandTemplate } from './workflows/explore.js';
7
7
  export { getNewChangeSkillTemplate, getOpsxNewCommandTemplate } from './workflows/new-change.js';
8
8
  export { getContinueChangeSkillTemplate, getOpsxContinueCommandTemplate } from './workflows/continue-change.js';
9
- export { getApplyChangeSkillTemplate, getOpsxApplyCommandTemplate } from './workflows/apply-change.js';
9
+ export { getApplyInstructions, getApplyChangeSkillTemplate, getOpsxApplyCommandTemplate } from './workflows/apply-change.js';
10
+ export { getUpdateChangeSkillTemplate, getOpsxUpdateCommandTemplate } from './workflows/update-change.js';
11
+ export { getModifyChangeSkillTemplate, getOpsxModifyCommandTemplate } from './workflows/modify-change.js';
10
12
  export { getFfChangeSkillTemplate, getOpsxFfCommandTemplate } from './workflows/ff-change.js';
11
13
  export { getSyncSpecsSkillTemplate, getOpsxSyncCommandTemplate } from './workflows/sync-specs.js';
12
14
  export { getArchiveChangeSkillTemplate, getOpsxArchiveCommandTemplate } from './workflows/archive-change.js';
@@ -14,6 +16,5 @@ export { getBulkArchiveChangeSkillTemplate, getOpsxBulkArchiveCommandTemplate }
14
16
  export { getVerifyChangeSkillTemplate, getOpsxVerifyCommandTemplate } from './workflows/verify-change.js';
15
17
  export { getOnboardSkillTemplate, getOpsxOnboardCommandTemplate } from './workflows/onboard.js';
16
18
  export { getOpsxProposeSkillTemplate, getOpsxProposeCommandTemplate } from './workflows/propose.js';
17
- export { getModifyChangeSkillTemplate, getOpsxModifyCommandTemplate } from './workflows/modify-change.js';
18
19
  export { getFeedbackSkillTemplate } from './workflows/feedback.js';
19
20
  //# sourceMappingURL=skill-templates.js.map
@@ -5,6 +5,16 @@
5
5
  * templates file into workflow-focused modules.
6
6
  */
7
7
  import type { SkillTemplate, CommandTemplate } from '../types.js';
8
+ /**
9
+ * The apply workflow instructions, authored once and rendered by both the
10
+ * skill and command surfaces. The surfaces are intentionally distinct, but
11
+ * they differ only in how they are invoked — the generation transformers
12
+ * rewrite the canonical `/opsx:<id>` tokens per surface downstream (see
13
+ * command-references.ts). The instruction text itself is shared, so the two
14
+ * cannot silently drift. Should a surface ever need genuinely different
15
+ * wording, add a parameter here and pass it from that surface's template.
16
+ */
17
+ export declare function getApplyInstructions(): string;
8
18
  export declare function getApplyChangeSkillTemplate(): SkillTemplate;
9
19
  export declare function getOpsxApplyCommandTemplate(): CommandTemplate;
10
20
  //# sourceMappingURL=apply-change.d.ts.map
@@ -1,171 +1,193 @@
1
- import { ATLASSIAN_ENRICHMENT_GUIDANCE, CONTEXT7_LOOKUP_GUIDANCE, PLAYWRIGHT_APPLY_GUARDRAIL, } from './mcp-guidance.js';
2
- import { COMPREHENSION_APPLY_GUARDRAIL, COMPREHENSION_QUIZ_GUIDANCE, } from './comprehension-guidance.js';
3
1
  import { STORE_SELECTION_GUIDANCE } from './store-selection.js';
4
- import { PROMPT_SELECT_CHANGE } from './user-prompt-guidance.js';
2
+ /**
3
+ * The apply workflow instructions, authored once and rendered by both the
4
+ * skill and command surfaces. The surfaces are intentionally distinct, but
5
+ * they differ only in how they are invoked — the generation transformers
6
+ * rewrite the canonical `/opsx:<id>` tokens per surface downstream (see
7
+ * command-references.ts). The instruction text itself is shared, so the two
8
+ * cannot silently drift. Should a surface ever need genuinely different
9
+ * wording, add a parameter here and pass it from that surface's template.
10
+ */
11
+ export function getApplyInstructions() {
12
+ return `Implement tasks from an OpenSpec change.
13
+
14
+ ${STORE_SELECTION_GUIDANCE}
15
+
16
+ **Input**: Optionally specify a change name (e.g., \`/opsx:apply add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
17
+
18
+ **Steps**
19
+
20
+ 1. **Select the change**
21
+
22
+ If a name is provided, use it. Otherwise:
23
+ - Infer from conversation context if the user mentioned a change
24
+ - Auto-select if only one active change exists
25
+ - If ambiguous, run \`openspec list --json\` to get available changes and ask the user to select one
26
+
27
+ Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:apply <other>\`).
28
+
29
+ 2. **Check status to understand the schema**
30
+ \`\`\`bash
31
+ openspec status --change "<name>" --json
32
+ \`\`\`
33
+ Parse the JSON to understand:
34
+ - \`schemaName\`: The workflow being used (e.g., "spec-driven")
35
+ - \`planningHome\`, \`changeRoot\`, and \`actionContext\`: planning scope and edit constraints
36
+ - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
37
+
38
+ 3. **Get apply instructions**
39
+
40
+ \`\`\`bash
41
+ openspec instructions apply --change "<name>" --json
42
+ \`\`\`
43
+
44
+ This returns:
45
+ - \`contextFiles\`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
46
+ - Progress (total, complete, remaining)
47
+ - Task list with status
48
+ - Dynamic instruction based on current state
49
+ - Optional \`context\`: current required project instruction input from the selected root
50
+ - Optional \`operationGuidance\`: current advisory guidance for apply
51
+
52
+ **Handle states:**
53
+ - If \`state: "blocked"\` (missing artifacts): show message, suggest using \`/opsx:continue\` (if it is not installed, run \`openspec status --change "<name>" --json\` to see the next artifact and \`openspec instructions <artifact-id> --change "<name>" --json\` for how to create it)
54
+ - If \`state: "all_done"\`: congratulate, suggest archive
55
+ - Otherwise: proceed to implementation
56
+
57
+ Treat \`context\` as a required prompt-level input. Read and consider it, and
58
+ apply relevant project facts, conventions, and constraints while implementing.
59
+ Treat \`operationGuidance\` as optional additive advice. Read and consider every
60
+ entry, and follow entries that are applicable and compatible with the built-in
61
+ workflow.
62
+
63
+ Keep both fields separate from CLI-returned state, missing artifacts, tasks,
64
+ progress, \`contextFiles\`, and the built-in \`instruction\`. They are not
65
+ evidence of task completion, do not replace the built-in instruction, and do
66
+ not permit bypassing a blocked state. If context conflicts with the built-in
67
+ instruction, an explicit user choice, or a CLI-controlled value, report the
68
+ conflict and preserve the controlling value. If guidance is inapplicable or
69
+ conflicts with those controlling inputs, do not follow it and explain why.
70
+ These are prompt-level behavior contracts, not enforceable checks.
71
+
72
+ 4. **Read context files**
73
+
74
+ Read every file path listed under \`contextFiles\` from the apply instructions output.
75
+ The files depend on the schema being used:
76
+ - **spec-driven**: proposal, specs, design, tasks
77
+ - Other schemas: follow the contextFiles from CLI output
78
+
79
+ Do not copy \`context\` or \`operationGuidance\` verbatim into implementation
80
+ files or planning artifacts unless the user separately asks for that content.
81
+
82
+ 5. **Show current progress**
83
+
84
+ Display:
85
+ - Schema being used
86
+ - Progress: "N/M tasks complete"
87
+ - Remaining tasks overview
88
+ - Dynamic instruction from CLI
89
+
90
+ 6. **Implement tasks (loop until done or blocked)**
91
+
92
+ For each pending task:
93
+ - Show which task is being worked on
94
+ - Make the code changes required
95
+ - Keep changes minimal and focused
96
+ - Mark task complete in the tasks file: \`- [ ]\` → \`- [x]\`
97
+ - Continue to next task
98
+
99
+ **Pause if:**
100
+ - Task is unclear → ask for clarification
101
+ - Implementation reveals a design issue → suggest updating artifacts
102
+ - Error or blocker encountered → report and wait for guidance
103
+ - User interrupts
104
+
105
+ 7. **On completion or pause, show status**
106
+
107
+ Display:
108
+ - Tasks completed this session
109
+ - Overall progress: "N/M tasks complete"
110
+ - If all done: suggest archive
111
+ - If paused: explain why and wait for guidance
112
+
113
+ **Output During Implementation**
114
+
115
+ \`\`\`
116
+ ## Implementing: <change-name> (schema: <schema-name>)
117
+
118
+ Working on task 3/7: <task description>
119
+ [...implementation happening...]
120
+ ✓ Task complete
121
+
122
+ Working on task 4/7: <task description>
123
+ [...implementation happening...]
124
+ ✓ Task complete
125
+ \`\`\`
126
+
127
+ **Output On Completion**
128
+
129
+ \`\`\`
130
+ ## Implementation Complete
131
+
132
+ **Change:** <change-name>
133
+ **Schema:** <schema-name>
134
+ **Progress:** 7/7 tasks complete ✓
135
+
136
+ ### Completed This Session
137
+ - [x] Task 1
138
+ - [x] Task 2
139
+ ...
140
+
141
+ All tasks complete! You can archive this change with \`/opsx:archive\`.
142
+ \`\`\`
143
+
144
+ **Output On Pause (Issue Encountered)**
145
+
146
+ \`\`\`
147
+ ## Implementation Paused
148
+
149
+ **Change:** <change-name>
150
+ **Schema:** <schema-name>
151
+ **Progress:** 4/7 tasks complete
152
+
153
+ ### Issue Encountered
154
+ <description of the issue>
155
+
156
+ **Options:**
157
+ 1. <option 1>
158
+ 2. <option 2>
159
+ 3. Other approach
160
+
161
+ What would you like to do?
162
+ \`\`\`
163
+
164
+ **Guardrails**
165
+ - Keep going through tasks until done or blocked
166
+ - Always read context files before starting (from the apply instructions output)
167
+ - If task is ambiguous, pause and ask before implementing
168
+ - If implementation reveals issues, pause and suggest artifact updates
169
+ - Keep code changes minimal and scoped to each task
170
+ - Update task checkbox immediately after completing each task
171
+ - Pause on errors, blockers, or unclear requirements - don't guess
172
+ - Use contextFiles from CLI output, don't assume specific file names
173
+ - Do not use context or operation guidance as proof that a task is complete
174
+ - Apply relevant project context; report conflicts with controlling workflow inputs
175
+ - Consider every guidance entry; explain any inapplicable or conflicting advice
176
+ - Do not copy runtime context or operation guidance into implementation files or planning artifacts
177
+ - Preserve CLI-controlled blocked/ready/all-done behavior and completion criteria
178
+
179
+ **Fluid Workflow Integration**
180
+
181
+ This skill supports the "actions on a change" model:
182
+
183
+ - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
184
+ - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly`;
185
+ }
5
186
  export function getApplyChangeSkillTemplate() {
6
187
  return {
7
188
  name: 'openspec-apply-change',
8
189
  description: 'Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.',
9
- instructions: `Implement tasks from an OpenSpec change.
10
-
11
- ${STORE_SELECTION_GUIDANCE}
12
-
13
- **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
14
-
15
- **Steps**
16
-
17
- 1. **Select the change**
18
-
19
- If a name is provided, use it. Otherwise:
20
- - Infer from conversation context if the user mentioned a change
21
- - Auto-select if only one active change exists
22
- - If ambiguous, ${PROMPT_SELECT_CHANGE}
23
-
24
- Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:apply <other>\`).
25
-
26
- 2. **Check status to understand the schema**
27
- \`\`\`bash
28
- openspec status --change "<name>" --json
29
- \`\`\`
30
- Parse the JSON to understand:
31
- - \`schemaName\`: The workflow being used (e.g., "spec-driven")
32
- - \`planningHome\`, \`changeRoot\`, and \`actionContext\`: planning scope and edit constraints
33
- - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
34
-
35
- 3. **Get apply instructions**
36
-
37
- \`\`\`bash
38
- openspec instructions apply --change "<name>" --json
39
- \`\`\`
40
-
41
- This returns:
42
- - \`contextFiles\`: artifact ID -> array of concrete file paths (varies by schema - could be proposal/specs/design/tasks or spec/tests/implementation/docs)
43
- - Progress (total, complete, remaining)
44
- - Task list with status
45
- - Dynamic instruction based on current state
46
-
47
- **Handle states:**
48
- - If \`state: "blocked"\` and \`missingArtifacts\`: show message, suggest using openspec-continue-change
49
- - If \`state: "blocked"\` and \`missingComprehension\`: proceed to step 4 (comprehension quiz) — do NOT implement
50
- - If \`state: "all_done"\`: congratulate, suggest archive
51
- - If \`state: "ready"\`: proceed to step 5
52
-
53
- ${ATLASSIAN_ENRICHMENT_GUIDANCE}
54
-
55
- ${COMPREHENSION_QUIZ_GUIDANCE}
56
-
57
- 5. **Read context files**
58
-
59
- After comprehension is passed (or not required), read every file path listed under \`contextFiles\` from the apply instructions output.
60
- The files depend on the schema being used:
61
- - **spec-driven**: proposal, specs, design, plan, tasks
62
- - Other schemas: follow the contextFiles from CLI output
63
-
64
- 6. **Show current progress**
65
-
66
- Display:
67
- - Schema being used
68
- - Progress: "N/M tasks complete"
69
- - Remaining tasks overview
70
- - Dynamic instruction from CLI
71
-
72
- 7. **Implement tasks (loop until done or blocked)**
73
-
74
- For each pending task:
75
- - Show which task is being worked on
76
-
77
- ${CONTEXT7_LOOKUP_GUIDANCE}
78
-
79
- - Make the code changes required
80
- - Keep changes minimal and focused
81
- - Mark task complete in the tasks file: \`- [ ]\` → \`- [x]\`
82
- - Continue to next task
83
-
84
- **After editing artifacts:** run \`openspec status --change "<name>" --json\` so revision tracking records content changes.
85
-
86
- **Pause if:**
87
- - Task is unclear → ask for clarification
88
- - Implementation reveals a design issue → suggest updating artifacts
89
- - Error or blocker encountered → report and wait for guidance
90
- - User interrupts
91
-
92
- 8. **On completion or pause, show status**
93
-
94
- Display:
95
- - Tasks completed this session
96
- - Overall progress: "N/M tasks complete"
97
- - If all done: suggest archive
98
- - If paused: explain why and wait for guidance
99
-
100
- **Output During Implementation**
101
-
102
- \`\`\`
103
- ## Implementing: <change-name> (schema: <schema-name>)
104
-
105
- Working on task 3/7: <task description>
106
- [...implementation happening...]
107
- ✓ Task complete
108
-
109
- Working on task 4/7: <task description>
110
- [...implementation happening...]
111
- ✓ Task complete
112
- \`\`\`
113
-
114
- **Output On Completion**
115
-
116
- \`\`\`
117
- ## Implementation Complete
118
-
119
- **Change:** <change-name>
120
- **Schema:** <schema-name>
121
- **Progress:** 7/7 tasks complete ✓
122
-
123
- ### Completed This Session
124
- - [x] Task 1
125
- - [x] Task 2
126
- ...
127
-
128
- All tasks complete! Ready to archive this change.
129
- \`\`\`
130
-
131
- **Output On Pause (Issue Encountered)**
132
-
133
- \`\`\`
134
- ## Implementation Paused
135
-
136
- **Change:** <change-name>
137
- **Schema:** <schema-name>
138
- **Progress:** 4/7 tasks complete
139
-
140
- ### Issue Encountered
141
- <description of the issue>
142
-
143
- **Options:**
144
- 1. <option 1>
145
- 2. <option 2>
146
- 3. Other approach
147
-
148
- What would you like to do?
149
- \`\`\`
150
-
151
- **Guardrails**
152
- - Keep going through tasks until done or blocked
153
- - Always read context files before starting (from the apply instructions output)
154
- - If task is ambiguous, pause and ask before implementing
155
- - If implementation reveals issues, pause and suggest artifact updates
156
- - Keep code changes minimal and scoped to each task
157
- - Update task checkbox immediately after completing each task
158
- - Pause on errors, blockers, or unclear requirements - don't guess
159
- - Use contextFiles from CLI output, don't assume specific file names
160
- ${COMPREHENSION_APPLY_GUARDRAIL}
161
- ${PLAYWRIGHT_APPLY_GUARDRAIL}
162
-
163
- **Fluid Workflow Integration**
164
-
165
- This skill supports the "actions on a change" model:
166
-
167
- - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
168
- - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly`,
190
+ instructions: getApplyInstructions(),
169
191
  license: 'MIT',
170
192
  compatibility: 'Requires openspec CLI.',
171
193
  metadata: { author: 'openspec', version: '1.0' },
@@ -177,166 +199,7 @@ export function getOpsxApplyCommandTemplate() {
177
199
  description: 'Implement tasks from an OpenSpec change (Experimental)',
178
200
  category: 'Workflow',
179
201
  tags: ['workflow', 'artifacts', 'experimental'],
180
- content: `Implement tasks from an OpenSpec change.
181
-
182
- ${STORE_SELECTION_GUIDANCE}
183
-
184
- **Input**: Optionally specify a change name (e.g., \`/opsx:apply add-auth\`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
185
-
186
- **Steps**
187
-
188
- 1. **Select the change**
189
-
190
- If a name is provided, use it. Otherwise:
191
- - Infer from conversation context if the user mentioned a change
192
- - Auto-select if only one active change exists
193
- - If ambiguous, ${PROMPT_SELECT_CHANGE}
194
-
195
- Always announce: "Using change: <name>" and how to override (e.g., \`/opsx:apply <other>\`).
196
-
197
- 2. **Check status to understand the schema**
198
- \`\`\`bash
199
- openspec status --change "<name>" --json
200
- \`\`\`
201
- Parse the JSON to understand:
202
- - \`schemaName\`: The workflow being used (e.g., "spec-driven")
203
- - \`planningHome\`, \`changeRoot\`, and \`actionContext\`: planning scope and edit constraints
204
- - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
205
-
206
- 3. **Get apply instructions**
207
-
208
- \`\`\`bash
209
- openspec instructions apply --change "<name>" --json
210
- \`\`\`
211
-
212
- This returns:
213
- - \`contextFiles\`: artifact ID -> array of concrete file paths (varies by schema)
214
- - Progress (total, complete, remaining)
215
- - Task list with status
216
- - Dynamic instruction based on current state
217
-
218
- **Handle states:**
219
- - If \`state: "blocked"\` and \`missingArtifacts\`: show message, suggest using \`/opsx:continue\`
220
- - If \`state: "blocked"\` and \`missingComprehension\`: proceed to step 4 (comprehension quiz) — do NOT implement
221
- - If \`state: "all_done"\`: congratulate, suggest archive
222
- - If \`state: "ready"\`: proceed to step 5
223
-
224
- ${ATLASSIAN_ENRICHMENT_GUIDANCE}
225
-
226
- ${COMPREHENSION_QUIZ_GUIDANCE}
227
-
228
- 5. **Read context files**
229
-
230
- After comprehension is passed (or not required), read every file path listed under \`contextFiles\` from the apply instructions output.
231
- The files depend on the schema being used:
232
- - **spec-driven**: proposal, specs, design, plan, tasks
233
- - Other schemas: follow the contextFiles from CLI output
234
-
235
- 6. **Show current progress**
236
-
237
- Display:
238
- - Schema being used
239
- - Progress: "N/M tasks complete"
240
- - Remaining tasks overview
241
- - Dynamic instruction from CLI
242
-
243
- 7. **Implement tasks (loop until done or blocked)**
244
-
245
- For each pending task:
246
- - Show which task is being worked on
247
-
248
- ${CONTEXT7_LOOKUP_GUIDANCE}
249
-
250
- - Make the code changes required
251
- - Keep changes minimal and focused
252
- - Mark task complete in the tasks file: \`- [ ]\` → \`- [x]\`
253
- - Continue to next task
254
-
255
- **After editing artifacts:** run \`openspec status --change "<name>" --json\` so revision tracking records content changes.
256
-
257
- **Pause if:**
258
- - Task is unclear → ask for clarification
259
- - Implementation reveals a design issue → suggest updating artifacts
260
- - Error or blocker encountered → report and wait for guidance
261
- - User interrupts
262
-
263
- 8. **On completion or pause, show status**
264
-
265
- Display:
266
- - Tasks completed this session
267
- - Overall progress: "N/M tasks complete"
268
- - If all done: suggest archive
269
- - If paused: explain why and wait for guidance
270
-
271
- **Output During Implementation**
272
-
273
- \`\`\`
274
- ## Implementing: <change-name> (schema: <schema-name>)
275
-
276
- Working on task 3/7: <task description>
277
- [...implementation happening...]
278
- ✓ Task complete
279
-
280
- Working on task 4/7: <task description>
281
- [...implementation happening...]
282
- ✓ Task complete
283
- \`\`\`
284
-
285
- **Output On Completion**
286
-
287
- \`\`\`
288
- ## Implementation Complete
289
-
290
- **Change:** <change-name>
291
- **Schema:** <schema-name>
292
- **Progress:** 7/7 tasks complete ✓
293
-
294
- ### Completed This Session
295
- - [x] Task 1
296
- - [x] Task 2
297
- ...
298
-
299
- All tasks complete! You can archive this change with \`/opsx:archive\`.
300
- \`\`\`
301
-
302
- **Output On Pause (Issue Encountered)**
303
-
304
- \`\`\`
305
- ## Implementation Paused
306
-
307
- **Change:** <change-name>
308
- **Schema:** <schema-name>
309
- **Progress:** 4/7 tasks complete
310
-
311
- ### Issue Encountered
312
- <description of the issue>
313
-
314
- **Options:**
315
- 1. <option 1>
316
- 2. <option 2>
317
- 3. Other approach
318
-
319
- What would you like to do?
320
- \`\`\`
321
-
322
- **Guardrails**
323
- - Keep going through tasks until done or blocked
324
- - Always read context files before starting (from the apply instructions output)
325
- - If task is ambiguous, pause and ask before implementing
326
- - If implementation reveals issues, pause and suggest artifact updates
327
- - Keep code changes minimal and scoped to each task
328
- - Update task checkbox immediately after completing each task
329
- - Pause on errors, blockers, or unclear requirements - don't guess
330
- - Use contextFiles from CLI output, don't assume specific file names
331
- ${COMPREHENSION_APPLY_GUARDRAIL}
332
- ${PLAYWRIGHT_APPLY_GUARDRAIL}
333
-
334
- **Fluid Workflow Integration**
335
-
336
- This skill supports the "actions on a change" model:
337
-
338
- - **Can be invoked anytime**: Before all artifacts are done (if tasks exist), after partial implementation, interleaved with other actions
339
- - **Allows artifact updates**: If implementation reveals design issues, suggest updating artifacts - not phase-locked, work fluidly`
202
+ content: getApplyInstructions(),
340
203
  };
341
204
  }
342
205
  //# sourceMappingURL=apply-change.js.map