openspec-cn 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +153 -0
- package/bin/openspec.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +480 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +277 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +257 -0
- package/dist/commands/config.d.ts +8 -0
- package/dist/commands/config.js +198 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +183 -0
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/schema.js +869 -0
- package/dist/commands/show.d.ts +14 -0
- package/dist/commands/show.js +132 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +225 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +294 -0
- package/dist/commands/workflow/index.d.ts +17 -0
- package/dist/commands/workflow/index.js +12 -0
- package/dist/commands/workflow/instructions.d.ts +29 -0
- package/dist/commands/workflow/instructions.js +381 -0
- package/dist/commands/workflow/new-change.d.ts +11 -0
- package/dist/commands/workflow/new-change.js +44 -0
- package/dist/commands/workflow/schemas.d.ts +10 -0
- package/dist/commands/workflow/schemas.js +34 -0
- package/dist/commands/workflow/shared.d.ts +52 -0
- package/dist/commands/workflow/shared.js +111 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +58 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +68 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +280 -0
- package/dist/core/artifact-graph/graph.d.ts +56 -0
- package/dist/core/artifact-graph/graph.js +141 -0
- package/dist/core/artifact-graph/index.d.ts +7 -0
- package/dist/core/artifact-graph/index.js +13 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
- package/dist/core/artifact-graph/instruction-loader.js +214 -0
- package/dist/core/artifact-graph/resolver.d.ts +81 -0
- package/dist/core/artifact-graph/resolver.js +257 -0
- package/dist/core/artifact-graph/schema.d.ts +13 -0
- package/dist/core/artifact-graph/schema.js +108 -0
- package/dist/core/artifact-graph/state.d.ts +12 -0
- package/dist/core/artifact-graph/state.js +54 -0
- package/dist/core/artifact-graph/types.d.ts +45 -0
- package/dist/core/artifact-graph/types.js +43 -0
- package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
- package/dist/core/command-generation/adapters/amazon-q.js +26 -0
- package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
- package/dist/core/command-generation/adapters/antigravity.js +26 -0
- package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
- package/dist/core/command-generation/adapters/auggie.js +27 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +50 -0
- package/dist/core/command-generation/adapters/cline.d.ts +14 -0
- package/dist/core/command-generation/adapters/cline.js +27 -0
- package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
- package/dist/core/command-generation/adapters/codebuddy.js +28 -0
- package/dist/core/command-generation/adapters/codex.d.ts +13 -0
- package/dist/core/command-generation/adapters/codex.js +27 -0
- package/dist/core/command-generation/adapters/continue.d.ts +13 -0
- package/dist/core/command-generation/adapters/continue.js +28 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +13 -0
- package/dist/core/command-generation/adapters/costrict.js +27 -0
- package/dist/core/command-generation/adapters/crush.d.ts +13 -0
- package/dist/core/command-generation/adapters/crush.js +30 -0
- package/dist/core/command-generation/adapters/cursor.d.ts +14 -0
- package/dist/core/command-generation/adapters/cursor.js +44 -0
- package/dist/core/command-generation/adapters/factory.d.ts +13 -0
- package/dist/core/command-generation/adapters/factory.js +27 -0
- package/dist/core/command-generation/adapters/gemini.d.ts +13 -0
- package/dist/core/command-generation/adapters/gemini.js +26 -0
- package/dist/core/command-generation/adapters/github-copilot.d.ts +13 -0
- package/dist/core/command-generation/adapters/github-copilot.js +26 -0
- package/dist/core/command-generation/adapters/iflow.d.ts +13 -0
- package/dist/core/command-generation/adapters/iflow.js +29 -0
- package/dist/core/command-generation/adapters/index.d.ts +27 -0
- package/dist/core/command-generation/adapters/index.js +27 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/kilocode.js +23 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +26 -0
- package/dist/core/command-generation/adapters/qoder.d.ts +13 -0
- package/dist/core/command-generation/adapters/qoder.js +30 -0
- package/dist/core/command-generation/adapters/qwen.d.ts +13 -0
- package/dist/core/command-generation/adapters/qwen.js +26 -0
- package/dist/core/command-generation/adapters/roocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/roocode.js +27 -0
- package/dist/core/command-generation/adapters/windsurf.d.ts +14 -0
- package/dist/core/command-generation/adapters/windsurf.js +51 -0
- package/dist/core/command-generation/generator.d.ts +21 -0
- package/dist/core/command-generation/generator.js +27 -0
- package/dist/core/command-generation/index.d.ts +22 -0
- package/dist/core/command-generation/index.js +24 -0
- package/dist/core/command-generation/registry.d.ts +36 -0
- package/dist/core/command-generation/registry.js +88 -0
- package/dist/core/command-generation/types.d.ts +55 -0
- package/dist/core/command-generation/types.js +8 -0
- package/dist/core/completions/command-registry.d.ts +7 -0
- package/dist/core/completions/command-registry.js +456 -0
- package/dist/core/completions/completion-provider.d.ts +60 -0
- package/dist/core/completions/completion-provider.js +102 -0
- package/dist/core/completions/factory.d.ts +64 -0
- package/dist/core/completions/factory.js +75 -0
- package/dist/core/completions/generators/bash-generator.d.ts +32 -0
- package/dist/core/completions/generators/bash-generator.js +174 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +157 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
- package/dist/core/completions/generators/powershell-generator.js +207 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
- package/dist/core/completions/generators/zsh-generator.js +250 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +318 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +143 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
- package/dist/core/completions/installers/powershell-installer.js +327 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
- package/dist/core/completions/installers/zsh-installer.js +449 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +24 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +39 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +25 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +36 -0
- package/dist/core/completions/types.d.ts +79 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +34 -0
- package/dist/core/config-schema.d.ts +76 -0
- package/dist/core/config-schema.js +200 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +30 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/global-config.d.ts +39 -0
- package/dist/core/global-config.js +115 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/init.d.ts +32 -0
- package/dist/core/init.js +433 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +501 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +171 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +193 -0
- package/dist/core/parsers/markdown-parser.d.ts +22 -0
- package/dist/core/parsers/markdown-parser.js +187 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +223 -0
- package/dist/core/schemas/base.schema.d.ts +13 -0
- package/dist/core/schemas/base.schema.js +13 -0
- package/dist/core/schemas/change.schema.d.ts +73 -0
- package/dist/core/schemas/change.schema.js +31 -0
- package/dist/core/schemas/index.d.ts +4 -0
- package/dist/core/schemas/index.js +4 -0
- package/dist/core/schemas/spec.schema.d.ts +18 -0
- package/dist/core/schemas/spec.schema.js +15 -0
- package/dist/core/shared/index.d.ts +8 -0
- package/dist/core/shared/index.js +8 -0
- package/dist/core/shared/skill-generation.d.ts +41 -0
- package/dist/core/shared/skill-generation.js +74 -0
- package/dist/core/shared/tool-detection.d.ts +66 -0
- package/dist/core/shared/tool-detection.js +140 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +384 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/index.d.ts +8 -0
- package/dist/core/templates/index.js +9 -0
- package/dist/core/templates/skill-templates.d.ts +112 -0
- package/dist/core/templates/skill-templates.js +2893 -0
- package/dist/core/update.d.ts +42 -0
- package/dist/core/update.js +306 -0
- package/dist/core/validation/constants.d.ts +34 -0
- package/dist/core/validation/constants.js +40 -0
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.js +2 -0
- package/dist/core/validation/validator.d.ts +33 -0
- package/dist/core/validation/validator.js +409 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +168 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/prompts/searchable-multi-select.d.ts +27 -0
- package/dist/prompts/searchable-multi-select.js +149 -0
- package/dist/telemetry/config.d.ts +32 -0
- package/dist/telemetry/config.js +68 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +145 -0
- package/dist/ui/ascii-patterns.d.ts +16 -0
- package/dist/ui/ascii-patterns.js +133 -0
- package/dist/ui/welcome-screen.d.ts +10 -0
- package/dist/ui/welcome-screen.js +146 -0
- package/dist/utils/change-metadata.d.ts +51 -0
- package/dist/utils/change-metadata.js +147 -0
- package/dist/utils/change-utils.d.ts +62 -0
- package/dist/utils/change-utils.js +121 -0
- package/dist/utils/file-system.d.ts +36 -0
- package/dist/utils/file-system.js +281 -0
- package/dist/utils/index.d.ts +5 -0
- package/dist/utils/index.js +7 -0
- package/dist/utils/interactive.d.ts +18 -0
- package/dist/utils/interactive.js +21 -0
- package/dist/utils/item-discovery.d.ts +4 -0
- package/dist/utils/item-discovery.js +72 -0
- package/dist/utils/match.d.ts +3 -0
- package/dist/utils/match.js +22 -0
- package/dist/utils/shell-detection.d.ts +20 -0
- package/dist/utils/shell-detection.js +41 -0
- package/dist/utils/task-progress.d.ts +8 -0
- package/dist/utils/task-progress.js +36 -0
- package/package.json +84 -0
- package/schemas/spec-driven/schema.yaml +148 -0
- package/schemas/spec-driven/templates/design.md +19 -0
- package/schemas/spec-driven/templates/proposal.md +23 -0
- package/schemas/spec-driven/templates/spec.md +8 -0
- package/schemas/spec-driven/templates/tasks.md +9 -0
- package/schemas/tdd/schema.yaml +213 -0
- package/schemas/tdd/templates/docs.md +15 -0
- package/schemas/tdd/templates/implementation.md +11 -0
- package/schemas/tdd/templates/spec.md +11 -0
- package/schemas/tdd/templates/test.md +11 -0
- package/scripts/postinstall.js +147 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 OpenSpec Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://github.com/xiangagou163/OpenSpec-cn">
|
|
3
|
+
<picture>
|
|
4
|
+
<source srcset="assets/openspec_pixel_dark.svg" media="(prefers-color-scheme: dark)">
|
|
5
|
+
<source srcset="assets/openspec_pixel_light.svg" media="(prefers-color-scheme: light)">
|
|
6
|
+
<img src="assets/openspec_pixel_light.svg" alt="OpenSpec logo" height="64">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
|
|
10
|
+
</p>
|
|
11
|
+
<p align="center">Spec-driven development for AI coding assistants.</p>
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://github.com/xiangagou163/OpenSpec-cn/actions/workflows/ci.yml"><img alt="CI" src="https://github.com/xiangagou163/OpenSpec-cn/actions/workflows/ci.yml/badge.svg" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/openspec-cn"><img alt="npm version" src="https://img.shields.io/npm/v/openspec-cn?style=flat-square" /></a>
|
|
15
|
+
<a href="https://nodejs.org/"><img alt="node version" src="https://img.shields.io/node/v/openspec-cn?style=flat-square" /></a>
|
|
16
|
+
<a href="./LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square" /></a>
|
|
17
|
+
<a href="https://conventionalcommits.org"><img alt="Conventional Commits" src="https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg?style=flat-square" /></a>
|
|
18
|
+
<a href="https://discord.gg/YctCnvvshC"><img alt="Discord" src="https://img.shields.io/badge/Discord-Join%20the%20community-5865F2?logo=discord&logoColor=white&style=flat-square" /></a>
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
<p align="center">
|
|
22
|
+
<img src="assets/openspec_dashboard.png" alt="OpenSpec dashboard preview" width="90%">
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
Follow <a href="https://x.com/0xTab">@0xTab on X</a> for updates · Join the <a href="https://discord.gg/YctCnvvshC">OpenSpec Discord</a> for help and questions.
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<p align="center">
|
|
30
|
+
<sub>🧪 <strong>New:</strong> <a href="docs/experimental-workflow.md">Experimental Workflow (OPSX)</a> — schema-driven, hackable, fluid. Iterate on workflows without code changes.</sub>
|
|
31
|
+
</p>
|
|
32
|
+
|
|
33
|
+
# OpenSpec-cn
|
|
34
|
+
|
|
35
|
+
OpenSpec alignments humans and AI coding assistants with spec-driven development so you agree on what to build before any code is written. **No API keys required.**
|
|
36
|
+
|
|
37
|
+
## Why OpenSpec?
|
|
38
|
+
|
|
39
|
+
AI coding assistants are powerful but unpredictable when requirements live in chat history. OpenSpec adds a lightweight specification workflow that locks intent before implementation, giving you deterministic, reviewable outputs.
|
|
40
|
+
|
|
41
|
+
Key outcomes:
|
|
42
|
+
- Human and AI stakeholders agree on specs before work begins.
|
|
43
|
+
- Structured change folders (proposals, tasks, and spec updates) keep scope explicit and auditable.
|
|
44
|
+
- Shared visibility into what's proposed, active, or archived.
|
|
45
|
+
- Works with the AI tools you already use: custom slash commands where supported, context rules everywhere else.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm install -g openspec-cn
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## How OpenSpec compares (at a glance)
|
|
54
|
+
|
|
55
|
+
- **Lightweight**: simple workflow, no API keys, minimal setup.
|
|
56
|
+
- **Brownfield-first**: works great beyond 0→1. OpenSpec separates the source of truth from proposals: `openspec/specs/` (current truth) and `openspec/changes/` (proposed updates). This keeps diffs explicit and manageable across features.
|
|
57
|
+
- **Change tracking**: proposals, tasks, and spec deltas live together; archiving merges the approved updates back into specs.
|
|
58
|
+
- **Compared to spec-kit & Kiro**: those shine for brand-new features (0→1). OpenSpec also excels when modifying existing behavior (1→n), especially when updates span multiple specs.
|
|
59
|
+
|
|
60
|
+
See the full comparison in [How OpenSpec Compares](#how-openspec-compares).
|
|
61
|
+
|
|
62
|
+
## How It Works
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
┌────────────────────┐
|
|
66
|
+
│ Draft Change │
|
|
67
|
+
│ Proposal │
|
|
68
|
+
└────────┬───────────┘
|
|
69
|
+
│ share intent with your AI
|
|
70
|
+
▼
|
|
71
|
+
┌────────────────────┐
|
|
72
|
+
│ Review & Align │
|
|
73
|
+
│ (edit specs/tasks) │◀──── feedback loop ──────┐
|
|
74
|
+
└────────┬───────────┘ │
|
|
75
|
+
│ approved plan │
|
|
76
|
+
▼ │
|
|
77
|
+
┌────────────────────┐ │
|
|
78
|
+
│ Implement Tasks │──────────────────────────┘
|
|
79
|
+
│ (AI writes code) │
|
|
80
|
+
└────────┬───────────┘
|
|
81
|
+
│ ship the change
|
|
82
|
+
▼
|
|
83
|
+
┌────────────────────┐
|
|
84
|
+
│ Archive & Update │
|
|
85
|
+
│ Specs (source) │
|
|
86
|
+
└────────────────────┘
|
|
87
|
+
|
|
88
|
+
1. Draft a change proposal that captures the spec updates you want.
|
|
89
|
+
2. Review the proposal with your AI assistant until everyone agrees.
|
|
90
|
+
3. Implement tasks that reference the agreed specs.
|
|
91
|
+
4. Archive the change to merge the approved updates back into the source-of-truth specs.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Getting Started
|
|
95
|
+
|
|
96
|
+
### Supported AI Tools
|
|
97
|
+
|
|
98
|
+
<details>
|
|
99
|
+
<summary><strong>Native Slash Commands</strong> (click to expand)</summary>
|
|
100
|
+
|
|
101
|
+
These tools have built-in OpenSpec commands. Select the OpenSpec integration when prompted.
|
|
102
|
+
|
|
103
|
+
| Tool | Commands |
|
|
104
|
+
|------|----------|
|
|
105
|
+
| **Amazon Q Developer** | `@openspec-proposal`, `@openspec-apply`, `@openspec-archive` (`.amazonq/prompts/`) |
|
|
106
|
+
| **Antigravity** | `/openspec-proposal`, `/openspec-apply`, `/openspec-archive` (`.agent/workflows/`) |
|
|
107
|
+
| **Claude Code** | `/opsx:new`, `/opsx:continue`, `/opsx:apply` (`.claude/commands/`) |
|
|
108
|
+
| **Cursor** | `/opsx:new`, `/opsx:continue`, `/opsx:apply` (`.cursor/commands/`) |
|
|
109
|
+
| **Windsurf** | `/opsx:new`, `/opsx:continue`, `/opsx:apply` (`.windsurf/commands/`) |
|
|
110
|
+
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
<details>
|
|
114
|
+
<summary><strong>Context Rules</strong> (click to expand)</summary>
|
|
115
|
+
|
|
116
|
+
For tools without custom commands, use OpenSpec via context rules. Copy the appropriate rules from [docs/context-rules/](docs/context-rules/) into your project's rule file (e.g., `.cursorrules`, `.clinerules`).
|
|
117
|
+
|
|
118
|
+
</details>
|
|
119
|
+
|
|
120
|
+
### Quick Start
|
|
121
|
+
|
|
122
|
+
1. Initialize OpenSpec in your project:
|
|
123
|
+
```bash
|
|
124
|
+
openspec init
|
|
125
|
+
```
|
|
126
|
+
2. Start a new change:
|
|
127
|
+
```bash
|
|
128
|
+
openspec change new "my-feature"
|
|
129
|
+
```
|
|
130
|
+
*This creates `openspec/changes/my-feature/proposal.md`*
|
|
131
|
+
3. Collaborate with your AI to refine the specs and tasks.
|
|
132
|
+
4. Implement the change:
|
|
133
|
+
```bash
|
|
134
|
+
openspec change apply "my-feature"
|
|
135
|
+
```
|
|
136
|
+
5. Archive when done:
|
|
137
|
+
```bash
|
|
138
|
+
openspec change archive "my-feature"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Documentation
|
|
142
|
+
|
|
143
|
+
Full documentation is available at [openspec.dev](https://openspec.dev) (TBD).
|
|
144
|
+
|
|
145
|
+
- [Core Concepts](docs/core-concepts.md)
|
|
146
|
+
- [Workflow Guide](docs/workflow.md)
|
|
147
|
+
- [Experimental Artifact Workflow](docs/experimental-workflow.md)
|
|
148
|
+
- [Configuration](docs/configuration.md)
|
|
149
|
+
- [Troubleshooting](docs/troubleshooting.md)
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT
|
package/bin/openspec.js
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { createRequire } from 'module';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { promises as fs } from 'fs';
|
|
6
|
+
import { AI_TOOLS } from '../core/config.js';
|
|
7
|
+
import { UpdateCommand } from '../core/update.js';
|
|
8
|
+
import { ListCommand } from '../core/list.js';
|
|
9
|
+
import { ArchiveCommand } from '../core/archive.js';
|
|
10
|
+
import { ViewCommand } from '../core/view.js';
|
|
11
|
+
import { registerSpecCommand } from '../commands/spec.js';
|
|
12
|
+
import { ChangeCommand } from '../commands/change.js';
|
|
13
|
+
import { ValidateCommand } from '../commands/validate.js';
|
|
14
|
+
import { ShowCommand } from '../commands/show.js';
|
|
15
|
+
import { CompletionCommand } from '../commands/completion.js';
|
|
16
|
+
import { FeedbackCommand } from '../commands/feedback.js';
|
|
17
|
+
import { registerConfigCommand } from '../commands/config.js';
|
|
18
|
+
import { registerSchemaCommand } from '../commands/schema.js';
|
|
19
|
+
import { statusCommand, instructionsCommand, applyInstructionsCommand, templatesCommand, schemasCommand, newChangeCommand, DEFAULT_SCHEMA, } from '../commands/workflow/index.js';
|
|
20
|
+
import { maybeShowTelemetryNotice, trackCommand, shutdown } from '../telemetry/index.js';
|
|
21
|
+
const program = new Command();
|
|
22
|
+
const require = createRequire(import.meta.url);
|
|
23
|
+
const { version } = require('../../package.json');
|
|
24
|
+
/**
|
|
25
|
+
* Get the full command path for nested commands.
|
|
26
|
+
* For example: 'change show' -> 'change:show'
|
|
27
|
+
*/
|
|
28
|
+
function getCommandPath(command) {
|
|
29
|
+
const names = [];
|
|
30
|
+
let current = command;
|
|
31
|
+
while (current) {
|
|
32
|
+
const name = current.name();
|
|
33
|
+
// Skip the root 'openspec' command
|
|
34
|
+
if (name && name !== 'openspec') {
|
|
35
|
+
names.unshift(name);
|
|
36
|
+
}
|
|
37
|
+
current = current.parent;
|
|
38
|
+
}
|
|
39
|
+
return names.join(':') || 'openspec';
|
|
40
|
+
}
|
|
41
|
+
program
|
|
42
|
+
.name('openspec')
|
|
43
|
+
.description('AI-native system for spec-driven development')
|
|
44
|
+
.version(version);
|
|
45
|
+
// Global options
|
|
46
|
+
program.option('--no-color', 'Disable color output');
|
|
47
|
+
// Apply global flags and telemetry before any command runs
|
|
48
|
+
// Note: preAction receives (thisCommand, actionCommand) where:
|
|
49
|
+
// - thisCommand: the command where hook was added (root program)
|
|
50
|
+
// - actionCommand: the command actually being executed (subcommand)
|
|
51
|
+
program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
52
|
+
const opts = thisCommand.opts();
|
|
53
|
+
if (opts.color === false) {
|
|
54
|
+
process.env.NO_COLOR = '1';
|
|
55
|
+
}
|
|
56
|
+
// Show first-run telemetry notice (if not seen)
|
|
57
|
+
await maybeShowTelemetryNotice();
|
|
58
|
+
// Track command execution (use actionCommand to get the actual subcommand)
|
|
59
|
+
const commandPath = getCommandPath(actionCommand);
|
|
60
|
+
await trackCommand(commandPath, version);
|
|
61
|
+
});
|
|
62
|
+
// Shutdown telemetry after command completes
|
|
63
|
+
program.hook('postAction', async () => {
|
|
64
|
+
await shutdown();
|
|
65
|
+
});
|
|
66
|
+
const availableToolIds = AI_TOOLS.filter((tool) => tool.skillsDir).map((tool) => tool.value);
|
|
67
|
+
const toolsOptionDescription = `Configure AI tools non-interactively. Use "all", "none", or a comma-separated list of: ${availableToolIds.join(', ')}`;
|
|
68
|
+
program
|
|
69
|
+
.command('init [path]')
|
|
70
|
+
.description('Initialize OpenSpec in your project')
|
|
71
|
+
.option('--tools <tools>', toolsOptionDescription)
|
|
72
|
+
.option('--force', 'Auto-cleanup legacy files without prompting')
|
|
73
|
+
.action(async (targetPath = '.', options) => {
|
|
74
|
+
try {
|
|
75
|
+
// Validate that the path is a valid directory
|
|
76
|
+
const resolvedPath = path.resolve(targetPath);
|
|
77
|
+
try {
|
|
78
|
+
const stats = await fs.stat(resolvedPath);
|
|
79
|
+
if (!stats.isDirectory()) {
|
|
80
|
+
throw new Error(`Path "${targetPath}" is not a directory`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
if (error.code === 'ENOENT') {
|
|
85
|
+
// Directory doesn't exist, but we can create it
|
|
86
|
+
console.log(`Directory "${targetPath}" doesn't exist, it will be created.`);
|
|
87
|
+
}
|
|
88
|
+
else if (error.message && error.message.includes('not a directory')) {
|
|
89
|
+
throw error;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
throw new Error(`Cannot access path "${targetPath}": ${error.message}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const { InitCommand } = await import('../core/init.js');
|
|
96
|
+
const initCommand = new InitCommand({
|
|
97
|
+
tools: options?.tools,
|
|
98
|
+
force: options?.force,
|
|
99
|
+
});
|
|
100
|
+
await initCommand.execute(targetPath);
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
console.log(); // Empty line for spacing
|
|
104
|
+
ora().fail(`Error: ${error.message}`);
|
|
105
|
+
process.exit(1);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
// Hidden alias: 'experimental' -> 'init' for backwards compatibility
|
|
109
|
+
program
|
|
110
|
+
.command('experimental', { hidden: true })
|
|
111
|
+
.description('Alias for init (deprecated)')
|
|
112
|
+
.option('--tool <tool-id>', 'Target AI tool (maps to --tools)')
|
|
113
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
114
|
+
.action(async (options) => {
|
|
115
|
+
try {
|
|
116
|
+
console.log('Note: "openspec experimental" is deprecated. Use "openspec init" instead.');
|
|
117
|
+
const { InitCommand } = await import('../core/init.js');
|
|
118
|
+
const initCommand = new InitCommand({
|
|
119
|
+
tools: options?.tool,
|
|
120
|
+
interactive: options?.noInteractive === true ? false : undefined,
|
|
121
|
+
});
|
|
122
|
+
await initCommand.execute('.');
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
console.log();
|
|
126
|
+
ora().fail(`Error: ${error.message}`);
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
program
|
|
131
|
+
.command('update [path]')
|
|
132
|
+
.description('Update OpenSpec instruction files')
|
|
133
|
+
.option('--force', 'Force update even when tools are up to date')
|
|
134
|
+
.action(async (targetPath = '.', options) => {
|
|
135
|
+
try {
|
|
136
|
+
const resolvedPath = path.resolve(targetPath);
|
|
137
|
+
const updateCommand = new UpdateCommand({ force: options?.force });
|
|
138
|
+
await updateCommand.execute(resolvedPath);
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
console.log(); // Empty line for spacing
|
|
142
|
+
ora().fail(`Error: ${error.message}`);
|
|
143
|
+
process.exit(1);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
program
|
|
147
|
+
.command('list')
|
|
148
|
+
.description('List items (changes by default). Use --specs to list specs.')
|
|
149
|
+
.option('--specs', 'List specs instead of changes')
|
|
150
|
+
.option('--changes', 'List changes explicitly (default)')
|
|
151
|
+
.option('--sort <order>', 'Sort order: "recent" (default) or "name"', 'recent')
|
|
152
|
+
.option('--json', 'Output as JSON (for programmatic use)')
|
|
153
|
+
.action(async (options) => {
|
|
154
|
+
try {
|
|
155
|
+
const listCommand = new ListCommand();
|
|
156
|
+
const mode = options?.specs ? 'specs' : 'changes';
|
|
157
|
+
const sort = options?.sort === 'name' ? 'name' : 'recent';
|
|
158
|
+
await listCommand.execute('.', mode, { sort, json: options?.json });
|
|
159
|
+
}
|
|
160
|
+
catch (error) {
|
|
161
|
+
console.log(); // Empty line for spacing
|
|
162
|
+
ora().fail(`Error: ${error.message}`);
|
|
163
|
+
process.exit(1);
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
program
|
|
167
|
+
.command('view')
|
|
168
|
+
.description('Display an interactive dashboard of specs and changes')
|
|
169
|
+
.action(async () => {
|
|
170
|
+
try {
|
|
171
|
+
const viewCommand = new ViewCommand();
|
|
172
|
+
await viewCommand.execute('.');
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
console.log(); // Empty line for spacing
|
|
176
|
+
ora().fail(`Error: ${error.message}`);
|
|
177
|
+
process.exit(1);
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
// Change command with subcommands
|
|
181
|
+
const changeCmd = program
|
|
182
|
+
.command('change')
|
|
183
|
+
.description('Manage OpenSpec change proposals');
|
|
184
|
+
// Deprecation notice for noun-based commands
|
|
185
|
+
changeCmd.hook('preAction', () => {
|
|
186
|
+
console.error('Warning: The "openspec change ..." commands are deprecated. Prefer verb-first commands (e.g., "openspec list", "openspec validate --changes").');
|
|
187
|
+
});
|
|
188
|
+
changeCmd
|
|
189
|
+
.command('show [change-name]')
|
|
190
|
+
.description('Show a change proposal in JSON or markdown format')
|
|
191
|
+
.option('--json', 'Output as JSON')
|
|
192
|
+
.option('--deltas-only', 'Show only deltas (JSON only)')
|
|
193
|
+
.option('--requirements-only', 'Alias for --deltas-only (deprecated)')
|
|
194
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
195
|
+
.action(async (changeName, options) => {
|
|
196
|
+
try {
|
|
197
|
+
const changeCommand = new ChangeCommand();
|
|
198
|
+
await changeCommand.show(changeName, options);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
console.error(`Error: ${error.message}`);
|
|
202
|
+
process.exitCode = 1;
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
changeCmd
|
|
206
|
+
.command('list')
|
|
207
|
+
.description('List all active changes (DEPRECATED: use "openspec list" instead)')
|
|
208
|
+
.option('--json', 'Output as JSON')
|
|
209
|
+
.option('--long', 'Show id and title with counts')
|
|
210
|
+
.action(async (options) => {
|
|
211
|
+
try {
|
|
212
|
+
console.error('Warning: "openspec change list" is deprecated. Use "openspec list".');
|
|
213
|
+
const changeCommand = new ChangeCommand();
|
|
214
|
+
await changeCommand.list(options);
|
|
215
|
+
}
|
|
216
|
+
catch (error) {
|
|
217
|
+
console.error(`Error: ${error.message}`);
|
|
218
|
+
process.exitCode = 1;
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
changeCmd
|
|
222
|
+
.command('validate [change-name]')
|
|
223
|
+
.description('Validate a change proposal')
|
|
224
|
+
.option('--strict', 'Enable strict validation mode')
|
|
225
|
+
.option('--json', 'Output validation report as JSON')
|
|
226
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
227
|
+
.action(async (changeName, options) => {
|
|
228
|
+
try {
|
|
229
|
+
const changeCommand = new ChangeCommand();
|
|
230
|
+
await changeCommand.validate(changeName, options);
|
|
231
|
+
if (typeof process.exitCode === 'number' && process.exitCode !== 0) {
|
|
232
|
+
process.exit(process.exitCode);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
catch (error) {
|
|
236
|
+
console.error(`Error: ${error.message}`);
|
|
237
|
+
process.exitCode = 1;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
program
|
|
241
|
+
.command('archive [change-name]')
|
|
242
|
+
.description('Archive a completed change and update main specs')
|
|
243
|
+
.option('-y, --yes', 'Skip confirmation prompts')
|
|
244
|
+
.option('--skip-specs', 'Skip spec update operations (useful for infrastructure, tooling, or doc-only changes)')
|
|
245
|
+
.option('--no-validate', 'Skip validation (not recommended, requires confirmation)')
|
|
246
|
+
.action(async (changeName, options) => {
|
|
247
|
+
try {
|
|
248
|
+
const archiveCommand = new ArchiveCommand();
|
|
249
|
+
await archiveCommand.execute(changeName, options);
|
|
250
|
+
}
|
|
251
|
+
catch (error) {
|
|
252
|
+
console.log(); // Empty line for spacing
|
|
253
|
+
ora().fail(`Error: ${error.message}`);
|
|
254
|
+
process.exit(1);
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
registerSpecCommand(program);
|
|
258
|
+
registerConfigCommand(program);
|
|
259
|
+
registerSchemaCommand(program);
|
|
260
|
+
// Top-level validate command
|
|
261
|
+
program
|
|
262
|
+
.command('validate [item-name]')
|
|
263
|
+
.description('Validate changes and specs')
|
|
264
|
+
.option('--all', 'Validate all changes and specs')
|
|
265
|
+
.option('--changes', 'Validate all changes')
|
|
266
|
+
.option('--specs', 'Validate all specs')
|
|
267
|
+
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
|
|
268
|
+
.option('--strict', 'Enable strict validation mode')
|
|
269
|
+
.option('--json', 'Output validation results as JSON')
|
|
270
|
+
.option('--concurrency <n>', 'Max concurrent validations (defaults to env OPENSPEC_CONCURRENCY or 6)')
|
|
271
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
272
|
+
.action(async (itemName, options) => {
|
|
273
|
+
try {
|
|
274
|
+
const validateCommand = new ValidateCommand();
|
|
275
|
+
await validateCommand.execute(itemName, options);
|
|
276
|
+
}
|
|
277
|
+
catch (error) {
|
|
278
|
+
console.log();
|
|
279
|
+
ora().fail(`Error: ${error.message}`);
|
|
280
|
+
process.exit(1);
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
// Top-level show command
|
|
284
|
+
program
|
|
285
|
+
.command('show [item-name]')
|
|
286
|
+
.description('Show a change or spec')
|
|
287
|
+
.option('--json', 'Output as JSON')
|
|
288
|
+
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
|
|
289
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
290
|
+
// change-only flags
|
|
291
|
+
.option('--deltas-only', 'Show only deltas (JSON only, change)')
|
|
292
|
+
.option('--requirements-only', 'Alias for --deltas-only (deprecated, change)')
|
|
293
|
+
// spec-only flags
|
|
294
|
+
.option('--requirements', 'JSON only: Show only requirements (exclude scenarios)')
|
|
295
|
+
.option('--no-scenarios', 'JSON only: Exclude scenario content')
|
|
296
|
+
.option('-r, --requirement <id>', 'JSON only: Show specific requirement by ID (1-based)')
|
|
297
|
+
// allow unknown options to pass-through to underlying command implementation
|
|
298
|
+
.allowUnknownOption(true)
|
|
299
|
+
.action(async (itemName, options) => {
|
|
300
|
+
try {
|
|
301
|
+
const showCommand = new ShowCommand();
|
|
302
|
+
await showCommand.execute(itemName, options ?? {});
|
|
303
|
+
}
|
|
304
|
+
catch (error) {
|
|
305
|
+
console.log();
|
|
306
|
+
ora().fail(`Error: ${error.message}`);
|
|
307
|
+
process.exit(1);
|
|
308
|
+
}
|
|
309
|
+
});
|
|
310
|
+
// Feedback command
|
|
311
|
+
program
|
|
312
|
+
.command('feedback <message>')
|
|
313
|
+
.description('Submit feedback about OpenSpec')
|
|
314
|
+
.option('--body <text>', 'Detailed description for the feedback')
|
|
315
|
+
.action(async (message, options) => {
|
|
316
|
+
try {
|
|
317
|
+
const feedbackCommand = new FeedbackCommand();
|
|
318
|
+
await feedbackCommand.execute(message, options);
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
console.log();
|
|
322
|
+
ora().fail(`Error: ${error.message}`);
|
|
323
|
+
process.exit(1);
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
// Completion command with subcommands
|
|
327
|
+
const completionCmd = program
|
|
328
|
+
.command('completion')
|
|
329
|
+
.description('Manage shell completions for OpenSpec CLI');
|
|
330
|
+
completionCmd
|
|
331
|
+
.command('generate [shell]')
|
|
332
|
+
.description('Generate completion script for a shell (outputs to stdout)')
|
|
333
|
+
.action(async (shell) => {
|
|
334
|
+
try {
|
|
335
|
+
const completionCommand = new CompletionCommand();
|
|
336
|
+
await completionCommand.generate({ shell });
|
|
337
|
+
}
|
|
338
|
+
catch (error) {
|
|
339
|
+
console.log();
|
|
340
|
+
ora().fail(`Error: ${error.message}`);
|
|
341
|
+
process.exit(1);
|
|
342
|
+
}
|
|
343
|
+
});
|
|
344
|
+
completionCmd
|
|
345
|
+
.command('install [shell]')
|
|
346
|
+
.description('Install completion script for a shell')
|
|
347
|
+
.option('--verbose', 'Show detailed installation output')
|
|
348
|
+
.action(async (shell, options) => {
|
|
349
|
+
try {
|
|
350
|
+
const completionCommand = new CompletionCommand();
|
|
351
|
+
await completionCommand.install({ shell, verbose: options?.verbose });
|
|
352
|
+
}
|
|
353
|
+
catch (error) {
|
|
354
|
+
console.log();
|
|
355
|
+
ora().fail(`Error: ${error.message}`);
|
|
356
|
+
process.exit(1);
|
|
357
|
+
}
|
|
358
|
+
});
|
|
359
|
+
completionCmd
|
|
360
|
+
.command('uninstall [shell]')
|
|
361
|
+
.description('Uninstall completion script for a shell')
|
|
362
|
+
.option('-y, --yes', 'Skip confirmation prompts')
|
|
363
|
+
.action(async (shell, options) => {
|
|
364
|
+
try {
|
|
365
|
+
const completionCommand = new CompletionCommand();
|
|
366
|
+
await completionCommand.uninstall({ shell, yes: options?.yes });
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
console.log();
|
|
370
|
+
ora().fail(`Error: ${error.message}`);
|
|
371
|
+
process.exit(1);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
// Hidden command for machine-readable completion data
|
|
375
|
+
program
|
|
376
|
+
.command('__complete <type>', { hidden: true })
|
|
377
|
+
.description('Output completion data in machine-readable format (internal use)')
|
|
378
|
+
.action(async (type) => {
|
|
379
|
+
try {
|
|
380
|
+
const completionCommand = new CompletionCommand();
|
|
381
|
+
await completionCommand.complete({ type });
|
|
382
|
+
}
|
|
383
|
+
catch (error) {
|
|
384
|
+
// Silently fail for graceful shell completion experience
|
|
385
|
+
process.exitCode = 1;
|
|
386
|
+
}
|
|
387
|
+
});
|
|
388
|
+
// ═══════════════════════════════════════════════════════════
|
|
389
|
+
// Workflow Commands (formerly experimental)
|
|
390
|
+
// ═══════════════════════════════════════════════════════════
|
|
391
|
+
// Status command
|
|
392
|
+
program
|
|
393
|
+
.command('status')
|
|
394
|
+
.description('Display artifact completion status for a change')
|
|
395
|
+
.option('--change <id>', 'Change name to show status for')
|
|
396
|
+
.option('--schema <name>', 'Schema override (auto-detected from config.yaml)')
|
|
397
|
+
.option('--json', 'Output as JSON')
|
|
398
|
+
.action(async (options) => {
|
|
399
|
+
try {
|
|
400
|
+
await statusCommand(options);
|
|
401
|
+
}
|
|
402
|
+
catch (error) {
|
|
403
|
+
console.log();
|
|
404
|
+
ora().fail(`Error: ${error.message}`);
|
|
405
|
+
process.exit(1);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
// Instructions command
|
|
409
|
+
program
|
|
410
|
+
.command('instructions [artifact]')
|
|
411
|
+
.description('Output enriched instructions for creating an artifact or applying tasks')
|
|
412
|
+
.option('--change <id>', 'Change name')
|
|
413
|
+
.option('--schema <name>', 'Schema override (auto-detected from config.yaml)')
|
|
414
|
+
.option('--json', 'Output as JSON')
|
|
415
|
+
.action(async (artifactId, options) => {
|
|
416
|
+
try {
|
|
417
|
+
// Special case: "apply" is not an artifact, but a command to get apply instructions
|
|
418
|
+
if (artifactId === 'apply') {
|
|
419
|
+
await applyInstructionsCommand(options);
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
await instructionsCommand(artifactId, options);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
catch (error) {
|
|
426
|
+
console.log();
|
|
427
|
+
ora().fail(`Error: ${error.message}`);
|
|
428
|
+
process.exit(1);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
// Templates command
|
|
432
|
+
program
|
|
433
|
+
.command('templates')
|
|
434
|
+
.description('Show resolved template paths for all artifacts in a schema')
|
|
435
|
+
.option('--schema <name>', `Schema to use (default: ${DEFAULT_SCHEMA})`)
|
|
436
|
+
.option('--json', 'Output as JSON mapping artifact IDs to template paths')
|
|
437
|
+
.action(async (options) => {
|
|
438
|
+
try {
|
|
439
|
+
await templatesCommand(options);
|
|
440
|
+
}
|
|
441
|
+
catch (error) {
|
|
442
|
+
console.log();
|
|
443
|
+
ora().fail(`Error: ${error.message}`);
|
|
444
|
+
process.exit(1);
|
|
445
|
+
}
|
|
446
|
+
});
|
|
447
|
+
// Schemas command
|
|
448
|
+
program
|
|
449
|
+
.command('schemas')
|
|
450
|
+
.description('List available workflow schemas with descriptions')
|
|
451
|
+
.option('--json', 'Output as JSON (for agent use)')
|
|
452
|
+
.action(async (options) => {
|
|
453
|
+
try {
|
|
454
|
+
await schemasCommand(options);
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
console.log();
|
|
458
|
+
ora().fail(`Error: ${error.message}`);
|
|
459
|
+
process.exit(1);
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
// New command group with change subcommand
|
|
463
|
+
const newCmd = program.command('new').description('Create new items');
|
|
464
|
+
newCmd
|
|
465
|
+
.command('change <name>')
|
|
466
|
+
.description('Create a new change directory')
|
|
467
|
+
.option('--description <text>', 'Description to add to README.md')
|
|
468
|
+
.option('--schema <name>', `Workflow schema to use (default: ${DEFAULT_SCHEMA})`)
|
|
469
|
+
.action(async (name, options) => {
|
|
470
|
+
try {
|
|
471
|
+
await newChangeCommand(name, options);
|
|
472
|
+
}
|
|
473
|
+
catch (error) {
|
|
474
|
+
console.log();
|
|
475
|
+
ora().fail(`Error: ${error.message}`);
|
|
476
|
+
process.exit(1);
|
|
477
|
+
}
|
|
478
|
+
});
|
|
479
|
+
program.parse();
|
|
480
|
+
//# sourceMappingURL=index.js.map
|