@bobby_z/openspec 0.0.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 +204 -0
- package/bin/openspec.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 +8 -0
- package/dist/commands/config.js +198 -0
- package/dist/commands/feedback.d.ts +9 -0
- package/dist/commands/feedback.js +183 -0
- package/dist/commands/schema.d.ts +6 -0
- package/dist/commands/schema.js +869 -0
- package/dist/commands/show.d.ts +14 -0
- package/dist/commands/show.js +132 -0
- package/dist/commands/spec.d.ts +15 -0
- package/dist/commands/spec.js +225 -0
- package/dist/commands/validate.d.ts +24 -0
- package/dist/commands/validate.js +294 -0
- package/dist/commands/workflow/index.d.ts +17 -0
- package/dist/commands/workflow/index.js +12 -0
- package/dist/commands/workflow/instructions.d.ts +29 -0
- package/dist/commands/workflow/instructions.js +381 -0
- package/dist/commands/workflow/new-change.d.ts +11 -0
- package/dist/commands/workflow/new-change.js +44 -0
- package/dist/commands/workflow/schemas.d.ts +10 -0
- package/dist/commands/workflow/schemas.js +34 -0
- package/dist/commands/workflow/shared.d.ts +52 -0
- package/dist/commands/workflow/shared.js +111 -0
- package/dist/commands/workflow/status.d.ts +14 -0
- package/dist/commands/workflow/status.js +58 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +68 -0
- package/dist/core/archive.d.ts +11 -0
- package/dist/core/archive.js +328 -0
- package/dist/core/artifact-graph/graph.d.ts +56 -0
- package/dist/core/artifact-graph/graph.js +141 -0
- package/dist/core/artifact-graph/index.d.ts +7 -0
- package/dist/core/artifact-graph/index.js +13 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +143 -0
- package/dist/core/artifact-graph/instruction-loader.js +214 -0
- package/dist/core/artifact-graph/resolver.d.ts +81 -0
- package/dist/core/artifact-graph/resolver.js +257 -0
- package/dist/core/artifact-graph/schema.d.ts +13 -0
- package/dist/core/artifact-graph/schema.js +108 -0
- package/dist/core/artifact-graph/state.d.ts +12 -0
- package/dist/core/artifact-graph/state.js +54 -0
- package/dist/core/artifact-graph/types.d.ts +45 -0
- package/dist/core/artifact-graph/types.js +43 -0
- package/dist/core/command-generation/adapters/amazon-q.d.ts +13 -0
- package/dist/core/command-generation/adapters/amazon-q.js +26 -0
- package/dist/core/command-generation/adapters/antigravity.d.ts +13 -0
- package/dist/core/command-generation/adapters/antigravity.js +26 -0
- package/dist/core/command-generation/adapters/auggie.d.ts +13 -0
- package/dist/core/command-generation/adapters/auggie.js +27 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +50 -0
- package/dist/core/command-generation/adapters/cline.d.ts +14 -0
- package/dist/core/command-generation/adapters/cline.js +27 -0
- package/dist/core/command-generation/adapters/codebuddy.d.ts +13 -0
- package/dist/core/command-generation/adapters/codebuddy.js +28 -0
- package/dist/core/command-generation/adapters/codex.d.ts +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/devagent.d.ts +15 -0
- package/dist/core/command-generation/adapters/devagent.js +28 -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 +28 -0
- package/dist/core/command-generation/adapters/index.js +28 -0
- package/dist/core/command-generation/adapters/kilocode.d.ts +14 -0
- package/dist/core/command-generation/adapters/kilocode.js +23 -0
- package/dist/core/command-generation/adapters/opencode.d.ts +13 -0
- package/dist/core/command-generation/adapters/opencode.js +29 -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 +90 -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 +454 -0
- package/dist/core/completions/completion-provider.d.ts +60 -0
- package/dist/core/completions/completion-provider.js +102 -0
- package/dist/core/completions/factory.d.ts +64 -0
- package/dist/core/completions/factory.js +75 -0
- package/dist/core/completions/generators/bash-generator.d.ts +32 -0
- package/dist/core/completions/generators/bash-generator.js +174 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +157 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +33 -0
- package/dist/core/completions/generators/powershell-generator.js +207 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +44 -0
- package/dist/core/completions/generators/zsh-generator.js +250 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +318 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +143 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +88 -0
- package/dist/core/completions/installers/powershell-installer.js +327 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +125 -0
- package/dist/core/completions/installers/zsh-installer.js +449 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +24 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +39 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +25 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +36 -0
- package/dist/core/completions/types.d.ts +79 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/config-prompts.d.ts +9 -0
- package/dist/core/config-prompts.js +34 -0
- package/dist/core/config-schema.d.ts +76 -0
- package/dist/core/config-schema.js +200 -0
- package/dist/core/config.d.ts +17 -0
- package/dist/core/config.js +175 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/global-config.d.ts +39 -0
- package/dist/core/global-config.js +115 -0
- package/dist/core/index.d.ts +2 -0
- package/dist/core/index.js +3 -0
- package/dist/core/init.d.ts +32 -0
- package/dist/core/init.js +447 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +520 -0
- package/dist/core/list.d.ts +9 -0
- package/dist/core/list.js +171 -0
- package/dist/core/parsers/change-parser.d.ts +13 -0
- package/dist/core/parsers/change-parser.js +193 -0
- package/dist/core/parsers/markdown-parser.d.ts +22 -0
- package/dist/core/parsers/markdown-parser.js +187 -0
- package/dist/core/parsers/requirement-blocks.d.ts +37 -0
- package/dist/core/parsers/requirement-blocks.js +201 -0
- package/dist/core/project-config.d.ts +64 -0
- package/dist/core/project-config.js +223 -0
- package/dist/core/schemas/base.schema.d.ts +13 -0
- package/dist/core/schemas/base.schema.js +13 -0
- package/dist/core/schemas/change.schema.d.ts +73 -0
- package/dist/core/schemas/change.schema.js +31 -0
- package/dist/core/schemas/index.d.ts +4 -0
- package/dist/core/schemas/index.js +4 -0
- package/dist/core/schemas/spec.schema.d.ts +18 -0
- package/dist/core/schemas/spec.schema.js +15 -0
- package/dist/core/shared/index.d.ts +8 -0
- package/dist/core/shared/index.js +8 -0
- package/dist/core/shared/skill-generation.d.ts +42 -0
- package/dist/core/shared/skill-generation.js +80 -0
- package/dist/core/shared/tool-detection.d.ts +66 -0
- package/dist/core/shared/tool-detection.js +140 -0
- package/dist/core/specs-apply.d.ts +73 -0
- package/dist/core/specs-apply.js +384 -0
- package/dist/core/styles/palette.d.ts +7 -0
- package/dist/core/styles/palette.js +8 -0
- package/dist/core/templates/index.d.ts +8 -0
- package/dist/core/templates/index.js +9 -0
- package/dist/core/templates/skill-templates.d.ts +122 -0
- package/dist/core/templates/skill-templates.js +3437 -0
- package/dist/core/update.d.ts +42 -0
- package/dist/core/update.js +311 -0
- package/dist/core/validation/constants.d.ts +34 -0
- package/dist/core/validation/constants.js +40 -0
- package/dist/core/validation/types.d.ts +18 -0
- package/dist/core/validation/types.js +2 -0
- package/dist/core/validation/validator.d.ts +33 -0
- package/dist/core/validation/validator.js +409 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +168 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/prompts/searchable-multi-select.d.ts +27 -0
- package/dist/prompts/searchable-multi-select.js +149 -0
- package/dist/telemetry/config.d.ts +32 -0
- package/dist/telemetry/config.js +68 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +145 -0
- package/dist/ui/ascii-patterns.d.ts +16 -0
- package/dist/ui/ascii-patterns.js +133 -0
- package/dist/ui/welcome-screen.d.ts +10 -0
- package/dist/ui/welcome-screen.js +146 -0
- package/dist/utils/change-metadata.d.ts +51 -0
- package/dist/utils/change-metadata.js +147 -0
- package/dist/utils/change-utils.d.ts +62 -0
- package/dist/utils/change-utils.js +121 -0
- package/dist/utils/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/package.json +83 -0
- package/schemas/spec-driven/schema.yaml +151 -0
- package/schemas/spec-driven/templates/design.md +21 -0
- package/schemas/spec-driven/templates/proposal.md +25 -0
- package/schemas/spec-driven/templates/spec.md +10 -0
- package/schemas/spec-driven/templates/tasks.md +9 -0
- package/scripts/postinstall.js +147 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared Utilities
|
|
3
|
+
*
|
|
4
|
+
* Common code shared between init and update commands.
|
|
5
|
+
*/
|
|
6
|
+
export { SKILL_NAMES, getToolsWithSkillsDir, getToolSkillStatus, getToolStates, extractGeneratedByVersion, getToolVersionStatus, getConfiguredTools, getAllToolVersionStatus, } from './tool-detection.js';
|
|
7
|
+
export { getSkillTemplates, getCommandTemplates, getCommandContents, generateSkillContent, } from './skill-generation.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Generation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for generating skill and command files.
|
|
5
|
+
*/
|
|
6
|
+
import { getOpsxExploreCommandTemplate, type SkillTemplate } from '../templates/skill-templates.js';
|
|
7
|
+
import type { CommandContent } from '../command-generation/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Skill template with directory name mapping.
|
|
10
|
+
*/
|
|
11
|
+
export interface SkillTemplateEntry {
|
|
12
|
+
template: SkillTemplate;
|
|
13
|
+
dirName: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Command template with ID mapping.
|
|
17
|
+
*/
|
|
18
|
+
export interface CommandTemplateEntry {
|
|
19
|
+
template: ReturnType<typeof getOpsxExploreCommandTemplate>;
|
|
20
|
+
id: string;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Gets all skill templates with their directory names.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getSkillTemplates(): SkillTemplateEntry[];
|
|
26
|
+
/**
|
|
27
|
+
* Gets all command templates with their IDs.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCommandTemplates(): CommandTemplateEntry[];
|
|
30
|
+
/**
|
|
31
|
+
* Converts command templates to CommandContent array.
|
|
32
|
+
*/
|
|
33
|
+
export declare function getCommandContents(): CommandContent[];
|
|
34
|
+
/**
|
|
35
|
+
* Generates skill file content with YAML frontmatter.
|
|
36
|
+
*
|
|
37
|
+
* @param template - The skill template
|
|
38
|
+
* @param generatedByVersion - The OpenSpec version to embed in the file
|
|
39
|
+
* @param transformInstructions - Optional callback to transform the instructions content
|
|
40
|
+
*/
|
|
41
|
+
export declare function generateSkillContent(template: SkillTemplate, generatedByVersion: string, transformInstructions?: (instructions: string) => string): string;
|
|
42
|
+
//# sourceMappingURL=skill-generation.d.ts.map
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Generation Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for generating skill and command files.
|
|
5
|
+
*/
|
|
6
|
+
import { getExploreSkillTemplate, getNewChangeSkillTemplate, getContinueChangeSkillTemplate, getApplyChangeSkillTemplate, getFfChangeSkillTemplate, getSyncSpecsSkillTemplate, getArchiveChangeSkillTemplate, getBulkArchiveChangeSkillTemplate, getVerifyChangeSkillTemplate, getOnboardSkillTemplate, getOpsxExploreCommandTemplate, getOpsxNewCommandTemplate, getOpsxContinueCommandTemplate, getOpsxApplyCommandTemplate, getOpsxFfCommandTemplate, getOpsxSyncCommandTemplate, getOpsxArchiveCommandTemplate, getOpsxBulkArchiveCommandTemplate, getOpsxVerifyCommandTemplate, getOpsxOnboardCommandTemplate, } from '../templates/skill-templates.js';
|
|
7
|
+
/**
|
|
8
|
+
* Gets all skill templates with their directory names.
|
|
9
|
+
*/
|
|
10
|
+
export function getSkillTemplates() {
|
|
11
|
+
return [
|
|
12
|
+
{ template: getExploreSkillTemplate(), dirName: 'openspec-explore' },
|
|
13
|
+
{ template: getNewChangeSkillTemplate(), dirName: 'openspec-new-change' },
|
|
14
|
+
{ template: getContinueChangeSkillTemplate(), dirName: 'openspec-continue-change' },
|
|
15
|
+
{ template: getApplyChangeSkillTemplate(), dirName: 'openspec-apply-change' },
|
|
16
|
+
{ template: getFfChangeSkillTemplate(), dirName: 'openspec-ff-change' },
|
|
17
|
+
{ template: getSyncSpecsSkillTemplate(), dirName: 'openspec-sync-specs' },
|
|
18
|
+
{ template: getArchiveChangeSkillTemplate(), dirName: 'openspec-archive-change' },
|
|
19
|
+
{ template: getBulkArchiveChangeSkillTemplate(), dirName: 'openspec-bulk-archive-change' },
|
|
20
|
+
{ template: getVerifyChangeSkillTemplate(), dirName: 'openspec-verify-change' },
|
|
21
|
+
{ template: getOnboardSkillTemplate(), dirName: 'openspec-onboard' },
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Gets all command templates with their IDs.
|
|
26
|
+
*/
|
|
27
|
+
export function getCommandTemplates() {
|
|
28
|
+
return [
|
|
29
|
+
{ template: getOpsxExploreCommandTemplate(), id: 'explore' },
|
|
30
|
+
{ template: getOpsxNewCommandTemplate(), id: 'new' },
|
|
31
|
+
{ template: getOpsxContinueCommandTemplate(), id: 'continue' },
|
|
32
|
+
{ template: getOpsxApplyCommandTemplate(), id: 'apply' },
|
|
33
|
+
{ template: getOpsxFfCommandTemplate(), id: 'ff' },
|
|
34
|
+
{ template: getOpsxSyncCommandTemplate(), id: 'sync' },
|
|
35
|
+
{ template: getOpsxArchiveCommandTemplate(), id: 'archive' },
|
|
36
|
+
{ template: getOpsxBulkArchiveCommandTemplate(), id: 'bulk-archive' },
|
|
37
|
+
{ template: getOpsxVerifyCommandTemplate(), id: 'verify' },
|
|
38
|
+
{ template: getOpsxOnboardCommandTemplate(), id: 'onboard' },
|
|
39
|
+
];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Converts command templates to CommandContent array.
|
|
43
|
+
*/
|
|
44
|
+
export function getCommandContents() {
|
|
45
|
+
const commandTemplates = getCommandTemplates();
|
|
46
|
+
return commandTemplates.map(({ template, id }) => ({
|
|
47
|
+
id,
|
|
48
|
+
name: template.name,
|
|
49
|
+
description: template.description,
|
|
50
|
+
category: template.category,
|
|
51
|
+
tags: template.tags,
|
|
52
|
+
body: template.content,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Generates skill file content with YAML frontmatter.
|
|
57
|
+
*
|
|
58
|
+
* @param template - The skill template
|
|
59
|
+
* @param generatedByVersion - The OpenSpec version to embed in the file
|
|
60
|
+
* @param transformInstructions - Optional callback to transform the instructions content
|
|
61
|
+
*/
|
|
62
|
+
export function generateSkillContent(template, generatedByVersion, transformInstructions) {
|
|
63
|
+
const instructions = transformInstructions
|
|
64
|
+
? transformInstructions(template.instructions)
|
|
65
|
+
: template.instructions;
|
|
66
|
+
return `---
|
|
67
|
+
name: ${template.name}
|
|
68
|
+
description: ${template.description}
|
|
69
|
+
license: ${template.license || 'MIT'}
|
|
70
|
+
compatibility: ${template.compatibility || 'Requires openspec CLI.'}
|
|
71
|
+
metadata:
|
|
72
|
+
author: ${template.metadata?.author || 'openspec'}
|
|
73
|
+
version: "${template.metadata?.version || '1.0'}"
|
|
74
|
+
generatedBy: "${generatedByVersion}"
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
${instructions}
|
|
78
|
+
`;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=skill-generation.js.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Detection Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for detecting tool configurations and version status.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Names of skill directories created by openspec init.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SKILL_NAMES: readonly ["openspec-explore", "openspec-new-change", "openspec-continue-change", "openspec-apply-change", "openspec-ff-change", "openspec-sync-specs", "openspec-archive-change", "openspec-bulk-archive-change", "openspec-verify-change"];
|
|
10
|
+
export type SkillName = (typeof SKILL_NAMES)[number];
|
|
11
|
+
/**
|
|
12
|
+
* Status of skill configuration for a tool.
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolSkillStatus {
|
|
15
|
+
/** Whether the tool has any skills configured */
|
|
16
|
+
configured: boolean;
|
|
17
|
+
/** Whether all 9 skills are configured */
|
|
18
|
+
fullyConfigured: boolean;
|
|
19
|
+
/** Number of skills currently configured (0-9) */
|
|
20
|
+
skillCount: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Version information for a tool's skills.
|
|
24
|
+
*/
|
|
25
|
+
export interface ToolVersionStatus {
|
|
26
|
+
/** The tool ID */
|
|
27
|
+
toolId: string;
|
|
28
|
+
/** The tool's display name */
|
|
29
|
+
toolName: string;
|
|
30
|
+
/** Whether the tool has any skills configured */
|
|
31
|
+
configured: boolean;
|
|
32
|
+
/** The generatedBy version found in the skill files, or null if not found */
|
|
33
|
+
generatedByVersion: string | null;
|
|
34
|
+
/** Whether the tool needs updating (version mismatch or missing) */
|
|
35
|
+
needsUpdate: boolean;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Gets the list of tools with skillsDir configured.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getToolsWithSkillsDir(): string[];
|
|
41
|
+
/**
|
|
42
|
+
* Checks which skill files exist for a tool.
|
|
43
|
+
*/
|
|
44
|
+
export declare function getToolSkillStatus(projectRoot: string, toolId: string): ToolSkillStatus;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the skill status for all tools with skillsDir configured.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getToolStates(projectRoot: string): Map<string, ToolSkillStatus>;
|
|
49
|
+
/**
|
|
50
|
+
* Extracts the generatedBy version from a skill file's YAML frontmatter.
|
|
51
|
+
* Returns null if the field is not found or the file doesn't exist.
|
|
52
|
+
*/
|
|
53
|
+
export declare function extractGeneratedByVersion(skillFilePath: string): string | null;
|
|
54
|
+
/**
|
|
55
|
+
* Gets version status for a tool by reading the first available skill file.
|
|
56
|
+
*/
|
|
57
|
+
export declare function getToolVersionStatus(projectRoot: string, toolId: string, currentVersion: string): ToolVersionStatus;
|
|
58
|
+
/**
|
|
59
|
+
* Gets all configured tools in the project.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getConfiguredTools(projectRoot: string): string[];
|
|
62
|
+
/**
|
|
63
|
+
* Gets version status for all configured tools.
|
|
64
|
+
*/
|
|
65
|
+
export declare function getAllToolVersionStatus(projectRoot: string, currentVersion: string): ToolVersionStatus[];
|
|
66
|
+
//# sourceMappingURL=tool-detection.d.ts.map
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool Detection Utilities
|
|
3
|
+
*
|
|
4
|
+
* Shared utilities for detecting tool configurations and version status.
|
|
5
|
+
*/
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import * as fs from 'fs';
|
|
8
|
+
import { AI_TOOLS } from '../config.js';
|
|
9
|
+
/**
|
|
10
|
+
* Names of skill directories created by openspec init.
|
|
11
|
+
*/
|
|
12
|
+
export const SKILL_NAMES = [
|
|
13
|
+
'openspec-explore',
|
|
14
|
+
'openspec-new-change',
|
|
15
|
+
'openspec-continue-change',
|
|
16
|
+
'openspec-apply-change',
|
|
17
|
+
'openspec-ff-change',
|
|
18
|
+
'openspec-sync-specs',
|
|
19
|
+
'openspec-archive-change',
|
|
20
|
+
'openspec-bulk-archive-change',
|
|
21
|
+
'openspec-verify-change',
|
|
22
|
+
];
|
|
23
|
+
/**
|
|
24
|
+
* Gets the list of tools with skillsDir configured.
|
|
25
|
+
*/
|
|
26
|
+
export function getToolsWithSkillsDir() {
|
|
27
|
+
return AI_TOOLS.filter((t) => t.skillsDir).map((t) => t.value);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Checks which skill files exist for a tool.
|
|
31
|
+
*/
|
|
32
|
+
export function getToolSkillStatus(projectRoot, toolId) {
|
|
33
|
+
const tool = AI_TOOLS.find((t) => t.value === toolId);
|
|
34
|
+
if (!tool?.skillsDir) {
|
|
35
|
+
return { configured: false, fullyConfigured: false, skillCount: 0 };
|
|
36
|
+
}
|
|
37
|
+
const skillsDir = path.join(projectRoot, tool.skillsDir, 'skills');
|
|
38
|
+
let skillCount = 0;
|
|
39
|
+
for (const skillName of SKILL_NAMES) {
|
|
40
|
+
const skillFile = path.join(skillsDir, skillName, 'SKILL.md');
|
|
41
|
+
if (fs.existsSync(skillFile)) {
|
|
42
|
+
skillCount++;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return {
|
|
46
|
+
configured: skillCount > 0,
|
|
47
|
+
fullyConfigured: skillCount === SKILL_NAMES.length,
|
|
48
|
+
skillCount,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Gets the skill status for all tools with skillsDir configured.
|
|
53
|
+
*/
|
|
54
|
+
export function getToolStates(projectRoot) {
|
|
55
|
+
const states = new Map();
|
|
56
|
+
const toolIds = AI_TOOLS.filter((t) => t.skillsDir).map((t) => t.value);
|
|
57
|
+
for (const toolId of toolIds) {
|
|
58
|
+
states.set(toolId, getToolSkillStatus(projectRoot, toolId));
|
|
59
|
+
}
|
|
60
|
+
return states;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Extracts the generatedBy version from a skill file's YAML frontmatter.
|
|
64
|
+
* Returns null if the field is not found or the file doesn't exist.
|
|
65
|
+
*/
|
|
66
|
+
export function extractGeneratedByVersion(skillFilePath) {
|
|
67
|
+
try {
|
|
68
|
+
if (!fs.existsSync(skillFilePath)) {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
const content = fs.readFileSync(skillFilePath, 'utf-8');
|
|
72
|
+
// Look for generatedBy in the YAML frontmatter
|
|
73
|
+
// The file format is:
|
|
74
|
+
// ---
|
|
75
|
+
// ...
|
|
76
|
+
// metadata:
|
|
77
|
+
// author: openspec
|
|
78
|
+
// version: "1.0"
|
|
79
|
+
// generatedBy: "0.23.0"
|
|
80
|
+
// ---
|
|
81
|
+
const generatedByMatch = content.match(/^\s*generatedBy:\s*["']?([^"'\n]+)["']?\s*$/m);
|
|
82
|
+
if (generatedByMatch && generatedByMatch[1]) {
|
|
83
|
+
return generatedByMatch[1].trim();
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets version status for a tool by reading the first available skill file.
|
|
93
|
+
*/
|
|
94
|
+
export function getToolVersionStatus(projectRoot, toolId, currentVersion) {
|
|
95
|
+
const tool = AI_TOOLS.find((t) => t.value === toolId);
|
|
96
|
+
if (!tool?.skillsDir) {
|
|
97
|
+
return {
|
|
98
|
+
toolId,
|
|
99
|
+
toolName: toolId,
|
|
100
|
+
configured: false,
|
|
101
|
+
generatedByVersion: null,
|
|
102
|
+
needsUpdate: false,
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const skillsDir = path.join(projectRoot, tool.skillsDir, 'skills');
|
|
106
|
+
let generatedByVersion = null;
|
|
107
|
+
// Find the first skill file that exists and read its version
|
|
108
|
+
for (const skillName of SKILL_NAMES) {
|
|
109
|
+
const skillFile = path.join(skillsDir, skillName, 'SKILL.md');
|
|
110
|
+
if (fs.existsSync(skillFile)) {
|
|
111
|
+
generatedByVersion = extractGeneratedByVersion(skillFile);
|
|
112
|
+
break;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const configured = getToolSkillStatus(projectRoot, toolId).configured;
|
|
116
|
+
const needsUpdate = configured && (generatedByVersion === null || generatedByVersion !== currentVersion);
|
|
117
|
+
return {
|
|
118
|
+
toolId,
|
|
119
|
+
toolName: tool.name,
|
|
120
|
+
configured,
|
|
121
|
+
generatedByVersion,
|
|
122
|
+
needsUpdate,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Gets all configured tools in the project.
|
|
127
|
+
*/
|
|
128
|
+
export function getConfiguredTools(projectRoot) {
|
|
129
|
+
return AI_TOOLS
|
|
130
|
+
.filter((t) => t.skillsDir && getToolSkillStatus(projectRoot, t.value).configured)
|
|
131
|
+
.map((t) => t.value);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Gets version status for all configured tools.
|
|
135
|
+
*/
|
|
136
|
+
export function getAllToolVersionStatus(projectRoot, currentVersion) {
|
|
137
|
+
const configuredTools = getConfiguredTools(projectRoot);
|
|
138
|
+
return configuredTools.map((toolId) => getToolVersionStatus(projectRoot, toolId, currentVersion));
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=tool-detection.js.map
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Spec Application Logic
|
|
3
|
+
*
|
|
4
|
+
* Extracted from ArchiveCommand to enable standalone spec application.
|
|
5
|
+
* Applies delta specs from a change to main specs without archiving.
|
|
6
|
+
*/
|
|
7
|
+
export interface SpecUpdate {
|
|
8
|
+
source: string;
|
|
9
|
+
target: string;
|
|
10
|
+
exists: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface ApplyResult {
|
|
13
|
+
capability: string;
|
|
14
|
+
added: number;
|
|
15
|
+
modified: number;
|
|
16
|
+
removed: number;
|
|
17
|
+
renamed: number;
|
|
18
|
+
}
|
|
19
|
+
export interface SpecsApplyOutput {
|
|
20
|
+
changeName: string;
|
|
21
|
+
capabilities: ApplyResult[];
|
|
22
|
+
totals: {
|
|
23
|
+
added: number;
|
|
24
|
+
modified: number;
|
|
25
|
+
removed: number;
|
|
26
|
+
renamed: number;
|
|
27
|
+
};
|
|
28
|
+
noChanges: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Find all delta spec files that need to be applied from a change.
|
|
32
|
+
*/
|
|
33
|
+
export declare function findSpecUpdates(changeDir: string, mainSpecsDir: string): Promise<SpecUpdate[]>;
|
|
34
|
+
/**
|
|
35
|
+
* Build an updated spec by applying delta operations.
|
|
36
|
+
* Returns the rebuilt content and counts of operations.
|
|
37
|
+
*/
|
|
38
|
+
export declare function buildUpdatedSpec(update: SpecUpdate, changeName: string): Promise<{
|
|
39
|
+
rebuilt: string;
|
|
40
|
+
counts: {
|
|
41
|
+
added: number;
|
|
42
|
+
modified: number;
|
|
43
|
+
removed: number;
|
|
44
|
+
renamed: number;
|
|
45
|
+
};
|
|
46
|
+
}>;
|
|
47
|
+
/**
|
|
48
|
+
* Write an updated spec to disk.
|
|
49
|
+
*/
|
|
50
|
+
export declare function writeUpdatedSpec(update: SpecUpdate, rebuilt: string, counts: {
|
|
51
|
+
added: number;
|
|
52
|
+
modified: number;
|
|
53
|
+
removed: number;
|
|
54
|
+
renamed: number;
|
|
55
|
+
}): Promise<void>;
|
|
56
|
+
/**
|
|
57
|
+
* Build a skeleton spec for new capabilities.
|
|
58
|
+
*/
|
|
59
|
+
export declare function buildSpecSkeleton(specFolderName: string, changeName: string): string;
|
|
60
|
+
/**
|
|
61
|
+
* Apply all delta specs from a change to main specs.
|
|
62
|
+
*
|
|
63
|
+
* @param projectRoot - The project root directory
|
|
64
|
+
* @param changeName - The name of the change to apply
|
|
65
|
+
* @param options - Options for the operation
|
|
66
|
+
* @returns Result of the operation with counts
|
|
67
|
+
*/
|
|
68
|
+
export declare function applySpecs(projectRoot: string, changeName: string, options?: {
|
|
69
|
+
dryRun?: boolean;
|
|
70
|
+
skipValidation?: boolean;
|
|
71
|
+
silent?: boolean;
|
|
72
|
+
}): Promise<SpecsApplyOutput>;
|
|
73
|
+
//# sourceMappingURL=specs-apply.d.ts.map
|