@cbartens/bkit 5.2.4 → 5.4.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 +27 -11
- package/.bkit/core/.agents/context.md +1 -1
- package/.bkit/core/.agents/docs.md +1 -1
- package/.bkit/core/.agents/plugins/bkit/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.agents/rules.md +18 -1
- package/.bkit/core/.bkit/README.md +26 -10
- package/.bkit/core/.bkit/cloud.md +40 -39
- package/.bkit/core/.bkit/comparison.md +68 -345
- package/.bkit/core/.bkit/install.md +16 -9
- package/.bkit/core/.bkit/lite.md +73 -0
- package/.bkit/core/.bkit/pipeline.md +346 -0
- package/.bkit/core/.bkit/prompts.md +90 -74
- package/.bkit/core/.bkit/providers.md +42 -23
- package/.bkit/core/.bkit/templates.md +138 -19
- package/.bkit/core/.bkit/trackers.md +49 -4
- package/.bkit/core/.bkit/workflows.md +144 -123
- package/.bkit/core/.claude/hooks/bkit-guardrails.cjs +1 -1
- package/.bkit/core/.codex/hooks/bkit-guardrails.cjs +7 -4
- package/.bkit/core/.cursor/hooks/bkit-guardrails.cjs +8 -5
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-agents.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +4 -2
- package/.bkit/core/docs/templates/bkit-audit-config.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-cost.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-database.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +5 -5
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +26 -21
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +2 -2
- package/.bkit/core/docs/templates/bkit-audit-failures.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-gates.md +5 -2
- package/.bkit/core/docs/templates/bkit-audit-issues.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-llm.md +22 -15
- package/.bkit/core/docs/templates/bkit-audit-logs.md +10 -6
- package/.bkit/core/docs/templates/bkit-audit-models.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +7 -7
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +12 -9
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +3 -2
- package/.bkit/core/docs/templates/bkit-audit-repo.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-security.md +14 -12
- package/.bkit/core/docs/templates/bkit-audit-slop.md +1 -1
- package/.bkit/core/docs/templates/bkit-audit-testing.md +10 -8
- package/.bkit/core/docs/templates/bkit-audit-usability.md +1 -1
- package/.bkit/core/docs/templates/bkit-plan.md +8 -6
- package/.bkit/core/engine/checks/after/auth.ts +9 -9
- package/.bkit/core/engine/checks/after/ci-yml.ts +14 -12
- package/.bkit/core/engine/checks/after/github.ts +29 -120
- package/.bkit/core/engine/checks/after/index.ts +2 -2
- package/.bkit/core/engine/checks/after/managed.ts +8 -28
- package/.bkit/core/engine/checks/after/tools.ts +3 -15
- package/.bkit/core/engine/checks/before/context-fetch.ts +1 -21
- package/.bkit/core/engine/checks/before/index.ts +7 -43
- package/.bkit/core/engine/checks/before/mcp.ts +17 -8
- package/.bkit/core/engine/checks/before/repo.ts +9 -12
- package/.bkit/core/engine/checks/status-holes.ts +4 -6
- package/.bkit/core/engine/checks/tips/catalogue.ts +76 -24
- package/.bkit/core/engine/checks/tips/detect.ts +45 -2
- package/.bkit/core/engine/checks/tips/index.ts +77 -26
- package/.bkit/core/engine/cli.ts +57 -27
- package/.bkit/core/engine/commands/analysis.ts +36 -26
- package/.bkit/core/engine/commands/comply.ts +42 -32
- package/.bkit/core/engine/commands/harvest.ts +12 -12
- package/.bkit/core/engine/commands/install/doctor.ts +57 -28
- package/.bkit/core/engine/commands/install/install.ts +73 -130
- package/.bkit/core/engine/commands/install/uninstall.ts +191 -33
- package/.bkit/core/engine/commands/install/upgrade.ts +49 -43
- package/.bkit/core/engine/commands/land.ts +156 -0
- package/.bkit/core/engine/commands/lib.ts +45 -18
- package/.bkit/core/engine/commands/registry.ts +2 -0
- package/.bkit/core/engine/commands/tips.ts +12 -5
- package/.bkit/core/engine/commands/workflow/branches.ts +386 -286
- package/.bkit/core/engine/commands/workflow/counters.ts +21 -12
- package/.bkit/core/engine/commands/workflow/disk.ts +556 -0
- package/.bkit/core/engine/commands/workflow/fids.ts +46 -0
- package/.bkit/core/engine/commands/workflow/issues.ts +73 -28
- package/.bkit/core/engine/commands/workflow/ledgers.ts +3 -1
- package/.bkit/core/engine/commands/workflow/locks.ts +38 -152
- package/.bkit/core/engine/commands/workflow/prs.ts +15 -4
- package/.bkit/core/engine/commands/workflow/repo.ts +2 -2
- package/.bkit/core/engine/commands/workflow/roadmap.ts +49 -53
- package/.bkit/core/engine/commands/workflow/runs.ts +8 -7
- package/.bkit/core/engine/commands/workflow/runtime.ts +3 -2
- package/.bkit/core/engine/commands/workflow/status.ts +33 -11
- package/.bkit/core/engine/commands/workflow/steps.ts +25 -15
- package/.bkit/core/engine/commands/workflow/tests.ts +17 -5
- package/.bkit/core/engine/commands/workflow/workflows.ts +436 -267
- package/.bkit/core/engine/commands/workflow/workstreams.ts +4 -2
- package/.bkit/core/engine/commands/workflow/worktrees.ts +24 -6
- package/.bkit/core/engine/install/cloud-env.ts +10 -31
- package/.bkit/core/engine/install/manifest.ts +14 -7
- package/.bkit/core/engine/install/modules/antigravity.ts +15 -26
- package/.bkit/core/engine/install/modules/claude.ts +20 -28
- package/.bkit/core/engine/install/modules/cloud.ts +5 -2
- package/.bkit/core/engine/install/modules/codex.ts +15 -29
- package/.bkit/core/engine/install/modules/core.ts +106 -70
- package/.bkit/core/engine/install/modules/cursor.ts +6 -20
- package/.bkit/core/engine/install/modules/index.ts +7 -1
- package/.bkit/core/engine/install/modules/opencode.ts +48 -70
- package/.bkit/core/engine/install/network-allowlist.ts +73 -0
- package/.bkit/core/engine/install/placeholders.ts +16 -35
- package/.bkit/core/engine/install/write.ts +59 -12
- package/.bkit/core/engine/ledgers/telemetry.ts +6 -4
- package/.bkit/core/engine/render/hosts.ts +47 -67
- package/.bkit/core/engine/render/models.ts +29 -11
- package/.bkit/core/engine/shared/branches.ts +13 -0
- package/.bkit/core/engine/shared/egress.ts +3 -3
- package/.bkit/core/engine/shared/json.ts +18 -1
- package/.bkit/core/engine/shared/package-json.ts +63 -0
- package/.bkit/core/engine/shared/package-roots.ts +0 -10
- package/.bkit/core/engine/shared/protected-paths.ts +5 -130
- package/.bkit/core/engine/shared/settings.ts +44 -0
- package/.bkit/core/engine/shared/timeouts.ts +8 -7
- package/.bkit/core/hooks/antigravity-hook.js +1 -0
- package/.bkit/core/hooks/guardrails-shell.js +186 -40
- package/.bkit/core/hooks/guardrails-tiers.js +5 -78
- package/.bkit/core/prompts/bkit-audit-generate.md +103 -7
- package/.bkit/core/prompts/bkit-build-challenge-1.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-2.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +1 -1
- package/.bkit/core/prompts/bkit-build-install-skills.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-current.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-execute.md +4 -4
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-build-plan-verify.md +2 -2
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +1 -1
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +78 -0
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +1 -1
- package/.bkit/core/prompts/bkit-debug-summary.md +3 -3
- package/.bkit/core/prompts/bkit-design-spike.md +1 -1
- package/.bkit/core/prompts/bkit-design-summary.md +2 -2
- package/.bkit/core/prompts/bkit-design-update.md +1 -1
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +1 -1
- package/.bkit/core/prompts/bkit-plan-generate.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +1 -1
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +1 -1
- package/.bkit/core/prompts/bkit-plan-summary.md +1 -1
- package/.bkit/core/prompts/bkit-plan-update.md +1 -1
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +1 -1
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +1 -1
- package/.bkit/core/prompts/bkit-ship-update-docs.md +1 -1
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +2 -1
- package/.bkit/core/prompts/bkit-utility-update-failures.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +9 -2
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +11 -4
- package/.bkit/core/workflows/bkit-auto.md +2 -2
- package/.bkit/core/workflows/bkit-build.md +10 -10
- package/.bkit/core/workflows/bkit-debug.md +80 -44
- package/.bkit/core/workflows/bkit-design.md +22 -13
- package/.bkit/core/workflows/bkit-plan.md +33 -16
- package/.bkit/core/workflows/bkit-ship.md +87 -98
- package/.bkit/shared/.claude/bkit-cloud.md +58 -25
- package/.bkit/shared/.claude/settings.json +19 -0
- package/.bkit/shared/.cursor/mcp.json +2 -1
- package/.bkit/shared/.opencode/opencode.json +19 -1
- package/.bkit/shared/docs/deployments.md +49 -29
- package/.bkit/shared/docs/security.md +8 -6
- package/.bkit/shared/docs/testing.md +9 -5
- package/.bkit/shared/gitignore +1 -2
- package/.bkit/templates/.cursor/Dockerfile +30 -16
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-bug.yml +78 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +91 -0
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-idea.yml +56 -0
- package/.bkit/templates/.github/renovate.json5 +91 -12
- package/.bkit/templates/.github/workflows/bkit-ci.yml +73 -55
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +3 -1
- package/.bkit/templates/.github/workflows/bkit-renovate.yml +8 -1
- package/.bkit/templates/.github/workflows/bkit-trivy.yml +67 -0
- package/.bkit/templates/.husky/pre-commit +6 -0
- package/.bkit/templates/.husky/pre-push +15 -3
- package/.bkit/templates/.lintstagedrc.json +5 -1
- package/.bkit/templates/.oxlintrc.json +21 -0
- package/.bkit/templates/docs/capabilities.md +1 -1
- package/.bkit/templates/scripts/ci/check-capstone.mjs +176 -0
- package/.bkit/templates/scripts/ci/check-capstone.test.mjs +311 -0
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.machine.mjs +197 -0
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +164 -0
- package/.bkit/templates/scripts/graphify/bkit-graph-eager.py +2 -2
- package/.bkit/templates/scripts/graphify/bkit-graph-imports.py +43 -20
- package/.bkit/templates/scripts/graphify/bkit-graph-pre-push.sh +33 -11
- package/.bkit/templates/scripts/graphify/bkit-graph-repair.py +3 -2
- package/.bkit/templates/scripts/graphify/bkit-graphify-rollup.py +5 -5
- package/.bkit/templates/scripts/graphify/bkit-graphify.sh +79 -19
- package/CHANGELOG.md +98 -3
- package/README.md +252 -122
- package/dist/checks/after/auth.js +10 -11
- package/dist/checks/after/ci-yml.js +11 -14
- package/dist/checks/after/github.js +32 -125
- package/dist/checks/after/index.js +3 -2
- package/dist/checks/after/managed.js +8 -24
- package/dist/checks/after/tools.js +3 -16
- package/dist/checks/before/context-fetch.js +1 -21
- package/dist/checks/before/index.js +6 -42
- package/dist/checks/before/mcp.js +14 -9
- package/dist/checks/before/repo.js +8 -11
- package/dist/checks/status-holes.js +5 -7
- package/dist/checks/tips/catalogue.js +65 -18
- package/dist/checks/tips/detect.js +41 -2
- package/dist/checks/tips/index.js +61 -25
- package/dist/cli.js +52 -26
- package/dist/commands/analysis.js +21 -5
- package/dist/commands/comply.js +40 -31
- package/dist/commands/harvest.js +12 -13
- package/dist/commands/install/doctor.js +55 -23
- package/dist/commands/install/install.js +72 -122
- package/dist/commands/install/uninstall.js +165 -31
- package/dist/commands/install/upgrade.js +46 -39
- package/dist/commands/land.js +129 -0
- package/dist/commands/lib.js +41 -16
- package/dist/commands/registry.js +2 -0
- package/dist/commands/tips.js +10 -3
- package/dist/commands/workflow/branches.js +303 -248
- package/dist/commands/workflow/counters.js +17 -7
- package/dist/commands/workflow/disk.js +452 -0
- package/dist/commands/workflow/fids.js +39 -0
- package/dist/commands/workflow/issues.js +63 -27
- package/dist/commands/workflow/ledgers.js +3 -1
- package/dist/commands/workflow/locks.js +35 -130
- package/dist/commands/workflow/prs.js +8 -5
- package/dist/commands/workflow/repo.js +2 -2
- package/dist/commands/workflow/roadmap.js +50 -57
- package/dist/commands/workflow/runs.js +5 -5
- package/dist/commands/workflow/runtime.js +3 -2
- package/dist/commands/workflow/status.js +32 -12
- package/dist/commands/workflow/steps.js +19 -11
- package/dist/commands/workflow/tests.js +16 -3
- package/dist/commands/workflow/workflows.js +390 -249
- package/dist/commands/workflow/workstreams.js +4 -2
- package/dist/commands/workflow/worktrees.js +15 -6
- package/dist/install/cloud-env.js +10 -23
- package/dist/install/manifest.js +14 -7
- package/dist/install/modules/antigravity.js +15 -26
- package/dist/install/modules/claude.js +17 -21
- package/dist/install/modules/cloud.js +6 -2
- package/dist/install/modules/codex.js +15 -29
- package/dist/install/modules/core.js +95 -63
- package/dist/install/modules/cursor.js +6 -9
- package/dist/install/modules/index.js +6 -1
- package/dist/install/modules/opencode.js +41 -72
- package/dist/install/network-allowlist.js +62 -0
- package/dist/install/placeholders.js +16 -35
- package/dist/install/write.js +55 -15
- package/dist/ledgers/telemetry.js +5 -4
- package/dist/render/hosts.js +30 -55
- package/dist/render/models.js +20 -9
- package/dist/shared/branches.js +11 -0
- package/dist/shared/egress.js +0 -2
- package/dist/shared/json.js +14 -0
- package/dist/shared/package-json.js +61 -0
- package/dist/shared/package-roots.js +0 -8
- package/dist/shared/protected-paths.js +5 -122
- package/dist/shared/settings.js +23 -1
- package/dist/shared/timeouts.js +8 -7
- package/package.json +21 -17
- package/.bkit/core/.agents/shortcuts.md +0 -73
|
@@ -25,16 +25,19 @@ import { writeTier2, writeTier2JsonContained } from "../../install/write.js";
|
|
|
25
25
|
import { detectMarkerStyle } from "../../install/managed-block.js";
|
|
26
26
|
import { applyTokens, resolveTokens } from "../../install/placeholders.js";
|
|
27
27
|
import { readTemplate } from "../../render/parts.js";
|
|
28
|
-
import { TEMPLATE_COPIES_DIR, getCoreRoot, getSharedRoot, getBkitDocsRoot,
|
|
29
|
-
import {
|
|
28
|
+
import { TEMPLATE_COPIES_DIR, getCoreRoot, getSharedRoot, getBkitDocsRoot, } from "../../shared/package-roots.js";
|
|
29
|
+
import { readDependencySpec, readInstallingVersion } from "../../shared/package-json.js";
|
|
30
|
+
import { requireOpencodeProvider, detectOpencodeProviders, runUpgradeAdvisories, } from "./install.js";
|
|
30
31
|
import { setLogPrefix } from "../../shared/log-prefix.js";
|
|
31
32
|
import { BKIT_PACKAGE, lookupLatestPublished } from "../../shared/bkit-latest.js";
|
|
32
|
-
import {
|
|
33
|
+
import { PACKAGE_RUNNER } from "../../shared/package-manager.js";
|
|
34
|
+
import { getInstallManifest, getModuleManifest, } from "../../install/manifest.js";
|
|
33
35
|
import { OPTIN_MODULES } from "../../install/manifest.js";
|
|
36
|
+
import { readBkitConfig } from "../../shared/settings.js";
|
|
34
37
|
import { detectInstalledHostModules } from "../../install/hosts.js";
|
|
35
38
|
import { detectInstalledModules } from "./check.js";
|
|
36
39
|
import { remapTemplateDest } from "../../install/template-copies.js";
|
|
37
|
-
import { CLAUDE_CLOUD_RELPATH, CURSOR_CLOUD_RELPATH, writeClaudeCloudDoc, writeCursorCloudDoc,
|
|
40
|
+
import { CLAUDE_CLOUD_RELPATH, CURSOR_CLOUD_RELPATH, writeClaudeCloudDoc, writeCursorCloudDoc, writeCursorCliPermissionsArtifact, } from "../../install/cloud-env.js";
|
|
38
41
|
import { syncTemplateCopies, formatTemplateChanges } from "../../install/template-copies.js";
|
|
39
42
|
import { formatPayloadLinkChanges, syncPayloadLinks } from "../../install/payload-links.js";
|
|
40
43
|
import { renderOpencodeJson, reconcileOpencodeJson } from "../../install/modules/opencode.js";
|
|
@@ -58,12 +61,25 @@ const EMPTY_TOKENS = {
|
|
|
58
61
|
// ---------------------------------------------------------------------------
|
|
59
62
|
/** Accepts X.Y.Z with an optional prerelease tag (e.g. 4.1.5, 4.2.0-rc.1). */
|
|
60
63
|
const SELF_BUMP_SEMVER_RE = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z.-]+)?$/;
|
|
64
|
+
/**
|
|
65
|
+
* True when a `package.json` dependency spec resolves from the registry: a version, range or
|
|
66
|
+
* dist-tag. `file:` / `link:` / `workspace:` / `npm:` alias / git / URL / path specs are not.
|
|
67
|
+
*/
|
|
68
|
+
export function isRegistrySpec(spec) {
|
|
69
|
+
const s = spec.trim();
|
|
70
|
+
return !/[:/\\]/.test(s) && !s.startsWith(".");
|
|
71
|
+
}
|
|
61
72
|
/**
|
|
62
73
|
* Resolve the self-bump target and decide the action. `resolveLatest` is only
|
|
63
74
|
* invoked for `--latest` (it shells out to the registry in production); injected
|
|
64
75
|
* so tests stay offline. A leading `v` is tolerated on either source.
|
|
76
|
+
*
|
|
77
|
+
* `installedSpec` is the consumer `package.json` spec for @cbartens/bkit (`null` when
|
|
78
|
+
* undeclared). A matching version string is a no-op only when that spec resolves from the
|
|
79
|
+
* registry: a `file:` tarball or other non-registry install at the same version still bumps,
|
|
80
|
+
* so `pnpm add` replaces it with the published package.
|
|
65
81
|
*/
|
|
66
|
-
export function planSelfBump(installed, flags, resolveLatest) {
|
|
82
|
+
export function planSelfBump(installed, flags, resolveLatest, installedSpec = null) {
|
|
67
83
|
let target;
|
|
68
84
|
if (flags.toVersion !== null) {
|
|
69
85
|
target = flags.toVersion.trim().replace(/^v/, "");
|
|
@@ -83,9 +99,11 @@ export function planSelfBump(installed, flags, resolveLatest) {
|
|
|
83
99
|
};
|
|
84
100
|
}
|
|
85
101
|
}
|
|
86
|
-
if (target
|
|
102
|
+
if (target !== installed.trim().replace(/^v/, ""))
|
|
103
|
+
return { kind: "bump", target };
|
|
104
|
+
if (installedSpec === null || isRegistrySpec(installedSpec))
|
|
87
105
|
return { kind: "noop", target };
|
|
88
|
-
return { kind: "bump", target };
|
|
106
|
+
return { kind: "bump", target, fromSpec: installedSpec };
|
|
89
107
|
}
|
|
90
108
|
export const LOG_PREFIX = "[bkit-upgrade]";
|
|
91
109
|
export function diffFile(relPath, absolutePath, templateContent, canonicalHashes) {
|
|
@@ -295,7 +313,7 @@ export function updateCanonicalHashesAfterUpgrade(result, options) {
|
|
|
295
313
|
const seedablePaths = new Set([...result.updated, ...result.skippedSeedable]);
|
|
296
314
|
const fresh = {};
|
|
297
315
|
for (const relPath of seedablePaths) {
|
|
298
|
-
// Exclude .agents/ internal files (docs.md,
|
|
316
|
+
// Exclude .agents/ internal files (docs.md, rules.md,
|
|
299
317
|
// skills.md, .env.example etc.) from canonicalHashes — they are not consumer-facing files
|
|
300
318
|
// whose hashes bkit uses for drift detection. Mirrors the same filter applied
|
|
301
319
|
// in the install path (install/modules/index.ts postDispatch). Template copies carry no
|
|
@@ -361,10 +379,10 @@ function resolveLatestPublishedVersion(cwd) {
|
|
|
361
379
|
* caller falls through to a normal in-place re-render.
|
|
362
380
|
*/
|
|
363
381
|
export async function runSelfBump(flags, cwd) {
|
|
364
|
-
const installed =
|
|
382
|
+
const installed = readInstallingVersion();
|
|
365
383
|
// Resolve the latest first (only when asked), then feed planSelfBump a constant.
|
|
366
384
|
const latestVersion = flags.latest ? resolveLatestPublishedVersion(cwd) : "";
|
|
367
|
-
const resolvedPlan = planSelfBump(installed, { toVersion: flags.toVersion, latest: flags.latest }, () => latestVersion);
|
|
385
|
+
const resolvedPlan = planSelfBump(installed, { toVersion: flags.toVersion, latest: flags.latest }, () => latestVersion, readDependencySpec(cwd, BKIT_PACKAGE));
|
|
368
386
|
if (resolvedPlan.kind === "invalid") {
|
|
369
387
|
console.error(`${LOG_PREFIX} ${resolvedPlan.message}`);
|
|
370
388
|
process.exit(1);
|
|
@@ -388,16 +406,17 @@ export async function runSelfBump(flags, cwd) {
|
|
|
388
406
|
...(inWorkspaceRoot ? ["-w"] : []),
|
|
389
407
|
`@cbartens/bkit@${resolvedPlan.target}`,
|
|
390
408
|
];
|
|
391
|
-
const addCmd =
|
|
409
|
+
const addCmd = [PACKAGE_RUNNER, ...addArgs].join(" ");
|
|
410
|
+
const from = resolvedPlan.fromSpec ? `${installed} (${resolvedPlan.fromSpec})` : installed;
|
|
392
411
|
if (flags.dryRun) {
|
|
393
|
-
console.log(`${LOG_PREFIX} [dry-run] would bump @cbartens/bkit ${
|
|
412
|
+
console.log(`${LOG_PREFIX} [dry-run] would bump @cbartens/bkit ${from} -> ${resolvedPlan.target} ` +
|
|
394
413
|
`(${addCmd}), then re-render + re-pin via the ` +
|
|
395
414
|
`freshly-installed binary. No changes made.`);
|
|
396
415
|
return true;
|
|
397
416
|
}
|
|
398
417
|
const { spawnSync } = await import("node:child_process");
|
|
399
|
-
console.log(`${LOG_PREFIX} bumping @cbartens/bkit ${
|
|
400
|
-
const add = spawnSync(
|
|
418
|
+
console.log(`${LOG_PREFIX} bumping @cbartens/bkit ${from} -> ${resolvedPlan.target} ...`);
|
|
419
|
+
const add = spawnSync(PACKAGE_RUNNER, addArgs, {
|
|
401
420
|
cwd,
|
|
402
421
|
stdio: "inherit",
|
|
403
422
|
});
|
|
@@ -411,7 +430,7 @@ export async function runSelfBump(flags, cwd) {
|
|
|
411
430
|
const reArgs = ["exec", "bkit", "upgrade"];
|
|
412
431
|
if (flags.nonInteractive)
|
|
413
432
|
reArgs.push("--auto-apply");
|
|
414
|
-
const re = spawnSync(
|
|
433
|
+
const re = spawnSync(PACKAGE_RUNNER, reArgs, { cwd, stdio: "inherit" });
|
|
415
434
|
process.exit(re.status ?? 1);
|
|
416
435
|
}
|
|
417
436
|
export async function runUpgradeCommand(upgradeFlags) {
|
|
@@ -426,6 +445,8 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
426
445
|
if (handled)
|
|
427
446
|
return;
|
|
428
447
|
}
|
|
448
|
+
// Read before any write: a damaged bkit package stops the run with nothing changed.
|
|
449
|
+
const installingVersion = readInstallingVersion();
|
|
429
450
|
console.log(`${LOG_PREFIX} Running upgrade${upgradeFlags.dryRun ? " (dry-run)" : ""}${upgradeFlags.nonInteractive ? " (non-interactive)" : ""}`);
|
|
430
451
|
// Collect bkit-managed payload candidates from the package: `shared/` and
|
|
431
452
|
// `core/` hold every file install writes. `templates/` is excluded — it is
|
|
@@ -464,16 +485,7 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
464
485
|
const installedModules = detectInstalledModules(process.cwd());
|
|
465
486
|
// Resolve the consumer's tracker so upgrade renders tracker-conditional files
|
|
466
487
|
// (opencode.json, the mcp.json files) the same way install does.
|
|
467
|
-
|
|
468
|
-
try {
|
|
469
|
-
const pkg = JSON.parse(fs.readFileSync(path.join(process.cwd(), "package.json"), "utf-8"));
|
|
470
|
-
const stored = parseIssueTracker(pkg.bkit?.issueTracker);
|
|
471
|
-
if (stored !== null)
|
|
472
|
-
upgradeTracker = stored;
|
|
473
|
-
}
|
|
474
|
-
catch {
|
|
475
|
-
// package.json absent/unparseable — default tracker
|
|
476
|
-
}
|
|
488
|
+
const upgradeTracker = readBkitConfig(process.cwd()).issueTracker;
|
|
477
489
|
// opencode.json is provider/tracker-templated on install (renderOpencodeJson resolves the
|
|
478
490
|
// `@@OPENCODE_*@@` sentinels). Upgrade renders it the same way, with the installed
|
|
479
491
|
// provider, so no raw sentinel key reaches the consumer's config.
|
|
@@ -677,7 +689,7 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
677
689
|
cloudVariant: null,
|
|
678
690
|
// Re-stamp every rendered agent + command at the version we are upgrading TO,
|
|
679
691
|
// so a clean upgrade refreshes the managed-version marker and `bkit check` stays green.
|
|
680
|
-
version:
|
|
692
|
+
version: installingVersion,
|
|
681
693
|
// The detected host set — read by the Antigravity module for the Codex-overlap advisory.
|
|
682
694
|
installedModules: renderModules,
|
|
683
695
|
};
|
|
@@ -722,20 +734,17 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
722
734
|
}
|
|
723
735
|
}
|
|
724
736
|
// Network allowlist + MCP allows — OpenCode from renderOpencodeJson; Claude enrich
|
|
725
|
-
// below;
|
|
726
|
-
// module installed. Written artifacts get their
|
|
737
|
+
// below; `.bkit/allowlist.json` in renderManagedOutputs above; Cursor
|
|
738
|
+
// `.cursor/cli.json` only when cursor module installed. Written artifacts get their
|
|
739
|
+
// canonicalHashes refreshed below.
|
|
727
740
|
const artifactWrites = [];
|
|
728
741
|
{
|
|
729
742
|
const cwd = process.cwd();
|
|
730
743
|
if (renderModules.has("cursor")) {
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
if (art.wrote) {
|
|
736
|
-
artifactWrites.push(art.path);
|
|
737
|
-
console.log(`${LOG_PREFIX}${upgradeFlags.dryRun ? " [dry-run]" : ""} upgrade: ${art.path}`);
|
|
738
|
-
}
|
|
744
|
+
const art = writeCursorCliPermissionsArtifact(cwd, upgradeFlags.dryRun);
|
|
745
|
+
if (art.wrote) {
|
|
746
|
+
artifactWrites.push(art.path);
|
|
747
|
+
console.log(`${LOG_PREFIX}${upgradeFlags.dryRun ? " [dry-run]" : ""} upgrade: ${art.path}`);
|
|
739
748
|
}
|
|
740
749
|
}
|
|
741
750
|
if (renderModules.has("claude") && fs.existsSync(path.join(cwd, ".claude", "settings.json"))) {
|
|
@@ -754,8 +763,6 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
754
763
|
// exit), so feed those writes into canonicalHashes — keeping install/upgrade `.bkit/version`
|
|
755
764
|
// parity.
|
|
756
765
|
if (!upgradeFlags.dryRun) {
|
|
757
|
-
const pkgVersion = JSON.parse(fs.readFileSync(path.join(getPkgRoot(), "package.json"), "utf-8"))
|
|
758
|
-
.version;
|
|
759
766
|
const renderedDocPaths = renderWs.writes.map((w) => path.relative(process.cwd(), path.isAbsolute(w.path) ? w.path : path.resolve(process.cwd(), w.path)));
|
|
760
767
|
updateCanonicalHashesAfterUpgrade({
|
|
761
768
|
updated: [
|
|
@@ -770,7 +777,7 @@ export async function runUpgradeCommand(upgradeFlags) {
|
|
|
770
777
|
}, {
|
|
771
778
|
dryRun: false,
|
|
772
779
|
cwd: process.cwd(),
|
|
773
|
-
pinnedVersion:
|
|
780
|
+
pinnedVersion: installingVersion,
|
|
774
781
|
claudeAllowDerived: upgradeClaudeAllowDerived,
|
|
775
782
|
});
|
|
776
783
|
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
// The one way bkit lands a commit on dev: build it in a detached throwaway
|
|
2
|
+
// worktree off a fresh origin/dev and push it as dev. The main checkout's
|
|
3
|
+
// branch, index and edits are never touched, and local dev commits missing from
|
|
4
|
+
// origin/dev are never pushed. dev moved underneath → rebuild on the new dev and
|
|
5
|
+
// push again, with backoff. Used by the design / plan close, the build / debug
|
|
6
|
+
// roadmap mirror, and ship's close and FAILED record. The throwaway runs no git
|
|
7
|
+
// hooks: what it lands is bookkeeping only (docs, logs, ledgers, `[skip ci]`).
|
|
8
|
+
import * as fs from "node:fs";
|
|
9
|
+
import * as path from "node:path";
|
|
10
|
+
import { CommandError, DEV, EXIT, git, runGit } from "./lib.js";
|
|
11
|
+
import { TIMEOUTS } from "../shared/timeouts.js";
|
|
12
|
+
const REMOTE = "origin";
|
|
13
|
+
const UPSTREAM = `${REMOTE}/${DEV}`;
|
|
14
|
+
/** dev moved before git sent anything: git compared the remote's dev and stopped. */
|
|
15
|
+
const MOVED_BEFORE = /\[rejected\][^\n]*\((?:fetch first|non-fast-forward)\)/;
|
|
16
|
+
/** dev moved while the push was in flight: the server's ref update lost the race. */
|
|
17
|
+
const MOVED_DURING = /\[remote rejected\][^\n]*\((?:incorrect old value provided|cannot lock ref[^\n]*)\)/;
|
|
18
|
+
/** The server turned the push away: branch protection, a ruleset, an HTTP 403. */
|
|
19
|
+
const REFUSED = /\[remote rejected\]|returned error: 403|\bGH0\d\d\b/;
|
|
20
|
+
/** A dev push rejected only because dev moved: rebuild on the new dev, push again. */
|
|
21
|
+
export const devMoved = (stderr) => MOVED_BEFORE.test(stderr) || MOVED_DURING.test(stderr);
|
|
22
|
+
/** A dev push the server refused for a reason other than dev moving. */
|
|
23
|
+
export const devRefused = (stderr) => !devMoved(stderr) && REFUSED.test(stderr);
|
|
24
|
+
/**
|
|
25
|
+
* Milliseconds to wait before retry `retry` (1-based) of a landing: `startS`
|
|
26
|
+
* doubling per retry, capped at `capS`, then jittered down by up to half so two
|
|
27
|
+
* landings that collided once do not retry in step.
|
|
28
|
+
*/
|
|
29
|
+
export function landBackoffMs(retry, random = Math.random, startS = TIMEOUTS.LAND_BACKOFF_START_S, capS = TIMEOUTS.LAND_BACKOFF_CAP_S) {
|
|
30
|
+
const s = Math.min(startS * 2 ** (retry - 1), capS);
|
|
31
|
+
return Math.round(s * 1000 * (0.5 + random() / 2));
|
|
32
|
+
}
|
|
33
|
+
export const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
34
|
+
/** A FID names one folder: no separators, no `..`. */
|
|
35
|
+
const SAFE_FID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
36
|
+
/** The throwaway checkout a landing is built in, beside the feature worktrees. */
|
|
37
|
+
export function landDir(root, fid) {
|
|
38
|
+
if (!SAFE_FID.test(fid) || fid.includes(".."))
|
|
39
|
+
throw new CommandError(EXIT.USAGE, `--fid "${fid}" is not a feature id`);
|
|
40
|
+
return path.join(root, ".worktrees", `_land-${fid}`);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Remove a throwaway checkout. A landing killed inside `worktree add` leaves it
|
|
44
|
+
* locked ("initializing"), which a single `--force` and `prune` both skip, so it
|
|
45
|
+
* is unlocked first; a folder git no longer lists is the landing's own scratch.
|
|
46
|
+
*/
|
|
47
|
+
export function dropLandTree(root, dir) {
|
|
48
|
+
runGit(root, ["worktree", "unlock", dir]);
|
|
49
|
+
if (fs.existsSync(dir))
|
|
50
|
+
runGit(root, ["worktree", "remove", "--force", "--force", dir]);
|
|
51
|
+
runGit(root, ["worktree", "prune"]);
|
|
52
|
+
if (fs.existsSync(dir))
|
|
53
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
54
|
+
}
|
|
55
|
+
/** `core.hooksPath` pointing nowhere, so no hook runs. */
|
|
56
|
+
const NO_HOOKS = process.platform === "win32" ? "NUL" : "/dev/null";
|
|
57
|
+
/**
|
|
58
|
+
* Run `fn` with git hooks off for every git child it starts: one more
|
|
59
|
+
* `GIT_CONFIG_*` entry (git >= 2.31) setting `core.hooksPath`, restored after.
|
|
60
|
+
*/
|
|
61
|
+
export async function withoutHooks(fn) {
|
|
62
|
+
const saved = process.env.GIT_CONFIG_COUNT;
|
|
63
|
+
const n = Number(saved ?? 0) || 0;
|
|
64
|
+
const key = `GIT_CONFIG_KEY_${n}`;
|
|
65
|
+
const value = `GIT_CONFIG_VALUE_${n}`;
|
|
66
|
+
process.env.GIT_CONFIG_COUNT = String(n + 1);
|
|
67
|
+
process.env[key] = "core.hooksPath";
|
|
68
|
+
process.env[value] = NO_HOOKS;
|
|
69
|
+
try {
|
|
70
|
+
return await fn();
|
|
71
|
+
}
|
|
72
|
+
finally {
|
|
73
|
+
if (saved === undefined)
|
|
74
|
+
delete process.env.GIT_CONFIG_COUNT;
|
|
75
|
+
else
|
|
76
|
+
process.env.GIT_CONFIG_COUNT = saved;
|
|
77
|
+
delete process.env[key];
|
|
78
|
+
delete process.env[value];
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Land one commit on dev: per attempt, fetch dev, add `dir` detached at
|
|
83
|
+
* origin/dev, let `build` make the commit there, push `HEAD:dev` — git hooks
|
|
84
|
+
* off. `build` throwing stops the landing with that throw. A server refusal runs
|
|
85
|
+
* `refused` on the built commit first, when given. `dir` is removed on every path.
|
|
86
|
+
*/
|
|
87
|
+
export async function pushToDev(o) {
|
|
88
|
+
o.log("git hooks skipped in the throwaway dev checkout — it lands bookkeeping only");
|
|
89
|
+
for (let attempt = 1;; attempt++) {
|
|
90
|
+
let wait = 0;
|
|
91
|
+
dropLandTree(o.root, o.dir);
|
|
92
|
+
try {
|
|
93
|
+
const outcome = await withoutHooks(async () => {
|
|
94
|
+
const fetched = runGit(o.root, ["fetch", REMOTE, DEV]);
|
|
95
|
+
if (!fetched.ok)
|
|
96
|
+
return { kind: "fetch-failed", stderr: fetched.stderr };
|
|
97
|
+
const added = runGit(o.root, ["worktree", "add", "--detach", o.dir, UPSTREAM]);
|
|
98
|
+
if (!added.ok)
|
|
99
|
+
return { kind: "setup-failed", stderr: added.stderr };
|
|
100
|
+
o.build(o.dir, attempt);
|
|
101
|
+
const pushed = runGit(o.dir, ["push", REMOTE, `HEAD:${DEV}`]);
|
|
102
|
+
if (pushed.ok) {
|
|
103
|
+
return {
|
|
104
|
+
kind: "landed",
|
|
105
|
+
sha: git(o.dir, ["rev-parse", "HEAD"]) ?? "",
|
|
106
|
+
attempts: attempt,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
if (devRefused(pushed.stderr)) {
|
|
110
|
+
await o.refused?.(o.dir, pushed.stderr);
|
|
111
|
+
return { kind: "refused", stderr: pushed.stderr };
|
|
112
|
+
}
|
|
113
|
+
if (!devMoved(pushed.stderr))
|
|
114
|
+
return { kind: "push-failed", stderr: pushed.stderr };
|
|
115
|
+
return null;
|
|
116
|
+
});
|
|
117
|
+
if (outcome !== null)
|
|
118
|
+
return outcome;
|
|
119
|
+
if (attempt >= TIMEOUTS.LAND_ATTEMPTS)
|
|
120
|
+
return { kind: "exhausted", attempts: attempt };
|
|
121
|
+
wait = landBackoffMs(attempt);
|
|
122
|
+
o.log(`dev moved before push ${attempt} of ${TIMEOUTS.LAND_ATTEMPTS} — rebuilding on the new dev in ${(wait / 1000).toFixed(1)}s`);
|
|
123
|
+
}
|
|
124
|
+
finally {
|
|
125
|
+
dropLandTree(o.root, o.dir);
|
|
126
|
+
}
|
|
127
|
+
await sleep(wait);
|
|
128
|
+
}
|
|
129
|
+
}
|
package/dist/commands/lib.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
// Flag parsing, one JSON object on stdout, `[bkit-<noun>]`-tagged logs on stderr,
|
|
4
4
|
// the exit-code table, `--help` rendering, and the repo facts several workflow
|
|
5
5
|
// steps each re-derived by hand: repo root, UTC month, where `status.jsonl` lives,
|
|
6
|
-
//
|
|
7
|
-
// in its spec; `--help` and the convention test both read
|
|
8
|
-
// text cannot drift from what the command accepts.
|
|
6
|
+
// the skip-CI tokens, and which branches are shared. A command declares its flags,
|
|
7
|
+
// output keys and exit codes in its spec; `--help` and the convention test both read
|
|
8
|
+
// that spec, so the help text cannot drift from what the command accepts.
|
|
9
9
|
import { spawnSync } from "node:child_process";
|
|
10
10
|
import * as fs from "node:fs";
|
|
11
11
|
import * as os from "node:os";
|
|
@@ -253,13 +253,29 @@ export async function runCommand(argv, commands, options) {
|
|
|
253
253
|
// ---------------------------------------------------------------------------
|
|
254
254
|
// Repo facts
|
|
255
255
|
// ---------------------------------------------------------------------------
|
|
256
|
+
/** Captured stdout / stderr cap for `runGit` / `runTool`; hook output (pre-push) counts. */
|
|
257
|
+
const OUTPUT_LIMIT = 1 << 26;
|
|
258
|
+
/** Spawn error as a stderr lead line: ENOBUFS names the limit, anything else Node's message. */
|
|
259
|
+
function spawnErrorText(cmd, args, err) {
|
|
260
|
+
return err.code === "ENOBUFS"
|
|
261
|
+
? `${cmd} ${args[0] ?? ""}: output passed the ${OUTPUT_LIMIT / (1 << 20)} MiB limit (ENOBUFS)`
|
|
262
|
+
: err.message;
|
|
263
|
+
}
|
|
256
264
|
/** `git <args>` in `cwd`, never throwing: exit status plus trimmed stdout / stderr. */
|
|
257
265
|
export function runGit(cwd, args) {
|
|
258
|
-
const res = spawnSync("git", args, {
|
|
266
|
+
const res = spawnSync("git", args, {
|
|
267
|
+
cwd,
|
|
268
|
+
encoding: "utf-8",
|
|
269
|
+
env: gitEnv(),
|
|
270
|
+
maxBuffer: OUTPUT_LIMIT,
|
|
271
|
+
});
|
|
272
|
+
const stderr = (res.stderr ?? "").trim();
|
|
259
273
|
return {
|
|
260
|
-
ok: res.status === 0,
|
|
274
|
+
ok: !res.error && res.status === 0,
|
|
261
275
|
stdout: (res.stdout ?? "").trim(),
|
|
262
|
-
stderr:
|
|
276
|
+
stderr: res.error
|
|
277
|
+
? [spawnErrorText("git", args, res.error), stderr].filter(Boolean).join("\n")
|
|
278
|
+
: stderr,
|
|
263
279
|
};
|
|
264
280
|
}
|
|
265
281
|
/** `git <args>` in `cwd`; stdout trimmed, or null on a non-zero exit. */
|
|
@@ -271,6 +287,8 @@ export function git(cwd, args) {
|
|
|
271
287
|
// Shared with the files that are not commands (checks, install): re-exported here
|
|
272
288
|
// for the command modules that already import it from this module.
|
|
273
289
|
export { parseJson } from "../shared/json.js";
|
|
290
|
+
// The shared-branch rule (`dev`, `main`) lives in shared/ so checks can read it too.
|
|
291
|
+
export { DEV, isSharedBranch } from "../shared/branches.js";
|
|
274
292
|
/**
|
|
275
293
|
* Run a tool other than git, never throwing. Hook-exported GIT_* vars are scrubbed
|
|
276
294
|
* so gh and friends answer for `cwd`; `input` goes to stdin.
|
|
@@ -281,16 +299,20 @@ export function runTool(cmd, args, cwd, opts = {}) {
|
|
|
281
299
|
encoding: "utf-8",
|
|
282
300
|
env: gitEnv(),
|
|
283
301
|
input: opts.input,
|
|
284
|
-
maxBuffer:
|
|
302
|
+
maxBuffer: OUTPUT_LIMIT,
|
|
285
303
|
});
|
|
286
|
-
if (res.error) {
|
|
304
|
+
if (res.error && res.pid === 0) {
|
|
287
305
|
return { found: false, status: 127, stdout: "", stderr: `${cmd} not found on PATH` };
|
|
288
306
|
}
|
|
307
|
+
const status = res.status ?? 128 + signalNumber(res.signal);
|
|
289
308
|
return {
|
|
290
309
|
found: true,
|
|
291
|
-
|
|
310
|
+
// A spawn error is never a success: the child can exit 0 before ENOBUFS kills it.
|
|
311
|
+
status: res.error && status === 0 ? 1 : status,
|
|
292
312
|
stdout: res.stdout ?? "",
|
|
293
|
-
stderr: res.
|
|
313
|
+
stderr: res.error
|
|
314
|
+
? [spawnErrorText(cmd, args, res.error), res.stderr ?? ""].filter(Boolean).join("\n")
|
|
315
|
+
: (res.stderr ?? ""),
|
|
294
316
|
};
|
|
295
317
|
}
|
|
296
318
|
const signalNumber = (signal) => (signal ? os.constants.signals[signal] : undefined) ?? 1;
|
|
@@ -305,8 +327,12 @@ export function runGh(cwd, args, input) {
|
|
|
305
327
|
status: res.status,
|
|
306
328
|
};
|
|
307
329
|
}
|
|
308
|
-
/**
|
|
309
|
-
|
|
330
|
+
/**
|
|
331
|
+
* gh cannot serve this call here: not installed, exit 4 (not logged in), or an
|
|
332
|
+
* HTTP 403 — a token or proxy that may not use this API, where the GitHub MCP
|
|
333
|
+
* (its own credentials) can.
|
|
334
|
+
*/
|
|
335
|
+
export const ghUnavailable = (res) => res.missing || res.status === 4 || (!res.ok && /\bHTTP 403\b/.test(res.stderr));
|
|
310
336
|
/**
|
|
311
337
|
* The main checkout's root, from any worktree. `--git-common-dir` points at the
|
|
312
338
|
* shared `.git`, so a linked worktree resolves to the same root as the main one.
|
|
@@ -328,15 +354,14 @@ export const statusRelPath = (month, fid) => path.join("docs", "plans", month, "
|
|
|
328
354
|
*
|
|
329
355
|
* - design / plan / build / debug: the feature worktree's copy when it exists
|
|
330
356
|
* (`.worktrees/{fid}`), else the main checkout's.
|
|
331
|
-
* - ship: the
|
|
332
|
-
* worktree
|
|
333
|
-
* least-capable answer: current worktree.
|
|
357
|
+
* - ship: the current worktree's top — the tree ship works in (the feature
|
|
358
|
+
* worktree, or the adopted checkout), so asked from inside it.
|
|
334
359
|
*/
|
|
335
360
|
export function statusLocation(opts) {
|
|
336
361
|
const root = repoRoot(opts.cwd);
|
|
337
362
|
const rel = statusRelPath(opts.month, opts.fid);
|
|
338
363
|
if (opts.workflow === "ship") {
|
|
339
|
-
const bookRoot =
|
|
364
|
+
const bookRoot = git(opts.cwd, ["rev-parse", "--show-toplevel"]) ?? root;
|
|
340
365
|
return { bookRoot, path: path.join(bookRoot, rel) };
|
|
341
366
|
}
|
|
342
367
|
const worktree = path.join(root, ".worktrees", opts.fid);
|
|
@@ -9,6 +9,7 @@ import { setupCommand } from "./setup/setup.js";
|
|
|
9
9
|
import { branchesCommand } from "./workflow/branches.js";
|
|
10
10
|
import { contextCommand } from "./workflow/context.js";
|
|
11
11
|
import { countersCommand } from "./workflow/counters.js";
|
|
12
|
+
import { diskCommand } from "./workflow/disk.js";
|
|
12
13
|
import { fidsCommand } from "./workflow/fids.js";
|
|
13
14
|
import { issuesCommand } from "./workflow/issues.js";
|
|
14
15
|
import { ledgersCommand } from "./workflow/ledgers.js";
|
|
@@ -36,6 +37,7 @@ export const COMMANDS = [
|
|
|
36
37
|
locksCommand,
|
|
37
38
|
workflowsCommand,
|
|
38
39
|
worktreesCommand,
|
|
40
|
+
diskCommand,
|
|
39
41
|
branchesCommand,
|
|
40
42
|
skillsCommand,
|
|
41
43
|
prsCommand,
|
package/dist/commands/tips.js
CHANGED
|
@@ -1,10 +1,17 @@
|
|
|
1
1
|
// commands/tips.ts — `bkit tips [--workflow=<name>] [--all]`: print the setup tips that
|
|
2
2
|
// apply to this repo. Each workflow passes its name at its close and gets the one tip that
|
|
3
|
-
// matters most there
|
|
4
|
-
//
|
|
3
|
+
// matters most there (`audit` / `utility` for the audit agent and the ledger / roadmap
|
|
4
|
+
// updaters); bare `bkit tips` prints the top three. The star line closes bare and phase
|
|
5
|
+
// output unless `bkit-star` is in `bkit.ignoreAdvisories`. Local checks only, no network; prints
|
|
6
|
+
// nothing when no tip fires and no star line shows; exits 0. What the last disk clean-up left
|
|
7
|
+
// for the person to decide (`bkit disk prune` notes) comes first, outside the tip cap.
|
|
5
8
|
import { collectTips, formatTips } from "../checks/tips/index.js";
|
|
9
|
+
import { formatNotes, readNotes } from "./workflow/disk.js";
|
|
6
10
|
export function runTipsCommand(all, workflow, cwd = process.cwd()) {
|
|
7
|
-
const
|
|
11
|
+
const { tips, star } = collectTips(cwd);
|
|
12
|
+
const output = [formatNotes(readNotes(cwd)), formatTips(tips, { all, workflow, star })]
|
|
13
|
+
.filter((part) => part !== "")
|
|
14
|
+
.join("\n\n");
|
|
8
15
|
if (output)
|
|
9
16
|
console.log(output);
|
|
10
17
|
}
|