@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,351 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Example. Copy into the repo and own it.
|
|
3
|
+
# bkit install does not write this file and does not overwrite a copy.
|
|
4
|
+
# Adapt app roots, the workspace package scope, and the rules JSON to this repo.
|
|
5
|
+
# Code graph (graphify) — always local, never an LLM call. See .bkit/templates.md.
|
|
6
|
+
#
|
|
7
|
+
# graphify has no persistent "no LLM" setting (.graphifyrc accepts only
|
|
8
|
+
# viz_node_limit; there is no GRAPHIFY_CODE_ONLY env var), so LLM-off is set per
|
|
9
|
+
# invocation here.
|
|
10
|
+
#
|
|
11
|
+
# Two independent guards:
|
|
12
|
+
# 1. --code-only / --no-label — the two flags that reach a model at all
|
|
13
|
+
# (docs/PDFs/images on extract, community naming on cluster).
|
|
14
|
+
# 2. Unsetting every key graphify auto-detects a backend from, so a key in
|
|
15
|
+
# the caller's shell cannot silently pick one anyway.
|
|
16
|
+
set -euo pipefail
|
|
17
|
+
|
|
18
|
+
# Output directory. graphify defaults to graphify-out/ at the repo root; this
|
|
19
|
+
# wrapper puts it under docs/.
|
|
20
|
+
# GRAPHIFY_OUT (graphify/paths.py:26) is the supported override and takes a
|
|
21
|
+
# relative path, not just a name. Every command honours it — extract,
|
|
22
|
+
# cluster-only, update, tree AND the read commands, because their `--graph`
|
|
23
|
+
# default is paths.default_graph_json(). .envrc exports the same value so a
|
|
24
|
+
# bare `graphify affected "<symbol>"` typed by hand finds the graph too.
|
|
25
|
+
#
|
|
26
|
+
# $OUT holds RAW graph data only — graph.json, manifest.json, cache/ and
|
|
27
|
+
# graphify's own dotfile sidecars. graphify writes that layout and owns it.
|
|
28
|
+
# Everything DERIVED lands in $REPORTS. graphify has no flag for that split:
|
|
29
|
+
# cluster-only always writes GRAPH_REPORT.md (and graph.html) next to
|
|
30
|
+
# graph.json, so those two are moved after the run. The rest is written
|
|
31
|
+
# straight into $REPORTS.
|
|
32
|
+
OUT="${GRAPHIFY_OUT:-docs/graphify-out}"
|
|
33
|
+
REPORTS="$OUT/reports"
|
|
34
|
+
|
|
35
|
+
# Report filenames — RENAME HERE AND NOWHERE ELSE. Each is referenced once
|
|
36
|
+
# below, so a new name takes effect on the next run with no other edit. These
|
|
37
|
+
# are all derived artifacts: renaming one never invalidates the graph, and the
|
|
38
|
+
# old file is not cleaned up automatically — delete it or run `pnpm graph:clean`.
|
|
39
|
+
R_REPORT="graph-report.md" # cluster-only's own report, moved here
|
|
40
|
+
R_TREE="graph-tree.html" # collapsible folder tree
|
|
41
|
+
R_FULL_GRAPHML="graph.graphml" # whole graph for Gephi
|
|
42
|
+
R_PACKAGES_HTML="graph-packages.html" # ~24-node architecture view
|
|
43
|
+
R_MODULES_HTML="graph-modules.html" # ~134-node subsystem view
|
|
44
|
+
R_PACKAGES_GRAPHML="graph-packages.graphml"
|
|
45
|
+
R_MODULES_GRAPHML="graph-modules.graphml"
|
|
46
|
+
R_PACKAGES_MMD="graph-packages.mmd" # ~15-node Mermaid architecture view
|
|
47
|
+
R_MODULES_MMD="graph-modules.mmd" # ~51-node Mermaid subsystem view
|
|
48
|
+
R_OVERLAY="graph-drift.json" # computed capability status, feeds the .mmd
|
|
49
|
+
# The one TRACKED output. Everything else under $REPORTS is gitignored scratch;
|
|
50
|
+
# this is the register the repo reads, so it lives in docs/ and is committed.
|
|
51
|
+
CAPABILITIES_DOC="docs/capabilities.md"
|
|
52
|
+
R_SCOPED_PREFIX="scoped-" # + the subtree path, slashes to dashes
|
|
53
|
+
|
|
54
|
+
# Cross-group edges below this weight are dropped from the Mermaid views only —
|
|
55
|
+
# the HTML and GraphML views stay complete.
|
|
56
|
+
MMD_MIN_WEIGHT="${MMD_MIN_WEIGHT:-12}"
|
|
57
|
+
|
|
58
|
+
# The two derived-view programs. They import networkx / graphify, so they run
|
|
59
|
+
# under graphify's bundled interpreter (see graphify_python below), never the
|
|
60
|
+
# system python.
|
|
61
|
+
ROLLUP_PY="scripts/graphify/bkit-graphify-rollup.py"
|
|
62
|
+
GRAPHML_PY="scripts/graphify/bkit-graphify-graphml.py"
|
|
63
|
+
# Drift status: a LITERAL-pattern scan, not a graph query. Runs on system python
|
|
64
|
+
# (stdlib only) and writes the overlay the Mermaid views paint from.
|
|
65
|
+
DRIFT_PY="scripts/graphify/bkit-graph-drift.py"
|
|
66
|
+
DRIFT_RULES="scripts/graphify/bkit-graph-drift-rules.json"
|
|
67
|
+
# Route -> endpoint -> service join. Needs the graph (symbol-level attribution) AND
|
|
68
|
+
# the source tree (the endpoint literal), so it runs after the graph is built.
|
|
69
|
+
SURFACE_PY="scripts/graphify/bkit-graph-surface.py"
|
|
70
|
+
R_SURFACE="graph-surface.json"
|
|
71
|
+
# Writes the imports graphify cannot resolve back INTO graph.json, so the read
|
|
72
|
+
# commands (affected/god-nodes/explain/path/query) see them too, not just our
|
|
73
|
+
# own checks. Resolver lives in graph_imports.py; this is its only writer.
|
|
74
|
+
REPAIR_PY="scripts/graphify/bkit-graph-repair.py"
|
|
75
|
+
# Modules that do work when imported. Detection is a SOURCE scan; the blast radius
|
|
76
|
+
# is graph.json's transitive inbound imports.
|
|
77
|
+
EAGER_PY="scripts/graphify/bkit-graph-eager.py"
|
|
78
|
+
EAGER_RULES="scripts/graphify/bkit-graph-eager-rules.json"
|
|
79
|
+
R_EAGER="graph-eager.json"
|
|
80
|
+
# Client fetches matched against the routes the app serves. A SOURCE scan: a request
|
|
81
|
+
# URL is a STRING inside a template literal, never an edge in graph.json. The
|
|
82
|
+
# register carries its findings.
|
|
83
|
+
REACH_MJS="scripts/ci/guards/assert-routes-reachable.mjs"
|
|
84
|
+
R_REACH="graph-reachability.json"
|
|
85
|
+
|
|
86
|
+
usage() {
|
|
87
|
+
cat <<'EOF'
|
|
88
|
+
Usage: pnpm graph[:clean|:update|:rollup|:graphml|:tree|:scoped]
|
|
89
|
+
|
|
90
|
+
graph Full repo: extract + cluster. ~2 min, 0 tokens.
|
|
91
|
+
graph:clean Same, but deletes the output dir first. REQUIRED after any
|
|
92
|
+
tsconfig `paths` change — `--force` re-reads source files but
|
|
93
|
+
NOT the module-resolution cache, so a graph built after an
|
|
94
|
+
alias edit will silently keep the old, unresolved edges.
|
|
95
|
+
graph:update Re-extract changed files only, then recluster.
|
|
96
|
+
graph:check Release gate: rebuild from THIS tree and fail if the tracked
|
|
97
|
+
register docs/capabilities.md is not what a rebuild produces.
|
|
98
|
+
Writes nothing tracked. Run it from a clean dev checkout
|
|
99
|
+
before opening the dev -> main PR (docs/deployments.md
|
|
100
|
+
§ Workflow: Dev → Main).
|
|
101
|
+
graph:rollup Collapse the symbol graph into a package view (~24 nodes, the
|
|
102
|
+
architecture) and a module view (~133 nodes, the subsystems),
|
|
103
|
+
as interactive HTML. Edge weight is the number of underlying
|
|
104
|
+
symbol edges. Open these INSTEAD of the full graph; 9.8K nodes
|
|
105
|
+
is a database, not a picture.
|
|
106
|
+
graph:graphml OPT-IN, for Gephi / yEd only — nothing else produces GraphML.
|
|
107
|
+
Writes all three views: the whole graph plus the two rollups.
|
|
108
|
+
The CLI has no --graphml flag (it exists only on the /graphify
|
|
109
|
+
skill, which this repo does not install), so the whole-graph
|
|
110
|
+
export calls graphify's own to_graphml() through its bundled
|
|
111
|
+
interpreter.
|
|
112
|
+
graph:tree Collapsible folder tree with search and an outbound-edge
|
|
113
|
+
inspector.
|
|
114
|
+
graph:scoped One subtree with a browsable graph.html.
|
|
115
|
+
Path defaults to apps/web/src; pass another as $2.
|
|
116
|
+
|
|
117
|
+
Two directories, both gitignored and both rebuilt from source:
|
|
118
|
+
|
|
119
|
+
<out>/ RAW graph data — graph.json, manifest.json, cache/. graphify
|
|
120
|
+
owns this layout; the read commands (affected, god-nodes,
|
|
121
|
+
explain, path, query) all resolve <out>/graph.json.
|
|
122
|
+
<out>/reports/ Every DERIVED view. Safe to delete wholesale; `pnpm graph`
|
|
123
|
+
plus the view command that made it rebuilds any of it.
|
|
124
|
+
|
|
125
|
+
A whole-repo graph.html is never kept — 8.3 MB rendering ~9.8k nodes as a
|
|
126
|
+
hairball. Every run deletes it. Use the rollup HTMLs to click around, and Gephi
|
|
127
|
+
on the GraphML only for metrics.
|
|
128
|
+
EOF
|
|
129
|
+
echo " <out> = $OUT/ (override with GRAPHIFY_OUT)"
|
|
130
|
+
echo
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
# Every credential graphify probes for backend auto-detect.
|
|
134
|
+
NOKEYS=(env -u ANTHROPIC_API_KEY -u AZURE_OPENAI_API_KEY -u DEEPSEEK_API_KEY
|
|
135
|
+
-u GEMINI_API_KEY -u GOOGLE_API_KEY -u GRAPHIFY_API_KEY
|
|
136
|
+
-u MOONSHOT_API_KEY -u OLLAMA_API_KEY -u OPENAI_API_KEY
|
|
137
|
+
-u AWS_ACCESS_KEY_ID -u AWS_PROFILE)
|
|
138
|
+
|
|
139
|
+
run_local() { "${NOKEYS[@]}" GRAPHIFY_OUT="$OUT" graphify "$@"; }
|
|
140
|
+
|
|
141
|
+
# Rollup and scoped runs render into a throwaway directory and move the finished
|
|
142
|
+
# artifact into $REPORTS. Those sub-runs keep graphify's DEFAULT output name, so
|
|
143
|
+
# the scratch layout is always <scratch>/graphify-out/ no matter where $OUT
|
|
144
|
+
# points.
|
|
145
|
+
run_scratch() { "${NOKEYS[@]}" GRAPHIFY_OUT=graphify-out graphify "$@"; }
|
|
146
|
+
|
|
147
|
+
# graphify ships its own interpreter next to the CLI; that is the only python
|
|
148
|
+
# with networkx and graphify importable.
|
|
149
|
+
# Returns the path on stdout. `exit` here would only kill the command
|
|
150
|
+
# substitution's subshell and expand to an empty command, so it returns non-zero
|
|
151
|
+
# instead and every caller uses `gpy=$(graphify_python) || exit 1`.
|
|
152
|
+
graphify_python() {
|
|
153
|
+
local p
|
|
154
|
+
p=$(command -v graphify)
|
|
155
|
+
p="$(dirname "$(readlink -f "$p" 2>/dev/null || echo "$p")")/python"
|
|
156
|
+
if [ ! -x "$p" ]; then
|
|
157
|
+
echo "[graph] cannot find graphify's interpreter next to the CLI" >&2
|
|
158
|
+
return 1
|
|
159
|
+
fi
|
|
160
|
+
printf '%s\n' "$p"
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
require_graph() {
|
|
164
|
+
[ -f "$OUT/graph.json" ] || { echo "[graph] no $OUT/graph.json — run 'pnpm graph' first" >&2; exit 1; }
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if ! command -v graphify >/dev/null 2>&1; then
|
|
168
|
+
echo "[graph] graphify not found. Install: brew install uv && uv tool install \"graphifyy[sql]\"" >&2
|
|
169
|
+
echo "[graph] If it is installed, ~/.local/bin is not on PATH — run: uv tool update-shell" >&2
|
|
170
|
+
exit 1
|
|
171
|
+
fi
|
|
172
|
+
|
|
173
|
+
# cluster-only writes GRAPH_REPORT.md next to graph.json with no flag to
|
|
174
|
+
# redirect it, so move it into $REPORTS afterwards under $R_REPORT.
|
|
175
|
+
#
|
|
176
|
+
# The whole-repo graph.html is DELETED, never kept. --no-viz below stops
|
|
177
|
+
# cluster-only writing one, but `graphify update` regenerates it on its own
|
|
178
|
+
# ("regenerated missing or stale graph.html") before this function reclusters, so
|
|
179
|
+
# the rm removes it. Use graph:rollup for something clickable, or Gephi on the
|
|
180
|
+
# GraphML for metrics.
|
|
181
|
+
cluster() {
|
|
182
|
+
run_local cluster-only . --no-label --no-viz
|
|
183
|
+
mkdir -p "$REPORTS"
|
|
184
|
+
if [ -f "$OUT/GRAPH_REPORT.md" ]; then mv "$OUT/GRAPH_REPORT.md" "$REPORTS/$R_REPORT"; fi
|
|
185
|
+
rm -f "$OUT/graph.html" "$REPORTS/graph.html"
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
# Put back the imports graphify cannot resolve — a `.js` specifier never reaches
|
|
189
|
+
# a `.tsx` file, and workspace subpaths through an `exports` map resolve to
|
|
190
|
+
# nothing. ~540 edges here, 16% of relative imports. Upstream Graphify-Labs/
|
|
191
|
+
# graphify#3486 and #3487, open on v8.
|
|
192
|
+
#
|
|
193
|
+
# Runs BEFORE cluster, so communities, the god-node ranking and the cycle list in
|
|
194
|
+
# graph-report.md are computed from the repaired graph. Runs on every command that
|
|
195
|
+
# WRITES graph.json (`graphify update` rewrites the file without the injection).
|
|
196
|
+
# Idempotent — it strips its own previous edges before re-adding.
|
|
197
|
+
repair() {
|
|
198
|
+
python3 "$REPAIR_PY" "$OUT/graph.json"
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
# The derived-view pipeline that ends in the capability register. $1 is the doc
|
|
202
|
+
# to write: `rollup` passes the TRACKED docs/capabilities.md, `check` passes a
|
|
203
|
+
# throwaway copy. Everything else written here ($REPORTS/*.json, the two .mmd)
|
|
204
|
+
# is gitignored scratch in both modes, so one code path serves both.
|
|
205
|
+
#
|
|
206
|
+
# `check`'s copy must be SEEDED from the tracked doc. bkit-graphify-rollup.py reads
|
|
207
|
+
# the hand-maintained Overrides block back out of the very file it is about to
|
|
208
|
+
# overwrite (read_overrides(args.capabilities_doc)), so writing into an empty
|
|
209
|
+
# path silently drops every override and reports the loss as drift.
|
|
210
|
+
capabilities() {
|
|
211
|
+
local doc="$1"
|
|
212
|
+
require_graph
|
|
213
|
+
mkdir -p "$REPORTS"
|
|
214
|
+
local rpy
|
|
215
|
+
rpy=$(graphify_python) || exit 1
|
|
216
|
+
python3 "$DRIFT_PY" "$DRIFT_RULES" "$REPORTS/$R_OVERLAY"
|
|
217
|
+
python3 "$SURFACE_PY" "$OUT/graph.json" "$REPORTS/$R_SURFACE" \
|
|
218
|
+
--external-rules scripts/graphify/bkit-graph-external-rules.json --quiet
|
|
219
|
+
python3 "$EAGER_PY" "$OUT/graph.json" "$REPORTS/$R_EAGER" --rules "$EAGER_RULES"
|
|
220
|
+
# Exit 1 means "found unreachable paths", which is the normal state while any
|
|
221
|
+
# are open — it must not abort the register that reports them. Anything above 1
|
|
222
|
+
# is the scan itself failing (an unfollowable router variable, a missing v1.ts)
|
|
223
|
+
# and MUST stop the run, or the register silently loses the whole section.
|
|
224
|
+
# Pinned by assert-routes-reachable.test.mjs.
|
|
225
|
+
# Skip the section when scripts/ci/guards/assert-routes-reachable.mjs is absent.
|
|
226
|
+
REACH_ARGS=()
|
|
227
|
+
if [ -f "$REACH_MJS" ]; then
|
|
228
|
+
set +e
|
|
229
|
+
node "$REACH_MJS" --json > "$REPORTS/$R_REACH"
|
|
230
|
+
local reach_rc=$?
|
|
231
|
+
set -e
|
|
232
|
+
if [ "$reach_rc" -gt 1 ]; then
|
|
233
|
+
echo "[graph] $REACH_MJS failed (exit $reach_rc) — see the error above" >&2
|
|
234
|
+
exit 1
|
|
235
|
+
fi
|
|
236
|
+
REACH_ARGS=(--reachability "$REPORTS/$R_REACH")
|
|
237
|
+
else
|
|
238
|
+
echo "[graph] $REACH_MJS absent — route-reachability section skipped" >&2
|
|
239
|
+
fi
|
|
240
|
+
"$rpy" "$ROLLUP_PY" "$OUT/graph.json" --build-dir "$REPORTS/.build" \
|
|
241
|
+
--packages-mermaid "$REPORTS/$R_PACKAGES_MMD" \
|
|
242
|
+
--modules-mermaid "$REPORTS/$R_MODULES_MMD" \
|
|
243
|
+
--capabilities-doc "$doc" --surface "$REPORTS/$R_SURFACE" \
|
|
244
|
+
--eager "$REPORTS/$R_EAGER" "${REACH_ARGS[@]}" \
|
|
245
|
+
--min-weight "$MMD_MIN_WEIGHT" --overlay "$REPORTS/$R_OVERLAY"
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
# Strip the three provenance stamps (one header line, two `%% Generated ... from
|
|
249
|
+
# <sha>` comments) so `check` compares CONTENT: the graph is built at HEAD, a
|
|
250
|
+
# committed register at the PARENT of the commit carrying it. Stamp staleness is
|
|
251
|
+
# the freshness warning in .husky/pre-push.
|
|
252
|
+
strip_stamps() {
|
|
253
|
+
sed -E -e 's/(Diagrams from `graph\.json` @ `)[0-9a-f]+(`)/\1<sha>\2/' \
|
|
254
|
+
-e 's/(Generated by bkit-graphify-rollup\.py from )[0-9a-f]+/\1<sha>/' "$1"
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
case "${1:-build}" in
|
|
258
|
+
build) run_local extract . --code-only && repair && cluster ;;
|
|
259
|
+
clean) rm -rf "$OUT" && run_local extract . --code-only && repair && cluster ;;
|
|
260
|
+
rollup)
|
|
261
|
+
capabilities "$CAPABILITIES_DOC"
|
|
262
|
+
for lvl in packages modules; do
|
|
263
|
+
run_scratch cluster-only "$REPORTS/.build/$lvl" --no-label >/dev/null 2>&1 || true
|
|
264
|
+
done
|
|
265
|
+
if [ -f "$REPORTS/.build/packages/graphify-out/graph.html" ]; then
|
|
266
|
+
mv "$REPORTS/.build/packages/graphify-out/graph.html" "$REPORTS/$R_PACKAGES_HTML"
|
|
267
|
+
fi
|
|
268
|
+
if [ -f "$REPORTS/.build/modules/graphify-out/graph.html" ]; then
|
|
269
|
+
mv "$REPORTS/.build/modules/graphify-out/graph.html" "$REPORTS/$R_MODULES_HTML"
|
|
270
|
+
fi
|
|
271
|
+
rm -rf "$REPORTS/.build"
|
|
272
|
+
echo "[graph] interactive (click a node, neighbours highlight):"
|
|
273
|
+
echo " $REPORTS/$R_PACKAGES_HTML"
|
|
274
|
+
echo " $REPORTS/$R_MODULES_HTML"
|
|
275
|
+
echo "[graph] capability register (TRACKED — commit it): $CAPABILITIES_DOC"
|
|
276
|
+
echo "[graph] import-time side effects, full list incl. per-site lines: $REPORTS/$R_EAGER"
|
|
277
|
+
echo "[graph] mermaid (paste into mermaid.live, or render per docs/setup.md):"
|
|
278
|
+
echo " $REPORTS/$R_PACKAGES_MMD"
|
|
279
|
+
echo " $REPORTS/$R_MODULES_MMD"
|
|
280
|
+
echo "[graph] GraphML for Gephi is opt-in: pnpm graph:graphml"
|
|
281
|
+
;;
|
|
282
|
+
tree)
|
|
283
|
+
require_graph
|
|
284
|
+
mkdir -p "$REPORTS"
|
|
285
|
+
run_local tree --graph "$OUT/graph.json" \
|
|
286
|
+
--output "$REPORTS/$R_TREE" --root . --label "repo"
|
|
287
|
+
;;
|
|
288
|
+
graphml)
|
|
289
|
+
require_graph
|
|
290
|
+
mkdir -p "$REPORTS"
|
|
291
|
+
gpy=$(graphify_python) || exit 1
|
|
292
|
+
"$gpy" "$GRAPHML_PY" "$OUT/graph.json" "$REPORTS/$R_FULL_GRAPHML"
|
|
293
|
+
"$gpy" "$ROLLUP_PY" "$OUT/graph.json" \
|
|
294
|
+
--packages-graphml "$REPORTS/$R_PACKAGES_GRAPHML" \
|
|
295
|
+
--modules-graphml "$REPORTS/$R_MODULES_GRAPHML"
|
|
296
|
+
echo "[graph] wrote $REPORTS/$R_FULL_GRAPHML — File > Open in Gephi"
|
|
297
|
+
echo "[graph] rollup views too: $R_PACKAGES_GRAPHML, $R_MODULES_GRAPHML (open these first)"
|
|
298
|
+
;;
|
|
299
|
+
update) run_local update . && repair && cluster ;;
|
|
300
|
+
check)
|
|
301
|
+
# RELEASE GATE, not a hook. Rebuild the graph from this tree, regenerate the
|
|
302
|
+
# register into a throwaway copy, and fail if it differs from the tracked
|
|
303
|
+
# file. Nothing tracked is written, so a red here is a red you fix with
|
|
304
|
+
# `pnpm graph:update && pnpm graph:rollup` plus a commit.
|
|
305
|
+
#
|
|
306
|
+
# Run it from a CLEAN checkout. graphify reads the working tree, not the
|
|
307
|
+
# commit, so uncommitted edits surface here as drift that nobody else can
|
|
308
|
+
# reproduce. After a tsconfig `paths` change run `pnpm graph:clean` first:
|
|
309
|
+
# `update` keeps the stale module-resolution cache and the drift this
|
|
310
|
+
# reports would then be the cache, not the register.
|
|
311
|
+
if [ -n "$(git status --porcelain -- '*.ts' '*.tsx' 2>/dev/null)" ]; then
|
|
312
|
+
echo "[graph] WARNING: uncommitted .ts/.tsx edits — graphify reads the WORKING TREE," >&2
|
|
313
|
+
echo "[graph] so any diff below may be your own unstaged work, not committed drift." >&2
|
|
314
|
+
fi
|
|
315
|
+
if [ -f "$OUT/graph.json" ]; then run_local update .; else run_local extract . --code-only; fi
|
|
316
|
+
repair
|
|
317
|
+
cluster
|
|
318
|
+
scratch_dir=$(mktemp -d)
|
|
319
|
+
trap 'rm -rf "$scratch_dir"' EXIT
|
|
320
|
+
fresh="$scratch_dir/capabilities.md"
|
|
321
|
+
cp "$CAPABILITIES_DOC" "$fresh"
|
|
322
|
+
capabilities "$fresh" >/dev/null
|
|
323
|
+
rm -rf "$REPORTS/.build"
|
|
324
|
+
if diff -u <(strip_stamps "$CAPABILITIES_DOC") <(strip_stamps "$fresh") \
|
|
325
|
+
--label "$CAPABILITIES_DOC (committed)" --label "rebuilt from $(git rev-parse --short HEAD)"; then
|
|
326
|
+
echo "[graph] $CAPABILITIES_DOC matches a rebuild at $(git rev-parse --short HEAD)."
|
|
327
|
+
else
|
|
328
|
+
echo "[graph] DRIFT: $CAPABILITIES_DOC is not what this tree produces (diff above)." >&2
|
|
329
|
+
echo "[graph] Fix: pnpm graph:update && pnpm graph:rollup && git add $CAPABILITIES_DOC" >&2
|
|
330
|
+
exit 1
|
|
331
|
+
fi
|
|
332
|
+
;;
|
|
333
|
+
scoped)
|
|
334
|
+
target="${2:-apps/web/src}"
|
|
335
|
+
[ -d "$target" ] || { echo "[graph] no such directory: $target" >&2; exit 1; }
|
|
336
|
+
name="${target//\//-}"
|
|
337
|
+
scratch="$REPORTS/.build/scoped-$name"
|
|
338
|
+
rm -rf "$scratch"
|
|
339
|
+
run_scratch extract "./$target" --code-only --out "$scratch"
|
|
340
|
+
# graph.html is written by the clustering pass, NOT by extract — without this
|
|
341
|
+
# the scoped run produces only graph.json and the promised HTML never exists.
|
|
342
|
+
# No --no-viz here: a subtree renders.
|
|
343
|
+
run_scratch cluster-only "$scratch" --no-label
|
|
344
|
+
mkdir -p "$REPORTS/$R_SCOPED_PREFIX$name"
|
|
345
|
+
mv "$scratch"/graphify-out/* "$REPORTS/$R_SCOPED_PREFIX$name/" 2>/dev/null || true
|
|
346
|
+
rm -rf "$REPORTS/.build"
|
|
347
|
+
echo "[graph] open $REPORTS/$R_SCOPED_PREFIX$name/graph.html"
|
|
348
|
+
;;
|
|
349
|
+
-h | --help | help) usage ;;
|
|
350
|
+
*) usage >&2; exit 1 ;;
|
|
351
|
+
esac
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
3
|
+
<!-- Example. Copy into ~/Library/LaunchAgents/ and own it. -->
|
|
4
|
+
<!-- bkit install does not write this file and does not overwrite a copy. -->
|
|
5
|
+
<plist version="1.0">
|
|
6
|
+
<dict>
|
|
7
|
+
<key>Label</key>
|
|
8
|
+
<string>ai.bkit.launchd</string>
|
|
9
|
+
<key>ProgramArguments</key>
|
|
10
|
+
<array>
|
|
11
|
+
<string>/bin/sh</string>
|
|
12
|
+
<string>{{SCRIPT_PATH}}</string>
|
|
13
|
+
<string>{{ENV_FILE}}</string>
|
|
14
|
+
</array>
|
|
15
|
+
<key>RunAtLoad</key>
|
|
16
|
+
<true/>
|
|
17
|
+
<key>WatchPaths</key>
|
|
18
|
+
<array>
|
|
19
|
+
<string>{{ENV_FILE}}</string>
|
|
20
|
+
</array>
|
|
21
|
+
<key>StandardOutPath</key>
|
|
22
|
+
<string>/tmp/bkit-launchd.log</string>
|
|
23
|
+
<key>StandardErrorPath</key>
|
|
24
|
+
<string>/tmp/bkit-launchd.log</string>
|
|
25
|
+
</dict>
|
|
26
|
+
</plist>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#!/usr/bin/env sh
|
|
2
|
+
# Example. Copy into the repo and own it.
|
|
3
|
+
# bkit install does not write this file and does not overwrite a copy.
|
|
4
|
+
# Adapt the env file path to your machine setup.
|
|
5
|
+
#
|
|
6
|
+
# Hands each KEY=VALUE in an env file to launchd via `launchctl setenv`, so GUI
|
|
7
|
+
# apps launched from the Dock or Spotlight — which never run the login shell or
|
|
8
|
+
# direnv — see the BKIT_* tokens. Logs key names only, never values.
|
|
9
|
+
set -eu
|
|
10
|
+
|
|
11
|
+
LOG_FILE="${BKIT_LAUNCHD_LOG:-$HOME/Library/Logs/bkit-launchd.log}"
|
|
12
|
+
mkdir -p "$(dirname "$LOG_FILE")" 2>/dev/null || true
|
|
13
|
+
exec >> "$LOG_FILE" 2>&1
|
|
14
|
+
|
|
15
|
+
ENV_FILE="${1:-${BKIT_LAUNCHD_ENV:-$HOME/.config/bkit/launchd.env}}"
|
|
16
|
+
|
|
17
|
+
if [ ! -f "$ENV_FILE" ]; then
|
|
18
|
+
echo "$(date '+%Y-%m-%d %H:%M:%S') [bkit-launchd] env file not found at $ENV_FILE — skipping"
|
|
19
|
+
exit 0
|
|
20
|
+
fi
|
|
21
|
+
|
|
22
|
+
if ! command -v launchctl >/dev/null 2>&1; then
|
|
23
|
+
echo "$(date '+%Y-%m-%d %H:%M:%S') [bkit-launchd] launchctl not found — skipping"
|
|
24
|
+
exit 0
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
while IFS= read -r line || [ -n "$line" ]; do
|
|
28
|
+
case "$line" in
|
|
29
|
+
"" | "#"*) continue ;;
|
|
30
|
+
esac
|
|
31
|
+
line="${line#export }"
|
|
32
|
+
case "$line" in
|
|
33
|
+
*=*) ;;
|
|
34
|
+
*) continue ;;
|
|
35
|
+
esac
|
|
36
|
+
key="${line%%=*}"
|
|
37
|
+
val="${line#*=}"
|
|
38
|
+
case "$key" in
|
|
39
|
+
"" | *[!A-Za-z0-9_]*) continue ;;
|
|
40
|
+
esac
|
|
41
|
+
case "$val" in
|
|
42
|
+
\"*\")
|
|
43
|
+
val="${val#\"}"
|
|
44
|
+
val="${val%\"}"
|
|
45
|
+
;;
|
|
46
|
+
\'*\')
|
|
47
|
+
val="${val#\'}"
|
|
48
|
+
val="${val%\'}"
|
|
49
|
+
;;
|
|
50
|
+
esac
|
|
51
|
+
launchctl setenv "$key" "$val"
|
|
52
|
+
echo "$(date '+%Y-%m-%d %H:%M:%S') [bkit-launchd] setenv $key"
|
|
53
|
+
done < "$ENV_FILE"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Example. Copy into ~/.config/bkit/launchd.env and own it.
|
|
2
|
+
# bkit install does not write this file and does not overwrite a copy.
|
|
3
|
+
#
|
|
4
|
+
# Machine-local tokens for GUI apps (opencode desktop, Cursor) launched via Dock/Spotlight.
|
|
5
|
+
# Restrict permissions: chmod 600 ~/.config/bkit/launchd.env
|
|
6
|
+
#
|
|
7
|
+
# Format: KEY=VALUE (or export KEY="VALUE")
|
|
8
|
+
# Lines starting with # and blank lines are ignored.
|
|
9
|
+
#
|
|
10
|
+
BKIT_OPENROUTER_API_KEY=""
|
|
11
|
+
BKIT_GH_TOKEN=""
|
|
12
|
+
# BKIT_ANTHROPIC_API_KEY=""
|
|
13
|
+
# BKIT_OPENAI_API_KEY=""
|