@devtrack-solution/codesdd 1.2.2 → 1.2.3
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/.sdd/skills/curated/api-clean-flask-langgraph/SKILL.md +17 -17
- package/.sdd/skills/curated/devtrack-api/SKILL.md +160 -28
- package/.sdd/skills/curated/devtrack-api/agents/openai.yaml +1 -1
- package/.sdd/skills/curated/devtrack-api/references/architecture-governance.md +8 -7
- package/.sdd/skills/curated/devtrack-api/references/consumer-sync-policy.md +93 -0
- package/.sdd/skills/curated/devtrack-api/references/contract-pack.yaml +317 -0
- package/.sdd/skills/curated/devtrack-api/references/field-validation-protocol.md +95 -0
- package/.sdd/skills/curated/devtrack-api/references/foundation-layout.md +295 -0
- package/.sdd/skills/curated/devtrack-api/references/implementation-checklist.md +4 -4
- package/.sdd/skills/curated/devtrack-api/references/imports-lint.md +4 -0
- package/.sdd/skills/curated/devtrack-api/references/testing-validation.md +2 -2
- package/LICENSE +1 -1
- package/README.md +243 -51
- package/bin/codesdd.js +3 -2
- package/dist/cli/index.d.ts +2 -2
- package/dist/cli/index.js +11 -558
- package/dist/cli/program.d.ts +14 -0
- package/dist/cli/program.js +645 -0
- package/dist/commands/change.js +5 -5
- package/dist/commands/completion.d.ts +1 -1
- package/dist/commands/completion.js +9 -2
- package/dist/commands/config.js +159 -20
- package/dist/commands/feedback.js +1 -1
- package/dist/commands/schema.d.ts +63 -0
- package/dist/commands/schema.js +12 -12
- package/dist/commands/sdd/backlog.d.ts +3 -0
- package/dist/commands/sdd/backlog.js +54 -0
- package/dist/commands/sdd/execution.js +147 -16
- package/dist/commands/sdd/plugin.d.ts +3 -0
- package/dist/commands/sdd/plugin.js +153 -0
- package/dist/commands/sdd/shared.js +2 -23
- package/dist/commands/sdd/skills.js +7 -0
- package/dist/commands/sdd.js +69 -12
- package/dist/commands/spec.js +9 -9
- package/dist/commands/validate.js +6 -6
- package/dist/commands/workflow/instructions.js +6 -6
- package/dist/commands/workflow/new-change.js +3 -3
- package/dist/commands/workflow/shared.d.ts +1 -1
- package/dist/commands/workflow/shared.js +4 -4
- package/dist/core/archive.js +15 -5
- package/dist/core/artifact-graph/instruction-loader.d.ts +1 -1
- package/dist/core/artifact-graph/instruction-loader.js +3 -3
- package/dist/core/artifact-graph/resolver.d.ts +4 -4
- package/dist/core/artifact-graph/resolver.js +6 -6
- package/dist/core/branding.js +3 -3
- package/dist/core/cli/command-matrix.js +10 -1
- package/dist/core/cli-command-quality.d.ts +27 -0
- package/dist/core/cli-command-quality.js +171 -0
- package/dist/core/command-generation/adapters/costrict.d.ts +1 -1
- package/dist/core/command-generation/adapters/costrict.js +2 -2
- package/dist/core/command-generation/types.d.ts +1 -1
- package/dist/core/completions/command-registry.d.ts +1 -1
- package/dist/core/completions/command-registry.js +155 -12
- package/dist/core/completions/completion-provider.d.ts +14 -1
- package/dist/core/completions/completion-provider.js +29 -1
- package/dist/core/completions/generators/bash-generator.d.ts +1 -1
- package/dist/core/completions/generators/bash-generator.js +20 -12
- package/dist/core/completions/generators/fish-generator.d.ts +9 -1
- package/dist/core/completions/generators/fish-generator.js +39 -25
- package/dist/core/completions/generators/powershell-generator.d.ts +1 -1
- package/dist/core/completions/generators/powershell-generator.js +21 -11
- package/dist/core/completions/generators/zsh-generator.d.ts +3 -6
- package/dist/core/completions/generators/zsh-generator.js +21 -42
- package/dist/core/completions/installers/bash-installer.js +6 -6
- package/dist/core/completions/installers/fish-installer.js +1 -1
- package/dist/core/completions/installers/powershell-installer.js +14 -14
- package/dist/core/completions/installers/zsh-installer.d.ts +7 -1
- package/dist/core/completions/installers/zsh-installer.js +36 -8
- package/dist/core/completions/templates/bash-templates.d.ts +1 -1
- package/dist/core/completions/templates/bash-templates.js +12 -6
- package/dist/core/completions/templates/fish-templates.d.ts +2 -2
- package/dist/core/completions/templates/fish-templates.js +20 -9
- package/dist/core/completions/templates/powershell-templates.d.ts +1 -1
- package/dist/core/completions/templates/powershell-templates.js +13 -4
- package/dist/core/completions/templates/zsh-templates.d.ts +1 -1
- package/dist/core/completions/templates/zsh-templates.js +18 -9
- package/dist/core/config-schema.d.ts +3 -1
- package/dist/core/config-schema.js +26 -1
- package/dist/core/config.d.ts +3 -3
- package/dist/core/config.js +4 -4
- package/dist/core/global-config.d.ts +41 -12
- package/dist/core/global-config.js +344 -27
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +2 -2
- package/dist/core/init.d.ts +6 -1
- package/dist/core/init.js +99 -77
- package/dist/core/legacy-cleanup.d.ts +17 -17
- package/dist/core/legacy-cleanup.js +96 -79
- package/dist/core/list.js +18 -4
- package/dist/core/migration.d.ts +3 -1
- package/dist/core/migration.js +7 -8
- package/dist/core/parsers/change-parser.js +1 -1
- package/dist/core/parsers/markdown-parser.js +2 -2
- package/dist/core/profile-sync-drift.d.ts +1 -1
- package/dist/core/profile-sync-drift.js +13 -13
- package/dist/core/project-config.d.ts +4 -4
- package/dist/core/project-config.js +11 -11
- package/dist/core/schemas/change.schema.d.ts +1 -1
- package/dist/core/schemas/change.schema.js +1 -1
- package/dist/core/schemas/spec.schema.d.ts +1 -1
- package/dist/core/schemas/spec.schema.js +1 -1
- package/dist/core/sdd/adr.js +23 -1
- package/dist/core/sdd/agent-binding.d.ts +346 -0
- package/dist/core/sdd/agent-binding.js +343 -0
- package/dist/core/sdd/backlog-cli.d.ts +16 -0
- package/dist/core/sdd/backlog-cli.js +146 -0
- package/dist/core/sdd/backlog-conflict-policy.d.ts +58 -0
- package/dist/core/sdd/backlog-conflict-policy.js +230 -0
- package/dist/core/sdd/backlog-projection.d.ts +8 -0
- package/dist/core/sdd/backlog-projection.js +89 -0
- package/dist/core/sdd/backlog-provider-contract.d.ts +252 -0
- package/dist/core/sdd/backlog-provider-contract.js +158 -0
- package/dist/core/sdd/bootstrap.js +2 -2
- package/dist/core/sdd/check.d.ts +42 -0
- package/dist/core/sdd/check.js +22 -22
- package/dist/core/sdd/contract.d.ts +13 -0
- package/dist/core/sdd/contract.js +36 -0
- package/dist/core/sdd/coordination/coordination-adapters.d.ts +38 -0
- package/dist/core/sdd/coordination/coordination-adapters.js +139 -1
- package/dist/core/sdd/deepagent-contracts.d.ts +276 -0
- package/dist/core/sdd/deepagent-contracts.js +173 -0
- package/dist/core/sdd/deepagents/adr-governor.d.ts +2 -0
- package/dist/core/sdd/deepagents/adr-governor.js +30 -0
- package/dist/core/sdd/deepagents/backend.d.ts +63 -0
- package/dist/core/sdd/deepagents/backend.js +174 -0
- package/dist/core/sdd/deepagents/codesdd-tools.d.ts +39 -0
- package/dist/core/sdd/deepagents/codesdd-tools.js +83 -0
- package/dist/core/sdd/deepagents/evidence-mapper.d.ts +86 -0
- package/dist/core/sdd/deepagents/evidence-mapper.js +178 -0
- package/dist/core/sdd/deepagents/model-provider.d.ts +53 -0
- package/dist/core/sdd/deepagents/model-provider.js +379 -0
- package/dist/core/sdd/deepagents/policy-enforcement.d.ts +30 -0
- package/dist/core/sdd/deepagents/policy-enforcement.js +90 -0
- package/dist/core/sdd/deepagents/policy.d.ts +75 -0
- package/dist/core/sdd/deepagents/policy.js +358 -0
- package/dist/core/sdd/deepagents/quality-witness.d.ts +3 -0
- package/dist/core/sdd/deepagents/quality-witness.js +77 -0
- package/dist/core/sdd/deepagents/reversa-subagents.d.ts +75 -0
- package/dist/core/sdd/deepagents/reversa-subagents.js +182 -0
- package/dist/core/sdd/deepagents/runtime-factory.d.ts +90 -0
- package/dist/core/sdd/deepagents/runtime-factory.js +231 -0
- package/dist/core/sdd/deepagents/runtime-loader.d.ts +16 -0
- package/dist/core/sdd/deepagents/runtime-loader.js +65 -0
- package/dist/core/sdd/default-bootstrap-files.d.ts +2 -2
- package/dist/core/sdd/default-bootstrap-files.js +36 -2
- package/dist/core/sdd/default-skills.d.ts +30 -0
- package/dist/core/sdd/default-skills.js +181 -5
- package/dist/core/sdd/devtrack-api-appliance.d.ts +84 -0
- package/dist/core/sdd/devtrack-api-appliance.js +257 -0
- package/dist/core/sdd/devtrack-api-architecture.d.ts +31 -0
- package/dist/core/sdd/devtrack-api-architecture.js +608 -0
- package/dist/core/sdd/devtrack-api-import-boundary.d.ts +19 -0
- package/dist/core/sdd/devtrack-api-import-boundary.js +32 -0
- package/dist/core/sdd/diagnose.d.ts +59 -0
- package/dist/core/sdd/diagnose.js +37 -37
- package/dist/core/sdd/docs-sync.js +33 -5
- package/dist/core/sdd/domain/post-active-validation.d.ts +7 -0
- package/dist/core/sdd/domain/post-active-validation.js +61 -0
- package/dist/core/sdd/domain/transition-engine.js +1 -0
- package/dist/core/sdd/entity-reference.d.ts +5 -0
- package/dist/core/sdd/entity-reference.js +22 -0
- package/dist/core/sdd/governance-backfill.d.ts +31 -0
- package/dist/core/sdd/governance-backfill.js +359 -0
- package/dist/core/sdd/governance-parser.d.ts +21 -0
- package/dist/core/sdd/governance-parser.js +91 -0
- package/dist/core/sdd/governance-schemas.d.ts +245 -0
- package/dist/core/sdd/governance-schemas.js +143 -0
- package/dist/core/sdd/{import-openspec.d.ts → import-legacy-spec.d.ts} +7 -7
- package/dist/core/sdd/{import-openspec.js → import-legacy-spec.js} +21 -29
- package/dist/core/sdd/init.d.ts +3 -0
- package/dist/core/sdd/init.js +6 -3
- package/dist/core/sdd/json-schema.js +100 -6
- package/dist/core/sdd/knowledge-graph.d.ts +45 -0
- package/dist/core/sdd/knowledge-graph.js +288 -0
- package/dist/core/sdd/legacy-operations.js +431 -43
- package/dist/core/sdd/lenses.d.ts +1 -0
- package/dist/core/sdd/lenses.js +29 -1
- package/dist/core/sdd/migrate-workspace.js +56 -2
- package/dist/core/sdd/migrate.d.ts +1 -1
- package/dist/core/sdd/migrate.js +36 -2
- package/dist/core/sdd/package-structure-gate.d.ts +83 -0
- package/dist/core/sdd/package-structure-gate.js +362 -0
- package/dist/core/sdd/parallel-feat-automation.d.ts +152 -0
- package/dist/core/sdd/parallel-feat-automation.js +212 -0
- package/dist/core/sdd/plugin-broker.d.ts +558 -0
- package/dist/core/sdd/plugin-broker.js +482 -0
- package/dist/core/sdd/plugin-certification.d.ts +79 -0
- package/dist/core/sdd/plugin-certification.js +453 -0
- package/dist/core/sdd/plugin-cli.d.ts +109 -0
- package/dist/core/sdd/plugin-cli.js +198 -0
- package/dist/core/sdd/plugin-evidence.d.ts +275 -0
- package/dist/core/sdd/plugin-evidence.js +307 -0
- package/dist/core/sdd/plugin-manifest.d.ts +164 -0
- package/dist/core/sdd/plugin-manifest.js +215 -0
- package/dist/core/sdd/plugin-policy-pack.d.ts +88 -0
- package/dist/core/sdd/plugin-policy-pack.js +236 -0
- package/dist/core/sdd/plugin-policy.d.ts +68 -0
- package/dist/core/sdd/plugin-policy.js +212 -0
- package/dist/core/sdd/plugin-registry.d.ts +311 -0
- package/dist/core/sdd/plugin-registry.js +138 -0
- package/dist/core/sdd/plugin-skill-binding.d.ts +151 -0
- package/dist/core/sdd/plugin-skill-binding.js +339 -0
- package/dist/core/sdd/quality-artifact-manifest-validator.d.ts +28 -0
- package/dist/core/sdd/quality-artifact-manifest-validator.js +167 -0
- package/dist/core/sdd/quality-evidence-renderer.d.ts +65 -0
- package/dist/core/sdd/quality-evidence-renderer.js +218 -0
- package/dist/core/sdd/quality-scenario-runner.d.ts +42 -0
- package/dist/core/sdd/quality-scenario-runner.js +613 -0
- package/dist/core/sdd/quality-validation.d.ts +547 -0
- package/dist/core/sdd/quality-validation.js +239 -0
- package/dist/core/sdd/resolve-project-root.d.ts +2 -2
- package/dist/core/sdd/resolve-project-root.js +11 -5
- package/dist/core/sdd/sanitize.d.ts +30 -1
- package/dist/core/sdd/sanitize.js +23 -23
- package/dist/core/sdd/services/agent-run.service.d.ts +65 -0
- package/dist/core/sdd/services/agent-run.service.js +189 -0
- package/dist/core/sdd/services/breakdown.service.js +2 -1
- package/dist/core/sdd/services/context.service.js +18 -16
- package/dist/core/sdd/services/debate.service.js +15 -2
- package/dist/core/sdd/services/feature-lint.service.d.ts +22 -0
- package/dist/core/sdd/services/feature-lint.service.js +105 -5
- package/dist/core/sdd/services/finalize.service.d.ts +80 -0
- package/dist/core/sdd/services/finalize.service.js +323 -24
- package/dist/core/sdd/services/frontend-gap.service.js +22 -7
- package/dist/core/sdd/services/governance-control-plane-runtime-adapters.d.ts +17 -0
- package/dist/core/sdd/services/governance-control-plane-runtime-adapters.js +38 -0
- package/dist/core/sdd/services/governance-control-plane.service.d.ts +66 -0
- package/dist/core/sdd/services/governance-control-plane.service.js +134 -0
- package/dist/core/sdd/services/ingest-deposito.service.js +1 -1
- package/dist/core/sdd/services/legacy-capability.service.d.ts +10 -7
- package/dist/core/sdd/services/legacy-capability.service.js +38 -21
- package/dist/core/sdd/services/mcp-runtime.service.d.ts +123 -8
- package/dist/core/sdd/services/mcp-runtime.service.js +1085 -33
- package/dist/core/sdd/services/onboard.service.js +2 -1
- package/dist/core/sdd/services/rebuild.service.js +6 -1
- package/dist/core/sdd/services/skills-sync.service.d.ts +17 -5
- package/dist/core/sdd/services/skills-sync.service.js +55 -2
- package/dist/core/sdd/services/start.service.js +6 -4
- package/dist/core/sdd/skill-bundles-curation-schema.d.ts +66 -0
- package/dist/core/sdd/skill-bundles-curation-schema.js +52 -0
- package/dist/core/sdd/skill-evidence.d.ts +19 -0
- package/dist/core/sdd/skill-evidence.js +38 -0
- package/dist/core/sdd/skill-policy-pool.d.ts +46 -0
- package/dist/core/sdd/skill-policy-pool.js +185 -0
- package/dist/core/sdd/state.d.ts +22 -0
- package/dist/core/sdd/state.js +66 -41
- package/dist/core/sdd/structural-health.d.ts +42 -42
- package/dist/core/sdd/types.d.ts +33 -7
- package/dist/core/sdd/types.js +17 -0
- package/dist/core/sdd/upgrade-to-codesdd.d.ts +45 -0
- package/dist/core/sdd/upgrade-to-codesdd.js +179 -0
- package/dist/core/sdd/workspace-schemas.d.ts +285 -14
- package/dist/core/sdd/workspace-schemas.js +148 -0
- package/dist/core/sdd/write-manifest.js +22 -4
- package/dist/core/shared/skill-generation.d.ts +1 -1
- package/dist/core/shared/skill-generation.js +15 -15
- package/dist/core/shared/tool-detection.d.ts +3 -3
- package/dist/core/shared/tool-detection.js +14 -14
- package/dist/core/specs-apply.js +6 -6
- package/dist/core/templates/index.d.ts +1 -1
- package/dist/core/templates/index.js +1 -1
- package/dist/core/templates/workflows/apply-change.js +14 -14
- package/dist/core/templates/workflows/archive-change.js +32 -32
- package/dist/core/templates/workflows/bulk-archive-change.js +25 -25
- package/dist/core/templates/workflows/continue-change.js +12 -12
- package/dist/core/templates/workflows/explore.js +29 -29
- package/dist/core/templates/workflows/feedback.js +6 -6
- package/dist/core/templates/workflows/ff-change.js +24 -24
- package/dist/core/templates/workflows/new-change.js +20 -20
- package/dist/core/templates/workflows/onboard.js +33 -33
- package/dist/core/templates/workflows/propose.js +23 -23
- package/dist/core/templates/workflows/sdd.js +8 -8
- package/dist/core/templates/workflows/sync-specs.js +19 -19
- package/dist/core/templates/workflows/verify-change.js +17 -17
- package/dist/core/update.d.ts +2 -2
- package/dist/core/update.js +16 -15
- package/dist/core/validation/constants.d.ts +1 -1
- package/dist/core/validation/constants.js +1 -1
- package/dist/core/view.js +11 -11
- package/dist/telemetry/config.d.ts +2 -1
- package/dist/telemetry/config.js +17 -8
- package/dist/telemetry/index.d.ts +10 -2
- package/dist/telemetry/index.js +40 -7
- package/dist/ui/ascii-patterns.d.ts +2 -2
- package/dist/ui/ascii-patterns.js +2 -2
- package/dist/ui/welcome-screen.js +2 -2
- package/dist/utils/change-metadata.d.ts +4 -4
- package/dist/utils/change-metadata.js +6 -6
- package/dist/utils/change-utils.d.ts +3 -3
- package/dist/utils/change-utils.js +5 -5
- package/dist/utils/file-system.js +1 -1
- package/dist/utils/interactive.js +1 -1
- package/dist/utils/item-discovery.js +4 -4
- package/dist/utils/legacy-spec-compat.d.ts +2 -0
- package/dist/utils/legacy-spec-compat.js +2 -0
- package/dist/utils/shell-detection.d.ts +1 -0
- package/dist/utils/shell-detection.js +16 -0
- package/package.json +27 -17
- package/schemas/sdd/1-spec.schema.json +1 -1
- package/schemas/sdd/2-plan.schema.json +73 -1
- package/schemas/sdd/3-tasks.schema.json +73 -1
- package/schemas/sdd/4-changelog.schema.json +1 -1
- package/schemas/sdd/5-quality.schema.json +442 -2
- package/schemas/sdd/adr.schema.json +148 -0
- package/schemas/sdd/agent-binding-adapter.schema.json +210 -0
- package/schemas/sdd/agent-binding-resolution.schema.json +338 -0
- package/schemas/sdd/backlog-projection-plan.schema.json +180 -0
- package/schemas/sdd/backlog-provider-contract.schema.json +260 -0
- package/schemas/sdd/codesdd-plugin.schema.json +474 -0
- package/schemas/sdd/debate.schema.json +244 -0
- package/schemas/sdd/deepagent-decision-evidence.schema.json +58 -0
- package/schemas/sdd/deepagent-env-contract.schema.json +143 -0
- package/schemas/sdd/deepagent-quality-evidence.schema.json +108 -0
- package/schemas/sdd/deepagent-run-evidence.schema.json +192 -0
- package/schemas/sdd/deepagent-run-plan.schema.json +197 -0
- package/schemas/sdd/deepagent-run-request.schema.json +321 -0
- package/schemas/sdd/deepagent-subagent-evidence.schema.json +110 -0
- package/schemas/sdd/deepagent-tool-call-evidence.schema.json +78 -0
- package/schemas/sdd/discarded.schema.json +127 -0
- package/schemas/sdd/epic.schema.json +147 -0
- package/schemas/sdd/insight.schema.json +136 -0
- package/schemas/sdd/parallel-feat-automation-plan.schema.json +215 -0
- package/schemas/sdd/parallel-feat-automation-request.schema.json +109 -0
- package/schemas/sdd/plugin-artifact-manifest.schema.json +150 -0
- package/schemas/sdd/plugin-compliance-index.schema.json +136 -0
- package/schemas/sdd/plugin-dry-run-plan.schema.json +260 -0
- package/schemas/sdd/plugin-evidence-manifest.schema.json +569 -0
- package/schemas/sdd/plugin-policy-evaluation.schema.json +92 -0
- package/schemas/sdd/plugin-policy-pack-evaluation.schema.json +94 -0
- package/schemas/sdd/plugin-policy-pack.schema.json +196 -0
- package/schemas/sdd/plugin-registry.schema.json +558 -0
- package/schemas/sdd/plugin-rollback-manifest.schema.json +87 -0
- package/schemas/sdd/plugin-runtime-invocation-plan.schema.json +845 -0
- package/schemas/sdd/plugin-skill-binding-resolution.schema.json +305 -0
- package/schemas/sdd/plugin-skill-binding.schema.json +88 -0
- package/schemas/sdd/plugin-validation-manifest.schema.json +123 -0
- package/schemas/sdd/quality-architecture-schema.schema.json +216 -0
- package/schemas/sdd/quality-evidence-bundle.schema.json +1228 -0
- package/schemas/sdd/quality-run.schema.json +197 -0
- package/schemas/sdd/quality-scenario.schema.json +252 -0
- package/schemas/sdd/workspace-catalog.schema.json +9841 -22
- package/schemas/spec-driven/schema.yaml +4 -4
- package/schemas/spec-driven/templates/proposal.md +1 -1
- package/dist/utils/openspec-compat.d.ts +0 -2
- package/dist/utils/openspec-compat.js +0 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BASH_DYNAMIC_HELPERS } from '../templates/bash-templates.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates Bash completion scripts for the
|
|
3
|
+
* Generates Bash completion scripts for the CodeSDD CLI.
|
|
4
4
|
* Follows Bash completion conventions using complete builtin and COMPREPLY array.
|
|
5
5
|
*/
|
|
6
6
|
export class BashGenerator {
|
|
@@ -25,10 +25,10 @@ export class BashGenerator {
|
|
|
25
25
|
// Dynamic completion helpers from template
|
|
26
26
|
const helpers = BASH_DYNAMIC_HELPERS;
|
|
27
27
|
// Assemble final script with template literal
|
|
28
|
-
return `# Bash completion script for
|
|
28
|
+
return `# Bash completion script for CodeSDD CLI
|
|
29
29
|
# Auto-generated - do not edit manually
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
_codesdd_completion() {
|
|
32
32
|
local cur prev words cword
|
|
33
33
|
|
|
34
34
|
# Use _init_completion if available (from bash-completion package)
|
|
@@ -47,7 +47,6 @@ _openspec_completion() {
|
|
|
47
47
|
fi
|
|
48
48
|
|
|
49
49
|
local cmd="\${words[1]}"
|
|
50
|
-
local subcmd="\${words[2]}"
|
|
51
50
|
|
|
52
51
|
# Top-level commands
|
|
53
52
|
if [[ $cword -eq 1 ]]; then
|
|
@@ -65,13 +64,13 @@ ${commandCases}
|
|
|
65
64
|
}
|
|
66
65
|
|
|
67
66
|
${helpers}
|
|
68
|
-
complete -F
|
|
67
|
+
complete -F _codesdd_completion codesdd
|
|
69
68
|
`;
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
71
|
* Generate completion case logic for a command
|
|
73
72
|
*/
|
|
74
|
-
generateCommandCase(cmd, indent) {
|
|
73
|
+
generateCommandCase(cmd, indent, depth = 2) {
|
|
75
74
|
const lines = [];
|
|
76
75
|
// Handle subcommands
|
|
77
76
|
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
@@ -91,16 +90,22 @@ complete -F _openspec_completion openspec
|
|
|
91
90
|
lines.push(`${indent}fi`);
|
|
92
91
|
lines.push('');
|
|
93
92
|
}
|
|
94
|
-
lines.push(`${indent}if [[ $cword -eq
|
|
93
|
+
lines.push(`${indent}if [[ $cword -eq ${depth} ]]; then`);
|
|
95
94
|
lines.push(`${indent} local subcommands="` + cmd.subcommands.map(s => this.escapeCommandName(s.name)).join(' ') + '"');
|
|
96
95
|
lines.push(`${indent} COMPREPLY=($(compgen -W "$subcommands" -- "$cur"))`);
|
|
97
96
|
lines.push(`${indent} return 0`);
|
|
98
97
|
lines.push(`${indent}fi`);
|
|
99
98
|
lines.push('');
|
|
100
|
-
lines.push(`${indent}
|
|
99
|
+
lines.push(`${indent}local subcmd_${depth}="\${words[${depth}]}"`);
|
|
100
|
+
lines.push(`${indent}case "$subcmd_${depth}" in`);
|
|
101
101
|
for (const subcmd of cmd.subcommands) {
|
|
102
102
|
lines.push(`${indent} ${subcmd.name})`);
|
|
103
|
-
|
|
103
|
+
if (subcmd.subcommands && subcmd.subcommands.length > 0) {
|
|
104
|
+
lines.push(...this.generateCommandCase(subcmd, indent + ' ', depth + 1));
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
lines.push(...this.generateArgumentCompletion(subcmd, indent + ' '));
|
|
108
|
+
}
|
|
104
109
|
lines.push(`${indent} ;;`);
|
|
105
110
|
}
|
|
106
111
|
lines.push(`${indent}esac`);
|
|
@@ -145,13 +150,13 @@ complete -F _openspec_completion openspec
|
|
|
145
150
|
const lines = [];
|
|
146
151
|
switch (positionalType) {
|
|
147
152
|
case 'change-id':
|
|
148
|
-
lines.push(`${indent}
|
|
153
|
+
lines.push(`${indent}_codesdd_complete_changes`);
|
|
149
154
|
break;
|
|
150
155
|
case 'spec-id':
|
|
151
|
-
lines.push(`${indent}
|
|
156
|
+
lines.push(`${indent}_codesdd_complete_specs`);
|
|
152
157
|
break;
|
|
153
158
|
case 'change-or-spec-id':
|
|
154
|
-
lines.push(`${indent}
|
|
159
|
+
lines.push(`${indent}_codesdd_complete_items`);
|
|
155
160
|
break;
|
|
156
161
|
case 'shell':
|
|
157
162
|
lines.push(`${indent}local shells="zsh bash fish powershell"`);
|
|
@@ -160,6 +165,9 @@ complete -F _openspec_completion openspec
|
|
|
160
165
|
case 'path':
|
|
161
166
|
lines.push(`${indent}COMPREPLY=($(compgen -f -- "$cur"))`);
|
|
162
167
|
break;
|
|
168
|
+
case 'schema-name':
|
|
169
|
+
lines.push(`${indent}_codesdd_complete_schemas`);
|
|
170
|
+
break;
|
|
163
171
|
}
|
|
164
172
|
return lines;
|
|
165
173
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompletionGenerator, CommandDefinition } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates Fish completion scripts for the
|
|
3
|
+
* Generates Fish completion scripts for the CodeSDD CLI.
|
|
4
4
|
* Follows Fish completion conventions using the complete command.
|
|
5
5
|
*/
|
|
6
6
|
export declare class FishGenerator implements CompletionGenerator {
|
|
@@ -16,6 +16,14 @@ export declare class FishGenerator implements CompletionGenerator {
|
|
|
16
16
|
* Generate completions for a specific command
|
|
17
17
|
*/
|
|
18
18
|
private generateCommandCompletions;
|
|
19
|
+
/**
|
|
20
|
+
* Generate completions for a command path at any depth.
|
|
21
|
+
*/
|
|
22
|
+
private generateNodeCompletions;
|
|
23
|
+
/**
|
|
24
|
+
* Generate a Fish condition that checks every command segment in a path.
|
|
25
|
+
*/
|
|
26
|
+
private generatePathCondition;
|
|
19
27
|
/**
|
|
20
28
|
* Generate flag completion
|
|
21
29
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FISH_STATIC_HELPERS, FISH_DYNAMIC_HELPERS } from '../templates/fish-templates.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates Fish completion scripts for the
|
|
3
|
+
* Generates Fish completion scripts for the CodeSDD CLI.
|
|
4
4
|
* Follows Fish completion conventions using the complete command.
|
|
5
5
|
*/
|
|
6
6
|
export class FishGenerator {
|
|
@@ -16,7 +16,7 @@ export class FishGenerator {
|
|
|
16
16
|
const topLevelLines = [];
|
|
17
17
|
for (const cmd of commands) {
|
|
18
18
|
topLevelLines.push(`# ${cmd.name} command`);
|
|
19
|
-
topLevelLines.push(`complete -c
|
|
19
|
+
topLevelLines.push(`complete -c codesdd -n '__fish_codesdd_no_subcommand' -a '${cmd.name}' -d '${this.escapeDescription(cmd.description)}'`);
|
|
20
20
|
}
|
|
21
21
|
const topLevelCommands = topLevelLines.join('\n');
|
|
22
22
|
// Build command-specific completions using push() for loop clarity
|
|
@@ -31,7 +31,7 @@ export class FishGenerator {
|
|
|
31
31
|
// Dynamic completion helpers from template
|
|
32
32
|
const dynamicHelpers = FISH_DYNAMIC_HELPERS;
|
|
33
33
|
// Assemble final script with template literal
|
|
34
|
-
return `# Fish completion script for
|
|
34
|
+
return `# Fish completion script for CodeSDD CLI
|
|
35
35
|
# Auto-generated - do not edit manually
|
|
36
36
|
|
|
37
37
|
${helperFunctions}
|
|
@@ -44,43 +44,54 @@ ${commandCompletions}`;
|
|
|
44
44
|
* Generate completions for a specific command
|
|
45
45
|
*/
|
|
46
46
|
generateCommandCompletions(cmd) {
|
|
47
|
+
return this.generateNodeCompletions(cmd, [cmd.name]);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate completions for a command path at any depth.
|
|
51
|
+
*/
|
|
52
|
+
generateNodeCompletions(cmd, path) {
|
|
47
53
|
const lines = [];
|
|
54
|
+
const pathCondition = this.generatePathCondition(path);
|
|
48
55
|
// If command has subcommands
|
|
49
56
|
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
50
57
|
// Add subcommand completions
|
|
58
|
+
const childExclusion = cmd.subcommands
|
|
59
|
+
.map((subcmd) => `not __fish_codesdd_using_subcommand ${subcmd.name}`)
|
|
60
|
+
.join('; and ');
|
|
61
|
+
const subcommandCondition = `${pathCondition}; and ${childExclusion}`;
|
|
51
62
|
for (const subcmd of cmd.subcommands) {
|
|
52
|
-
lines.push(`complete -c
|
|
63
|
+
lines.push(`complete -c codesdd -n '${subcommandCondition}' -a '${subcmd.name}' -d '${this.escapeDescription(subcmd.description)}'`);
|
|
53
64
|
}
|
|
54
65
|
lines.push('');
|
|
55
66
|
// Add flags for parent command
|
|
56
67
|
for (const flag of cmd.flags) {
|
|
57
|
-
lines.push(...this.generateFlagCompletion(flag,
|
|
68
|
+
lines.push(...this.generateFlagCompletion(flag, pathCondition));
|
|
58
69
|
}
|
|
59
70
|
// Add completions for each subcommand
|
|
60
71
|
for (const subcmd of cmd.subcommands) {
|
|
61
|
-
lines.push(`# ${
|
|
62
|
-
|
|
63
|
-
lines.push(...this.generateFlagCompletion(flag, `__fish_openspec_using_subcommand ${cmd.name}; and __fish_openspec_using_subcommand ${subcmd.name}`));
|
|
64
|
-
}
|
|
65
|
-
// Add positional completions for subcommand
|
|
66
|
-
if (subcmd.acceptsPositional) {
|
|
67
|
-
lines.push(...this.generatePositionalCompletion(subcmd.positionalType, `__fish_openspec_using_subcommand ${cmd.name}; and __fish_openspec_using_subcommand ${subcmd.name}`));
|
|
68
|
-
}
|
|
72
|
+
lines.push(`# ${[...path, subcmd.name].join(' ')} completions`);
|
|
73
|
+
lines.push(...this.generateNodeCompletions(subcmd, [...path, subcmd.name]));
|
|
69
74
|
}
|
|
70
75
|
}
|
|
71
76
|
else {
|
|
72
77
|
// Command without subcommands
|
|
73
78
|
lines.push(`# ${cmd.name} flags`);
|
|
74
79
|
for (const flag of cmd.flags) {
|
|
75
|
-
lines.push(...this.generateFlagCompletion(flag,
|
|
80
|
+
lines.push(...this.generateFlagCompletion(flag, pathCondition));
|
|
76
81
|
}
|
|
77
82
|
// Add positional completions
|
|
78
83
|
if (cmd.acceptsPositional) {
|
|
79
|
-
lines.push(...this.generatePositionalCompletion(cmd.positionalType,
|
|
84
|
+
lines.push(...this.generatePositionalCompletion(cmd.positionalType, pathCondition));
|
|
80
85
|
}
|
|
81
86
|
}
|
|
82
87
|
return lines;
|
|
83
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Generate a Fish condition that checks every command segment in a path.
|
|
91
|
+
*/
|
|
92
|
+
generatePathCondition(path) {
|
|
93
|
+
return path.map((segment) => `__fish_codesdd_using_subcommand ${segment}`).join('; and ');
|
|
94
|
+
}
|
|
84
95
|
/**
|
|
85
96
|
* Generate flag completion
|
|
86
97
|
*/
|
|
@@ -92,29 +103,29 @@ ${commandCompletions}`;
|
|
|
92
103
|
// Flag with enum values
|
|
93
104
|
for (const value of flag.values) {
|
|
94
105
|
if (shortFlag) {
|
|
95
|
-
lines.push(`complete -c
|
|
106
|
+
lines.push(`complete -c codesdd -n '${condition}' -s ${flag.short} -l ${flag.name} -a '${value}' -d '${this.escapeDescription(flag.description)}'`);
|
|
96
107
|
}
|
|
97
108
|
else {
|
|
98
|
-
lines.push(`complete -c
|
|
109
|
+
lines.push(`complete -c codesdd -n '${condition}' -l ${flag.name} -a '${value}' -d '${this.escapeDescription(flag.description)}'`);
|
|
99
110
|
}
|
|
100
111
|
}
|
|
101
112
|
}
|
|
102
113
|
else if (flag.takesValue) {
|
|
103
114
|
// Flag that takes a value but no specific values defined
|
|
104
115
|
if (shortFlag) {
|
|
105
|
-
lines.push(`complete -c
|
|
116
|
+
lines.push(`complete -c codesdd -n '${condition}' -s ${flag.short} -l ${flag.name} -r -d '${this.escapeDescription(flag.description)}'`);
|
|
106
117
|
}
|
|
107
118
|
else {
|
|
108
|
-
lines.push(`complete -c
|
|
119
|
+
lines.push(`complete -c codesdd -n '${condition}' -l ${flag.name} -r -d '${this.escapeDescription(flag.description)}'`);
|
|
109
120
|
}
|
|
110
121
|
}
|
|
111
122
|
else {
|
|
112
123
|
// Boolean flag
|
|
113
124
|
if (shortFlag) {
|
|
114
|
-
lines.push(`complete -c
|
|
125
|
+
lines.push(`complete -c codesdd -n '${condition}' -s ${flag.short} -l ${flag.name} -d '${this.escapeDescription(flag.description)}'`);
|
|
115
126
|
}
|
|
116
127
|
else {
|
|
117
|
-
lines.push(`complete -c
|
|
128
|
+
lines.push(`complete -c codesdd -n '${condition}' -l ${flag.name} -d '${this.escapeDescription(flag.description)}'`);
|
|
118
129
|
}
|
|
119
130
|
}
|
|
120
131
|
return lines;
|
|
@@ -126,20 +137,23 @@ ${commandCompletions}`;
|
|
|
126
137
|
const lines = [];
|
|
127
138
|
switch (positionalType) {
|
|
128
139
|
case 'change-id':
|
|
129
|
-
lines.push(`complete -c
|
|
140
|
+
lines.push(`complete -c codesdd -n '${condition}' -a '(__fish_codesdd_changes)' -f`);
|
|
130
141
|
break;
|
|
131
142
|
case 'spec-id':
|
|
132
|
-
lines.push(`complete -c
|
|
143
|
+
lines.push(`complete -c codesdd -n '${condition}' -a '(__fish_codesdd_specs)' -f`);
|
|
133
144
|
break;
|
|
134
145
|
case 'change-or-spec-id':
|
|
135
|
-
lines.push(`complete -c
|
|
146
|
+
lines.push(`complete -c codesdd -n '${condition}' -a '(__fish_codesdd_items)' -f`);
|
|
136
147
|
break;
|
|
137
148
|
case 'shell':
|
|
138
|
-
lines.push(`complete -c
|
|
149
|
+
lines.push(`complete -c codesdd -n '${condition}' -a 'zsh bash fish powershell' -f`);
|
|
139
150
|
break;
|
|
140
151
|
case 'path':
|
|
141
152
|
// Fish automatically completes files, no need to specify
|
|
142
153
|
break;
|
|
154
|
+
case 'schema-name':
|
|
155
|
+
lines.push(`complete -c codesdd -n '${condition}' -a '(__fish_codesdd_schemas)' -f`);
|
|
156
|
+
break;
|
|
143
157
|
}
|
|
144
158
|
return lines;
|
|
145
159
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CompletionGenerator, CommandDefinition } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates PowerShell completion scripts for the
|
|
3
|
+
* Generates PowerShell completion scripts for the CodeSDD CLI.
|
|
4
4
|
* Uses Register-ArgumentCompleter for command completion.
|
|
5
5
|
*/
|
|
6
6
|
export declare class PowerShellGenerator implements CompletionGenerator {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { POWERSHELL_DYNAMIC_HELPERS } from '../templates/powershell-templates.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates PowerShell completion scripts for the
|
|
3
|
+
* Generates PowerShell completion scripts for the CodeSDD CLI.
|
|
4
4
|
* Uses Register-ArgumentCompleter for command completion.
|
|
5
5
|
*/
|
|
6
6
|
export class PowerShellGenerator {
|
|
@@ -35,11 +35,11 @@ export class PowerShellGenerator {
|
|
|
35
35
|
// Dynamic completion helpers from template
|
|
36
36
|
const helpers = POWERSHELL_DYNAMIC_HELPERS;
|
|
37
37
|
// Assemble final script with template literal
|
|
38
|
-
return `# PowerShell completion script for
|
|
38
|
+
return `# PowerShell completion script for CodeSDD CLI
|
|
39
39
|
# Auto-generated - do not edit manually
|
|
40
40
|
|
|
41
41
|
${helpers}
|
|
42
|
-
$
|
|
42
|
+
$codesddCompleter = {
|
|
43
43
|
param($wordToComplete, $commandAst, $cursorPosition)
|
|
44
44
|
|
|
45
45
|
$tokens = $commandAst.ToString() -split "\\s+"
|
|
@@ -63,13 +63,13 @@ ${commandCases}
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
Register-ArgumentCompleter -CommandName
|
|
66
|
+
Register-ArgumentCompleter -CommandName codesdd -ScriptBlock $codesddCompleter
|
|
67
67
|
`;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
70
|
* Generate completion case for a command
|
|
71
71
|
*/
|
|
72
|
-
generateCommandCase(cmd, indent) {
|
|
72
|
+
generateCommandCase(cmd, indent, depth = 2) {
|
|
73
73
|
const lines = [];
|
|
74
74
|
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
75
75
|
// First, check if user is typing a flag for the parent command
|
|
@@ -97,7 +97,7 @@ Register-ArgumentCompleter -CommandName opensdd -ScriptBlock $openspecCompleter
|
|
|
97
97
|
lines.push('');
|
|
98
98
|
}
|
|
99
99
|
// Handle subcommands
|
|
100
|
-
lines.push(`${indent}if ($commandCount -eq
|
|
100
|
+
lines.push(`${indent}if ($commandCount -eq ${depth} -or ($commandCount -eq ${depth + 1} -and $wordToComplete)) {`);
|
|
101
101
|
lines.push(`${indent} $subcommands = @(`);
|
|
102
102
|
for (const subcmd of cmd.subcommands) {
|
|
103
103
|
lines.push(`${indent} @{Name="${subcmd.name}"; Description="${this.escapeDescription(subcmd.description)}"},`);
|
|
@@ -110,11 +110,16 @@ Register-ArgumentCompleter -CommandName opensdd -ScriptBlock $openspecCompleter
|
|
|
110
110
|
lines.push(`${indent} return`);
|
|
111
111
|
lines.push(`${indent}}`);
|
|
112
112
|
lines.push('');
|
|
113
|
-
lines.push(`${indent}$subcommand = if ($commandCount -gt
|
|
113
|
+
lines.push(`${indent}$subcommand = if ($commandCount -gt ${depth}) { $tokens[${depth}] } else { "" }`);
|
|
114
114
|
lines.push(`${indent}switch ($subcommand) {`);
|
|
115
115
|
for (const subcmd of cmd.subcommands) {
|
|
116
116
|
lines.push(`${indent} "${subcmd.name}" {`);
|
|
117
|
-
|
|
117
|
+
if (subcmd.subcommands && subcmd.subcommands.length > 0) {
|
|
118
|
+
lines.push(...this.generateCommandCase(subcmd, indent + ' ', depth + 1));
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
lines.push(...this.generateArgumentCompletion(subcmd, indent + ' '));
|
|
122
|
+
}
|
|
118
123
|
lines.push(`${indent} }`);
|
|
119
124
|
}
|
|
120
125
|
lines.push(`${indent}}`);
|
|
@@ -167,17 +172,17 @@ Register-ArgumentCompleter -CommandName opensdd -ScriptBlock $openspecCompleter
|
|
|
167
172
|
const lines = [];
|
|
168
173
|
switch (positionalType) {
|
|
169
174
|
case 'change-id':
|
|
170
|
-
lines.push(`${indent}Get-
|
|
175
|
+
lines.push(`${indent}Get-CodeSDDChanges | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {`);
|
|
171
176
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", "Change: $_")`);
|
|
172
177
|
lines.push(`${indent}}`);
|
|
173
178
|
break;
|
|
174
179
|
case 'spec-id':
|
|
175
|
-
lines.push(`${indent}Get-
|
|
180
|
+
lines.push(`${indent}Get-CodeSDDSpecs | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {`);
|
|
176
181
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", "Spec: $_")`);
|
|
177
182
|
lines.push(`${indent}}`);
|
|
178
183
|
break;
|
|
179
184
|
case 'change-or-spec-id':
|
|
180
|
-
lines.push(`${indent}$items = @(Get-
|
|
185
|
+
lines.push(`${indent}$items = @(Get-CodeSDDChanges) + @(Get-CodeSDDSpecs)`);
|
|
181
186
|
lines.push(`${indent}$items | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {`);
|
|
182
187
|
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", $_)`);
|
|
183
188
|
lines.push(`${indent}}`);
|
|
@@ -191,6 +196,11 @@ Register-ArgumentCompleter -CommandName opensdd -ScriptBlock $openspecCompleter
|
|
|
191
196
|
case 'path':
|
|
192
197
|
// PowerShell handles file path completion automatically
|
|
193
198
|
break;
|
|
199
|
+
case 'schema-name':
|
|
200
|
+
lines.push(`${indent}Get-CodeSDDSchemas | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {`);
|
|
201
|
+
lines.push(`${indent} [System.Management.Automation.CompletionResult]::new($_, $_, "ParameterValue", "Schema: $_")`);
|
|
202
|
+
lines.push(`${indent}}`);
|
|
203
|
+
break;
|
|
194
204
|
}
|
|
195
205
|
return lines;
|
|
196
206
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CompletionGenerator, CommandDefinition } from '../types.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates Zsh completion scripts for the
|
|
4
|
-
* Follows Zsh completion system conventions using the
|
|
3
|
+
* Generates Zsh completion scripts for the CodeSDD CLI.
|
|
4
|
+
* Follows Zsh completion system conventions using the _codesdd function.
|
|
5
5
|
*/
|
|
6
6
|
export declare class ZshGenerator implements CompletionGenerator {
|
|
7
7
|
readonly shell: "zsh";
|
|
@@ -16,10 +16,6 @@ export declare class ZshGenerator implements CompletionGenerator {
|
|
|
16
16
|
* Generate completion function for a specific command
|
|
17
17
|
*/
|
|
18
18
|
private generateCommandFunction;
|
|
19
|
-
/**
|
|
20
|
-
* Generate completion function for a subcommand
|
|
21
|
-
*/
|
|
22
|
-
private generateSubcommandFunction;
|
|
23
19
|
/**
|
|
24
20
|
* Generate flag specification for _arguments
|
|
25
21
|
*/
|
|
@@ -40,5 +36,6 @@ export declare class ZshGenerator implements CompletionGenerator {
|
|
|
40
36
|
* Sanitize command names for use in function names
|
|
41
37
|
*/
|
|
42
38
|
private sanitizeFunctionName;
|
|
39
|
+
private functionNameForPath;
|
|
43
40
|
}
|
|
44
41
|
//# sourceMappingURL=zsh-generator.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ZSH_DYNAMIC_HELPERS } from '../templates/zsh-templates.js';
|
|
2
2
|
/**
|
|
3
|
-
* Generates Zsh completion scripts for the
|
|
4
|
-
* Follows Zsh completion system conventions using the
|
|
3
|
+
* Generates Zsh completion scripts for the CodeSDD CLI.
|
|
4
|
+
* Follows Zsh completion system conventions using the _codesdd function.
|
|
5
5
|
*/
|
|
6
6
|
export class ZshGenerator {
|
|
7
7
|
shell = 'zsh';
|
|
@@ -23,26 +23,26 @@ export class ZshGenerator {
|
|
|
23
23
|
const commandCaseLines = [];
|
|
24
24
|
for (const cmd of commands) {
|
|
25
25
|
commandCaseLines.push(` ${cmd.name})`);
|
|
26
|
-
commandCaseLines.push(`
|
|
26
|
+
commandCaseLines.push(` _codesdd_${this.sanitizeFunctionName(cmd.name)}`);
|
|
27
27
|
commandCaseLines.push(' ;;');
|
|
28
28
|
}
|
|
29
29
|
const commandCases = commandCaseLines.join('\n');
|
|
30
30
|
// Build command functions using push() for loop clarity
|
|
31
31
|
const commandFunctionLines = [];
|
|
32
32
|
for (const cmd of commands) {
|
|
33
|
-
commandFunctionLines.push(...this.generateCommandFunction(cmd));
|
|
33
|
+
commandFunctionLines.push(...this.generateCommandFunction(cmd, [cmd.name]));
|
|
34
34
|
commandFunctionLines.push('');
|
|
35
35
|
}
|
|
36
36
|
const commandFunctions = commandFunctionLines.join('\n');
|
|
37
37
|
// Dynamic completion helpers from template
|
|
38
38
|
const helpers = ZSH_DYNAMIC_HELPERS;
|
|
39
39
|
// Assemble final script with template literal
|
|
40
|
-
return `#compdef
|
|
40
|
+
return `#compdef codesdd
|
|
41
41
|
|
|
42
|
-
# Zsh completion script for
|
|
42
|
+
# Zsh completion script for CodeSDD CLI
|
|
43
43
|
# Auto-generated - do not edit manually
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
_codesdd() {
|
|
46
46
|
local context state line
|
|
47
47
|
typeset -A opt_args
|
|
48
48
|
|
|
@@ -57,7 +57,7 @@ ${commandList}
|
|
|
57
57
|
|
|
58
58
|
case $state in
|
|
59
59
|
command)
|
|
60
|
-
_describe "
|
|
60
|
+
_describe "codesdd command" commands
|
|
61
61
|
;;
|
|
62
62
|
args)
|
|
63
63
|
case $words[1] in
|
|
@@ -69,14 +69,14 @@ ${commandCases}
|
|
|
69
69
|
|
|
70
70
|
${commandFunctions}
|
|
71
71
|
${helpers}
|
|
72
|
-
compdef
|
|
72
|
+
compdef _codesdd codesdd
|
|
73
73
|
`;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Generate completion function for a specific command
|
|
77
77
|
*/
|
|
78
|
-
generateCommandFunction(cmd) {
|
|
79
|
-
const funcName =
|
|
78
|
+
generateCommandFunction(cmd, path) {
|
|
79
|
+
const funcName = this.functionNameForPath(path);
|
|
80
80
|
const lines = [];
|
|
81
81
|
lines.push(`${funcName}() {`);
|
|
82
82
|
// If command has subcommands, handle them
|
|
@@ -108,7 +108,7 @@ compdef _openspec opensdd
|
|
|
108
108
|
lines.push(' case $words[1] in');
|
|
109
109
|
for (const subcmd of cmd.subcommands) {
|
|
110
110
|
lines.push(` ${subcmd.name})`);
|
|
111
|
-
lines.push(`
|
|
111
|
+
lines.push(` ${this.functionNameForPath([...path, subcmd.name])}`);
|
|
112
112
|
lines.push(' ;;');
|
|
113
113
|
}
|
|
114
114
|
lines.push(' esac');
|
|
@@ -139,37 +139,11 @@ compdef _openspec opensdd
|
|
|
139
139
|
if (cmd.subcommands) {
|
|
140
140
|
for (const subcmd of cmd.subcommands) {
|
|
141
141
|
lines.push('');
|
|
142
|
-
lines.push(...this.
|
|
142
|
+
lines.push(...this.generateCommandFunction(subcmd, [...path, subcmd.name]));
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
return lines;
|
|
146
146
|
}
|
|
147
|
-
/**
|
|
148
|
-
* Generate completion function for a subcommand
|
|
149
|
-
*/
|
|
150
|
-
generateSubcommandFunction(parentName, subcmd) {
|
|
151
|
-
const funcName = `_openspec_${this.sanitizeFunctionName(parentName)}_${this.sanitizeFunctionName(subcmd.name)}`;
|
|
152
|
-
const lines = [];
|
|
153
|
-
lines.push(`${funcName}() {`);
|
|
154
|
-
lines.push(' _arguments \\');
|
|
155
|
-
// Add flags
|
|
156
|
-
for (const flag of subcmd.flags) {
|
|
157
|
-
lines.push(' ' + this.generateFlagSpec(flag) + ' \\');
|
|
158
|
-
}
|
|
159
|
-
// Add positional argument completion
|
|
160
|
-
if (subcmd.acceptsPositional) {
|
|
161
|
-
const positionalSpec = this.generatePositionalSpec(subcmd.positionalType);
|
|
162
|
-
lines.push(' ' + positionalSpec);
|
|
163
|
-
}
|
|
164
|
-
else {
|
|
165
|
-
// Remove trailing backslash from last flag
|
|
166
|
-
if (lines[lines.length - 1].endsWith(' \\')) {
|
|
167
|
-
lines[lines.length - 1] = lines[lines.length - 1].slice(0, -2);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
lines.push('}');
|
|
171
|
-
return lines;
|
|
172
|
-
}
|
|
173
147
|
/**
|
|
174
148
|
* Generate flag specification for _arguments
|
|
175
149
|
*/
|
|
@@ -207,15 +181,17 @@ compdef _openspec opensdd
|
|
|
207
181
|
generatePositionalSpec(positionalType) {
|
|
208
182
|
switch (positionalType) {
|
|
209
183
|
case 'change-id':
|
|
210
|
-
return "'*: :
|
|
184
|
+
return "'*: :_codesdd_complete_changes'";
|
|
211
185
|
case 'spec-id':
|
|
212
|
-
return "'*: :
|
|
186
|
+
return "'*: :_codesdd_complete_specs'";
|
|
213
187
|
case 'change-or-spec-id':
|
|
214
|
-
return "'*: :
|
|
188
|
+
return "'*: :_codesdd_complete_items'";
|
|
215
189
|
case 'path':
|
|
216
190
|
return "'*:path:_files'";
|
|
217
191
|
case 'shell':
|
|
218
192
|
return "'*:shell:(zsh bash fish powershell)'";
|
|
193
|
+
case 'schema-name':
|
|
194
|
+
return "'*: :_codesdd_complete_schemas'";
|
|
219
195
|
default:
|
|
220
196
|
return "'*: :_default'";
|
|
221
197
|
}
|
|
@@ -246,5 +222,8 @@ compdef _openspec opensdd
|
|
|
246
222
|
sanitizeFunctionName(name) {
|
|
247
223
|
return name.replace(/-/g, '_');
|
|
248
224
|
}
|
|
225
|
+
functionNameForPath(path) {
|
|
226
|
+
return `_codesdd_${path.map((segment) => this.sanitizeFunctionName(segment)).join('_')}`;
|
|
227
|
+
}
|
|
249
228
|
}
|
|
250
229
|
//# sourceMappingURL=zsh-generator.js.map
|
|
@@ -12,8 +12,8 @@ export class BashInstaller {
|
|
|
12
12
|
* Markers for .bashrc configuration management
|
|
13
13
|
*/
|
|
14
14
|
BASHRC_MARKERS = {
|
|
15
|
-
start: '#
|
|
16
|
-
end: '#
|
|
15
|
+
start: '# CODESDD:START',
|
|
16
|
+
end: '# CODESDD:END',
|
|
17
17
|
};
|
|
18
18
|
constructor(homeDir = os.homedir()) {
|
|
19
19
|
this.homeDir = homeDir;
|
|
@@ -53,7 +53,7 @@ export class BashInstaller {
|
|
|
53
53
|
// Try user-local bash-completion directory first
|
|
54
54
|
const localCompletionDir = path.join(this.homeDir, '.local', 'share', 'bash-completion', 'completions');
|
|
55
55
|
// For user installation, use local directory
|
|
56
|
-
return path.join(localCompletionDir, '
|
|
56
|
+
return path.join(localCompletionDir, 'codesdd');
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Backup an existing completion file if it exists
|
|
@@ -91,7 +91,7 @@ export class BashInstaller {
|
|
|
91
91
|
*/
|
|
92
92
|
generateBashrcConfig(completionsDir) {
|
|
93
93
|
return [
|
|
94
|
-
'#
|
|
94
|
+
'# CodeSDD shell completions configuration',
|
|
95
95
|
`if [ -d "${completionsDir}" ]; then`,
|
|
96
96
|
` for f in "${completionsDir}"/*; do`,
|
|
97
97
|
' [ -f "$f" ] && . "$f"',
|
|
@@ -107,7 +107,7 @@ export class BashInstaller {
|
|
|
107
107
|
*/
|
|
108
108
|
async configureBashrc(completionsDir) {
|
|
109
109
|
// Check if auto-configuration is disabled
|
|
110
|
-
if (process.env.
|
|
110
|
+
if (process.env.CODESDD_NO_AUTO_CONFIG === '1') {
|
|
111
111
|
return false;
|
|
112
112
|
}
|
|
113
113
|
try {
|
|
@@ -268,7 +268,7 @@ export class BashInstaller {
|
|
|
268
268
|
'',
|
|
269
269
|
'To enable completions, add the following to your ~/.bashrc file:',
|
|
270
270
|
'',
|
|
271
|
-
` # Source
|
|
271
|
+
` # Source CodeSDD completions`,
|
|
272
272
|
` if [ -d "${completionsDir}" ]; then`,
|
|
273
273
|
` for f in "${completionsDir}"/*; do`,
|
|
274
274
|
' [ -f "$f" ] && . "$f"',
|
|
@@ -16,7 +16,7 @@ export class FishInstaller {
|
|
|
16
16
|
* @returns Installation path
|
|
17
17
|
*/
|
|
18
18
|
getInstallationPath() {
|
|
19
|
-
return path.join(this.homeDir, '.config', 'fish', 'completions', '
|
|
19
|
+
return path.join(this.homeDir, '.config', 'fish', 'completions', 'codesdd.fish');
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Backup an existing completion file if it exists
|