@cbartens/bkit 5.5.1 → 6.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 +30 -20
- package/.bkit/core/.agents/docs.md +1 -0
- package/.bkit/core/.agents/rules.md +35 -26
- package/.bkit/core/.bkit/README.md +29 -19
- package/.bkit/core/.bkit/authoring.md +117 -0
- package/.bkit/core/.bkit/cloud.md +11 -11
- package/.bkit/core/.bkit/comparison.md +5 -5
- package/.bkit/core/.bkit/install.md +19 -18
- package/.bkit/core/.bkit/jsonl.md +202 -122
- package/.bkit/core/.bkit/lite.md +1 -1
- package/.bkit/core/.bkit/pipeline.md +49 -52
- package/.bkit/core/.bkit/prompts.md +91 -167
- package/.bkit/core/.bkit/providers.md +29 -32
- package/.bkit/core/.bkit/templates.md +12 -11
- package/.bkit/core/.bkit/trackers.md +51 -28
- package/.bkit/core/.bkit/workflows.md +394 -355
- package/.bkit/core/AGENTS.md +16 -22
- package/.bkit/core/docs/templates/bkit-audit-accessibility.md +14 -38
- package/.bkit/core/docs/templates/bkit-audit-adoption.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-agents.md +19 -43
- package/.bkit/core/docs/templates/bkit-audit-aio-seo.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-analytics.md +14 -38
- package/.bkit/core/docs/templates/bkit-audit-annotations.md +11 -35
- package/.bkit/core/docs/templates/bkit-audit-app-performance.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-app-store.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-architecture.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-ci-performance.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-config.md +18 -42
- package/.bkit/core/docs/templates/bkit-audit-cost.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-coverage.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-database.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-dead-code.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-deferrals.md +15 -38
- package/.bkit/core/docs/templates/bkit-audit-dependencies.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-documentation.md +11 -35
- package/.bkit/core/docs/templates/bkit-audit-duplication.md +18 -42
- package/.bkit/core/docs/templates/bkit-audit-failures.md +13 -37
- package/.bkit/core/docs/templates/bkit-audit-flakes.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-gates.md +14 -38
- package/.bkit/core/docs/templates/bkit-audit-issues.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-llm.md +16 -40
- package/.bkit/core/docs/templates/bkit-audit-logs.md +14 -38
- package/.bkit/core/docs/templates/bkit-audit-models.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-privacy.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-prompts.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-red-team.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-reliability.md +15 -39
- package/.bkit/core/docs/templates/bkit-audit-repo.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-security.md +13 -37
- package/.bkit/core/docs/templates/bkit-audit-slop.md +14 -38
- package/.bkit/core/docs/templates/bkit-audit-testing.md +12 -36
- package/.bkit/core/docs/templates/bkit-audit-usability.md +16 -40
- package/.bkit/core/docs/templates/bkit-plan.md +97 -226
- package/.bkit/core/engine/checks/after/ci-yml.ts +39 -29
- package/.bkit/core/engine/checks/after/github.ts +95 -17
- package/.bkit/core/engine/checks/after/index.ts +10 -7
- package/.bkit/core/engine/checks/after/suppression.ts +8 -5
- package/.bkit/core/engine/checks/after/tools.ts +46 -91
- package/.bkit/core/engine/checks/before/env.ts +2 -2
- package/.bkit/core/engine/checks/before/files.ts +5 -4
- package/.bkit/core/engine/checks/before/index.ts +18 -1
- package/.bkit/core/engine/checks/before/repo.ts +168 -2
- package/.bkit/core/engine/checks/tips/catalogue.ts +16 -5
- package/.bkit/core/engine/checks/tips/detect.ts +34 -0
- package/.bkit/core/engine/checks/tips/index.ts +6 -6
- package/.bkit/core/engine/cli.ts +20 -53
- package/.bkit/core/engine/commands/analysis.ts +171 -140
- package/.bkit/core/engine/commands/ci/ci.ts +6 -6
- package/.bkit/core/engine/commands/comply.ts +77 -103
- package/.bkit/core/engine/commands/install/doctor.ts +2 -2
- package/.bkit/core/engine/commands/install/install.ts +57 -18
- package/.bkit/core/engine/commands/install/uninstall.ts +65 -28
- package/.bkit/core/engine/commands/land.ts +18 -12
- package/.bkit/core/engine/commands/lib.ts +79 -17
- package/.bkit/core/engine/commands/registry.ts +4 -0
- package/.bkit/core/engine/commands/setup/setup.ts +7 -7
- package/.bkit/core/engine/commands/stats.ts +204 -0
- package/.bkit/core/engine/commands/tips.ts +10 -5
- package/.bkit/core/engine/commands/workflow/branches.ts +741 -62
- package/.bkit/core/engine/commands/workflow/challenge.ts +673 -0
- package/.bkit/core/engine/commands/workflow/context.ts +853 -29
- package/.bkit/core/engine/commands/workflow/counters.ts +267 -84
- package/.bkit/core/engine/commands/workflow/decisions.ts +541 -0
- package/.bkit/core/engine/commands/workflow/disk.ts +2 -2
- package/.bkit/core/engine/commands/workflow/fids.ts +793 -33
- package/.bkit/core/engine/commands/workflow/issues.ts +407 -64
- package/.bkit/core/engine/commands/workflow/ledgers.ts +884 -27
- package/.bkit/core/engine/commands/workflow/locks.ts +26 -2
- package/.bkit/core/engine/commands/workflow/plan-blocks.ts +582 -0
- package/.bkit/core/engine/commands/workflow/plan-versions.ts +21 -0
- package/.bkit/core/engine/commands/workflow/prs.ts +166 -30
- package/.bkit/core/engine/commands/workflow/repo.ts +58 -8
- package/.bkit/core/engine/commands/workflow/roadmap.ts +16 -7
- package/.bkit/core/engine/commands/workflow/run-facts.ts +501 -0
- package/.bkit/core/engine/commands/workflow/runs.ts +179 -49
- package/.bkit/core/engine/commands/workflow/runtime.ts +22 -1
- package/.bkit/core/engine/commands/workflow/status.ts +142 -29
- package/.bkit/core/engine/commands/workflow/step-table.ts +339 -0
- package/.bkit/core/engine/commands/workflow/steps.ts +213 -88
- package/.bkit/core/engine/commands/workflow/summary.ts +398 -0
- package/.bkit/core/engine/commands/workflow/tests.ts +1013 -148
- package/.bkit/core/engine/commands/workflow/tracker.ts +1195 -0
- package/.bkit/core/engine/commands/workflow/workflows.ts +984 -207
- package/.bkit/core/engine/commands/workflow/workstreams.ts +11 -5
- package/.bkit/core/engine/commands/workflow/worktrees.ts +185 -8
- package/.bkit/core/engine/install/manifest.ts +11 -9
- package/.bkit/core/engine/install/modules/cloud.ts +21 -13
- package/.bkit/core/engine/install/modules/core.ts +250 -3
- package/.bkit/core/engine/install/modules/opencode.ts +2 -2
- package/.bkit/core/engine/install/version-file.ts +6 -2
- package/.bkit/core/engine/ledgers/migrate.ts +92 -0
- package/.bkit/core/engine/ledgers/status.ts +92 -15
- package/.bkit/core/engine/ledgers/telemetry.ts +1261 -254
- package/.bkit/core/engine/render/hosts.ts +4 -0
- package/.bkit/core/engine/render/models.ts +12 -0
- package/.bkit/core/engine/shared/branches.ts +4 -1
- package/.bkit/core/engine/shared/egress.ts +7 -0
- package/.bkit/core/engine/shared/json.ts +25 -7
- package/.bkit/core/engine/shared/settings.ts +157 -20
- package/.bkit/core/engine/shared/text.ts +361 -0
- package/.bkit/core/engine/tools/grammar-density.ts +215 -0
- package/.bkit/core/engine/tools/instructions-sources.ts +834 -0
- package/.bkit/core/engine/tools/instructions.ts +1751 -0
- package/.bkit/core/hooks/gateguard-engine.js +24 -23
- package/.bkit/core/hooks/guardrails-shell.js +2 -3
- package/.bkit/core/hooks/guardrails-tiers.js +7 -1
- package/.bkit/core/hooks/readguard-engine.js +2 -2
- package/.bkit/core/prompts/bkit-audit-generate.md +62 -25
- package/.bkit/core/prompts/bkit-build-challenge-1.md +40 -17
- package/.bkit/core/prompts/bkit-build-challenge-2.md +44 -17
- package/.bkit/core/prompts/bkit-build-install-skills.md +26 -13
- package/.bkit/core/prompts/bkit-build-plan-convert.md +74 -0
- package/.bkit/core/prompts/bkit-build-plan-current.md +26 -13
- package/.bkit/core/prompts/bkit-build-plan-execute.md +74 -26
- package/.bkit/core/prompts/bkit-build-plan-gaps-remediate.md +64 -23
- package/.bkit/core/prompts/bkit-build-plan-verify.md +57 -33
- package/.bkit/core/prompts/bkit-debug-abort-handover.md +29 -15
- package/.bkit/core/prompts/bkit-debug-failure-diagnose.md +34 -14
- package/.bkit/core/prompts/bkit-debug-failure-remediate.md +34 -17
- package/.bkit/core/prompts/bkit-debug-failure-reproduce.md +26 -13
- package/.bkit/core/prompts/bkit-debug-failure-soak.md +31 -16
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-1.md +21 -11
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-2.md +20 -11
- package/.bkit/core/prompts/bkit-design-brainstorm-ideate-3.md +20 -11
- package/.bkit/core/prompts/bkit-design-generate.md +32 -14
- package/.bkit/core/prompts/bkit-design-organise.md +25 -12
- package/.bkit/core/prompts/bkit-design-review-1.md +31 -15
- package/.bkit/core/prompts/bkit-design-review-2.md +28 -13
- package/.bkit/core/prompts/bkit-design-spike.md +30 -13
- package/.bkit/core/prompts/bkit-design-update.md +33 -19
- package/.bkit/core/prompts/bkit-plan-generate.md +72 -18
- package/.bkit/core/prompts/bkit-plan-review-1.md +50 -27
- package/.bkit/core/prompts/bkit-plan-review-2.md +59 -28
- package/.bkit/core/prompts/bkit-plan-scope-check.md +109 -0
- package/.bkit/core/prompts/bkit-plan-update.md +61 -24
- package/.bkit/core/prompts/bkit-ship-conflict-resolve.md +27 -15
- package/.bkit/core/prompts/bkit-ship-deferred-sweep.md +31 -16
- package/.bkit/core/prompts/bkit-ship-update-docs.md +29 -14
- package/.bkit/core/prompts/bkit-utility-compress-markdown.md +24 -14
- package/.bkit/core/prompts/bkit-utility-update-decisions.md +32 -14
- package/.bkit/core/prompts/bkit-utility-update-deferrals.md +29 -14
- package/.bkit/core/prompts/bkit-utility-update-documentation.md +27 -12
- package/.bkit/core/prompts/bkit-utility-update-failures.md +31 -14
- package/.bkit/core/prompts/bkit-utility-update-knowledge.md +33 -14
- package/.bkit/core/prompts/bkit-utility-update-roadmap.md +38 -17
- package/.bkit/core/prompts/bkit-utility-update-tracker.md +41 -18
- package/.bkit/core/workflows/bkit-auto.md +54 -46
- package/.bkit/core/workflows/bkit-build.md +577 -458
- package/.bkit/core/workflows/bkit-debug.md +348 -333
- package/.bkit/core/workflows/bkit-design.md +201 -237
- package/.bkit/core/workflows/bkit-plan.md +210 -321
- package/.bkit/core/workflows/bkit-ship.md +328 -278
- package/.bkit/shared/.bkit/.env.example +2 -2
- package/.bkit/shared/.claude/settings.json +11 -0
- package/.bkit/shared/.cursor/mcp.json +1 -1
- package/.bkit/shared/.cursor/rules/bkit-rules.mdc +1 -1
- package/.bkit/shared/.gitattributes +1 -1
- package/.bkit/shared/.mcp.json +1 -1
- package/.bkit/shared/.opencode/opencode.json +11 -0
- package/.bkit/shared/CLAUDE.md +2 -2
- package/.bkit/shared/GEMINI.md +2 -2
- package/.bkit/shared/docs/architecture.md +1 -1
- package/.bkit/shared/docs/data-schema.md +1 -1
- package/.bkit/shared/docs/deployments.md +11 -11
- package/.bkit/shared/docs/design.md +1 -1
- package/.bkit/shared/docs/noise.md +1 -1
- package/.bkit/shared/docs/observability.md +2 -2
- package/.bkit/shared/docs/security.md +1 -1
- package/.bkit/shared/docs/setup.md +1 -1
- package/.bkit/shared/docs/technology.md +1 -1
- package/.bkit/shared/docs/testing.md +16 -7
- package/.bkit/templates/.claude/hooks/bkit-cloud-bootstrap.sh +1 -1
- package/.bkit/templates/.github/ISSUE_TEMPLATE/bkit-change.yml +26 -5
- package/.bkit/templates/.github/workflows/bkit-ci.yml +1 -1
- package/.bkit/templates/.github/workflows/bkit-cloud.yml +21 -19
- package/.bkit/templates/.husky/pre-push +4 -4
- package/.bkit/templates/.prettierignore +7 -0
- package/.bkit/templates/scripts/cleanup/bkit-disk-prune.mjs +1 -1
- package/CHANGELOG.md +112 -0
- package/README.md +50 -35
- package/dist/checks/after/ci-yml.js +39 -28
- package/dist/checks/after/github.js +91 -17
- package/dist/checks/after/index.js +11 -8
- package/dist/checks/after/suppression.js +8 -5
- package/dist/checks/after/tools.js +39 -82
- package/dist/checks/before/env.js +2 -2
- package/dist/checks/before/files.js +5 -3
- package/dist/checks/before/index.js +15 -2
- package/dist/checks/before/repo.js +163 -2
- package/dist/checks/tips/catalogue.js +14 -5
- package/dist/checks/tips/detect.js +32 -0
- package/dist/checks/tips/index.js +4 -4
- package/dist/cli.js +19 -47
- package/dist/commands/analysis.js +109 -100
- package/dist/commands/ci/ci.js +6 -6
- package/dist/commands/comply.js +54 -91
- package/dist/commands/install/doctor.js +2 -2
- package/dist/commands/install/install.js +50 -19
- package/dist/commands/install/uninstall.js +59 -28
- package/dist/commands/land.js +16 -12
- package/dist/commands/lib.js +51 -16
- package/dist/commands/registry.js +4 -0
- package/dist/commands/setup/setup.js +7 -7
- package/dist/commands/stats.js +136 -0
- package/dist/commands/tips.js +7 -3
- package/dist/commands/workflow/branches.js +656 -56
- package/dist/commands/workflow/challenge.js +556 -0
- package/dist/commands/workflow/context.js +709 -30
- package/dist/commands/workflow/counters.js +208 -75
- package/dist/commands/workflow/decisions.js +441 -0
- package/dist/commands/workflow/disk.js +2 -2
- package/dist/commands/workflow/fids.js +689 -33
- package/dist/commands/workflow/issues.js +343 -59
- package/dist/commands/workflow/ledgers.js +762 -27
- package/dist/commands/workflow/locks.js +24 -2
- package/dist/commands/workflow/plan-blocks.js +437 -0
- package/dist/commands/workflow/plan-versions.js +22 -0
- package/dist/commands/workflow/prs.js +142 -32
- package/dist/commands/workflow/repo.js +52 -8
- package/dist/commands/workflow/roadmap.js +9 -7
- package/dist/commands/workflow/run-facts.js +426 -0
- package/dist/commands/workflow/runs.js +144 -43
- package/dist/commands/workflow/runtime.js +12 -1
- package/dist/commands/workflow/status.js +130 -29
- package/dist/commands/workflow/step-table.js +276 -0
- package/dist/commands/workflow/steps.js +171 -80
- package/dist/commands/workflow/summary.js +275 -0
- package/dist/commands/workflow/tests.js +834 -136
- package/dist/commands/workflow/tracker.js +983 -0
- package/dist/commands/workflow/workflows.js +834 -195
- package/dist/commands/workflow/workstreams.js +11 -5
- package/dist/commands/workflow/worktrees.js +147 -9
- package/dist/install/manifest.js +11 -9
- package/dist/install/modules/cloud.js +22 -13
- package/dist/install/modules/core.js +247 -3
- package/dist/install/modules/opencode.js +2 -2
- package/dist/install/version-file.js +6 -2
- package/dist/ledgers/migrate.js +81 -0
- package/dist/ledgers/status.js +61 -8
- package/dist/ledgers/telemetry.js +905 -124
- package/dist/render/hosts.js +4 -0
- package/dist/render/models.js +12 -0
- package/dist/shared/branches.js +3 -1
- package/dist/shared/egress.js +7 -0
- package/dist/shared/json.js +20 -7
- package/dist/shared/settings.js +125 -17
- package/dist/shared/text.js +333 -0
- package/dist/tools/grammar-density.js +183 -0
- package/dist/tools/instructions-sources.js +721 -0
- package/dist/tools/instructions.js +1579 -0
- package/package.json +113 -24
- package/.bkit/core/engine/commands/harvest.ts +0 -459
- package/.bkit/core/engine/tools/wording.ts +0 -748
- package/.bkit/core/prompts/bkit-build-challenge-reconcile.md +0 -69
- package/.bkit/core/prompts/bkit-build-challenge-remediate.md +0 -71
- package/.bkit/core/prompts/bkit-build-challenge-tests.md +0 -74
- package/.bkit/core/prompts/bkit-build-summary.md +0 -94
- package/.bkit/core/prompts/bkit-debug-summary.md +0 -96
- package/.bkit/core/prompts/bkit-design-summary.md +0 -107
- package/.bkit/core/prompts/bkit-plan-complexity-check.md +0 -67
- package/.bkit/core/prompts/bkit-plan-complexity-split.md +0 -88
- package/.bkit/core/prompts/bkit-plan-review-3.md +0 -93
- package/.bkit/core/prompts/bkit-plan-scope-check-1.md +0 -85
- package/.bkit/core/prompts/bkit-plan-scope-check-2.md +0 -85
- package/.bkit/core/prompts/bkit-plan-summary.md +0 -107
- package/.bkit/core/prompts/bkit-ship-summary.md +0 -78
- package/dist/commands/harvest.js +0 -353
- package/dist/tools/wording.js +0 -680
|
@@ -9,10 +9,13 @@
|
|
|
9
9
|
import * as fs from "node:fs";
|
|
10
10
|
import * as path from "node:path";
|
|
11
11
|
import { readBkitConfig } from "../../shared/settings.js";
|
|
12
|
-
import { appendLine, statusTimestamp } from "../../ledgers/status.js";
|
|
13
|
-
import { bodySkipToken, CommandError, DEV, EXIT, ghUnavailable, git, isSharedBranch, parseJson, repoRoot, runGh, runGit, SKIP_CI_TOKEN, } from "../lib.js";
|
|
12
|
+
import { actionHash, actionKey, alreadyDone, appendLine, recordAction, runNumber, statusTimestamp, } from "../../ledgers/status.js";
|
|
13
|
+
import { bodySkipToken, CommandError, DEV, EXIT, ghUnavailable, git, isSharedBranch, MAIN, parseJson, repoRoot, runGh, runGit, SKIP_CI_TOKEN, } from "../lib.js";
|
|
14
|
+
import { fidProblem } from "./fids.js";
|
|
14
15
|
import { AUTO_LABEL, AUTO_ROUTE_SUFFIX } from "./issues.js";
|
|
15
|
-
import {
|
|
16
|
+
import { resolveOwnerRepo } from "./repo.js";
|
|
17
|
+
import { writeBodyFile } from "./tracker.js";
|
|
18
|
+
import { EXIT_NO_STATUS, FILE_FLAG, readRuns, readStatusRows, statusFile, str } from "./status.js";
|
|
16
19
|
// ---------------------------------------------------------------------------
|
|
17
20
|
// gh
|
|
18
21
|
// ---------------------------------------------------------------------------
|
|
@@ -111,29 +114,19 @@ function refFlag(value, flag) {
|
|
|
111
114
|
// ---------------------------------------------------------------------------
|
|
112
115
|
// open
|
|
113
116
|
// ---------------------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
none: /^[a-z0-9][a-z0-9-]*$/,
|
|
120
|
-
};
|
|
121
|
-
const ISSUE_FORMAT = {
|
|
122
|
-
github: /^[0-9]+$/,
|
|
123
|
-
linear: /^[A-Z]+-[0-9]+$/,
|
|
124
|
-
jira: /^[A-Z][A-Z0-9]+-[0-9]+$/,
|
|
125
|
-
};
|
|
126
|
-
/** The PR-body marker line for this tracker (`.bkit/trackers.md` `pr-body-marker`). */
|
|
117
|
+
/**
|
|
118
|
+
* The PR-body marker line for this tracker (`.bkit/trackers.md` `pr-body-marker`). With
|
|
119
|
+
* no issue the marker is FID-only (`<!-- bkit:fid={FID} -->`, the `none` shape) and the
|
|
120
|
+
* FID any slug; with an issue, the FID must embed that same issue id.
|
|
121
|
+
*/
|
|
127
122
|
export function prMarker(tracker, fid, issue) {
|
|
128
|
-
if (!FID_FORMAT[tracker].test(fid)) {
|
|
129
|
-
throw new CommandError(EXIT.USAGE, `--fid "${fid}" is not a ${tracker} FID slug`);
|
|
130
|
-
}
|
|
131
|
-
if (tracker === "none")
|
|
132
|
-
return `<!-- bkit:fid=${fid} -->`;
|
|
133
123
|
const id = (issue ?? "").replace(/^#/, "");
|
|
134
|
-
|
|
135
|
-
|
|
124
|
+
const problem = fidProblem(fid, tracker, id);
|
|
125
|
+
if (problem !== undefined) {
|
|
126
|
+
throw new CommandError(EXIT.USAGE, `--fid "${fid}" / --issue "${issue ?? ""}": ${problem}`);
|
|
136
127
|
}
|
|
128
|
+
if (tracker === "none" || id === "")
|
|
129
|
+
return `<!-- bkit:fid=${fid} -->`;
|
|
137
130
|
return tracker === "github"
|
|
138
131
|
? `<!-- bkit:issue=#${id} bkit:fid=${fid} -->`
|
|
139
132
|
: `<!-- bkit:issue=${id} bkit:fid=${fid} -->`;
|
|
@@ -145,10 +138,15 @@ export function prBody(marker, notes, plan) {
|
|
|
145
138
|
.join("\n")
|
|
146
139
|
.concat("\n");
|
|
147
140
|
}
|
|
141
|
+
/** The CI marker `branches force-build` puts on the PR title; `prs merge` drops it from the squash subject. */
|
|
142
|
+
export const FORCE_BUILD = "[force build]";
|
|
143
|
+
const FORCE_BUILD_TAG = / ?(bkit )?\[force build\]/g;
|
|
148
144
|
export const EXIT_PR_EXISTS = 3;
|
|
149
145
|
export const EXIT_SKIP_CI_TITLE = 4;
|
|
150
146
|
export const EXIT_GH_FAILED = 5;
|
|
151
147
|
export const EXIT_WRONG_BASE = 6;
|
|
148
|
+
/** Exit code (open): `--base=main` — bkit never opens a PR into `main`. */
|
|
149
|
+
export const EXIT_BASE_MAIN = 7;
|
|
152
150
|
/** Open (or, with `existing: "reuse"`, reuse) the PR for `head`; `code` is the verb's exit code. */
|
|
153
151
|
export function openPrFor(cwd, o, log) {
|
|
154
152
|
const tracker = readBkitConfig(repoRoot(cwd)).issueTracker;
|
|
@@ -164,6 +162,11 @@ export function openPrFor(cwd, o, log) {
|
|
|
164
162
|
return { code: EXIT_SKIP_CI_TITLE, out: null };
|
|
165
163
|
}
|
|
166
164
|
const base = refFlag(o.base ?? DEV, "base");
|
|
165
|
+
// `refs/heads/main`, `origin/main` and `heads/main` name the same branch for gh.
|
|
166
|
+
if (base.replace(/^(?:refs\/)?(?:heads\/|remotes\/)?(?:origin\/)?/, "") === MAIN) {
|
|
167
|
+
log(`refusing to open a PR into ${MAIN}: bkit opens PRs into ${DEV} only, releases stay manual`);
|
|
168
|
+
return { code: EXIT_BASE_MAIN, out: null };
|
|
169
|
+
}
|
|
167
170
|
const head = o.head === undefined ? currentBranch(cwd) : refFlag(o.head, "head");
|
|
168
171
|
if (head === base || isSharedBranch(head)) {
|
|
169
172
|
throw new CommandError(EXIT.USAGE, `refusing to open a PR from "${head}" into "${base}"`);
|
|
@@ -178,7 +181,17 @@ export function openPrFor(cwd, o, log) {
|
|
|
178
181
|
log(`${why} — create the PR through the GitHub MCP tool with this title and body`);
|
|
179
182
|
return {
|
|
180
183
|
code: EXIT.USE_MCP,
|
|
181
|
-
out: {
|
|
184
|
+
out: {
|
|
185
|
+
created: false,
|
|
186
|
+
useMcp: true,
|
|
187
|
+
number: null,
|
|
188
|
+
url: null,
|
|
189
|
+
base,
|
|
190
|
+
head,
|
|
191
|
+
title,
|
|
192
|
+
body,
|
|
193
|
+
bodyFile: writeBodyFile(cwd, "pr-body", body),
|
|
194
|
+
},
|
|
182
195
|
};
|
|
183
196
|
};
|
|
184
197
|
const existing = probePr(cwd, { head, base, state: "open" });
|
|
@@ -253,6 +266,26 @@ export function openPrFor(cwd, o, log) {
|
|
|
253
266
|
return { code: EXIT.OK, out };
|
|
254
267
|
}
|
|
255
268
|
function openPr(ctx) {
|
|
269
|
+
const fileFlag = str(ctx.flags.file);
|
|
270
|
+
const workflow = str(ctx.flags.workflow);
|
|
271
|
+
if (fileFlag !== undefined && workflow === undefined) {
|
|
272
|
+
throw new CommandError(EXIT.USAGE, "--file needs --workflow");
|
|
273
|
+
}
|
|
274
|
+
// A recorded open of this head into this base makes the PR now open on it this run's own.
|
|
275
|
+
let existing = str(ctx.flags.existing);
|
|
276
|
+
let action;
|
|
277
|
+
if (fileFlag !== undefined && workflow !== undefined) {
|
|
278
|
+
const file = path.resolve(ctx.cwd, fileFlag);
|
|
279
|
+
const head = str(ctx.flags.head) ?? currentBranch(ctx.cwd);
|
|
280
|
+
const run = fs.existsSync(file) ? runNumber(readRuns(file), workflow) : 1;
|
|
281
|
+
action = {
|
|
282
|
+
file,
|
|
283
|
+
key: actionKey(workflow, run, "pr-open"),
|
|
284
|
+
hash: actionHash(`${head}\n${str(ctx.flags.base) ?? DEV}`),
|
|
285
|
+
};
|
|
286
|
+
if (alreadyDone(action.file, action.key, action.hash))
|
|
287
|
+
existing = "reuse";
|
|
288
|
+
}
|
|
256
289
|
const r = openPrFor(ctx.cwd, {
|
|
257
290
|
fid: String(ctx.flags.fid),
|
|
258
291
|
title: String(ctx.flags.title),
|
|
@@ -261,8 +294,16 @@ function openPr(ctx) {
|
|
|
261
294
|
head: str(ctx.flags.head),
|
|
262
295
|
plan: str(ctx.flags.plan),
|
|
263
296
|
notes: ctx.flags.note ?? [],
|
|
264
|
-
existing
|
|
297
|
+
existing,
|
|
265
298
|
}, ctx.log);
|
|
299
|
+
if (action && r.code === EXIT.OK && r.out?.created === true) {
|
|
300
|
+
recordAction(action.file, {
|
|
301
|
+
action: "pr-open",
|
|
302
|
+
key: action.key,
|
|
303
|
+
hash: action.hash,
|
|
304
|
+
ref: r.out.url,
|
|
305
|
+
});
|
|
306
|
+
}
|
|
266
307
|
if (r.out)
|
|
267
308
|
ctx.emit(r.out);
|
|
268
309
|
return r.code;
|
|
@@ -272,9 +313,13 @@ function openPr(ctx) {
|
|
|
272
313
|
// ---------------------------------------------------------------------------
|
|
273
314
|
/** Exit code (merge --expect-merged): the PR did not reach MERGED. */
|
|
274
315
|
export const EXIT_NOT_MERGED = 7;
|
|
316
|
+
/** Exit code (merge): the PR's base is not `dev`, or could not be read — nothing merged. */
|
|
317
|
+
export const EXIT_BASE_NOT_DEV = 8;
|
|
275
318
|
/**
|
|
276
319
|
* Squash-merge a PR with an explicit empty body (never the default concatenated
|
|
277
|
-
* subjects), unless it is already MERGED, then read the state back.
|
|
320
|
+
* subjects), unless it is already MERGED, then read the state back. A PR whose base
|
|
321
|
+
* (read by the same `pr view` that reads its state) is not `dev`, or is unreadable, is
|
|
322
|
+
* never merged (EXIT_BASE_NOT_DEV). gh missing →
|
|
278
323
|
* EXIT.USE_MCP (merge through `merge_pull_request` with `subject`).
|
|
279
324
|
*/
|
|
280
325
|
export function mergePr(cwd, o, log) {
|
|
@@ -305,6 +350,10 @@ export function mergePr(cwd, o, log) {
|
|
|
305
350
|
}
|
|
306
351
|
if (before.pr?.state === "MERGED")
|
|
307
352
|
return result(EXIT.OK, before.pr, true);
|
|
353
|
+
if (before.pr?.baseRefName !== DEV) {
|
|
354
|
+
log(`refusing to merge PR ${o.number}: its base is ${before.pr?.baseRefName ?? "unknown"}, not ${DEV} — bkit merges into ${DEV} only, releases stay manual`);
|
|
355
|
+
return result(EXIT_BASE_NOT_DEV, before.pr, false);
|
|
356
|
+
}
|
|
308
357
|
const args = ["pr", "merge", o.number, "--squash", "--subject", o.subject, "--body", ""];
|
|
309
358
|
if (o.deleteBranch === true)
|
|
310
359
|
args.push("--delete-branch");
|
|
@@ -322,15 +371,58 @@ export function mergePr(cwd, o, log) {
|
|
|
322
371
|
log(after.message);
|
|
323
372
|
return result(EXIT_GH_FAILED, undefined, false);
|
|
324
373
|
}
|
|
374
|
+
// A retarget between the base check and the merge is caught here, loudly.
|
|
375
|
+
if (after.pr?.state === "MERGED" && after.pr.baseRefName !== DEV) {
|
|
376
|
+
log(`INTEGRITY FAILURE: PR ${o.number} merged into ${after.pr.baseRefName ?? "an unknown base"}, not ${DEV} — its base changed after the check; revert the merge`);
|
|
377
|
+
const r = result(EXIT_BASE_NOT_DEV, after.pr, false);
|
|
378
|
+
return { ...r, out: { ...r.out, verdict: "FAIL", failures: 1 } };
|
|
379
|
+
}
|
|
325
380
|
return result(EXIT.OK, after.pr, false);
|
|
326
381
|
}
|
|
382
|
+
/** Whether dev demands status checks (ruleset or branch protection): CI must then pass at the PR head. */
|
|
383
|
+
export function devRequiresChecks(gh, repo) {
|
|
384
|
+
const rules = gh(["api", `repos/${repo}/rules/branches/dev`]);
|
|
385
|
+
const read = rules.ok ? parseJson(rules.stdout) : { ok: false };
|
|
386
|
+
const list = read.ok && Array.isArray(read.value) ? read.value : [];
|
|
387
|
+
const hasCheckRule = list.some((r) => r !== null &&
|
|
388
|
+
typeof r === "object" &&
|
|
389
|
+
r.type === "required_status_checks");
|
|
390
|
+
if (hasCheckRule)
|
|
391
|
+
return true;
|
|
392
|
+
return gh(["api", `repos/${repo}/branches/dev/protection/required_status_checks`]).ok;
|
|
393
|
+
}
|
|
327
394
|
/**
|
|
328
395
|
* Request a server-side base-into-head refresh (ship Step 4 B1). GitHub authors
|
|
329
396
|
* the merge commit, so bkit cannot set its message and there is no local head to
|
|
330
397
|
* read back — ship's Step 9 poll observes the new head. gh missing →
|
|
331
398
|
* EXIT.USE_MCP (route through `update_pull_request_branch`).
|
|
399
|
+
*
|
|
400
|
+
* `onlyIfRequired`: refresh only when dev requires status checks. Otherwise the
|
|
401
|
+
* PR merges at the head CI already passed at, and the dev push run tests the
|
|
402
|
+
* merged result — a refresh would only re-run CI on the same feature change.
|
|
332
403
|
*/
|
|
333
|
-
export function updateBranch(cwd, number, log) {
|
|
404
|
+
export function updateBranch(cwd, number, log, o = {}) {
|
|
405
|
+
if (o.onlyIfRequired === true) {
|
|
406
|
+
const repo = resolveOwnerRepo(cwd)?.ownerRepo;
|
|
407
|
+
let ghMissing = false;
|
|
408
|
+
const gh = (args) => {
|
|
409
|
+
const res = runGh(cwd, args);
|
|
410
|
+
if (ghUnavailable(res))
|
|
411
|
+
ghMissing = true;
|
|
412
|
+
return res;
|
|
413
|
+
};
|
|
414
|
+
const required = repo === undefined || devRequiresChecks(gh, repo);
|
|
415
|
+
if (ghMissing) {
|
|
416
|
+
log("gh unavailable to read dev's required checks — update the branch through update_pull_request_branch");
|
|
417
|
+
return { code: EXIT.USE_MCP, out: null };
|
|
418
|
+
}
|
|
419
|
+
if (!required) {
|
|
420
|
+
log(`dev requires no status checks — PR ${number} merges at the head CI passed at; the dev push run tests the merged result`);
|
|
421
|
+
return { code: EXIT.OK, out: { number, updated: false } };
|
|
422
|
+
}
|
|
423
|
+
if (repo === undefined)
|
|
424
|
+
log("cannot resolve the repo to read dev's required checks — updating");
|
|
425
|
+
}
|
|
334
426
|
const res = runGh(cwd, ["pr", "update-branch", number]);
|
|
335
427
|
if (ghUnavailable(res)) {
|
|
336
428
|
log("gh unavailable for gh pr update-branch — update the branch through update_pull_request_branch");
|
|
@@ -615,22 +707,30 @@ export const prsCommand = {
|
|
|
615
707
|
type: "string",
|
|
616
708
|
help: "an open PR already on --head: fail (default, exit 3) | reuse",
|
|
617
709
|
},
|
|
710
|
+
{
|
|
711
|
+
name: "file",
|
|
712
|
+
type: "string",
|
|
713
|
+
help: "status.jsonl: record the open as an engine-action row; a re-run this run reuses that PR (needs --workflow)",
|
|
714
|
+
},
|
|
715
|
+
{ name: "workflow", type: "string", help: "--file: the workflow, for the run number" },
|
|
618
716
|
],
|
|
619
717
|
output: {
|
|
620
718
|
created: "true when this run created the PR",
|
|
621
|
-
useMcp: "true when gh is unavailable: create it through MCP with title/
|
|
719
|
+
useMcp: "true when gh is unavailable: create it through MCP with title/base/head and the body read from bodyFile",
|
|
622
720
|
number: "PR number, or null",
|
|
623
721
|
url: "PR URL, or null",
|
|
624
722
|
base: "base branch (read back from the PR when created)",
|
|
625
723
|
head: "head branch",
|
|
626
724
|
title: "PR title",
|
|
627
725
|
body: "PR body, marker first",
|
|
726
|
+
bodyFile: "useMcp only: absolute path of a file holding `body` byte-for-byte (the MCP fallback reads it); absent otherwise",
|
|
628
727
|
},
|
|
629
728
|
exitCodes: {
|
|
630
729
|
[EXIT_PR_EXISTS]: "--head already has an open PR (with --existing=fail)",
|
|
631
730
|
[EXIT_SKIP_CI_TITLE]: "the title carries a CI-suppressing token",
|
|
632
731
|
[EXIT_GH_FAILED]: "gh errored (probe, create after one retry, or read-back)",
|
|
633
732
|
[EXIT_WRONG_BASE]: "the created PR's base is not --base",
|
|
733
|
+
[EXIT_BASE_MAIN]: `--base is ${MAIN}: bkit opens PRs into ${DEV} only (no gh call made)`,
|
|
634
734
|
},
|
|
635
735
|
run: (ctx) => {
|
|
636
736
|
const existing = str(ctx.flags.existing);
|
|
@@ -716,6 +816,7 @@ export const prsCommand = {
|
|
|
716
816
|
exitCodes: {
|
|
717
817
|
[EXIT_GH_FAILED]: "gh could not read the PR",
|
|
718
818
|
[EXIT_NOT_MERGED]: "--expect-merged and the PR did not reach MERGED",
|
|
819
|
+
[EXIT_BASE_NOT_DEV]: `the PR's base is not ${DEV}, or could not be read — nothing merged`,
|
|
719
820
|
},
|
|
720
821
|
run: (ctx) => {
|
|
721
822
|
const number = String(ctx.flags.number);
|
|
@@ -732,7 +833,7 @@ export const prsCommand = {
|
|
|
732
833
|
ctx.log(pr.kind === "failed" ? pr.message : `PR #${number} not found`);
|
|
733
834
|
return EXIT_GH_FAILED;
|
|
734
835
|
}
|
|
735
|
-
subject = `${pr.pr.title} (#${number})`;
|
|
836
|
+
subject = `${pr.pr.title.replace(FORCE_BUILD_TAG, "")} (#${number})`;
|
|
736
837
|
}
|
|
737
838
|
if ((ctx.flags.label ?? []).includes(AUTO_LABEL))
|
|
738
839
|
subject += AUTO_ROUTE_SUFFIX;
|
|
@@ -750,10 +851,17 @@ export const prsCommand = {
|
|
|
750
851
|
},
|
|
751
852
|
"update-branch": {
|
|
752
853
|
summary: "Refresh a PR's head from its base server-side (exit 80: use update_pull_request_branch).",
|
|
753
|
-
flags: [
|
|
854
|
+
flags: [
|
|
855
|
+
{ name: "number", type: "string", required: true, help: "the PR number" },
|
|
856
|
+
{
|
|
857
|
+
name: "only-if-required",
|
|
858
|
+
type: "boolean",
|
|
859
|
+
help: "skip the update (updated: false) when dev requires no status checks",
|
|
860
|
+
},
|
|
861
|
+
],
|
|
754
862
|
output: {
|
|
755
863
|
number: "the PR number",
|
|
756
|
-
updated: "the update request succeeded (true even when already up to date)",
|
|
864
|
+
updated: "the update request succeeded (true even when already up to date); false when --only-if-required skipped it",
|
|
757
865
|
},
|
|
758
866
|
exitCodes: {
|
|
759
867
|
[EXIT_GH_FAILED]: "gh could not update the branch (403 = actions:write scope)",
|
|
@@ -762,7 +870,9 @@ export const prsCommand = {
|
|
|
762
870
|
const number = String(ctx.flags.number);
|
|
763
871
|
if (!/^[1-9][0-9]*$/.test(number))
|
|
764
872
|
throw new CommandError(EXIT.USAGE, "--number must be a PR number");
|
|
765
|
-
const r = updateBranch(ctx.cwd, number, ctx.log
|
|
873
|
+
const r = updateBranch(ctx.cwd, number, ctx.log, {
|
|
874
|
+
onlyIfRequired: ctx.flags.onlyIfRequired === true,
|
|
875
|
+
});
|
|
766
876
|
if (r.out)
|
|
767
877
|
ctx.emit(r.out);
|
|
768
878
|
return r.code;
|
|
@@ -6,10 +6,11 @@
|
|
|
6
6
|
// workflows already describe: "parse git remote"). The current branch, how far it
|
|
7
7
|
// trails `origin/dev`, the main checkout, the bkit binary every later block calls,
|
|
8
8
|
// and whether that bkit is behind the newest release ride along so Step 1 is one call.
|
|
9
|
+
import { randomBytes } from "node:crypto";
|
|
9
10
|
import * as fs from "node:fs";
|
|
10
11
|
import * as path from "node:path";
|
|
11
12
|
import { parseRemoteUrlToSlug } from "../../ledgers/telemetry.js";
|
|
12
|
-
import { DEV, EXIT, git, repoRoot, runGit, runTool } from "../lib.js";
|
|
13
|
+
import { DEV, EXIT, git, outboxRoot, repoRoot, runGit, runTool } from "../lib.js";
|
|
13
14
|
import { bkitVersionStatus } from "../../shared/bkit-latest.js";
|
|
14
15
|
import { readBkitConfig, trackerScope } from "../../shared/settings.js";
|
|
15
16
|
/** Exit code: neither gh nor the origin remote named an owner/repo. */
|
|
@@ -26,9 +27,14 @@ export function resolveOwnerRepo(cwd) {
|
|
|
26
27
|
const gh = runTool("gh", ["repo", "view", "--json", "nameWithOwner", "--jq", ".nameWithOwner"], cwd);
|
|
27
28
|
if (gh.status === 0 && splitSlug(gh.stdout))
|
|
28
29
|
return { ownerRepo: gh.stdout.trim(), source: "gh" };
|
|
30
|
+
const slug = originOwnerRepo(cwd);
|
|
31
|
+
return slug === null ? null : { ownerRepo: slug, source: "remote" };
|
|
32
|
+
}
|
|
33
|
+
/** `owner/repo` from the `origin` remote URL alone (no network); null when origin names none. */
|
|
34
|
+
export function originOwnerRepo(cwd) {
|
|
29
35
|
const url = git(cwd, ["remote", "get-url", "origin"]);
|
|
30
36
|
const slug = url ? parseRemoteUrlToSlug(url) : "";
|
|
31
|
-
return splitSlug(slug) ?
|
|
37
|
+
return splitSlug(slug) ? slug : null;
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* How far HEAD trails `origin/dev`, from whatever was last fetched. null when
|
|
@@ -80,6 +86,33 @@ export function actionsPermissionsReadable(cwd, ownerRepo) {
|
|
|
80
86
|
.at(-1) ?? "";
|
|
81
87
|
return { readable: res.found && res.status === 0, status: res.status, detail };
|
|
82
88
|
}
|
|
89
|
+
/** Session folders older than this are pruned by `repo info`. */
|
|
90
|
+
export const SESSION_TTL_MS = 7 * 86_400_000;
|
|
91
|
+
const SESSION_NAME = /^(\d{4})(\d{2})(\d{2})T(\d{2})(\d{2})(\d{2})Z-[0-9a-f]+$/;
|
|
92
|
+
/**
|
|
93
|
+
* Creates `<outboxRoot>/sessions/<utc-time>-<random>/` and prunes session folders
|
|
94
|
+
* whose name stamps them older than {@link SESSION_TTL_MS}. Folders named any
|
|
95
|
+
* other way are left alone.
|
|
96
|
+
*/
|
|
97
|
+
export function newSessionDir(outboxRoot, now = new Date()) {
|
|
98
|
+
const sessions = path.join(outboxRoot, "sessions");
|
|
99
|
+
fs.mkdirSync(sessions, { recursive: true });
|
|
100
|
+
for (const name of fs.readdirSync(sessions)) {
|
|
101
|
+
const m = SESSION_NAME.exec(name);
|
|
102
|
+
if (!m)
|
|
103
|
+
continue;
|
|
104
|
+
const at = Date.UTC(+m[1], +m[2] - 1, +m[3], +m[4], +m[5], +m[6]);
|
|
105
|
+
if (now.getTime() - at > SESSION_TTL_MS)
|
|
106
|
+
fs.rmSync(path.join(sessions, name), { recursive: true, force: true });
|
|
107
|
+
}
|
|
108
|
+
const stamp = now
|
|
109
|
+
.toISOString()
|
|
110
|
+
.replace(/[-:]/g, "")
|
|
111
|
+
.replace(/\.\d{3}/, "");
|
|
112
|
+
const dir = path.join(sessions, `${stamp}-${randomBytes(4).toString("hex")}`);
|
|
113
|
+
fs.mkdirSync(dir);
|
|
114
|
+
return dir;
|
|
115
|
+
}
|
|
83
116
|
export const repoCommand = {
|
|
84
117
|
noun: "repo",
|
|
85
118
|
summary: "Repo facts for Step 1: owner/repo, current branch, and how far it trails dev.",
|
|
@@ -109,14 +142,18 @@ export const repoCommand = {
|
|
|
109
142
|
repoRoot: "the main checkout (the same from any worktree)",
|
|
110
143
|
bkit: "the bkit binary the workflow blocks call: <repoRoot>/node_modules/.bin/bkit, else `bkit` on PATH",
|
|
111
144
|
outboxRoot: "<git common dir>/bkit-outbox: per-run scratch files, never committed",
|
|
145
|
+
sessionDir: "<outboxRoot>/sessions/<utc-time>-<random>/: a new, empty folder per call for this run's prompt.md and issue files; folders older than 7 days are pruned",
|
|
112
146
|
bkitVersion: ".bkit/version pinnedVersion: the release this repo's bkit files came from (null when unpinned)",
|
|
113
147
|
bkitLatest: "newest published @cbartens/bkit, asked at most once a day (null when offline, opted out via BKIT_NO_UPDATE_CHECK, or unpinned)",
|
|
114
148
|
bkitOutdated: "true when bkitVersion is older than bkitLatest (null when either is unknown)",
|
|
115
149
|
bkitAdvisory: "one line to show the user when bkitOutdated, else null",
|
|
116
|
-
trackerTeam: "package.json bkit.linear.team under linear, else null",
|
|
117
|
-
trackerProject: "package.json bkit.linear.project under linear, bkit.jira.project under jira, else null",
|
|
118
|
-
trackerSite: "package.json bkit.jira.site under jira (the MCP cloudId), else null",
|
|
119
|
-
trackerBoard: "{ownerType, owner, number} read from package.json bkit.github.project under github, else null",
|
|
150
|
+
trackerTeam: "package.json bkit.tracker.linear.team under linear, else null",
|
|
151
|
+
trackerProject: "package.json bkit.tracker.linear.project under linear, bkit.tracker.jira.project under jira, else null",
|
|
152
|
+
trackerSite: "package.json bkit.tracker.jira.site under jira (the MCP cloudId), else null",
|
|
153
|
+
trackerBoard: "{ownerType, owner, number} read from package.json bkit.tracker.github.project under github, else null",
|
|
154
|
+
trackerProgress: "the state an issue moves to when work starts: package.json bkit.tracker.<tracker>.progress for the wired tracker, at its default when unset (github `In progress`, linear `started`, jira `In Progress`); null under none",
|
|
155
|
+
trackerReview: "the state an issue moves to when it is handed to a human: package.json bkit.tracker.<tracker>.review for the wired tracker, at its default when unset (github `In review`, linear `In Review`, jira `In Review`); null under none",
|
|
156
|
+
tasks: "{maxPerGroup, maxTestsPerGroup, maxTestsPerTask, maxTestFilesPerTask}: the plan caps from package.json bkit.workflows.tasks, each missing or invalid key at its default",
|
|
120
157
|
},
|
|
121
158
|
exitCodes: {
|
|
122
159
|
[EXIT_NO_REPO]: "neither gh nor the origin remote named an owner/repo",
|
|
@@ -149,6 +186,9 @@ export const repoCommand = {
|
|
|
149
186
|
const latest = bkitVersionStatus(root, common);
|
|
150
187
|
if (latest.advisory !== null)
|
|
151
188
|
ctx.log(latest.advisory);
|
|
189
|
+
const outbox = outboxRoot(ctx.cwd) ?? path.join(root, ".git", "bkit-outbox");
|
|
190
|
+
const config = readBkitConfig(root);
|
|
191
|
+
const states = config.issueTracker === "none" ? null : config[config.issueTracker];
|
|
152
192
|
ctx.emit({
|
|
153
193
|
...resolved,
|
|
154
194
|
owner,
|
|
@@ -157,12 +197,16 @@ export const repoCommand = {
|
|
|
157
197
|
...behind,
|
|
158
198
|
repoRoot: root,
|
|
159
199
|
bkit: resolveBkitBinary(root),
|
|
160
|
-
outboxRoot:
|
|
200
|
+
outboxRoot: outbox,
|
|
201
|
+
sessionDir: newSessionDir(outbox),
|
|
161
202
|
bkitVersion: latest.version,
|
|
162
203
|
bkitLatest: latest.latest,
|
|
163
204
|
bkitOutdated: latest.outdated,
|
|
164
205
|
bkitAdvisory: latest.advisory,
|
|
165
|
-
...trackerScope(
|
|
206
|
+
...trackerScope(config),
|
|
207
|
+
trackerProgress: states?.progress ?? null,
|
|
208
|
+
trackerReview: states?.review ?? null,
|
|
209
|
+
tasks: config.tasks,
|
|
166
210
|
});
|
|
167
211
|
if (branch === null && ctx.flags.allowDetached !== true) {
|
|
168
212
|
ctx.log("HEAD is detached — no current branch");
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
// a bad ledger or an unwritable board, and never gates the caller's close.
|
|
17
17
|
import * as fs from "node:fs";
|
|
18
18
|
import * as path from "node:path";
|
|
19
|
-
import { compareTs, parse, resolveRepoSlug, validate } from "../../ledgers/telemetry.js";
|
|
19
|
+
import { SCHEMA, compareTs, mintTs, parse, resolveRepoSlug, validate, } from "../../ledgers/telemetry.js";
|
|
20
20
|
import { readBkitVersion } from "../../install/version-file.js";
|
|
21
21
|
import { CommandError, DEV, EXIT, git, parseJson, repoRoot, runGit, } from "../lib.js";
|
|
22
22
|
import { landDir, pushToDev } from "../land.js";
|
|
@@ -42,7 +42,7 @@ export const MARKERS = {
|
|
|
42
42
|
const ANALYSIS_PLACEHOLDER = "_(no analysis yet; run @bkit-utility-update-roadmap to populate)_";
|
|
43
43
|
const NOTES_PRE_PLACEHOLDER = "## Notes\n\n_(above the bkit list — yours, never overwritten)_";
|
|
44
44
|
const NOTES_POST_PLACEHOLDER = "## Notes\n\n_(end of the board — yours, never overwritten)_";
|
|
45
|
-
const BANNER = "> Generated tables — do not hand-edit the `bkit` tables; append to `.bkit/issues.jsonl` instead (an `ABANDONED` row hides a FID from every section). `## Notes` blocks are yours and are never overwritten. Everything above the first marker is also yours. notes-post is last. Analysis list length: `package.json` key `bkit.roadmapNext` (positive integer; absent or invalid → 25).";
|
|
45
|
+
const BANNER = "> Generated tables — do not hand-edit the `bkit` tables; append to `.bkit/issues.jsonl` instead (an `ABANDONED` row hides a FID from every section). `## Notes` blocks are yours and are never overwritten. Everything above the first marker is also yours. notes-post is last. Analysis list length: `package.json` key `bkit.prompts.roadmapNext` (positive integer; absent or invalid → 25).";
|
|
46
46
|
/** Fixed related-utilities line; `@bkit-audit-generate` ends every run with the same text. */
|
|
47
47
|
export const RELATED_UTILITIES = "> Related utilities, run on demand: `@bkit-utility-update-roadmap` ranks the next best items in `docs/roadmap.md`; `@bkit-utility-update-tracker` brings tracker issues in line with the tracker rules; `@bkit-utility-update-deferrals` and `@bkit-utility-update-failures` close ledger rows the code already resolved; `@bkit-utility-update-decisions`, `@bkit-utility-update-knowledge` and `@bkit-utility-update-documentation` correct ledgers and docs the code has since contradicted.";
|
|
48
48
|
/** Newest SHIPPED rows on the board; older ones stay in the ledger. */
|
|
@@ -264,13 +264,15 @@ function fold(ctx) {
|
|
|
264
264
|
export function featureRow(root, o) {
|
|
265
265
|
const phase = o.workflow.charAt(0).toUpperCase() + o.workflow.slice(1);
|
|
266
266
|
return {
|
|
267
|
-
|
|
267
|
+
schema: SCHEMA,
|
|
268
|
+
ts: mintTs(),
|
|
268
269
|
kind: "feature",
|
|
269
|
-
repo: resolveRepoSlug(root) || "unknown/repo",
|
|
270
|
-
bkitVersion: readBkitVersion(path.join(root, ".bkit", "version"))?.pinnedVersion || "unknown",
|
|
271
|
-
workflow: o.workflow,
|
|
272
|
-
step: o.step,
|
|
273
270
|
key: o.fid,
|
|
271
|
+
repo: resolveRepoSlug(root) || "unknown/repo",
|
|
272
|
+
bkit: {
|
|
273
|
+
version: readBkitVersion(path.join(root, ".bkit", "version"))?.pinnedVersion || "unknown",
|
|
274
|
+
},
|
|
275
|
+
by: { workflow: o.workflow, step: o.step },
|
|
274
276
|
category: "agentic",
|
|
275
277
|
description: `${phase} closed for ${o.fid}`,
|
|
276
278
|
status: o.status,
|