@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
|
@@ -1,33 +1,32 @@
|
|
|
1
|
-
// commands/analysis.ts —
|
|
1
|
+
// commands/analysis.ts — the computations behind `bkit stats` (commands/stats.ts) and the
|
|
2
|
+
// cross-repo section of the harvest report (scripts/harvest/, bkit's checkout only).
|
|
2
3
|
//
|
|
3
4
|
// Provides:
|
|
4
5
|
// 1. Counts/rates/elapsed-time over telemetry rows.
|
|
5
|
-
// 2. Size↔outcome regression (
|
|
6
|
-
//
|
|
7
|
-
// 3. Dispatch-size threshold computation
|
|
8
|
-
// 4. `
|
|
9
|
-
// (model-self-report
|
|
6
|
+
// 2. Size↔outcome regression (error rate per `lines.total.added` bucket) over
|
|
7
|
+
// `kind:"outcome"` rows.
|
|
8
|
+
// 3. Dispatch-size threshold computation, printed by `bkit stats` and the harvest report.
|
|
9
|
+
// 4. `counter.source` trust labelling: each outcome row is joined to its `counter` row
|
|
10
|
+
// (model-self-report or shell-bus).
|
|
10
11
|
// 5. Per-rule compliance rate over `kind:"compliance"` rows.
|
|
11
|
-
// 6. Per-`
|
|
12
|
+
// 6. Per-`bkit.version` release-attributed regression.
|
|
12
13
|
//
|
|
13
|
-
//
|
|
14
|
-
// installed; PRs closed >= `--since` date; fields: additions, deletions, changedFiles,
|
|
15
|
-
// commits count (for correctiveCommits proxy). Model-self-report counterSource.
|
|
14
|
+
// Rows are read folded, so rows written without `schema` arrive in the current shape.
|
|
16
15
|
//
|
|
17
16
|
// All computation is advisory + inform-only; never gates any workflow.
|
|
18
17
|
// See DE-34 for the shared-entrypoint + crash-isolation contract.
|
|
19
18
|
|
|
20
|
-
import * as fs from "node:fs";
|
|
21
|
-
import * as path from "node:path";
|
|
22
19
|
import {
|
|
20
|
+
AGENT_CONTEXT_CAP,
|
|
23
21
|
UNJUSTIFIED_REASON,
|
|
24
22
|
foldFrom,
|
|
23
|
+
type CompliancePayload,
|
|
25
24
|
type CounterPayload,
|
|
25
|
+
type DeferralPayload,
|
|
26
26
|
type OutcomePayload,
|
|
27
27
|
type TelemetryEnvelope,
|
|
28
28
|
type TelemetryEvent,
|
|
29
29
|
} from "../ledgers/telemetry.js";
|
|
30
|
-
import { HARVEST_DEST_DIR } from "./harvest.js";
|
|
31
30
|
|
|
32
31
|
// ---------------------------------------------------------------------------
|
|
33
32
|
// Types
|
|
@@ -36,18 +35,11 @@ import { HARVEST_DEST_DIR } from "./harvest.js";
|
|
|
36
35
|
/** A `kind:"outcome"` ledger row: the shared envelope plus the outcome payload. */
|
|
37
36
|
export type OutcomeRow = TelemetryEnvelope & OutcomePayload;
|
|
38
37
|
|
|
39
|
-
/** A `kind:"counter"` ledger row; `
|
|
38
|
+
/** A `kind:"counter"` ledger row; `counter.source` lives here, never on the outcome row. */
|
|
40
39
|
export type CounterRow = TelemetryEnvelope & CounterPayload;
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
repo: string;
|
|
45
|
-
bkitVersion: string;
|
|
46
|
-
rule: string;
|
|
47
|
-
result: "pass" | "fail" | "n/a";
|
|
48
|
-
phase: string;
|
|
49
|
-
parentSha: string;
|
|
50
|
-
}
|
|
41
|
+
/** A `kind:"compliance"` ledger row. */
|
|
42
|
+
export type ComplianceRow = TelemetryEnvelope & CompliancePayload;
|
|
51
43
|
|
|
52
44
|
// ---------------------------------------------------------------------------
|
|
53
45
|
// Counts / rates summary
|
|
@@ -67,7 +59,8 @@ export function computeCounts(events: TelemetryEvent[]): TelemetryCounts {
|
|
|
67
59
|
|
|
68
60
|
for (const ev of events) {
|
|
69
61
|
byKind[ev.kind] = (byKind[ev.kind] ?? 0) + 1;
|
|
70
|
-
|
|
62
|
+
const workflow = ev.by?.workflow ?? "unknown";
|
|
63
|
+
byWorkflow[workflow] = (byWorkflow[workflow] ?? 0) + 1;
|
|
71
64
|
byRepo[ev.repo] = (byRepo[ev.repo] ?? 0) + 1;
|
|
72
65
|
}
|
|
73
66
|
|
|
@@ -80,43 +73,118 @@ export function computeCounts(events: TelemetryEvent[]): TelemetryCounts {
|
|
|
80
73
|
|
|
81
74
|
export interface ElapsedStats {
|
|
82
75
|
count: number;
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
totalMinutes: number;
|
|
77
|
+
meanMinutes: number;
|
|
78
|
+
minMinutes: number;
|
|
79
|
+
maxMinutes: number;
|
|
80
|
+
p50Minutes: number;
|
|
88
81
|
}
|
|
89
82
|
|
|
83
|
+
/** Over the rows that carry `time.totalMinutes`. */
|
|
90
84
|
export function computeElapsedStats(rows: OutcomeRow[]): ElapsedStats {
|
|
91
|
-
|
|
85
|
+
const durations = rows
|
|
86
|
+
.map((r) => r.time?.totalMinutes)
|
|
87
|
+
.filter((m): m is number => typeof m === "number")
|
|
88
|
+
.sort((a, b) => a - b);
|
|
89
|
+
if (durations.length === 0) {
|
|
92
90
|
return {
|
|
93
91
|
count: 0,
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
totalMinutes: 0,
|
|
93
|
+
meanMinutes: 0,
|
|
94
|
+
minMinutes: 0,
|
|
95
|
+
maxMinutes: 0,
|
|
96
|
+
p50Minutes: 0,
|
|
99
97
|
};
|
|
100
98
|
}
|
|
101
|
-
const durations = rows.map((r) => r.durationSeconds).sort((a, b) => a - b);
|
|
102
99
|
const total = durations.reduce((s, v) => s + v, 0);
|
|
103
|
-
const p50 = durations[Math.floor(durations.length / 2)] ?? 0;
|
|
104
100
|
return {
|
|
105
|
-
count:
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
101
|
+
count: durations.length,
|
|
102
|
+
totalMinutes: total,
|
|
103
|
+
meanMinutes: total / durations.length,
|
|
104
|
+
minMinutes: durations[0] ?? 0,
|
|
105
|
+
maxMinutes: durations[durations.length - 1] ?? 0,
|
|
106
|
+
p50Minutes: durations[Math.floor(durations.length / 2)] ?? 0,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// ---------------------------------------------------------------------------
|
|
111
|
+
// Build challenge size gate
|
|
112
|
+
// ---------------------------------------------------------------------------
|
|
113
|
+
|
|
114
|
+
export interface ChallengeGateCounts {
|
|
115
|
+
/** Build runs whose challenge block carries a size gate. */
|
|
116
|
+
runs: number;
|
|
117
|
+
/** Small changes: challenge-2 ran alone. */
|
|
118
|
+
small: number;
|
|
119
|
+
/** Large changes: both reviewers ran. */
|
|
120
|
+
large: number;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Over the outcome rows whose `build.challenge.gate` is set. */
|
|
124
|
+
export function computeChallengeGate(rows: OutcomeRow[]): ChallengeGateCounts {
|
|
125
|
+
const out: ChallengeGateCounts = { runs: 0, small: 0, large: 0 };
|
|
126
|
+
for (const r of rows) {
|
|
127
|
+
const gate = r.build?.challenge?.gate;
|
|
128
|
+
if (gate === undefined) continue;
|
|
129
|
+
out.runs++;
|
|
130
|
+
if (gate.skipped) out.small++;
|
|
131
|
+
else out.large++;
|
|
132
|
+
}
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export interface AgentContextEntry {
|
|
137
|
+
agent: string;
|
|
138
|
+
/** Subagents of this type, over every run. */
|
|
139
|
+
subagents: number;
|
|
140
|
+
/** Workflow runs that started one. */
|
|
141
|
+
runs: number;
|
|
142
|
+
/** The largest context any of them reached, tokens. */
|
|
143
|
+
peak: number;
|
|
144
|
+
/** Workflow runs in which one of them went past `cap`. */
|
|
145
|
+
overCap: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface AgentContextReport {
|
|
149
|
+
cap: number;
|
|
150
|
+
/** Outcome rows read, and those carrying a `context` block. */
|
|
151
|
+
outcomes: number;
|
|
152
|
+
recorded: number;
|
|
153
|
+
/** By agent type, largest peak first. */
|
|
154
|
+
byAgent: AgentContextEntry[];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** Each agent type's context peak over the outcome rows' `context` blocks, against `cap`. */
|
|
158
|
+
export function computeAgentContext(
|
|
159
|
+
rows: OutcomeRow[],
|
|
160
|
+
cap: number = AGENT_CONTEXT_CAP,
|
|
161
|
+
): AgentContextReport {
|
|
162
|
+
const by: Record<string, AgentContextEntry> = {};
|
|
163
|
+
let recorded = 0;
|
|
164
|
+
for (const r of rows) {
|
|
165
|
+
if (r.context === undefined) continue;
|
|
166
|
+
recorded++;
|
|
167
|
+
for (const [agent, a] of Object.entries(r.context.byAgent)) {
|
|
168
|
+
const e = (by[agent] ??= { agent, subagents: 0, runs: 0, peak: 0, overCap: 0 });
|
|
169
|
+
e.subagents += a.runs;
|
|
170
|
+
e.runs++;
|
|
171
|
+
e.peak = Math.max(e.peak, a.peak);
|
|
172
|
+
if (a.peak > cap) e.overCap++;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
cap,
|
|
177
|
+
outcomes: rows.length,
|
|
178
|
+
recorded,
|
|
179
|
+
byAgent: Object.values(by).sort((a, b) => b.peak - a.peak || a.agent.localeCompare(b.agent)),
|
|
111
180
|
};
|
|
112
181
|
}
|
|
113
182
|
|
|
114
183
|
// ---------------------------------------------------------------------------
|
|
115
184
|
// Size↔outcome regression
|
|
116
185
|
//
|
|
117
|
-
//
|
|
118
|
-
//
|
|
119
|
-
// "Error" = ciTrySuccess > 1 OR correctiveCommits > 0 OR reviewIterations > 1 OR failures > 0.
|
|
186
|
+
// Error rate per `lines.total.added` bucket. "Error" = the run added failures
|
|
187
|
+
// (`ledgers.failures.repo` rose against the previous run of the repo).
|
|
120
188
|
// ---------------------------------------------------------------------------
|
|
121
189
|
|
|
122
190
|
export interface SizeBucket {
|
|
@@ -132,13 +200,13 @@ export interface RegressionResult {
|
|
|
132
200
|
buckets: SizeBucket[];
|
|
133
201
|
/**
|
|
134
202
|
* Dispatch-size threshold: the bucket where error rate first exceeds 50%,
|
|
135
|
-
* or the largest bucket if no bucket does.
|
|
203
|
+
* or the largest bucket if no bucket does. Printed by `bkit stats` and the harvest report.
|
|
136
204
|
*/
|
|
137
205
|
dispatchSizeThreshold: number;
|
|
138
206
|
/**
|
|
139
207
|
* Trust tier split: an outcome row is shell-bus when a `counter` row with the same
|
|
140
|
-
* repo + workflow + parentSha carries `
|
|
141
|
-
* deterministic); every other outcome row is model-self-report (
|
|
208
|
+
* repo + workflow + run.parentSha carries `counter.source: "shell-bus"`
|
|
209
|
+
* (deterministic); every other outcome row is model-self-report (untrusted).
|
|
142
210
|
*/
|
|
143
211
|
shellBusCount: number;
|
|
144
212
|
modelSelfReportCount: number;
|
|
@@ -156,7 +224,7 @@ const SIZE_BUCKETS: Array<{ label: string; min: number; max: number }> = [
|
|
|
156
224
|
/**
|
|
157
225
|
* Per-run NEW failures = this row's cumulative total minus the previous row's.
|
|
158
226
|
*
|
|
159
|
-
* `
|
|
227
|
+
* `ledgers.failures.repo` is the repo's CUMULATIVE distinct-failure count at close.
|
|
160
228
|
*
|
|
161
229
|
* Previous = the newest outcome row for the SAME repo strictly before this one; the
|
|
162
230
|
* first row for a repo has no predecessor, so its total IS its delta.
|
|
@@ -167,29 +235,25 @@ export function newFailuresThisRun(row: OutcomeRow, allRows: OutcomeRow[]): numb
|
|
|
167
235
|
const previous = allRows
|
|
168
236
|
.filter((r) => r.repo === row.repo && r.ts < row.ts)
|
|
169
237
|
.sort((a, b) => b.ts - a.ts)[0];
|
|
170
|
-
|
|
171
|
-
|
|
238
|
+
const failures = (r: OutcomeRow) => r.ledgers?.failures?.repo ?? 0;
|
|
239
|
+
if (!previous) return failures(row);
|
|
240
|
+
return Math.max(0, failures(row) - failures(previous));
|
|
172
241
|
}
|
|
173
242
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
(row.ciTrySuccess !== undefined && row.ciTrySuccess > 1) ||
|
|
177
|
-
(row.correctiveCommits !== undefined && row.correctiveCommits > 0) ||
|
|
178
|
-
(row.reviewIterations !== undefined && row.reviewIterations > 1) ||
|
|
179
|
-
newFailuresThisRun(row, allRows) > 0
|
|
180
|
-
);
|
|
181
|
-
}
|
|
243
|
+
const isErrorRun = (row: OutcomeRow, allRows: OutcomeRow[]): boolean =>
|
|
244
|
+
newFailuresThisRun(row, allRows) > 0;
|
|
182
245
|
|
|
183
246
|
/** Identity of one workflow run: the key the close writes on both its counter and outcome rows. */
|
|
184
|
-
function runKey(row:
|
|
185
|
-
|
|
247
|
+
function runKey(row: TelemetryEnvelope & { run?: { parentSha?: string } }): string | undefined {
|
|
248
|
+
const sha = row.run?.parentSha;
|
|
249
|
+
return sha ? JSON.stringify([row.repo, row.by?.workflow, sha]) : undefined;
|
|
186
250
|
}
|
|
187
251
|
|
|
188
252
|
export function computeRegression(rows: OutcomeRow[], counterRows: CounterRow[]): RegressionResult {
|
|
189
253
|
const shellBusRuns = new Set<string>();
|
|
190
254
|
for (const c of counterRows) {
|
|
191
255
|
const key = runKey(c);
|
|
192
|
-
if (c.
|
|
256
|
+
if (c.counter?.source === "shell-bus" && key !== undefined) shellBusRuns.add(key);
|
|
193
257
|
}
|
|
194
258
|
|
|
195
259
|
const buckets: SizeBucket[] = SIZE_BUCKETS.map((b) => ({
|
|
@@ -213,8 +277,8 @@ export function computeRegression(rows: OutcomeRow[], counterRows: CounterRow[])
|
|
|
213
277
|
modelSelfReportCount++;
|
|
214
278
|
}
|
|
215
279
|
|
|
216
|
-
// Bucket by
|
|
217
|
-
const lines = row.
|
|
280
|
+
// Bucket by lines added
|
|
281
|
+
const lines = row.lines?.total?.added ?? 0;
|
|
218
282
|
for (const bucket of buckets) {
|
|
219
283
|
if (lines >= bucket.minLines && lines <= bucket.maxLines) {
|
|
220
284
|
bucket.count++;
|
|
@@ -269,13 +333,14 @@ export function computeComplianceRates(rows: ComplianceRow[]): ComplianceRuleRat
|
|
|
269
333
|
> = {};
|
|
270
334
|
|
|
271
335
|
for (const row of rows) {
|
|
272
|
-
|
|
273
|
-
|
|
336
|
+
const id = row.rule?.id ?? "unknown";
|
|
337
|
+
if (!byRule[id]) {
|
|
338
|
+
byRule[id] = { passCount: 0, failCount: 0, naCount: 0, totalCount: 0 };
|
|
274
339
|
}
|
|
275
|
-
const r = byRule[
|
|
340
|
+
const r = byRule[id]!;
|
|
276
341
|
r.totalCount++;
|
|
277
|
-
if (row.
|
|
278
|
-
else if (row.
|
|
342
|
+
if (row.rule?.verdict === "pass") r.passCount++;
|
|
343
|
+
else if (row.rule?.verdict === "fail") r.failCount++;
|
|
279
344
|
else r.naCount++;
|
|
280
345
|
}
|
|
281
346
|
|
|
@@ -287,11 +352,11 @@ export function computeComplianceRates(rows: ComplianceRow[]): ComplianceRuleRat
|
|
|
287
352
|
}
|
|
288
353
|
|
|
289
354
|
// ---------------------------------------------------------------------------
|
|
290
|
-
// Per-
|
|
355
|
+
// Per-bkit.version compliance trend (release-attributed regression)
|
|
291
356
|
// ---------------------------------------------------------------------------
|
|
292
357
|
|
|
293
358
|
export interface VersionComplianceEntry {
|
|
294
|
-
|
|
359
|
+
version: string;
|
|
295
360
|
passRate: number;
|
|
296
361
|
totalRuns: number;
|
|
297
362
|
}
|
|
@@ -299,18 +364,19 @@ export interface VersionComplianceEntry {
|
|
|
299
364
|
export function computeVersionCompliance(rows: ComplianceRow[]): VersionComplianceEntry[] {
|
|
300
365
|
const byVersion: Record<string, { pass: number; total: number }> = {};
|
|
301
366
|
for (const row of rows) {
|
|
302
|
-
|
|
303
|
-
|
|
367
|
+
const version = row.bkit?.version ?? "unknown";
|
|
368
|
+
if (!byVersion[version]) byVersion[version] = { pass: 0, total: 0 };
|
|
369
|
+
const v = byVersion[version]!;
|
|
304
370
|
v.total++;
|
|
305
|
-
if (row.
|
|
371
|
+
if (row.rule?.verdict === "pass") v.pass++;
|
|
306
372
|
}
|
|
307
373
|
return Object.entries(byVersion)
|
|
308
|
-
.map(([
|
|
309
|
-
|
|
374
|
+
.map(([version, { pass, total }]) => ({
|
|
375
|
+
version,
|
|
310
376
|
passRate: total > 0 ? pass / total : 0,
|
|
311
377
|
totalRuns: total,
|
|
312
378
|
}))
|
|
313
|
-
.sort((a, b) => a.
|
|
379
|
+
.sort((a, b) => a.version.localeCompare(b.version, undefined, { numeric: true }));
|
|
314
380
|
}
|
|
315
381
|
|
|
316
382
|
// ---------------------------------------------------------------------------
|
|
@@ -318,22 +384,10 @@ export function computeVersionCompliance(rows: ComplianceRow[]): VersionComplian
|
|
|
318
384
|
// ---------------------------------------------------------------------------
|
|
319
385
|
|
|
320
386
|
/**
|
|
321
|
-
* One folded `kind:"deferral"` entity. `subagent` + `model` are absent on rows an
|
|
387
|
+
* One folded `kind:"deferral"` entity. `by.subagent` + `by.model` are absent on rows an
|
|
322
388
|
* orchestrator wrote directly (`.bkit/jsonl.md` § Who Wrote It).
|
|
323
389
|
*/
|
|
324
|
-
export
|
|
325
|
-
ts: number;
|
|
326
|
-
repo: string;
|
|
327
|
-
bkitVersion: string;
|
|
328
|
-
key?: string;
|
|
329
|
-
workflow?: string;
|
|
330
|
-
step?: string;
|
|
331
|
-
subagent?: string;
|
|
332
|
-
model?: string;
|
|
333
|
-
reason?: string;
|
|
334
|
-
severity?: string;
|
|
335
|
-
status?: string;
|
|
336
|
-
}
|
|
390
|
+
export type DeferralRow = TelemetryEnvelope & Partial<DeferralPayload>;
|
|
337
391
|
|
|
338
392
|
export interface DeferralDisciplineEntry {
|
|
339
393
|
/** The writer: subagent name, or the workflow that wrote the row itself. */
|
|
@@ -369,8 +423,8 @@ export function computeDeferralDiscipline(rows: DeferralRow[]): DeferralDiscipli
|
|
|
369
423
|
|
|
370
424
|
for (const row of rows) {
|
|
371
425
|
const writer =
|
|
372
|
-
row.subagent ?? (row.workflow ? `${row.workflow} (orchestrator)` : "unattributed");
|
|
373
|
-
const model = row.model ?? "unknown";
|
|
426
|
+
row.by?.subagent ?? (row.by?.workflow ? `${row.by.workflow} (orchestrator)` : "unattributed");
|
|
427
|
+
const model = row.by?.model ?? "unknown";
|
|
374
428
|
const id = `${writer}\u0000${model}`;
|
|
375
429
|
if (!byWriter[id])
|
|
376
430
|
byWriter[id] = { writer, model, total: 0, unjustifiedCount: 0, byReason: {} };
|
|
@@ -410,12 +464,18 @@ export interface AnalysisReport {
|
|
|
410
464
|
complianceRates: ComplianceRuleRate[];
|
|
411
465
|
versionCompliance: VersionComplianceEntry[];
|
|
412
466
|
deferralDiscipline: DeferralDisciplineEntry[];
|
|
467
|
+
challengeGate: ChallengeGateCounts;
|
|
468
|
+
agentContext: AgentContextReport;
|
|
413
469
|
reportLines: string[];
|
|
414
470
|
}
|
|
415
471
|
|
|
416
|
-
|
|
472
|
+
/** Analyse the folded rows of `paths`, leaving out rows of `skipKinds`. */
|
|
473
|
+
export function runAnalysis(
|
|
474
|
+
paths: string[],
|
|
475
|
+
skipKinds: ReadonlySet<string> = new Set(),
|
|
476
|
+
): AnalysisReport {
|
|
417
477
|
const { state, rowCount, malformedLineCount } = foldFrom(paths);
|
|
418
|
-
const events = [...state.values()];
|
|
478
|
+
const events = [...state.values()].filter((ev) => !skipKinds.has(ev.kind));
|
|
419
479
|
|
|
420
480
|
const outcomeRows: OutcomeRow[] = [];
|
|
421
481
|
const counterRows: CounterRow[] = [];
|
|
@@ -440,6 +500,8 @@ export function runAnalysis(paths: string[]): AnalysisReport {
|
|
|
440
500
|
const complianceRates = computeComplianceRates(complianceRows);
|
|
441
501
|
const versionCompliance = computeVersionCompliance(complianceRows);
|
|
442
502
|
const deferralDiscipline = computeDeferralDiscipline(deferralRows);
|
|
503
|
+
const challengeGate = computeChallengeGate(outcomeRows);
|
|
504
|
+
const agentContext = computeAgentContext(outcomeRows);
|
|
443
505
|
|
|
444
506
|
const reportLines: string[] = [
|
|
445
507
|
`[bkit-analysis] Telemetry rows: ${rowCount} | malformed: ${malformedLineCount}`,
|
|
@@ -450,13 +512,13 @@ export function runAnalysis(paths: string[]): AnalysisReport {
|
|
|
450
512
|
|
|
451
513
|
if (elapsed.count > 0) {
|
|
452
514
|
reportLines.push(
|
|
453
|
-
`[bkit-analysis] Duration (
|
|
515
|
+
`[bkit-analysis] Duration (min): mean=${elapsed.meanMinutes.toFixed(1)} | p50=${elapsed.p50Minutes.toFixed(1)} | min=${elapsed.minMinutes} | max=${elapsed.maxMinutes}`,
|
|
454
516
|
);
|
|
455
517
|
}
|
|
456
518
|
|
|
457
519
|
// Regression report
|
|
458
520
|
reportLines.push(
|
|
459
|
-
`[bkit-analysis] #183 Size↔outcome regression (dispatch-size threshold: ${regression.dispatchSizeThreshold}
|
|
521
|
+
`[bkit-analysis] #183 Size↔outcome regression (dispatch-size threshold: ${regression.dispatchSizeThreshold} lines added):`,
|
|
460
522
|
);
|
|
461
523
|
for (const b of regression.buckets) {
|
|
462
524
|
if (b.count > 0) {
|
|
@@ -466,9 +528,15 @@ export function runAnalysis(paths: string[]): AnalysisReport {
|
|
|
466
528
|
}
|
|
467
529
|
}
|
|
468
530
|
reportLines.push(
|
|
469
|
-
`[bkit-analysis]
|
|
531
|
+
`[bkit-analysis] counter.source trust: shell-bus=${regression.shellBusCount} (trusted) | model-self-report=${regression.modelSelfReportCount} (untrusted)`,
|
|
470
532
|
);
|
|
471
533
|
|
|
534
|
+
if (challengeGate.runs > 0) {
|
|
535
|
+
reportLines.push(
|
|
536
|
+
`[bkit-analysis] Build challenge size: ${challengeGate.small} small (challenge-1 skipped) | ${challengeGate.large} large, of ${challengeGate.runs} runs`,
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
|
|
472
540
|
// Compliance rates
|
|
473
541
|
if (complianceRates.length > 0) {
|
|
474
542
|
reportLines.push(`[bkit-analysis] Per-rule compliance rates:`);
|
|
@@ -481,10 +549,10 @@ export function runAnalysis(paths: string[]): AnalysisReport {
|
|
|
481
549
|
|
|
482
550
|
// Version compliance
|
|
483
551
|
if (versionCompliance.length > 0) {
|
|
484
|
-
reportLines.push(`[bkit-analysis] Per-
|
|
552
|
+
reportLines.push(`[bkit-analysis] Per-bkit.version compliance:`);
|
|
485
553
|
for (const v of versionCompliance) {
|
|
486
554
|
reportLines.push(
|
|
487
|
-
` v${v.
|
|
555
|
+
` v${v.version}: ${(v.passRate * 100).toFixed(1)}% pass (${v.totalRuns} runs)`,
|
|
488
556
|
);
|
|
489
557
|
}
|
|
490
558
|
}
|
|
@@ -516,45 +584,8 @@ export function runAnalysis(paths: string[]): AnalysisReport {
|
|
|
516
584
|
complianceRates,
|
|
517
585
|
versionCompliance,
|
|
518
586
|
deferralDiscipline,
|
|
587
|
+
challengeGate,
|
|
588
|
+
agentContext,
|
|
519
589
|
reportLines,
|
|
520
590
|
};
|
|
521
591
|
}
|
|
522
|
-
|
|
523
|
-
// analysis — cross-repo analysis CLI.
|
|
524
|
-
// Reports counts/rates/elapsed-time, size↔outcome regression, per-rule compliance
|
|
525
|
-
// rate, dispatch-size threshold, counterSource trust labelling. Advisory + inform-only.
|
|
526
|
-
// See DE-34 for the shared-entrypoint + crash-isolation contract.
|
|
527
|
-
export function runAnalysisCommand(): void {
|
|
528
|
-
try {
|
|
529
|
-
const cwd = process.cwd();
|
|
530
|
-
// Analyse: bkit's own stats.jsonl + harvested consumer rows.
|
|
531
|
-
// Harvest dest is sourced from the constant, NOT re-spelled here.
|
|
532
|
-
const statsPath = path.join(cwd, ".bkit", "stats.jsonl");
|
|
533
|
-
const harvestStatsPath = path.join(cwd, HARVEST_DEST_DIR, "stats.jsonl");
|
|
534
|
-
const harvestFrictionPath = path.join(cwd, HARVEST_DEST_DIR, "friction.jsonl");
|
|
535
|
-
const frictionPath = path.join(cwd, ".bkit", "friction.jsonl");
|
|
536
|
-
// deferrals is LOCAL-only: harvest takes it count-only (prose never leaves the
|
|
537
|
-
// consumer), so the discipline rate is this repo's own writers, not a fleet view.
|
|
538
|
-
const deferralsPath = path.join(cwd, "docs", "deferrals.jsonl");
|
|
539
|
-
const paths = [
|
|
540
|
-
statsPath,
|
|
541
|
-
harvestStatsPath,
|
|
542
|
-
harvestFrictionPath,
|
|
543
|
-
frictionPath,
|
|
544
|
-
deferralsPath,
|
|
545
|
-
].filter((p) => fs.existsSync(p));
|
|
546
|
-
if (paths.length === 0) {
|
|
547
|
-
console.log(
|
|
548
|
-
"[bkit-analysis] No telemetry files found. Run `bkit harvest` first, or accumulate telemetry via bkit workflows.",
|
|
549
|
-
);
|
|
550
|
-
return;
|
|
551
|
-
}
|
|
552
|
-
const report = runAnalysis(paths);
|
|
553
|
-
for (const line of report.reportLines) {
|
|
554
|
-
console.log(line);
|
|
555
|
-
}
|
|
556
|
-
} catch (err: unknown) {
|
|
557
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
558
|
-
console.error(`[bkit-analysis] analysis error (fail-open): ${msg}`);
|
|
559
|
-
}
|
|
560
|
-
}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// `skip-token` — whether a commit message carries a GitHub skip-CI token
|
|
16
16
|
// (`SKIP_CI_TOKEN`), for the `.husky/pre-push` CI-suppressor guard.
|
|
17
17
|
//
|
|
18
|
-
// `min-push` — whether every file a push changes matches `bkit.minPushPaths`, so
|
|
18
|
+
// `min-push` — whether every file a push changes matches `bkit.testing.minPushPaths`, so
|
|
19
19
|
// `.husky/pre-push` runs `bkit:gate:min`. Files decide, never `[skip ci]` (a typed label
|
|
20
20
|
// GitHub reads off the last commit only).
|
|
21
21
|
|
|
@@ -428,7 +428,7 @@ function skipToken(ctx: RunContext): number {
|
|
|
428
428
|
// min-push
|
|
429
429
|
// ---------------------------------------------------------------------------
|
|
430
430
|
|
|
431
|
-
/** `bkit.minPushPaths` as git pathspecs: `:(glob)` unless an entry carries its own magic. */
|
|
431
|
+
/** `bkit.testing.minPushPaths` as git pathspecs: `:(glob)` unless an entry carries its own magic. */
|
|
432
432
|
export const minPushPathspecs = (paths: readonly string[]): string[] =>
|
|
433
433
|
paths.map((p) => (p.startsWith(":") ? p : `:(glob)${p}`));
|
|
434
434
|
|
|
@@ -483,7 +483,7 @@ function minPush(ctx: RunContext): number {
|
|
|
483
483
|
return code;
|
|
484
484
|
};
|
|
485
485
|
if (paths.length === 0) {
|
|
486
|
-
return result("no-paths", EXIT.NO, "bkit.minPushPaths is empty — not a min push");
|
|
486
|
+
return result("no-paths", EXIT.NO, "bkit.testing.minPushPaths is empty — not a min push");
|
|
487
487
|
}
|
|
488
488
|
if (changed.size === 0) {
|
|
489
489
|
return result("no-changes", EXIT.NO, "the push changes no files — not proven a min push");
|
|
@@ -564,7 +564,7 @@ export const ciCommand: CommandSpec = {
|
|
|
564
564
|
},
|
|
565
565
|
"min-push": {
|
|
566
566
|
summary:
|
|
567
|
-
"Exit 0 when every file a push changes matches bkit.minPushPaths (the pre-push light gate).",
|
|
567
|
+
"Exit 0 when every file a push changes matches bkit.testing.minPushPaths (the pre-push light gate).",
|
|
568
568
|
flags: [
|
|
569
569
|
{
|
|
570
570
|
name: "ref",
|
|
@@ -575,11 +575,11 @@ export const ciCommand: CommandSpec = {
|
|
|
575
575
|
{ name: "base", type: "string", help: "start every range here instead" },
|
|
576
576
|
],
|
|
577
577
|
output: {
|
|
578
|
-
minPush: "true when every changed file matches bkit.minPushPaths",
|
|
578
|
+
minPush: "true when every changed file matches bkit.testing.minPushPaths",
|
|
579
579
|
reason: "null when a min push; else no-paths | no-changes | outside | unknown",
|
|
580
580
|
changed: "files the push changes, across every ref",
|
|
581
581
|
outside: "the changed files no min-push path matches",
|
|
582
|
-
paths: "bkit.minPushPaths as read",
|
|
582
|
+
paths: "bkit.testing.minPushPaths as read",
|
|
583
583
|
},
|
|
584
584
|
exitCodes: {
|
|
585
585
|
[EXIT_RANGE_UNKNOWN]: "a pushed commit, its base, or its git diff could not be read",
|