@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,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Change Command
|
|
3
|
+
*
|
|
4
|
+
* Creates a new change directory with optional description and schema.
|
|
5
|
+
*/
|
|
6
|
+
export interface NewChangeOptions {
|
|
7
|
+
description?: string;
|
|
8
|
+
schema?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function newChangeCommand(name: string | undefined, options: NewChangeOptions): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=new-change.d.ts.map
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* New Change Command
|
|
3
|
+
*
|
|
4
|
+
* Creates a new change directory with optional description and schema.
|
|
5
|
+
*/
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { createChange, validateChangeName } from '../../utils/change-utils.js';
|
|
9
|
+
import { validateSchemaExists } from './shared.js';
|
|
10
|
+
import { WORKFLOW_MESSAGES } from '../../messages/index.js';
|
|
11
|
+
// -----------------------------------------------------------------------------
|
|
12
|
+
// Command Implementation
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
export async function newChangeCommand(name, options) {
|
|
15
|
+
if (!name) {
|
|
16
|
+
throw new Error(WORKFLOW_MESSAGES.missingNameArgument);
|
|
17
|
+
}
|
|
18
|
+
const validation = validateChangeName(name);
|
|
19
|
+
if (!validation.valid) {
|
|
20
|
+
throw new Error(validation.error);
|
|
21
|
+
}
|
|
22
|
+
const projectRoot = process.cwd();
|
|
23
|
+
// Validate schema if provided
|
|
24
|
+
if (options.schema) {
|
|
25
|
+
validateSchemaExists(options.schema, projectRoot);
|
|
26
|
+
}
|
|
27
|
+
const spinner = ora(WORKFLOW_MESSAGES.creatingChange(name, options.schema)).start();
|
|
28
|
+
try {
|
|
29
|
+
const result = await createChange(projectRoot, name, { schema: options.schema });
|
|
30
|
+
// If description provided, create README.md with description
|
|
31
|
+
if (options.description) {
|
|
32
|
+
const { promises: fs } = await import('fs');
|
|
33
|
+
const changeDir = path.join(projectRoot, 'openspec', 'changes', name);
|
|
34
|
+
const readmePath = path.join(changeDir, 'README.md');
|
|
35
|
+
await fs.writeFile(readmePath, `# ${name}\n\n${options.description}\n`, 'utf-8');
|
|
36
|
+
}
|
|
37
|
+
spinner.succeed(WORKFLOW_MESSAGES.createdChange(name, result.schema));
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
spinner.fail(WORKFLOW_MESSAGES.failedToCreateChange(name));
|
|
41
|
+
throw error;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=new-change.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schemas Command
|
|
3
|
+
*
|
|
4
|
+
* Lists available workflow schemas with descriptions.
|
|
5
|
+
*/
|
|
6
|
+
export interface SchemasOptions {
|
|
7
|
+
json?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function schemasCommand(options: SchemasOptions): Promise<void>;
|
|
10
|
+
//# sourceMappingURL=schemas.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schemas Command
|
|
3
|
+
*
|
|
4
|
+
* Lists available workflow schemas with descriptions.
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { listSchemasWithInfo } from '../../core/artifact-graph/index.js';
|
|
8
|
+
import { WORKFLOW_MESSAGES } from '../../messages/index.js';
|
|
9
|
+
// -----------------------------------------------------------------------------
|
|
10
|
+
// Command Implementation
|
|
11
|
+
// -----------------------------------------------------------------------------
|
|
12
|
+
export async function schemasCommand(options) {
|
|
13
|
+
const projectRoot = process.cwd();
|
|
14
|
+
const schemas = listSchemasWithInfo(projectRoot);
|
|
15
|
+
if (options.json) {
|
|
16
|
+
console.log(JSON.stringify(schemas, null, 2));
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
console.log(WORKFLOW_MESSAGES.availableSchemas);
|
|
20
|
+
console.log();
|
|
21
|
+
for (const schema of schemas) {
|
|
22
|
+
let sourceLabel = '';
|
|
23
|
+
if (schema.source === 'project') {
|
|
24
|
+
sourceLabel = chalk.cyan(WORKFLOW_MESSAGES.projectLabel);
|
|
25
|
+
}
|
|
26
|
+
else if (schema.source === 'user') {
|
|
27
|
+
sourceLabel = chalk.dim(WORKFLOW_MESSAGES.userOverrideLabel);
|
|
28
|
+
}
|
|
29
|
+
console.log(` ${chalk.bold(schema.name)}${sourceLabel}`);
|
|
30
|
+
console.log(` ${schema.description}`);
|
|
31
|
+
console.log(` ${WORKFLOW_MESSAGES.artifactsLabel(schema.artifacts.join(' → '))}`);
|
|
32
|
+
console.log();
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Types and Utilities for Artifact Workflow Commands
|
|
3
|
+
*
|
|
4
|
+
* This module contains types, constants, and validation helpers used across
|
|
5
|
+
* multiple artifact workflow commands.
|
|
6
|
+
*/
|
|
7
|
+
export interface TaskItem {
|
|
8
|
+
id: string;
|
|
9
|
+
description: string;
|
|
10
|
+
done: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ApplyInstructions {
|
|
13
|
+
changeName: string;
|
|
14
|
+
changeDir: string;
|
|
15
|
+
schemaName: string;
|
|
16
|
+
contextFiles: Record<string, string[]>;
|
|
17
|
+
progress: {
|
|
18
|
+
total: number;
|
|
19
|
+
complete: number;
|
|
20
|
+
remaining: number;
|
|
21
|
+
};
|
|
22
|
+
tasks: TaskItem[];
|
|
23
|
+
state: 'blocked' | 'all_done' | 'ready';
|
|
24
|
+
missingArtifacts?: string[];
|
|
25
|
+
instruction: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const DEFAULT_SCHEMA = "spec-driven";
|
|
28
|
+
/**
|
|
29
|
+
* Checks if color output is disabled via NO_COLOR env or --no-color flag.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isColorDisabled(): boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Gets the color function based on status.
|
|
34
|
+
*/
|
|
35
|
+
export declare function getStatusColor(status: 'done' | 'ready' | 'blocked'): (text: string) => string;
|
|
36
|
+
/**
|
|
37
|
+
* Gets the status indicator for an artifact.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getStatusIndicator(status: 'done' | 'ready' | 'blocked'): string;
|
|
40
|
+
/**
|
|
41
|
+
* Returns the list of available change directory names under openspec/changes/.
|
|
42
|
+
* Excludes the archive directory and hidden directories.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getAvailableChanges(projectRoot: string): Promise<string[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Validates that a change exists and returns available changes if not.
|
|
47
|
+
* Checks directory existence directly to support scaffolded changes (without proposal.md).
|
|
48
|
+
*/
|
|
49
|
+
export declare function validateChangeExists(changeName: string | undefined, projectRoot: string): Promise<string>;
|
|
50
|
+
/**
|
|
51
|
+
* Validates that a schema exists and returns available schemas if not.
|
|
52
|
+
*
|
|
53
|
+
* @param schemaName - The schema name to validate
|
|
54
|
+
* @param projectRoot - Optional project root for project-local schema resolution
|
|
55
|
+
*/
|
|
56
|
+
export declare function validateSchemaExists(schemaName: string, projectRoot?: string): string;
|
|
57
|
+
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Types and Utilities for Artifact Workflow Commands
|
|
3
|
+
*
|
|
4
|
+
* This module contains types, constants, and validation helpers used across
|
|
5
|
+
* multiple artifact workflow commands.
|
|
6
|
+
*/
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import * as fs from 'fs';
|
|
10
|
+
import { getSchemaDir, listSchemas } from '../../core/artifact-graph/index.js';
|
|
11
|
+
import { validateChangeName } from '../../utils/change-utils.js';
|
|
12
|
+
import { WORKFLOW_MESSAGES } from '../../messages/index.js';
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
// Constants
|
|
15
|
+
// -----------------------------------------------------------------------------
|
|
16
|
+
export const DEFAULT_SCHEMA = 'spec-driven';
|
|
17
|
+
// -----------------------------------------------------------------------------
|
|
18
|
+
// Utility Functions
|
|
19
|
+
// -----------------------------------------------------------------------------
|
|
20
|
+
/**
|
|
21
|
+
* Checks if color output is disabled via NO_COLOR env or --no-color flag.
|
|
22
|
+
*/
|
|
23
|
+
export function isColorDisabled() {
|
|
24
|
+
return process.env.NO_COLOR === '1' || process.env.NO_COLOR === 'true';
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets the color function based on status.
|
|
28
|
+
*/
|
|
29
|
+
export function getStatusColor(status) {
|
|
30
|
+
if (isColorDisabled()) {
|
|
31
|
+
return (text) => text;
|
|
32
|
+
}
|
|
33
|
+
switch (status) {
|
|
34
|
+
case 'done':
|
|
35
|
+
return chalk.green;
|
|
36
|
+
case 'ready':
|
|
37
|
+
return chalk.yellow;
|
|
38
|
+
case 'blocked':
|
|
39
|
+
return chalk.red;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Gets the status indicator for an artifact.
|
|
44
|
+
*/
|
|
45
|
+
export function getStatusIndicator(status) {
|
|
46
|
+
const color = getStatusColor(status);
|
|
47
|
+
switch (status) {
|
|
48
|
+
case 'done':
|
|
49
|
+
return color('[x]');
|
|
50
|
+
case 'ready':
|
|
51
|
+
return color('[ ]');
|
|
52
|
+
case 'blocked':
|
|
53
|
+
return color('[-]');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns the list of available change directory names under openspec/changes/.
|
|
58
|
+
* Excludes the archive directory and hidden directories.
|
|
59
|
+
*/
|
|
60
|
+
export async function getAvailableChanges(projectRoot) {
|
|
61
|
+
const changesPath = path.join(projectRoot, 'openspec', 'changes');
|
|
62
|
+
try {
|
|
63
|
+
const entries = await fs.promises.readdir(changesPath, { withFileTypes: true });
|
|
64
|
+
return entries
|
|
65
|
+
.filter((e) => e.isDirectory() && e.name !== 'archive' && !e.name.startsWith('.'))
|
|
66
|
+
.map((e) => e.name);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error.code === 'ENOENT')
|
|
70
|
+
return [];
|
|
71
|
+
throw error;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Validates that a change exists and returns available changes if not.
|
|
76
|
+
* Checks directory existence directly to support scaffolded changes (without proposal.md).
|
|
77
|
+
*/
|
|
78
|
+
export async function validateChangeExists(changeName, projectRoot) {
|
|
79
|
+
if (!changeName) {
|
|
80
|
+
const available = await getAvailableChanges(projectRoot);
|
|
81
|
+
if (available.length === 0) {
|
|
82
|
+
throw new Error(WORKFLOW_MESSAGES.noChangesFound);
|
|
83
|
+
}
|
|
84
|
+
throw new Error(WORKFLOW_MESSAGES.missingChangeOption(available.join('\n ')));
|
|
85
|
+
}
|
|
86
|
+
// Validate change name format to prevent path traversal
|
|
87
|
+
const nameValidation = validateChangeName(changeName);
|
|
88
|
+
if (!nameValidation.valid) {
|
|
89
|
+
throw new Error(WORKFLOW_MESSAGES.invalidChangeName(changeName, nameValidation.error));
|
|
90
|
+
}
|
|
91
|
+
// Check directory existence directly
|
|
92
|
+
const changePath = path.join(projectRoot, 'openspec', 'changes', changeName);
|
|
93
|
+
const exists = fs.existsSync(changePath) && fs.statSync(changePath).isDirectory();
|
|
94
|
+
if (!exists) {
|
|
95
|
+
const available = await getAvailableChanges(projectRoot);
|
|
96
|
+
if (available.length === 0) {
|
|
97
|
+
throw new Error(WORKFLOW_MESSAGES.changeNotFoundNoChanges(changeName));
|
|
98
|
+
}
|
|
99
|
+
throw new Error(WORKFLOW_MESSAGES.changeNotFound(changeName, available.join('\n ')));
|
|
100
|
+
}
|
|
101
|
+
return changeName;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Validates that a schema exists and returns available schemas if not.
|
|
105
|
+
*
|
|
106
|
+
* @param schemaName - The schema name to validate
|
|
107
|
+
* @param projectRoot - Optional project root for project-local schema resolution
|
|
108
|
+
*/
|
|
109
|
+
export function validateSchemaExists(schemaName, projectRoot) {
|
|
110
|
+
const schemaDir = getSchemaDir(schemaName, projectRoot);
|
|
111
|
+
if (!schemaDir) {
|
|
112
|
+
const availableSchemas = listSchemas(projectRoot);
|
|
113
|
+
throw new Error(WORKFLOW_MESSAGES.schemaNotFound(schemaName, availableSchemas.join('\n ')));
|
|
114
|
+
}
|
|
115
|
+
return schemaName;
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status Command
|
|
3
|
+
*
|
|
4
|
+
* Displays artifact completion status for a change.
|
|
5
|
+
*/
|
|
6
|
+
import { type ChangeStatus } from '../../core/artifact-graph/index.js';
|
|
7
|
+
export interface StatusOptions {
|
|
8
|
+
change?: string;
|
|
9
|
+
schema?: string;
|
|
10
|
+
json?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function statusCommand(options: StatusOptions): Promise<void>;
|
|
13
|
+
export declare function printStatusText(status: ChangeStatus): void;
|
|
14
|
+
//# sourceMappingURL=status.d.ts.map
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Status Command
|
|
3
|
+
*
|
|
4
|
+
* Displays artifact completion status for a change.
|
|
5
|
+
*/
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { loadChangeContext, formatChangeStatus, } from '../../core/artifact-graph/index.js';
|
|
9
|
+
import { validateChangeExists, validateSchemaExists, getAvailableChanges, getStatusIndicator, getStatusColor, } from './shared.js';
|
|
10
|
+
import { WORKFLOW_MESSAGES } from '../../messages/index.js';
|
|
11
|
+
// -----------------------------------------------------------------------------
|
|
12
|
+
// Command Implementation
|
|
13
|
+
// -----------------------------------------------------------------------------
|
|
14
|
+
export async function statusCommand(options) {
|
|
15
|
+
const spinner = options.json ? undefined : ora(WORKFLOW_MESSAGES.loadingChangeStatus).start();
|
|
16
|
+
try {
|
|
17
|
+
const projectRoot = process.cwd();
|
|
18
|
+
// Handle no-changes case gracefully — status is informational,
|
|
19
|
+
// so "no changes" is a valid state, not an error.
|
|
20
|
+
if (!options.change) {
|
|
21
|
+
const available = await getAvailableChanges(projectRoot);
|
|
22
|
+
if (available.length === 0) {
|
|
23
|
+
spinner?.stop();
|
|
24
|
+
if (options.json) {
|
|
25
|
+
console.log(JSON.stringify({ changes: [], message: WORKFLOW_MESSAGES.noActiveChanges }, null, 2));
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
console.log(WORKFLOW_MESSAGES.noActiveChanges);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
// Changes exist but --change not provided
|
|
32
|
+
spinner?.stop();
|
|
33
|
+
throw new Error(WORKFLOW_MESSAGES.missingChangeOption(available.join('\n ')));
|
|
34
|
+
}
|
|
35
|
+
const changeName = await validateChangeExists(options.change, projectRoot);
|
|
36
|
+
// Validate schema if explicitly provided
|
|
37
|
+
if (options.schema) {
|
|
38
|
+
validateSchemaExists(options.schema, projectRoot);
|
|
39
|
+
}
|
|
40
|
+
// loadChangeContext will auto-detect schema from metadata if not provided
|
|
41
|
+
const context = loadChangeContext(projectRoot, changeName, options.schema);
|
|
42
|
+
const status = formatChangeStatus(context);
|
|
43
|
+
spinner?.stop();
|
|
44
|
+
if (options.json) {
|
|
45
|
+
console.log(JSON.stringify(status, null, 2));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
printStatusText(status);
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
spinner?.stop();
|
|
52
|
+
throw error;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export function printStatusText(status) {
|
|
56
|
+
const doneCount = status.artifacts.filter((a) => a.status === 'done').length;
|
|
57
|
+
const total = status.artifacts.length;
|
|
58
|
+
console.log(WORKFLOW_MESSAGES.changeLabel(status.changeName));
|
|
59
|
+
console.log(WORKFLOW_MESSAGES.schemaLabel2(status.schemaName));
|
|
60
|
+
console.log(WORKFLOW_MESSAGES.progressArtifacts(doneCount, total));
|
|
61
|
+
console.log();
|
|
62
|
+
for (const artifact of status.artifacts) {
|
|
63
|
+
const indicator = getStatusIndicator(artifact.status);
|
|
64
|
+
const color = getStatusColor(artifact.status);
|
|
65
|
+
let line = `${indicator} ${artifact.id}`;
|
|
66
|
+
if (artifact.status === 'blocked' && artifact.missingDeps && artifact.missingDeps.length > 0) {
|
|
67
|
+
line += color(WORKFLOW_MESSAGES.blockedBy(artifact.missingDeps.join(', ')));
|
|
68
|
+
}
|
|
69
|
+
console.log(line);
|
|
70
|
+
}
|
|
71
|
+
if (status.isComplete) {
|
|
72
|
+
console.log();
|
|
73
|
+
console.log(chalk.green(WORKFLOW_MESSAGES.allArtifactsComplete));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=status.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Templates Command
|
|
3
|
+
*
|
|
4
|
+
* Shows resolved template paths for all artifacts in a schema.
|
|
5
|
+
*/
|
|
6
|
+
export interface TemplatesOptions {
|
|
7
|
+
schema?: string;
|
|
8
|
+
json?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface TemplateInfo {
|
|
11
|
+
artifactId: string;
|
|
12
|
+
templatePath: string;
|
|
13
|
+
source: 'project' | 'user' | 'package';
|
|
14
|
+
}
|
|
15
|
+
export declare function templatesCommand(options: TemplatesOptions): Promise<void>;
|
|
16
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Templates Command
|
|
3
|
+
*
|
|
4
|
+
* Shows resolved template paths for all artifacts in a schema.
|
|
5
|
+
*/
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import { resolveSchema, getSchemaDir, ArtifactGraph, } from '../../core/artifact-graph/index.js';
|
|
9
|
+
import { FileSystemUtils } from '../../utils/file-system.js';
|
|
10
|
+
import { validateSchemaExists, DEFAULT_SCHEMA } from './shared.js';
|
|
11
|
+
import { WORKFLOW_MESSAGES } from '../../messages/index.js';
|
|
12
|
+
// -----------------------------------------------------------------------------
|
|
13
|
+
// Command Implementation
|
|
14
|
+
// -----------------------------------------------------------------------------
|
|
15
|
+
export async function templatesCommand(options) {
|
|
16
|
+
const spinner = options.json ? undefined : ora(WORKFLOW_MESSAGES.loadingTemplates).start();
|
|
17
|
+
try {
|
|
18
|
+
const projectRoot = process.cwd();
|
|
19
|
+
const schemaName = validateSchemaExists(options.schema ?? DEFAULT_SCHEMA, projectRoot);
|
|
20
|
+
const schema = resolveSchema(schemaName, projectRoot);
|
|
21
|
+
const graph = ArtifactGraph.fromSchema(schema);
|
|
22
|
+
const schemaDir = getSchemaDir(schemaName, projectRoot);
|
|
23
|
+
// Determine the source (project, user, or package)
|
|
24
|
+
const { getUserSchemasDir, getProjectSchemasDir, } = await import('../../core/artifact-graph/resolver.js');
|
|
25
|
+
const projectSchemasDir = getProjectSchemasDir(projectRoot);
|
|
26
|
+
const userSchemasDir = getUserSchemasDir();
|
|
27
|
+
// Determine source by checking if schemaDir is inside each base directory
|
|
28
|
+
// Using path.relative is more robust than startsWith for path comparisons
|
|
29
|
+
const isInsideDir = (child, parent) => {
|
|
30
|
+
const relative = path.relative(parent, child);
|
|
31
|
+
return !relative.startsWith('..') && !path.isAbsolute(relative);
|
|
32
|
+
};
|
|
33
|
+
let source;
|
|
34
|
+
if (isInsideDir(schemaDir, projectSchemasDir)) {
|
|
35
|
+
source = 'project';
|
|
36
|
+
}
|
|
37
|
+
else if (isInsideDir(schemaDir, userSchemasDir)) {
|
|
38
|
+
source = 'user';
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
source = 'package';
|
|
42
|
+
}
|
|
43
|
+
const templates = graph.getAllArtifacts().map((artifact) => ({
|
|
44
|
+
artifactId: artifact.id,
|
|
45
|
+
templatePath: FileSystemUtils.canonicalizeExistingPath(path.join(schemaDir, 'templates', artifact.template)),
|
|
46
|
+
source,
|
|
47
|
+
}));
|
|
48
|
+
spinner?.stop();
|
|
49
|
+
if (options.json) {
|
|
50
|
+
const output = {};
|
|
51
|
+
for (const t of templates) {
|
|
52
|
+
output[t.artifactId] = { path: t.templatePath, source: t.source };
|
|
53
|
+
}
|
|
54
|
+
console.log(JSON.stringify(output, null, 2));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
console.log(WORKFLOW_MESSAGES.schemaLabel3(schemaName));
|
|
58
|
+
console.log(WORKFLOW_MESSAGES.sourceLabel(source));
|
|
59
|
+
console.log();
|
|
60
|
+
for (const t of templates) {
|
|
61
|
+
console.log(`${t.artifactId}:`);
|
|
62
|
+
console.log(` ${t.templatePath}`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
spinner?.stop();
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare class ArchiveCommand {
|
|
2
|
+
execute(changeName?: string, options?: {
|
|
3
|
+
yes?: boolean;
|
|
4
|
+
skipSpecs?: boolean;
|
|
5
|
+
noValidate?: boolean;
|
|
6
|
+
validate?: boolean;
|
|
7
|
+
}): Promise<void>;
|
|
8
|
+
private selectChange;
|
|
9
|
+
private getArchiveDate;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=archive.d.ts.map
|