@kindgi/cli 0.0.0-bootstrap.0 → 0.1.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 +201 -0
- package/README.md +690 -1
- package/dist/build/apt.d.ts +16 -0
- package/dist/build/apt.d.ts.map +1 -0
- package/dist/build/apt.js +50 -0
- package/dist/build/apt.js.map +1 -0
- package/dist/build/bundle.d.ts +45 -0
- package/dist/build/bundle.d.ts.map +1 -0
- package/dist/build/bundle.js +121 -0
- package/dist/build/bundle.js.map +1 -0
- package/dist/build/containerfile.d.ts +27 -0
- package/dist/build/containerfile.d.ts.map +1 -0
- package/dist/build/containerfile.js +196 -0
- package/dist/build/containerfile.js.map +1 -0
- package/dist/build/context-files.d.ts +24 -0
- package/dist/build/context-files.d.ts.map +1 -0
- package/dist/build/context-files.js +99 -0
- package/dist/build/context-files.js.map +1 -0
- package/dist/build/defaults.d.ts +66 -0
- package/dist/build/defaults.d.ts.map +1 -0
- package/dist/build/defaults.js +586 -0
- package/dist/build/defaults.js.map +1 -0
- package/dist/build/envelope.d.ts +72 -0
- package/dist/build/envelope.d.ts.map +1 -0
- package/dist/build/envelope.js +76 -0
- package/dist/build/envelope.js.map +1 -0
- package/dist/build/host-install.d.ts +48 -0
- package/dist/build/host-install.d.ts.map +1 -0
- package/dist/build/host-install.js +375 -0
- package/dist/build/host-install.js.map +1 -0
- package/dist/build/image-config.d.ts +32 -0
- package/dist/build/image-config.d.ts.map +1 -0
- package/dist/build/image-config.js +129 -0
- package/dist/build/image-config.js.map +1 -0
- package/dist/build/integrity.d.ts +51 -0
- package/dist/build/integrity.d.ts.map +1 -0
- package/dist/build/integrity.js +75 -0
- package/dist/build/integrity.js.map +1 -0
- package/dist/build/node-image.d.ts +18 -0
- package/dist/build/node-image.d.ts.map +1 -0
- package/dist/build/node-image.js +46 -0
- package/dist/build/node-image.js.map +1 -0
- package/dist/build/pack-root.d.ts +69 -0
- package/dist/build/pack-root.d.ts.map +1 -0
- package/dist/build/pack-root.js +102 -0
- package/dist/build/pack-root.js.map +1 -0
- package/dist/build/poetry-requirements.d.ts +5 -0
- package/dist/build/poetry-requirements.d.ts.map +1 -0
- package/dist/build/poetry-requirements.js +8 -0
- package/dist/build/poetry-requirements.js.map +1 -0
- package/dist/build/python-image.d.ts +40 -0
- package/dist/build/python-image.d.ts.map +1 -0
- package/dist/build/python-image.js +197 -0
- package/dist/build/python-image.js.map +1 -0
- package/dist/build/runners.d.ts +259 -0
- package/dist/build/runners.d.ts.map +1 -0
- package/dist/build/runners.js +4 -0
- package/dist/build/runners.js.map +1 -0
- package/dist/build/version-specifier.d.ts +2 -0
- package/dist/build/version-specifier.d.ts.map +1 -0
- package/dist/build/version-specifier.js +70 -0
- package/dist/build/version-specifier.js.map +1 -0
- package/dist/cli-package.d.ts +15 -0
- package/dist/cli-package.d.ts.map +1 -0
- package/dist/cli-package.js +37 -0
- package/dist/cli-package.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +26 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/adapters.d.ts +3 -0
- package/dist/commands/adapters.d.ts.map +1 -0
- package/dist/commands/adapters.js +148 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/agents.d.ts +3 -0
- package/dist/commands/agents.d.ts.map +1 -0
- package/dist/commands/agents.js +82 -0
- package/dist/commands/agents.js.map +1 -0
- package/dist/commands/approvals.d.ts +3 -0
- package/dist/commands/approvals.d.ts.map +1 -0
- package/dist/commands/approvals.js +92 -0
- package/dist/commands/approvals.js.map +1 -0
- package/dist/commands/artifacts.d.ts +3 -0
- package/dist/commands/artifacts.d.ts.map +1 -0
- package/dist/commands/artifacts.js +87 -0
- package/dist/commands/artifacts.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +88 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/build.d.ts +39 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +872 -0
- package/dist/commands/build.js.map +1 -0
- package/dist/commands/capabilities.d.ts +3 -0
- package/dist/commands/capabilities.d.ts.map +1 -0
- package/dist/commands/capabilities.js +38 -0
- package/dist/commands/capabilities.js.map +1 -0
- package/dist/commands/conversations.d.ts +3 -0
- package/dist/commands/conversations.d.ts.map +1 -0
- package/dist/commands/conversations.js +75 -0
- package/dist/commands/conversations.js.map +1 -0
- package/dist/commands/deploy.d.ts +7 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +697 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/dev.d.ts +44 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +1032 -0
- package/dist/commands/dev.js.map +1 -0
- package/dist/commands/env.d.ts +27 -0
- package/dist/commands/env.d.ts.map +1 -0
- package/dist/commands/env.js +816 -0
- package/dist/commands/env.js.map +1 -0
- package/dist/commands/feedback.d.ts +33 -0
- package/dist/commands/feedback.d.ts.map +1 -0
- package/dist/commands/feedback.js +374 -0
- package/dist/commands/feedback.js.map +1 -0
- package/dist/commands/flows.d.ts +3 -0
- package/dist/commands/flows.d.ts.map +1 -0
- package/dist/commands/flows.js +60 -0
- package/dist/commands/flows.js.map +1 -0
- package/dist/commands/guardrails.d.ts +3 -0
- package/dist/commands/guardrails.d.ts.map +1 -0
- package/dist/commands/guardrails.js +89 -0
- package/dist/commands/guardrails.js.map +1 -0
- package/dist/commands/health.d.ts +8 -0
- package/dist/commands/health.d.ts.map +1 -0
- package/dist/commands/health.js +40 -0
- package/dist/commands/health.js.map +1 -0
- package/dist/commands/helpers.d.ts +37 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +93 -0
- package/dist/commands/helpers.js.map +1 -0
- package/dist/commands/index.d.ts +7 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +90 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/init.d.ts +46 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +455 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/key.d.ts +3 -0
- package/dist/commands/key.d.ts.map +1 -0
- package/dist/commands/key.js +322 -0
- package/dist/commands/key.js.map +1 -0
- package/dist/commands/mcp.d.ts +43 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +433 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/memory.d.ts +3 -0
- package/dist/commands/memory.d.ts.map +1 -0
- package/dist/commands/memory.js +82 -0
- package/dist/commands/memory.js.map +1 -0
- package/dist/commands/observations.d.ts +3 -0
- package/dist/commands/observations.d.ts.map +1 -0
- package/dist/commands/observations.js +27 -0
- package/dist/commands/observations.js.map +1 -0
- package/dist/commands/proposals.d.ts +3 -0
- package/dist/commands/proposals.d.ts.map +1 -0
- package/dist/commands/proposals.js +116 -0
- package/dist/commands/proposals.js.map +1 -0
- package/dist/commands/provenance.d.ts +3 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/provenance.js +53 -0
- package/dist/commands/provenance.js.map +1 -0
- package/dist/commands/providers.d.ts +3 -0
- package/dist/commands/providers.d.ts.map +1 -0
- package/dist/commands/providers.js +202 -0
- package/dist/commands/providers.js.map +1 -0
- package/dist/commands/reviewers.d.ts +3 -0
- package/dist/commands/reviewers.d.ts.map +1 -0
- package/dist/commands/reviewers.js +78 -0
- package/dist/commands/reviewers.js.map +1 -0
- package/dist/commands/runs.d.ts +3 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +221 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/secrets.d.ts +21 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +750 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/skills.d.ts +64 -0
- package/dist/commands/skills.d.ts.map +1 -0
- package/dist/commands/skills.js +430 -0
- package/dist/commands/skills.js.map +1 -0
- package/dist/commands/test.d.ts +5 -0
- package/dist/commands/test.d.ts.map +1 -0
- package/dist/commands/test.js +181 -0
- package/dist/commands/test.js.map +1 -0
- package/dist/commands/tokens.d.ts +3 -0
- package/dist/commands/tokens.d.ts.map +1 -0
- package/dist/commands/tokens.js +33 -0
- package/dist/commands/tokens.js.map +1 -0
- package/dist/commands/tools.d.ts +3 -0
- package/dist/commands/tools.d.ts.map +1 -0
- package/dist/commands/tools.js +153 -0
- package/dist/commands/tools.js.map +1 -0
- package/dist/commands/types.d.ts +54 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +4 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/commands/unwired.d.ts +17 -0
- package/dist/commands/unwired.d.ts.map +1 -0
- package/dist/commands/unwired.js +41 -0
- package/dist/commands/unwired.js.map +1 -0
- package/dist/commands/version.d.ts +8 -0
- package/dist/commands/version.d.ts.map +1 -0
- package/dist/commands/version.js +41 -0
- package/dist/commands/version.js.map +1 -0
- package/dist/config.d.ts +42 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +83 -0
- package/dist/config.js.map +1 -0
- package/dist/context.d.ts +153 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +44 -0
- package/dist/context.js.map +1 -0
- package/dist/deploy/defaults.d.ts +14 -0
- package/dist/deploy/defaults.d.ts.map +1 -0
- package/dist/deploy/defaults.js +37 -0
- package/dist/deploy/defaults.js.map +1 -0
- package/dist/deploy/envelope-loader.d.ts +24 -0
- package/dist/deploy/envelope-loader.d.ts.map +1 -0
- package/dist/deploy/envelope-loader.js +141 -0
- package/dist/deploy/envelope-loader.js.map +1 -0
- package/dist/deploy/post.d.ts +48 -0
- package/dist/deploy/post.d.ts.map +1 -0
- package/dist/deploy/post.js +210 -0
- package/dist/deploy/post.js.map +1 -0
- package/dist/deploy/response.d.ts +42 -0
- package/dist/deploy/response.d.ts.map +1 -0
- package/dist/deploy/response.js +128 -0
- package/dist/deploy/response.js.map +1 -0
- package/dist/deploy/runners.d.ts +218 -0
- package/dist/deploy/runners.d.ts.map +1 -0
- package/dist/deploy/runners.js +4 -0
- package/dist/deploy/runners.js.map +1 -0
- package/dist/dev/bundler.d.ts +8 -0
- package/dist/dev/bundler.d.ts.map +1 -0
- package/dist/dev/bundler.js +154 -0
- package/dist/dev/bundler.js.map +1 -0
- package/dist/dev/defaults.d.ts +138 -0
- package/dist/dev/defaults.d.ts.map +1 -0
- package/dist/dev/defaults.js +691 -0
- package/dist/dev/defaults.js.map +1 -0
- package/dist/dev/docker-compose.dev.yml +56 -0
- package/dist/dev/index-child.d.ts +2 -0
- package/dist/dev/index-child.d.ts.map +1 -0
- package/dist/dev/index-child.js +53 -0
- package/dist/dev/index-child.js.map +1 -0
- package/dist/dev/pack-code.d.ts +36 -0
- package/dist/dev/pack-code.d.ts.map +1 -0
- package/dist/dev/pack-code.js +129 -0
- package/dist/dev/pack-code.js.map +1 -0
- package/dist/dev/pack-env.d.ts +13 -0
- package/dist/dev/pack-env.d.ts.map +1 -0
- package/dist/dev/pack-env.js +36 -0
- package/dist/dev/pack-env.js.map +1 -0
- package/dist/dev/pack-service.d.ts +32 -0
- package/dist/dev/pack-service.d.ts.map +1 -0
- package/dist/dev/pack-service.js +188 -0
- package/dist/dev/pack-service.js.map +1 -0
- package/dist/dev/paths.d.ts +22 -0
- package/dist/dev/paths.d.ts.map +1 -0
- package/dist/dev/paths.js +35 -0
- package/dist/dev/paths.js.map +1 -0
- package/dist/dev/python-builder.d.ts +16 -0
- package/dist/dev/python-builder.d.ts.map +1 -0
- package/dist/dev/python-builder.js +122 -0
- package/dist/dev/python-builder.js.map +1 -0
- package/dist/dev/register.d.ts +71 -0
- package/dist/dev/register.d.ts.map +1 -0
- package/dist/dev/register.js +54 -0
- package/dist/dev/register.js.map +1 -0
- package/dist/dev/runners.d.ts +287 -0
- package/dist/dev/runners.d.ts.map +1 -0
- package/dist/dev/runners.js +4 -0
- package/dist/dev/runners.js.map +1 -0
- package/dist/dev/runtime-container.d.ts +62 -0
- package/dist/dev/runtime-container.d.ts.map +1 -0
- package/dist/dev/runtime-container.js +164 -0
- package/dist/dev/runtime-container.js.map +1 -0
- package/dist/dev/runtime-env.d.ts +62 -0
- package/dist/dev/runtime-env.d.ts.map +1 -0
- package/dist/dev/runtime-env.js +100 -0
- package/dist/dev/runtime-env.js.map +1 -0
- package/dist/dev/runtime-image.d.ts +13 -0
- package/dist/dev/runtime-image.d.ts.map +1 -0
- package/dist/dev/runtime-image.js +15 -0
- package/dist/dev/runtime-image.js.map +1 -0
- package/dist/env/defaults.d.ts +3 -0
- package/dist/env/defaults.d.ts.map +1 -0
- package/dist/env/defaults.js +22 -0
- package/dist/env/defaults.js.map +1 -0
- package/dist/env/pack-env-plan.d.ts +70 -0
- package/dist/env/pack-env-plan.d.ts.map +1 -0
- package/dist/env/pack-env-plan.js +236 -0
- package/dist/env/pack-env-plan.js.map +1 -0
- package/dist/env/parser.d.ts +9 -0
- package/dist/env/parser.d.ts.map +1 -0
- package/dist/env/parser.js +11 -0
- package/dist/env/parser.js.map +1 -0
- package/dist/env/project-env.d.ts +34 -0
- package/dist/env/project-env.d.ts.map +1 -0
- package/dist/env/project-env.js +45 -0
- package/dist/env/project-env.js.map +1 -0
- package/dist/env/runners.d.ts +22 -0
- package/dist/env/runners.d.ts.map +1 -0
- package/dist/env/runners.js +4 -0
- package/dist/env/runners.js.map +1 -0
- package/dist/env/writer.d.ts +7 -0
- package/dist/env/writer.d.ts.map +1 -0
- package/dist/env/writer.js +9 -0
- package/dist/env/writer.js.map +1 -0
- package/dist/errors.d.ts +31 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +107 -0
- package/dist/errors.js.map +1 -0
- package/dist/help.d.ts +5 -0
- package/dist/help.d.ts.map +1 -0
- package/dist/help.js +61 -0
- package/dist/help.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/init/augment-scaffolder.d.ts +74 -0
- package/dist/init/augment-scaffolder.d.ts.map +1 -0
- package/dist/init/augment-scaffolder.js +459 -0
- package/dist/init/augment-scaffolder.js.map +1 -0
- package/dist/init/dependency-specs.d.ts +58 -0
- package/dist/init/dependency-specs.d.ts.map +1 -0
- package/dist/init/dependency-specs.js +153 -0
- package/dist/init/dependency-specs.js.map +1 -0
- package/dist/init/gitignore-patcher.d.ts +23 -0
- package/dist/init/gitignore-patcher.d.ts.map +1 -0
- package/dist/init/gitignore-patcher.js +103 -0
- package/dist/init/gitignore-patcher.js.map +1 -0
- package/dist/init/mode-detect.d.ts +34 -0
- package/dist/init/mode-detect.d.ts.map +1 -0
- package/dist/init/mode-detect.js +115 -0
- package/dist/init/mode-detect.js.map +1 -0
- package/dist/init/package-json-patcher.d.ts +36 -0
- package/dist/init/package-json-patcher.d.ts.map +1 -0
- package/dist/init/package-json-patcher.js +128 -0
- package/dist/init/package-json-patcher.js.map +1 -0
- package/dist/init/pyproject-patcher.d.ts +56 -0
- package/dist/init/pyproject-patcher.d.ts.map +1 -0
- package/dist/init/pyproject-patcher.js +324 -0
- package/dist/init/pyproject-patcher.js.map +1 -0
- package/dist/init/python-augment.d.ts +22 -0
- package/dist/init/python-augment.d.ts.map +1 -0
- package/dist/init/python-augment.js +300 -0
- package/dist/init/python-augment.js.map +1 -0
- package/dist/init/template-files.d.ts +16 -0
- package/dist/init/template-files.d.ts.map +1 -0
- package/dist/init/template-files.js +38 -0
- package/dist/init/template-files.js.map +1 -0
- package/dist/key/defaults.d.ts +3 -0
- package/dist/key/defaults.d.ts.map +1 -0
- package/dist/key/defaults.js +60 -0
- package/dist/key/defaults.js.map +1 -0
- package/dist/key/fingerprint.d.ts +6 -0
- package/dist/key/fingerprint.d.ts.map +1 -0
- package/dist/key/fingerprint.js +25 -0
- package/dist/key/fingerprint.js.map +1 -0
- package/dist/key/paths.d.ts +30 -0
- package/dist/key/paths.d.ts.map +1 -0
- package/dist/key/paths.js +51 -0
- package/dist/key/paths.js.map +1 -0
- package/dist/key/runners.d.ts +60 -0
- package/dist/key/runners.d.ts.map +1 -0
- package/dist/key/runners.js +4 -0
- package/dist/key/runners.js.map +1 -0
- package/dist/main.d.ts +106 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +198 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp/launcher.d.ts +143 -0
- package/dist/mcp/launcher.d.ts.map +1 -0
- package/dist/mcp/launcher.js +393 -0
- package/dist/mcp/launcher.js.map +1 -0
- package/dist/mcp/preset-loader.d.ts +29 -0
- package/dist/mcp/preset-loader.d.ts.map +1 -0
- package/dist/mcp/preset-loader.js +217 -0
- package/dist/mcp/preset-loader.js.map +1 -0
- package/dist/mcp/preset-types.d.ts +71 -0
- package/dist/mcp/preset-types.d.ts.map +1 -0
- package/dist/mcp/preset-types.js +4 -0
- package/dist/mcp/preset-types.js.map +1 -0
- package/dist/mcp/presets/README.md +68 -0
- package/dist/mcp/presets/postgres.json +15 -0
- package/dist/output.d.ts +26 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +46 -0
- package/dist/output.js.map +1 -0
- package/dist/pack-config.d.ts +37 -0
- package/dist/pack-config.d.ts.map +1 -0
- package/dist/pack-config.js +65 -0
- package/dist/pack-config.js.map +1 -0
- package/dist/package-manager.d.ts +33 -0
- package/dist/package-manager.d.ts.map +1 -0
- package/dist/package-manager.js +129 -0
- package/dist/package-manager.js.map +1 -0
- package/dist/parse.d.ts +82 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +99 -0
- package/dist/parse.js.map +1 -0
- package/dist/providers/preset-loader.d.ts +47 -0
- package/dist/providers/preset-loader.d.ts.map +1 -0
- package/dist/providers/preset-loader.js +107 -0
- package/dist/providers/preset-loader.js.map +1 -0
- package/dist/providers/presets/anthropic.json +47 -0
- package/dist/providers/presets/gemini.json +40 -0
- package/dist/reference.d.ts +28 -0
- package/dist/reference.d.ts.map +1 -0
- package/dist/reference.js +52 -0
- package/dist/reference.js.map +1 -0
- package/dist/sdk-package.d.ts +9 -0
- package/dist/sdk-package.d.ts.map +1 -0
- package/dist/sdk-package.js +20 -0
- package/dist/sdk-package.js.map +1 -0
- package/dist/sdk-skills/kindgi-authoring-agents/SKILL.md +253 -0
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +299 -0
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +291 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +289 -0
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +704 -0
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +288 -0
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +211 -0
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +181 -0
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +205 -0
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +322 -0
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +173 -0
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +299 -0
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +240 -0
- package/dist/stop-signal.d.ts +15 -0
- package/dist/stop-signal.d.ts.map +1 -0
- package/dist/stop-signal.js +16 -0
- package/dist/stop-signal.js.map +1 -0
- package/dist/templates/minimal/.gitignore +8 -0
- package/dist/templates/minimal/.nvmrc +1 -0
- package/dist/templates/minimal/AGENTS.md +23 -0
- package/dist/templates/minimal/README.md.tmpl +69 -0
- package/dist/templates/minimal/agents/.gitkeep +0 -0
- package/dist/templates/minimal/flows/.gitkeep +0 -0
- package/dist/templates/minimal/guardrails/.gitkeep +0 -0
- package/dist/templates/minimal/kindgi.config.ts.tmpl +44 -0
- package/dist/templates/minimal/package.json.tmpl +25 -0
- package/dist/templates/minimal/pnpm-workspace.yaml +6 -0
- package/dist/templates/minimal/tools/.gitkeep +0 -0
- package/dist/templates/minimal/tsconfig.json.tmpl +27 -0
- package/dist/templates/minimal/vitest.config.ts.tmpl +14 -0
- package/dist/templates/python/.gitignore +9 -0
- package/dist/templates/python/AGENTS.md +30 -0
- package/dist/templates/python/README.md.tmpl +56 -0
- package/dist/templates/python/agents/echo_agent.py.tmpl +23 -0
- package/dist/templates/python/flows/echo_flow.py.tmpl +17 -0
- package/dist/templates/python/guardrails/response_not_empty.py.tmpl +27 -0
- package/dist/templates/python/pyproject.toml.tmpl +42 -0
- package/dist/templates/python/tests/test_tools.py.tmpl +22 -0
- package/dist/templates/python/tools/echo.py.tmpl +27 -0
- package/dist/templates/python/tools/greet.py.tmpl +20 -0
- package/dist/templates/sample/.gitignore +8 -0
- package/dist/templates/sample/.nvmrc +1 -0
- package/dist/templates/sample/AGENTS.md +23 -0
- package/dist/templates/sample/README.md.tmpl +85 -0
- package/dist/templates/sample/agents/echo-agent/index.ts.tmpl +34 -0
- package/dist/templates/sample/flows/echo-flow/index.ts.tmpl +59 -0
- package/dist/templates/sample/guardrails/response-not-empty/index.ts.tmpl +50 -0
- package/dist/templates/sample/kindgi.config.ts.tmpl +41 -0
- package/dist/templates/sample/package.json.tmpl +25 -0
- package/dist/templates/sample/pnpm-workspace.yaml +6 -0
- package/dist/templates/sample/tools/echo/index.test.ts.tmpl +31 -0
- package/dist/templates/sample/tools/echo/index.ts.tmpl +37 -0
- package/dist/templates/sample/tools/fetch-httpbin/index.ts.tmpl +60 -0
- package/dist/templates/sample/tools/greet/index.ts.tmpl +35 -0
- package/dist/templates/sample/tsconfig.json.tmpl +27 -0
- package/dist/templates/sample/vitest.config.ts.tmpl +14 -0
- package/dist/test/defaults.d.ts +3 -0
- package/dist/test/defaults.d.ts.map +1 -0
- package/dist/test/defaults.js +104 -0
- package/dist/test/defaults.js.map +1 -0
- package/dist/test/runners.d.ts +60 -0
- package/dist/test/runners.d.ts.map +1 -0
- package/dist/test/runners.js +4 -0
- package/dist/test/runners.js.map +1 -0
- package/dist/version-info.d.ts +9 -0
- package/dist/version-info.d.ts.map +1 -0
- package/dist/version-info.js +27 -0
- package/dist/version-info.js.map +1 -0
- package/dist/write-fully.d.ts +13 -0
- package/dist/write-fully.d.ts.map +1 -0
- package/dist/write-fully.js +17 -0
- package/dist/write-fully.js.map +1 -0
- package/package.json +63 -4
|
@@ -0,0 +1,393 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* `kindgi mcp-launch` — the subprocess wrapper that spawns an MCP
|
|
5
|
+
* server with secrets injected from the pack's env files — the same
|
|
6
|
+
* files, read the same way, as Kindgi's dev-mode `SecretBinding`
|
|
7
|
+
* (`@kindgi/secrets-dotenv`): for `local`, the project's `.env` then
|
|
8
|
+
* `.env.local` (or `dev.envFiles`); otherwise `.env.<envName>`.
|
|
9
|
+
*
|
|
10
|
+
* Design goals:
|
|
11
|
+
* - **Generic** — no per-server logic. Works for any Node package
|
|
12
|
+
* invocable via `npx`, or any Docker image, that reads its
|
|
13
|
+
* credentials from environment variables.
|
|
14
|
+
* - **Portable across MCP clients** — a `.mcp.json` entry running the
|
|
15
|
+
* project's `kindgi mcp-launch …` (via its package manager, e.g.
|
|
16
|
+
* `pnpm exec kindgi`) works identically for Claude Code, Cursor,
|
|
17
|
+
* VS Code, Claude Desktop, Windsurf, or anything else that speaks
|
|
18
|
+
* the MCP config shape.
|
|
19
|
+
* - **Secrets stay outside the model's context** — the DB URL /
|
|
20
|
+
* token flows: SecretBinding → this process's memory → child
|
|
21
|
+
* process's env. Never in argv (visible via `ps aux`); never in
|
|
22
|
+
* `.mcp.json` (visible via any Read tool the model calls).
|
|
23
|
+
*
|
|
24
|
+
* Argv shape:
|
|
25
|
+
*
|
|
26
|
+
* kindgi mcp-launch \
|
|
27
|
+
* --runtime=<npx|docker> \
|
|
28
|
+
* --package=<npm-package-or-docker-image> \
|
|
29
|
+
* --env-map=VAR=secret:NAME@envName:scopeKind[:scopeId] \ (repeatable)
|
|
30
|
+
* [--pack-dir=<abs-path>] \
|
|
31
|
+
* [--host-remap=docker-desktop] \
|
|
32
|
+
* -- <passthrough args forwarded to the child process>
|
|
33
|
+
*
|
|
34
|
+
* `--host-remap=docker-desktop` rewrites `localhost` / `127.0.0.1` in
|
|
35
|
+
* resolved secret VALUES to `host.docker.internal` — the Mac/Windows
|
|
36
|
+
* Docker escape hatch. Only applied when the runtime is `docker`.
|
|
37
|
+
*
|
|
38
|
+
* Exit codes:
|
|
39
|
+
* - 0 (or child's exit code) — child ran to completion
|
|
40
|
+
* - 2 — argv parse error
|
|
41
|
+
* - 3 — secret resolution error (missing env file, missing secret)
|
|
42
|
+
* - 4 — spawn error (child couldn't start)
|
|
43
|
+
*/
|
|
44
|
+
import { spawn as nodeSpawn } from 'node:child_process';
|
|
45
|
+
import { readFile as nodeReadFile } from 'node:fs/promises';
|
|
46
|
+
import { parseArgs as nodeParseArgs } from 'node:util';
|
|
47
|
+
import { displayEnvPath, packValues, readPackEnv } from '@kindgi/secrets-dotenv';
|
|
48
|
+
import { loadLocalEnvSettings } from '../env/project-env.js';
|
|
49
|
+
// ---------------------------------------------------------------------
|
|
50
|
+
// Argv parsing
|
|
51
|
+
// ---------------------------------------------------------------------
|
|
52
|
+
const RUNTIMES = new Set(['npx', 'docker']);
|
|
53
|
+
const HOST_REMAPS = new Set(['docker-desktop']);
|
|
54
|
+
/**
|
|
55
|
+
* Parse a single `--env-map` value: `VAR=secret:NAME@envName:scopeKind[:scopeId]`.
|
|
56
|
+
* Returns null on malformed input; caller decides error phrasing.
|
|
57
|
+
*/
|
|
58
|
+
export function parseEnvMapFlag(raw) {
|
|
59
|
+
const eq = raw.indexOf('=');
|
|
60
|
+
if (eq <= 0)
|
|
61
|
+
return null;
|
|
62
|
+
const child = raw.slice(0, eq).trim();
|
|
63
|
+
if (child === '')
|
|
64
|
+
return null;
|
|
65
|
+
const refRaw = raw.slice(eq + 1);
|
|
66
|
+
const ref = parseSecretRef(refRaw);
|
|
67
|
+
if (ref === null)
|
|
68
|
+
return null;
|
|
69
|
+
return { child, ref };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Parse a secret reference: `secret:NAME@envName:scopeKind[:scopeId]`.
|
|
73
|
+
*
|
|
74
|
+
* - `secret:GRIEVANCE_DB_URL@local:tenant`
|
|
75
|
+
* - `secret:X@local:project:pack-a`
|
|
76
|
+
* - `secret:X@local:org:acme`
|
|
77
|
+
*/
|
|
78
|
+
export function parseSecretRef(raw) {
|
|
79
|
+
if (!raw.startsWith('secret:'))
|
|
80
|
+
return null;
|
|
81
|
+
const body = raw.slice('secret:'.length);
|
|
82
|
+
const atSign = body.indexOf('@');
|
|
83
|
+
if (atSign <= 0)
|
|
84
|
+
return null;
|
|
85
|
+
const name = body.slice(0, atSign);
|
|
86
|
+
const tail = body.slice(atSign + 1);
|
|
87
|
+
const parts = tail.split(':');
|
|
88
|
+
if (parts.length < 2)
|
|
89
|
+
return null;
|
|
90
|
+
const envName = parts[0];
|
|
91
|
+
const scopeKind = parts[1];
|
|
92
|
+
if (envName === undefined || envName === '')
|
|
93
|
+
return null;
|
|
94
|
+
if (scopeKind !== 'tenant' && scopeKind !== 'org' && scopeKind !== 'project')
|
|
95
|
+
return null;
|
|
96
|
+
if (scopeKind === 'tenant') {
|
|
97
|
+
if (parts.length !== 2)
|
|
98
|
+
return null;
|
|
99
|
+
return { name, envName, scopeKind };
|
|
100
|
+
}
|
|
101
|
+
// org / project must carry a scopeId
|
|
102
|
+
if (parts.length !== 3)
|
|
103
|
+
return null;
|
|
104
|
+
const scopeId = parts[2];
|
|
105
|
+
if (scopeId === undefined || scopeId === '')
|
|
106
|
+
return null;
|
|
107
|
+
return { name, envName, scopeKind, scopeId };
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Parse the full launcher argv. Everything after a bare `--` token is
|
|
111
|
+
* treated as passthrough to the child.
|
|
112
|
+
*/
|
|
113
|
+
export function parseLauncherArgs(argv) {
|
|
114
|
+
const dashDash = argv.indexOf('--');
|
|
115
|
+
const launcherArgv = dashDash >= 0 ? argv.slice(0, dashDash) : argv;
|
|
116
|
+
const passthroughArgs = dashDash >= 0 ? argv.slice(dashDash + 1) : [];
|
|
117
|
+
let parsed;
|
|
118
|
+
try {
|
|
119
|
+
parsed = nodeParseArgs({
|
|
120
|
+
args: [...launcherArgv],
|
|
121
|
+
options: {
|
|
122
|
+
runtime: { type: 'string' },
|
|
123
|
+
package: { type: 'string' },
|
|
124
|
+
'env-map': { type: 'string', multiple: true },
|
|
125
|
+
'pack-dir': { type: 'string' },
|
|
126
|
+
'host-remap': { type: 'string' },
|
|
127
|
+
},
|
|
128
|
+
strict: true,
|
|
129
|
+
allowPositionals: false,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
return { kind: 'err', message: `Bad launcher argv: ${err.message}` };
|
|
134
|
+
}
|
|
135
|
+
const runtimeRaw = parsed.values.runtime;
|
|
136
|
+
if (typeof runtimeRaw !== 'string') {
|
|
137
|
+
return { kind: 'err', message: 'Missing required --runtime=<npx|docker>' };
|
|
138
|
+
}
|
|
139
|
+
if (!RUNTIMES.has(runtimeRaw)) {
|
|
140
|
+
return {
|
|
141
|
+
kind: 'err',
|
|
142
|
+
message: `Invalid --runtime "${runtimeRaw}". Accepted: npx, docker.`,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const runtime = runtimeRaw;
|
|
146
|
+
const packageName = parsed.values.package;
|
|
147
|
+
if (typeof packageName !== 'string' || packageName === '') {
|
|
148
|
+
return { kind: 'err', message: 'Missing required --package=<npm-package-or-docker-image>' };
|
|
149
|
+
}
|
|
150
|
+
const envMapRaws = parsed.values['env-map'] ?? [];
|
|
151
|
+
const envMap = [];
|
|
152
|
+
for (const raw of envMapRaws) {
|
|
153
|
+
const entry = parseEnvMapFlag(raw);
|
|
154
|
+
if (entry === null) {
|
|
155
|
+
return {
|
|
156
|
+
kind: 'err',
|
|
157
|
+
message: `Bad --env-map "${raw}". Expected VAR=secret:NAME@envName:scopeKind[:scopeId].`,
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
envMap.push(entry);
|
|
161
|
+
}
|
|
162
|
+
const packDir = parsed.values['pack-dir'] ?? process.cwd();
|
|
163
|
+
const hostRemapRaw = parsed.values['host-remap'];
|
|
164
|
+
let hostRemap;
|
|
165
|
+
if (hostRemapRaw !== undefined) {
|
|
166
|
+
if (!HOST_REMAPS.has(hostRemapRaw)) {
|
|
167
|
+
return {
|
|
168
|
+
kind: 'err',
|
|
169
|
+
message: `Invalid --host-remap "${hostRemapRaw}". Accepted: docker-desktop.`,
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
hostRemap = hostRemapRaw;
|
|
173
|
+
}
|
|
174
|
+
return {
|
|
175
|
+
kind: 'ok',
|
|
176
|
+
args: {
|
|
177
|
+
runtime,
|
|
178
|
+
package: packageName,
|
|
179
|
+
envMap,
|
|
180
|
+
packDir,
|
|
181
|
+
...(hostRemap !== undefined && { hostRemap }),
|
|
182
|
+
passthroughArgs,
|
|
183
|
+
},
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
// ---------------------------------------------------------------------
|
|
187
|
+
// Secret resolution
|
|
188
|
+
// ---------------------------------------------------------------------
|
|
189
|
+
/**
|
|
190
|
+
* Resolve every env-map entry against the pack's env files for its
|
|
191
|
+
* environment (`@kindgi/secrets-dotenv`'s `readPackEnv`). Each
|
|
192
|
+
* environment's files are read once. The dev store is scope-blind, so
|
|
193
|
+
* `scopeKind` / `scopeId` are recorded but not used for lookup;
|
|
194
|
+
* `KINDGI_*` names are runtime config and never resolve here.
|
|
195
|
+
*/
|
|
196
|
+
export async function resolveSecrets(entries, packDir, readFile, options = {}) {
|
|
197
|
+
const byEnv = new Map();
|
|
198
|
+
const readOrNull = async (path) => {
|
|
199
|
+
try {
|
|
200
|
+
return await readFile(path);
|
|
201
|
+
}
|
|
202
|
+
catch (err) {
|
|
203
|
+
if (err.code === 'ENOENT')
|
|
204
|
+
return null;
|
|
205
|
+
throw err;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
const load = async (envName) => {
|
|
209
|
+
const cached = byEnv.get(envName);
|
|
210
|
+
if (cached !== undefined)
|
|
211
|
+
return cached;
|
|
212
|
+
const env = await readPackEnv({
|
|
213
|
+
packDir,
|
|
214
|
+
envName,
|
|
215
|
+
readFile: readOrNull,
|
|
216
|
+
...(options.localEnvFiles !== undefined && { localEnvFiles: options.localEnvFiles }),
|
|
217
|
+
});
|
|
218
|
+
byEnv.set(envName, env);
|
|
219
|
+
return env;
|
|
220
|
+
};
|
|
221
|
+
const label = (paths) => paths.map((p) => displayEnvPath(packDir, p)).join(', ');
|
|
222
|
+
const resolved = {};
|
|
223
|
+
for (const entry of entries) {
|
|
224
|
+
const { name, envName, scopeKind, scopeId } = entry.ref;
|
|
225
|
+
let env;
|
|
226
|
+
try {
|
|
227
|
+
env = await load(envName);
|
|
228
|
+
}
|
|
229
|
+
catch (err) {
|
|
230
|
+
return {
|
|
231
|
+
kind: 'err',
|
|
232
|
+
message: `Failed to read env files for "${envName}": ${err.message}`,
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
const setHint = `Run \`kindgi secrets set ${name} --env=${envName} --scope=${scopeKind}${scopeId !== undefined ? `:${scopeId}` : ''}\` first.`;
|
|
236
|
+
if (env.present.length === 0) {
|
|
237
|
+
return {
|
|
238
|
+
kind: 'err',
|
|
239
|
+
message: `No env files for env "${envName}" at ${packDir} (looked for ${label(env.files.read)}). ${setHint}`,
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
const secrets = packValues(env.values);
|
|
243
|
+
if (!Object.hasOwn(secrets, name)) {
|
|
244
|
+
return {
|
|
245
|
+
kind: 'err',
|
|
246
|
+
message: `Secret "${name}" not found in ${label(env.present)}. Available: ${Object.keys(secrets).sort().join(', ') || '(none)'}. ${setHint}`,
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
resolved[entry.child] = secrets[name];
|
|
250
|
+
}
|
|
251
|
+
return { kind: 'ok', env: resolved };
|
|
252
|
+
}
|
|
253
|
+
// ---------------------------------------------------------------------
|
|
254
|
+
// Host remap — Docker-Desktop escape hatch for localhost DBs
|
|
255
|
+
// ---------------------------------------------------------------------
|
|
256
|
+
/**
|
|
257
|
+
* Rewrite `localhost` / `127.0.0.1` in a value to `host.docker.internal`
|
|
258
|
+
* when `mode === 'docker-desktop'`. Applied to every resolved secret
|
|
259
|
+
* value before injecting into the child's env, but only when the child
|
|
260
|
+
* is a Docker container (the launcher decides at call time).
|
|
261
|
+
*
|
|
262
|
+
* Not URL-parsing-based; we don't want to shred a value we don't
|
|
263
|
+
* understand. Simple string replacement on the two known host tokens.
|
|
264
|
+
* Real edge cases (nested URLs, IPv6 `::1`) can be added if a real
|
|
265
|
+
* consumer surfaces them.
|
|
266
|
+
*/
|
|
267
|
+
export function applyHostRemap(value, mode) {
|
|
268
|
+
if (mode !== 'docker-desktop')
|
|
269
|
+
return value;
|
|
270
|
+
return value
|
|
271
|
+
.replace(/@localhost([:/])/g, '@host.docker.internal$1')
|
|
272
|
+
.replace(/@127\.0\.0\.1([:/])/g, '@host.docker.internal$1');
|
|
273
|
+
}
|
|
274
|
+
// ---------------------------------------------------------------------
|
|
275
|
+
// Build the child command
|
|
276
|
+
// ---------------------------------------------------------------------
|
|
277
|
+
/**
|
|
278
|
+
* Compose the (cmd, args, extraEnv) triple to spawn. Deterministic —
|
|
279
|
+
* no side effects — so it's trivially testable. Docker-runtime host
|
|
280
|
+
* remap is applied here because it's per-value transformation.
|
|
281
|
+
*/
|
|
282
|
+
export function buildChildCommand(parsed, resolvedEnv) {
|
|
283
|
+
const remapped = {};
|
|
284
|
+
for (const [key, value] of Object.entries(resolvedEnv)) {
|
|
285
|
+
remapped[key] = parsed.runtime === 'docker' ? applyHostRemap(value, parsed.hostRemap) : value;
|
|
286
|
+
}
|
|
287
|
+
if (parsed.runtime === 'npx') {
|
|
288
|
+
return {
|
|
289
|
+
cmd: 'npx',
|
|
290
|
+
args: ['-y', parsed.package, ...parsed.passthroughArgs],
|
|
291
|
+
extraEnv: remapped,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
// docker
|
|
295
|
+
const passthroughEnvFlags = [];
|
|
296
|
+
for (const key of Object.keys(remapped).sort()) {
|
|
297
|
+
passthroughEnvFlags.push('-e', key);
|
|
298
|
+
}
|
|
299
|
+
return {
|
|
300
|
+
cmd: 'docker',
|
|
301
|
+
args: ['run', '-i', '--rm', ...passthroughEnvFlags, parsed.package, ...parsed.passthroughArgs],
|
|
302
|
+
extraEnv: remapped,
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
const DEFAULT_DEPS = {
|
|
306
|
+
readFile: (path) => nodeReadFile(path, 'utf8'),
|
|
307
|
+
localEnvSettings: (packDir) => loadLocalEnvSettings({ buildConfigLoader: undefined }, packDir),
|
|
308
|
+
spawn: nodeSpawn,
|
|
309
|
+
stderr: (msg) => process.stderr.write(msg),
|
|
310
|
+
onSignal: (handler) => {
|
|
311
|
+
const wrapped = (sig) => handler(sig);
|
|
312
|
+
process.on('SIGINT', wrapped);
|
|
313
|
+
process.on('SIGTERM', wrapped);
|
|
314
|
+
return () => {
|
|
315
|
+
process.off('SIGINT', wrapped);
|
|
316
|
+
process.off('SIGTERM', wrapped);
|
|
317
|
+
};
|
|
318
|
+
},
|
|
319
|
+
};
|
|
320
|
+
/**
|
|
321
|
+
* Run the launcher end-to-end. Returns the effective exit code so a
|
|
322
|
+
* caller (the CLI) can `process.exit(code)`.
|
|
323
|
+
*/
|
|
324
|
+
export async function runLauncher(argv, overrides = {}) {
|
|
325
|
+
const deps = { ...DEFAULT_DEPS, ...overrides };
|
|
326
|
+
const parsed = parseLauncherArgs(argv);
|
|
327
|
+
if (parsed.kind === 'err') {
|
|
328
|
+
deps.stderr(`kindgi mcp-launch: ${parsed.message}\n`);
|
|
329
|
+
return 2;
|
|
330
|
+
}
|
|
331
|
+
const settings = await deps.localEnvSettings(parsed.args.packDir);
|
|
332
|
+
if (settings.kind === 'error') {
|
|
333
|
+
deps.stderr(`kindgi mcp-launch: ${settings.message}\n`);
|
|
334
|
+
return 3;
|
|
335
|
+
}
|
|
336
|
+
const resolved = await resolveSecrets(parsed.args.envMap, parsed.args.packDir, deps.readFile, {
|
|
337
|
+
...(settings.localEnvFiles !== undefined && { localEnvFiles: settings.localEnvFiles }),
|
|
338
|
+
});
|
|
339
|
+
if (resolved.kind === 'err') {
|
|
340
|
+
deps.stderr(`kindgi mcp-launch: ${resolved.message}\n`);
|
|
341
|
+
return 3;
|
|
342
|
+
}
|
|
343
|
+
const child = buildChildCommand(parsed.args, resolved.env);
|
|
344
|
+
let subprocess;
|
|
345
|
+
try {
|
|
346
|
+
subprocess = deps.spawn(child.cmd, [...child.args], {
|
|
347
|
+
env: { ...process.env, ...child.extraEnv },
|
|
348
|
+
stdio: 'inherit',
|
|
349
|
+
});
|
|
350
|
+
}
|
|
351
|
+
catch (err) {
|
|
352
|
+
deps.stderr(`kindgi mcp-launch: spawn failed: ${err.message}\n`);
|
|
353
|
+
return 4;
|
|
354
|
+
}
|
|
355
|
+
const unsubscribe = deps.onSignal((sig) => {
|
|
356
|
+
if (!subprocess.killed)
|
|
357
|
+
subprocess.kill(sig);
|
|
358
|
+
});
|
|
359
|
+
return await new Promise((resolve) => {
|
|
360
|
+
subprocess.once('exit', (code, signal) => {
|
|
361
|
+
unsubscribe();
|
|
362
|
+
if (code !== null)
|
|
363
|
+
return resolve(code);
|
|
364
|
+
// Killed by signal — mirror shell convention (128 + signal number)
|
|
365
|
+
const signalNum = signal !== null ? signalNumber(signal) : 0;
|
|
366
|
+
return resolve(128 + signalNum);
|
|
367
|
+
});
|
|
368
|
+
subprocess.once('error', (err) => {
|
|
369
|
+
unsubscribe();
|
|
370
|
+
deps.stderr(`kindgi mcp-launch: child error: ${err.message}\n`);
|
|
371
|
+
return resolve(4);
|
|
372
|
+
});
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
function signalNumber(signal) {
|
|
376
|
+
// Minimal table — matches shell convention. Only entries we're
|
|
377
|
+
// likely to see; unknowns fall back to 0 (128 = "killed by unknown").
|
|
378
|
+
switch (signal) {
|
|
379
|
+
case 'SIGHUP':
|
|
380
|
+
return 1;
|
|
381
|
+
case 'SIGINT':
|
|
382
|
+
return 2;
|
|
383
|
+
case 'SIGQUIT':
|
|
384
|
+
return 3;
|
|
385
|
+
case 'SIGKILL':
|
|
386
|
+
return 9;
|
|
387
|
+
case 'SIGTERM':
|
|
388
|
+
return 15;
|
|
389
|
+
default:
|
|
390
|
+
return 0;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
//# sourceMappingURL=launcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/mcp/launcher.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAgB,cAAc,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAyB,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AA6CpF,wEAAwE;AACxE,eAAe;AACf,wEAAwE;AAExE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAU,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACrD,MAAM,WAAW,GAAG,IAAI,GAAG,CAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAE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ACH,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Preset, PresetSummary } from './preset-types.js';
|
|
2
|
+
export declare function defaultPresetsRoot(): string;
|
|
3
|
+
export interface PresetIO {
|
|
4
|
+
readonly readdir: (path: string) => Promise<readonly string[]>;
|
|
5
|
+
readonly readFile: (path: string) => Promise<string>;
|
|
6
|
+
}
|
|
7
|
+
export type LoadPresetsResult = {
|
|
8
|
+
readonly kind: 'ok';
|
|
9
|
+
readonly presets: Readonly<Record<string, Preset>>;
|
|
10
|
+
} | {
|
|
11
|
+
readonly kind: 'err';
|
|
12
|
+
readonly message: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Read every `*.json` file in the presets directory, parse + validate
|
|
16
|
+
* each, and key the resulting map by preset `kind`. Malformed files
|
|
17
|
+
* accumulate into an error rather than being silently skipped — a
|
|
18
|
+
* broken preset should fail loudly in dev so we catch schema drift
|
|
19
|
+
* during authoring, not in production.
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadPresets(dir?: string, io?: PresetIO): Promise<LoadPresetsResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Convenience — `null` when the preset doesn't exist. Callers surface
|
|
24
|
+
* the message with the available list.
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPreset(presets: Readonly<Record<string, Preset>>, kind: string): Preset | null;
|
|
27
|
+
/** Summary rows for `kindgi mcp presets`. */
|
|
28
|
+
export declare function listPresetSummaries(presets: Readonly<Record<string, Preset>>): readonly PresetSummary[];
|
|
29
|
+
//# sourceMappingURL=preset-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preset-loader.d.ts","sourceRoot":"","sources":["../../src/mcp/preset-loader.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAM/D,wBAAgB,kBAAkB,IAAI,MAAM,CAE3C;AAED,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;IAC/D,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CACtD;AAOD,MAAM,MAAM,iBAAiB,GACzB;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAA;CAAE,GAC3E;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAsB,WAAW,CAC/B,GAAG,GAAE,MAA6B,EAClC,EAAE,GAAE,QAAqB,GACxB,OAAO,CAAC,iBAAiB,CAAC,CAmD5B;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAEhG;AAED,6CAA6C;AAC7C,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACxC,SAAS,aAAa,EAAE,CAU1B"}
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* Load `kindgi mcp` presets from JSON files on disk. Presets ship
|
|
5
|
+
* inside the CLI package (`packages/cli/src/mcp/presets/`) and are
|
|
6
|
+
* copied to `dist/mcp/presets/` by `copy-build-assets.mjs` so the
|
|
7
|
+
* published tarball is self-contained.
|
|
8
|
+
*
|
|
9
|
+
* Test-friendly: `loadPresets(dir, reader)` accepts an explicit
|
|
10
|
+
* directory + reader pair so tests can point at fixture dirs. The
|
|
11
|
+
* default resolves to `<this-file's-dir>/presets/`.
|
|
12
|
+
*/
|
|
13
|
+
import { readFile as nodeReadFile, readdir as nodeReaddir } from 'node:fs/promises';
|
|
14
|
+
import { dirname, join } from 'node:path';
|
|
15
|
+
import { fileURLToPath } from 'node:url';
|
|
16
|
+
// Colocated with this loader — `src/mcp/presets/*.json` at source,
|
|
17
|
+
// `dist/mcp/presets/*.json` at built time.
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
export function defaultPresetsRoot() {
|
|
20
|
+
return join(__dirname, 'presets');
|
|
21
|
+
}
|
|
22
|
+
const DEFAULT_IO = {
|
|
23
|
+
readdir: async (path) => nodeReaddir(path),
|
|
24
|
+
readFile: async (path) => nodeReadFile(path, 'utf8'),
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Read every `*.json` file in the presets directory, parse + validate
|
|
28
|
+
* each, and key the resulting map by preset `kind`. Malformed files
|
|
29
|
+
* accumulate into an error rather than being silently skipped — a
|
|
30
|
+
* broken preset should fail loudly in dev so we catch schema drift
|
|
31
|
+
* during authoring, not in production.
|
|
32
|
+
*/
|
|
33
|
+
export async function loadPresets(dir = defaultPresetsRoot(), io = DEFAULT_IO) {
|
|
34
|
+
let entries;
|
|
35
|
+
try {
|
|
36
|
+
entries = await io.readdir(dir);
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
return { kind: 'err', message: `Failed to read presets dir ${dir}: ${err.message}` };
|
|
40
|
+
}
|
|
41
|
+
const jsonFiles = entries.filter((n) => n.endsWith('.json')).sort();
|
|
42
|
+
const presets = {};
|
|
43
|
+
const errors = [];
|
|
44
|
+
for (const file of jsonFiles) {
|
|
45
|
+
const path = join(dir, file);
|
|
46
|
+
let raw;
|
|
47
|
+
try {
|
|
48
|
+
raw = await io.readFile(path);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
errors.push(`${file}: read failed — ${err.message}`);
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
let parsed;
|
|
55
|
+
try {
|
|
56
|
+
parsed = JSON.parse(raw);
|
|
57
|
+
}
|
|
58
|
+
catch (err) {
|
|
59
|
+
errors.push(`${file}: invalid JSON — ${err.message}`);
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const validated = validatePreset(parsed);
|
|
63
|
+
if (validated.kind === 'err') {
|
|
64
|
+
errors.push(`${file}: ${validated.message}`);
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
const preset = validated.preset;
|
|
68
|
+
// Sanity-check the filename matches `kind` — catches renames that
|
|
69
|
+
// leave the JSON out of sync.
|
|
70
|
+
const expectedStem = file.replace(/\.json$/, '');
|
|
71
|
+
if (preset.kind !== expectedStem) {
|
|
72
|
+
errors.push(`${file}: preset kind "${preset.kind}" does not match filename stem "${expectedStem}"`);
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (presets[preset.kind] !== undefined) {
|
|
76
|
+
errors.push(`${file}: duplicate preset kind "${preset.kind}"`);
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
presets[preset.kind] = preset;
|
|
80
|
+
}
|
|
81
|
+
if (errors.length > 0) {
|
|
82
|
+
return { kind: 'err', message: `Preset load errors:\n ${errors.join('\n ')}` };
|
|
83
|
+
}
|
|
84
|
+
return { kind: 'ok', presets };
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Convenience — `null` when the preset doesn't exist. Callers surface
|
|
88
|
+
* the message with the available list.
|
|
89
|
+
*/
|
|
90
|
+
export function getPreset(presets, kind) {
|
|
91
|
+
return presets[kind] ?? null;
|
|
92
|
+
}
|
|
93
|
+
/** Summary rows for `kindgi mcp presets`. */
|
|
94
|
+
export function listPresetSummaries(presets) {
|
|
95
|
+
return Object.values(presets)
|
|
96
|
+
.map((p) => ({
|
|
97
|
+
kind: p.kind,
|
|
98
|
+
runtime: p.runtime,
|
|
99
|
+
package: p.package,
|
|
100
|
+
...(p.description !== undefined && { description: p.description }),
|
|
101
|
+
audit: p.audit,
|
|
102
|
+
}))
|
|
103
|
+
.sort((a, b) => a.kind.localeCompare(b.kind));
|
|
104
|
+
}
|
|
105
|
+
function validatePreset(input) {
|
|
106
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
107
|
+
return { kind: 'err', message: 'preset must be a JSON object' };
|
|
108
|
+
}
|
|
109
|
+
const obj = input;
|
|
110
|
+
const kind = obj.kind;
|
|
111
|
+
if (typeof kind !== 'string' || kind === '') {
|
|
112
|
+
return { kind: 'err', message: 'preset.kind must be a non-empty string' };
|
|
113
|
+
}
|
|
114
|
+
const runtime = obj.runtime;
|
|
115
|
+
if (runtime !== 'npx' && runtime !== 'docker') {
|
|
116
|
+
return { kind: 'err', message: 'preset.runtime must be "npx" or "docker"' };
|
|
117
|
+
}
|
|
118
|
+
const pkg = obj.package;
|
|
119
|
+
if (typeof pkg !== 'string' || pkg === '') {
|
|
120
|
+
return { kind: 'err', message: 'preset.package must be a non-empty string' };
|
|
121
|
+
}
|
|
122
|
+
const envMapRaw = obj.envMap;
|
|
123
|
+
if (!Array.isArray(envMapRaw)) {
|
|
124
|
+
return { kind: 'err', message: 'preset.envMap must be an array' };
|
|
125
|
+
}
|
|
126
|
+
const envMap = [];
|
|
127
|
+
for (const [i, entry] of envMapRaw.entries()) {
|
|
128
|
+
if (entry === null || typeof entry !== 'object') {
|
|
129
|
+
return { kind: 'err', message: `preset.envMap[${i}] must be an object` };
|
|
130
|
+
}
|
|
131
|
+
const e = entry;
|
|
132
|
+
const child = e.child;
|
|
133
|
+
const from = e.from;
|
|
134
|
+
if (typeof child !== 'string' || child === '') {
|
|
135
|
+
return { kind: 'err', message: `preset.envMap[${i}].child must be a non-empty string` };
|
|
136
|
+
}
|
|
137
|
+
if (typeof from !== 'string' || from === '') {
|
|
138
|
+
return { kind: 'err', message: `preset.envMap[${i}].from must be a non-empty string` };
|
|
139
|
+
}
|
|
140
|
+
// Only `$SECRET` is supported today. Reject unknowns loudly so we
|
|
141
|
+
// catch typos or future forms that haven't been implemented.
|
|
142
|
+
if (from !== '$SECRET') {
|
|
143
|
+
return {
|
|
144
|
+
kind: 'err',
|
|
145
|
+
message: `preset.envMap[${i}].from = "${from}" unsupported (only "$SECRET" is recognized)`,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
envMap.push({ child, from });
|
|
149
|
+
}
|
|
150
|
+
const defaultArgsRaw = obj.defaultArgs ?? [];
|
|
151
|
+
if (!Array.isArray(defaultArgsRaw) || !defaultArgsRaw.every((a) => typeof a === 'string')) {
|
|
152
|
+
return { kind: 'err', message: 'preset.defaultArgs must be an array of strings' };
|
|
153
|
+
}
|
|
154
|
+
const defaultArgs = defaultArgsRaw;
|
|
155
|
+
const hostRemapRaw = obj.hostRemap;
|
|
156
|
+
let hostRemap;
|
|
157
|
+
if (hostRemapRaw !== undefined) {
|
|
158
|
+
if (hostRemapRaw !== 'docker-desktop') {
|
|
159
|
+
return {
|
|
160
|
+
kind: 'err',
|
|
161
|
+
message: `preset.hostRemap = "${String(hostRemapRaw)}" unsupported (only "docker-desktop" is recognized)`,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
hostRemap = 'docker-desktop';
|
|
165
|
+
}
|
|
166
|
+
const audit = obj.audit;
|
|
167
|
+
const auditValidated = validateAudit(audit);
|
|
168
|
+
if (auditValidated.kind === 'err')
|
|
169
|
+
return auditValidated;
|
|
170
|
+
const description = typeof obj.description === 'string' ? obj.description : undefined;
|
|
171
|
+
const preset = {
|
|
172
|
+
kind,
|
|
173
|
+
...(description !== undefined && { description }),
|
|
174
|
+
runtime,
|
|
175
|
+
package: pkg,
|
|
176
|
+
envMap,
|
|
177
|
+
defaultArgs,
|
|
178
|
+
...(hostRemap !== undefined && { hostRemap }),
|
|
179
|
+
audit: auditValidated.audit,
|
|
180
|
+
};
|
|
181
|
+
return { kind: 'ok', preset };
|
|
182
|
+
}
|
|
183
|
+
function validateAudit(input) {
|
|
184
|
+
if (input === null || typeof input !== 'object') {
|
|
185
|
+
return { kind: 'err', message: 'preset.audit must be an object' };
|
|
186
|
+
}
|
|
187
|
+
const obj = input;
|
|
188
|
+
const leak = obj.urlLeakInErrors;
|
|
189
|
+
if (leak !== 'verified-safe' && leak !== 'pending' && leak !== 'known-issue') {
|
|
190
|
+
return {
|
|
191
|
+
kind: 'err',
|
|
192
|
+
message: 'preset.audit.urlLeakInErrors must be one of "verified-safe" | "pending" | "known-issue"',
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
const reviewedAt = obj.reviewedAt;
|
|
196
|
+
if (reviewedAt !== null && typeof reviewedAt !== 'string') {
|
|
197
|
+
return { kind: 'err', message: 'preset.audit.reviewedAt must be null or a string' };
|
|
198
|
+
}
|
|
199
|
+
const version = obj.version;
|
|
200
|
+
if (version !== null && typeof version !== 'string') {
|
|
201
|
+
return { kind: 'err', message: 'preset.audit.version must be null or a string' };
|
|
202
|
+
}
|
|
203
|
+
const notes = obj.notes;
|
|
204
|
+
if (notes !== undefined && typeof notes !== 'string') {
|
|
205
|
+
return { kind: 'err', message: 'preset.audit.notes must be a string when present' };
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
kind: 'ok',
|
|
209
|
+
audit: {
|
|
210
|
+
urlLeakInErrors: leak,
|
|
211
|
+
reviewedAt,
|
|
212
|
+
version,
|
|
213
|
+
...(notes !== undefined && { notes }),
|
|
214
|
+
},
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
//# sourceMappingURL=preset-loader.js.map
|