@codewalla_india/openspec 1.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 +225 -0
- package/bin/openspec.js +5 -0
- package/dist/cli/index.d.ts +10 -0
- package/dist/cli/index.js +548 -0
- package/dist/commands/change.d.ts +39 -0
- package/dist/commands/change.js +279 -0
- package/dist/commands/completion.d.ts +72 -0
- package/dist/commands/completion.js +264 -0
- package/dist/commands/config.d.ts +36 -0
- package/dist/commands/config.js +552 -0
- package/dist/commands/context.d.ts +3 -0
- package/dist/commands/context.js +155 -0
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.js +163 -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/shared-gather.d.ts +14 -0
- package/dist/commands/shared-gather.js +31 -0
- package/dist/commands/shared-output.d.ts +18 -0
- package/dist/commands/shared-output.js +61 -0
- package/dist/commands/show.d.ts +19 -0
- package/dist/commands/show.js +177 -0
- package/dist/commands/spec.d.ts +19 -0
- package/dist/commands/spec.js +236 -0
- package/dist/commands/store.d.ts +3 -0
- package/dist/commands/store.js +547 -0
- package/dist/commands/validate.d.ts +26 -0
- package/dist/commands/validate.js +330 -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 +45 -0
- package/dist/commands/workflow/instructions.js +500 -0
- package/dist/commands/workflow/new-change.d.ts +20 -0
- package/dist/commands/workflow/new-change.js +106 -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 +84 -0
- package/dist/commands/workflow/shared.js +133 -0
- package/dist/commands/workflow/status.d.ts +16 -0
- package/dist/commands/workflow/status.js +92 -0
- package/dist/commands/workflow/templates.d.ts +16 -0
- package/dist/commands/workflow/templates.js +69 -0
- package/dist/commands/workset-input.d.ts +19 -0
- package/dist/commands/workset-input.js +112 -0
- package/dist/commands/workset-prompts.d.ts +12 -0
- package/dist/commands/workset-prompts.js +143 -0
- package/dist/commands/workset.d.ts +25 -0
- package/dist/commands/workset.js +446 -0
- package/dist/core/archive.d.ts +22 -0
- package/dist/core/archive.js +471 -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 +9 -0
- package/dist/core/artifact-graph/index.js +14 -0
- package/dist/core/artifact-graph/instruction-loader.d.ts +188 -0
- package/dist/core/artifact-graph/instruction-loader.js +233 -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 +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 +31 -0
- package/dist/core/artifact-graph/types.d.ts +40 -0
- package/dist/core/artifact-graph/types.js +29 -0
- package/dist/core/available-tools.d.ts +17 -0
- package/dist/core/available-tools.js +43 -0
- package/dist/core/change-metadata/index.d.ts +2 -0
- package/dist/core/change-metadata/index.js +2 -0
- package/dist/core/change-metadata/schema.d.ts +19 -0
- package/dist/core/change-metadata/schema.js +30 -0
- package/dist/core/change-status-policy.d.ts +37 -0
- package/dist/core/change-status-policy.js +35 -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 +32 -0
- package/dist/core/command-generation/adapters/claude.d.ts +13 -0
- package/dist/core/command-generation/adapters/claude.js +37 -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 +31 -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 +42 -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 +38 -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/command-generation/yaml.d.ts +22 -0
- package/dist/core/command-generation/yaml.js +38 -0
- package/dist/core/completions/command-registry.d.ts +3 -0
- package/dist/core/completions/command-registry.js +778 -0
- package/dist/core/completions/completion-provider.d.ts +71 -0
- package/dist/core/completions/completion-provider.js +129 -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 +35 -0
- package/dist/core/completions/generators/bash-generator.js +230 -0
- package/dist/core/completions/generators/fish-generator.d.ts +32 -0
- package/dist/core/completions/generators/fish-generator.js +160 -0
- package/dist/core/completions/generators/powershell-generator.d.ts +36 -0
- package/dist/core/completions/generators/powershell-generator.js +266 -0
- package/dist/core/completions/generators/zsh-generator.d.ts +47 -0
- package/dist/core/completions/generators/zsh-generator.js +276 -0
- package/dist/core/completions/installers/bash-installer.d.ts +87 -0
- package/dist/core/completions/installers/bash-installer.js +321 -0
- package/dist/core/completions/installers/fish-installer.d.ts +43 -0
- package/dist/core/completions/installers/fish-installer.js +151 -0
- package/dist/core/completions/installers/powershell-installer.d.ts +102 -0
- package/dist/core/completions/installers/powershell-installer.js +415 -0
- package/dist/core/completions/installers/zsh-installer.d.ts +117 -0
- package/dist/core/completions/installers/zsh-installer.js +424 -0
- package/dist/core/completions/shared-flags.d.ts +13 -0
- package/dist/core/completions/shared-flags.js +33 -0
- package/dist/core/completions/templates/bash-templates.d.ts +6 -0
- package/dist/core/completions/templates/bash-templates.js +30 -0
- package/dist/core/completions/templates/fish-templates.d.ts +7 -0
- package/dist/core/completions/templates/fish-templates.js +45 -0
- package/dist/core/completions/templates/powershell-templates.d.ts +6 -0
- package/dist/core/completions/templates/powershell-templates.js +34 -0
- package/dist/core/completions/templates/zsh-templates.d.ts +6 -0
- package/dist/core/completions/templates/zsh-templates.js +45 -0
- package/dist/core/completions/types.d.ts +101 -0
- package/dist/core/completions/types.js +2 -0
- package/dist/core/comprehension/config.d.ts +20 -0
- package/dist/core/comprehension/config.js +23 -0
- package/dist/core/comprehension/fingerprint.d.ts +5 -0
- package/dist/core/comprehension/fingerprint.js +25 -0
- package/dist/core/comprehension/index.d.ts +49 -0
- package/dist/core/comprehension/index.js +78 -0
- package/dist/core/comprehension/pass-record.d.ts +29 -0
- package/dist/core/comprehension/pass-record.js +64 -0
- package/dist/core/comprehension/stats.d.ts +18 -0
- package/dist/core/comprehension/stats.js +41 -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 +87 -0
- package/dist/core/config-schema.js +239 -0
- package/dist/core/config.d.ts +18 -0
- package/dist/core/config.js +39 -0
- package/dist/core/converters/json-converter.d.ts +6 -0
- package/dist/core/converters/json-converter.js +51 -0
- package/dist/core/file-state.d.ts +36 -0
- package/dist/core/file-state.js +112 -0
- package/dist/core/global-config.d.ts +51 -0
- package/dist/core/global-config.js +124 -0
- package/dist/core/id.d.ts +17 -0
- package/dist/core/id.js +30 -0
- package/dist/core/index.d.ts +6 -0
- package/dist/core/index.js +7 -0
- package/dist/core/init.d.ts +37 -0
- package/dist/core/init.js +613 -0
- package/dist/core/legacy-cleanup.d.ts +162 -0
- package/dist/core/legacy-cleanup.js +514 -0
- package/dist/core/list.d.ts +11 -0
- package/dist/core/list.js +185 -0
- package/dist/core/migration.d.ts +23 -0
- package/dist/core/migration.js +108 -0
- package/dist/core/openers.d.ts +77 -0
- package/dist/core/openers.js +251 -0
- package/dist/core/openspec-root.d.ts +45 -0
- package/dist/core/openspec-root.js +192 -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 +227 -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/planning-home.d.ts +16 -0
- package/dist/core/planning-home.js +67 -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 +120 -0
- package/dist/core/project-config.js +406 -0
- package/dist/core/references.d.ts +63 -0
- package/dist/core/references.js +310 -0
- package/dist/core/relationship-health.d.ts +65 -0
- package/dist/core/relationship-health.js +64 -0
- package/dist/core/root-selection.d.ts +122 -0
- package/dist/core/root-selection.js +337 -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 +78 -0
- package/dist/core/specs-apply.js +394 -0
- package/dist/core/store/errors.d.ts +20 -0
- package/dist/core/store/errors.js +22 -0
- package/dist/core/store/foundation.d.ts +56 -0
- package/dist/core/store/foundation.js +251 -0
- package/dist/core/store/git.d.ts +23 -0
- package/dist/core/store/git.js +137 -0
- package/dist/core/store/index.d.ts +5 -0
- package/dist/core/store/index.js +5 -0
- package/dist/core/store/operations.d.ts +114 -0
- package/dist/core/store/operations.js +783 -0
- package/dist/core/store/registry.d.ts +58 -0
- package/dist/core/store/registry.js +275 -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 +337 -0
- package/dist/core/templates/workflows/archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/archive-change.js +278 -0
- package/dist/core/templates/workflows/bulk-archive-change.d.ts +10 -0
- package/dist/core/templates/workflows/bulk-archive-change.js +493 -0
- package/dist/core/templates/workflows/comprehension-guidance.d.ts +9 -0
- package/dist/core/templates/workflows/comprehension-guidance.js +58 -0
- package/dist/core/templates/workflows/continue-change.d.ts +10 -0
- package/dist/core/templates/workflows/continue-change.js +239 -0
- package/dist/core/templates/workflows/explore.d.ts +10 -0
- package/dist/core/templates/workflows/explore.js +464 -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 +205 -0
- package/dist/core/templates/workflows/mcp-guidance.d.ts +13 -0
- package/dist/core/templates/workflows/mcp-guidance.js +116 -0
- package/dist/core/templates/workflows/new-change.d.ts +10 -0
- package/dist/core/templates/workflows/new-change.js +148 -0
- package/dist/core/templates/workflows/onboard.d.ts +10 -0
- package/dist/core/templates/workflows/onboard.js +566 -0
- package/dist/core/templates/workflows/propose.d.ts +10 -0
- package/dist/core/templates/workflows/propose.js +228 -0
- package/dist/core/templates/workflows/store-selection.d.ts +8 -0
- package/dist/core/templates/workflows/store-selection.js +8 -0
- package/dist/core/templates/workflows/sync-specs.d.ts +10 -0
- package/dist/core/templates/workflows/sync-specs.js +291 -0
- package/dist/core/templates/workflows/verify-change.d.ts +10 -0
- package/dist/core/templates/workflows/verify-change.js +346 -0
- package/dist/core/update.d.ts +82 -0
- package/dist/core/update.js +557 -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 +44 -0
- package/dist/core/validation/validator.js +435 -0
- package/dist/core/view.d.ts +8 -0
- package/dist/core/view.js +168 -0
- package/dist/core/working-set.d.ts +47 -0
- package/dist/core/working-set.js +43 -0
- package/dist/core/worksets.d.ts +75 -0
- package/dist/core/worksets.js +245 -0
- package/dist/core/zod-issues.d.ts +4 -0
- package/dist/core/zod-issues.js +10 -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 +38 -0
- package/dist/telemetry/config.js +136 -0
- package/dist/telemetry/index.d.ts +31 -0
- package/dist/telemetry/index.js +164 -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 +55 -0
- package/dist/utils/change-metadata.js +141 -0
- package/dist/utils/change-utils.d.ts +71 -0
- package/dist/utils/change-utils.js +138 -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 +320 -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 +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,101 @@
|
|
|
1
|
+
import { SupportedShell } from '../../utils/shell-detection.js';
|
|
2
|
+
/**
|
|
3
|
+
* Definition of a command-line flag/option
|
|
4
|
+
*/
|
|
5
|
+
export interface FlagDefinition {
|
|
6
|
+
/**
|
|
7
|
+
* Flag name without dashes (e.g., "json", "strict", "no-interactive")
|
|
8
|
+
*/
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* Short flag name without dash (e.g., "y" for "-y")
|
|
12
|
+
*/
|
|
13
|
+
short?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Human-readable description of what the flag does
|
|
16
|
+
*/
|
|
17
|
+
description: string;
|
|
18
|
+
/**
|
|
19
|
+
* Whether the flag takes an argument value
|
|
20
|
+
*/
|
|
21
|
+
takesValue?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Possible values for the flag (for completion suggestions)
|
|
24
|
+
*/
|
|
25
|
+
values?: string[];
|
|
26
|
+
}
|
|
27
|
+
export type PositionalType = 'change-id' | 'spec-id' | 'change-or-spec-id' | 'path' | 'shell' | 'schema-name';
|
|
28
|
+
/**
|
|
29
|
+
* Definition of a positional argument.
|
|
30
|
+
*/
|
|
31
|
+
export interface PositionalDefinition {
|
|
32
|
+
/**
|
|
33
|
+
* Positional name used in generated shell metadata.
|
|
34
|
+
*/
|
|
35
|
+
name: string;
|
|
36
|
+
/**
|
|
37
|
+
* Type of positional argument for dynamic completion.
|
|
38
|
+
*/
|
|
39
|
+
type?: PositionalType;
|
|
40
|
+
/**
|
|
41
|
+
* Whether this positional is optional in the CLI syntax.
|
|
42
|
+
*/
|
|
43
|
+
optional?: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Definition of a CLI command
|
|
47
|
+
*/
|
|
48
|
+
export interface CommandDefinition {
|
|
49
|
+
/**
|
|
50
|
+
* Command name (e.g., "init", "validate", "show")
|
|
51
|
+
*/
|
|
52
|
+
name: string;
|
|
53
|
+
/**
|
|
54
|
+
* Human-readable description of the command
|
|
55
|
+
*/
|
|
56
|
+
description: string;
|
|
57
|
+
/**
|
|
58
|
+
* Flags/options supported by this command
|
|
59
|
+
*/
|
|
60
|
+
flags: FlagDefinition[];
|
|
61
|
+
/**
|
|
62
|
+
* Subcommands (e.g., "change show", "spec validate")
|
|
63
|
+
*/
|
|
64
|
+
subcommands?: CommandDefinition[];
|
|
65
|
+
/**
|
|
66
|
+
* Whether this command accepts a positional argument (e.g., item name, path)
|
|
67
|
+
*/
|
|
68
|
+
acceptsPositional?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Type of positional argument for dynamic completion
|
|
71
|
+
* - 'change-id': Complete with active change IDs
|
|
72
|
+
* - 'spec-id': Complete with spec IDs
|
|
73
|
+
* - 'change-or-spec-id': Complete with both changes and specs
|
|
74
|
+
* - 'path': Complete with file paths
|
|
75
|
+
* - 'shell': Complete with supported shell names
|
|
76
|
+
* - 'schema-name': Complete with available schema names
|
|
77
|
+
* - undefined: No specific completion
|
|
78
|
+
*/
|
|
79
|
+
positionalType?: PositionalType;
|
|
80
|
+
/**
|
|
81
|
+
* Ordered positional arguments when a command accepts more than one.
|
|
82
|
+
*/
|
|
83
|
+
positionals?: PositionalDefinition[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Interface for shell-specific completion script generators
|
|
87
|
+
*/
|
|
88
|
+
export interface CompletionGenerator {
|
|
89
|
+
/**
|
|
90
|
+
* The shell type this generator targets
|
|
91
|
+
*/
|
|
92
|
+
readonly shell: SupportedShell;
|
|
93
|
+
/**
|
|
94
|
+
* Generate the completion script content
|
|
95
|
+
*
|
|
96
|
+
* @param commands - Command definitions to generate completions for
|
|
97
|
+
* @returns The shell-specific completion script as a string
|
|
98
|
+
*/
|
|
99
|
+
generate(commands: CommandDefinition[]): string;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ProjectConfig } from '../project-config.js';
|
|
2
|
+
export interface ComprehensionConfig {
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
thresholdPercent: number;
|
|
5
|
+
minQuestions: number;
|
|
6
|
+
maxQuestions: number;
|
|
7
|
+
}
|
|
8
|
+
export declare const DEFAULT_COMPREHENSION_CONFIG: ComprehensionConfig;
|
|
9
|
+
export interface ComprehensionConfigInput {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
threshold_percent?: number;
|
|
12
|
+
min_questions?: number;
|
|
13
|
+
max_questions?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Resolve comprehension settings from project config.
|
|
17
|
+
* Defaults apply when config is missing or fields are absent.
|
|
18
|
+
*/
|
|
19
|
+
export declare function resolveComprehensionConfig(projectConfig: ProjectConfig | null | undefined): ComprehensionConfig;
|
|
20
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const DEFAULT_COMPREHENSION_CONFIG = {
|
|
2
|
+
enabled: true,
|
|
3
|
+
thresholdPercent: 80,
|
|
4
|
+
minQuestions: 5,
|
|
5
|
+
maxQuestions: 10,
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Resolve comprehension settings from project config.
|
|
9
|
+
* Defaults apply when config is missing or fields are absent.
|
|
10
|
+
*/
|
|
11
|
+
export function resolveComprehensionConfig(projectConfig) {
|
|
12
|
+
const raw = projectConfig?.comprehension;
|
|
13
|
+
if (!raw) {
|
|
14
|
+
return { ...DEFAULT_COMPREHENSION_CONFIG };
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
enabled: raw.enabled ?? DEFAULT_COMPREHENSION_CONFIG.enabled,
|
|
18
|
+
thresholdPercent: raw.thresholdPercent ?? DEFAULT_COMPREHENSION_CONFIG.thresholdPercent,
|
|
19
|
+
minQuestions: raw.minQuestions ?? DEFAULT_COMPREHENSION_CONFIG.minQuestions,
|
|
20
|
+
maxQuestions: raw.maxQuestions ?? DEFAULT_COMPREHENSION_CONFIG.maxQuestions,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
3
|
+
/**
|
|
4
|
+
* SHA-256 fingerprint of delta spec and optional tasks file contents.
|
|
5
|
+
*/
|
|
6
|
+
export function fingerprintSpecFiles(specPaths, tasksPath) {
|
|
7
|
+
const sorted = [...specPaths].sort();
|
|
8
|
+
const hash = createHash('sha256');
|
|
9
|
+
for (const specPath of sorted) {
|
|
10
|
+
hash.update('spec:');
|
|
11
|
+
hash.update(specPath);
|
|
12
|
+
hash.update('\0');
|
|
13
|
+
hash.update(readFileSync(specPath, 'utf-8'));
|
|
14
|
+
hash.update('\0');
|
|
15
|
+
}
|
|
16
|
+
if (tasksPath && existsSync(tasksPath)) {
|
|
17
|
+
hash.update('tasks:');
|
|
18
|
+
hash.update(tasksPath);
|
|
19
|
+
hash.update('\0');
|
|
20
|
+
hash.update(readFileSync(tasksPath, 'utf-8'));
|
|
21
|
+
hash.update('\0');
|
|
22
|
+
}
|
|
23
|
+
return hash.digest('hex');
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=fingerprint.js.map
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { ProjectConfig } from '../project-config.js';
|
|
2
|
+
import { type ComprehensionPassRecord } from './pass-record.js';
|
|
3
|
+
export { DEFAULT_COMPREHENSION_CONFIG, resolveComprehensionConfig, type ComprehensionConfig, } from './config.js';
|
|
4
|
+
export { fingerprintSpecFiles } from './fingerprint.js';
|
|
5
|
+
export { COMPREHENSION_PASS_FILENAME, COMPREHENSION_SESSION_FILENAME, buildPassRecord, deleteSessionRecord, isPassValid, readPassRecord, writePassRecord, type ComprehensionPassRecord, } from './pass-record.js';
|
|
6
|
+
export { computeQuestionCount, computeSpecStats, countSpecStats, type SpecStats } from './stats.js';
|
|
7
|
+
export interface ComprehensionGateInfo {
|
|
8
|
+
required: boolean;
|
|
9
|
+
passed: boolean;
|
|
10
|
+
thresholdPercent: number;
|
|
11
|
+
bestScorePercent?: number;
|
|
12
|
+
questionCount: number;
|
|
13
|
+
requirementCount: number;
|
|
14
|
+
scenarioCount: number;
|
|
15
|
+
pendingTaskCount: number;
|
|
16
|
+
attempts?: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ComprehensionGateOptions {
|
|
19
|
+
tasksPath?: string | null;
|
|
20
|
+
pendingTaskCount?: number;
|
|
21
|
+
}
|
|
22
|
+
export interface ComprehensionGateResult {
|
|
23
|
+
active: boolean;
|
|
24
|
+
passed: boolean;
|
|
25
|
+
info?: ComprehensionGateInfo;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Evaluate whether apply is blocked by the comprehension gate.
|
|
29
|
+
*/
|
|
30
|
+
export declare function checkComprehensionGate(changeDir: string, specPaths: string[], projectConfig: ProjectConfig | null | undefined, gateOptions?: ComprehensionGateOptions): ComprehensionGateResult;
|
|
31
|
+
export declare class ComprehensionPassError extends Error {
|
|
32
|
+
readonly score: number;
|
|
33
|
+
readonly threshold: number;
|
|
34
|
+
constructor(message: string, score: number, threshold: number);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Record a comprehension pass after quiz success.
|
|
38
|
+
*/
|
|
39
|
+
export declare function recordComprehensionPass(input: {
|
|
40
|
+
changeDir: string;
|
|
41
|
+
specPaths: string[];
|
|
42
|
+
tasksPath?: string | null;
|
|
43
|
+
projectConfig: ProjectConfig | null | undefined;
|
|
44
|
+
scorePercent: number;
|
|
45
|
+
attempt: number;
|
|
46
|
+
questionCount: number;
|
|
47
|
+
pendingTaskCount?: number;
|
|
48
|
+
}): ComprehensionPassRecord;
|
|
49
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { resolveComprehensionConfig } from './config.js';
|
|
2
|
+
import { fingerprintSpecFiles } from './fingerprint.js';
|
|
3
|
+
import { buildPassRecord, deleteSessionRecord, isPassValid, readPassRecord, writePassRecord, } from './pass-record.js';
|
|
4
|
+
import { computeSpecStats } from './stats.js';
|
|
5
|
+
export { DEFAULT_COMPREHENSION_CONFIG, resolveComprehensionConfig, } from './config.js';
|
|
6
|
+
export { fingerprintSpecFiles } from './fingerprint.js';
|
|
7
|
+
export { COMPREHENSION_PASS_FILENAME, COMPREHENSION_SESSION_FILENAME, buildPassRecord, deleteSessionRecord, isPassValid, readPassRecord, writePassRecord, } from './pass-record.js';
|
|
8
|
+
export { computeQuestionCount, computeSpecStats, countSpecStats } from './stats.js';
|
|
9
|
+
/**
|
|
10
|
+
* Evaluate whether apply is blocked by the comprehension gate.
|
|
11
|
+
*/
|
|
12
|
+
export function checkComprehensionGate(changeDir, specPaths, projectConfig, gateOptions = {}) {
|
|
13
|
+
const config = resolveComprehensionConfig(projectConfig);
|
|
14
|
+
const pendingTaskCount = gateOptions.pendingTaskCount ?? 0;
|
|
15
|
+
const tasksPath = gateOptions.tasksPath ?? null;
|
|
16
|
+
if (!config.enabled) {
|
|
17
|
+
return { active: false, passed: true };
|
|
18
|
+
}
|
|
19
|
+
if (specPaths.length === 0) {
|
|
20
|
+
return { active: false, passed: true };
|
|
21
|
+
}
|
|
22
|
+
const stats = computeSpecStats(specPaths, config, pendingTaskCount);
|
|
23
|
+
if (stats.requirementCount === 0) {
|
|
24
|
+
return { active: false, passed: true };
|
|
25
|
+
}
|
|
26
|
+
const fingerprint = fingerprintSpecFiles(specPaths, tasksPath);
|
|
27
|
+
const record = readPassRecord(changeDir);
|
|
28
|
+
const passed = isPassValid(record, fingerprint);
|
|
29
|
+
const info = {
|
|
30
|
+
required: true,
|
|
31
|
+
passed,
|
|
32
|
+
thresholdPercent: config.thresholdPercent,
|
|
33
|
+
questionCount: stats.questionCount,
|
|
34
|
+
requirementCount: stats.requirementCount,
|
|
35
|
+
scenarioCount: stats.scenarioCount,
|
|
36
|
+
pendingTaskCount: stats.pendingTaskCount,
|
|
37
|
+
...(record && !passed
|
|
38
|
+
? { bestScorePercent: record.score_percent, attempts: record.attempt }
|
|
39
|
+
: record && passed
|
|
40
|
+
? { attempts: record.attempt }
|
|
41
|
+
: {}),
|
|
42
|
+
};
|
|
43
|
+
return { active: true, passed, info };
|
|
44
|
+
}
|
|
45
|
+
export class ComprehensionPassError extends Error {
|
|
46
|
+
score;
|
|
47
|
+
threshold;
|
|
48
|
+
constructor(message, score, threshold) {
|
|
49
|
+
super(message);
|
|
50
|
+
this.score = score;
|
|
51
|
+
this.threshold = threshold;
|
|
52
|
+
this.name = 'ComprehensionPassError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Record a comprehension pass after quiz success.
|
|
57
|
+
*/
|
|
58
|
+
export function recordComprehensionPass(input) {
|
|
59
|
+
const config = resolveComprehensionConfig(input.projectConfig);
|
|
60
|
+
if (input.scorePercent < config.thresholdPercent) {
|
|
61
|
+
throw new ComprehensionPassError(`Score ${input.scorePercent}% is below the ${config.thresholdPercent}% threshold required to apply.`, input.scorePercent, config.thresholdPercent);
|
|
62
|
+
}
|
|
63
|
+
const stats = input.questionCount > 0
|
|
64
|
+
? { questionCount: input.questionCount }
|
|
65
|
+
: computeSpecStats(input.specPaths, config, input.pendingTaskCount ?? 0);
|
|
66
|
+
const fingerprint = fingerprintSpecFiles(input.specPaths, input.tasksPath);
|
|
67
|
+
const record = buildPassRecord({
|
|
68
|
+
scorePercent: input.scorePercent,
|
|
69
|
+
thresholdPercent: config.thresholdPercent,
|
|
70
|
+
attempt: input.attempt,
|
|
71
|
+
questionCount: stats.questionCount,
|
|
72
|
+
specFingerprint: fingerprint,
|
|
73
|
+
});
|
|
74
|
+
writePassRecord(input.changeDir, record);
|
|
75
|
+
deleteSessionRecord(input.changeDir);
|
|
76
|
+
return record;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const COMPREHENSION_PASS_FILENAME = ".comprehension-pass.yaml";
|
|
3
|
+
export declare const COMPREHENSION_SESSION_FILENAME = ".comprehension-session.yaml";
|
|
4
|
+
declare const PassRecordSchema: z.ZodObject<{
|
|
5
|
+
version: z.ZodLiteral<1>;
|
|
6
|
+
passed: z.ZodLiteral<true>;
|
|
7
|
+
score_percent: z.ZodNumber;
|
|
8
|
+
threshold_percent: z.ZodNumber;
|
|
9
|
+
attempt: z.ZodNumber;
|
|
10
|
+
question_count: z.ZodNumber;
|
|
11
|
+
spec_fingerprint: z.ZodString;
|
|
12
|
+
passed_at: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
export type ComprehensionPassRecord = z.infer<typeof PassRecordSchema>;
|
|
15
|
+
export declare function passRecordPath(changeDir: string): string;
|
|
16
|
+
export declare function sessionRecordPath(changeDir: string): string;
|
|
17
|
+
export declare function readPassRecord(changeDir: string): ComprehensionPassRecord | null;
|
|
18
|
+
export declare function writePassRecord(changeDir: string, record: ComprehensionPassRecord): void;
|
|
19
|
+
export declare function deleteSessionRecord(changeDir: string): void;
|
|
20
|
+
export declare function isPassValid(record: ComprehensionPassRecord | null, currentFingerprint: string): boolean;
|
|
21
|
+
export declare function buildPassRecord(input: {
|
|
22
|
+
scorePercent: number;
|
|
23
|
+
thresholdPercent: number;
|
|
24
|
+
attempt: number;
|
|
25
|
+
questionCount: number;
|
|
26
|
+
specFingerprint: string;
|
|
27
|
+
}): ComprehensionPassRecord;
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=pass-record.d.ts.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { existsSync, readFileSync, unlinkSync, writeFileSync } from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
export const COMPREHENSION_PASS_FILENAME = '.comprehension-pass.yaml';
|
|
6
|
+
export const COMPREHENSION_SESSION_FILENAME = '.comprehension-session.yaml';
|
|
7
|
+
const PassRecordSchema = z.object({
|
|
8
|
+
version: z.literal(1),
|
|
9
|
+
passed: z.literal(true),
|
|
10
|
+
score_percent: z.number().int().min(0).max(100),
|
|
11
|
+
threshold_percent: z.number().int().min(0).max(100),
|
|
12
|
+
attempt: z.number().int().positive(),
|
|
13
|
+
question_count: z.number().int().positive(),
|
|
14
|
+
spec_fingerprint: z.string().min(1),
|
|
15
|
+
passed_at: z.string().min(1),
|
|
16
|
+
});
|
|
17
|
+
export function passRecordPath(changeDir) {
|
|
18
|
+
return path.join(changeDir, COMPREHENSION_PASS_FILENAME);
|
|
19
|
+
}
|
|
20
|
+
export function sessionRecordPath(changeDir) {
|
|
21
|
+
return path.join(changeDir, COMPREHENSION_SESSION_FILENAME);
|
|
22
|
+
}
|
|
23
|
+
export function readPassRecord(changeDir) {
|
|
24
|
+
const filePath = passRecordPath(changeDir);
|
|
25
|
+
if (!existsSync(filePath)) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
try {
|
|
29
|
+
const parsed = parseYaml(readFileSync(filePath, 'utf-8'));
|
|
30
|
+
const result = PassRecordSchema.safeParse(parsed);
|
|
31
|
+
return result.success ? result.data : null;
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function writePassRecord(changeDir, record) {
|
|
38
|
+
writeFileSync(passRecordPath(changeDir), stringifyYaml(record), 'utf-8');
|
|
39
|
+
}
|
|
40
|
+
export function deleteSessionRecord(changeDir) {
|
|
41
|
+
const filePath = sessionRecordPath(changeDir);
|
|
42
|
+
if (existsSync(filePath)) {
|
|
43
|
+
unlinkSync(filePath);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export function isPassValid(record, currentFingerprint) {
|
|
47
|
+
if (!record?.passed) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
return record.spec_fingerprint === currentFingerprint;
|
|
51
|
+
}
|
|
52
|
+
export function buildPassRecord(input) {
|
|
53
|
+
return {
|
|
54
|
+
version: 1,
|
|
55
|
+
passed: true,
|
|
56
|
+
score_percent: input.scorePercent,
|
|
57
|
+
threshold_percent: input.thresholdPercent,
|
|
58
|
+
attempt: input.attempt,
|
|
59
|
+
question_count: input.questionCount,
|
|
60
|
+
spec_fingerprint: input.specFingerprint,
|
|
61
|
+
passed_at: new Date().toISOString(),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=pass-record.js.map
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ComprehensionConfig } from './config.js';
|
|
2
|
+
export interface SpecStats {
|
|
3
|
+
requirementCount: number;
|
|
4
|
+
scenarioCount: number;
|
|
5
|
+
pendingTaskCount: number;
|
|
6
|
+
questionCount: number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Count requirements and scenarios across delta spec files.
|
|
10
|
+
*/
|
|
11
|
+
export declare function countSpecStats(specPaths: string[]): Pick<SpecStats, 'requirementCount' | 'scenarioCount'>;
|
|
12
|
+
/**
|
|
13
|
+
* Target quiz length from spec and task size:
|
|
14
|
+
* clamp(min, max, round(req * 0.6 + scenarios * 0.15 + pendingTasks * 0.15)).
|
|
15
|
+
*/
|
|
16
|
+
export declare function computeQuestionCount(requirementCount: number, scenarioCount: number, pendingTaskCount: number, config: Pick<ComprehensionConfig, 'minQuestions' | 'maxQuestions'>): number;
|
|
17
|
+
export declare function computeSpecStats(specPaths: string[], config: Pick<ComprehensionConfig, 'minQuestions' | 'maxQuestions'>, pendingTaskCount?: number): SpecStats;
|
|
18
|
+
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { parseDeltaSpec } from '../parsers/requirement-blocks.js';
|
|
3
|
+
const SCENARIO_HEADER_REGEX = /^####\s*Scenario:/gim;
|
|
4
|
+
function countScenariosInBlock(raw) {
|
|
5
|
+
const matches = raw.match(SCENARIO_HEADER_REGEX);
|
|
6
|
+
return matches?.length ?? 0;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Count requirements and scenarios across delta spec files.
|
|
10
|
+
*/
|
|
11
|
+
export function countSpecStats(specPaths) {
|
|
12
|
+
let requirementCount = 0;
|
|
13
|
+
let scenarioCount = 0;
|
|
14
|
+
for (const specPath of specPaths) {
|
|
15
|
+
const content = readFileSync(specPath, 'utf-8');
|
|
16
|
+
const plan = parseDeltaSpec(content);
|
|
17
|
+
const blocks = [...plan.added, ...plan.modified];
|
|
18
|
+
requirementCount += blocks.length;
|
|
19
|
+
for (const block of blocks) {
|
|
20
|
+
scenarioCount += countScenariosInBlock(block.raw);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return { requirementCount, scenarioCount };
|
|
24
|
+
}
|
|
25
|
+
function clamp(min, max, value) {
|
|
26
|
+
return Math.min(max, Math.max(min, value));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Target quiz length from spec and task size:
|
|
30
|
+
* clamp(min, max, round(req * 0.6 + scenarios * 0.15 + pendingTasks * 0.15)).
|
|
31
|
+
*/
|
|
32
|
+
export function computeQuestionCount(requirementCount, scenarioCount, pendingTaskCount, config) {
|
|
33
|
+
const raw = Math.round(requirementCount * 0.6 + scenarioCount * 0.15 + pendingTaskCount * 0.15);
|
|
34
|
+
return clamp(config.minQuestions, config.maxQuestions, raw);
|
|
35
|
+
}
|
|
36
|
+
export function computeSpecStats(specPaths, config, pendingTaskCount = 0) {
|
|
37
|
+
const { requirementCount, scenarioCount } = countSpecStats(specPaths);
|
|
38
|
+
const questionCount = computeQuestionCount(requirementCount, scenarioCount, pendingTaskCount, config);
|
|
39
|
+
return { requirementCount, scenarioCount, pendingTaskCount, questionCount };
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=stats.js.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ProjectConfig } from './project-config.js';
|
|
2
|
+
/**
|
|
3
|
+
* Serialize config to YAML string with helpful comments.
|
|
4
|
+
*
|
|
5
|
+
* @param config - Partial config object (schema required, context/rules optional)
|
|
6
|
+
* @returns YAML string ready to write to file
|
|
7
|
+
*/
|
|
8
|
+
export declare function serializeConfig(config: Partial<ProjectConfig>): string;
|
|
9
|
+
//# sourceMappingURL=config-prompts.d.ts.map
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialize config to YAML string with helpful comments.
|
|
3
|
+
*
|
|
4
|
+
* @param config - Partial config object (schema required, context/rules optional)
|
|
5
|
+
* @returns YAML string ready to write to file
|
|
6
|
+
*/
|
|
7
|
+
export function serializeConfig(config) {
|
|
8
|
+
const lines = [];
|
|
9
|
+
// Schema (required)
|
|
10
|
+
lines.push(`schema: ${config.schema}`);
|
|
11
|
+
lines.push('');
|
|
12
|
+
// Context section with comments
|
|
13
|
+
lines.push('# Project context (optional)');
|
|
14
|
+
lines.push('# This is shown to AI when creating artifacts.');
|
|
15
|
+
lines.push('# Add your tech stack, conventions, style guides, domain knowledge, etc.');
|
|
16
|
+
lines.push('# Example:');
|
|
17
|
+
lines.push('# context: |');
|
|
18
|
+
lines.push('# Tech stack: TypeScript, React, Node.js');
|
|
19
|
+
lines.push('# We use conventional commits');
|
|
20
|
+
lines.push('# Domain: e-commerce platform');
|
|
21
|
+
lines.push('');
|
|
22
|
+
// Rules section with comments
|
|
23
|
+
lines.push('# Per-artifact rules (optional)');
|
|
24
|
+
lines.push('# Add custom rules for specific artifacts.');
|
|
25
|
+
lines.push('# Example:');
|
|
26
|
+
lines.push('# rules:');
|
|
27
|
+
lines.push('# proposal:');
|
|
28
|
+
lines.push('# - Keep proposals under 500 words');
|
|
29
|
+
lines.push('# - Always include a "Non-goals" section');
|
|
30
|
+
lines.push('# tasks:');
|
|
31
|
+
lines.push('# - Break tasks into chunks of max 2 hours');
|
|
32
|
+
return lines.join('\n') + '\n';
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=config-prompts.js.map
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schema for global OpenSpec configuration.
|
|
4
|
+
* Uses passthrough() to preserve unknown fields for forward compatibility.
|
|
5
|
+
*/
|
|
6
|
+
export declare const GlobalConfigSchema: z.ZodObject<{
|
|
7
|
+
featureFlags: z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodBoolean>>>;
|
|
8
|
+
profile: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
core: "core";
|
|
10
|
+
custom: "custom";
|
|
11
|
+
}>>>;
|
|
12
|
+
delivery: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
13
|
+
commands: "commands";
|
|
14
|
+
skills: "skills";
|
|
15
|
+
both: "both";
|
|
16
|
+
}>>>;
|
|
17
|
+
workflows: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
18
|
+
}, z.core.$loose>;
|
|
19
|
+
export type GlobalConfigType = z.infer<typeof GlobalConfigSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* Default configuration values.
|
|
22
|
+
*/
|
|
23
|
+
export declare const DEFAULT_CONFIG: GlobalConfigType;
|
|
24
|
+
/**
|
|
25
|
+
* Validate a config key path for CLI set operations.
|
|
26
|
+
* Unknown top-level keys are rejected unless explicitly allowed by the caller.
|
|
27
|
+
*/
|
|
28
|
+
export declare function validateConfigKeyPath(path: string): {
|
|
29
|
+
valid: boolean;
|
|
30
|
+
reason?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Get a nested value from an object using dot notation.
|
|
34
|
+
*
|
|
35
|
+
* @param obj - The object to access
|
|
36
|
+
* @param path - Dot-separated path (e.g., "featureFlags.someFlag")
|
|
37
|
+
* @returns The value at the path, or undefined if not found
|
|
38
|
+
*/
|
|
39
|
+
export declare function getNestedValue(obj: Record<string, unknown>, path: string): unknown;
|
|
40
|
+
/**
|
|
41
|
+
* Set a nested value in an object using dot notation.
|
|
42
|
+
* Creates intermediate objects as needed.
|
|
43
|
+
*
|
|
44
|
+
* @param obj - The object to modify (mutated in place)
|
|
45
|
+
* @param path - Dot-separated path (e.g., "featureFlags.someFlag")
|
|
46
|
+
* @param value - The value to set
|
|
47
|
+
*/
|
|
48
|
+
export declare function setNestedValue(obj: Record<string, unknown>, path: string, value: unknown): void;
|
|
49
|
+
/**
|
|
50
|
+
* Delete a nested value from an object using dot notation.
|
|
51
|
+
*
|
|
52
|
+
* @param obj - The object to modify (mutated in place)
|
|
53
|
+
* @param path - Dot-separated path (e.g., "featureFlags.someFlag")
|
|
54
|
+
* @returns true if the key existed and was deleted, false otherwise
|
|
55
|
+
*/
|
|
56
|
+
export declare function deleteNestedValue(obj: Record<string, unknown>, path: string): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Coerce a string value to its appropriate type.
|
|
59
|
+
* - "true" / "false" -> boolean
|
|
60
|
+
* - Numeric strings -> number
|
|
61
|
+
* - JSON arrays/objects -> parsed containers
|
|
62
|
+
* - Everything else -> string
|
|
63
|
+
*
|
|
64
|
+
* @param value - The string value to coerce
|
|
65
|
+
* @param forceString - If true, always return the value as a string
|
|
66
|
+
* @returns The coerced value
|
|
67
|
+
*/
|
|
68
|
+
export declare function coerceValue(value: string, forceString?: boolean): string | number | boolean | unknown[] | Record<string, unknown>;
|
|
69
|
+
/**
|
|
70
|
+
* Format a value for YAML-like display.
|
|
71
|
+
*
|
|
72
|
+
* @param value - The value to format
|
|
73
|
+
* @param indent - Current indentation level
|
|
74
|
+
* @returns Formatted string
|
|
75
|
+
*/
|
|
76
|
+
export declare function formatValueYaml(value: unknown, indent?: number): string;
|
|
77
|
+
/**
|
|
78
|
+
* Validate a configuration object against the schema.
|
|
79
|
+
*
|
|
80
|
+
* @param config - The configuration to validate
|
|
81
|
+
* @returns Validation result with success status and optional error message
|
|
82
|
+
*/
|
|
83
|
+
export declare function validateConfig(config: unknown): {
|
|
84
|
+
success: boolean;
|
|
85
|
+
error?: string;
|
|
86
|
+
};
|
|
87
|
+
//# sourceMappingURL=config-schema.d.ts.map
|