@kindgi/cli 0.0.0-bootstrap.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +738 -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 +48 -0
- package/dist/build/bundle.d.ts.map +1 -0
- package/dist/build/bundle.js +125 -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 +197 -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 +597 -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 +100 -0
- package/dist/build/host-install.d.ts.map +1 -0
- package/dist/build/host-install.js +443 -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 +25 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +283 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/build.d.ts +46 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +902 -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 +43 -0
- package/dist/commands/dev.d.ts.map +1 -0
- package/dist/commands/dev.js +1110 -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 +48 -0
- package/dist/commands/helpers.d.ts.map +1 -0
- package/dist/commands/helpers.js +110 -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 +454 -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 +212 -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 +223 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/secrets.d.ts +18 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +702 -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 +162 -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 +22 -0
- package/dist/commands/unwired.d.ts.map +1 -0
- package/dist/commands/unwired.js +52 -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 +162 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.js +45 -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 +10 -0
- package/dist/dev/bundler.d.ts.map +1 -0
- package/dist/dev/bundler.js +235 -0
- package/dist/dev/bundler.js.map +1 -0
- package/dist/dev/defaults.d.ts +140 -0
- package/dist/dev/defaults.d.ts.map +1 -0
- package/dist/dev/defaults.js +709 -0
- package/dist/dev/defaults.js.map +1 -0
- package/dist/dev/dev-only-imports.d.ts +15 -0
- package/dist/dev/dev-only-imports.d.ts.map +1 -0
- package/dist/dev/dev-only-imports.js +57 -0
- package/dist/dev/dev-only-imports.js.map +1 -0
- package/dist/dev/docker-compose.dev.yml +68 -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 +40 -0
- package/dist/dev/pack-service.d.ts.map +1 -0
- package/dist/dev/pack-service.js +189 -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/postgres-container.d.ts +77 -0
- package/dist/dev/postgres-container.d.ts.map +1 -0
- package/dist/dev/postgres-container.js +346 -0
- package/dist/dev/postgres-container.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 +312 -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 +71 -0
- package/dist/dev/runtime-container.d.ts.map +1 -0
- package/dist/dev/runtime-container.js +173 -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 +26 -0
- package/dist/dev/runtime-image.d.ts.map +1 -0
- package/dist/dev/runtime-image.js +44 -0
- package/dist/dev/runtime-image.js.map +1 -0
- package/dist/dev/runtime-registry.d.ts +73 -0
- package/dist/dev/runtime-registry.d.ts.map +1 -0
- package/dist/dev/runtime-registry.js +111 -0
- package/dist/dev/runtime-registry.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 +111 -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 +86 -0
- package/dist/init/augment-scaffolder.d.ts.map +1 -0
- package/dist/init/augment-scaffolder.js +538 -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/pnpm-workspace-patcher.d.ts +55 -0
- package/dist/init/pnpm-workspace-patcher.d.ts.map +1 -0
- package/dist/init/pnpm-workspace-patcher.js +248 -0
- package/dist/init/pnpm-workspace-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 +18 -0
- package/dist/init/template-files.d.ts.map +1 -0
- package/dist/init/template-files.js +53 -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 +113 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +199 -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 +88 -0
- package/dist/parse.d.ts.map +1 -0
- package/dist/parse.js +100 -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 +252 -0
- package/dist/sdk-skills/kindgi-authoring-flows/SKILL.md +302 -0
- package/dist/sdk-skills/kindgi-authoring-guardrails/SKILL.md +297 -0
- package/dist/sdk-skills/kindgi-authoring-mcp-servers/SKILL.md +289 -0
- package/dist/sdk-skills/kindgi-authoring-providers/SKILL.md +705 -0
- package/dist/sdk-skills/kindgi-authoring-tools/SKILL.md +298 -0
- package/dist/sdk-skills/kindgi-framework-feedback/SKILL.md +211 -0
- package/dist/sdk-skills/kindgi-getting-started/SKILL.md +189 -0
- package/dist/sdk-skills/kindgi-python-authoring-agents/SKILL.md +205 -0
- package/dist/sdk-skills/kindgi-python-authoring-flows/SKILL.md +325 -0
- package/dist/sdk-skills/kindgi-python-authoring-guardrails/SKILL.md +176 -0
- package/dist/sdk-skills/kindgi-python-authoring-tools/SKILL.md +305 -0
- package/dist/sdk-skills/kindgi-python-getting-started/SKILL.md +242 -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/.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/gitignore +8 -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 +8 -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/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/gitignore +9 -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/.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/gitignore +8 -0
- package/dist/templates/sample/guardrails/response-not-empty/index.ts.tmpl +58 -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 +8 -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/terminal-input.d.ts +17 -0
- package/dist/terminal-input.d.ts.map +1 -0
- package/dist/terminal-input.js +88 -0
- package/dist/terminal-input.js.map +1 -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,312 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Injectable seams for `kindgi dev`. The command consumes only these
|
|
3
|
+
* interfaces so tests can hand in a mock runtime / indexer / watcher
|
|
4
|
+
* without touching Docker, Postgres, the filesystem, or `fs.watch`'s
|
|
5
|
+
* cross-platform caveats. Production callers wire the real ones from
|
|
6
|
+
* `packages/cli/src/dev/defaults.ts`: the Kindgi runtime as a container,
|
|
7
|
+
* `runIndexer` (`@kindgi/handler-runtime`), and an `fs.watch` bridge.
|
|
8
|
+
*/
|
|
9
|
+
import type { PackServiceSupervisor, PackServiceSupervisorEvent } from '@kindgi/handler-runtime/pack-service';
|
|
10
|
+
import type { PackCode } from './pack-code.js';
|
|
11
|
+
/** The running Kindgi runtime `kindgi dev` talks to. */
|
|
12
|
+
export interface RunningApiServer {
|
|
13
|
+
readonly baseUrl: string;
|
|
14
|
+
readonly port: number;
|
|
15
|
+
readonly tenantId: string;
|
|
16
|
+
/** The user the dev token resolves to. */
|
|
17
|
+
readonly userId: string;
|
|
18
|
+
/**
|
|
19
|
+
* Default project id for the boot tenant. Required for POST-body
|
|
20
|
+
* primitive-registration routes. `kindgi dev`
|
|
21
|
+
* threads this into `registerFromIndex` so scaffolded packs land
|
|
22
|
+
* under the tenant's Default project.
|
|
23
|
+
*/
|
|
24
|
+
readonly defaultProjectId: string;
|
|
25
|
+
readonly token: string;
|
|
26
|
+
readonly banner: string;
|
|
27
|
+
/**
|
|
28
|
+
* True when the api-server has the console SPA mounted at
|
|
29
|
+
* `${baseUrl}/console/`. Depends on the bundled console-assets
|
|
30
|
+
* directory being present next to the CLI dist — the shipped CLI
|
|
31
|
+
* ships them; a broken install may not. Absent = console URL
|
|
32
|
+
* should not be advertised.
|
|
33
|
+
*/
|
|
34
|
+
readonly consoleMounted?: boolean;
|
|
35
|
+
shutdown(): Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
export interface StartApiServerOptions {
|
|
38
|
+
/** The host port the API is reached on (`127.0.0.1` only). */
|
|
39
|
+
readonly port: number;
|
|
40
|
+
/** Postgres, as this machine reaches it. */
|
|
41
|
+
readonly databaseUrl: string;
|
|
42
|
+
readonly tenantId: string;
|
|
43
|
+
readonly token: string;
|
|
44
|
+
/** The user the dev token resolves to — the previous boot's, so reviewer registrations carry over. */
|
|
45
|
+
readonly userId: string;
|
|
46
|
+
/** The pack directory: the runtime reads its index and its `.env` files there. */
|
|
47
|
+
readonly packDir: string;
|
|
48
|
+
/** `dev.envFiles` from `kindgi.config.ts`; default `.env`, `.env.local`. */
|
|
49
|
+
readonly localEnvFiles?: readonly string[];
|
|
50
|
+
/**
|
|
51
|
+
* The CLI's environment: values for `${VAR}` references the env files
|
|
52
|
+
* don't define, and `HOME` (Google credentials).
|
|
53
|
+
*/
|
|
54
|
+
readonly hostEnv: Readonly<Record<string, string | undefined>>;
|
|
55
|
+
/** The local pack service's front, which the runtime calls the pack's code through. */
|
|
56
|
+
readonly packService: {
|
|
57
|
+
readonly url: string;
|
|
58
|
+
readonly token: string;
|
|
59
|
+
};
|
|
60
|
+
/** `KINDGI_PUBLIC_TOKEN_SIGNING_KEY_PATH`: the developer's key file, if set. Otherwise the runtime makes one. */
|
|
61
|
+
readonly publicRunTokenKeyPath?: string;
|
|
62
|
+
/** `KINDGI_CORS_ORIGINS`: the browser app's origins, allowed on the run progress routes. */
|
|
63
|
+
readonly corsOrigins?: readonly string[];
|
|
64
|
+
/** The runtime image (`--runtime-image`). */
|
|
65
|
+
readonly runtimeImage: string;
|
|
66
|
+
/**
|
|
67
|
+
* `--runtime-url`: a runtime the developer runs themselves (from
|
|
68
|
+
* source). No container: `kindgi dev` writes `runtime.env` for it and
|
|
69
|
+
* waits until it serves with this session's dev token.
|
|
70
|
+
*/
|
|
71
|
+
readonly runtimeUrl?: string;
|
|
72
|
+
/** Lines the runtime writes. */
|
|
73
|
+
readonly onLog?: (line: string) => void;
|
|
74
|
+
/** Progress while preparing (an image pull). */
|
|
75
|
+
readonly onProgress?: (line: string) => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* One bundle of the pack's code: each primitive's source path (as the
|
|
79
|
+
* index records it) mapped to its bundle, both relative to the pack
|
|
80
|
+
* root — or the build errors, located `file:line:column`.
|
|
81
|
+
*
|
|
82
|
+
* `externals` (a Node pack's): the packages the code loads from the
|
|
83
|
+
* app's `node_modules`, the same ones a pack image's bundles load — its
|
|
84
|
+
* primitives' and its config's. Absent for a Python pack.
|
|
85
|
+
*/
|
|
86
|
+
export type PackBuild = {
|
|
87
|
+
readonly kind: 'ok';
|
|
88
|
+
readonly bundleMap: Readonly<Record<string, string>>;
|
|
89
|
+
readonly externals?: readonly ExternalPackage[];
|
|
90
|
+
} | {
|
|
91
|
+
readonly kind: 'err';
|
|
92
|
+
readonly errors: readonly string[];
|
|
93
|
+
};
|
|
94
|
+
/** A package the pack's code loads from `node_modules`, and the files that import it. */
|
|
95
|
+
export interface ExternalPackage {
|
|
96
|
+
/** `@scope/name` or `name`. */
|
|
97
|
+
readonly name: string;
|
|
98
|
+
/** Relative to the pack root, sorted. */
|
|
99
|
+
readonly importers: readonly string[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Makes the pack's code ready for the pack service: esbuild bundles for a
|
|
103
|
+
* Node pack, the sources themselves for a Python one.
|
|
104
|
+
*/
|
|
105
|
+
export interface PackBuilder {
|
|
106
|
+
/** Build once; picks up added or removed primitive files. */
|
|
107
|
+
build(): Promise<PackBuild>;
|
|
108
|
+
/** Rebuild whenever a file any bundle read changes, reporting every build. */
|
|
109
|
+
watch(onBuild: (build: PackBuild) => void): Promise<void>;
|
|
110
|
+
/** Pick up added or removed primitive files; resolves `true` when the entries changed. */
|
|
111
|
+
syncEntries(): Promise<boolean>;
|
|
112
|
+
dispose(): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
export interface IndexerRunOptions {
|
|
115
|
+
/** Import each primitive's bundle instead of its source (source path → bundle path). */
|
|
116
|
+
readonly bundleMap?: Readonly<Record<string, string>>;
|
|
117
|
+
/** Run the indexer in a child process with this environment. */
|
|
118
|
+
readonly env?: () => Promise<Readonly<Record<string, string>>>;
|
|
119
|
+
/** Which indexer: the TypeScript one (default) or the pack's Python. */
|
|
120
|
+
readonly code?: PackCode;
|
|
121
|
+
}
|
|
122
|
+
/** The local pack service `kindgi dev` runs the pack's code in. */
|
|
123
|
+
export interface DevPackServiceOptions {
|
|
124
|
+
readonly packDir: string;
|
|
125
|
+
/** Which pack service runs the code: the Node one, or the pack's Python. */
|
|
126
|
+
readonly code: PackCode;
|
|
127
|
+
/** The pack service's whole environment, read at every start. */
|
|
128
|
+
readonly env: () => Promise<Readonly<Record<string, string>>>;
|
|
129
|
+
/** Lines the pack's code writes. */
|
|
130
|
+
readonly onLog: (line: string, stream: 'stdout' | 'stderr') => void;
|
|
131
|
+
readonly onEvent: (event: PackServiceSupervisorEvent) => void;
|
|
132
|
+
/**
|
|
133
|
+
* The front's port and token: the previous session's, so a runtime
|
|
134
|
+
* started with them (`--runtime-url`) keeps reaching it. Default: any
|
|
135
|
+
* free port, a new token.
|
|
136
|
+
*/
|
|
137
|
+
readonly port?: number;
|
|
138
|
+
readonly token?: string;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The local pack service: the public supervisor, children behind a
|
|
142
|
+
* stable front. The runtime calls the front by URL and token.
|
|
143
|
+
*/
|
|
144
|
+
export type DevPackService = PackServiceSupervisor;
|
|
145
|
+
/**
|
|
146
|
+
* Shape of `IndexerReport.counts` — kept structural so tests can hand
|
|
147
|
+
* back plain objects without importing `@kindgi/handler-runtime`.
|
|
148
|
+
*/
|
|
149
|
+
export interface IndexedCounts {
|
|
150
|
+
readonly tools: number;
|
|
151
|
+
readonly guardrails: number;
|
|
152
|
+
readonly agents: number;
|
|
153
|
+
readonly flows: number;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The subset of `IndexerReport` `kindgi dev` needs at the callsite.
|
|
157
|
+
* The full runtime report (published-at, artifact version, etc.) is
|
|
158
|
+
* present in the manifest but the CLI only surfaces counts + the read
|
|
159
|
+
* `index.json` bytes.
|
|
160
|
+
*/
|
|
161
|
+
export interface IndexOutcome {
|
|
162
|
+
readonly kind: 'ok';
|
|
163
|
+
readonly packId: string;
|
|
164
|
+
readonly packVersion: string;
|
|
165
|
+
readonly counts: IndexedCounts;
|
|
166
|
+
/**
|
|
167
|
+
* Per-file errors accumulated during indexing. One bad file no
|
|
168
|
+
* longer aborts the whole pass — registration proceeds on healthy
|
|
169
|
+
* primitives and the errors surface here for `kindgi dev` to
|
|
170
|
+
* print. Empty on a fully-clean pass.
|
|
171
|
+
*/
|
|
172
|
+
readonly fileErrors: readonly {
|
|
173
|
+
readonly code: string;
|
|
174
|
+
readonly message: string;
|
|
175
|
+
readonly filePath?: string;
|
|
176
|
+
}[];
|
|
177
|
+
/**
|
|
178
|
+
* The parsed `index.json` payload — passed straight to the
|
|
179
|
+
* registration bridge. Kept as `unknown` because the CLI does not
|
|
180
|
+
* re-validate the shape (`runIndexer` is the authority).
|
|
181
|
+
*/
|
|
182
|
+
readonly index: unknown;
|
|
183
|
+
}
|
|
184
|
+
export interface IndexFailure {
|
|
185
|
+
readonly kind: 'err';
|
|
186
|
+
readonly code: string;
|
|
187
|
+
readonly message: string;
|
|
188
|
+
readonly filePath?: string;
|
|
189
|
+
}
|
|
190
|
+
export type IndexResult = IndexOutcome | IndexFailure;
|
|
191
|
+
/**
|
|
192
|
+
* Watcher handle. `close()` is idempotent — the command may call it
|
|
193
|
+
* from the graceful-shutdown path after the abort-signal has fired.
|
|
194
|
+
*/
|
|
195
|
+
export interface WatchHandle {
|
|
196
|
+
close(): Promise<void>;
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Handle returned by `startServices` when auto-start succeeded.
|
|
200
|
+
* `databaseUrl` is the connection string the runtime should use;
|
|
201
|
+
* `services` names what runs, for the banner.
|
|
202
|
+
*
|
|
203
|
+
* The services aren't stopped when `kindgi dev` exits: every `kindgi dev`
|
|
204
|
+
* on the machine shares the one `kindgi-dev` compose project, so another
|
|
205
|
+
* session's runtime may be using them. The next boot picks them up.
|
|
206
|
+
* `kindgi dev --reset` leaves them alone; `docker compose -p kindgi-dev
|
|
207
|
+
* down -v` removes them and their data.
|
|
208
|
+
*/
|
|
209
|
+
export interface StartedServicesHandle {
|
|
210
|
+
readonly databaseUrl: string;
|
|
211
|
+
readonly services: readonly string[];
|
|
212
|
+
/**
|
|
213
|
+
* How they were started: with `docker compose`, or with plain `docker`
|
|
214
|
+
* when compose isn't available (a Docker engine without the plugin).
|
|
215
|
+
* The same containers, volume and network either way.
|
|
216
|
+
*/
|
|
217
|
+
readonly startedWith: 'docker compose' | 'docker';
|
|
218
|
+
/** What the developer should know about this start: a flag that needs compose. */
|
|
219
|
+
readonly notes?: readonly string[];
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Outcome of `startServices`. `kind: 'ok'` = started (with docker
|
|
223
|
+
* compose, or plain docker without it) AND all containers healthy.
|
|
224
|
+
* `kind: 'unavailable'` = docker itself isn't available (not installed,
|
|
225
|
+
* or the engine doesn't answer); caller falls back to the
|
|
226
|
+
* missing-KINDGI_DATABASE_URL error. `kind: 'error'` = docker was
|
|
227
|
+
* available but the boot failed (image pull, port collision, health
|
|
228
|
+
* timeout) — caller surfaces the reason.
|
|
229
|
+
*/
|
|
230
|
+
export type StartServicesResult = {
|
|
231
|
+
readonly kind: 'ok';
|
|
232
|
+
readonly handle: StartedServicesHandle;
|
|
233
|
+
} | {
|
|
234
|
+
readonly kind: 'unavailable';
|
|
235
|
+
readonly reason: string;
|
|
236
|
+
} | {
|
|
237
|
+
readonly kind: 'error';
|
|
238
|
+
readonly message: string;
|
|
239
|
+
};
|
|
240
|
+
/**
|
|
241
|
+
* Injected fixture-friendly runners. Every field has a real
|
|
242
|
+
* implementation in `dev/defaults.ts`; tests replace individual fields
|
|
243
|
+
* to bypass Postgres, real file watchers, or the real indexer.
|
|
244
|
+
*/
|
|
245
|
+
export interface DevRunners {
|
|
246
|
+
/** Boot the api-server. Resolves once the HTTP listener is bound. */
|
|
247
|
+
readonly startApiServer: (opts: StartApiServerOptions) => Promise<RunningApiServer>;
|
|
248
|
+
/**
|
|
249
|
+
* Run the indexer against a pack root + return the parsed
|
|
250
|
+
* `index.json`, written to `outputPath` (default: the dev index).
|
|
251
|
+
* Failures are captured — this function never throws.
|
|
252
|
+
*/
|
|
253
|
+
readonly runIndexer: (packDir: string, outputPath?: string, options?: IndexerRunOptions) => Promise<IndexResult>;
|
|
254
|
+
/** The builder for the pack's code (esbuild for Node, the sources for Python). */
|
|
255
|
+
readonly createPackBuilder: (opts: {
|
|
256
|
+
readonly packDir: string;
|
|
257
|
+
readonly patterns: readonly string[];
|
|
258
|
+
/** A Node pack's `kindgi.config.*`: its imports count among the externals, as in a pack image. */
|
|
259
|
+
readonly configPath?: string;
|
|
260
|
+
readonly code: PackCode;
|
|
261
|
+
/** The pack's environment (a Python build runs the pack's interpreter with it). */
|
|
262
|
+
readonly env: () => Promise<Readonly<Record<string, string>>>;
|
|
263
|
+
}) => PackBuilder;
|
|
264
|
+
/** The local pack service (not yet started). */
|
|
265
|
+
readonly createPackService: (opts: DevPackServiceOptions) => DevPackService;
|
|
266
|
+
/**
|
|
267
|
+
* Check a Python pack's interpreter can run pack code (`import kindgi`),
|
|
268
|
+
* with the pack's environment: a one-line description, or why not.
|
|
269
|
+
*/
|
|
270
|
+
readonly checkPackPython: (python: readonly [string, ...string[]], env: Readonly<Record<string, string>>, packDir?: string) => Promise<{
|
|
271
|
+
readonly kind: 'ok';
|
|
272
|
+
readonly value: string;
|
|
273
|
+
} | {
|
|
274
|
+
readonly kind: 'err';
|
|
275
|
+
readonly message: string;
|
|
276
|
+
}>;
|
|
277
|
+
/** Make a staged index the one the api-server reads. */
|
|
278
|
+
readonly publishIndex: (stagedPath: string, indexPath: string) => Promise<void>;
|
|
279
|
+
/**
|
|
280
|
+
* Start watching the pack's discovery patterns (default: the
|
|
281
|
+
* indexer's `DEFAULT_DISCOVERY`). The callback fires (debounced) when
|
|
282
|
+
* a file a pattern matches changes, or one of `files` (absolute
|
|
283
|
+
* paths — the env files). Returns a handle with an idempotent
|
|
284
|
+
* `close()`.
|
|
285
|
+
*/
|
|
286
|
+
readonly watchPack: (packDir: string, onChange: () => void, opts?: {
|
|
287
|
+
readonly debounceMs?: number;
|
|
288
|
+
readonly patterns?: readonly string[];
|
|
289
|
+
readonly files?: readonly string[];
|
|
290
|
+
}) => Promise<WatchHandle>;
|
|
291
|
+
/**
|
|
292
|
+
* Auto-start the bundled `docker-compose.dev.yml` (Postgres) with
|
|
293
|
+
* `docker compose`, in the `kindgi-dev` project, or with plain `docker`
|
|
294
|
+
* when compose isn't available. Called only when the user did NOT
|
|
295
|
+
* provide `--database-url` / `KINDGI_DATABASE_URL`. Returns an outcome
|
|
296
|
+
* enum: `ok` (fall through with the container's URL), `unavailable`
|
|
297
|
+
* (docker isn't available — caller falls back to the manual error),
|
|
298
|
+
* or `error` (docker was available but boot failed).
|
|
299
|
+
*
|
|
300
|
+
* Optional so tests can leave it unset (falls through to the
|
|
301
|
+
* current "manual KINDGI_DATABASE_URL required" error).
|
|
302
|
+
*
|
|
303
|
+
* `recreate`: let compose recreate the shared Postgres when its
|
|
304
|
+
* definition changed (`--recreate-services`). Default: an existing
|
|
305
|
+
* container is reused as it is — another `kindgi dev` may be using it.
|
|
306
|
+
* Without compose it is always reused; the handle's `notes` say so.
|
|
307
|
+
*/
|
|
308
|
+
readonly startServices?: (options: {
|
|
309
|
+
readonly recreate: boolean;
|
|
310
|
+
}) => Promise<StartServicesResult>;
|
|
311
|
+
}
|
|
312
|
+
//# sourceMappingURL=runners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runners.d.ts","sourceRoot":"","sources":["../../src/dev/runners.ts"],"names":[],"mappings":"AAGA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,sCAAsC,CAAC;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,wDAAwD;AACxD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,0CAA0C;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB;;;;;OAKG;IACH,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,KAA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CAAC;QAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CACrD,CAAC;IACF,wDAAwD;IACxD,QAAQ,CAAC,YAAY,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChF;;;;;;OAMG;IACH,QAAQ,CAAC,SAAS,EAAE,CAClB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,IAAI,EACpB,IAAI,CAAC,EAAE;QACL,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;QAC7B,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;QACtC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACpC,KACE,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1B;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC,OAAO,EAAE;QACjC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;KAC5B,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runners.js","sourceRoot":"","sources":["../../src/dev/runners.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export type RuntimeNetwork = 'alias' | 'host-network';
|
|
2
|
+
/** The port the image's server listens on (its `KINDGI_API_PORT`). */
|
|
3
|
+
export declare const IMAGE_API_PORT = 4000;
|
|
4
|
+
export interface DockerOutcome {
|
|
5
|
+
/** The exit code; `null` when `docker` couldn't be spawned. */
|
|
6
|
+
readonly code: number | null;
|
|
7
|
+
readonly stdout: string;
|
|
8
|
+
readonly stderr: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DockerRunOptions {
|
|
11
|
+
/**
|
|
12
|
+
* Written to the command's stdin, which is then closed. A secret (a
|
|
13
|
+
* registry token) goes here, never in the arguments or the environment.
|
|
14
|
+
*/
|
|
15
|
+
readonly stdin?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Runs one `docker` command to completion: `docker` below, or a fake in tests. */
|
|
18
|
+
export type DockerRunner = (args: readonly string[], options?: DockerRunOptions) => Promise<DockerOutcome>;
|
|
19
|
+
/** Run one `docker` command to completion. */
|
|
20
|
+
export declare function docker(args: readonly string[], options?: DockerRunOptions): Promise<DockerOutcome>;
|
|
21
|
+
/**
|
|
22
|
+
* How this machine's Docker reaches the host: Docker Desktop (any OS)
|
|
23
|
+
* can't see the host's loopback; a Linux engine can share the host
|
|
24
|
+
* network.
|
|
25
|
+
*/
|
|
26
|
+
export declare function detectRuntimeNetwork(): Promise<RuntimeNetwork>;
|
|
27
|
+
/** The container for this pack directory: one per pack, so two packs can run side by side. */
|
|
28
|
+
export declare function runtimeContainerName(packDir: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Make sure the image is here, pulling it if not. A private image needs
|
|
31
|
+
* a registry login first (`kindgi auth registry`); the error says so.
|
|
32
|
+
*/
|
|
33
|
+
export declare function ensureRuntimeImage(image: string, onProgress: (line: string) => void): Promise<{
|
|
34
|
+
readonly kind: 'ok';
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'error';
|
|
37
|
+
readonly message: string;
|
|
38
|
+
}>;
|
|
39
|
+
export interface RuntimeContainerOptions {
|
|
40
|
+
readonly image: string;
|
|
41
|
+
/** The pack directory on the host, mounted at `/pack`. */
|
|
42
|
+
readonly packDir: string;
|
|
43
|
+
/** The `runtime.env` file (`docker run --env-file`). */
|
|
44
|
+
readonly envFile: string;
|
|
45
|
+
readonly network: RuntimeNetwork;
|
|
46
|
+
/** The host port the API is reached on (always on `127.0.0.1`). */
|
|
47
|
+
readonly hostPort: number;
|
|
48
|
+
/** Credential files mounted read-only, by host path. */
|
|
49
|
+
readonly googleCredentials?: string;
|
|
50
|
+
readonly publicTokenKey?: string;
|
|
51
|
+
/** Every line the runtime writes. */
|
|
52
|
+
readonly onLog: (line: string) => void;
|
|
53
|
+
}
|
|
54
|
+
export interface RunningRuntimeContainer {
|
|
55
|
+
readonly name: string;
|
|
56
|
+
readonly baseUrl: string;
|
|
57
|
+
/** What the runtime printed until it served: its banner. */
|
|
58
|
+
readonly banner: string;
|
|
59
|
+
stop(): Promise<void>;
|
|
60
|
+
}
|
|
61
|
+
/** The `docker run` arguments for the runtime container. */
|
|
62
|
+
export declare function runtimeRunArgs(name: string, options: RuntimeContainerOptions): string[];
|
|
63
|
+
/**
|
|
64
|
+
* Start the runtime container and wait until it serves. An earlier
|
|
65
|
+
* container for the same pack (a crashed session) is replaced.
|
|
66
|
+
*/
|
|
67
|
+
export declare function startRuntimeContainer(options: RuntimeContainerOptions, wait?: {
|
|
68
|
+
readonly timeoutMs?: number;
|
|
69
|
+
readonly fetch?: typeof fetch;
|
|
70
|
+
}): Promise<RunningRuntimeContainer>;
|
|
71
|
+
//# sourceMappingURL=runtime-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-container.d.ts","sourceRoot":"","sources":["../../src/dev/runtime-container.ts"],"names":[],"mappings":"AA2BA,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,cAAc,CAAC;AAEtD,sEAAsE;AACtE,eAAO,MAAM,cAAc,OAAO,CAAC;AAEnC,MAAM,WAAW,aAAa;IAC5B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,mFAAmF;AACnF,MAAM,MAAM,YAAY,GAAG,CACzB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,O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OAAO,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAED,4DAA4D;AAC5D,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,uBAAuB,GAAG,MAAM,EAAE,CAuBvF;AAKD;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,uBAAuB,EAChC,IAAI,GAAE;IAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAA;CAAO,GACxE,OAAO,CAAC,uBAAuB,CAAC,CAgElC"}
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* The Kindgi runtime as a container under `kindgi dev`: one
|
|
5
|
+
* container per pack directory, started with `docker run`, configured
|
|
6
|
+
* only by `runtime.env`, with the pack directory mounted at `/pack`.
|
|
7
|
+
*
|
|
8
|
+
* Nothing it serves is reachable from the network:
|
|
9
|
+
* - Docker Desktop (`alias`): the API is published on the host's
|
|
10
|
+
* `127.0.0.1` only, and loopback calls from the container (the pack
|
|
11
|
+
* service, the app's webhooks) go to `host.docker.internal`.
|
|
12
|
+
* - Linux (`host-network`): the container shares the host's network,
|
|
13
|
+
* binds `127.0.0.1`, and runs as the developer's user, so files it
|
|
14
|
+
* writes into the pack stay theirs.
|
|
15
|
+
*/
|
|
16
|
+
import { spawn } from 'node:child_process';
|
|
17
|
+
import { createHash } from 'node:crypto';
|
|
18
|
+
import { RUNTIME_GOOGLE_CREDENTIALS, RUNTIME_PACK_DIR, RUNTIME_PUBLIC_TOKEN_KEY, } from './runtime-env.js';
|
|
19
|
+
import { isRegistryAuthFailure, registryLoginCommand } from './runtime-registry.js';
|
|
20
|
+
/** The port the image's server listens on (its `KINDGI_API_PORT`). */
|
|
21
|
+
export const IMAGE_API_PORT = 4000;
|
|
22
|
+
/** Run one `docker` command to completion. */
|
|
23
|
+
export function docker(args, options = {}) {
|
|
24
|
+
return new Promise((resolve) => {
|
|
25
|
+
const child = spawn('docker', args, {
|
|
26
|
+
stdio: [options.stdin === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'],
|
|
27
|
+
});
|
|
28
|
+
let stdout = '';
|
|
29
|
+
let stderr = '';
|
|
30
|
+
child.stdout?.on('data', (chunk) => {
|
|
31
|
+
stdout += chunk.toString();
|
|
32
|
+
});
|
|
33
|
+
child.stderr?.on('data', (chunk) => {
|
|
34
|
+
stderr += chunk.toString();
|
|
35
|
+
});
|
|
36
|
+
child.once('error', (err) => resolve({ code: null, stdout, stderr: err.message }));
|
|
37
|
+
child.once('close', (code) => resolve({ code, stdout, stderr }));
|
|
38
|
+
if (options.stdin !== undefined) {
|
|
39
|
+
// `docker` may exit without reading it (a bad flag, or no `docker`
|
|
40
|
+
// at all): the write's EPIPE is reported by the exit, not thrown.
|
|
41
|
+
child.stdin?.on('error', () => undefined);
|
|
42
|
+
child.stdin?.end(options.stdin);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function lastLines(text, n = 5) {
|
|
47
|
+
return text.trim().split('\n').slice(-n).join('\n');
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* How this machine's Docker reaches the host: Docker Desktop (any OS)
|
|
51
|
+
* can't see the host's loopback; a Linux engine can share the host
|
|
52
|
+
* network.
|
|
53
|
+
*/
|
|
54
|
+
export async function detectRuntimeNetwork() {
|
|
55
|
+
if (process.platform !== 'linux')
|
|
56
|
+
return 'alias';
|
|
57
|
+
const info = await docker(['info', '--format', '{{.OperatingSystem}}']);
|
|
58
|
+
return info.code === 0 && /Docker Desktop/i.test(info.stdout) ? 'alias' : 'host-network';
|
|
59
|
+
}
|
|
60
|
+
/** The container for this pack directory: one per pack, so two packs can run side by side. */
|
|
61
|
+
export function runtimeContainerName(packDir) {
|
|
62
|
+
return `kindgi-dev-runtime-${createHash('sha256').update(packDir).digest('hex').slice(0, 12)}`;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Make sure the image is here, pulling it if not. A private image needs
|
|
66
|
+
* a registry login first (`kindgi auth registry`); the error says so.
|
|
67
|
+
*/
|
|
68
|
+
export async function ensureRuntimeImage(image, onProgress) {
|
|
69
|
+
const present = await docker(['image', 'inspect', '--format', '{{.Id}}', image]);
|
|
70
|
+
if (present.code === 0)
|
|
71
|
+
return { kind: 'ok' };
|
|
72
|
+
if (present.code === null) {
|
|
73
|
+
return { kind: 'error', message: `Docker isn't available: ${present.stderr}` };
|
|
74
|
+
}
|
|
75
|
+
onProgress(`Pulling the Kindgi runtime image ${image} (first run only)...`);
|
|
76
|
+
const pulled = await docker(['pull', image]);
|
|
77
|
+
if (pulled.code === 0)
|
|
78
|
+
return { kind: 'ok' };
|
|
79
|
+
const detail = lastLines(pulled.stderr);
|
|
80
|
+
const auth = isRegistryAuthFailure(pulled.stderr)
|
|
81
|
+
? `\n The runtime image is in private preview: request access at contact@kindgi.com, log in with the pull credentials you receive (${registryLoginCommand(image)}), then run kindgi dev again.`
|
|
82
|
+
: '';
|
|
83
|
+
return { kind: 'error', message: `Couldn't pull ${image}: ${detail}${auth}` };
|
|
84
|
+
}
|
|
85
|
+
/** The `docker run` arguments for the runtime container. */
|
|
86
|
+
export function runtimeRunArgs(name, options) {
|
|
87
|
+
const args = ['run', '--detach', '--rm', '--name', name, '--env-file', options.envFile];
|
|
88
|
+
args.push('--volume', `${options.packDir}:${RUNTIME_PACK_DIR}`);
|
|
89
|
+
if (options.googleCredentials !== undefined) {
|
|
90
|
+
args.push('--volume', `${options.googleCredentials}:${RUNTIME_GOOGLE_CREDENTIALS}:ro`);
|
|
91
|
+
}
|
|
92
|
+
if (options.publicTokenKey !== undefined) {
|
|
93
|
+
args.push('--volume', `${options.publicTokenKey}:${RUNTIME_PUBLIC_TOKEN_KEY}:ro`);
|
|
94
|
+
}
|
|
95
|
+
if (options.network === 'host-network') {
|
|
96
|
+
args.push('--network', 'host');
|
|
97
|
+
// Files the runtime writes into the pack (secrets) stay the developer's.
|
|
98
|
+
if (typeof process.getuid === 'function' && typeof process.getgid === 'function') {
|
|
99
|
+
args.push('--user', `${process.getuid()}:${process.getgid()}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
args.push('--publish', `127.0.0.1:${options.hostPort}:${IMAGE_API_PORT}`);
|
|
104
|
+
// Docker Desktop provides the name; other engines get it this way.
|
|
105
|
+
args.push('--add-host', 'host.docker.internal:host-gateway');
|
|
106
|
+
}
|
|
107
|
+
// The image's own argument (its console), then the dev-echo provider.
|
|
108
|
+
args.push(options.image, '--console-static-dir', '/app/console', '--dev-echo-provider');
|
|
109
|
+
return args;
|
|
110
|
+
}
|
|
111
|
+
/** The line every runtime that runs a `kindgi dev` pack prints. */
|
|
112
|
+
const PACK_DIR_BANNER = ` Pack: ${RUNTIME_PACK_DIR} `;
|
|
113
|
+
/**
|
|
114
|
+
* Start the runtime container and wait until it serves. An earlier
|
|
115
|
+
* container for the same pack (a crashed session) is replaced.
|
|
116
|
+
*/
|
|
117
|
+
export async function startRuntimeContainer(options, wait = {}) {
|
|
118
|
+
const name = runtimeContainerName(options.packDir);
|
|
119
|
+
await docker(['rm', '--force', name]);
|
|
120
|
+
const started = await docker(runtimeRunArgs(name, options));
|
|
121
|
+
if (started.code !== 0) {
|
|
122
|
+
throw new Error(`docker run failed: ${lastLines(started.stderr)}`);
|
|
123
|
+
}
|
|
124
|
+
const lines = [];
|
|
125
|
+
let logs = spawn('docker', ['logs', '--follow', name], {
|
|
126
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
127
|
+
});
|
|
128
|
+
const onChunk = (chunk) => {
|
|
129
|
+
for (const line of chunk.toString().split('\n')) {
|
|
130
|
+
if (line === '')
|
|
131
|
+
continue;
|
|
132
|
+
lines.push(line);
|
|
133
|
+
options.onLog(line);
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
logs.stdout?.on('data', onChunk);
|
|
137
|
+
logs.stderr?.on('data', onChunk);
|
|
138
|
+
const stop = async () => {
|
|
139
|
+
logs?.kill();
|
|
140
|
+
logs = undefined;
|
|
141
|
+
await docker(['stop', '--time', '10', name]);
|
|
142
|
+
};
|
|
143
|
+
const baseUrl = `http://127.0.0.1:${options.hostPort}`;
|
|
144
|
+
const doFetch = wait.fetch ?? fetch;
|
|
145
|
+
const deadline = Date.now() + (wait.timeoutMs ?? 120_000);
|
|
146
|
+
for (;;) {
|
|
147
|
+
const healthy = await doFetch(`${baseUrl}/health`, { signal: AbortSignal.timeout(2_000) })
|
|
148
|
+
.then((r) => r.ok)
|
|
149
|
+
.catch(() => false);
|
|
150
|
+
// Serving, and its banner printed (the pack line comes after the URL).
|
|
151
|
+
if (healthy && lines.some((l) => l.startsWith(PACK_DIR_BANNER)))
|
|
152
|
+
break;
|
|
153
|
+
const running = await docker(['inspect', '--format', '{{.State.Running}}', name]);
|
|
154
|
+
if (running.code !== 0 || running.stdout.trim() !== 'true') {
|
|
155
|
+
await stop();
|
|
156
|
+
throw new Error(`the Kindgi runtime container stopped while starting:\n${lines.slice(-15).join('\n')}`);
|
|
157
|
+
}
|
|
158
|
+
// The banner ends with the `Env:` line, after the pack line. Without
|
|
159
|
+
// the pack line, the image predates the runtime's development settings.
|
|
160
|
+
if (lines.some((l) => l.startsWith(' Env: ')) &&
|
|
161
|
+
!lines.some((l) => l.startsWith(PACK_DIR_BANNER))) {
|
|
162
|
+
await stop();
|
|
163
|
+
throw new Error(`${options.image} can't run a kindgi dev pack: it predates the runtime's development settings. Use a newer image (--runtime-image).`);
|
|
164
|
+
}
|
|
165
|
+
if (Date.now() > deadline) {
|
|
166
|
+
await stop();
|
|
167
|
+
throw new Error(`the Kindgi runtime didn't start serving in time:\n${lines.slice(-15).join('\n')}`);
|
|
168
|
+
}
|
|
169
|
+
await new Promise((r) => setTimeout(r, 250));
|
|
170
|
+
}
|
|
171
|
+
return { name, baseUrl, banner: lines.join('\n'), stop };
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=runtime-container.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-container.js","sourceRoot":"","sources":["../../src/dev/runtime-container.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAqB,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAIpF,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC;AAuBnC,8CAA8C;AAC9C,MAAM,UAAU,MAAM,CACpB,IAAuB,EACvB,UAA4B,EAAE;IAE9B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,QAAQ,EAAE,IAAI,EAAE;YAClC,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SACzE,CAAC,CAAC;QACH,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,IAAI,MAAM,GAAG,EAAE,CAAC;QAChB,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,MAAM,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;QAC7B,CAAC,CAAC,CA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= "/pack";
|
|
3
|
+
/** Where read-only credential files are mounted in the runtime container. */
|
|
4
|
+
export declare const RUNTIME_GOOGLE_CREDENTIALS = "/run/kindgi/google-credentials.json";
|
|
5
|
+
export declare const RUNTIME_PUBLIC_TOKEN_KEY = "/run/kindgi/public-token-signing.pem";
|
|
6
|
+
/** `<pack>/.kindgi/dev/runtime.env`. */
|
|
7
|
+
export declare function runtimeEnvPath(packDir: string): string;
|
|
8
|
+
export interface RuntimeEnvInput {
|
|
9
|
+
/** The port the API listens on, as the runtime sees it. */
|
|
10
|
+
readonly apiPort: number;
|
|
11
|
+
/** `KINDGI_API_HOST`: bind loopback (Linux host networking, or a server on the host). */
|
|
12
|
+
readonly apiHost?: string;
|
|
13
|
+
/**
|
|
14
|
+
* `KINDGI_DEV_HOST_ALIAS`: where loopback calls go when the runtime
|
|
15
|
+
* can't see the host's loopback (Docker Desktop: `host.docker.internal`).
|
|
16
|
+
*/
|
|
17
|
+
readonly hostAlias?: string;
|
|
18
|
+
/** The pack directory, as the runtime sees it (`/pack` in the container). */
|
|
19
|
+
readonly packDir: string;
|
|
20
|
+
/** Postgres, as the runtime reaches it. */
|
|
21
|
+
readonly databaseUrl: string;
|
|
22
|
+
readonly tenantId: string;
|
|
23
|
+
readonly token: string;
|
|
24
|
+
readonly seedUserId: string;
|
|
25
|
+
/** The pack service's front (`http://127.0.0.1:<port>`; through the alias from a container). */
|
|
26
|
+
readonly packService: {
|
|
27
|
+
readonly url: string;
|
|
28
|
+
readonly token: string;
|
|
29
|
+
};
|
|
30
|
+
/** `dev.envFiles`; default `.env`, `.env.local`. */
|
|
31
|
+
readonly localEnvFiles?: readonly string[];
|
|
32
|
+
/** Browser origins allowed on the run progress routes. */
|
|
33
|
+
readonly corsOrigins: readonly string[];
|
|
34
|
+
/** The developer's public run token key file, as the runtime sees it. */
|
|
35
|
+
readonly publicTokenKeyPath?: string;
|
|
36
|
+
/** The developer's Google Application Default Credentials, as the runtime sees them. */
|
|
37
|
+
readonly googleCredentialsPath?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Values from the shell for `${VAR}` references the pack's env files
|
|
40
|
+
* make and don't define. On the machine the server reads them from the
|
|
41
|
+
* shell; in the container this is its shell.
|
|
42
|
+
*/
|
|
43
|
+
readonly shellReferences: Readonly<Record<string, string>>;
|
|
44
|
+
}
|
|
45
|
+
/** The runtime container's environment, by name. */
|
|
46
|
+
export declare function buildRuntimeEnv(input: RuntimeEnvInput): Record<string, string>;
|
|
47
|
+
/**
|
|
48
|
+
* The shell values the runtime needs for the pack's `${VAR}` references:
|
|
49
|
+
* names the env files refer to without defining, that the shell has.
|
|
50
|
+
*/
|
|
51
|
+
export declare function shellReferencesOf(input: {
|
|
52
|
+
readonly packDir: string;
|
|
53
|
+
readonly localEnvFiles?: readonly string[];
|
|
54
|
+
readonly shellEnv: Readonly<Record<string, string | undefined>>;
|
|
55
|
+
}): Promise<Record<string, string>>;
|
|
56
|
+
/**
|
|
57
|
+
* Write the env file `docker run --env-file` reads: `NAME=value` lines,
|
|
58
|
+
* taken literally (no quotes, no expansion), mode 0600, since it holds
|
|
59
|
+
* the API token. A value with a line break can't be written.
|
|
60
|
+
*/
|
|
61
|
+
export declare function writeRuntimeEnv(path: string, env: Readonly<Record<string, string>>): Promise<void>;
|
|
62
|
+
//# sourceMappingURL=runtime-env.d.ts.map
|