@dynamicworks/br-openspec 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +210 -0
- package/README.pt-BR.md +212 -0
- package/bin/openspec.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +484 -0
- package/dist/commands/change.d.ts +35 -0
- package/dist/commands/change.js +278 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +258 -0
- package/dist/commands/config.d.ts +36 -0
- package/dist/commands/config.js +553 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +184 -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 +133 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +226 -0
- package/dist/commands/tools.d.ts +11 -0
- package/dist/commands/tools.js +252 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +295 -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 +328 -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 +35 -0
- package/dist/commands/workflow/shared.d.ts +57 -0
- package/dist/commands/workflow/shared.js +117 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +76 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +70 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +322 -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 +8 -0
- package/dist/core/artifact-graph/index.js +14 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
- package/dist/core/artifact-graph/instruction-loader.js +217 -0
- package/dist/core/artifact-graph/outputs.d.ts +14 -0
- package/dist/core/artifact-graph/outputs.js +39 -0
- package/dist/core/artifact-graph/resolver.d.ts +81 -0
- package/dist/core/artifact-graph/resolver.js +258 -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 +31 -0
- package/dist/core/artifact-graph/types.d.ts +45 -0
- package/dist/core/artifact-graph/types.js +43 -0
- package/dist/core/available-tools.d.ts +17 -0
- package/dist/core/available-tools.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/bob.d.ts +14 -0
- package/dist/core/command-generation/adapters/bob.js +45 -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 +16 -0
- package/dist/core/command-generation/adapters/codex.js +39 -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 +32 -0
- package/dist/core/command-generation/adapters/index.js +32 -0
- package/dist/core/command-generation/adapters/junie.d.ts +13 -0
- package/dist/core/command-generation/adapters/junie.js +26 -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/kiro.d.ts +13 -0
- package/dist/core/command-generation/adapters/kiro.js +26 -0
- package/dist/core/command-generation/adapters/lingma.d.ts +13 -0
- package/dist/core/command-generation/adapters/lingma.js +30 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +29 -0
- package/dist/core/command-generation/adapters/pi.d.ts +18 -0
- package/dist/core/command-generation/adapters/pi.js +55 -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 +98 -0
- package/dist/core/command-generation/types.d.ts +56 -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 +462 -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 +208 -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 +319 -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 +102 -0
- package/dist/core/completions/installers/powershell-installer.js +400 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
- package/dist/core/completions/installers/zsh-installer.js +450 -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 +86 -0
- package/dist/core/config-schema.js +213 -0
- package/dist/core/config.d.ts +18 -0
- package/dist/core/config.js +38 -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 +44 -0
- package/dist/core/global-config.js +125 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/init.d.ts +37 -0
- package/dist/core/init.js +549 -0
- package/dist/core/is-project-initialized.d.ts +12 -0
- package/dist/core/is-project-initialized.js +18 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +515 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +172 -0
- package/dist/core/migration.d.ts +23 -0
- package/dist/core/migration.js +109 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +197 -0
- package/dist/core/parsers/markdown-parser.d.ts +26 -0
- package/dist/core/parsers/markdown-parser.js +228 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/parsers/spec-structure.d.ts +9 -0
- package/dist/core/parsers/spec-structure.js +88 -0
- package/dist/core/profile-sync-drift.d.ts +38 -0
- package/dist/core/profile-sync-drift.js +200 -0
- package/dist/core/profiles.d.ts +26 -0
- package/dist/core/profiles.js +40 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +224 -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 +49 -0
- package/dist/core/shared/skill-generation.js +96 -0
- package/dist/core/shared/tool-detection.d.ts +71 -0
- package/dist/core/shared/tool-detection.js +158 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +393 -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 +20 -0
- package/dist/core/templates/skill-templates.js +19 -0
- package/dist/core/templates/types.d.ts +19 -0
- package/dist/core/templates/types.js +5 -0
- package/dist/core/templates/workflows/apply-change.d.ts +10 -0
- package/dist/core/templates/workflows/apply-change.js +308 -0
- package/dist/core/templates/workflows/archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/archive-change.js +271 -0
- package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/bulk-archive-change.js +492 -0
- package/dist/core/templates/workflows/continue-change.d.ts +10 -0
- package/dist/core/templates/workflows/continue-change.js +232 -0
- package/dist/core/templates/workflows/explore.d.ts +10 -0
- package/dist/core/templates/workflows/explore.js +463 -0
- package/dist/core/templates/workflows/feedback.d.ts +9 -0
- package/dist/core/templates/workflows/feedback.js +108 -0
- package/dist/core/templates/workflows/ff-change.d.ts +10 -0
- package/dist/core/templates/workflows/ff-change.js +198 -0
- package/dist/core/templates/workflows/new-change.d.ts +10 -0
- package/dist/core/templates/workflows/new-change.js +21 -0
- package/dist/core/templates/workflows/onboard.d.ts +10 -0
- package/dist/core/templates/workflows/onboard.js +21 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +216 -0
- package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
- package/dist/core/templates/workflows/sync-specs.js +272 -0
- package/dist/core/templates/workflows/upstream-sync.d.ts +10 -0
- package/dist/core/templates/workflows/upstream-sync.js +116 -0
- package/dist/core/templates/workflows/verify-change.d.ts +10 -0
- package/dist/core/templates/workflows/verify-change.js +21 -0
- package/dist/core/tools-manager.d.ts +56 -0
- package/dist/core/tools-manager.js +215 -0
- package/dist/core/update.d.ts +77 -0
- package/dist/core/update.js +538 -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 +419 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +169 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/messages/index.d.ts +867 -0
- package/dist/messages/index.js +1960 -0
- package/dist/prompts/searchable-multi-select.d.ts +28 -0
- package/dist/prompts/searchable-multi-select.js +160 -0
- package/dist/telemetry/config.d.ts +38 -0
- package/dist/telemetry/config.js +136 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +165 -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 +147 -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/command-references.d.ts +18 -0
- package/dist/utils/command-references.js +20 -0
- package/dist/utils/file-system.d.ts +41 -0
- package/dist/utils/file-system.js +302 -0
- package/dist/utils/index.d.ts +6 -0
- package/dist/utils/index.js +9 -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 +37 -0
- package/package.json +84 -0
- package/schemas/spec-driven/schema.yaml +153 -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/scripts/postinstall.js +83 -0
|
@@ -0,0 +1,484 @@
|
|
|
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 { CLI_DESCRIPTIONS, CLI_MESSAGES, CONFIG_MESSAGES } from '../messages/index.js';
|
|
8
|
+
import { UpdateCommand } from '../core/update.js';
|
|
9
|
+
import { ListCommand } from '../core/list.js';
|
|
10
|
+
import { ArchiveCommand } from '../core/archive.js';
|
|
11
|
+
import { ViewCommand } from '../core/view.js';
|
|
12
|
+
import { registerSpecCommand } from '../commands/spec.js';
|
|
13
|
+
import { ChangeCommand } from '../commands/change.js';
|
|
14
|
+
import { ValidateCommand } from '../commands/validate.js';
|
|
15
|
+
import { ShowCommand } from '../commands/show.js';
|
|
16
|
+
import { CompletionCommand } from '../commands/completion.js';
|
|
17
|
+
import { FeedbackCommand } from '../commands/feedback.js';
|
|
18
|
+
import { registerConfigCommand } from '../commands/config.js';
|
|
19
|
+
import { registerSchemaCommand } from '../commands/schema.js';
|
|
20
|
+
import { registerToolsCommand } from '../commands/tools.js';
|
|
21
|
+
import { statusCommand, instructionsCommand, applyInstructionsCommand, templatesCommand, schemasCommand, newChangeCommand, DEFAULT_SCHEMA, } from '../commands/workflow/index.js';
|
|
22
|
+
import { maybeShowTelemetryNotice, trackCommand, shutdown } from '../telemetry/index.js';
|
|
23
|
+
const program = new Command();
|
|
24
|
+
const require = createRequire(import.meta.url);
|
|
25
|
+
const { version } = require('../../package.json');
|
|
26
|
+
/**
|
|
27
|
+
* Get the full command path for nested commands.
|
|
28
|
+
* For example: 'change show' -> 'change:show'
|
|
29
|
+
*/
|
|
30
|
+
function getCommandPath(command) {
|
|
31
|
+
const names = [];
|
|
32
|
+
let current = command;
|
|
33
|
+
while (current) {
|
|
34
|
+
const name = current.name();
|
|
35
|
+
// Skip the root 'openspec' command
|
|
36
|
+
if (name && name !== 'openspec') {
|
|
37
|
+
names.unshift(name);
|
|
38
|
+
}
|
|
39
|
+
current = current.parent;
|
|
40
|
+
}
|
|
41
|
+
return names.join(':') || 'openspec';
|
|
42
|
+
}
|
|
43
|
+
program
|
|
44
|
+
.name('openspec')
|
|
45
|
+
.description(CLI_DESCRIPTIONS.root)
|
|
46
|
+
.version(version);
|
|
47
|
+
// Global options
|
|
48
|
+
program.option('--no-color', CLI_DESCRIPTIONS.noColor);
|
|
49
|
+
// Apply global flags and telemetry before any command runs
|
|
50
|
+
// Note: preAction receives (thisCommand, actionCommand) where:
|
|
51
|
+
// - thisCommand: the command where hook was added (root program)
|
|
52
|
+
// - actionCommand: the command actually being executed (subcommand)
|
|
53
|
+
program.hook('preAction', async (thisCommand, actionCommand) => {
|
|
54
|
+
const opts = thisCommand.opts();
|
|
55
|
+
if (opts.color === false) {
|
|
56
|
+
process.env.NO_COLOR = '1';
|
|
57
|
+
}
|
|
58
|
+
// Show first-run telemetry notice (if not seen)
|
|
59
|
+
await maybeShowTelemetryNotice();
|
|
60
|
+
// Track command execution (use actionCommand to get the actual subcommand)
|
|
61
|
+
const commandPath = getCommandPath(actionCommand);
|
|
62
|
+
await trackCommand(commandPath, version);
|
|
63
|
+
});
|
|
64
|
+
// Shutdown telemetry after command completes
|
|
65
|
+
program.hook('postAction', async () => {
|
|
66
|
+
await shutdown();
|
|
67
|
+
});
|
|
68
|
+
const availableToolIds = AI_TOOLS.filter((tool) => tool.skillsDir).map((tool) => tool.value);
|
|
69
|
+
program
|
|
70
|
+
.command('init [path]')
|
|
71
|
+
.description(CLI_DESCRIPTIONS.init)
|
|
72
|
+
.option('--tools <tools>', CLI_DESCRIPTIONS.tools(availableToolIds.join(', ')))
|
|
73
|
+
.option('--force', CLI_DESCRIPTIONS.force)
|
|
74
|
+
.option('--profile <profile>', CLI_DESCRIPTIONS.profile)
|
|
75
|
+
.action(async (targetPath = '.', options) => {
|
|
76
|
+
try {
|
|
77
|
+
// Validate that the path is a valid directory
|
|
78
|
+
const resolvedPath = path.resolve(targetPath);
|
|
79
|
+
try {
|
|
80
|
+
const stats = await fs.stat(resolvedPath);
|
|
81
|
+
if (!stats.isDirectory()) {
|
|
82
|
+
throw new Error(CLI_MESSAGES.notADirectory(targetPath));
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
if (error.code === 'ENOENT') {
|
|
87
|
+
// Directory doesn't exist, but we can create it
|
|
88
|
+
console.log(CLI_MESSAGES.directoryWillBeCreated(targetPath));
|
|
89
|
+
}
|
|
90
|
+
else if (error.message && error.message.includes('not a directory')) {
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
throw new Error(CLI_MESSAGES.cannotAccessPath(targetPath, error.message));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const { InitCommand } = await import('../core/init.js');
|
|
98
|
+
const initCommand = new InitCommand({
|
|
99
|
+
tools: options?.tools,
|
|
100
|
+
force: options?.force,
|
|
101
|
+
profile: options?.profile,
|
|
102
|
+
});
|
|
103
|
+
await initCommand.execute(targetPath);
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.log(); // Empty line for spacing
|
|
107
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// Hidden alias: 'experimental' -> 'init' for backwards compatibility
|
|
112
|
+
program
|
|
113
|
+
.command('experimental', { hidden: true })
|
|
114
|
+
.description(CLI_DESCRIPTIONS.experimental)
|
|
115
|
+
.option('--tool <tool-id>', CLI_DESCRIPTIONS.experimentalTool)
|
|
116
|
+
.option('--no-interactive', CLI_DESCRIPTIONS.experimentalNoInteractive)
|
|
117
|
+
.action(async (options) => {
|
|
118
|
+
try {
|
|
119
|
+
console.log(CLI_MESSAGES.experimentalDeprecated);
|
|
120
|
+
const { InitCommand } = await import('../core/init.js');
|
|
121
|
+
const initCommand = new InitCommand({
|
|
122
|
+
tools: options?.tool,
|
|
123
|
+
interactive: options?.noInteractive === true ? false : undefined,
|
|
124
|
+
});
|
|
125
|
+
await initCommand.execute('.');
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.log();
|
|
129
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
130
|
+
process.exit(1);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
program
|
|
134
|
+
.command('update [path]')
|
|
135
|
+
.description(CLI_DESCRIPTIONS.update)
|
|
136
|
+
.option('--force', CLI_DESCRIPTIONS.updateForce)
|
|
137
|
+
.action(async (targetPath = '.', options) => {
|
|
138
|
+
try {
|
|
139
|
+
const resolvedPath = path.resolve(targetPath);
|
|
140
|
+
const updateCommand = new UpdateCommand({ force: options?.force });
|
|
141
|
+
await updateCommand.execute(resolvedPath);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
console.log(); // Empty line for spacing
|
|
145
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
146
|
+
process.exit(1);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
program
|
|
150
|
+
.command('list')
|
|
151
|
+
.description(CLI_DESCRIPTIONS.list)
|
|
152
|
+
.option('--specs', CLI_DESCRIPTIONS.listSpecs)
|
|
153
|
+
.option('--changes', CLI_DESCRIPTIONS.listChanges)
|
|
154
|
+
.option('--sort <order>', CLI_DESCRIPTIONS.listSort, 'recent')
|
|
155
|
+
.option('--json', CLI_DESCRIPTIONS.listJson)
|
|
156
|
+
.action(async (options) => {
|
|
157
|
+
try {
|
|
158
|
+
const listCommand = new ListCommand();
|
|
159
|
+
const mode = options?.specs ? 'specs' : 'changes';
|
|
160
|
+
const sort = options?.sort === 'name' ? 'name' : 'recent';
|
|
161
|
+
await listCommand.execute('.', mode, { sort, json: options?.json });
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
console.log(); // Empty line for spacing
|
|
165
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
166
|
+
process.exit(1);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
program
|
|
170
|
+
.command('view')
|
|
171
|
+
.description(CLI_DESCRIPTIONS.view)
|
|
172
|
+
.action(async () => {
|
|
173
|
+
try {
|
|
174
|
+
const viewCommand = new ViewCommand();
|
|
175
|
+
await viewCommand.execute('.');
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
console.log(); // Empty line for spacing
|
|
179
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
180
|
+
process.exit(1);
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
// Change command with subcommands
|
|
184
|
+
const changeCmd = program
|
|
185
|
+
.command('change')
|
|
186
|
+
.description(CLI_DESCRIPTIONS.change);
|
|
187
|
+
// Deprecation notice for noun-based commands
|
|
188
|
+
changeCmd.hook('preAction', () => {
|
|
189
|
+
console.error(CLI_MESSAGES.changeCommandsDeprecated);
|
|
190
|
+
});
|
|
191
|
+
changeCmd
|
|
192
|
+
.command('show [change-name]')
|
|
193
|
+
.description(CLI_DESCRIPTIONS.changeShow)
|
|
194
|
+
.option('--json', CLI_DESCRIPTIONS.changeShowJson)
|
|
195
|
+
.option('--deltas-only', CLI_DESCRIPTIONS.changeShowDeltasOnly)
|
|
196
|
+
.option('--requirements-only', CLI_DESCRIPTIONS.changeShowRequirementsOnly)
|
|
197
|
+
.option('--no-interactive', CLI_DESCRIPTIONS.changeShowNoInteractive)
|
|
198
|
+
.action(async (changeName, options) => {
|
|
199
|
+
try {
|
|
200
|
+
const changeCommand = new ChangeCommand();
|
|
201
|
+
await changeCommand.show(changeName, options);
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
console.error(CLI_MESSAGES.error(error.message));
|
|
205
|
+
process.exitCode = 1;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
changeCmd
|
|
209
|
+
.command('list')
|
|
210
|
+
.description(CLI_DESCRIPTIONS.changeList)
|
|
211
|
+
.option('--json', CLI_DESCRIPTIONS.changeListJson)
|
|
212
|
+
.option('--long', CLI_DESCRIPTIONS.changeListLong)
|
|
213
|
+
.action(async (options) => {
|
|
214
|
+
try {
|
|
215
|
+
console.error(CLI_MESSAGES.changeListDeprecated);
|
|
216
|
+
const changeCommand = new ChangeCommand();
|
|
217
|
+
await changeCommand.list(options);
|
|
218
|
+
}
|
|
219
|
+
catch (error) {
|
|
220
|
+
console.error(CLI_MESSAGES.error(error.message));
|
|
221
|
+
process.exitCode = 1;
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
changeCmd
|
|
225
|
+
.command('validate [change-name]')
|
|
226
|
+
.description(CLI_DESCRIPTIONS.changeValidate)
|
|
227
|
+
.option('--strict', CLI_DESCRIPTIONS.changeValidateStrict)
|
|
228
|
+
.option('--json', CLI_DESCRIPTIONS.changeValidateJson)
|
|
229
|
+
.option('--no-interactive', CLI_DESCRIPTIONS.changeValidateNoInteractive)
|
|
230
|
+
.action(async (changeName, options) => {
|
|
231
|
+
try {
|
|
232
|
+
const changeCommand = new ChangeCommand();
|
|
233
|
+
await changeCommand.validate(changeName, options);
|
|
234
|
+
if (typeof process.exitCode === 'number' && process.exitCode !== 0) {
|
|
235
|
+
process.exit(process.exitCode);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
console.error(CLI_MESSAGES.error(error.message));
|
|
240
|
+
process.exitCode = 1;
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
program
|
|
244
|
+
.command('archive [change-name]')
|
|
245
|
+
.description(CLI_DESCRIPTIONS.archive)
|
|
246
|
+
.option('-y, --yes', CLI_DESCRIPTIONS.archiveYes)
|
|
247
|
+
.option('--skip-specs', CLI_DESCRIPTIONS.archiveSkipSpecs)
|
|
248
|
+
.option('--no-validate', CLI_DESCRIPTIONS.archiveNoValidate)
|
|
249
|
+
.action(async (changeName, options) => {
|
|
250
|
+
try {
|
|
251
|
+
const archiveCommand = new ArchiveCommand();
|
|
252
|
+
await archiveCommand.execute(changeName, options);
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.log(); // Empty line for spacing
|
|
256
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
257
|
+
process.exit(1);
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
registerSpecCommand(program);
|
|
261
|
+
registerConfigCommand(program);
|
|
262
|
+
registerSchemaCommand(program);
|
|
263
|
+
registerToolsCommand(program);
|
|
264
|
+
// Top-level validate command
|
|
265
|
+
program
|
|
266
|
+
.command('validate [item-name]')
|
|
267
|
+
.description(CLI_DESCRIPTIONS.validate)
|
|
268
|
+
.option('--all', CLI_DESCRIPTIONS.validateAll)
|
|
269
|
+
.option('--changes', CLI_DESCRIPTIONS.validateChanges)
|
|
270
|
+
.option('--specs', CLI_DESCRIPTIONS.validateSpecs)
|
|
271
|
+
.option('--type <type>', CLI_DESCRIPTIONS.validateType)
|
|
272
|
+
.option('--strict', CLI_DESCRIPTIONS.validateStrict)
|
|
273
|
+
.option('--json', CLI_DESCRIPTIONS.validateJson)
|
|
274
|
+
.option('--concurrency <n>', CLI_DESCRIPTIONS.validateConcurrency)
|
|
275
|
+
.option('--no-interactive', CLI_DESCRIPTIONS.validateNoInteractive)
|
|
276
|
+
.action(async (itemName, options) => {
|
|
277
|
+
try {
|
|
278
|
+
const validateCommand = new ValidateCommand();
|
|
279
|
+
await validateCommand.execute(itemName, options);
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
console.log();
|
|
283
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
284
|
+
process.exit(1);
|
|
285
|
+
}
|
|
286
|
+
});
|
|
287
|
+
// Top-level show command
|
|
288
|
+
program
|
|
289
|
+
.command('show [item-name]')
|
|
290
|
+
.description(CLI_DESCRIPTIONS.show)
|
|
291
|
+
.option('--json', CLI_DESCRIPTIONS.showJson)
|
|
292
|
+
.option('--type <type>', CLI_DESCRIPTIONS.showType)
|
|
293
|
+
.option('--no-interactive', CLI_DESCRIPTIONS.showNoInteractive)
|
|
294
|
+
// change-only flags
|
|
295
|
+
.option('--deltas-only', CLI_DESCRIPTIONS.showDeltasOnly)
|
|
296
|
+
.option('--requirements-only', CLI_DESCRIPTIONS.showRequirementsOnly)
|
|
297
|
+
// spec-only flags
|
|
298
|
+
.option('--requirements', CLI_DESCRIPTIONS.showRequirements)
|
|
299
|
+
.option('--no-scenarios', CLI_DESCRIPTIONS.showNoScenarios)
|
|
300
|
+
.option('-r, --requirement <id>', CLI_DESCRIPTIONS.showRequirement)
|
|
301
|
+
// allow unknown options to pass-through to underlying command implementation
|
|
302
|
+
.allowUnknownOption(true)
|
|
303
|
+
.action(async (itemName, options) => {
|
|
304
|
+
try {
|
|
305
|
+
const showCommand = new ShowCommand();
|
|
306
|
+
await showCommand.execute(itemName, options ?? {});
|
|
307
|
+
}
|
|
308
|
+
catch (error) {
|
|
309
|
+
console.log();
|
|
310
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
311
|
+
process.exit(1);
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
// Feedback command
|
|
315
|
+
program
|
|
316
|
+
.command('feedback <message>')
|
|
317
|
+
.description(CLI_DESCRIPTIONS.feedback)
|
|
318
|
+
.option('--body <text>', CLI_DESCRIPTIONS.feedbackBody)
|
|
319
|
+
.action(async (message, options) => {
|
|
320
|
+
try {
|
|
321
|
+
const feedbackCommand = new FeedbackCommand();
|
|
322
|
+
await feedbackCommand.execute(message, options);
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
console.log();
|
|
326
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
327
|
+
process.exit(1);
|
|
328
|
+
}
|
|
329
|
+
});
|
|
330
|
+
// Completion command with subcommands
|
|
331
|
+
const completionCmd = program
|
|
332
|
+
.command('completion')
|
|
333
|
+
.description(CLI_DESCRIPTIONS.completion);
|
|
334
|
+
completionCmd
|
|
335
|
+
.command('generate [shell]')
|
|
336
|
+
.description(CLI_DESCRIPTIONS.completionGenerate)
|
|
337
|
+
.action(async (shell) => {
|
|
338
|
+
try {
|
|
339
|
+
const completionCommand = new CompletionCommand();
|
|
340
|
+
await completionCommand.generate({ shell });
|
|
341
|
+
}
|
|
342
|
+
catch (error) {
|
|
343
|
+
console.log();
|
|
344
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
345
|
+
process.exit(1);
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
completionCmd
|
|
349
|
+
.command('install [shell]')
|
|
350
|
+
.description(CLI_DESCRIPTIONS.completionInstall)
|
|
351
|
+
.option('--verbose', CLI_DESCRIPTIONS.completionVerbose)
|
|
352
|
+
.action(async (shell, options) => {
|
|
353
|
+
try {
|
|
354
|
+
const completionCommand = new CompletionCommand();
|
|
355
|
+
await completionCommand.install({ shell, verbose: options?.verbose });
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
console.log();
|
|
359
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
360
|
+
process.exit(1);
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
completionCmd
|
|
364
|
+
.command('uninstall [shell]')
|
|
365
|
+
.description(CLI_DESCRIPTIONS.completionUninstall)
|
|
366
|
+
.option('-y, --yes', CONFIG_MESSAGES.skipConfirmationOption)
|
|
367
|
+
.action(async (shell, options) => {
|
|
368
|
+
try {
|
|
369
|
+
const completionCommand = new CompletionCommand();
|
|
370
|
+
await completionCommand.uninstall({ shell, yes: options?.yes });
|
|
371
|
+
}
|
|
372
|
+
catch (error) {
|
|
373
|
+
console.log();
|
|
374
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
375
|
+
process.exit(1);
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
// Hidden command for machine-readable completion data
|
|
379
|
+
program
|
|
380
|
+
.command('__complete <type>', { hidden: true })
|
|
381
|
+
.description(CLI_DESCRIPTIONS.__complete)
|
|
382
|
+
.action(async (type) => {
|
|
383
|
+
try {
|
|
384
|
+
const completionCommand = new CompletionCommand();
|
|
385
|
+
await completionCommand.complete({ type });
|
|
386
|
+
}
|
|
387
|
+
catch (error) {
|
|
388
|
+
// Silently fail for graceful shell completion experience
|
|
389
|
+
process.exitCode = 1;
|
|
390
|
+
}
|
|
391
|
+
});
|
|
392
|
+
// ═══════════════════════════════════════════════════════════
|
|
393
|
+
// Workflow Commands (formerly experimental)
|
|
394
|
+
// ═══════════════════════════════════════════════════════════
|
|
395
|
+
// Status command
|
|
396
|
+
program
|
|
397
|
+
.command('status')
|
|
398
|
+
.description(CLI_DESCRIPTIONS.status)
|
|
399
|
+
.option('--change <id>', CLI_DESCRIPTIONS.statusChange)
|
|
400
|
+
.option('--schema <name>', CLI_DESCRIPTIONS.statusSchema)
|
|
401
|
+
.option('--json', CLI_DESCRIPTIONS.statusJson)
|
|
402
|
+
.action(async (options) => {
|
|
403
|
+
try {
|
|
404
|
+
await statusCommand(options);
|
|
405
|
+
}
|
|
406
|
+
catch (error) {
|
|
407
|
+
console.log();
|
|
408
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
409
|
+
process.exit(1);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
// Instructions command
|
|
413
|
+
program
|
|
414
|
+
.command('instructions [artifact]')
|
|
415
|
+
.description(CLI_DESCRIPTIONS.instructions)
|
|
416
|
+
.option('--change <id>', CLI_DESCRIPTIONS.instructionsChange)
|
|
417
|
+
.option('--schema <name>', CLI_DESCRIPTIONS.instructionsSchema)
|
|
418
|
+
.option('--json', CLI_DESCRIPTIONS.instructionsJson)
|
|
419
|
+
.action(async (artifactId, options) => {
|
|
420
|
+
try {
|
|
421
|
+
// Special case: "apply" is not an artifact, but a command to get apply instructions
|
|
422
|
+
if (artifactId === 'apply') {
|
|
423
|
+
await applyInstructionsCommand(options);
|
|
424
|
+
}
|
|
425
|
+
else {
|
|
426
|
+
await instructionsCommand(artifactId, options);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
catch (error) {
|
|
430
|
+
console.log();
|
|
431
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
432
|
+
process.exit(1);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
// Templates command
|
|
436
|
+
program
|
|
437
|
+
.command('templates')
|
|
438
|
+
.description(CLI_DESCRIPTIONS.templates)
|
|
439
|
+
.option('--schema <name>', CLI_DESCRIPTIONS.templatesSchema(DEFAULT_SCHEMA))
|
|
440
|
+
.option('--json', CLI_DESCRIPTIONS.templatesJson)
|
|
441
|
+
.action(async (options) => {
|
|
442
|
+
try {
|
|
443
|
+
await templatesCommand(options);
|
|
444
|
+
}
|
|
445
|
+
catch (error) {
|
|
446
|
+
console.log();
|
|
447
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
448
|
+
process.exit(1);
|
|
449
|
+
}
|
|
450
|
+
});
|
|
451
|
+
// Schemas command
|
|
452
|
+
program
|
|
453
|
+
.command('schemas')
|
|
454
|
+
.description(CLI_DESCRIPTIONS.schemas)
|
|
455
|
+
.option('--json', CLI_DESCRIPTIONS.schemasJson)
|
|
456
|
+
.action(async (options) => {
|
|
457
|
+
try {
|
|
458
|
+
await schemasCommand(options);
|
|
459
|
+
}
|
|
460
|
+
catch (error) {
|
|
461
|
+
console.log();
|
|
462
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
463
|
+
process.exit(1);
|
|
464
|
+
}
|
|
465
|
+
});
|
|
466
|
+
// New command group with change subcommand
|
|
467
|
+
const newCmd = program.command('new').description(CLI_DESCRIPTIONS.new);
|
|
468
|
+
newCmd
|
|
469
|
+
.command('change <name>')
|
|
470
|
+
.description(CLI_DESCRIPTIONS.newChange)
|
|
471
|
+
.option('--description <text>', CLI_DESCRIPTIONS.newChangeDescription)
|
|
472
|
+
.option('--schema <name>', CLI_DESCRIPTIONS.newChangeSchema(DEFAULT_SCHEMA))
|
|
473
|
+
.action(async (name, options) => {
|
|
474
|
+
try {
|
|
475
|
+
await newChangeCommand(name, options);
|
|
476
|
+
}
|
|
477
|
+
catch (error) {
|
|
478
|
+
console.log();
|
|
479
|
+
ora().fail(CLI_MESSAGES.error(error.message));
|
|
480
|
+
process.exit(1);
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
program.parse();
|
|
484
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare class ChangeCommand {
|
|
2
|
+
private converter;
|
|
3
|
+
constructor();
|
|
4
|
+
/**
|
|
5
|
+
* Show a change proposal.
|
|
6
|
+
* - Text mode: raw markdown passthrough (no filters)
|
|
7
|
+
* - JSON mode: minimal object with deltas; --deltas-only returns same object with filtered deltas
|
|
8
|
+
* Note: --requirements-only is deprecated alias for --deltas-only
|
|
9
|
+
*/
|
|
10
|
+
show(changeName?: string, options?: {
|
|
11
|
+
json?: boolean;
|
|
12
|
+
requirementsOnly?: boolean;
|
|
13
|
+
deltasOnly?: boolean;
|
|
14
|
+
noInteractive?: boolean;
|
|
15
|
+
}): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* List active changes.
|
|
18
|
+
* - Text default: IDs only; --long prints minimal details (title, counts)
|
|
19
|
+
* - JSON: array of { id, title, deltaCount, taskStatus }, sorted by id
|
|
20
|
+
*/
|
|
21
|
+
list(options?: {
|
|
22
|
+
json?: boolean;
|
|
23
|
+
long?: boolean;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
validate(changeName?: string, options?: {
|
|
26
|
+
strict?: boolean;
|
|
27
|
+
json?: boolean;
|
|
28
|
+
noInteractive?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
private getActiveChanges;
|
|
31
|
+
private extractTitle;
|
|
32
|
+
private countTasks;
|
|
33
|
+
private printNextSteps;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=change.d.ts.map
|