superpowers-spec 1.0.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 +141 -0
- package/agents/code-reviewer.md +48 -0
- package/bin/openspec.js +3 -0
- package/bin/superpowers.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +482 -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 +36 -0
- package/dist/commands/config.js +552 -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 +57 -0
- package/dist/commands/workflow/shared.js +116 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +75 -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 +318 -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/available-tools.d.ts +16 -0
- package/dist/core/available-tools.js +30 -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 +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 +29 -0
- package/dist/core/command-generation/adapters/index.js +29 -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/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +29 -0
- package/dist/core/command-generation/adapters/pi.d.ts +14 -0
- package/dist/core/command-generation/adapters/pi.js +41 -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 +92 -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 +461 -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 +86 -0
- package/dist/core/config-schema.js +213 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +33 -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 +39 -0
- package/dist/core/init.js +634 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +512 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +171 -0
- package/dist/core/migration.d.ts +23 -0
- package/dist/core/migration.js +108 -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/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 +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 +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 +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 +19 -0
- package/dist/core/templates/skill-templates.js +18 -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 +313 -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 +488 -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 +469 -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 +143 -0
- package/dist/core/templates/workflows/onboard.d.ts +10 -0
- package/dist/core/templates/workflows/onboard.js +565 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +223 -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/verify-change.d.ts +10 -0
- package/dist/core/templates/workflows/verify-change.js +332 -0
- package/dist/core/update.d.ts +77 -0
- package/dist/core/update.js +537 -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 +28 -0
- package/dist/prompts/searchable-multi-select.js +159 -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 +180 -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/command-references.d.ts +18 -0
- package/dist/utils/command-references.js +20 -0
- package/dist/utils/file-system.d.ts +36 -0
- package/dist/utils/file-system.js +281 -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 +36 -0
- package/extension-manifest.json +9 -0
- package/hooks/hooks.json +16 -0
- package/hooks/run-hook.cmd +46 -0
- package/hooks/session-start +51 -0
- package/package.json +87 -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 +147 -0
- package/skills/dispatching-parallel-agents/SKILL.md +113 -0
- package/skills/finishing-a-development-branch/SKILL.md +200 -0
- package/skills/receiving-code-review/SKILL.md +213 -0
- package/skills/requesting-code-review/SKILL.md +73 -0
- package/skills/requesting-code-review/code-reviewer.md +146 -0
- package/skills/subagent-driven-development/SKILL.md +98 -0
- package/skills/subagent-driven-development/code-quality-reviewer-prompt.md +20 -0
- package/skills/subagent-driven-development/implementer-prompt.md +78 -0
- package/skills/systematic-debugging/CREATION-LOG.md +119 -0
- package/skills/systematic-debugging/SKILL.md +296 -0
- package/skills/systematic-debugging/condition-based-waiting-example.ts +158 -0
- package/skills/systematic-debugging/condition-based-waiting.md +115 -0
- package/skills/systematic-debugging/defense-in-depth.md +122 -0
- package/skills/systematic-debugging/find-polluter.sh +63 -0
- package/skills/systematic-debugging/root-cause-tracing.md +169 -0
- package/skills/systematic-debugging/test-academic.md +14 -0
- package/skills/systematic-debugging/test-pressure-1.md +58 -0
- package/skills/systematic-debugging/test-pressure-2.md +68 -0
- package/skills/systematic-debugging/test-pressure-3.md +69 -0
- package/skills/test-driven-development/SKILL.md +356 -0
- package/skills/test-driven-development/testing-anti-patterns.md +299 -0
- package/skills/using-git-worktrees/SKILL.md +212 -0
- package/skills/using-superpowers/SKILL.md +95 -0
- package/skills/verification-before-completion/SKILL.md +126 -0
- package/skills/writing-skills/SKILL.md +148 -0
|
@@ -0,0 +1,482 @@
|
|
|
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 'superpowers' command
|
|
34
|
+
if (name && name !== 'superpowers') {
|
|
35
|
+
names.unshift(name);
|
|
36
|
+
}
|
|
37
|
+
current = current.parent;
|
|
38
|
+
}
|
|
39
|
+
return names.join(':') || 'superpowers';
|
|
40
|
+
}
|
|
41
|
+
program
|
|
42
|
+
.name('superpowers')
|
|
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 Superpowers in your project')
|
|
71
|
+
.option('--tools <tools>', toolsOptionDescription)
|
|
72
|
+
.option('--force', 'Auto-cleanup legacy files without prompting')
|
|
73
|
+
.option('--profile <profile>', 'Override global config profile (core or custom)')
|
|
74
|
+
.action(async (targetPath = '.', options) => {
|
|
75
|
+
try {
|
|
76
|
+
// Validate that the path is a valid directory
|
|
77
|
+
const resolvedPath = path.resolve(targetPath);
|
|
78
|
+
try {
|
|
79
|
+
const stats = await fs.stat(resolvedPath);
|
|
80
|
+
if (!stats.isDirectory()) {
|
|
81
|
+
throw new Error(`Path "${targetPath}" is not a directory`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error.code === 'ENOENT') {
|
|
86
|
+
// Directory doesn't exist, but we can create it
|
|
87
|
+
console.log(`Directory "${targetPath}" doesn't exist, it will be created.`);
|
|
88
|
+
}
|
|
89
|
+
else if (error.message && error.message.includes('not a directory')) {
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
throw new Error(`Cannot access path "${targetPath}": ${error.message}`);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
const { InitCommand } = await import('../core/init.js');
|
|
97
|
+
const initCommand = new InitCommand({
|
|
98
|
+
tools: options?.tools,
|
|
99
|
+
force: options?.force,
|
|
100
|
+
profile: options?.profile,
|
|
101
|
+
});
|
|
102
|
+
await initCommand.execute(targetPath);
|
|
103
|
+
}
|
|
104
|
+
catch (error) {
|
|
105
|
+
console.log(); // Empty line for spacing
|
|
106
|
+
ora().fail(`Error: ${error.message}`);
|
|
107
|
+
process.exit(1);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
// Hidden alias: 'experimental' -> 'init' for backwards compatibility
|
|
111
|
+
program
|
|
112
|
+
.command('experimental', { hidden: true })
|
|
113
|
+
.description('Alias for init (deprecated)')
|
|
114
|
+
.option('--tool <tool-id>', 'Target AI tool (maps to --tools)')
|
|
115
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
116
|
+
.action(async (options) => {
|
|
117
|
+
try {
|
|
118
|
+
console.log('Note: "superpowers experimental" is deprecated. Use "superpowers init" instead.');
|
|
119
|
+
const { InitCommand } = await import('../core/init.js');
|
|
120
|
+
const initCommand = new InitCommand({
|
|
121
|
+
tools: options?.tool,
|
|
122
|
+
interactive: options?.noInteractive === true ? false : undefined,
|
|
123
|
+
});
|
|
124
|
+
await initCommand.execute('.');
|
|
125
|
+
}
|
|
126
|
+
catch (error) {
|
|
127
|
+
console.log();
|
|
128
|
+
ora().fail(`Error: ${error.message}`);
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
program
|
|
133
|
+
.command('update [path]')
|
|
134
|
+
.description('Update Superpowers instruction files')
|
|
135
|
+
.option('--force', 'Force update even when tools are up to date')
|
|
136
|
+
.action(async (targetPath = '.', options) => {
|
|
137
|
+
try {
|
|
138
|
+
const resolvedPath = path.resolve(targetPath);
|
|
139
|
+
const updateCommand = new UpdateCommand({ force: options?.force });
|
|
140
|
+
await updateCommand.execute(resolvedPath);
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
console.log(); // Empty line for spacing
|
|
144
|
+
ora().fail(`Error: ${error.message}`);
|
|
145
|
+
process.exit(1);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
program
|
|
149
|
+
.command('list')
|
|
150
|
+
.description('List items (changes by default). Use --specs to list specs.')
|
|
151
|
+
.option('--specs', 'List specs instead of changes')
|
|
152
|
+
.option('--changes', 'List changes explicitly (default)')
|
|
153
|
+
.option('--sort <order>', 'Sort order: "recent" (default) or "name"', 'recent')
|
|
154
|
+
.option('--json', 'Output as JSON (for programmatic use)')
|
|
155
|
+
.action(async (options) => {
|
|
156
|
+
try {
|
|
157
|
+
const listCommand = new ListCommand();
|
|
158
|
+
const mode = options?.specs ? 'specs' : 'changes';
|
|
159
|
+
const sort = options?.sort === 'name' ? 'name' : 'recent';
|
|
160
|
+
await listCommand.execute('.', mode, { sort, json: options?.json });
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
console.log(); // Empty line for spacing
|
|
164
|
+
ora().fail(`Error: ${error.message}`);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
program
|
|
169
|
+
.command('view')
|
|
170
|
+
.description('Display an interactive dashboard of specs and changes')
|
|
171
|
+
.action(async () => {
|
|
172
|
+
try {
|
|
173
|
+
const viewCommand = new ViewCommand();
|
|
174
|
+
await viewCommand.execute('.');
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
console.log(); // Empty line for spacing
|
|
178
|
+
ora().fail(`Error: ${error.message}`);
|
|
179
|
+
process.exit(1);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
// Change command with subcommands
|
|
183
|
+
const changeCmd = program
|
|
184
|
+
.command('change')
|
|
185
|
+
.description('Manage Superpowers change proposals');
|
|
186
|
+
// Deprecation notice for noun-based commands
|
|
187
|
+
changeCmd.hook('preAction', () => {
|
|
188
|
+
console.error('Warning: The "superpowers change ..." commands are deprecated. Prefer verb-first commands (e.g., "superpowers list", "superpowers validate --changes").');
|
|
189
|
+
});
|
|
190
|
+
changeCmd
|
|
191
|
+
.command('show [change-name]')
|
|
192
|
+
.description('Show a change proposal in JSON or markdown format')
|
|
193
|
+
.option('--json', 'Output as JSON')
|
|
194
|
+
.option('--deltas-only', 'Show only deltas (JSON only)')
|
|
195
|
+
.option('--requirements-only', 'Alias for --deltas-only (deprecated)')
|
|
196
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
197
|
+
.action(async (changeName, options) => {
|
|
198
|
+
try {
|
|
199
|
+
const changeCommand = new ChangeCommand();
|
|
200
|
+
await changeCommand.show(changeName, options);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
console.error(`Error: ${error.message}`);
|
|
204
|
+
process.exitCode = 1;
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
changeCmd
|
|
208
|
+
.command('list')
|
|
209
|
+
.description('List all active changes (DEPRECATED: use "superpowers list" instead)')
|
|
210
|
+
.option('--json', 'Output as JSON')
|
|
211
|
+
.option('--long', 'Show id and title with counts')
|
|
212
|
+
.action(async (options) => {
|
|
213
|
+
try {
|
|
214
|
+
console.error('Warning: "superpowers change list" is deprecated. Use "superpowers list".');
|
|
215
|
+
const changeCommand = new ChangeCommand();
|
|
216
|
+
await changeCommand.list(options);
|
|
217
|
+
}
|
|
218
|
+
catch (error) {
|
|
219
|
+
console.error(`Error: ${error.message}`);
|
|
220
|
+
process.exitCode = 1;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
changeCmd
|
|
224
|
+
.command('validate [change-name]')
|
|
225
|
+
.description('Validate a change proposal')
|
|
226
|
+
.option('--strict', 'Enable strict validation mode')
|
|
227
|
+
.option('--json', 'Output validation report as JSON')
|
|
228
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
229
|
+
.action(async (changeName, options) => {
|
|
230
|
+
try {
|
|
231
|
+
const changeCommand = new ChangeCommand();
|
|
232
|
+
await changeCommand.validate(changeName, options);
|
|
233
|
+
if (typeof process.exitCode === 'number' && process.exitCode !== 0) {
|
|
234
|
+
process.exit(process.exitCode);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error(`Error: ${error.message}`);
|
|
239
|
+
process.exitCode = 1;
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
program
|
|
243
|
+
.command('archive [change-name]')
|
|
244
|
+
.description('Archive a completed change and update main specs')
|
|
245
|
+
.option('-y, --yes', 'Skip confirmation prompts')
|
|
246
|
+
.option('--skip-specs', 'Skip spec update operations (useful for infrastructure, tooling, or doc-only changes)')
|
|
247
|
+
.option('--no-validate', 'Skip validation (not recommended, requires confirmation)')
|
|
248
|
+
.action(async (changeName, options) => {
|
|
249
|
+
try {
|
|
250
|
+
const archiveCommand = new ArchiveCommand();
|
|
251
|
+
await archiveCommand.execute(changeName, options);
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
console.log(); // Empty line for spacing
|
|
255
|
+
ora().fail(`Error: ${error.message}`);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
registerSpecCommand(program);
|
|
260
|
+
registerConfigCommand(program);
|
|
261
|
+
registerSchemaCommand(program);
|
|
262
|
+
// Top-level validate command
|
|
263
|
+
program
|
|
264
|
+
.command('validate [item-name]')
|
|
265
|
+
.description('Validate changes and specs')
|
|
266
|
+
.option('--all', 'Validate all changes and specs')
|
|
267
|
+
.option('--changes', 'Validate all changes')
|
|
268
|
+
.option('--specs', 'Validate all specs')
|
|
269
|
+
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
|
|
270
|
+
.option('--strict', 'Enable strict validation mode')
|
|
271
|
+
.option('--json', 'Output validation results as JSON')
|
|
272
|
+
.option('--concurrency <n>', 'Max concurrent validations (defaults to env SUPERPOWERS_CONCURRENCY or 6)')
|
|
273
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
274
|
+
.action(async (itemName, options) => {
|
|
275
|
+
try {
|
|
276
|
+
const validateCommand = new ValidateCommand();
|
|
277
|
+
await validateCommand.execute(itemName, options);
|
|
278
|
+
}
|
|
279
|
+
catch (error) {
|
|
280
|
+
console.log();
|
|
281
|
+
ora().fail(`Error: ${error.message}`);
|
|
282
|
+
process.exit(1);
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
// Top-level show command
|
|
286
|
+
program
|
|
287
|
+
.command('show [item-name]')
|
|
288
|
+
.description('Show a change or spec')
|
|
289
|
+
.option('--json', 'Output as JSON')
|
|
290
|
+
.option('--type <type>', 'Specify item type when ambiguous: change|spec')
|
|
291
|
+
.option('--no-interactive', 'Disable interactive prompts')
|
|
292
|
+
// change-only flags
|
|
293
|
+
.option('--deltas-only', 'Show only deltas (JSON only, change)')
|
|
294
|
+
.option('--requirements-only', 'Alias for --deltas-only (deprecated, change)')
|
|
295
|
+
// spec-only flags
|
|
296
|
+
.option('--requirements', 'JSON only: Show only requirements (exclude scenarios)')
|
|
297
|
+
.option('--no-scenarios', 'JSON only: Exclude scenario content')
|
|
298
|
+
.option('-r, --requirement <id>', 'JSON only: Show specific requirement by ID (1-based)')
|
|
299
|
+
// allow unknown options to pass-through to underlying command implementation
|
|
300
|
+
.allowUnknownOption(true)
|
|
301
|
+
.action(async (itemName, options) => {
|
|
302
|
+
try {
|
|
303
|
+
const showCommand = new ShowCommand();
|
|
304
|
+
await showCommand.execute(itemName, options ?? {});
|
|
305
|
+
}
|
|
306
|
+
catch (error) {
|
|
307
|
+
console.log();
|
|
308
|
+
ora().fail(`Error: ${error.message}`);
|
|
309
|
+
process.exit(1);
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
// Feedback command
|
|
313
|
+
program
|
|
314
|
+
.command('feedback <message>')
|
|
315
|
+
.description('Submit feedback about Superpowers')
|
|
316
|
+
.option('--body <text>', 'Detailed description for the feedback')
|
|
317
|
+
.action(async (message, options) => {
|
|
318
|
+
try {
|
|
319
|
+
const feedbackCommand = new FeedbackCommand();
|
|
320
|
+
await feedbackCommand.execute(message, options);
|
|
321
|
+
}
|
|
322
|
+
catch (error) {
|
|
323
|
+
console.log();
|
|
324
|
+
ora().fail(`Error: ${error.message}`);
|
|
325
|
+
process.exit(1);
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
// Completion command with subcommands
|
|
329
|
+
const completionCmd = program
|
|
330
|
+
.command('completion')
|
|
331
|
+
.description('Manage shell completions for Superpowers CLI');
|
|
332
|
+
completionCmd
|
|
333
|
+
.command('generate [shell]')
|
|
334
|
+
.description('Generate completion script for a shell (outputs to stdout)')
|
|
335
|
+
.action(async (shell) => {
|
|
336
|
+
try {
|
|
337
|
+
const completionCommand = new CompletionCommand();
|
|
338
|
+
await completionCommand.generate({ shell });
|
|
339
|
+
}
|
|
340
|
+
catch (error) {
|
|
341
|
+
console.log();
|
|
342
|
+
ora().fail(`Error: ${error.message}`);
|
|
343
|
+
process.exit(1);
|
|
344
|
+
}
|
|
345
|
+
});
|
|
346
|
+
completionCmd
|
|
347
|
+
.command('install [shell]')
|
|
348
|
+
.description('Install completion script for a shell')
|
|
349
|
+
.option('--verbose', 'Show detailed installation output')
|
|
350
|
+
.action(async (shell, options) => {
|
|
351
|
+
try {
|
|
352
|
+
const completionCommand = new CompletionCommand();
|
|
353
|
+
await completionCommand.install({ shell, verbose: options?.verbose });
|
|
354
|
+
}
|
|
355
|
+
catch (error) {
|
|
356
|
+
console.log();
|
|
357
|
+
ora().fail(`Error: ${error.message}`);
|
|
358
|
+
process.exit(1);
|
|
359
|
+
}
|
|
360
|
+
});
|
|
361
|
+
completionCmd
|
|
362
|
+
.command('uninstall [shell]')
|
|
363
|
+
.description('Uninstall completion script for a shell')
|
|
364
|
+
.option('-y, --yes', 'Skip confirmation prompts')
|
|
365
|
+
.action(async (shell, options) => {
|
|
366
|
+
try {
|
|
367
|
+
const completionCommand = new CompletionCommand();
|
|
368
|
+
await completionCommand.uninstall({ shell, yes: options?.yes });
|
|
369
|
+
}
|
|
370
|
+
catch (error) {
|
|
371
|
+
console.log();
|
|
372
|
+
ora().fail(`Error: ${error.message}`);
|
|
373
|
+
process.exit(1);
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
// Hidden command for machine-readable completion data
|
|
377
|
+
program
|
|
378
|
+
.command('__complete <type>', { hidden: true })
|
|
379
|
+
.description('Output completion data in machine-readable format (internal use)')
|
|
380
|
+
.action(async (type) => {
|
|
381
|
+
try {
|
|
382
|
+
const completionCommand = new CompletionCommand();
|
|
383
|
+
await completionCommand.complete({ type });
|
|
384
|
+
}
|
|
385
|
+
catch (error) {
|
|
386
|
+
// Silently fail for graceful shell completion experience
|
|
387
|
+
process.exitCode = 1;
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
// ═══════════════════════════════════════════════════════════
|
|
391
|
+
// Workflow Commands (formerly experimental)
|
|
392
|
+
// ═══════════════════════════════════════════════════════════
|
|
393
|
+
// Status command
|
|
394
|
+
program
|
|
395
|
+
.command('status')
|
|
396
|
+
.description('Display artifact completion status for a change')
|
|
397
|
+
.option('--change <id>', 'Change name to show status for')
|
|
398
|
+
.option('--schema <name>', 'Schema override (auto-detected from config.yaml)')
|
|
399
|
+
.option('--json', 'Output as JSON')
|
|
400
|
+
.action(async (options) => {
|
|
401
|
+
try {
|
|
402
|
+
await statusCommand(options);
|
|
403
|
+
}
|
|
404
|
+
catch (error) {
|
|
405
|
+
console.log();
|
|
406
|
+
ora().fail(`Error: ${error.message}`);
|
|
407
|
+
process.exit(1);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
// Instructions command
|
|
411
|
+
program
|
|
412
|
+
.command('instructions [artifact]')
|
|
413
|
+
.description('Output enriched instructions for creating an artifact or applying tasks')
|
|
414
|
+
.option('--change <id>', 'Change name')
|
|
415
|
+
.option('--schema <name>', 'Schema override (auto-detected from config.yaml)')
|
|
416
|
+
.option('--json', 'Output as JSON')
|
|
417
|
+
.action(async (artifactId, options) => {
|
|
418
|
+
try {
|
|
419
|
+
// Special case: "apply" is not an artifact, but a command to get apply instructions
|
|
420
|
+
if (artifactId === 'apply') {
|
|
421
|
+
await applyInstructionsCommand(options);
|
|
422
|
+
}
|
|
423
|
+
else {
|
|
424
|
+
await instructionsCommand(artifactId, options);
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
console.log();
|
|
429
|
+
ora().fail(`Error: ${error.message}`);
|
|
430
|
+
process.exit(1);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
// Templates command
|
|
434
|
+
program
|
|
435
|
+
.command('templates')
|
|
436
|
+
.description('Show resolved template paths for all artifacts in a schema')
|
|
437
|
+
.option('--schema <name>', `Schema to use (default: ${DEFAULT_SCHEMA})`)
|
|
438
|
+
.option('--json', 'Output as JSON mapping artifact IDs to template paths')
|
|
439
|
+
.action(async (options) => {
|
|
440
|
+
try {
|
|
441
|
+
await templatesCommand(options);
|
|
442
|
+
}
|
|
443
|
+
catch (error) {
|
|
444
|
+
console.log();
|
|
445
|
+
ora().fail(`Error: ${error.message}`);
|
|
446
|
+
process.exit(1);
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
// Schemas command
|
|
450
|
+
program
|
|
451
|
+
.command('schemas')
|
|
452
|
+
.description('List available workflow schemas with descriptions')
|
|
453
|
+
.option('--json', 'Output as JSON (for agent use)')
|
|
454
|
+
.action(async (options) => {
|
|
455
|
+
try {
|
|
456
|
+
await schemasCommand(options);
|
|
457
|
+
}
|
|
458
|
+
catch (error) {
|
|
459
|
+
console.log();
|
|
460
|
+
ora().fail(`Error: ${error.message}`);
|
|
461
|
+
process.exit(1);
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
// New command group with change subcommand
|
|
465
|
+
const newCmd = program.command('new').description('Create new items');
|
|
466
|
+
newCmd
|
|
467
|
+
.command('change <name>')
|
|
468
|
+
.description('Create a new change directory')
|
|
469
|
+
.option('--description <text>', 'Description to add to README.md')
|
|
470
|
+
.option('--schema <name>', `Workflow schema to use (default: ${DEFAULT_SCHEMA})`)
|
|
471
|
+
.action(async (name, options) => {
|
|
472
|
+
try {
|
|
473
|
+
await newChangeCommand(name, options);
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
console.log();
|
|
477
|
+
ora().fail(`Error: ${error.message}`);
|
|
478
|
+
process.exit(1);
|
|
479
|
+
}
|
|
480
|
+
});
|
|
481
|
+
program.parse();
|
|
482
|
+
//# 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
|