@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,153 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* The version specs `kindgi init` writes for `@kindgi/sdk` (dependency)
|
|
5
|
+
* and `@kindgi/cli` (devDependency) — one answer for both init modes.
|
|
6
|
+
* The CLI is project-local: a project runs the `kindgi` it pins, never a
|
|
7
|
+
* global one.
|
|
8
|
+
*
|
|
9
|
+
* Three cases, decided by where the running CLI lives:
|
|
10
|
+
*
|
|
11
|
+
* - **published** — the CLI sits under `node_modules`. `@kindgi/cli`
|
|
12
|
+
* pins the running CLI's version; `@kindgi/sdk` uses the spec the
|
|
13
|
+
* published CLI itself depends on (pnpm rewrites `workspace:*` at
|
|
14
|
+
* publish time).
|
|
15
|
+
* - **workspace** — a source checkout, and the target is inside the
|
|
16
|
+
* same pnpm workspace (`packs/foo`): `workspace:*` for both.
|
|
17
|
+
* - **local-checkout** — a source checkout, target elsewhere (an
|
|
18
|
+
* existing app, a pilot repo) or `--link-local`: symlink both
|
|
19
|
+
* packages from the checkout (`link:`, or `file:` for npm).
|
|
20
|
+
*
|
|
21
|
+
* Never `latest` — an unpinned spec resolves to whatever the registry
|
|
22
|
+
* serves that day, and before publishing it resolves to nothing.
|
|
23
|
+
*/
|
|
24
|
+
import { realpath as fsRealpath, stat } from 'node:fs/promises';
|
|
25
|
+
import { dirname, join, relative, sep } from 'node:path';
|
|
26
|
+
import { resolveCliPackage } from '../cli-package.js';
|
|
27
|
+
import { localLinkProtocol } from '../package-manager.js';
|
|
28
|
+
import { resolveSdkPackageRoot } from '../sdk-package.js';
|
|
29
|
+
export async function resolveKindgiDependencySpecs(input) {
|
|
30
|
+
const realpath = input.realpath ?? fsRealpath;
|
|
31
|
+
const exists = input.exists ?? pathExists;
|
|
32
|
+
const cli = input.cli ?? resolveCliPackage();
|
|
33
|
+
if (cli === undefined) {
|
|
34
|
+
return {
|
|
35
|
+
kind: 'error',
|
|
36
|
+
message: 'Cannot locate the @kindgi/cli package.json — broken install.',
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
const cliRoot = await realpath(cli.root);
|
|
40
|
+
if (cliRoot.split(sep).includes('node_modules'))
|
|
41
|
+
return publishedSpecs(cli);
|
|
42
|
+
const sdkRootRaw = input.sdkRoot ?? resolveSdkPackageRoot();
|
|
43
|
+
if (sdkRootRaw === undefined) {
|
|
44
|
+
return {
|
|
45
|
+
kind: 'error',
|
|
46
|
+
message: 'Cannot resolve @kindgi/sdk from the CLI checkout — run the checkout install first.',
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const sdkRoot = await realpath(sdkRootRaw);
|
|
50
|
+
if (input.forceLocal !== true) {
|
|
51
|
+
const workspace = await findPnpmWorkspaceRoot(cliRoot, exists);
|
|
52
|
+
const target = await realpath(input.targetDir);
|
|
53
|
+
if (workspace !== undefined && isInside(target, workspace)) {
|
|
54
|
+
return { kind: 'ok', specs: { source: 'workspace', sdk: 'workspace:*', cli: 'workspace:*' } };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
const protocol = localLinkProtocol(input.packageManager);
|
|
58
|
+
return {
|
|
59
|
+
kind: 'ok',
|
|
60
|
+
specs: { source: 'local-checkout', sdk: `${protocol}${sdkRoot}`, cli: `${protocol}${cliRoot}` },
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function publishedSpecs(cli) {
|
|
64
|
+
const sdk = cli.sdkDependency;
|
|
65
|
+
if (sdk === undefined || sdk.startsWith('workspace:')) {
|
|
66
|
+
return {
|
|
67
|
+
kind: 'error',
|
|
68
|
+
message: `This @kindgi/cli (${cli.version}) lists @kindgi/sdk as "${sdk ?? '(missing)'}", not a published version — publisher misconfiguration.`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
return { kind: 'ok', specs: { source: 'published', sdk, cli: cli.version } };
|
|
72
|
+
}
|
|
73
|
+
async function findPnpmWorkspaceRoot(from, exists) {
|
|
74
|
+
let dir = from;
|
|
75
|
+
for (;;) {
|
|
76
|
+
if (await exists(join(dir, 'pnpm-workspace.yaml')))
|
|
77
|
+
return dir;
|
|
78
|
+
const parent = dirname(dir);
|
|
79
|
+
if (parent === dir)
|
|
80
|
+
return undefined;
|
|
81
|
+
dir = parent;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function isInside(path, root) {
|
|
85
|
+
const rel = relative(root, path);
|
|
86
|
+
return rel !== '' && !rel.startsWith('..') && !rel.startsWith(sep);
|
|
87
|
+
}
|
|
88
|
+
async function pathExists(path) {
|
|
89
|
+
try {
|
|
90
|
+
await stat(path);
|
|
91
|
+
return true;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* The `kindgi` requirement a published CLI writes: the Python SDK within the
|
|
99
|
+
* CLI's minor (`0.x`) or major (from `1.0`). The Python SDK's minors follow
|
|
100
|
+
* the npm packages'; its patches needn't, so a CLI patch release with no
|
|
101
|
+
* Python release still resolves.
|
|
102
|
+
*/
|
|
103
|
+
export function kindgiRequirement(cliVersion) {
|
|
104
|
+
const match = /^(\d+)\.(\d+)\.\d+/.exec(cliVersion);
|
|
105
|
+
if (match === null)
|
|
106
|
+
return undefined;
|
|
107
|
+
const major = Number(match[1]);
|
|
108
|
+
const minor = Number(match[2]);
|
|
109
|
+
return major === 0
|
|
110
|
+
? `kindgi>=0.${minor},<0.${minor + 1}`
|
|
111
|
+
: `kindgi>=${major}.${minor},<${major + 1}`;
|
|
112
|
+
}
|
|
113
|
+
/** The requirement to write for `source`: the published range, or the bare name a uv source pins. */
|
|
114
|
+
export function kindgiRequirementFor(source) {
|
|
115
|
+
return source.kind === 'published' ? source.requirement : 'kindgi';
|
|
116
|
+
}
|
|
117
|
+
export async function resolveKindgiPythonSource(input = {}) {
|
|
118
|
+
const realpath = input.realpath ?? fsRealpath;
|
|
119
|
+
const exists = input.exists ?? pathExists;
|
|
120
|
+
const cli = input.cli ?? resolveCliPackage();
|
|
121
|
+
if (cli === undefined) {
|
|
122
|
+
return {
|
|
123
|
+
kind: 'error',
|
|
124
|
+
message: 'Cannot locate the @kindgi/cli package.json — broken install.',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
if ((await realpath(cli.root)).split(sep).includes('node_modules')) {
|
|
128
|
+
const requirement = kindgiRequirement(cli.version);
|
|
129
|
+
if (requirement === undefined) {
|
|
130
|
+
return {
|
|
131
|
+
kind: 'error',
|
|
132
|
+
message: `This @kindgi/cli's version (${cli.version}) isn't major.minor.patch — broken install.`,
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return { kind: 'published', requirement };
|
|
136
|
+
}
|
|
137
|
+
const sdkRootRaw = input.sdkRoot ?? resolveSdkPackageRoot();
|
|
138
|
+
if (sdkRootRaw === undefined) {
|
|
139
|
+
return {
|
|
140
|
+
kind: 'error',
|
|
141
|
+
message: 'Cannot resolve @kindgi/sdk from the CLI checkout — run the checkout install first.',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
const python = join(await realpath(sdkRootRaw), '..', '..', 'sdks', 'python');
|
|
145
|
+
if (!(await exists(join(python, 'pyproject.toml')))) {
|
|
146
|
+
return {
|
|
147
|
+
kind: 'error',
|
|
148
|
+
message: `No Python SDK at ${python} — the Kindgi checkout is incomplete.`,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
return { kind: 'local-checkout', path: python };
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=dependency-specs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-specs.js","sourceRoot":"","sources":["../../src/init/dependency-specs.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEzD,OAAO,EAAuB,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAuB,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AA2B1D,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,KAAkC;IAElC,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAQ,IAAI,UAAU,CAAC;IAC9C,MAAM,MAAM,GAAG,KAAK,C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O;YACb,OAAO,EAAE,8DAA8D;SACxE,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC;QACnE,MAAM,WAAW,GAAG,iBAAiB,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACnD,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;YAC9B,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,OAAO,EAAE,+BAA+B,GAAG,CAAC,OAAO,6CAA6C;aACjG,CAAC;QACJ,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC;IAC5C,CAAC;IACD,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,IAAI,qBAAqB,EAAE,CAAC;IAC5D,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,oFAAoF;SAC9F,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9E,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC;QACpD,OAAO;YACL,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,oBAAoB,MAAM,uCAAuC;SAC3E,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface PatchResult {
|
|
2
|
+
/** `absent` — the file doesn't exist and was not created (formatter ignores). */
|
|
3
|
+
readonly kind: 'patched' | 'already-present' | 'absent' | 'error';
|
|
4
|
+
readonly appended: readonly string[];
|
|
5
|
+
readonly message?: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Read the file (or treat as empty if missing), append any of our
|
|
9
|
+
* patterns that aren't already an exact-match line, write back.
|
|
10
|
+
* Returns which lines were appended (empty when already complete).
|
|
11
|
+
*/
|
|
12
|
+
export declare function patchGitignore(gitignorePath: string): Promise<PatchResult>;
|
|
13
|
+
/**
|
|
14
|
+
* Add the Kindgi-managed skills to an existing `.prettierignore`. A
|
|
15
|
+
* project without one is left alone — Kindgi doesn't introduce a
|
|
16
|
+
* formatter config the app never had.
|
|
17
|
+
*/
|
|
18
|
+
export declare function patchPrettierignore(path: string): Promise<PatchResult>;
|
|
19
|
+
/** Append whichever of `patterns` are missing (exact-line match) under the Kindgi marker. */
|
|
20
|
+
export declare function patchIgnoreFile(gitignorePath: string, patterns: readonly string[], options: {
|
|
21
|
+
readonly createIfMissing: boolean;
|
|
22
|
+
}): Promise<PatchResult>;
|
|
23
|
+
//# sourceMappingURL=gitignore-patcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore-patcher.d.ts","sourceRoot":"","sources":["../../src/init/gitignore-patcher.ts"],"names":[],"mappings":"AA0CA,MAAM,WAAW,WAAW;IAC1B,iFAAiF;IACjF,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,iBAAiB,GAAG,QAAQ,GAAG,OAAO,CAAC;IAClE,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAE1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAEtE;AAED,6FAA6F;AAC7F,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,OAAO,EAAE;IAAE,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAAE,GAC7C,OAAO,CAAC,WAAW,CAAC,CAwCtB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* `.gitignore` patcher for augment mode. Appends Kindgi's local-state
|
|
5
|
+
* ignore patterns if absent (the fresh templates' `.gitignore` carries
|
|
6
|
+
* the same three):
|
|
7
|
+
*
|
|
8
|
+
* - `.env.local` — where `kindgi secrets set` writes plaintext
|
|
9
|
+
* secret values in dev mode
|
|
10
|
+
* - `.kindgi/` — build artifacts, the dev index, dev-server state
|
|
11
|
+
* - `.kindgirc.json` — the dev server's API URL + bearer token,
|
|
12
|
+
* written by `kindgi dev` for second-terminal commands
|
|
13
|
+
*
|
|
14
|
+
* Idempotency: line-scan for exact matches only. Broader user
|
|
15
|
+
* patterns (`.env*`, `*.local`) that already cover our lines get
|
|
16
|
+
* appended-alongside — Git handles duplicate patterns fine, and this
|
|
17
|
+
* keeps our detection dumb + predictable.
|
|
18
|
+
*
|
|
19
|
+
* Marker comment groups the additions so they're visible in a diff:
|
|
20
|
+
*
|
|
21
|
+
* # Kindgi
|
|
22
|
+
* .env.local
|
|
23
|
+
* .kindgi/
|
|
24
|
+
* .kindgirc.json
|
|
25
|
+
*/
|
|
26
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
27
|
+
const KINDGI_MARKER = '# Kindgi';
|
|
28
|
+
const KINDGI_PATTERNS = ['.env.local', '.kindgi/', '.kindgirc.json'];
|
|
29
|
+
/**
|
|
30
|
+
* Kindgi-managed files a host formatter must leave alone: `kindgi skills
|
|
31
|
+
* sync` owns their bytes, and a reformatted skill reads as a local edit
|
|
32
|
+
* that blocks every later update. Everything else Kindgi writes
|
|
33
|
+
* (`kindgi.config.*`, `kindgi/**`) is the author's code and is formatted
|
|
34
|
+
* like the rest of the app; `.kindgi/` is already out via `.gitignore`,
|
|
35
|
+
* which Prettier 3 honours.
|
|
36
|
+
*/
|
|
37
|
+
const FORMATTER_IGNORE_PATTERNS = ['.claude/skills/kindgi-*/'];
|
|
38
|
+
/**
|
|
39
|
+
* Read the file (or treat as empty if missing), append any of our
|
|
40
|
+
* patterns that aren't already an exact-match line, write back.
|
|
41
|
+
* Returns which lines were appended (empty when already complete).
|
|
42
|
+
*/
|
|
43
|
+
export function patchGitignore(gitignorePath) {
|
|
44
|
+
return patchIgnoreFile(gitignorePath, KINDGI_PATTERNS, { createIfMissing: true });
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Add the Kindgi-managed skills to an existing `.prettierignore`. A
|
|
48
|
+
* project without one is left alone — Kindgi doesn't introduce a
|
|
49
|
+
* formatter config the app never had.
|
|
50
|
+
*/
|
|
51
|
+
export function patchPrettierignore(path) {
|
|
52
|
+
return patchIgnoreFile(path, FORMATTER_IGNORE_PATTERNS, { createIfMissing: false });
|
|
53
|
+
}
|
|
54
|
+
/** Append whichever of `patterns` are missing (exact-line match) under the Kindgi marker. */
|
|
55
|
+
export async function patchIgnoreFile(gitignorePath, patterns, options) {
|
|
56
|
+
const read = await readIgnoreFile(gitignorePath);
|
|
57
|
+
if (read.kind === 'error')
|
|
58
|
+
return { kind: 'error', appended: [], message: read.message };
|
|
59
|
+
if (read.kind === 'absent' && !options.createIfMissing)
|
|
60
|
+
return { kind: 'absent', appended: [] };
|
|
61
|
+
const raw = read.kind === 'ok' ? read.raw : '';
|
|
62
|
+
const existed = read.kind === 'ok';
|
|
63
|
+
const existingLines = new Set(raw
|
|
64
|
+
.split('\n')
|
|
65
|
+
.map((l) => l.trim())
|
|
66
|
+
.filter((l) => l !== ''));
|
|
67
|
+
const toAppend = [];
|
|
68
|
+
for (const pattern of patterns) {
|
|
69
|
+
if (!existingLines.has(pattern))
|
|
70
|
+
toAppend.push(pattern);
|
|
71
|
+
}
|
|
72
|
+
if (toAppend.length === 0) {
|
|
73
|
+
return { kind: 'already-present', appended: [] };
|
|
74
|
+
}
|
|
75
|
+
// Preserve prior content verbatim; append our block with a marker.
|
|
76
|
+
// Ensure the prior content ends with a newline so our block starts
|
|
77
|
+
// on its own line.
|
|
78
|
+
const prefix = existed ? (raw.endsWith('\n') || raw === '' ? raw : `${raw}\n`) : '';
|
|
79
|
+
const separator = prefix === '' || prefix.endsWith('\n\n') ? '' : '\n';
|
|
80
|
+
const block = `${separator}${KINDGI_MARKER}\n${toAppend.join('\n')}\n`;
|
|
81
|
+
try {
|
|
82
|
+
await writeFile(gitignorePath, `${prefix}${block}`, 'utf8');
|
|
83
|
+
}
|
|
84
|
+
catch (err) {
|
|
85
|
+
return {
|
|
86
|
+
kind: 'error',
|
|
87
|
+
appended: [],
|
|
88
|
+
message: `Failed to write ${gitignorePath}: ${err.message}`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return { kind: 'patched', appended: toAppend };
|
|
92
|
+
}
|
|
93
|
+
async function readIgnoreFile(path) {
|
|
94
|
+
try {
|
|
95
|
+
return { kind: 'ok', raw: await readFile(path, 'utf8') };
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
if (err.code === 'ENOENT')
|
|
99
|
+
return { kind: 'absent' };
|
|
100
|
+
return { kind: 'error', message: `Failed to read ${path}: ${err.message}` };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=gitignore-patcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitignore-patcher.js","sourceRoot":"","sources":["../../src/init/gitignore-patcher.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,E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EAAE,mBAAmB,aAAa,KAAM,GAAa,CAAC,OAAO,EAAE;SACvE,CAAC;IACJ,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AACjD,CAAC;AAED,KAAK,UAAU,cAAc,CAC3B,IAAY;IAMZ,IAAI,CAAC;QACH,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;IAC3D,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;YAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;QAChF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,kBAAkB,IAAI,KAAM,GAAa,CAAC,OAAO,EAAE,EAAE,CAAC;IACzF,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export type InitMode = 'fresh' | 'augment';
|
|
2
|
+
export interface DetectInputs {
|
|
3
|
+
readonly cwd: string;
|
|
4
|
+
readonly positionals: readonly string[];
|
|
5
|
+
/** `--path=<dir>` — target directory. Absolute or cwd-relative. */
|
|
6
|
+
readonly pathFlag?: string;
|
|
7
|
+
/**
|
|
8
|
+
* `--new-repo` — force fresh mode even when a `package.json` sits
|
|
9
|
+
* at the target dir. Rare but real: someone in a monorepo wants to
|
|
10
|
+
* scaffold a standalone pack in a nested subdir.
|
|
11
|
+
*/
|
|
12
|
+
readonly newRepoFlag: boolean;
|
|
13
|
+
/** `--template=<name>` — `python` picks the Python app when both project files exist. */
|
|
14
|
+
readonly templateFlag?: string;
|
|
15
|
+
/** Test injection point. */
|
|
16
|
+
readonly fileExists?: (path: string) => Promise<boolean>;
|
|
17
|
+
}
|
|
18
|
+
export type DetectResult = {
|
|
19
|
+
readonly kind: 'ok';
|
|
20
|
+
readonly mode: 'fresh';
|
|
21
|
+
readonly targetDir: string;
|
|
22
|
+
readonly packName: string;
|
|
23
|
+
} | {
|
|
24
|
+
readonly kind: 'ok';
|
|
25
|
+
readonly mode: 'augment';
|
|
26
|
+
readonly targetDir: string;
|
|
27
|
+
/** The app's language — the pack's. */
|
|
28
|
+
readonly language: 'node' | 'python';
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'err';
|
|
31
|
+
readonly message: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function detectInitMode(inputs: DetectInputs): Promise<DetectResult>;
|
|
34
|
+
//# sourceMappingURL=mode-detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-detect.d.ts","sourceRoot":"","sources":["../../src/init/mode-detect.ts"],"names":[],"mappings":"AAqCA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,WAAW,EAAE,SAAS,MAAM,EAAE,CAAC;IACxC,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,yFAAyF;IACzF,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,4BAA4B;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;CAC1D;AAED,MAAM,MAAM,YAAY,GACpB;IACE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,CAAC;CACtC,GACD;IACE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B,CAAC;AAYN,wBAAsB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,YAAY,CAAC,CA+DhF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
// Copyright (C) 2026 Kindgi Inc.
|
|
3
|
+
/**
|
|
4
|
+
* `kindgi init` mode-detection — routes between two flows:
|
|
5
|
+
*
|
|
6
|
+
* - **fresh** — creates a new pack in a subdirectory, scaffolds the
|
|
7
|
+
* full template (`package.json`, `tsconfig.json`,
|
|
8
|
+
* `pnpm-workspace.yaml`, `agents/`, `tools/`, etc.). The
|
|
9
|
+
* historical `kindgi init <pack-name>` shape.
|
|
10
|
+
* - **augment** — adds Kindgi files alongside an existing project: a
|
|
11
|
+
* Node.js app (`kindgi.config.ts`, `kindgi/**`, `.claude/skills/`, the
|
|
12
|
+
* existing `package.json` patched — "add Kindgi to my Next.js app")
|
|
13
|
+
* or a Python app (`[tool.kindgi]` appended to its `pyproject.toml`,
|
|
14
|
+
* `kindgi/**`, the Python-pack skills).
|
|
15
|
+
*
|
|
16
|
+
* Detection rules (in evaluation order):
|
|
17
|
+
*
|
|
18
|
+
* 1. `--new-repo` explicit: fresh mode (positional pack-name still
|
|
19
|
+
* required). Escape hatch for "I'm in a repo but want a nested
|
|
20
|
+
* standalone pack anyway."
|
|
21
|
+
* 2. Positional pack-name present: fresh mode. Intent signal wins.
|
|
22
|
+
* 3. No positional AND `package.json` at target dir: augment mode, a
|
|
23
|
+
* TypeScript pack — unless `--template=python` and a
|
|
24
|
+
* `pyproject.toml` is there too (an app with both).
|
|
25
|
+
* 4. No positional AND a `pyproject.toml` (no `package.json`): augment
|
|
26
|
+
* mode, a Python pack.
|
|
27
|
+
* 5. Neither: error — caller either wants fresh (needs pack-name) or
|
|
28
|
+
* augment (needs a package.json or pyproject.toml in scope).
|
|
29
|
+
*
|
|
30
|
+
* The result carries the resolved `targetDir` so callers don't
|
|
31
|
+
* re-resolve `--path` themselves; consistent path handling in one
|
|
32
|
+
* place.
|
|
33
|
+
*/
|
|
34
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
35
|
+
const defaultFileExists = async (path) => {
|
|
36
|
+
const { stat } = await import('node:fs/promises');
|
|
37
|
+
try {
|
|
38
|
+
const s = await stat(path);
|
|
39
|
+
return s.isFile();
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
export async function detectInitMode(inputs) {
|
|
46
|
+
const fileExists = inputs.fileExists ?? defaultFileExists;
|
|
47
|
+
const packName = inputs.positionals[0] ?? '';
|
|
48
|
+
// Resolve targetDir:
|
|
49
|
+
// - fresh mode: --path defaults to `<cwd>/<packName>` (or `<cwd>/<lastDot>` for dot-namespaced ids)
|
|
50
|
+
// - augment mode: --path defaults to `<cwd>`
|
|
51
|
+
// For DETECTION we only care about the dir we'll look for `package.json` in.
|
|
52
|
+
// In fresh mode with a positional pack-name we look at the PARENT (cwd) not the target subdir.
|
|
53
|
+
// In augment mode we look at the resolved `--path` or cwd.
|
|
54
|
+
// Case 1: --new-repo forces fresh. Positional required.
|
|
55
|
+
if (inputs.newRepoFlag) {
|
|
56
|
+
if (packName === '') {
|
|
57
|
+
return {
|
|
58
|
+
kind: 'err',
|
|
59
|
+
message: '--new-repo requires a pack-name.\n' +
|
|
60
|
+
'Usage: kindgi init <pack-name> --new-repo [--path=<dir>]\n',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
kind: 'ok',
|
|
65
|
+
mode: 'fresh',
|
|
66
|
+
targetDir: resolveFreshTargetDir(inputs.cwd, inputs.pathFlag, packName),
|
|
67
|
+
packName,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// Case 2: positional pack-name present. Fresh mode (intent signal).
|
|
71
|
+
if (packName !== '') {
|
|
72
|
+
return {
|
|
73
|
+
kind: 'ok',
|
|
74
|
+
mode: 'fresh',
|
|
75
|
+
targetDir: resolveFreshTargetDir(inputs.cwd, inputs.pathFlag, packName),
|
|
76
|
+
packName,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
// No positional — detect based on package.json presence.
|
|
80
|
+
const augmentTargetDir = inputs.pathFlag !== undefined && inputs.pathFlag !== ''
|
|
81
|
+
? isAbsolute(inputs.pathFlag)
|
|
82
|
+
? inputs.pathFlag
|
|
83
|
+
: resolve(inputs.cwd, inputs.pathFlag)
|
|
84
|
+
: inputs.cwd;
|
|
85
|
+
const hasPackageJson = await fileExists(`${augmentTargetDir}/package.json`);
|
|
86
|
+
const hasPyproject = await fileExists(`${augmentTargetDir}/pyproject.toml`);
|
|
87
|
+
// Cases 3 and 4: no positional + a project file → augment, in its language.
|
|
88
|
+
if (hasPyproject && (!hasPackageJson || inputs.templateFlag === 'python')) {
|
|
89
|
+
return { kind: 'ok', mode: 'augment', targetDir: augmentTargetDir, language: 'python' };
|
|
90
|
+
}
|
|
91
|
+
if (hasPackageJson) {
|
|
92
|
+
return { kind: 'ok', mode: 'augment', targetDir: augmentTargetDir, language: 'node' };
|
|
93
|
+
}
|
|
94
|
+
// Case 5: no positional + neither → error.
|
|
95
|
+
return {
|
|
96
|
+
kind: 'err',
|
|
97
|
+
message: `No pack-name provided and no package.json or pyproject.toml at ${augmentTargetDir}.\n - To scaffold a new pack: kindgi init <pack-name> [--template=python]\n - To add Kindgi to existing: run inside a directory with package.json (Node) or pyproject.toml (Python)\n`,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Fresh-mode target dir resolution — matches the historical behavior
|
|
102
|
+
* of `resolveArgs` in `init.ts`. If `--path` is set, use it verbatim
|
|
103
|
+
* (absolute or cwd-relative). Otherwise default to `<cwd>/<dirName>`
|
|
104
|
+
* where dirName strips the namespace prefix of dot-namespaced ids
|
|
105
|
+
* (`acme.legal-basics` → `legal-basics`).
|
|
106
|
+
*/
|
|
107
|
+
function resolveFreshTargetDir(cwd, pathFlag, packName) {
|
|
108
|
+
if (pathFlag !== undefined && pathFlag !== '') {
|
|
109
|
+
return isAbsolute(pathFlag) ? pathFlag : resolve(cwd, pathFlag);
|
|
110
|
+
}
|
|
111
|
+
const dotIdx = packName.lastIndexOf('.');
|
|
112
|
+
const dirName = dotIdx === -1 ? packName : packName.slice(dotIdx + 1);
|
|
113
|
+
return resolve(cwd, dirName);
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=mode-detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mode-detect.js","sourceRoot":"","sources":["../../src/init/mode-detect.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwChD,MAAM,iBAAiB,GAAG,KAAK,EAAE,IAAY,EAAoB,EAAE;IACjE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAClD,IAAI,CAAC;QACH,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,CAAC,MAAM,EAAE,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAoB;IACvD,MAAM,UAAU,GAAG,MAAM,CAAC,UAA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from './dependency-specs.js';
|
|
2
|
+
export declare const KINDGI_SDK_PKG = "@kindgi/sdk";
|
|
3
|
+
export declare const KINDGI_CLI_PKG = "@kindgi/cli";
|
|
4
|
+
/** A package `patchPackageJson` adds when no dependency section declares it. */
|
|
5
|
+
export interface WantedDependency {
|
|
6
|
+
readonly name: string;
|
|
7
|
+
readonly spec: string;
|
|
8
|
+
readonly section: 'dependencies' | 'devDependencies';
|
|
9
|
+
}
|
|
10
|
+
export type PatchResult = {
|
|
11
|
+
readonly kind: 'patched';
|
|
12
|
+
readonly added: readonly string[];
|
|
13
|
+
} | {
|
|
14
|
+
readonly kind: 'already-present';
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'error';
|
|
17
|
+
readonly message: string;
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Read `package.json`, add whichever of `@kindgi/sdk` / `@kindgi/cli`
|
|
21
|
+
* (and `extra`) is missing, write it back preserving format. Never
|
|
22
|
+
* touches the file when all are already declared.
|
|
23
|
+
*/
|
|
24
|
+
export declare function patchPackageJson(pkgJsonPath: string, specs: Pick<KindgiDependencySpecs, 'sdk' | 'cli'>, extra?: readonly WantedDependency[]): Promise<PatchResult>;
|
|
25
|
+
/**
|
|
26
|
+
* Detect the indent width used in a JSON file. Reads until the first
|
|
27
|
+
* indented line (a line starting with whitespace), counts the run.
|
|
28
|
+
* Falls back to 2 spaces if nothing looks indented (single-line JSON).
|
|
29
|
+
*/
|
|
30
|
+
export declare function detectIndent(raw: string): number;
|
|
31
|
+
/**
|
|
32
|
+
* True iff the dep appears in `dependencies`, `devDependencies`,
|
|
33
|
+
* `peerDependencies`, or `optionalDependencies` sections.
|
|
34
|
+
*/
|
|
35
|
+
export declare function isDepPresent(pkg: Record<string, unknown>, name: string): boolean;
|
|
36
|
+
//# sourceMappingURL=package-json-patcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json-patcher.d.ts","sourceRoot":"","sources":["../../src/init/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i a project
|
|
5
|
+
* dependency — `@kindgi/sdk` in `dependencies`, `@kindgi/cli` in
|
|
6
|
+
* `devDependencies`, so the project runs its own pinned `kindgi` —
|
|
7
|
+
* while preserving the rest of the file:
|
|
8
|
+
*
|
|
9
|
+
* - Indent (2-space or 4-space, auto-detected from the first
|
|
10
|
+
* indented key)
|
|
11
|
+
* - Trailing-newline convention (preserved verbatim)
|
|
12
|
+
* - Field order (unrelated fields never reordered)
|
|
13
|
+
*
|
|
14
|
+
* Idempotency: a package already declared in ANY dependency section
|
|
15
|
+
* is left exactly where it is (the user's placement and spec win).
|
|
16
|
+
*
|
|
17
|
+
* Specs come from `resolveKindgiDependencySpecs` (`dependency-specs.ts`)
|
|
18
|
+
* — the same answer fresh mode uses. Never `latest`.
|
|
19
|
+
*/
|
|
20
|
+
import { readFile, writeFile } from 'node:fs/promises';
|
|
21
|
+
export const KINDGI_SDK_PKG = '@kindgi/sdk';
|
|
22
|
+
export const KINDGI_CLI_PKG = '@kindgi/cli';
|
|
23
|
+
/**
|
|
24
|
+
* Read `package.json`, add whichever of `@kindgi/sdk` / `@kindgi/cli`
|
|
25
|
+
* (and `extra`) is missing, write it back preserving format. Never
|
|
26
|
+
* touches the file when all are already declared.
|
|
27
|
+
*/
|
|
28
|
+
export async function patchPackageJson(pkgJsonPath, specs, extra = []) {
|
|
29
|
+
let raw;
|
|
30
|
+
try {
|
|
31
|
+
raw = await readFile(pkgJsonPath, 'utf8');
|
|
32
|
+
}
|
|
33
|
+
catch (err) {
|
|
34
|
+
return { kind: 'error', message: `Failed to read ${pkgJsonPath}: ${err.message}` };
|
|
35
|
+
}
|
|
36
|
+
let parsed;
|
|
37
|
+
try {
|
|
38
|
+
const p = JSON.parse(raw);
|
|
39
|
+
if (p === null || typeof p !== 'object' || Array.isArray(p)) {
|
|
40
|
+
return { kind: 'error', message: `${pkgJsonPath} is not a JSON object.` };
|
|
41
|
+
}
|
|
42
|
+
parsed = p;
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return {
|
|
46
|
+
kind: 'error',
|
|
47
|
+
message: `${pkgJsonPath} is not valid JSON: ${err.message}`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
const wanted = [
|
|
51
|
+
{ name: KINDGI_SDK_PKG, spec: specs.sdk, section: 'dependencies' },
|
|
52
|
+
{ name: KINDGI_CLI_PKG, spec: specs.cli, section: 'devDependencies' },
|
|
53
|
+
...extra,
|
|
54
|
+
];
|
|
55
|
+
const missing = wanted.filter((w) => !isDepPresent(parsed, w.name));
|
|
56
|
+
if (missing.length === 0)
|
|
57
|
+
return { kind: 'already-present' };
|
|
58
|
+
const next = { ...parsed };
|
|
59
|
+
for (const w of missing) {
|
|
60
|
+
const bucket = isRecord(next[w.section])
|
|
61
|
+
? { ...next[w.section] }
|
|
62
|
+
: {};
|
|
63
|
+
bucket[w.name] = w.spec;
|
|
64
|
+
next[w.section] = sortByKey(bucket);
|
|
65
|
+
}
|
|
66
|
+
const emitted = JSON.stringify(next, null, detectIndent(raw)) + (raw.endsWith('\n') ? '\n' : '');
|
|
67
|
+
try {
|
|
68
|
+
await writeFile(pkgJsonPath, emitted, 'utf8');
|
|
69
|
+
}
|
|
70
|
+
catch (err) {
|
|
71
|
+
return { kind: 'error', message: `Failed to write ${pkgJsonPath}: ${err.message}` };
|
|
72
|
+
}
|
|
73
|
+
return { kind: 'patched', added: missing.map((w) => w.name) };
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------
|
|
76
|
+
// Helpers — exported for tests
|
|
77
|
+
// ---------------------------------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Detect the indent width used in a JSON file. Reads until the first
|
|
80
|
+
* indented line (a line starting with whitespace), counts the run.
|
|
81
|
+
* Falls back to 2 spaces if nothing looks indented (single-line JSON).
|
|
82
|
+
*/
|
|
83
|
+
export function detectIndent(raw) {
|
|
84
|
+
const lines = raw.split('\n');
|
|
85
|
+
for (const line of lines) {
|
|
86
|
+
const match = line.match(/^(\s+)/);
|
|
87
|
+
if (match !== null) {
|
|
88
|
+
const ws = match[1] ?? '';
|
|
89
|
+
// Tabs → treat as 4 spaces of JSON.stringify indent (JS's
|
|
90
|
+
// JSON.stringify only accepts number-or-string, so we return a
|
|
91
|
+
// number; tab-indented files get re-emitted with 4-space
|
|
92
|
+
// indent. Acceptable rare-case regression.
|
|
93
|
+
if (ws.includes('\t'))
|
|
94
|
+
return 4;
|
|
95
|
+
return ws.length;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return 2;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* True iff the dep appears in `dependencies`, `devDependencies`,
|
|
102
|
+
* `peerDependencies`, or `optionalDependencies` sections.
|
|
103
|
+
*/
|
|
104
|
+
export function isDepPresent(pkg, name) {
|
|
105
|
+
const sections = [
|
|
106
|
+
'dependencies',
|
|
107
|
+
'devDependencies',
|
|
108
|
+
'peerDependencies',
|
|
109
|
+
'optionalDependencies',
|
|
110
|
+
];
|
|
111
|
+
for (const s of sections) {
|
|
112
|
+
const bucket = pkg[s];
|
|
113
|
+
if (isRecord(bucket) && Object.prototype.hasOwnProperty.call(bucket, name))
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
function isRecord(value) {
|
|
119
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
120
|
+
}
|
|
121
|
+
function sortByKey(obj) {
|
|
122
|
+
const out = {};
|
|
123
|
+
for (const key of Object.keys(obj).sort()) {
|
|
124
|
+
out[key] = obj[key];
|
|
125
|
+
}
|
|
126
|
+
return out;
|
|
127
|
+
}
|
|
128
|
+
//# sourceMappingURL=package-json-patcher.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-json-patcher.js","sourceRoot":"","sources":["../../src/init/package-json-patcher.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,iCAAiC;AAEjC;;;;;;;;;;;;;;;;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