codika 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +68 -0
- package/dist/cli/commands/completion.d.ts +15 -0
- package/dist/cli/commands/completion.d.ts.map +1 -0
- package/dist/cli/commands/completion.js +810 -0
- package/dist/cli/commands/completion.js.map +1 -0
- package/dist/cli/commands/config/clear.d.ts +12 -0
- package/dist/cli/commands/config/clear.d.ts.map +1 -0
- package/dist/cli/commands/config/clear.js +35 -0
- package/dist/cli/commands/config/clear.js.map +1 -0
- package/dist/cli/commands/config/index.d.ts +15 -0
- package/dist/cli/commands/config/index.d.ts.map +1 -0
- package/dist/cli/commands/config/index.js +21 -0
- package/dist/cli/commands/config/index.js.map +1 -0
- package/dist/cli/commands/config/set.d.ts +41 -0
- package/dist/cli/commands/config/set.d.ts.map +1 -0
- package/dist/cli/commands/config/set.js +185 -0
- package/dist/cli/commands/config/set.js.map +1 -0
- package/dist/cli/commands/config/show.d.ts +12 -0
- package/dist/cli/commands/config/show.d.ts.map +1 -0
- package/dist/cli/commands/config/show.js +45 -0
- package/dist/cli/commands/config/show.js.map +1 -0
- package/dist/cli/commands/deploy/documents.d.ts +12 -0
- package/dist/cli/commands/deploy/documents.d.ts.map +1 -0
- package/dist/cli/commands/deploy/documents.js +217 -0
- package/dist/cli/commands/deploy/documents.js.map +1 -0
- package/dist/cli/commands/deploy/index.d.ts +14 -0
- package/dist/cli/commands/deploy/index.d.ts.map +1 -0
- package/dist/cli/commands/deploy/index.js +21 -0
- package/dist/cli/commands/deploy/index.js.map +1 -0
- package/dist/cli/commands/deploy/process-data-ingestion.d.ts +13 -0
- package/dist/cli/commands/deploy/process-data-ingestion.d.ts.map +1 -0
- package/dist/cli/commands/deploy/process-data-ingestion.js +226 -0
- package/dist/cli/commands/deploy/process-data-ingestion.js.map +1 -0
- package/dist/cli/commands/deploy/use-case.d.ts +9 -0
- package/dist/cli/commands/deploy/use-case.d.ts.map +1 -0
- package/dist/cli/commands/deploy/use-case.js +212 -0
- package/dist/cli/commands/deploy/use-case.js.map +1 -0
- package/dist/cli/commands/get/execution.d.ts +9 -0
- package/dist/cli/commands/get/execution.d.ts.map +1 -0
- package/dist/cli/commands/get/execution.js +159 -0
- package/dist/cli/commands/get/execution.js.map +1 -0
- package/dist/cli/commands/get/index.d.ts +13 -0
- package/dist/cli/commands/get/index.d.ts.map +1 -0
- package/dist/cli/commands/get/index.js +20 -0
- package/dist/cli/commands/get/index.js.map +1 -0
- package/dist/cli/commands/get/skills.d.ts +15 -0
- package/dist/cli/commands/get/skills.d.ts.map +1 -0
- package/dist/cli/commands/get/skills.js +135 -0
- package/dist/cli/commands/get/skills.js.map +1 -0
- package/dist/cli/commands/get/use-case.d.ts +9 -0
- package/dist/cli/commands/get/use-case.d.ts.map +1 -0
- package/dist/cli/commands/get/use-case.js +186 -0
- package/dist/cli/commands/get/use-case.js.map +1 -0
- package/dist/cli/commands/init.d.ts +14 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +347 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/integration/delete.d.ts +13 -0
- package/dist/cli/commands/integration/delete.d.ts.map +1 -0
- package/dist/cli/commands/integration/delete.js +140 -0
- package/dist/cli/commands/integration/delete.js.map +1 -0
- package/dist/cli/commands/integration/index.d.ts +13 -0
- package/dist/cli/commands/integration/index.d.ts.map +1 -0
- package/dist/cli/commands/integration/index.js +20 -0
- package/dist/cli/commands/integration/index.js.map +1 -0
- package/dist/cli/commands/integration/list.d.ts +13 -0
- package/dist/cli/commands/integration/list.d.ts.map +1 -0
- package/dist/cli/commands/integration/list.js +129 -0
- package/dist/cli/commands/integration/list.js.map +1 -0
- package/dist/cli/commands/integration/set.d.ts +13 -0
- package/dist/cli/commands/integration/set.d.ts.map +1 -0
- package/dist/cli/commands/integration/set.js +253 -0
- package/dist/cli/commands/integration/set.js.map +1 -0
- package/dist/cli/commands/list/executions.d.ts +12 -0
- package/dist/cli/commands/list/executions.d.ts.map +1 -0
- package/dist/cli/commands/list/executions.js +168 -0
- package/dist/cli/commands/list/executions.js.map +1 -0
- package/dist/cli/commands/list/index.d.ts +11 -0
- package/dist/cli/commands/list/index.d.ts.map +1 -0
- package/dist/cli/commands/list/index.js +14 -0
- package/dist/cli/commands/list/index.js.map +1 -0
- package/dist/cli/commands/logout.d.ts +12 -0
- package/dist/cli/commands/logout.d.ts.map +1 -0
- package/dist/cli/commands/logout.js +58 -0
- package/dist/cli/commands/logout.js.map +1 -0
- package/dist/cli/commands/project/create.d.ts +8 -0
- package/dist/cli/commands/project/create.d.ts.map +1 -0
- package/dist/cli/commands/project/create.js +109 -0
- package/dist/cli/commands/project/create.js.map +1 -0
- package/dist/cli/commands/project/index.d.ts +12 -0
- package/dist/cli/commands/project/index.d.ts.map +1 -0
- package/dist/cli/commands/project/index.js +15 -0
- package/dist/cli/commands/project/index.js.map +1 -0
- package/dist/cli/commands/publish.d.ts +12 -0
- package/dist/cli/commands/publish.d.ts.map +1 -0
- package/dist/cli/commands/publish.js +152 -0
- package/dist/cli/commands/publish.js.map +1 -0
- package/dist/cli/commands/redeploy.d.ts +11 -0
- package/dist/cli/commands/redeploy.d.ts.map +1 -0
- package/dist/cli/commands/redeploy.js +166 -0
- package/dist/cli/commands/redeploy.js.map +1 -0
- package/dist/cli/commands/status.d.ts +63 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +290 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/trigger.d.ts +8 -0
- package/dist/cli/commands/trigger.d.ts.map +1 -0
- package/dist/cli/commands/trigger.js +247 -0
- package/dist/cli/commands/trigger.js.map +1 -0
- package/dist/cli/commands/use.d.ts +13 -0
- package/dist/cli/commands/use.d.ts.map +1 -0
- package/dist/cli/commands/use.js +92 -0
- package/dist/cli/commands/use.js.map +1 -0
- package/dist/cli/commands/verify/index.d.ts +13 -0
- package/dist/cli/commands/verify/index.d.ts.map +1 -0
- package/dist/cli/commands/verify/index.js +18 -0
- package/dist/cli/commands/verify/index.js.map +1 -0
- package/dist/cli/commands/verify/use-case.d.ts +23 -0
- package/dist/cli/commands/verify/use-case.d.ts.map +1 -0
- package/dist/cli/commands/verify/use-case.js +94 -0
- package/dist/cli/commands/verify/use-case.js.map +1 -0
- package/dist/cli/commands/verify/workflow.d.ts +22 -0
- package/dist/cli/commands/verify/workflow.d.ts.map +1 -0
- package/dist/cli/commands/verify/workflow.js +82 -0
- package/dist/cli/commands/verify/workflow.js.map +1 -0
- package/dist/cli/commands/whoami.d.ts +13 -0
- package/dist/cli/commands/whoami.d.ts.map +1 -0
- package/dist/cli/commands/whoami.js +126 -0
- package/dist/cli/commands/whoami.js.map +1 -0
- package/dist/cli/index.d.ts +24 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +90 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/templates/claude-md-template.d.ts +12 -0
- package/dist/cli/templates/claude-md-template.d.ts.map +1 -0
- package/dist/cli/templates/claude-md-template.js +162 -0
- package/dist/cli/templates/claude-md-template.js.map +1 -0
- package/dist/cli/templates/config-template.d.ts +18 -0
- package/dist/cli/templates/config-template.d.ts.map +1 -0
- package/dist/cli/templates/config-template.js +350 -0
- package/dist/cli/templates/config-template.js.map +1 -0
- package/dist/cli/templates/skill-templates.d.ts +24 -0
- package/dist/cli/templates/skill-templates.d.ts.map +1 -0
- package/dist/cli/templates/skill-templates.js +117 -0
- package/dist/cli/templates/skill-templates.js.map +1 -0
- package/dist/cli/templates/slug.d.ts +9 -0
- package/dist/cli/templates/slug.d.ts.map +1 -0
- package/dist/cli/templates/slug.js +17 -0
- package/dist/cli/templates/slug.js.map +1 -0
- package/dist/cli/templates/workflow-templates.d.ts +693 -0
- package/dist/cli/templates/workflow-templates.d.ts.map +1 -0
- package/dist/cli/templates/workflow-templates.js +516 -0
- package/dist/cli/templates/workflow-templates.js.map +1 -0
- package/dist/cli/utils/output.d.ts +65 -0
- package/dist/cli/utils/output.d.ts.map +1 -0
- package/dist/cli/utils/output.js +188 -0
- package/dist/cli/utils/output.js.map +1 -0
- package/dist/cli/utils/validation-output.d.ts +21 -0
- package/dist/cli/utils/validation-output.d.ts.map +1 -0
- package/dist/cli/utils/validation-output.js +204 -0
- package/dist/cli/utils/validation-output.js.map +1 -0
- package/dist/data/integration-fields.d.ts +27 -0
- package/dist/data/integration-fields.d.ts.map +1 -0
- package/dist/data/integration-fields.js +361 -0
- package/dist/data/integration-fields.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +39 -0
- package/dist/index.js.map +1 -0
- package/dist/types/process-types.d.ts +740 -0
- package/dist/types/process-types.d.ts.map +1 -0
- package/dist/types/process-types.js +22 -0
- package/dist/types/process-types.js.map +1 -0
- package/dist/utils/config.d.ts +127 -0
- package/dist/utils/config.d.ts.map +1 -0
- package/dist/utils/config.js +315 -0
- package/dist/utils/config.js.map +1 -0
- package/dist/utils/data-ingestion-deploy-client.d.ts +53 -0
- package/dist/utils/data-ingestion-deploy-client.d.ts.map +1 -0
- package/dist/utils/data-ingestion-deploy-client.js +63 -0
- package/dist/utils/data-ingestion-deploy-client.js.map +1 -0
- package/dist/utils/data-ingestion-deployer.d.ts +78 -0
- package/dist/utils/data-ingestion-deployer.d.ts.map +1 -0
- package/dist/utils/data-ingestion-deployer.js +119 -0
- package/dist/utils/data-ingestion-deployer.js.map +1 -0
- package/dist/utils/deploy-client.d.ts +55 -0
- package/dist/utils/deploy-client.d.ts.map +1 -0
- package/dist/utils/deploy-client.js +73 -0
- package/dist/utils/deploy-client.js.map +1 -0
- package/dist/utils/deployment-archiver.d.ts +110 -0
- package/dist/utils/deployment-archiver.d.ts.map +1 -0
- package/dist/utils/deployment-archiver.js +158 -0
- package/dist/utils/deployment-archiver.js.map +1 -0
- package/dist/utils/document-deploy-client.d.ts +41 -0
- package/dist/utils/document-deploy-client.d.ts.map +1 -0
- package/dist/utils/document-deploy-client.js +46 -0
- package/dist/utils/document-deploy-client.js.map +1 -0
- package/dist/utils/encryption.d.ts +85 -0
- package/dist/utils/encryption.d.ts.map +1 -0
- package/dist/utils/encryption.js +162 -0
- package/dist/utils/encryption.js.map +1 -0
- package/dist/utils/execution-client.d.ts +71 -0
- package/dist/utils/execution-client.d.ts.map +1 -0
- package/dist/utils/execution-client.js +56 -0
- package/dist/utils/execution-client.js.map +1 -0
- package/dist/utils/integration-client.d.ts +134 -0
- package/dist/utils/integration-client.d.ts.map +1 -0
- package/dist/utils/integration-client.js +109 -0
- package/dist/utils/integration-client.js.map +1 -0
- package/dist/utils/list-executions-client.d.ts +47 -0
- package/dist/utils/list-executions-client.d.ts.map +1 -0
- package/dist/utils/list-executions-client.js +50 -0
- package/dist/utils/list-executions-client.js.map +1 -0
- package/dist/utils/metadata-client.d.ts +90 -0
- package/dist/utils/metadata-client.d.ts.map +1 -0
- package/dist/utils/metadata-client.js +66 -0
- package/dist/utils/metadata-client.js.map +1 -0
- package/dist/utils/project-client.d.ts +70 -0
- package/dist/utils/project-client.d.ts.map +1 -0
- package/dist/utils/project-client.js +63 -0
- package/dist/utils/project-client.js.map +1 -0
- package/dist/utils/project-json.d.ts +71 -0
- package/dist/utils/project-json.d.ts.map +1 -0
- package/dist/utils/project-json.js +129 -0
- package/dist/utils/project-json.js.map +1 -0
- package/dist/utils/publish-client.d.ts +53 -0
- package/dist/utils/publish-client.d.ts.map +1 -0
- package/dist/utils/publish-client.js +64 -0
- package/dist/utils/publish-client.js.map +1 -0
- package/dist/utils/redeploy-client.d.ts +39 -0
- package/dist/utils/redeploy-client.d.ts.map +1 -0
- package/dist/utils/redeploy-client.js +51 -0
- package/dist/utils/redeploy-client.js.map +1 -0
- package/dist/utils/skill-parser.d.ts +52 -0
- package/dist/utils/skill-parser.d.ts.map +1 -0
- package/dist/utils/skill-parser.js +127 -0
- package/dist/utils/skill-parser.js.map +1 -0
- package/dist/utils/skills-client.d.ts +39 -0
- package/dist/utils/skills-client.d.ts.map +1 -0
- package/dist/utils/skills-client.js +32 -0
- package/dist/utils/skills-client.js.map +1 -0
- package/dist/utils/trigger-client.d.ts +78 -0
- package/dist/utils/trigger-client.d.ts.map +1 -0
- package/dist/utils/trigger-client.js +81 -0
- package/dist/utils/trigger-client.js.map +1 -0
- package/dist/utils/use-case-deployer.d.ts +93 -0
- package/dist/utils/use-case-deployer.d.ts.map +1 -0
- package/dist/utils/use-case-deployer.js +270 -0
- package/dist/utils/use-case-deployer.js.map +1 -0
- package/dist/utils/version-manager.d.ts +63 -0
- package/dist/utils/version-manager.d.ts.map +1 -0
- package/dist/utils/version-manager.js +91 -0
- package/dist/utils/version-manager.js.map +1 -0
- package/dist/utils/workflow-encoding.d.ts +26 -0
- package/dist/utils/workflow-encoding.d.ts.map +1 -0
- package/dist/utils/workflow-encoding.js +41 -0
- package/dist/utils/workflow-encoding.js.map +1 -0
- package/dist/validation/fixer.d.ts +56 -0
- package/dist/validation/fixer.d.ts.map +1 -0
- package/dist/validation/fixer.js +168 -0
- package/dist/validation/fixer.js.map +1 -0
- package/dist/validation/rules/codika-init-required.d.ts +18 -0
- package/dist/validation/rules/codika-init-required.d.ts.map +1 -0
- package/dist/validation/rules/codika-init-required.js +70 -0
- package/dist/validation/rules/codika-init-required.js.map +1 -0
- package/dist/validation/rules/codika-submit-result.d.ts +22 -0
- package/dist/validation/rules/codika-submit-result.d.ts.map +1 -0
- package/dist/validation/rules/codika-submit-result.js +144 -0
- package/dist/validation/rules/codika-submit-result.js.map +1 -0
- package/dist/validation/rules/error-branch-required.d.ts +24 -0
- package/dist/validation/rules/error-branch-required.d.ts.map +1 -0
- package/dist/validation/rules/error-branch-required.js +103 -0
- package/dist/validation/rules/error-branch-required.js.map +1 -0
- package/dist/validation/rules/index.d.ts +18 -0
- package/dist/validation/rules/index.d.ts.map +1 -0
- package/dist/validation/rules/index.js +28 -0
- package/dist/validation/rules/index.js.map +1 -0
- package/dist/validation/rules/schedule-webhook-convergence.d.ts +24 -0
- package/dist/validation/rules/schedule-webhook-convergence.d.ts.map +1 -0
- package/dist/validation/rules/schedule-webhook-convergence.js +129 -0
- package/dist/validation/rules/schedule-webhook-convergence.js.map +1 -0
- package/dist/validation/rules/subworkflow-min-params.d.ts +21 -0
- package/dist/validation/rules/subworkflow-min-params.d.ts.map +1 -0
- package/dist/validation/rules/subworkflow-min-params.js +84 -0
- package/dist/validation/rules/subworkflow-min-params.js.map +1 -0
- package/dist/validation/runner.d.ts +43 -0
- package/dist/validation/runner.d.ts.map +1 -0
- package/dist/validation/runner.js +335 -0
- package/dist/validation/runner.js.map +1 -0
- package/dist/validation/types.d.ts +155 -0
- package/dist/validation/types.d.ts.map +1 -0
- package/dist/validation/types.js +8 -0
- package/dist/validation/types.js.map +1 -0
- package/dist/validation/use-case-scripts/calledby-consistency.d.ts +23 -0
- package/dist/validation/use-case-scripts/calledby-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/calledby-consistency.js +236 -0
- package/dist/validation/use-case-scripts/calledby-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/config-exports.d.ts +17 -0
- package/dist/validation/use-case-scripts/config-exports.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/config-exports.js +93 -0
- package/dist/validation/use-case-scripts/config-exports.js.map +1 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.d.ts +21 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.js +378 -0
- package/dist/validation/use-case-scripts/custom-integration-schema.js.map +1 -0
- package/dist/validation/use-case-scripts/index.d.ts +27 -0
- package/dist/validation/use-case-scripts/index.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/index.js +52 -0
- package/dist/validation/use-case-scripts/index.js.map +1 -0
- package/dist/validation/use-case-scripts/integration-inheritance.d.ts +35 -0
- package/dist/validation/use-case-scripts/integration-inheritance.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/integration-inheritance.js +348 -0
- package/dist/validation/use-case-scripts/integration-inheritance.js.map +1 -0
- package/dist/validation/use-case-scripts/schema-types.d.ts +21 -0
- package/dist/validation/use-case-scripts/schema-types.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/schema-types.js +134 -0
- package/dist/validation/use-case-scripts/schema-types.js.map +1 -0
- package/dist/validation/use-case-scripts/skill-consistency.d.ts +21 -0
- package/dist/validation/use-case-scripts/skill-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/skill-consistency.js +180 -0
- package/dist/validation/use-case-scripts/skill-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/subworkflow-references.d.ts +22 -0
- package/dist/validation/use-case-scripts/subworkflow-references.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/subworkflow-references.js +139 -0
- package/dist/validation/use-case-scripts/subworkflow-references.js.map +1 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.d.ts +25 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.js +265 -0
- package/dist/validation/use-case-scripts/trigger-type-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/trigger-types.d.ts +20 -0
- package/dist/validation/use-case-scripts/trigger-types.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/trigger-types.js +177 -0
- package/dist/validation/use-case-scripts/trigger-types.js.map +1 -0
- package/dist/validation/use-case-scripts/triggers-required.d.ts +23 -0
- package/dist/validation/use-case-scripts/triggers-required.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/triggers-required.js +111 -0
- package/dist/validation/use-case-scripts/triggers-required.js.map +1 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.d.ts +28 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.js +288 -0
- package/dist/validation/use-case-scripts/webhook-path-consistency.js.map +1 -0
- package/dist/validation/use-case-scripts/workflow-imports.d.ts +16 -0
- package/dist/validation/use-case-scripts/workflow-imports.d.ts.map +1 -0
- package/dist/validation/use-case-scripts/workflow-imports.js +206 -0
- package/dist/validation/use-case-scripts/workflow-imports.js.map +1 -0
- package/dist/validation/workflow-scripts/credential-placeholders.d.ts +21 -0
- package/dist/validation/workflow-scripts/credential-placeholders.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/credential-placeholders.js +278 -0
- package/dist/validation/workflow-scripts/credential-placeholders.js.map +1 -0
- package/dist/validation/workflow-scripts/db-always-output.d.ts +16 -0
- package/dist/validation/workflow-scripts/db-always-output.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/db-always-output.js +95 -0
- package/dist/validation/workflow-scripts/db-always-output.js.map +1 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.d.ts +15 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.js +85 -0
- package/dist/validation/workflow-scripts/exec-workflow-wait.js.map +1 -0
- package/dist/validation/workflow-scripts/index.d.ts +31 -0
- package/dist/validation/workflow-scripts/index.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/index.js +58 -0
- package/dist/validation/workflow-scripts/index.js.map +1 -0
- package/dist/validation/workflow-scripts/instparm-quoting.d.ts +21 -0
- package/dist/validation/workflow-scripts/instparm-quoting.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/instparm-quoting.js +59 -0
- package/dist/validation/workflow-scripts/instparm-quoting.js.map +1 -0
- package/dist/validation/workflow-scripts/llm-model-id.d.ts +17 -0
- package/dist/validation/workflow-scripts/llm-model-id.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/llm-model-id.js +171 -0
- package/dist/validation/workflow-scripts/llm-model-id.js.map +1 -0
- package/dist/validation/workflow-scripts/llm-output-access.d.ts +23 -0
- package/dist/validation/workflow-scripts/llm-output-access.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/llm-output-access.js +274 -0
- package/dist/validation/workflow-scripts/llm-output-access.js.map +1 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.d.ts +20 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.js +87 -0
- package/dist/validation/workflow-scripts/merge-before-terminal.js.map +1 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.d.ts +29 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.js +154 -0
- package/dist/validation/workflow-scripts/placeholder-syntax.js.map +1 -0
- package/dist/validation/workflow-scripts/retry-backoff.d.ts +16 -0
- package/dist/validation/workflow-scripts/retry-backoff.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/retry-backoff.js +197 -0
- package/dist/validation/workflow-scripts/retry-backoff.js.map +1 -0
- package/dist/validation/workflow-scripts/webhook-id.d.ts +17 -0
- package/dist/validation/workflow-scripts/webhook-id.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/webhook-id.js +79 -0
- package/dist/validation/workflow-scripts/webhook-id.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-format.d.ts +16 -0
- package/dist/validation/workflow-scripts/workflow-format.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-format.js +51 -0
- package/dist/validation/workflow-scripts/workflow-format.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.d.ts +21 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.js +78 -0
- package/dist/validation/workflow-scripts/workflow-sanitization.js.map +1 -0
- package/dist/validation/workflow-scripts/workflow-settings.d.ts +19 -0
- package/dist/validation/workflow-scripts/workflow-settings.d.ts.map +1 -0
- package/dist/validation/workflow-scripts/workflow-settings.js +131 -0
- package/dist/validation/workflow-scripts/workflow-settings.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,810 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Completion Command
|
|
3
|
+
*
|
|
4
|
+
* Generate shell completion scripts for bash, zsh, and fish.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* codika completion bash # print bash completion script
|
|
8
|
+
* codika completion zsh # print zsh completion script
|
|
9
|
+
* codika completion fish # print fish completion script
|
|
10
|
+
* codika completion --install # auto-detect shell and install
|
|
11
|
+
* codika completion --uninstall # remove installed completion
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
import { homedir } from 'os';
|
|
15
|
+
import { join } from 'path';
|
|
16
|
+
import { existsSync, readFileSync, appendFileSync, writeFileSync, mkdirSync, unlinkSync } from 'fs';
|
|
17
|
+
const BEGIN_MARKER = '# BEGIN codika completion';
|
|
18
|
+
const END_MARKER = '# END codika completion';
|
|
19
|
+
// ── Shell detection ──────────────────────────────────────
|
|
20
|
+
function detectShell() {
|
|
21
|
+
const shell = process.env.SHELL || '';
|
|
22
|
+
if (shell.endsWith('/zsh') || shell.endsWith('/zsh5'))
|
|
23
|
+
return 'zsh';
|
|
24
|
+
if (shell.endsWith('/bash'))
|
|
25
|
+
return 'bash';
|
|
26
|
+
if (shell.endsWith('/fish'))
|
|
27
|
+
return 'fish';
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
function getRcFile(shell) {
|
|
31
|
+
switch (shell) {
|
|
32
|
+
case 'bash':
|
|
33
|
+
return join(homedir(), '.bashrc');
|
|
34
|
+
case 'zsh':
|
|
35
|
+
return join(homedir(), '.zshrc');
|
|
36
|
+
case 'fish':
|
|
37
|
+
return join(homedir(), '.config', 'fish', 'completions', 'codika.fish');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// ── Bash completion ──────────────────────────────────────
|
|
41
|
+
function generateBashCompletion() {
|
|
42
|
+
return `# codika bash completion
|
|
43
|
+
_codika_completions() {
|
|
44
|
+
local cur prev words cword
|
|
45
|
+
_init_completion || return
|
|
46
|
+
|
|
47
|
+
# Collect all words before current
|
|
48
|
+
local cmd=""
|
|
49
|
+
local subcmd=""
|
|
50
|
+
for ((i=1; i < cword; i++)); do
|
|
51
|
+
case "\${words[i]}" in
|
|
52
|
+
-*)
|
|
53
|
+
;;
|
|
54
|
+
*)
|
|
55
|
+
if [[ -z "$cmd" ]]; then
|
|
56
|
+
cmd="\${words[i]}"
|
|
57
|
+
elif [[ -z "$subcmd" ]]; then
|
|
58
|
+
subcmd="\${words[i]}"
|
|
59
|
+
fi
|
|
60
|
+
;;
|
|
61
|
+
esac
|
|
62
|
+
done
|
|
63
|
+
|
|
64
|
+
# Top-level commands
|
|
65
|
+
local commands="deploy get project verify config trigger login init whoami use logout status completion"
|
|
66
|
+
|
|
67
|
+
# Subcommand completions
|
|
68
|
+
case "$cmd" in
|
|
69
|
+
deploy)
|
|
70
|
+
if [[ -z "$subcmd" ]]; then
|
|
71
|
+
COMPREPLY=( $(compgen -W "use-case process-data-ingestion" -- "$cur") )
|
|
72
|
+
return
|
|
73
|
+
fi
|
|
74
|
+
case "$subcmd" in
|
|
75
|
+
use-case)
|
|
76
|
+
COMPREPLY=( $(compgen -W "--api-url --api-key --project-id --project-file --patch --minor --major --version --additional-file --json --dry-run" -- "$cur") )
|
|
77
|
+
return
|
|
78
|
+
;;
|
|
79
|
+
process-data-ingestion)
|
|
80
|
+
COMPREPLY=( $(compgen -W "--api-url --api-key --project-id --project-file --version-strategy --explicit-version --json" -- "$cur") )
|
|
81
|
+
return
|
|
82
|
+
;;
|
|
83
|
+
esac
|
|
84
|
+
;;
|
|
85
|
+
get)
|
|
86
|
+
if [[ -z "$subcmd" ]]; then
|
|
87
|
+
COMPREPLY=( $(compgen -W "execution use-case" -- "$cur") )
|
|
88
|
+
return
|
|
89
|
+
fi
|
|
90
|
+
case "$subcmd" in
|
|
91
|
+
execution)
|
|
92
|
+
COMPREPLY=( $(compgen -W "--api-key --process-instance-id --project-file --deep --slim --json" -- "$cur") )
|
|
93
|
+
return
|
|
94
|
+
;;
|
|
95
|
+
use-case)
|
|
96
|
+
COMPREPLY=( $(compgen -W "--api-key --project-id --version --include-content --json" -- "$cur") )
|
|
97
|
+
return
|
|
98
|
+
;;
|
|
99
|
+
esac
|
|
100
|
+
;;
|
|
101
|
+
project)
|
|
102
|
+
if [[ -z "$subcmd" ]]; then
|
|
103
|
+
COMPREPLY=( $(compgen -W "create" -- "$cur") )
|
|
104
|
+
return
|
|
105
|
+
fi
|
|
106
|
+
case "$subcmd" in
|
|
107
|
+
create)
|
|
108
|
+
COMPREPLY=( $(compgen -W "--name --api-url --api-key --organization-id --path --project-file --json" -- "$cur") )
|
|
109
|
+
return
|
|
110
|
+
;;
|
|
111
|
+
esac
|
|
112
|
+
;;
|
|
113
|
+
verify)
|
|
114
|
+
if [[ -z "$subcmd" ]]; then
|
|
115
|
+
COMPREPLY=( $(compgen -W "use-case workflow" -- "$cur") )
|
|
116
|
+
return
|
|
117
|
+
fi
|
|
118
|
+
case "$subcmd" in
|
|
119
|
+
use-case)
|
|
120
|
+
COMPREPLY=( $(compgen -W "--json --strict --fix --dry-run --rules --exclude-rules --skip-workflows" -- "$cur") )
|
|
121
|
+
return
|
|
122
|
+
;;
|
|
123
|
+
workflow)
|
|
124
|
+
COMPREPLY=( $(compgen -W "--json --strict --fix --dry-run --rules --exclude-rules" -- "$cur") )
|
|
125
|
+
return
|
|
126
|
+
;;
|
|
127
|
+
esac
|
|
128
|
+
;;
|
|
129
|
+
config)
|
|
130
|
+
if [[ -z "$subcmd" ]]; then
|
|
131
|
+
COMPREPLY=( $(compgen -W "set show clear" -- "$cur") )
|
|
132
|
+
return
|
|
133
|
+
fi
|
|
134
|
+
case "$subcmd" in
|
|
135
|
+
clear)
|
|
136
|
+
COMPREPLY=( $(compgen -W "--profile" -- "$cur") )
|
|
137
|
+
return
|
|
138
|
+
;;
|
|
139
|
+
esac
|
|
140
|
+
;;
|
|
141
|
+
trigger)
|
|
142
|
+
COMPREPLY=( $(compgen -W "--api-key --process-instance-id --workflow-id --project-file --payload-file --json --poll --timeout --output --path" -- "$cur") )
|
|
143
|
+
return
|
|
144
|
+
;;
|
|
145
|
+
login)
|
|
146
|
+
COMPREPLY=( $(compgen -W "--api-key --base-url --name --skip-verify" -- "$cur") )
|
|
147
|
+
return
|
|
148
|
+
;;
|
|
149
|
+
init)
|
|
150
|
+
COMPREPLY=( $(compgen -W "--name --description --icon --no-project --project-id --project-file --no-install --api-url --api-key --json" -- "$cur") )
|
|
151
|
+
return
|
|
152
|
+
;;
|
|
153
|
+
whoami)
|
|
154
|
+
COMPREPLY=( $(compgen -W "--json --fresh" -- "$cur") )
|
|
155
|
+
return
|
|
156
|
+
;;
|
|
157
|
+
status)
|
|
158
|
+
COMPREPLY=( $(compgen -W "--json --verify --project-file" -- "$cur") )
|
|
159
|
+
return
|
|
160
|
+
;;
|
|
161
|
+
use)
|
|
162
|
+
local profiles
|
|
163
|
+
profiles=$(codika use --list-names 2>/dev/null)
|
|
164
|
+
COMPREPLY=( $(compgen -W "$profiles" -- "$cur") )
|
|
165
|
+
return
|
|
166
|
+
;;
|
|
167
|
+
logout)
|
|
168
|
+
local profiles
|
|
169
|
+
profiles=$(codika use --list-names 2>/dev/null)
|
|
170
|
+
COMPREPLY=( $(compgen -W "$profiles" -- "$cur") )
|
|
171
|
+
return
|
|
172
|
+
;;
|
|
173
|
+
completion)
|
|
174
|
+
if [[ -z "$subcmd" ]]; then
|
|
175
|
+
COMPREPLY=( $(compgen -W "bash zsh fish --install --uninstall" -- "$cur") )
|
|
176
|
+
return
|
|
177
|
+
fi
|
|
178
|
+
;;
|
|
179
|
+
esac
|
|
180
|
+
|
|
181
|
+
# Default: complete top-level commands
|
|
182
|
+
if [[ -z "$cmd" ]]; then
|
|
183
|
+
COMPREPLY=( $(compgen -W "$commands" -- "$cur") )
|
|
184
|
+
fi
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
complete -o default -F _codika_completions codika`;
|
|
188
|
+
}
|
|
189
|
+
// ── Zsh completion ───────────────────────────────────────
|
|
190
|
+
function generateZshCompletion() {
|
|
191
|
+
return `#compdef codika
|
|
192
|
+
# codika zsh completion
|
|
193
|
+
|
|
194
|
+
_codika() {
|
|
195
|
+
local -a commands
|
|
196
|
+
local curcontext="$curcontext" state line
|
|
197
|
+
|
|
198
|
+
_arguments -C \\
|
|
199
|
+
'1:command:->command' \\
|
|
200
|
+
'*::arg:->args'
|
|
201
|
+
|
|
202
|
+
case $state in
|
|
203
|
+
command)
|
|
204
|
+
commands=(
|
|
205
|
+
'deploy:Deploy use cases or data ingestion configurations'
|
|
206
|
+
'get:Fetch execution details or use case information'
|
|
207
|
+
'project:Manage projects'
|
|
208
|
+
'verify:Validate use cases and workflows'
|
|
209
|
+
'config:Manage CLI configuration'
|
|
210
|
+
'trigger:Trigger a workflow execution'
|
|
211
|
+
'login:Save API key'
|
|
212
|
+
'init:Scaffold a new use case folder'
|
|
213
|
+
'whoami:Show current authenticated identity'
|
|
214
|
+
'use:Switch active profile or list profiles'
|
|
215
|
+
'logout:Remove a profile'
|
|
216
|
+
'status:Show project status'
|
|
217
|
+
'completion:Generate shell completion scripts'
|
|
218
|
+
)
|
|
219
|
+
_describe 'command' commands
|
|
220
|
+
;;
|
|
221
|
+
args)
|
|
222
|
+
case $line[1] in
|
|
223
|
+
deploy)
|
|
224
|
+
_arguments -C \\
|
|
225
|
+
'1:subcommand:->deploy_sub' \\
|
|
226
|
+
'*::arg:->deploy_args'
|
|
227
|
+
case $state in
|
|
228
|
+
deploy_sub)
|
|
229
|
+
local -a deploy_commands
|
|
230
|
+
deploy_commands=(
|
|
231
|
+
'use-case:Deploy a use case to the Codika platform'
|
|
232
|
+
'process-data-ingestion:Deploy process-level data ingestion'
|
|
233
|
+
)
|
|
234
|
+
_describe 'subcommand' deploy_commands
|
|
235
|
+
;;
|
|
236
|
+
deploy_args)
|
|
237
|
+
case $line[1] in
|
|
238
|
+
use-case)
|
|
239
|
+
_arguments \\
|
|
240
|
+
'--api-url[API base URL]:url:' \\
|
|
241
|
+
'--api-key[API key]:key:' \\
|
|
242
|
+
'--project-id[Project ID]:id:' \\
|
|
243
|
+
'--project-file[Custom project file]:file:_files -g "*.json"' \\
|
|
244
|
+
'--patch[Bump patch version]' \\
|
|
245
|
+
'--minor[Bump minor version]' \\
|
|
246
|
+
'--major[Bump major version]' \\
|
|
247
|
+
'--version[Explicit version]:version:' \\
|
|
248
|
+
'--additional-file[Additional file to include]:file:_files' \\
|
|
249
|
+
'--json[Output as JSON]' \\
|
|
250
|
+
'--dry-run[Dry run without deploying]' \\
|
|
251
|
+
'*:path:_files -/'
|
|
252
|
+
;;
|
|
253
|
+
process-data-ingestion)
|
|
254
|
+
_arguments \\
|
|
255
|
+
'--api-url[API base URL]:url:' \\
|
|
256
|
+
'--api-key[API key]:key:' \\
|
|
257
|
+
'--project-id[Project ID]:id:' \\
|
|
258
|
+
'--project-file[Custom project file]:file:_files -g "*.json"' \\
|
|
259
|
+
'--version-strategy[Version strategy]:strategy:(patch minor major)' \\
|
|
260
|
+
'--explicit-version[Explicit version]:version:' \\
|
|
261
|
+
'--json[Output as JSON]' \\
|
|
262
|
+
'*:path:_files -/'
|
|
263
|
+
;;
|
|
264
|
+
esac
|
|
265
|
+
;;
|
|
266
|
+
esac
|
|
267
|
+
;;
|
|
268
|
+
get)
|
|
269
|
+
_arguments -C \\
|
|
270
|
+
'1:subcommand:->get_sub' \\
|
|
271
|
+
'*::arg:->get_args'
|
|
272
|
+
case $state in
|
|
273
|
+
get_sub)
|
|
274
|
+
local -a get_commands
|
|
275
|
+
get_commands=(
|
|
276
|
+
'execution:Fetch execution details'
|
|
277
|
+
'use-case:Fetch use case information'
|
|
278
|
+
)
|
|
279
|
+
_describe 'subcommand' get_commands
|
|
280
|
+
;;
|
|
281
|
+
get_args)
|
|
282
|
+
case $line[1] in
|
|
283
|
+
execution)
|
|
284
|
+
_arguments \\
|
|
285
|
+
'--api-key[API key]:key:' \\
|
|
286
|
+
'--process-instance-id[Process instance ID]:id:' \\
|
|
287
|
+
'--project-file[Custom project file]:file:_files -g "*.json"' \\
|
|
288
|
+
'--deep[Include full details]' \\
|
|
289
|
+
'--slim[Minimal output]' \\
|
|
290
|
+
'--json[Output as JSON]'
|
|
291
|
+
;;
|
|
292
|
+
use-case)
|
|
293
|
+
_arguments \\
|
|
294
|
+
'--api-key[API key]:key:' \\
|
|
295
|
+
'--project-id[Project ID]:id:' \\
|
|
296
|
+
'--version[Version]:version:' \\
|
|
297
|
+
'--include-content[Include workflow content]' \\
|
|
298
|
+
'--json[Output as JSON]'
|
|
299
|
+
;;
|
|
300
|
+
esac
|
|
301
|
+
;;
|
|
302
|
+
esac
|
|
303
|
+
;;
|
|
304
|
+
project)
|
|
305
|
+
_arguments -C \\
|
|
306
|
+
'1:subcommand:->project_sub' \\
|
|
307
|
+
'*::arg:->project_args'
|
|
308
|
+
case $state in
|
|
309
|
+
project_sub)
|
|
310
|
+
local -a project_commands
|
|
311
|
+
project_commands=(
|
|
312
|
+
'create:Create a new project'
|
|
313
|
+
)
|
|
314
|
+
_describe 'subcommand' project_commands
|
|
315
|
+
;;
|
|
316
|
+
project_args)
|
|
317
|
+
case $line[1] in
|
|
318
|
+
create)
|
|
319
|
+
_arguments \\
|
|
320
|
+
'--name[Project name]:name:' \\
|
|
321
|
+
'--api-url[API base URL]:url:' \\
|
|
322
|
+
'--api-key[API key]:key:' \\
|
|
323
|
+
'--organization-id[Organization ID]:id:' \\
|
|
324
|
+
'--path[Path to write project.json]:path:_files -/' \\
|
|
325
|
+
'--project-file[Custom project file name]:file:' \\
|
|
326
|
+
'--json[Output as JSON]'
|
|
327
|
+
;;
|
|
328
|
+
esac
|
|
329
|
+
;;
|
|
330
|
+
esac
|
|
331
|
+
;;
|
|
332
|
+
verify)
|
|
333
|
+
_arguments -C \\
|
|
334
|
+
'1:subcommand:->verify_sub' \\
|
|
335
|
+
'*::arg:->verify_args'
|
|
336
|
+
case $state in
|
|
337
|
+
verify_sub)
|
|
338
|
+
local -a verify_commands
|
|
339
|
+
verify_commands=(
|
|
340
|
+
'use-case:Validate an entire use-case folder'
|
|
341
|
+
'workflow:Validate a single workflow file'
|
|
342
|
+
)
|
|
343
|
+
_describe 'subcommand' verify_commands
|
|
344
|
+
;;
|
|
345
|
+
verify_args)
|
|
346
|
+
case $line[1] in
|
|
347
|
+
use-case)
|
|
348
|
+
_arguments \\
|
|
349
|
+
'--json[Output as JSON]' \\
|
|
350
|
+
'--strict[Strict mode]' \\
|
|
351
|
+
'--fix[Auto-fix violations]' \\
|
|
352
|
+
'--dry-run[Show fixes without applying]' \\
|
|
353
|
+
'--rules[Include only specific rules]:rules:' \\
|
|
354
|
+
'--exclude-rules[Exclude specific rules]:rules:' \\
|
|
355
|
+
'--skip-workflows[Skip workflow validation]' \\
|
|
356
|
+
'*:path:_files -/'
|
|
357
|
+
;;
|
|
358
|
+
workflow)
|
|
359
|
+
_arguments \\
|
|
360
|
+
'--json[Output as JSON]' \\
|
|
361
|
+
'--strict[Strict mode]' \\
|
|
362
|
+
'--fix[Auto-fix violations]' \\
|
|
363
|
+
'--dry-run[Show fixes without applying]' \\
|
|
364
|
+
'--rules[Include only specific rules]:rules:' \\
|
|
365
|
+
'--exclude-rules[Exclude specific rules]:rules:' \\
|
|
366
|
+
'*:path:_files'
|
|
367
|
+
;;
|
|
368
|
+
esac
|
|
369
|
+
;;
|
|
370
|
+
esac
|
|
371
|
+
;;
|
|
372
|
+
config)
|
|
373
|
+
_arguments -C \\
|
|
374
|
+
'1:subcommand:->config_sub' \\
|
|
375
|
+
'*::arg:->config_args'
|
|
376
|
+
case $state in
|
|
377
|
+
config_sub)
|
|
378
|
+
local -a config_commands
|
|
379
|
+
config_commands=(
|
|
380
|
+
'set:Save API key and base URL'
|
|
381
|
+
'show:Display current configuration'
|
|
382
|
+
'clear:Remove saved configuration'
|
|
383
|
+
)
|
|
384
|
+
_describe 'subcommand' config_commands
|
|
385
|
+
;;
|
|
386
|
+
config_args)
|
|
387
|
+
case $line[1] in
|
|
388
|
+
clear)
|
|
389
|
+
_arguments \\
|
|
390
|
+
'--profile[Profile to clear]:profile:'
|
|
391
|
+
;;
|
|
392
|
+
esac
|
|
393
|
+
;;
|
|
394
|
+
esac
|
|
395
|
+
;;
|
|
396
|
+
trigger)
|
|
397
|
+
_arguments \\
|
|
398
|
+
'--api-key[API key]:key:' \\
|
|
399
|
+
'--process-instance-id[Process instance ID]:id:' \\
|
|
400
|
+
'--project-file[Custom project file]:file:_files -g "*.json"' \\
|
|
401
|
+
'--workflow-id[Workflow ID]:id:' \\
|
|
402
|
+
'--payload-file[JSON file or - for stdin]:file:_files -g "*.json"' \\
|
|
403
|
+
'--json[Output as JSON]' \\
|
|
404
|
+
'--poll[Poll for completion]' \\
|
|
405
|
+
'--timeout[Poll timeout in seconds]:seconds:' \\
|
|
406
|
+
'--output[Save result to file]:file:_files' \\
|
|
407
|
+
'--path[Use case folder path]:path:_directories'
|
|
408
|
+
;;
|
|
409
|
+
login)
|
|
410
|
+
_arguments \\
|
|
411
|
+
'--api-key[API key]:key:' \\
|
|
412
|
+
'--base-url[Base URL override]:url:' \\
|
|
413
|
+
'--name[Custom profile name]:name:' \\
|
|
414
|
+
'--skip-verify[Save without verifying]'
|
|
415
|
+
;;
|
|
416
|
+
init)
|
|
417
|
+
_arguments \\
|
|
418
|
+
'--name[Use case name]:name:' \\
|
|
419
|
+
'--description[Use case description]:description:' \\
|
|
420
|
+
'--icon[Use case icon]:icon:' \\
|
|
421
|
+
'--no-project[Skip project creation]' \\
|
|
422
|
+
'--project-id[Project ID]:id:' \\
|
|
423
|
+
'--project-file[Custom project file name]:file:' \\
|
|
424
|
+
'--no-install[Skip npm install]' \\
|
|
425
|
+
'--api-url[API base URL]:url:' \\
|
|
426
|
+
'--api-key[API key]:key:' \\
|
|
427
|
+
'--json[Output as JSON]' \\
|
|
428
|
+
'*:path:_files -/'
|
|
429
|
+
;;
|
|
430
|
+
whoami)
|
|
431
|
+
_arguments \\
|
|
432
|
+
'--json[Output as JSON]' \\
|
|
433
|
+
'--fresh[Skip cache]'
|
|
434
|
+
;;
|
|
435
|
+
status)
|
|
436
|
+
_arguments \\
|
|
437
|
+
'--json[Output as JSON]' \\
|
|
438
|
+
'--verify[Run verification]' \\
|
|
439
|
+
'--project-file[Custom project file]:file:_files -g "*.json"'
|
|
440
|
+
;;
|
|
441
|
+
use)
|
|
442
|
+
local -a profiles
|
|
443
|
+
profiles=(\${(f)"$(codika use --list-names 2>/dev/null)"})
|
|
444
|
+
_describe 'profile' profiles
|
|
445
|
+
;;
|
|
446
|
+
logout)
|
|
447
|
+
local -a profiles
|
|
448
|
+
profiles=(\${(f)"$(codika use --list-names 2>/dev/null)"})
|
|
449
|
+
_describe 'profile' profiles
|
|
450
|
+
;;
|
|
451
|
+
completion)
|
|
452
|
+
_arguments -C \\
|
|
453
|
+
'1:shell:(bash zsh fish)' \\
|
|
454
|
+
'--install[Auto-detect shell and install completion]' \\
|
|
455
|
+
'--uninstall[Remove installed completion]'
|
|
456
|
+
;;
|
|
457
|
+
esac
|
|
458
|
+
;;
|
|
459
|
+
esac
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
compdef _codika codika 2>/dev/null`;
|
|
463
|
+
}
|
|
464
|
+
// ── Fish completion ──────────────────────────────────────
|
|
465
|
+
function generateFishCompletion() {
|
|
466
|
+
return `# codika fish completion
|
|
467
|
+
|
|
468
|
+
# Disable file completions by default
|
|
469
|
+
complete -c codika -f
|
|
470
|
+
|
|
471
|
+
# Top-level commands
|
|
472
|
+
complete -c codika -n '__fish_use_subcommand' -a deploy -d 'Deploy use cases or data ingestion configurations'
|
|
473
|
+
complete -c codika -n '__fish_use_subcommand' -a get -d 'Fetch execution details or use case information'
|
|
474
|
+
complete -c codika -n '__fish_use_subcommand' -a project -d 'Manage projects'
|
|
475
|
+
complete -c codika -n '__fish_use_subcommand' -a verify -d 'Validate use cases and workflows'
|
|
476
|
+
complete -c codika -n '__fish_use_subcommand' -a config -d 'Manage CLI configuration'
|
|
477
|
+
complete -c codika -n '__fish_use_subcommand' -a trigger -d 'Trigger a workflow execution'
|
|
478
|
+
complete -c codika -n '__fish_use_subcommand' -a login -d 'Save API key'
|
|
479
|
+
complete -c codika -n '__fish_use_subcommand' -a init -d 'Scaffold a new use case folder'
|
|
480
|
+
complete -c codika -n '__fish_use_subcommand' -a whoami -d 'Show current authenticated identity'
|
|
481
|
+
complete -c codika -n '__fish_use_subcommand' -a use -d 'Switch active profile or list profiles'
|
|
482
|
+
complete -c codika -n '__fish_use_subcommand' -a logout -d 'Remove a profile'
|
|
483
|
+
complete -c codika -n '__fish_use_subcommand' -a status -d 'Show project status'
|
|
484
|
+
complete -c codika -n '__fish_use_subcommand' -a completion -d 'Generate shell completion scripts'
|
|
485
|
+
|
|
486
|
+
# deploy subcommands
|
|
487
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and not __fish_seen_subcommand_from use-case process-data-ingestion' -a use-case -d 'Deploy a use case'
|
|
488
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and not __fish_seen_subcommand_from use-case process-data-ingestion' -a process-data-ingestion -d 'Deploy data ingestion'
|
|
489
|
+
|
|
490
|
+
# deploy use-case options
|
|
491
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l api-url -d 'API base URL'
|
|
492
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l api-key -d 'API key'
|
|
493
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l project-id -d 'Project ID'
|
|
494
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l patch -d 'Bump patch version'
|
|
495
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l minor -d 'Bump minor version'
|
|
496
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l major -d 'Bump major version'
|
|
497
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l version -d 'Explicit version'
|
|
498
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l additional-file -d 'Additional file' -F
|
|
499
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l project-file -d 'Custom project file' -rF
|
|
500
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l json -d 'Output as JSON'
|
|
501
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from use-case' -l dry-run -d 'Dry run'
|
|
502
|
+
|
|
503
|
+
# deploy process-data-ingestion options
|
|
504
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l api-url -d 'API base URL'
|
|
505
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l api-key -d 'API key'
|
|
506
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l project-id -d 'Project ID'
|
|
507
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l version-strategy -d 'Version strategy'
|
|
508
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l explicit-version -d 'Explicit version'
|
|
509
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l project-file -d 'Custom project file' -rF
|
|
510
|
+
complete -c codika -n '__fish_seen_subcommand_from deploy; and __fish_seen_subcommand_from process-data-ingestion' -l json -d 'Output as JSON'
|
|
511
|
+
|
|
512
|
+
# get subcommands
|
|
513
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and not __fish_seen_subcommand_from execution use-case' -a execution -d 'Fetch execution details'
|
|
514
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and not __fish_seen_subcommand_from execution use-case' -a use-case -d 'Fetch use case information'
|
|
515
|
+
|
|
516
|
+
# get execution options
|
|
517
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l api-key -d 'API key'
|
|
518
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l process-instance-id -d 'Process instance ID'
|
|
519
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l project-file -d 'Custom project file' -rF
|
|
520
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l deep -d 'Include full details'
|
|
521
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l slim -d 'Minimal output'
|
|
522
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from execution' -l json -d 'Output as JSON'
|
|
523
|
+
|
|
524
|
+
# get use-case options
|
|
525
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from use-case' -l api-key -d 'API key'
|
|
526
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from use-case' -l project-id -d 'Project ID'
|
|
527
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from use-case' -l version -d 'Version'
|
|
528
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from use-case' -l include-content -d 'Include workflow content'
|
|
529
|
+
complete -c codika -n '__fish_seen_subcommand_from get; and __fish_seen_subcommand_from use-case' -l json -d 'Output as JSON'
|
|
530
|
+
|
|
531
|
+
# project subcommands
|
|
532
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and not __fish_seen_subcommand_from create' -a create -d 'Create a new project'
|
|
533
|
+
|
|
534
|
+
# project create options
|
|
535
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l name -d 'Project name'
|
|
536
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l api-url -d 'API base URL'
|
|
537
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l api-key -d 'API key'
|
|
538
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l organization-id -d 'Organization ID'
|
|
539
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l path -d 'Path to write project.json' -F
|
|
540
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l project-file -d 'Custom project file name'
|
|
541
|
+
complete -c codika -n '__fish_seen_subcommand_from project; and __fish_seen_subcommand_from create' -l json -d 'Output as JSON'
|
|
542
|
+
|
|
543
|
+
# verify subcommands
|
|
544
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and not __fish_seen_subcommand_from use-case workflow' -a use-case -d 'Validate a use-case folder'
|
|
545
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and not __fish_seen_subcommand_from use-case workflow' -a workflow -d 'Validate a single workflow'
|
|
546
|
+
|
|
547
|
+
# verify use-case options
|
|
548
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l json -d 'Output as JSON'
|
|
549
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l strict -d 'Strict mode'
|
|
550
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l fix -d 'Auto-fix violations'
|
|
551
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l dry-run -d 'Show fixes without applying'
|
|
552
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l rules -d 'Include only specific rules'
|
|
553
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l exclude-rules -d 'Exclude specific rules'
|
|
554
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from use-case' -l skip-workflows -d 'Skip workflow validation'
|
|
555
|
+
|
|
556
|
+
# verify workflow options
|
|
557
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l json -d 'Output as JSON'
|
|
558
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l strict -d 'Strict mode'
|
|
559
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l fix -d 'Auto-fix violations'
|
|
560
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l dry-run -d 'Show fixes without applying'
|
|
561
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l rules -d 'Include only specific rules'
|
|
562
|
+
complete -c codika -n '__fish_seen_subcommand_from verify; and __fish_seen_subcommand_from workflow' -l exclude-rules -d 'Exclude specific rules'
|
|
563
|
+
|
|
564
|
+
# config subcommands
|
|
565
|
+
complete -c codika -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set show clear' -a set -d 'Save API key and base URL'
|
|
566
|
+
complete -c codika -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set show clear' -a show -d 'Display current configuration'
|
|
567
|
+
complete -c codika -n '__fish_seen_subcommand_from config; and not __fish_seen_subcommand_from set show clear' -a clear -d 'Remove saved configuration'
|
|
568
|
+
|
|
569
|
+
# config clear options
|
|
570
|
+
complete -c codika -n '__fish_seen_subcommand_from config; and __fish_seen_subcommand_from clear' -l profile -d 'Profile to clear'
|
|
571
|
+
|
|
572
|
+
# trigger options
|
|
573
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l api-key -d 'API key'
|
|
574
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l process-instance-id -d 'Process instance ID'
|
|
575
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l project-file -d 'Custom project file' -rF
|
|
576
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l workflow-id -d 'Workflow ID'
|
|
577
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l payload-file -d 'JSON file or - for stdin' -rF
|
|
578
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l json -d 'Output as JSON'
|
|
579
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l poll -d 'Poll for completion'
|
|
580
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l timeout -d 'Poll timeout in seconds'
|
|
581
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l output -s o -d 'Save result to file' -rF
|
|
582
|
+
complete -c codika -n '__fish_seen_subcommand_from trigger' -l path -d 'Use case folder path' -rF
|
|
583
|
+
|
|
584
|
+
# login options
|
|
585
|
+
complete -c codika -n '__fish_seen_subcommand_from login' -l api-key -d 'API key'
|
|
586
|
+
complete -c codika -n '__fish_seen_subcommand_from login' -l base-url -d 'Base URL override'
|
|
587
|
+
complete -c codika -n '__fish_seen_subcommand_from login' -l name -d 'Custom profile name'
|
|
588
|
+
complete -c codika -n '__fish_seen_subcommand_from login' -l skip-verify -d 'Save without verifying'
|
|
589
|
+
|
|
590
|
+
# init options
|
|
591
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l name -d 'Use case name'
|
|
592
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l description -d 'Use case description'
|
|
593
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l icon -d 'Use case icon'
|
|
594
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l no-project -d 'Skip project creation'
|
|
595
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l project-id -d 'Project ID'
|
|
596
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l project-file -d 'Custom project file name'
|
|
597
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l no-install -d 'Skip npm install'
|
|
598
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l api-url -d 'API base URL'
|
|
599
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l api-key -d 'API key'
|
|
600
|
+
complete -c codika -n '__fish_seen_subcommand_from init' -l json -d 'Output as JSON'
|
|
601
|
+
|
|
602
|
+
# whoami options
|
|
603
|
+
complete -c codika -n '__fish_seen_subcommand_from whoami' -l json -d 'Output as JSON'
|
|
604
|
+
complete -c codika -n '__fish_seen_subcommand_from whoami' -l fresh -d 'Skip cache'
|
|
605
|
+
|
|
606
|
+
# status options
|
|
607
|
+
complete -c codika -n '__fish_seen_subcommand_from status' -l json -d 'Output as JSON'
|
|
608
|
+
complete -c codika -n '__fish_seen_subcommand_from status' -l verify -d 'Run verification'
|
|
609
|
+
complete -c codika -n '__fish_seen_subcommand_from status' -l project-file -d 'Custom project file' -rF
|
|
610
|
+
|
|
611
|
+
# use — dynamic profile names
|
|
612
|
+
complete -c codika -n '__fish_seen_subcommand_from use' -a '(codika use --list-names 2>/dev/null)' -d 'Profile'
|
|
613
|
+
|
|
614
|
+
# logout — dynamic profile names
|
|
615
|
+
complete -c codika -n '__fish_seen_subcommand_from logout' -a '(codika use --list-names 2>/dev/null)' -d 'Profile'
|
|
616
|
+
|
|
617
|
+
# completion subcommands and options
|
|
618
|
+
complete -c codika -n '__fish_seen_subcommand_from completion' -a 'bash zsh fish' -d 'Shell type'
|
|
619
|
+
complete -c codika -n '__fish_seen_subcommand_from completion' -l install -d 'Auto-detect shell and install'
|
|
620
|
+
complete -c codika -n '__fish_seen_subcommand_from completion' -l uninstall -d 'Remove installed completion'`;
|
|
621
|
+
}
|
|
622
|
+
// ── Install / Uninstall ──────────────────────────────────
|
|
623
|
+
function installCompletion() {
|
|
624
|
+
const shell = detectShell();
|
|
625
|
+
if (!shell) {
|
|
626
|
+
console.error('Could not detect shell from $SHELL environment variable.');
|
|
627
|
+
console.error('Please run one of:');
|
|
628
|
+
console.error(' codika completion bash');
|
|
629
|
+
console.error(' codika completion zsh');
|
|
630
|
+
console.error(' codika completion fish');
|
|
631
|
+
process.exit(1);
|
|
632
|
+
}
|
|
633
|
+
if (shell === 'fish') {
|
|
634
|
+
const dir = join(homedir(), '.config', 'fish', 'completions');
|
|
635
|
+
mkdirSync(dir, { recursive: true });
|
|
636
|
+
const fishFile = getRcFile(shell);
|
|
637
|
+
writeFileSync(fishFile, generateFishCompletion() + '\n');
|
|
638
|
+
console.log(`Completion installed to ${fishFile}`);
|
|
639
|
+
console.log('Restart your terminal or run: source ' + fishFile);
|
|
640
|
+
return;
|
|
641
|
+
}
|
|
642
|
+
if (shell === 'zsh') {
|
|
643
|
+
// Install as a file in ~/.zsh/completions (fpath-based)
|
|
644
|
+
const completionsDir = join(homedir(), '.zsh', 'completions');
|
|
645
|
+
const completionFile = join(completionsDir, '_codika');
|
|
646
|
+
mkdirSync(completionsDir, { recursive: true });
|
|
647
|
+
writeFileSync(completionFile, generateZshCompletion() + '\n');
|
|
648
|
+
const rcFile = getRcFile(shell);
|
|
649
|
+
let rcContent = existsSync(rcFile) ? readFileSync(rcFile, 'utf-8') : '';
|
|
650
|
+
// Remove old eval-based completion block if present
|
|
651
|
+
if (rcContent.includes(BEGIN_MARKER)) {
|
|
652
|
+
const beginIdx = rcContent.indexOf(BEGIN_MARKER);
|
|
653
|
+
const endIdx = rcContent.indexOf(END_MARKER);
|
|
654
|
+
if (beginIdx !== -1 && endIdx !== -1) {
|
|
655
|
+
const before = rcContent.slice(0, beginIdx).replace(/\n+$/, '\n');
|
|
656
|
+
const after = rcContent.slice(endIdx + END_MARKER.length).replace(/^\n+/, '\n');
|
|
657
|
+
rcContent = before + after;
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
// Build the block we need at the top: fpath + compinit
|
|
661
|
+
const fpathLine = 'fpath=(~/.zsh/completions $fpath)';
|
|
662
|
+
const compinitLine = 'autoload -Uz compinit && compinit -C';
|
|
663
|
+
const hasFpath = rcContent.includes('~/.zsh/completions');
|
|
664
|
+
const hasCompinit = /autoload.*compinit/.test(rcContent);
|
|
665
|
+
// fpath must come before compinit so compinit discovers the completions
|
|
666
|
+
const linesToPrepend = [];
|
|
667
|
+
if (!hasFpath)
|
|
668
|
+
linesToPrepend.push(fpathLine);
|
|
669
|
+
if (!hasCompinit)
|
|
670
|
+
linesToPrepend.push(compinitLine);
|
|
671
|
+
if (linesToPrepend.length > 0) {
|
|
672
|
+
rcContent = linesToPrepend.join('\n') + '\n' + rcContent;
|
|
673
|
+
}
|
|
674
|
+
writeFileSync(rcFile, rcContent);
|
|
675
|
+
if (!hasFpath)
|
|
676
|
+
console.log(`Added fpath entry to ${rcFile}`);
|
|
677
|
+
if (!hasCompinit)
|
|
678
|
+
console.log(`Added compinit to ${rcFile}`);
|
|
679
|
+
console.log(`Completion installed to ${completionFile}`);
|
|
680
|
+
console.log('Restart your terminal for changes to take effect.');
|
|
681
|
+
return;
|
|
682
|
+
}
|
|
683
|
+
// bash — eval-based approach
|
|
684
|
+
const rcFile = getRcFile(shell);
|
|
685
|
+
const block = [
|
|
686
|
+
'',
|
|
687
|
+
BEGIN_MARKER,
|
|
688
|
+
`eval "$(codika completion ${shell})"`,
|
|
689
|
+
END_MARKER,
|
|
690
|
+
'',
|
|
691
|
+
].join('\n');
|
|
692
|
+
if (existsSync(rcFile)) {
|
|
693
|
+
const content = readFileSync(rcFile, 'utf-8');
|
|
694
|
+
if (content.includes(BEGIN_MARKER)) {
|
|
695
|
+
const beginIdx = content.indexOf(BEGIN_MARKER);
|
|
696
|
+
const endIdx = content.indexOf(END_MARKER);
|
|
697
|
+
if (beginIdx !== -1 && endIdx !== -1) {
|
|
698
|
+
const before = content.slice(0, beginIdx).replace(/\n+$/, '\n');
|
|
699
|
+
const after = content.slice(endIdx + END_MARKER.length);
|
|
700
|
+
writeFileSync(rcFile, before + block.trimStart() + after);
|
|
701
|
+
console.log(`Completion updated in ${rcFile}`);
|
|
702
|
+
console.log('Restart your terminal or run: source ' + rcFile);
|
|
703
|
+
return;
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
appendFileSync(rcFile, block);
|
|
708
|
+
console.log(`Completion installed in ${rcFile}`);
|
|
709
|
+
console.log('Restart your terminal or run: source ' + rcFile);
|
|
710
|
+
}
|
|
711
|
+
function uninstallCompletion() {
|
|
712
|
+
const shell = detectShell();
|
|
713
|
+
if (!shell) {
|
|
714
|
+
console.error('Could not detect shell from $SHELL environment variable.');
|
|
715
|
+
process.exit(1);
|
|
716
|
+
}
|
|
717
|
+
if (shell === 'fish') {
|
|
718
|
+
const fishFile = getRcFile(shell);
|
|
719
|
+
if (existsSync(fishFile)) {
|
|
720
|
+
unlinkSync(fishFile);
|
|
721
|
+
console.log(`Completion removed from ${fishFile}`);
|
|
722
|
+
}
|
|
723
|
+
else {
|
|
724
|
+
console.log('No fish completion file found.');
|
|
725
|
+
}
|
|
726
|
+
return;
|
|
727
|
+
}
|
|
728
|
+
if (shell === 'zsh') {
|
|
729
|
+
// Remove fpath-based completion file
|
|
730
|
+
const completionFile = join(homedir(), '.zsh', 'completions', '_codika');
|
|
731
|
+
if (existsSync(completionFile)) {
|
|
732
|
+
unlinkSync(completionFile);
|
|
733
|
+
console.log(`Completion removed from ${completionFile}`);
|
|
734
|
+
}
|
|
735
|
+
// Also remove old eval-based block from .zshrc if present
|
|
736
|
+
const rcFile = getRcFile(shell);
|
|
737
|
+
if (existsSync(rcFile)) {
|
|
738
|
+
const content = readFileSync(rcFile, 'utf-8');
|
|
739
|
+
if (content.includes(BEGIN_MARKER)) {
|
|
740
|
+
const beginIdx = content.indexOf(BEGIN_MARKER);
|
|
741
|
+
const endIdx = content.indexOf(END_MARKER);
|
|
742
|
+
if (beginIdx !== -1 && endIdx !== -1) {
|
|
743
|
+
const before = content.slice(0, beginIdx).replace(/\n+$/, '\n');
|
|
744
|
+
const after = content.slice(endIdx + END_MARKER.length).replace(/^\n+/, '\n');
|
|
745
|
+
writeFileSync(rcFile, before + after);
|
|
746
|
+
console.log(`Removed old completion block from ${rcFile}`);
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
// bash
|
|
753
|
+
const rcFile = getRcFile(shell);
|
|
754
|
+
if (!existsSync(rcFile)) {
|
|
755
|
+
console.log(`No ${shell} rc file found at ${rcFile}`);
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
const content = readFileSync(rcFile, 'utf-8');
|
|
759
|
+
const beginIdx = content.indexOf(BEGIN_MARKER);
|
|
760
|
+
const endIdx = content.indexOf(END_MARKER);
|
|
761
|
+
if (beginIdx === -1 || endIdx === -1) {
|
|
762
|
+
console.log(`No codika completion block found in ${rcFile}`);
|
|
763
|
+
return;
|
|
764
|
+
}
|
|
765
|
+
const before = content.slice(0, beginIdx).replace(/\n+$/, '\n');
|
|
766
|
+
const after = content.slice(endIdx + END_MARKER.length).replace(/^\n+/, '\n');
|
|
767
|
+
writeFileSync(rcFile, before + after);
|
|
768
|
+
console.log(`Completion removed from ${rcFile}`);
|
|
769
|
+
}
|
|
770
|
+
// ── Command ──────────────────────────────────────────────
|
|
771
|
+
export const completionCommand = new Command('completion')
|
|
772
|
+
.description('Generate shell completion scripts')
|
|
773
|
+
.argument('[shell]', 'Shell type: bash, zsh, or fish')
|
|
774
|
+
.option('--install', 'Auto-detect shell and install completion')
|
|
775
|
+
.option('--uninstall', 'Remove installed completion')
|
|
776
|
+
.action((shell, options) => {
|
|
777
|
+
if (options?.install) {
|
|
778
|
+
installCompletion();
|
|
779
|
+
return;
|
|
780
|
+
}
|
|
781
|
+
if (options?.uninstall) {
|
|
782
|
+
uninstallCompletion();
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
if (!shell) {
|
|
786
|
+
console.error('Please specify a shell: bash, zsh, or fish');
|
|
787
|
+
console.error('');
|
|
788
|
+
console.error('Usage:');
|
|
789
|
+
console.error(' codika completion bash # print bash completion script');
|
|
790
|
+
console.error(' codika completion zsh # print zsh completion script');
|
|
791
|
+
console.error(' codika completion fish # print fish completion script');
|
|
792
|
+
console.error(' codika completion --install # auto-detect and install');
|
|
793
|
+
process.exit(1);
|
|
794
|
+
}
|
|
795
|
+
switch (shell) {
|
|
796
|
+
case 'bash':
|
|
797
|
+
console.log(generateBashCompletion());
|
|
798
|
+
break;
|
|
799
|
+
case 'zsh':
|
|
800
|
+
console.log(generateZshCompletion());
|
|
801
|
+
break;
|
|
802
|
+
case 'fish':
|
|
803
|
+
console.log(generateFishCompletion());
|
|
804
|
+
break;
|
|
805
|
+
default:
|
|
806
|
+
console.error(`Unknown shell: ${shell}. Supported: bash, zsh, fish`);
|
|
807
|
+
process.exit(1);
|
|
808
|
+
}
|
|
809
|
+
});
|
|
810
|
+
//# sourceMappingURL=completion.js.map
|