@cbartens/bkit 0.0.0-stage → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.bkit/README.md +421 -0
- package/.bkit/core/.agents/context.md +95 -0
- package/.bkit/core/.agents/docs.md +62 -0
- package/.bkit/core/.agents/rules.md +147 -0
- package/.bkit/core/.agents/skills.md +43 -0
- package/.bkit/core/.bkit/LICENSE.md +151 -0
- package/.bkit/core/.bkit/README.md +421 -0
- package/.bkit/core/.bkit/cloud.md +502 -0
- package/.bkit/core/.bkit/comparison.md +318 -0
- package/.bkit/core/.bkit/install.md +496 -0
- package/.bkit/core/.bkit/jsonl.md +497 -0
- package/.bkit/core/.bkit/prompts.md +474 -0
- package/.bkit/core/.bkit/providers.md +598 -0
- package/.bkit/core/.bkit/templates.md +471 -0
- package/.bkit/core/.bkit/trackers.md +95 -0
- package/.bkit/core/.bkit/workflows.md +1546 -0
- package/.bkit/core/.claude/hooks/bkit-gateguard.cjs +82 -0
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +93 -0
- package/.bkit/core/.claude/hooks/bkit-preflight.sh +74 -0
- package/.bkit/core/.codex/hooks/bkit-gateguard.cjs +115 -0
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +135 -0
- package/.bkit/core/.cursor/hooks/bkit-gateguard.cjs +111 -0
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +169 -0
- package/.bkit/core/.cursor/hooks/bkit-preflight.sh +63 -0
- package/.bkit/core/.opencode/plugin/bkit-gateguard.js +225 -0
- package/.bkit/core/AGENTS.md +77 -0
- package/.bkit/core/LICENSE.md +149 -0
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +272 -0
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +223 -0
- package/.bkit/core/docs/templates/bkit-audit-agents.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +227 -0
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +254 -0
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +241 -0
- package/.bkit/core/docs/templates/bkit-audit-config.md +230 -0
- package/.bkit/core/docs/templates/bkit-audit-cost.md +218 -0
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +221 -0
- package/.bkit/core/docs/templates/bkit-audit-database.md +229 -0
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +251 -0
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +283 -0
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +268 -0
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +280 -0
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +253 -0
- package/.bkit/core/docs/templates/bkit-audit-failures.md +259 -0
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +237 -0
- package/.bkit/core/docs/templates/bkit-audit-gates.md +250 -0
- package/.bkit/core/docs/templates/bkit-audit-issues.md +273 -0
- package/.bkit/core/docs/templates/bkit-audit-llm.md +239 -0
- package/.bkit/core/docs/templates/bkit-audit-logs.md +266 -0
- package/.bkit/core/docs/templates/bkit-audit-models.md +210 -0
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +211 -0
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +216 -0
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +220 -0
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +222 -0
- package/.bkit/core/docs/templates/bkit-audit-repo.md +224 -0
- package/.bkit/core/docs/templates/bkit-audit-security.md +274 -0
- package/.bkit/core/docs/templates/bkit-audit-slop.md +200 -0
- package/.bkit/core/docs/templates/bkit-audit-testing.md +270 -0
- package/.bkit/core/docs/templates/bkit-audit-usability.md +237 -0
- package/.bkit/core/docs/templates/bkit-plan.md +476 -0
- package/.bkit/core/engine/checks/after/auth.ts +247 -0
- package/.bkit/core/engine/checks/after/ci-yml.ts +739 -0
- package/.bkit/core/engine/checks/after/github.ts +424 -0
- package/.bkit/core/engine/checks/after/index.ts +556 -0
- package/.bkit/core/engine/checks/after/managed.ts +217 -0
- package/.bkit/core/engine/checks/after/tools.ts +427 -0
- package/.bkit/core/engine/checks/after/vercel.ts +101 -0
- package/.bkit/core/engine/checks/before/context-fetch.ts +429 -0
- package/.bkit/core/engine/checks/before/env.ts +201 -0
- package/.bkit/core/engine/checks/before/files.ts +202 -0
- package/.bkit/core/engine/checks/before/index.ts +206 -0
- package/.bkit/core/engine/checks/before/mcp.ts +127 -0
- package/.bkit/core/engine/checks/before/repo.ts +77 -0
- package/.bkit/core/engine/checks/before/version.ts +67 -0
- package/.bkit/core/engine/checks/status-holes.ts +479 -0
- package/.bkit/core/engine/cli.ts +871 -0
- package/.bkit/core/engine/commands/analysis.ts +550 -0
- package/.bkit/core/engine/commands/ci/ci.ts +483 -0
- package/.bkit/core/engine/commands/comply.ts +415 -0
- package/.bkit/core/engine/commands/harvest.ts +459 -0
- package/.bkit/core/engine/commands/install/check.ts +70 -0
- package/.bkit/core/engine/commands/install/doctor.ts +247 -0
- package/.bkit/core/engine/commands/install/install.ts +528 -0
- package/.bkit/core/engine/commands/install/uninstall.ts +972 -0
- package/.bkit/core/engine/commands/install/upgrade.ts +1026 -0
- package/.bkit/core/engine/commands/launch.ts +139 -0
- package/.bkit/core/engine/commands/lib.ts +494 -0
- package/.bkit/core/engine/commands/registry.ts +53 -0
- package/.bkit/core/engine/commands/setup/setup.ts +184 -0
- package/.bkit/core/engine/commands/telemetry.ts +32 -0
- package/.bkit/core/engine/commands/workflow/branches.ts +1514 -0
- package/.bkit/core/engine/commands/workflow/context.ts +961 -0
- package/.bkit/core/engine/commands/workflow/counters.ts +268 -0
- package/.bkit/core/engine/commands/workflow/fids.ts +243 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +675 -0
- package/.bkit/core/engine/commands/workflow/ledgers.ts +575 -0
- package/.bkit/core/engine/commands/workflow/locks.ts +478 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +1087 -0
- package/.bkit/core/engine/commands/workflow/repo.ts +220 -0
- package/.bkit/core/engine/commands/workflow/roadmap.ts +576 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +2140 -0
- package/.bkit/core/engine/commands/workflow/runtime.ts +300 -0
- package/.bkit/core/engine/commands/workflow/skills.ts +118 -0
- package/.bkit/core/engine/commands/workflow/status.ts +455 -0
- package/.bkit/core/engine/commands/workflow/steps.ts +1300 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +161 -0
- package/.bkit/core/engine/commands/workflow/workflows.ts +1573 -0
- package/.bkit/core/engine/commands/workflow/workstreams.ts +164 -0
- package/.bkit/core/engine/commands/workflow/worktrees.ts +534 -0
- package/.bkit/core/engine/install/cloud-env.ts +925 -0
- package/.bkit/core/engine/install/managed-block.ts +212 -0
- package/.bkit/core/engine/install/manifest.ts +448 -0
- package/.bkit/core/engine/install/modules/claude.ts +362 -0
- package/.bkit/core/engine/install/modules/cloud.ts +174 -0
- package/.bkit/core/engine/install/modules/codex.ts +219 -0
- package/.bkit/core/engine/install/modules/core.ts +600 -0
- package/.bkit/core/engine/install/modules/cursor.ts +231 -0
- package/.bkit/core/engine/install/modules/index.ts +242 -0
- package/.bkit/core/engine/install/modules/opencode.ts +573 -0
- package/.bkit/core/engine/install/placeholders.ts +108 -0
- package/.bkit/core/engine/install/template-copies.ts +119 -0
- package/.bkit/core/engine/install/version-file.ts +284 -0
- package/.bkit/core/engine/install/write.ts +467 -0
- package/.bkit/core/engine/ledgers/clamp-log.ts +32 -0
- package/.bkit/core/engine/ledgers/status.ts +213 -0
- package/.bkit/core/engine/ledgers/telemetry.ts +1143 -0
- package/.bkit/core/engine/render/hosts.ts +372 -0
- package/.bkit/core/engine/render/models.ts +323 -0
- package/.bkit/core/engine/render/parts.ts +38 -0
- package/.bkit/core/engine/render/trackers.ts +170 -0
- package/.bkit/core/engine/shared/egress.ts +345 -0
- package/.bkit/core/engine/shared/json.ts +16 -0
- package/.bkit/core/engine/shared/log-prefix.ts +9 -0
- package/.bkit/core/engine/shared/package-json.ts +29 -0
- package/.bkit/core/engine/shared/package-manager.ts +38 -0
- package/.bkit/core/engine/shared/package-roots.ts +163 -0
- package/.bkit/core/engine/shared/protected-paths.ts +164 -0
- package/.bkit/core/engine/shared/settings.ts +72 -0
- package/.bkit/core/engine/shared/timeouts.ts +20 -0
- package/.bkit/core/engine/tools/wording.ts +748 -0
- package/.bkit/core/hooks/gateguard-edit-payload.js +18 -0
- package/.bkit/core/hooks/gateguard-engine.js +193 -0
- package/.bkit/core/hooks/guardrails-shell.js +154 -0
- package/.bkit/core/hooks/guardrails-tiers.js +68 -0
- package/.bkit/core/hooks/preflight-linear.sh +73 -0
- package/.bkit/core/prompts/bkit-audit-generate.md +66 -0
- package/.bkit/core/prompts/bkit-build-challenge-1.md +79 -0
- package/.bkit/core/prompts/bkit-build-challenge-2.md +81 -0
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +68 -0
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +70 -0
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +73 -0
- package/.bkit/core/prompts/bkit-build-install-skills.md +67 -0
- package/.bkit/core/prompts/bkit-build-plan-current.md +75 -0
- package/.bkit/core/prompts/bkit-build-plan-execute.md +72 -0
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +73 -0
- package/.bkit/core/prompts/bkit-build-plan-verify.md +88 -0
- package/.bkit/core/prompts/bkit-build-summary.md +93 -0
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +90 -0
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +151 -0
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +73 -0
- package/.bkit/core/prompts/bkit-debug-summary.md +95 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +72 -0
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +75 -0
- package/.bkit/core/prompts/bkit-design-generate.md +110 -0
- package/.bkit/core/prompts/bkit-design-organise.md +85 -0
- package/.bkit/core/prompts/bkit-design-review-1.md +121 -0
- package/.bkit/core/prompts/bkit-design-review-2.md +111 -0
- package/.bkit/core/prompts/bkit-design-spike.md +97 -0
- package/.bkit/core/prompts/bkit-design-summary.md +106 -0
- package/.bkit/core/prompts/bkit-design-update.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +66 -0
- package/.bkit/core/prompts/bkit-plan-complexity-split.md +87 -0
- package/.bkit/core/prompts/bkit-plan-generate.md +74 -0
- package/.bkit/core/prompts/bkit-plan-review-1.md +90 -0
- package/.bkit/core/prompts/bkit-plan-review-2.md +80 -0
- package/.bkit/core/prompts/bkit-plan-review-3.md +92 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +84 -0
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +84 -0
- package/.bkit/core/prompts/bkit-plan-summary.md +106 -0
- package/.bkit/core/prompts/bkit-plan-update.md +68 -0
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +90 -0
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +94 -0
- package/.bkit/core/prompts/bkit-ship-summary.md +77 -0
- package/.bkit/core/prompts/bkit-ship-update-docs.md +71 -0
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +91 -0
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +61 -0
- package/.bkit/core/prompts/bkit-utility-update-failures.md +76 -0
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +75 -0
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +82 -0
- package/.bkit/core/workflows/bkit-auto.md +121 -0
- package/.bkit/core/workflows/bkit-build.md +802 -0
- package/.bkit/core/workflows/bkit-debug.md +642 -0
- package/.bkit/core/workflows/bkit-design.md +495 -0
- package/.bkit/core/workflows/bkit-plan.md +510 -0
- package/.bkit/core/workflows/bkit-ship.md +650 -0
- package/.bkit/shared/.bkit/.env.example +108 -0
- package/.bkit/shared/.claude/bkit-cloud.md +117 -0
- package/.bkit/shared/.claude/settings.json +88 -0
- package/.bkit/shared/.codex/hooks.json +26 -0
- package/.bkit/shared/.cursor/bkit-cloud.md +84 -0
- package/.bkit/shared/.cursor/hooks.json +26 -0
- package/.bkit/shared/.cursor/mcp.json +15 -0
- package/.bkit/shared/.cursor/rules/bkit-rules.mdc +12 -0
- package/.bkit/shared/.gitattributes +37 -0
- package/.bkit/shared/.mcp.json +16 -0
- package/.bkit/shared/.opencode/opencode.json +62 -0
- package/.bkit/shared/CLAUDE.md +11 -0
- package/.bkit/shared/LICENSE.md +22 -0
- package/.bkit/shared/docs/architecture.md +19 -0
- package/.bkit/shared/docs/data-schema.md +19 -0
- package/.bkit/shared/docs/deployments.md +438 -0
- package/.bkit/shared/docs/design.md +39 -0
- package/.bkit/shared/docs/noise.md +19 -0
- package/.bkit/shared/docs/observability.md +25 -0
- package/.bkit/shared/docs/security.md +42 -0
- package/.bkit/shared/docs/setup.md +30 -0
- package/.bkit/shared/docs/technology.md +18 -0
- package/.bkit/shared/docs/testing.md +413 -0
- package/.bkit/shared/gitignore +92 -0
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +192 -0
- package/.bkit/templates/.cursor/Dockerfile +68 -0
- package/.bkit/templates/.cursor/environment.json +6 -0
- package/.bkit/templates/.cursor/settings.json +11 -0
- package/.bkit/templates/.envrc +7 -0
- package/.bkit/templates/.github/dependabot.yml +52 -0
- package/.bkit/templates/.github/renovate.json5 +239 -0
- package/.bkit/templates/.github/workflows/bkit-ci.yml +1082 -0
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +566 -0
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +107 -0
- package/.bkit/templates/.graphifyignore +108 -0
- package/.bkit/templates/.husky/pre-commit +16 -0
- package/.bkit/templates/.husky/pre-push +91 -0
- package/.bkit/templates/.lintstagedrc.json +3 -0
- package/.bkit/templates/.prettierignore +41 -0
- package/.bkit/templates/.serena/project.yml +243 -0
- package/.bkit/templates/.vale/styles/House/Filler.yml +11 -0
- package/.bkit/templates/.vale/styles/House/Hedging.yml +12 -0
- package/.bkit/templates/.vale/styles/House/LLMSlop.yml +13 -0
- package/.bkit/templates/.vale/styles/House/Verbose.yml +12 -0
- package/.bkit/templates/.vale.ini +67 -0
- package/.bkit/templates/LICENSE.md +22 -0
- package/.bkit/templates/context/bkit-cloudrun.md +84 -0
- package/.bkit/templates/context/bkit-expo.md +186 -0
- package/.bkit/templates/context/bkit-github.md +79 -0
- package/.bkit/templates/context/bkit-inngest.md +45 -0
- package/.bkit/templates/context/bkit-maestro.md +76 -0
- package/.bkit/templates/context/bkit-playwright.md +62 -0
- package/.bkit/templates/context/bkit-resend.md +36 -0
- package/.bkit/templates/context/bkit-sentry.md +65 -0
- package/.bkit/templates/context/bkit-serena.md +33 -0
- package/.bkit/templates/context/bkit-stripe.md +36 -0
- package/.bkit/templates/context/bkit-supabase.md +59 -0
- package/.bkit/templates/context/bkit-tavily.md +49 -0
- package/.bkit/templates/context/bkit-vercel.md +64 -0
- package/.bkit/templates/docs/capabilities.md +72 -0
- package/.bkit/templates/scripts/ci/accepted-divergences.json +21 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.mjs +152 -0
- package/.bkit/templates/scripts/ci/check-accepted-divergences.test.mjs +130 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.mjs +98 -0
- package/.bkit/templates/scripts/ci/lanes/resolve-push-base.test.mjs +86 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift-rules.json +23 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-drift.py +208 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager-rules.json +35 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +236 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-external-rules.json +17 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +290 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +19 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +120 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-surface.py +232 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-graphml.py +36 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +927 -0
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +351 -0
- package/.bkit/templates/scripts/launchd/ai.bkit.launchd.plist +26 -0
- package/.bkit/templates/scripts/launchd/bkit-launchd-env.sh +53 -0
- package/.bkit/templates/scripts/launchd/launchd.env.example +13 -0
- package/.bkit/templates/scripts/prettier/bkit-insert-ignore.mjs +275 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.config.mjs +66 -0
- package/.bkit/templates/scripts/secrets/bkit-secrets.mjs +785 -0
- package/.bkit/templates/scripts/serena/bkit-serena-mcp.sh +30 -0
- package/.bkit/templates/scripts/serena/bkit-serena.mcp.json +9 -0
- package/.bkit/templates/scripts/slop/bkit-slop-type-suppression.mjs +286 -0
- package/.bkit/templates/slop-scan.config.json +120 -0
- package/CHANGELOG.md +1486 -0
- package/LICENSE.md +161 -0
- package/README.md +185 -2
- package/dist/checks/after/auth.js +232 -0
- package/dist/checks/after/ci-yml.js +718 -0
- package/dist/checks/after/github.js +400 -0
- package/dist/checks/after/index.js +447 -0
- package/dist/checks/after/managed.js +187 -0
- package/dist/checks/after/tools.js +351 -0
- package/dist/checks/after/vercel.js +102 -0
- package/dist/checks/before/context-fetch.js +426 -0
- package/dist/checks/before/env.js +173 -0
- package/dist/checks/before/files.js +185 -0
- package/dist/checks/before/index.js +162 -0
- package/dist/checks/before/mcp.js +111 -0
- package/dist/checks/before/repo.js +71 -0
- package/dist/checks/before/version.js +60 -0
- package/dist/checks/status-holes.js +393 -0
- package/dist/cli.js +692 -0
- package/dist/commands/analysis.js +325 -0
- package/dist/commands/ci/ci.js +438 -0
- package/dist/commands/comply.js +310 -0
- package/dist/commands/harvest.js +354 -0
- package/dist/commands/install/check.js +61 -0
- package/dist/commands/install/doctor.js +207 -0
- package/dist/commands/install/install.js +461 -0
- package/dist/commands/install/uninstall.js +815 -0
- package/dist/commands/install/upgrade.js +771 -0
- package/dist/commands/launch.js +118 -0
- package/dist/commands/lib.js +362 -0
- package/dist/commands/registry.js +50 -0
- package/dist/commands/setup/setup.js +158 -0
- package/dist/commands/telemetry.js +29 -0
- package/dist/commands/workflow/branches.js +1265 -0
- package/dist/commands/workflow/context.js +846 -0
- package/dist/commands/workflow/counters.js +227 -0
- package/dist/commands/workflow/fids.js +224 -0
- package/dist/commands/workflow/issues.js +585 -0
- package/dist/commands/workflow/ledgers.js +472 -0
- package/dist/commands/workflow/locks.js +364 -0
- package/dist/commands/workflow/prs.js +904 -0
- package/dist/commands/workflow/repo.js +199 -0
- package/dist/commands/workflow/roadmap.js +495 -0
- package/dist/commands/workflow/runs.js +1717 -0
- package/dist/commands/workflow/runtime.js +257 -0
- package/dist/commands/workflow/skills.js +110 -0
- package/dist/commands/workflow/status.js +392 -0
- package/dist/commands/workflow/steps.js +1093 -0
- package/dist/commands/workflow/tests.js +144 -0
- package/dist/commands/workflow/workflows.js +1342 -0
- package/dist/commands/workflow/workstreams.js +141 -0
- package/dist/commands/workflow/worktrees.js +473 -0
- package/dist/install/cloud-env.js +819 -0
- package/dist/install/managed-block.js +182 -0
- package/dist/install/manifest.js +376 -0
- package/dist/install/modules/claude.js +288 -0
- package/dist/install/modules/cloud.js +152 -0
- package/dist/install/modules/codex.js +193 -0
- package/dist/install/modules/core.js +511 -0
- package/dist/install/modules/cursor.js +186 -0
- package/dist/install/modules/index.js +152 -0
- package/dist/install/modules/opencode.js +504 -0
- package/dist/install/placeholders.js +87 -0
- package/dist/install/template-copies.js +106 -0
- package/dist/install/version-file.js +204 -0
- package/dist/install/write.js +342 -0
- package/dist/ledgers/clamp-log.js +27 -0
- package/dist/ledgers/status.js +156 -0
- package/dist/ledgers/telemetry.js +637 -0
- package/dist/render/hosts.js +339 -0
- package/dist/render/models.js +288 -0
- package/dist/render/parts.js +33 -0
- package/dist/render/trackers.js +135 -0
- package/dist/shared/egress.js +299 -0
- package/dist/shared/json.js +16 -0
- package/dist/shared/log-prefix.js +7 -0
- package/dist/shared/package-json.js +22 -0
- package/dist/shared/package-manager.js +32 -0
- package/dist/shared/package-roots.js +145 -0
- package/dist/shared/protected-paths.js +153 -0
- package/dist/shared/settings.js +44 -0
- package/dist/shared/timeouts.js +19 -0
- package/dist/tools/wording.js +680 -0
- package/package.json +101 -4
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
// render/trackers.ts — resolve tracker-specific blocks in workflow and prompt source
|
|
2
|
+
// files at install time. Consumed by install/modules/index.ts when the host-pass mirrors
|
|
3
|
+
// `.bkit/workflows/bkit-*.md` to host commands and `.bkit/prompts/bkit-*.md` to
|
|
4
|
+
// host agents.
|
|
5
|
+
//
|
|
6
|
+
// Inline model (no trackers.md substitution): every tracker call site carries the
|
|
7
|
+
// `github` and `linear` variants inline as a consecutive pair. The installer keeps
|
|
8
|
+
// the block matching the chosen tracker and drops the other. Two boolean
|
|
9
|
+
// conditional dialects gate tracker-agnostic content:
|
|
10
|
+
//
|
|
11
|
+
// <!-- bkit:tracker true start/end --> kept when a tracker IS connected; removed under none
|
|
12
|
+
// <!-- bkit:tracker false start/end --> kept ONLY under none; removed when wired
|
|
13
|
+
//
|
|
14
|
+
// Under `none` a pair collapses to its trailing `false` block if present (the
|
|
15
|
+
// substantive no-tracker behaviour — e.g. `issue-id-extraction`, `fid-format`,
|
|
16
|
+
// `pr-body-marker`), otherwise to one generic skip message. There is no separate
|
|
17
|
+
// `none` marker — no-tracker content is always `false`.
|
|
18
|
+
//
|
|
19
|
+
// See `.bkit/trackers.md` for the marker contract.
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Markers
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
/** Generic message rendered in place of a github/linear pair when no tracker is wired. */
|
|
24
|
+
const NONE_STUB = "_No tracker connected, skip step._";
|
|
25
|
+
/**
|
|
26
|
+
* Marker regex source. An optional `# ` prefix belongs to the marker: inside YAML
|
|
27
|
+
* frontmatter a marker line is written as a YAML comment
|
|
28
|
+
* (` # <!-- bkit:tracker github start -->`) so the raw source stays valid YAML
|
|
29
|
+
* for tools that parse it unresolved (vale). The prefix is consumed with the marker.
|
|
30
|
+
*/
|
|
31
|
+
function marker(name, edge) {
|
|
32
|
+
return `(?:#[ \\t]*)?<!--\\s*bkit:tracker\\s+${name}\\s+${edge}\\s*-->`;
|
|
33
|
+
}
|
|
34
|
+
/** `start` marker, captured body, `end` marker. */
|
|
35
|
+
function block(name) {
|
|
36
|
+
return `${marker(name, "start")}([\\s\\S]*?)${marker(name, "end")}`;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Per-tracker group: a consecutive `github` → `linear` pair, each
|
|
40
|
+
* `<!-- bkit:tracker {name} start -->` … `<!-- bkit:tracker {name} end -->`,
|
|
41
|
+
* with an OPTIONAL trailing `false` block. The whitespace BEFORE the optional
|
|
42
|
+
* `false` block lives INSIDE the optional group (`(?:\s*<false>)?`), so when no
|
|
43
|
+
* `false` follows the pair, the trailing newline + indent are left untouched —
|
|
44
|
+
* otherwise content immediately after the pair would jam onto the kept body. A
|
|
45
|
+
* list-number prefix (`3. `) precedes the first marker and is left untouched, so
|
|
46
|
+
* the kept body / none stub attaches to it cleanly.
|
|
47
|
+
*
|
|
48
|
+
* `none` resolution: if a trailing `false` block is present (substantive
|
|
49
|
+
* no-tracker behaviour — e.g. `issue-id-extraction`, `fid-format`,
|
|
50
|
+
* `pr-body-marker`), use its body; otherwise emit the generic skip message.
|
|
51
|
+
* (Standalone `false` blocks not attached to a pair are handled in pass 2.)
|
|
52
|
+
*/
|
|
53
|
+
const PAIR_RE = new RegExp(block("github") + "\\s*" + block("linear") + "(?:\\s*" + block("false") + ")?", "g");
|
|
54
|
+
/** Conditional-keep block, KEEP form (markers stripped, content trimmed in place). */
|
|
55
|
+
function condKeepRe(name) {
|
|
56
|
+
return new RegExp(block(name), "g");
|
|
57
|
+
}
|
|
58
|
+
/** Conditional-keep block, REMOVE form (consumes the leading newline + indent). */
|
|
59
|
+
function condDropRe(name) {
|
|
60
|
+
return new RegExp(`\\n?[ \\t]*${block(name)}`, "g");
|
|
61
|
+
}
|
|
62
|
+
// Any tracker marker surviving resolution is an orphan (lone github/linear, or
|
|
63
|
+
// unbalanced true/false).
|
|
64
|
+
const ORPHAN_RE = new RegExp(marker("(github|linear|true|false)", "(?:start|end)"), "g");
|
|
65
|
+
/**
|
|
66
|
+
* When keeping in-place content, drop the newline (and its indentation)
|
|
67
|
+
* immediately after `start -->` and immediately before the `end` marker, so the
|
|
68
|
+
* kept content attaches to the pre-marker indentation cleanly instead of gaining
|
|
69
|
+
* a blank line / double indent. Author markers at the same indent as their
|
|
70
|
+
* content for aligned output.
|
|
71
|
+
*/
|
|
72
|
+
function trimKeptContent(s) {
|
|
73
|
+
return s.replace(/^\r?\n[ \t]*/, "").replace(/\r?\n[ \t]*$/, "");
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// Resolution
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Resolve tracker blocks in a workflow source file for the chosen tracker.
|
|
80
|
+
*
|
|
81
|
+
* Pass 1 collapses each github/linear pair to the chosen tracker's body, or — for
|
|
82
|
+
* `none` — to the generic skip message. Pass 2 resolves the `true`/`false`
|
|
83
|
+
* conditional blocks (kept when their condition matches the chosen tracker,
|
|
84
|
+
* removed otherwise) — run AFTER pass 1 so pairs nested inside a kept conditional
|
|
85
|
+
* are resolved first. Mirror output is clean — no markers remain.
|
|
86
|
+
*
|
|
87
|
+
* Always operates on workflow SOURCE (which has markers). Mirror output is
|
|
88
|
+
* regenerated from source each install.
|
|
89
|
+
*/
|
|
90
|
+
export function substituteWorkflow(workflowContent, tracker) {
|
|
91
|
+
const wired = tracker !== "none";
|
|
92
|
+
// Pass 1: github/linear pairs → chosen tracker's body; none → the pair's
|
|
93
|
+
// trailing `false` block if present, else the generic skip message.
|
|
94
|
+
let pairs = 0;
|
|
95
|
+
let output = workflowContent.replace(PAIR_RE, (_match, gh, ln, falseBody) => {
|
|
96
|
+
pairs++;
|
|
97
|
+
if (tracker === "github")
|
|
98
|
+
return trimKeptContent(gh);
|
|
99
|
+
if (tracker === "linear")
|
|
100
|
+
return trimKeptContent(ln);
|
|
101
|
+
return falseBody !== undefined ? trimKeptContent(falseBody) : NONE_STUB;
|
|
102
|
+
});
|
|
103
|
+
// Pass 2: standalone conditional `true`/`false` blocks (any `false` attached to
|
|
104
|
+
// a pair was already consumed in pass 1).
|
|
105
|
+
let conditionals = 0;
|
|
106
|
+
for (const name of ["true", "false"]) {
|
|
107
|
+
const active = name === "true" ? wired : !wired;
|
|
108
|
+
if (active) {
|
|
109
|
+
output = output.replace(condKeepRe(name), (_m, content) => {
|
|
110
|
+
conditionals++;
|
|
111
|
+
return trimKeptContent(content);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
output = output.replace(condDropRe(name), () => {
|
|
116
|
+
conditionals++;
|
|
117
|
+
return "";
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
return { output, pairs, conditionals, orphans: findOrphanMarkers(output) };
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Find tracker markers that didn't participate in a successful resolution — a
|
|
125
|
+
* lone github/linear block (not part of a complete pair) or an unbalanced
|
|
126
|
+
* true/false pair.
|
|
127
|
+
*/
|
|
128
|
+
function findOrphanMarkers(content) {
|
|
129
|
+
const orphans = [];
|
|
130
|
+
ORPHAN_RE.lastIndex = 0;
|
|
131
|
+
let m;
|
|
132
|
+
while ((m = ORPHAN_RE.exec(content)) !== null)
|
|
133
|
+
orphans.push(m[1]);
|
|
134
|
+
return orphans;
|
|
135
|
+
}
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
// Egress registry leaf. Pure data: zero imports, zero control flow. All branching lives
|
|
2
|
+
// in install/cloud-env.ts.
|
|
3
|
+
/**
|
|
4
|
+
* Providers bkit supports for the opencode host. `--opencode=<provider>` accepts
|
|
5
|
+
* ONLY these — anything else is rejected (no generic/arbitrary-endpoint fallback).
|
|
6
|
+
* Keep in sync with OPENCODE_PROVIDER_DEFAULTS (below) and
|
|
7
|
+
* GATEWAY_COLUMN (render/models.ts § Models lookup).
|
|
8
|
+
*/
|
|
9
|
+
export const OPENCODE_PROVIDERS = [
|
|
10
|
+
// OpenAI-compatible npm driver — endpoint + key per provider.
|
|
11
|
+
"openrouter",
|
|
12
|
+
"ollama",
|
|
13
|
+
// opencode-native gateways — two DISTINCT models.dev providers with separate catalogs.
|
|
14
|
+
// CLI: opencode-zen / opencode-go. Agent model pins: opencode/<id> (Zen built-in id) and
|
|
15
|
+
// opencode-go/<id>. Both auth via BKIT_OPENCODE_API_KEY. See providers.md § Models.
|
|
16
|
+
"opencode-zen",
|
|
17
|
+
"opencode-go",
|
|
18
|
+
];
|
|
19
|
+
// Per-provider provider key name + base URL + env var suggestions.
|
|
20
|
+
// These are sane defaults; consumers tune after install.
|
|
21
|
+
// npmPackage: set for custom OpenAI-compatible providers that use npm-based AI SDK driver.
|
|
22
|
+
export const OPENCODE_PROVIDER_DEFAULTS = {
|
|
23
|
+
// Aggregator — one key, every model (incl :free variants). A named, pinned provider
|
|
24
|
+
// (NOT an any-endpoint fallback).
|
|
25
|
+
// opencode custom providers use the npm driver (NOT an "api" field, which is invalid
|
|
26
|
+
// and makes opencode reject the whole config) and read keys via {env:VAR} — never
|
|
27
|
+
// shell ${VAR}. See https://opencode.ai/docs/config + /docs/providers.
|
|
28
|
+
openrouter: {
|
|
29
|
+
envVar: "BKIT_OPENROUTER_API_KEY",
|
|
30
|
+
baseURL: "https://openrouter.ai/api/v1",
|
|
31
|
+
apiPlaceholder: "{env:BKIT_OPENROUTER_API_KEY}",
|
|
32
|
+
npmPackage: "@ai-sdk/openai-compatible",
|
|
33
|
+
displayName: "OpenRouter",
|
|
34
|
+
},
|
|
35
|
+
// Cloud-hosted Ollama (ollama.com). Matches opencode's own naming where built-in
|
|
36
|
+
// `ollama` = the cloud service.
|
|
37
|
+
ollama: {
|
|
38
|
+
envVar: "BKIT_OLLAMA_API_KEY",
|
|
39
|
+
baseURL: "https://ollama.com/v1",
|
|
40
|
+
apiPlaceholder: "{env:BKIT_OLLAMA_API_KEY}",
|
|
41
|
+
npmPackage: "@ai-sdk/openai-compatible",
|
|
42
|
+
displayName: "Ollama",
|
|
43
|
+
},
|
|
44
|
+
// opencode-native gateways — two DISTINCT models.dev providers, both auth'd via
|
|
45
|
+
// BKIT_OPENCODE_API_KEY. Built-in (apiKey only): OpenCode resolves endpoints + per-model SDK
|
|
46
|
+
// from models.dev. CLI keys are opencode-zen / opencode-go; Zen's models.dev id is
|
|
47
|
+
// `opencode` (agent pins opencode/<id>), Go's id is `opencode-go` (opencode-go/<id>).
|
|
48
|
+
"opencode-zen": {
|
|
49
|
+
envVar: "BKIT_OPENCODE_API_KEY",
|
|
50
|
+
baseURL: "",
|
|
51
|
+
apiPlaceholder: "{env:BKIT_OPENCODE_API_KEY}",
|
|
52
|
+
builtin: true,
|
|
53
|
+
providerId: "opencode",
|
|
54
|
+
displayName: "OpenCode Zen",
|
|
55
|
+
},
|
|
56
|
+
"opencode-go": {
|
|
57
|
+
envVar: "BKIT_OPENCODE_API_KEY",
|
|
58
|
+
baseURL: "",
|
|
59
|
+
apiPlaceholder: "{env:BKIT_OPENCODE_API_KEY}",
|
|
60
|
+
builtin: true,
|
|
61
|
+
providerId: "opencode-go",
|
|
62
|
+
displayName: "OpenCode Go",
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* The shipped egress sources. `hosts` and `bases` are literal arrays: the leaf parses
|
|
67
|
+
* no URL. For `opencode-provider` rows the literals are gate-checked against the
|
|
68
|
+
* provider baseURL by the suffix-invariant test.
|
|
69
|
+
*
|
|
70
|
+
* Not listed:
|
|
71
|
+
* - Dependency-updater hosts (Renovate, Dependabot): egress on the updater's runner,
|
|
72
|
+
* never inside an agent session.
|
|
73
|
+
* - The literal "none" member of `ISSUE_TRACKERS`: a sentinel. The completeness test
|
|
74
|
+
* skips exactly "none" and asserts it was the only skip.
|
|
75
|
+
* - `json.schemastore.org`: fetched by the editor JSON language server, never by an
|
|
76
|
+
* agent tool call.
|
|
77
|
+
* - `kimi.com`: outside the four-provider opencode allowlist
|
|
78
|
+
* (`opencode-provider-allowlist-cut-to-four`).
|
|
79
|
+
*/
|
|
80
|
+
export const BKIT_EGRESS_SOURCES = [
|
|
81
|
+
{
|
|
82
|
+
id: "openrouter",
|
|
83
|
+
kind: "opencode-provider",
|
|
84
|
+
hosts: ["openrouter.ai"],
|
|
85
|
+
bases: ["openrouter.ai"],
|
|
86
|
+
},
|
|
87
|
+
{ id: "ollama", kind: "opencode-provider", hosts: ["ollama.com"], bases: ["ollama.com"] },
|
|
88
|
+
{
|
|
89
|
+
id: "opencode-zen",
|
|
90
|
+
kind: "opencode-provider",
|
|
91
|
+
hosts: ["opencode.ai", "models.dev"],
|
|
92
|
+
bases: ["opencode.ai", "models.dev"],
|
|
93
|
+
reason: "baseURL is empty (builtin); endpoints resolved via models.dev",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "opencode-go",
|
|
97
|
+
kind: "opencode-provider",
|
|
98
|
+
hosts: ["opencode.ai", "models.dev"],
|
|
99
|
+
bases: ["opencode.ai", "models.dev"],
|
|
100
|
+
reason: "baseURL is empty (builtin); a distinct registry key, so a distinct row",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: "mcp-github",
|
|
104
|
+
kind: "tracker-mcp",
|
|
105
|
+
hosts: ["api.githubcopilot.com"],
|
|
106
|
+
bases: ["githubcopilot.com"],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
id: "mcp-linear",
|
|
110
|
+
kind: "tracker-mcp",
|
|
111
|
+
hosts: ["mcp.linear.app", "api.linear.app"],
|
|
112
|
+
bases: ["linear.app"],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: "agent-claude",
|
|
116
|
+
kind: "agent-host",
|
|
117
|
+
hosts: ["console.anthropic.com"],
|
|
118
|
+
bases: ["anthropic.com", "claude.com"],
|
|
119
|
+
},
|
|
120
|
+
{ id: "agent-cursor", kind: "agent-host", hosts: ["api.cursor.com"], bases: ["cursor.com"] },
|
|
121
|
+
{ id: "agent-opencode", kind: "agent-host", hosts: ["opencode.ai"], bases: ["opencode.ai"] },
|
|
122
|
+
{
|
|
123
|
+
id: "pkg-npm",
|
|
124
|
+
kind: "package-registry",
|
|
125
|
+
hosts: ["registry.npmjs.org"],
|
|
126
|
+
bases: ["npmjs.com", "npmjs.org"],
|
|
127
|
+
reason: "the registry API host sits on a sibling TLD its .com base cannot cover on a label boundary",
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
id: "pkg-github",
|
|
131
|
+
kind: "package-registry",
|
|
132
|
+
hosts: ["npm.pkg.github.com", "raw.githubusercontent.com"],
|
|
133
|
+
bases: ["github.com", "githubusercontent.com"],
|
|
134
|
+
},
|
|
135
|
+
{ id: "skills-sh", kind: "skills", hosts: ["skills.sh"], bases: ["skills.sh"] },
|
|
136
|
+
{ id: "tooling-tavily", kind: "tooling-api", hosts: ["api.tavily.com"], bases: ["tavily.com"] },
|
|
137
|
+
// Audit anchor standards. Every consumer gets the `docs/templates/bkit-audit-*.md` set,
|
|
138
|
+
// and each template's Standards step reads its anchors over WebFetch. Only standards
|
|
139
|
+
// bodies, specs and model makers' prompting guides belong here: a vendor or platform a
|
|
140
|
+
// template names as an example (Sentry, Supabase, Apple, Google Play, web.dev) is
|
|
141
|
+
// stack-specific, so a consumer that uses it declares it in its own block.
|
|
142
|
+
{
|
|
143
|
+
id: "audit-security-ai",
|
|
144
|
+
kind: "audit-standard",
|
|
145
|
+
hosts: [
|
|
146
|
+
"owasp.org",
|
|
147
|
+
"genai.owasp.org",
|
|
148
|
+
"mas.owasp.org",
|
|
149
|
+
"atlas.mitre.org",
|
|
150
|
+
"www.nist.gov",
|
|
151
|
+
"airc.nist.gov",
|
|
152
|
+
"nvlpubs.nist.gov",
|
|
153
|
+
"openssf.org",
|
|
154
|
+
"best.openssf.org",
|
|
155
|
+
"baseline.openssf.org",
|
|
156
|
+
"slsa.dev",
|
|
157
|
+
"modelcontextprotocol.io",
|
|
158
|
+
],
|
|
159
|
+
bases: [
|
|
160
|
+
"owasp.org",
|
|
161
|
+
"mitre.org",
|
|
162
|
+
"nist.gov",
|
|
163
|
+
"openssf.org",
|
|
164
|
+
"slsa.dev",
|
|
165
|
+
"modelcontextprotocol.io",
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "audit-prompting-guides",
|
|
170
|
+
kind: "audit-standard",
|
|
171
|
+
hosts: [
|
|
172
|
+
"docs.claude.com",
|
|
173
|
+
"platform.claude.com",
|
|
174
|
+
"www.anthropic.com",
|
|
175
|
+
"platform.openai.com",
|
|
176
|
+
"cookbook.openai.com",
|
|
177
|
+
"developers.openai.com",
|
|
178
|
+
"ai.google.dev",
|
|
179
|
+
],
|
|
180
|
+
bases: ["claude.com", "anthropic.com", "openai.com", "google.dev"],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
id: "audit-law-and-specs",
|
|
184
|
+
kind: "audit-standard",
|
|
185
|
+
hosts: [
|
|
186
|
+
"www.w3.org",
|
|
187
|
+
"www.iso.org",
|
|
188
|
+
"www.etsi.org",
|
|
189
|
+
"eur-lex.europa.eu",
|
|
190
|
+
"digital-strategy.ec.europa.eu",
|
|
191
|
+
"ec.europa.eu",
|
|
192
|
+
"www.edpb.europa.eu",
|
|
193
|
+
"ico.org.uk",
|
|
194
|
+
"www.rfc-editor.org",
|
|
195
|
+
"datatracker.ietf.org",
|
|
196
|
+
"cabforum.org",
|
|
197
|
+
"schema.org",
|
|
198
|
+
"spdx.org",
|
|
199
|
+
"opentelemetry.io",
|
|
200
|
+
],
|
|
201
|
+
bases: [
|
|
202
|
+
"w3.org",
|
|
203
|
+
"iso.org",
|
|
204
|
+
"etsi.org",
|
|
205
|
+
"europa.eu",
|
|
206
|
+
"ico.org.uk",
|
|
207
|
+
"rfc-editor.org",
|
|
208
|
+
"ietf.org",
|
|
209
|
+
"cabforum.org",
|
|
210
|
+
"schema.org",
|
|
211
|
+
"spdx.org",
|
|
212
|
+
"opentelemetry.io",
|
|
213
|
+
],
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
id: "audit-engineering-practice",
|
|
217
|
+
kind: "audit-standard",
|
|
218
|
+
hosts: [
|
|
219
|
+
"sre.google",
|
|
220
|
+
"dora.dev",
|
|
221
|
+
"12factor.net",
|
|
222
|
+
"www.finops.org",
|
|
223
|
+
"focus.finops.org",
|
|
224
|
+
"c4model.com",
|
|
225
|
+
"diataxis.fr",
|
|
226
|
+
"www.nngroup.com",
|
|
227
|
+
"scrumguides.org",
|
|
228
|
+
"kanbanguides.org",
|
|
229
|
+
"endoflife.date",
|
|
230
|
+
"bugzilla.mozilla.org",
|
|
231
|
+
"wiki.mozilla.org",
|
|
232
|
+
],
|
|
233
|
+
bases: [
|
|
234
|
+
"sre.google",
|
|
235
|
+
"dora.dev",
|
|
236
|
+
"12factor.net",
|
|
237
|
+
"finops.org",
|
|
238
|
+
"c4model.com",
|
|
239
|
+
"diataxis.fr",
|
|
240
|
+
"nngroup.com",
|
|
241
|
+
"scrumguides.org",
|
|
242
|
+
"kanbanguides.org",
|
|
243
|
+
"endoflife.date",
|
|
244
|
+
"mozilla.org",
|
|
245
|
+
],
|
|
246
|
+
},
|
|
247
|
+
];
|
|
248
|
+
/**
|
|
249
|
+
* Public-suffix shortlist. A naive last-two-labels collapse turns `app.example.co.uk`
|
|
250
|
+
* into `co.uk`, allowing an entire national namespace, so a host whose final two labels
|
|
251
|
+
* match one of these takes three labels instead.
|
|
252
|
+
*/
|
|
253
|
+
export const MULTI_LABEL_SUFFIXES = [
|
|
254
|
+
"co.uk",
|
|
255
|
+
"org.uk",
|
|
256
|
+
"ac.uk",
|
|
257
|
+
"gov.uk",
|
|
258
|
+
"co.jp",
|
|
259
|
+
"or.jp",
|
|
260
|
+
"ne.jp",
|
|
261
|
+
"com.au",
|
|
262
|
+
"net.au",
|
|
263
|
+
"org.au",
|
|
264
|
+
"com.br",
|
|
265
|
+
"com.cn",
|
|
266
|
+
"net.cn",
|
|
267
|
+
"org.cn",
|
|
268
|
+
"com.mx",
|
|
269
|
+
"com.tr",
|
|
270
|
+
"co.nz",
|
|
271
|
+
"co.za",
|
|
272
|
+
"co.in",
|
|
273
|
+
"com.sg",
|
|
274
|
+
"com.hk",
|
|
275
|
+
];
|
|
276
|
+
/**
|
|
277
|
+
* Shared-tenant apexes: a base collapse to one of these grants every tenant on the
|
|
278
|
+
* platform. The gate is a DENY, never a rewriter; an apex absent from this list passes.
|
|
279
|
+
*/
|
|
280
|
+
export const MULTI_TENANT_APEXES = [
|
|
281
|
+
"amazonaws.com",
|
|
282
|
+
"googleapis.com",
|
|
283
|
+
"azure.com",
|
|
284
|
+
"azurewebsites.net",
|
|
285
|
+
"cloudfront.net",
|
|
286
|
+
"workers.dev",
|
|
287
|
+
"vercel.app",
|
|
288
|
+
"netlify.app",
|
|
289
|
+
"pages.dev",
|
|
290
|
+
"hf.space",
|
|
291
|
+
"run.app",
|
|
292
|
+
"appspot.com",
|
|
293
|
+
"herokuapp.com",
|
|
294
|
+
"fly.dev",
|
|
295
|
+
"onrender.com",
|
|
296
|
+
"supabase.co",
|
|
297
|
+
"github.io",
|
|
298
|
+
"gitlab.io",
|
|
299
|
+
];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// shared/json.ts — `JSON.parse` without the throw, for consumer-authored input.
|
|
2
|
+
//
|
|
3
|
+
// Every read of a file bkit does not own (package.json, .mcp.json, settings JSON,
|
|
4
|
+
// .bkit/version) must fail open into a result the caller reports in its own terms,
|
|
5
|
+
// never abort install, upgrade or `bkit check`. One shape, one catch — so the
|
|
6
|
+
// defensive-slop gate reads a single documented fallback instead of one per caller.
|
|
7
|
+
/** `JSON.parse(raw)` as a result: `{ ok: true, value }`, or `{ ok: false }` when not JSON. */
|
|
8
|
+
export function parseJson(raw) {
|
|
9
|
+
try {
|
|
10
|
+
return { ok: true, value: JSON.parse(raw) };
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// Not JSON: the result says so, and the caller reports it in its own terms.
|
|
14
|
+
return { ok: false };
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// shared/log-prefix.ts — the log prefix every install-side message carries.
|
|
2
|
+
// The running verb sets it (setLogPrefix: "[bkit-check]" for `bkit check`, …) so log
|
|
3
|
+
// scanners can tell which verb actually ran.
|
|
4
|
+
export let LOG_PREFIX = "[bkit-install]";
|
|
5
|
+
export function setLogPrefix(prefix) {
|
|
6
|
+
LOG_PREFIX = prefix;
|
|
7
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// shared/package-json.ts — read a checkout's `package.json`, saying why when it cannot.
|
|
2
|
+
//
|
|
3
|
+
// Commands that look up a script or a `bkit` setting need to tell "no file" and
|
|
4
|
+
// "file is not JSON" apart from "key absent", so a broken manifest is named in the
|
|
5
|
+
// message instead of reading as an empty one.
|
|
6
|
+
import * as fs from "node:fs";
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import { parseJson } from "./json.js";
|
|
9
|
+
/** `dir/package.json` as an object, or why it could not be read as one. */
|
|
10
|
+
export function readPackageJson(dir) {
|
|
11
|
+
const file = path.join(dir, "package.json");
|
|
12
|
+
if (!fs.existsSync(file))
|
|
13
|
+
return { ok: false, reason: "missing" };
|
|
14
|
+
const parsed = parseJson(fs.readFileSync(file, "utf-8"));
|
|
15
|
+
if (!parsed.ok ||
|
|
16
|
+
typeof parsed.value !== "object" ||
|
|
17
|
+
parsed.value === null ||
|
|
18
|
+
Array.isArray(parsed.value)) {
|
|
19
|
+
return { ok: false, reason: "unparseable" };
|
|
20
|
+
}
|
|
21
|
+
return { ok: true, pkg: parsed.value };
|
|
22
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// shared/package-manager.ts — the one place that names the package manager.
|
|
2
|
+
//
|
|
3
|
+
// bkit installs and upgrades itself with pnpm, so a consumer repo is a pnpm repo.
|
|
4
|
+
// Every command that runs a package script or an install builds the command here,
|
|
5
|
+
// so changing that decision is a change to this file only.
|
|
6
|
+
/** The package manager that runs `package.json` scripts and installs. */
|
|
7
|
+
export const PACKAGE_RUNNER = "pnpm";
|
|
8
|
+
/** argv for running one `package.json` script, e.g. `bkit:gate:static-unit`. */
|
|
9
|
+
export const scriptCommand = (script) => [PACKAGE_RUNNER, script];
|
|
10
|
+
/** argv for installing dependencies; `frozen` refuses to change the lockfile. */
|
|
11
|
+
export const installCommand = (opts) => opts.frozen ? [PACKAGE_RUNNER, "install", "--frozen-lockfile"] : [PACKAGE_RUNNER, "install"];
|
|
12
|
+
/**
|
|
13
|
+
* argv that regenerates a lockfile from its manifest, keyed by lockfile name.
|
|
14
|
+
* Covers lockfiles from other ecosystems too: a rebase conflict in `Cargo.lock` is
|
|
15
|
+
* resolved the same way as one in
|
|
16
|
+
* `pnpm-lock.yaml`. A lockfile with no entry is left for a human.
|
|
17
|
+
*/
|
|
18
|
+
export const LOCKFILE_REGENERATE = {
|
|
19
|
+
"pnpm-lock.yaml": [PACKAGE_RUNNER, "install", "--lockfile-only"],
|
|
20
|
+
"package-lock.json": ["npm", "install", "--package-lock-only"],
|
|
21
|
+
"yarn.lock": ["yarn", "install", "--mode=update-lockfile"],
|
|
22
|
+
"bun.lock": ["bun", "install", "--lockfile-only"],
|
|
23
|
+
"Cargo.lock": ["cargo", "generate-lockfile"],
|
|
24
|
+
"go.sum": ["go", "mod", "tidy"],
|
|
25
|
+
"uv.lock": ["uv", "lock"],
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Exit codes a shell gives when the command itself could not run: 126 = found but
|
|
29
|
+
* not executable, 127 = not found. A gate that exits with one of these never ran,
|
|
30
|
+
* so it must not be recorded as a failing test.
|
|
31
|
+
*/
|
|
32
|
+
export const COULD_NOT_RUN_EXIT_CODES = new Set([126, 127]);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
// shared/package-roots.ts — resolves the bkit package root and the roots under it
|
|
2
|
+
// (core, shared, templates) from wherever the engine runs.
|
|
3
|
+
// Imports allowed: node:path, node:url, node:fs only.
|
|
4
|
+
import * as fs from "node:fs";
|
|
5
|
+
import * as path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// ENGINE_SUBPATH — the package-relative sub-path that contains bkit's engine
|
|
9
|
+
// source files. All three run-contexts derive their suffix check from this
|
|
10
|
+
// constant so a single edit flips every resolver.
|
|
11
|
+
// ---------------------------------------------------------------------------
|
|
12
|
+
export const ENGINE_SUBPATH = path.join(".bkit", "core", "engine");
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// getPkgRoot — resolve the bkit package root at runtime
|
|
15
|
+
//
|
|
16
|
+
// This file sits in the engine's `shared/` folder, so engineDir is its parent.
|
|
17
|
+
// Three run-contexts (walk-up strategy):
|
|
18
|
+
//
|
|
19
|
+
// 1. dist/ (compiled, consumers run this):
|
|
20
|
+
// engineDir = <pkgRoot>/dist
|
|
21
|
+
// → pkgRoot = engineDir/..
|
|
22
|
+
//
|
|
23
|
+
// 2. tsx-from-source (bkit repo dev / integration tests):
|
|
24
|
+
// engineDir = <pkgRoot>/.bkit/core/engine
|
|
25
|
+
// → pkgRoot = engineDir/../../..
|
|
26
|
+
//
|
|
27
|
+
// 3. packed-tarball install (node_modules layout):
|
|
28
|
+
// engineDir = <consumerRoot>/node_modules/@cbartens/bkit/dist
|
|
29
|
+
// → pkgRoot = engineDir/.. (same as arm 1 — dist/ arm covers both)
|
|
30
|
+
//
|
|
31
|
+
// Arms 1 and 3 are identical (both resolve via the dist/ suffix check); the
|
|
32
|
+
// distinction matters only when asserting getPkgRoot() under each context in
|
|
33
|
+
// the shared/package-roots.test.ts unit test.
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
export function getPkgRoot() {
|
|
36
|
+
const engineDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
37
|
+
return engineDir.endsWith(ENGINE_SUBPATH)
|
|
38
|
+
? path.resolve(engineDir, "..", "..", "..")
|
|
39
|
+
: path.resolve(engineDir, "..");
|
|
40
|
+
}
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
// The three payload roots. Each folder carries one licence and one install
|
|
43
|
+
// behaviour; a file's path inside its folder is where it lands in the consumer
|
|
44
|
+
// repo.
|
|
45
|
+
//
|
|
46
|
+
// core/ PolyForm. Written and kept current. engine/, workflows/,
|
|
47
|
+
// prompts/, .bkit/, hooks/ and every LICENSE.md are skipped
|
|
48
|
+
// by install; the rest is copied at its folder-relative path.
|
|
49
|
+
// shared/ MIT-0. Written and kept current: bkit's blocks and keys inside
|
|
50
|
+
// files the consumer also edits, plus small whole files.
|
|
51
|
+
// templates/ MIT-0. Copy-and-own only: never applied to the repo, copied raw
|
|
52
|
+
// into the consumer's `.bkit/templates/` by syncTemplateCopies.
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
export function getCoreRoot() {
|
|
55
|
+
return path.join(getPkgRoot(), ".bkit", "core");
|
|
56
|
+
}
|
|
57
|
+
export function getSharedRoot() {
|
|
58
|
+
return path.join(getPkgRoot(), ".bkit", "shared");
|
|
59
|
+
}
|
|
60
|
+
// ---------------------------------------------------------------------------
|
|
61
|
+
// getTemplatesRoot — the copy-and-own templates root.
|
|
62
|
+
//
|
|
63
|
+
// The consumer keeps its copies of the template set at the same relative path,
|
|
64
|
+
// TEMPLATE_COPIES_DIR (install/template-copies.ts syncTemplateCopies). In
|
|
65
|
+
// dogfood the two are the same folder.
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
export const TEMPLATE_COPIES_DIR = path.join(".bkit", "templates");
|
|
68
|
+
export function getTemplatesRoot() {
|
|
69
|
+
return path.join(getPkgRoot(), TEMPLATE_COPIES_DIR);
|
|
70
|
+
}
|
|
71
|
+
// npm hard-excludes files literally named `.gitignore` and `.npmignore` from
|
|
72
|
+
// packed tarballs (by basename, anywhere in the tree), regardless of the `files`
|
|
73
|
+
// field. Those — and ONLY those — are stored without the leading dot in
|
|
74
|
+
// `.bkit/shared/` and remapped to their dotted dest at install/upgrade time.
|
|
75
|
+
//
|
|
76
|
+
// Any OTHER dotfile (`.gitattributes`, `.prettierignore`, `.mcp.json`, …) packs
|
|
77
|
+
// fine with its dot, so it is stored dotted in the payload tree and needs NO
|
|
78
|
+
// remap. Do not add such names here — store the file with its real name.
|
|
79
|
+
//
|
|
80
|
+
// Source basename → dest basename. The single source of truth for the dotfile
|
|
81
|
+
// remap: remapTemplateDest (install/template-copies.ts) reads it forward,
|
|
82
|
+
// templateRelPath below reads it backward.
|
|
83
|
+
export const NPM_STRIP_REMAP = {
|
|
84
|
+
gitignore: ".gitignore",
|
|
85
|
+
npmignore: ".npmignore",
|
|
86
|
+
};
|
|
87
|
+
/** The payload path, relative to its root, a consumer-relative dest is written from. */
|
|
88
|
+
export function templateRelPath(dest) {
|
|
89
|
+
const base = path.basename(dest);
|
|
90
|
+
const src = Object.keys(NPM_STRIP_REMAP).find((k) => NPM_STRIP_REMAP[k] === base);
|
|
91
|
+
if (src === undefined)
|
|
92
|
+
return dest;
|
|
93
|
+
const dir = path.dirname(dest);
|
|
94
|
+
return dir === "." ? src : path.join(dir, src);
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The absolute source path backing a consumer-relative dest, or `null` when no
|
|
98
|
+
* payload root carries it. Checks `shared/` then `core/`, applying the dotfile
|
|
99
|
+
* remap. Root-level `LICENSE.md` files are never install sources.
|
|
100
|
+
*/
|
|
101
|
+
export function findTemplateSource(relPath) {
|
|
102
|
+
if (path.basename(relPath) === "LICENSE.md")
|
|
103
|
+
return null;
|
|
104
|
+
const rel = templateRelPath(relPath);
|
|
105
|
+
for (const root of [getSharedRoot(), getCoreRoot()]) {
|
|
106
|
+
const p = path.join(root, rel);
|
|
107
|
+
if (fs.existsSync(p))
|
|
108
|
+
return p;
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
// Mirror-source roots. `core/workflows` and `core/prompts` are the canonical
|
|
114
|
+
// SOURCE for the `.claude/*` and `.cursor/*` mirrors. They live only in the bkit
|
|
115
|
+
// package — never copied into a consumer — so the install engine resolves them
|
|
116
|
+
// package-relative (via getPkgRoot()), not from the consumer's cwd. In dogfood
|
|
117
|
+
// (getPkgRoot() === cwd) these resolve to the in-repo source, so mirror
|
|
118
|
+
// regeneration works unchanged.
|
|
119
|
+
// ---------------------------------------------------------------------------
|
|
120
|
+
export function getWorkflowsRoot() {
|
|
121
|
+
return path.join(getCoreRoot(), "workflows");
|
|
122
|
+
}
|
|
123
|
+
export function getPromptsRoot() {
|
|
124
|
+
return path.join(getCoreRoot(), "prompts");
|
|
125
|
+
}
|
|
126
|
+
// `core/.bkit/` holds bkit-authoring reference docs (e.g. prompts.md's Cursor
|
|
127
|
+
// model-lookup table). This is the runtime read root (package-side). The
|
|
128
|
+
// reference docs are ALSO force-overwritten into the consumer's own `.bkit/` on
|
|
129
|
+
// install — a readable mirror — by runBkitDocs (install/modules/core.ts).
|
|
130
|
+
// Shared hook code spliced into each host's hook template at render time
|
|
131
|
+
// (render/parts.ts). Package-only: never copied into a consumer.
|
|
132
|
+
export function getHooksRoot() {
|
|
133
|
+
return path.join(getPkgRoot(), ".bkit", "core", "hooks");
|
|
134
|
+
}
|
|
135
|
+
export function getBkitDocsRoot() {
|
|
136
|
+
return path.join(getCoreRoot(), ".bkit");
|
|
137
|
+
}
|
|
138
|
+
// ---------------------------------------------------------------------------
|
|
139
|
+
// isDogfood — true when bkit is running inside its own repo (in-repo install).
|
|
140
|
+
// In this case the source tree IS the consumer's .agents/ directory, so any
|
|
141
|
+
// payload copy would overwrite the source with itself.
|
|
142
|
+
// ---------------------------------------------------------------------------
|
|
143
|
+
export function isDogfood() {
|
|
144
|
+
return getPkgRoot() === process.cwd();
|
|
145
|
+
}
|