@holmes-lab/holmes-kit 0.40.0 → 0.40.1
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/CHANGELOG.md +234 -0
- package/README.md +70 -4
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/index.js +25 -19
- package/dist/holmes/cli/interactive-prompt.d.ts +39 -2
- package/dist/holmes/cli/interactive-prompt.js +98 -16
- package/dist/holmes/config/config.d.ts +17 -0
- package/dist/holmes/config/config.js +13 -1
- package/dist/holmes/governance/autonomy.d.ts +7 -0
- package/dist/holmes/governance/autonomy.js +36 -5
- package/dist/holmes/governance/push-gate-runner.d.ts +2 -0
- package/dist/holmes/governance/push-gate-runner.js +40 -3
- package/dist/holmes/governance/push-gate.d.ts +13 -2
- package/dist/holmes/governance/push-gate.js +106 -14
- package/dist/holmes/guardrail/advisory-line.d.ts +102 -0
- package/dist/holmes/guardrail/advisory-line.js +718 -0
- package/dist/holmes/guardrail/impact-gate.d.ts +6 -0
- package/dist/holmes/guardrail/impact-gate.js +32 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +11 -0
- package/dist/holmes/hooks/pre-tool-use.js +44 -5
- package/dist/holmes/hooks/session-start.js +17 -1
- package/dist/holmes/mcp/handlers/maintenance-analysis.d.ts +13 -0
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +59 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +470 -3
- package/dist/holmes/mcp/handlers/test-execution.js +199 -21
- package/dist/holmes/mcp/handlers.d.ts +468 -3
- package/dist/holmes/mcp/handlers.js +5 -1
- package/dist/holmes/mcp/maintenance-analyze.d.ts +5 -0
- package/dist/holmes/mcp/maintenance-analyze.js +4 -2
- package/dist/holmes/mcp/maintenance-evidence.d.ts +9 -0
- package/dist/holmes/mcp/maintenance-evidence.js +4 -1
- package/dist/holmes/mcp/tool-schemas.js +13 -7
- package/dist/holmes/project/baseline.d.ts +15 -2
- package/dist/holmes/project/baseline.js +11 -6
- package/dist/holmes/project/bounded-io.d.ts +1 -0
- package/dist/holmes/project/bounded-io.js +4 -2
- package/dist/holmes/project/change-source.d.ts +4 -0
- package/dist/holmes/project/change-source.js +13 -5
- package/dist/holmes/project/root.js +3 -1
- package/dist/holmes/review/evidence-mode.d.ts +21 -0
- package/dist/holmes/review/evidence-mode.js +33 -0
- package/dist/holmes/review/head-worktree.d.ts +55 -0
- package/dist/holmes/review/head-worktree.js +329 -0
- package/dist/holmes/review/mrp.js +13 -3
- package/dist/holmes/review/run-provenance.d.ts +45 -0
- package/dist/holmes/review/run-provenance.js +314 -0
- package/dist/holmes/review/test-evidence.d.ts +174 -0
- package/dist/holmes/review/test-evidence.js +330 -2
- package/dist/holmes/review/test-reports.d.ts +94 -0
- package/dist/holmes/review/test-reports.js +382 -0
- package/dist/holmes/review/test-runner.d.ts +176 -65
- package/dist/holmes/review/test-runner.js +531 -316
- package/dist/holmes/review/test-units.d.ts +159 -0
- package/dist/holmes/review/test-units.js +814 -0
- package/package.json +1 -1
- package/playbooks/publish/PLAYBOOK.md +2 -1
|
@@ -33,13 +33,23 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AUTONOMY_PROMPT_TEXT = void 0;
|
|
36
|
+
exports.terminalAutonomyIO = exports.AUTONOMY_PROMPT_TEXT = void 0;
|
|
37
37
|
exports.parseAgentList = parseAgentList;
|
|
38
38
|
exports.promptAgentSelection = promptAgentSelection;
|
|
39
|
+
exports.autonomyAnswer = autonomyAnswer;
|
|
40
|
+
exports.autonomyQuestion = autonomyQuestion;
|
|
41
|
+
exports.currentAutonomyAt = currentAutonomyAt;
|
|
42
|
+
exports.initUnderHarness = initUnderHarness;
|
|
43
|
+
exports.initAutonomyChoice = initAutonomyChoice;
|
|
44
|
+
exports.resolveInitAutonomy = resolveInitAutonomy;
|
|
39
45
|
exports.promptAutonomy = promptAutonomy;
|
|
40
|
-
// @implements A-SPEC-724, A-SPEC-200
|
|
46
|
+
// @implements A-SPEC-724, A-SPEC-200, A-SPEC-552.2, A-SPEC-552.3, A-SPEC-552.4
|
|
41
47
|
const readline = __importStar(require("node:readline"));
|
|
42
48
|
const agents_1 = require("./agents");
|
|
49
|
+
const autonomy_1 = require("../governance/autonomy");
|
|
50
|
+
const harness_catalog_1 = require("../governance/harness-catalog");
|
|
51
|
+
const operator_person_1 = require("../guardrail/operator-person");
|
|
52
|
+
const verdicts_1 = require("../review/verdicts");
|
|
43
53
|
/**
|
|
44
54
|
* Parses user input or CLI flag string into normalized Agent array.
|
|
45
55
|
*/
|
|
@@ -156,7 +166,7 @@ async function promptAgentSelection(availableAgents = agents_1.AGENTS, currentWi
|
|
|
156
166
|
* The project autonomy-posture prompt. TTY-only (its raw-terminal read is the human-presence proof —
|
|
157
167
|
* an agent's non-TTY Bash cannot reach it, so a `true` here is a human answer, not a self-grant).
|
|
158
168
|
* Non-TTY returns false (leave HITL); the caller does not treat that as an interactive answer.
|
|
159
|
-
*
|
|
169
|
+
* A-SPEC-552.2: Enter means the default — ON for a first install, the current value on a re-init.
|
|
160
170
|
*/
|
|
161
171
|
/**
|
|
162
172
|
* @implements A-SPEC-769.1 — what the prompt says matches the grader (X1, 2026-10-12: the old text said REQ/H-SPEC
|
|
@@ -165,18 +175,90 @@ async function promptAgentSelection(availableAgents = agents_1.AGENTS, currentWi
|
|
|
165
175
|
exports.AUTONOMY_PROMPT_TEXT = '\n 🔑 Autonomous spec approval\n'
|
|
166
176
|
+ ' The agent may self-approve LOW-RISK specs (tests, benign changes). High-risk and irreversible\n'
|
|
167
177
|
+ ' specs (C-SPEC/ADR, gate/security/architecture files, root-only or unbounded Files to Touch)\n'
|
|
168
|
-
+ ' still ask you; a REQ or H-SPEC seals on its own only
|
|
169
|
-
+ ' and a REQ never admitted through requirement_triage always asks
|
|
170
|
-
+ '
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
178
|
+
+ ' and governance-critical ones still ask you; a REQ or H-SPEC seals on its own only\n'
|
|
179
|
+
+ ' when every A-SPEC beneath it is low-risk, and a REQ never admitted through requirement_triage always asks.\n'
|
|
180
|
+
+ ' The default is Y on a first install at your own terminal (recommended since 0.41): only low-risk\n'
|
|
181
|
+
+ ' specs approve themselves. Under an agent harness or CI, Enter keeps the current value (off on a\n'
|
|
182
|
+
+ ' first install). y or yes turns it on; any other answer turns it off.\n'
|
|
183
|
+
+ ' To turn it off later: holmes-kit init --no-autonomy (or remove HOLMES_AUTONOMOUS_APPROVAL from\n'
|
|
184
|
+
+ ' .mcp.json); holmes-kit autonomy off ends session autonomy only.\n';
|
|
185
|
+
/**
|
|
186
|
+
* @implements A-SPEC-552.2, A-SPEC-552.3 — Enter takes the default: the current value, else ON at a person's own
|
|
187
|
+
* terminal and OFF under an agent harness or CI; y/yes and n/no decide; anything else is OFF.
|
|
188
|
+
*/
|
|
189
|
+
function autonomyAnswer(answer, current, underHarness = false) {
|
|
190
|
+
const a = answer.trim().toLowerCase();
|
|
191
|
+
if (a === '')
|
|
192
|
+
return current ?? !underHarness;
|
|
193
|
+
return a === 'y' || a === 'yes';
|
|
194
|
+
}
|
|
195
|
+
/** The question, its brackets naming what Enter means. */
|
|
196
|
+
function autonomyQuestion(current, underHarness = false) {
|
|
197
|
+
return ` Grant autonomous spec approval for this project? ${(current ?? !underHarness) ? '[Y/n]' : '[y/N]'} `;
|
|
198
|
+
}
|
|
199
|
+
/** @implements A-SPEC-552.3 — the target's current posture, read by the runtime's own reader (governance/autonomy). */
|
|
200
|
+
function currentAutonomyAt(target) {
|
|
201
|
+
return (0, autonomy_1.projectAutonomyState)(target);
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* @implements A-SPEC-552.3 — whether init runs where an agent could be answering: an agent harness among its parents
|
|
205
|
+
* (operatorActGuard names one, A-SPEC-102.29) or a CI environment. A pty an agent allocated still has one.
|
|
206
|
+
*/
|
|
207
|
+
function initUnderHarness(target, env = process.env) {
|
|
208
|
+
if (typeof env.CI === 'string' && env.CI !== '' && env.CI !== 'false')
|
|
209
|
+
return true;
|
|
210
|
+
// @implements A-SPEC-552.4 — the given environment's harness markers, over the project's catalog; a catalog that
|
|
211
|
+
// cannot be read counts as a harness (Enter then keeps the value, the safe side)
|
|
212
|
+
try {
|
|
213
|
+
if ((0, verdicts_1.agentHarnessMarker)(env, (0, harness_catalog_1.liveHarnessCatalog)(target)) !== null)
|
|
214
|
+
return true;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return true;
|
|
218
|
+
}
|
|
219
|
+
return (0, operator_person_1.operatorActGuard)('turning on autonomous spec approval with Enter', target) !== null;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @implements A-SPEC-552.2 — init's interactive choice. No TTY asks nothing and decides nothing (`autonomy` undefined:
|
|
223
|
+
* the posture is preserved, A-SPEC-552.1). ON is returned only with `interactive: true`, the proof a person answered.
|
|
224
|
+
*/
|
|
225
|
+
async function initAutonomyChoice(target, io) {
|
|
226
|
+
if (!io.stdinTTY || !io.stdoutTTY)
|
|
227
|
+
return { autonomy: undefined, interactive: false };
|
|
228
|
+
const current = currentAutonomyAt(target);
|
|
229
|
+
io.write(exports.AUTONOMY_PROMPT_TEXT);
|
|
230
|
+
const answer = await io.ask(autonomyQuestion(current, io.underHarness));
|
|
231
|
+
// @implements A-SPEC-552.4 — Enter that keeps a value writes nothing: the posture stays where the runtime reads it,
|
|
232
|
+
// and a switch another server entry holds is never copied into Holmes-Kit's own entry
|
|
233
|
+
if (answer.trim() === '' && current !== undefined)
|
|
234
|
+
return { autonomy: undefined, interactive: false };
|
|
235
|
+
const on = autonomyAnswer(answer, current, io.underHarness);
|
|
236
|
+
return { autonomy: on, interactive: on };
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @implements A-SPEC-552.3 — init's whole autonomy decision, so index.ts makes none of its own: the flags first
|
|
240
|
+
* (`--autonomy` is gated in runInit, `--no-autonomy` is free), then the acts that ask nothing, then the question.
|
|
241
|
+
*/
|
|
242
|
+
async function resolveInitAutonomy(flags, target, io) {
|
|
243
|
+
if (flags.autonomy === true)
|
|
244
|
+
return { autonomy: true, interactive: false };
|
|
245
|
+
if (flags['no-autonomy'] === true)
|
|
246
|
+
return { autonomy: false, interactive: false };
|
|
247
|
+
if (flags['dry-run'] === true || flags.remove === true || flags['no-mcp'] === true)
|
|
248
|
+
return { autonomy: undefined, interactive: false };
|
|
249
|
+
return initAutonomyChoice(target, io);
|
|
250
|
+
}
|
|
251
|
+
/** The real terminal's io for `target`. */
|
|
252
|
+
const terminalAutonomyIO = (target) => ({
|
|
253
|
+
stdinTTY: Boolean(process.stdin.isTTY), stdoutTTY: Boolean(process.stdout.isTTY),
|
|
254
|
+
underHarness: Boolean(process.stdin.isTTY && process.stdout.isTTY) && initUnderHarness(target),
|
|
255
|
+
write: (text) => { process.stdout.write(text); },
|
|
256
|
+
ask: (question) => new Promise((resolve) => {
|
|
175
257
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
258
|
+
rl.question(question, (ans) => { rl.close(); resolve(ans); });
|
|
259
|
+
}),
|
|
260
|
+
});
|
|
261
|
+
exports.terminalAutonomyIO = terminalAutonomyIO;
|
|
262
|
+
async function promptAutonomy(target = process.cwd()) {
|
|
263
|
+
return (await initAutonomyChoice(target, (0, exports.terminalAutonomyIO)(target))).autonomy === true;
|
|
182
264
|
}
|
|
@@ -66,6 +66,23 @@ export interface AxConfig {
|
|
|
66
66
|
};
|
|
67
67
|
/** @implements A-SPEC-781 — a run's stage machine: the stages, the allowed edges, and the stages that need review. */
|
|
68
68
|
stages: StageMachine;
|
|
69
|
+
/**
|
|
70
|
+
* @implements A-SPEC-128.5 — directories test ecosystem detection never walks (vendored or reference trees). Empty when
|
|
71
|
+
* absent; anything that is not an array of strings declares nothing.
|
|
72
|
+
* @implements A-SPEC-128.7 — an entry holding `/` is a root-relative path prefix (`test/fixtures/pyproj`); one without is
|
|
73
|
+
* a directory name at any depth (`pyproj`). A leading `./` and a trailing `/` are ignored.
|
|
74
|
+
* @implements A-SPEC-128.13 — `prepare`: the argv a full run runs in HEAD's worktree before its units (`["npm", "run",
|
|
75
|
+
* "build"]`), no shell. Absent, or anything but a non-empty array of strings, declares none — no prepare is guessed.
|
|
76
|
+
*/
|
|
77
|
+
testRun: {
|
|
78
|
+
excludeDirs: string[];
|
|
79
|
+
prepare?: string[];
|
|
80
|
+
linkWalk?: {
|
|
81
|
+
entries: number;
|
|
82
|
+
seconds: number;
|
|
83
|
+
};
|
|
84
|
+
pythonNames?: number;
|
|
85
|
+
};
|
|
69
86
|
}
|
|
70
87
|
/** @implements A-SPEC-781 */
|
|
71
88
|
/** @implements A-SPEC-781.1 — `deny`: per stage, the classifier actions the gate refuses in a run at that stage. */
|
|
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.DEFAULT_CONFIG = exports.RUN_APPROVAL_WAIT_DEFAULT = exports.RUN_REFUSAL_LIMIT_DEFAULT = exports.DEFAULT_STAGES = void 0;
|
|
37
37
|
exports.loadConfig = loadConfig;
|
|
38
|
-
// @implements A-SPEC-278, A-SPEC-781.2, A-SPEC-476.3
|
|
38
|
+
// @implements A-SPEC-278, A-SPEC-781.2, A-SPEC-476.3, A-SPEC-128.5, A-SPEC-128.7, A-SPEC-128.13
|
|
39
39
|
// @implements A-SPEC-125.5
|
|
40
40
|
// src/holmes/config/config.ts
|
|
41
41
|
const fs = __importStar(require("node:fs"));
|
|
@@ -159,6 +159,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
159
159
|
autonomy: { ceiling: 'default', shellStaging: 'on' },
|
|
160
160
|
run: { refusalRepeatLimit: exports.RUN_REFUSAL_LIMIT_DEFAULT, approvalWaitMinutes: exports.RUN_APPROVAL_WAIT_DEFAULT },
|
|
161
161
|
stages: structuredClone(exports.DEFAULT_STAGES),
|
|
162
|
+
testRun: { excludeDirs: [] },
|
|
162
163
|
};
|
|
163
164
|
function deepMerge(base, ov) {
|
|
164
165
|
if (ov == null || typeof ov !== 'object')
|
|
@@ -223,6 +224,17 @@ function loadConfig(root) {
|
|
|
223
224
|
declaredStages = undefined;
|
|
224
225
|
}
|
|
225
226
|
merged.stages = stageMachineOf(declaredStages);
|
|
227
|
+
// @implements A-SPEC-128.5 — an exclusion list never fails toward wider: only an array of strings excludes anything
|
|
228
|
+
const tr = merged.testRun;
|
|
229
|
+
const ex = tr !== null && typeof tr === 'object' ? tr.excludeDirs : undefined;
|
|
230
|
+
const prep = tr !== null && typeof tr === 'object' ? tr.prepare : undefined;
|
|
231
|
+
const prepare = Array.isArray(prep) && prep.length > 0 && prep.every((x) => typeof x === 'string' && x !== '') ? prep : undefined;
|
|
232
|
+
// @implements A-SPEC-128.16 — W1: linkWalk survives the rebuild when both are positive finite numbers (review A M1)
|
|
233
|
+
const lw = tr !== null && typeof tr === 'object' ? tr.linkWalk : undefined;
|
|
234
|
+
const ok = (n) => typeof n === 'number' && Number.isFinite(n) && n > 0;
|
|
235
|
+
const linkWalk = lw && typeof lw === 'object' && ok(lw.entries) && ok(lw.seconds) ? { entries: lw.entries, seconds: lw.seconds } : undefined;
|
|
236
|
+
merged.testRun = { excludeDirs: Array.isArray(ex) ? ex.filter((x) => typeof x === 'string' && x !== '') : [], ...(prepare ? { prepare } : {}), ...(linkWalk ? { linkWalk } : {}),
|
|
237
|
+
...(Number.isInteger(tr?.pythonNames) && (tr.pythonNames) > 0 ? { pythonNames: tr.pythonNames } : {}) };
|
|
226
238
|
return merged;
|
|
227
239
|
}
|
|
228
240
|
catch {
|
|
@@ -60,6 +60,13 @@ export declare function sessionAutonomyActive(root: string, now: string): boolea
|
|
|
60
60
|
/** Whether autonomous approval is enabled — the out-of-band env switch, OR a valid session envelope
|
|
61
61
|
* (A-SPEC-553.1). `root`/`now` are optional so env-only callers are byte-identical. */
|
|
62
62
|
export declare function projectDefaultAutonomy(root: string): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @implements A-SPEC-552.3 — the project default as init and the runtime both read it, so init's question shows the
|
|
65
|
+
* posture the hooks will act on. `undefined`: no `.mcp.json`, or one with no Holmes-Kit entry and no switch (a first
|
|
66
|
+
* install). `true`: any server's env holds a non-empty switch. `false`: everything else — an unreadable or unparsable
|
|
67
|
+
* file (a BOM included), a wrong shape, or a Holmes-Kit entry without the switch.
|
|
68
|
+
*/
|
|
69
|
+
export declare function projectAutonomyState(root: string): boolean | undefined;
|
|
63
70
|
export declare function autonomousApprovalEnabled(env: NodeJS.ProcessEnv, root?: string, now?: string): boolean;
|
|
64
71
|
/** @implements A-SPEC-792.7 — the full profile covering `root`, as one line (without the banner prefix), or ''. */
|
|
65
72
|
export declare function fullAutonomyLine(root: string, home?: string): string;
|
|
@@ -45,13 +45,14 @@ exports.ceilingRefusal = ceilingRefusal;
|
|
|
45
45
|
exports.requiresAutonomousApprovalPrompt = requiresAutonomousApprovalPrompt;
|
|
46
46
|
exports.sessionAutonomyActive = sessionAutonomyActive;
|
|
47
47
|
exports.projectDefaultAutonomy = projectDefaultAutonomy;
|
|
48
|
+
exports.projectAutonomyState = projectAutonomyState;
|
|
48
49
|
exports.autonomousApprovalEnabled = autonomousApprovalEnabled;
|
|
49
50
|
exports.fullAutonomyLine = fullAutonomyLine;
|
|
50
51
|
exports.autonomyBanner = autonomyBanner;
|
|
51
52
|
exports.autonomyMarkerShouldPrune = autonomyMarkerShouldPrune;
|
|
52
53
|
exports.versionBumpKind = versionBumpKind;
|
|
53
54
|
exports.releaseAutonomy = releaseAutonomy;
|
|
54
|
-
// @implements A-SPEC-794.55, A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4, A-SPEC-532.7, A-SPEC-792.7, A-SPEC-794.47, A-SPEC-794.49
|
|
55
|
+
// @implements A-SPEC-794.55, A-SPEC-552.3, A-SPEC-552.4,A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4, A-SPEC-532.7, A-SPEC-792.7, A-SPEC-794.47, A-SPEC-794.49
|
|
55
56
|
// Whether a spec approval may be sealed AUTONOMOUSLY by the agent, or must still ask a human through
|
|
56
57
|
// the MCP elicitation TUI. The governance chain (REQ→H→A→T→CPG + RTM + taint + phase gate) already
|
|
57
58
|
// forces quality structurally, so a low/mid-risk spec self-approving under an explicitly-enabled
|
|
@@ -354,17 +355,47 @@ function sessionAutonomyActive(root, now) {
|
|
|
354
355
|
// is agent-write-protected, so this opens no self-grant channel; a live read also removes the
|
|
355
356
|
// restart-lag footgun (the owner's edit takes effect at the next hook run).
|
|
356
357
|
function projectDefaultAutonomy(root) {
|
|
358
|
+
return projectAutonomyState(root) === true;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* @implements A-SPEC-552.3 — the project default as init and the runtime both read it, so init's question shows the
|
|
362
|
+
* posture the hooks will act on. `undefined`: no `.mcp.json`, or one with no Holmes-Kit entry and no switch (a first
|
|
363
|
+
* install). `true`: any server's env holds a non-empty switch. `false`: everything else — an unreadable or unparsable
|
|
364
|
+
* file (a BOM included), a wrong shape, or a Holmes-Kit entry without the switch.
|
|
365
|
+
*/
|
|
366
|
+
function projectAutonomyState(root) {
|
|
367
|
+
const file = path.join(root, '.mcp.json');
|
|
368
|
+
// @implements A-SPEC-552.4 — only a file that is not there at all is a first install; a dangling link is there
|
|
369
|
+
try {
|
|
370
|
+
fs.lstatSync(file);
|
|
371
|
+
}
|
|
372
|
+
catch (e) {
|
|
373
|
+
return e.code === 'ENOENT' ? undefined : false;
|
|
374
|
+
}
|
|
375
|
+
let text;
|
|
376
|
+
try {
|
|
377
|
+
text = fs.readFileSync(file, 'utf8');
|
|
378
|
+
}
|
|
379
|
+
catch {
|
|
380
|
+
return false;
|
|
381
|
+
}
|
|
357
382
|
try {
|
|
358
|
-
const parsed = JSON.parse(
|
|
359
|
-
|
|
383
|
+
const parsed = JSON.parse(text);
|
|
384
|
+
if (parsed === null || typeof parsed !== 'object' || Array.isArray(parsed))
|
|
385
|
+
return false;
|
|
386
|
+
const servers = parsed.mcpServers;
|
|
387
|
+
// A-SPEC-552.4 — `{}` and a non-object `mcpServers` (an array included) are odd files, read as OFF
|
|
388
|
+
if (servers === null || typeof servers !== 'object' || Array.isArray(servers))
|
|
389
|
+
return false;
|
|
390
|
+
for (const server of Object.values(servers)) {
|
|
360
391
|
const v = server?.env?.[exports.AUTONOMY_ENV];
|
|
361
392
|
if (typeof v === 'string' && v !== '')
|
|
362
393
|
return true; // same truthiness convention as the env switch
|
|
363
394
|
}
|
|
364
|
-
return false;
|
|
395
|
+
return 'holmes-kit' in servers ? false : undefined;
|
|
365
396
|
}
|
|
366
397
|
catch {
|
|
367
|
-
return false; //
|
|
398
|
+
return false; // an unparsable file is no signal — never a throw, and never a first install
|
|
368
399
|
}
|
|
369
400
|
}
|
|
370
401
|
function autonomousApprovalEnabled(env, root, now) {
|
|
@@ -19,5 +19,7 @@ export interface PrePushIo {
|
|
|
19
19
|
* gate stays fail-open on collection errors, H-SPEC-509).
|
|
20
20
|
*/
|
|
21
21
|
export declare function runPushReviewRefusal(cwd: string, env: NodeJS.ProcessEnv, sha: string): string | null;
|
|
22
|
+
/** @implements A-SPEC-128.8 — the ledger of pushes allowed without evidence (D3); appended, never read by the gate. */
|
|
23
|
+
export declare const NO_EVIDENCE_PUSHES_FILE: string;
|
|
22
24
|
/** Exit code of the hook: 0 = push proceeds, 1 = refused. */
|
|
23
25
|
export declare function runPrePush(io: PrePushIo): 0 | 1;
|
|
@@ -33,10 +33,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.NO_EVIDENCE_PUSHES_FILE = void 0;
|
|
36
37
|
exports.effectiveHooksDir = effectiveHooksDir;
|
|
37
38
|
exports.runPushReviewRefusal = runPushReviewRefusal;
|
|
38
39
|
exports.runPrePush = runPrePush;
|
|
39
|
-
// @implements A-SPEC-509.1, A-SPEC-734, A-SPEC-102.4, A-SPEC-774.21, A-SPEC-102.12
|
|
40
|
+
// @implements A-SPEC-509.1, A-SPEC-734, A-SPEC-102.4, A-SPEC-774.21, A-SPEC-102.12, A-SPEC-128.3, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9
|
|
40
41
|
/**
|
|
41
42
|
* The push gate's IMPURE half: collect (stdin lines, git facts, the evidence ledger) and hand
|
|
42
43
|
* everything to the pure judgePush. Any collection failure ALLOWS — this gate safens the default
|
|
@@ -110,6 +111,23 @@ function runPushReviewRefusal(cwd, env, sha) {
|
|
|
110
111
|
return cannot(e instanceof Error ? e.message : String(e));
|
|
111
112
|
}
|
|
112
113
|
}
|
|
114
|
+
/** @implements A-SPEC-128.8 — the ledger of pushes allowed without evidence (D3); appended, never read by the gate. */
|
|
115
|
+
exports.NO_EVIDENCE_PUSHES_FILE = path.join('.ax', 'ledger', 'no-evidence-pushes.jsonl');
|
|
116
|
+
/**
|
|
117
|
+
* @implements A-SPEC-128.9 — E2: the line is `{ts, head, reason: 'no-tests'}`. False when it could not be written, so the
|
|
118
|
+
* hook can say so; the record is observation and never changes the verdict.
|
|
119
|
+
*/
|
|
120
|
+
function recordNoEvidencePush(cwd, head) {
|
|
121
|
+
try {
|
|
122
|
+
const file = path.join(cwd, exports.NO_EVIDENCE_PUSHES_FILE);
|
|
123
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
124
|
+
fs.appendFileSync(file, JSON.stringify({ ts: new Date().toISOString(), head, reason: 'no-tests' }) + '\n', 'utf8');
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return false;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
113
131
|
/** Exit code of the hook: 0 = push proceeds, 1 = refused. */
|
|
114
132
|
function runPrePush(io) {
|
|
115
133
|
try {
|
|
@@ -119,7 +137,13 @@ function runPrePush(io) {
|
|
|
119
137
|
const hasGovernance = fs.existsSync(path.join(io.cwd, '.ax'));
|
|
120
138
|
if (!hasGovernance)
|
|
121
139
|
return 0; // un-adopted: silent
|
|
122
|
-
|
|
140
|
+
// @implements A-SPEC-128.5 — an existing test-evidence file that is not a record is 'unreadable', never absent
|
|
141
|
+
const full = (0, test_evidence_1.testEvidenceState)(io.cwd);
|
|
142
|
+
const evidence = full.state === 'unreadable' ? 'unreadable' : full.evidence ?? null;
|
|
143
|
+
// @implements A-SPEC-128.3 — read only when there is no full ledger; the judgement stays in judgePush
|
|
144
|
+
// @implements A-SPEC-128.4 — an existing file that is not a record is passed as 'unreadable', never as absent
|
|
145
|
+
const scoped = evidence ? null : (0, test_evidence_1.scopedEvidenceState)(io.cwd);
|
|
146
|
+
const scopedEvidence = !scoped || scoped.state === 'absent' ? null : scoped.state === 'unreadable' ? 'unreadable' : scoped.evidence ?? null;
|
|
123
147
|
let refused = false;
|
|
124
148
|
for (const line of lines) {
|
|
125
149
|
let claimCommits = [];
|
|
@@ -134,9 +158,22 @@ function runPrePush(io) {
|
|
|
134
158
|
});
|
|
135
159
|
}
|
|
136
160
|
catch { /* claim surfacing is optional — judgment inputs stay deterministic */ }
|
|
137
|
-
|
|
161
|
+
// @implements A-SPEC-128.7 — an exception INSIDE the judgement is not a collection failure: the gate could not judge
|
|
162
|
+
// the records it read, so it refuses, naming the exception (a malformed record threw here and the hook exited 0)
|
|
163
|
+
let v;
|
|
164
|
+
try {
|
|
165
|
+
v = (0, push_gate_1.judgePush)({ pushedHead: line.localSha, evidence, hasGovernance, claimCommits, scopedEvidence });
|
|
166
|
+
}
|
|
167
|
+
catch (e) {
|
|
168
|
+
v = { allow: false, notices: [], reason: `[Holmes-Kit push 게이트] 원장 기록을 판정하지 못했습니다(${e instanceof Error ? e.message : String(e)}) — 기록을 새로 쓰십시오. 복구: 현재 HEAD에서 ${push_gate_1.FULL_RUN_CALL}를 실행한 뒤 다시 push하십시오. 의도적 우회는 git push --no-verify.` };
|
|
169
|
+
}
|
|
138
170
|
for (const n of v.notices)
|
|
139
171
|
io.write(n + '\n');
|
|
172
|
+
// @implements A-SPEC-128.8 — D3: a push allowed without evidence is a line in the ledger, not only a notice
|
|
173
|
+
// @implements A-SPEC-128.9 — a ledger line that could not be written is said, not swallowed
|
|
174
|
+
if (v.allow && v.noEvidencePush && !recordNoEvidencePush(io.cwd, line.localSha)) {
|
|
175
|
+
io.write(`[Holmes-Kit] 증빙 없는 push를 원장(${exports.NO_EVIDENCE_PUSHES_FILE})에 기록하지 못했습니다\n`);
|
|
176
|
+
}
|
|
140
177
|
if (!v.allow) {
|
|
141
178
|
io.write((v.reason ?? '[Holmes-Kit push 게이트] 거부') + '\n');
|
|
142
179
|
refused = true;
|
|
@@ -9,12 +9,14 @@
|
|
|
9
9
|
* gates own security). And `git push --no-verify` is git's own escape hatch — respected, not
|
|
10
10
|
* re-litigated: this gate safens the default, it does not take the human's final say.
|
|
11
11
|
*/
|
|
12
|
-
import type
|
|
12
|
+
import { type ScopedEvidence, type TestEvidence } from '../review/test-evidence';
|
|
13
|
+
import { FULL_RUN_CALL } from '../review/evidence-mode';
|
|
13
14
|
/** Identifies OUR installed hook — the single truth doctor and re-install both key on. */
|
|
14
15
|
export declare const PUSH_HOOK_SIGNATURE = "HOLMES-KIT PUSH GATE v1";
|
|
15
16
|
export interface PushJudgeInput {
|
|
16
17
|
pushedHead: string;
|
|
17
|
-
evidence
|
|
18
|
+
/** @implements A-SPEC-128.5 — `'unreadable'`: the test-evidence file exists but is not a record. */
|
|
19
|
+
evidence: TestEvidence | 'unreadable' | null;
|
|
18
20
|
/** `.ax` exists — the repo opted into governance. */
|
|
19
21
|
hasGovernance: boolean;
|
|
20
22
|
/** Commits in the pushed range, for the claim cross-check (surfacing only). */
|
|
@@ -22,11 +24,20 @@ export interface PushJudgeInput {
|
|
|
22
24
|
sha: string;
|
|
23
25
|
subject: string;
|
|
24
26
|
}>;
|
|
27
|
+
/**
|
|
28
|
+
* @implements A-SPEC-128.3 — the record of a run that was not full; read only when there is no test-evidence.
|
|
29
|
+
* @implements A-SPEC-128.4 — `'unreadable'`: the file exists but is not a record.
|
|
30
|
+
*/
|
|
31
|
+
scopedEvidence?: ScopedEvidence | 'unreadable' | null;
|
|
25
32
|
}
|
|
33
|
+
/** @implements A-SPEC-128.4 — the one call that clears a refusal (A-SPEC-128.5: it lives in review/evidence-mode). */
|
|
34
|
+
export { FULL_RUN_CALL };
|
|
26
35
|
export interface PushVerdict {
|
|
27
36
|
allow: boolean;
|
|
28
37
|
reason?: string;
|
|
29
38
|
notices: string[];
|
|
39
|
+
/** @implements A-SPEC-128.8 — D3: allowed without evidence because the root has nothing to run; the runner records it. */
|
|
40
|
+
noEvidencePush?: true;
|
|
30
41
|
}
|
|
31
42
|
export declare function judgePush(input: PushJudgeInput): PushVerdict;
|
|
32
43
|
/**
|
|
@@ -1,10 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PUSH_HOOK_SIGNATURE = void 0;
|
|
3
|
+
exports.FULL_RUN_CALL = exports.PUSH_HOOK_SIGNATURE = void 0;
|
|
4
4
|
exports.judgePush = judgePush;
|
|
5
5
|
exports.parsePushLines = parsePushLines;
|
|
6
|
+
// @implements A-SPEC-509.1, A-SPEC-128.2, A-SPEC-128.3, A-SPEC-128.4, A-SPEC-128.5, A-SPEC-128.6, A-SPEC-128.7, A-SPEC-128.8, A-SPEC-128.9, A-SPEC-128.10, A-SPEC-128.12
|
|
7
|
+
/**
|
|
8
|
+
* The push gate's PURE judgment. A push is the moment a commit becomes other agents' baseline
|
|
9
|
+
* (field basis: a multi-agent regression reached production unguarded), so the default is made
|
|
10
|
+
* safe: the test-evidence ledger must vouch for EXACTLY the head being pushed, green, with real
|
|
11
|
+
* executions. Deterministic facts only — commit-message prose ("전체 스위트 초록") never moves
|
|
12
|
+
* the verdict; an unbacked claim is SURFACED as a notice so the dishonesty is audible.
|
|
13
|
+
*
|
|
14
|
+
* Deliberately NOT a security boundary: collection failures and un-adopted repos pass (the tool
|
|
15
|
+
* gates own security). And `git push --no-verify` is git's own escape hatch — respected, not
|
|
16
|
+
* re-litigated: this gate safens the default, it does not take the human's final say.
|
|
17
|
+
*/
|
|
18
|
+
const test_evidence_1 = require("../review/test-evidence");
|
|
19
|
+
const evidence_mode_1 = require("../review/evidence-mode");
|
|
20
|
+
Object.defineProperty(exports, "FULL_RUN_CALL", { enumerable: true, get: function () { return evidence_mode_1.FULL_RUN_CALL; } });
|
|
6
21
|
/** Identifies OUR installed hook — the single truth doctor and re-install both key on. */
|
|
7
22
|
exports.PUSH_HOOK_SIGNATURE = 'HOLMES-KIT PUSH GATE v1';
|
|
23
|
+
/** @implements A-SPEC-128.2, A-SPEC-128.3, A-SPEC-128.4 — the recovery and escape every refusal carries. */
|
|
24
|
+
const RECOVERY = `복구: 현재 HEAD에서 ${evidence_mode_1.FULL_RUN_CALL}를 초록으로 실행해 원장을 갱신한 뒤 다시 push하십시오. 의도적 우회는 git push --no-verify.`;
|
|
8
25
|
/** Prose that CLAIMS a test success — a surfacing pattern, never a judgment input. */
|
|
9
26
|
const SUCCESS_CLAIM_RE = /초록|green|pass(es|ed)?\b|✅/i;
|
|
10
27
|
// @implements A-SPEC-509.1
|
|
@@ -12,37 +29,112 @@ function judgePush(input) {
|
|
|
12
29
|
if (!input.hasGovernance)
|
|
13
30
|
return { allow: true, notices: [] }; // un-adopted: never coerce adoption
|
|
14
31
|
const notices = [];
|
|
15
|
-
const ev = input.evidence;
|
|
32
|
+
const ev = input.evidence === 'unreadable' ? null : input.evidence;
|
|
16
33
|
// Claim cross-check first — it rides allow AND deny alike.
|
|
17
34
|
for (const c of input.claimCommits) {
|
|
18
35
|
if (!SUCCESS_CLAIM_RE.test(c.subject))
|
|
19
36
|
continue;
|
|
20
|
-
|
|
21
|
-
|
|
37
|
+
// the ledger backs this claim (A-SPEC-128.2: full only; @implements A-SPEC-128.7 — by the one predicate)
|
|
38
|
+
if (ev && (0, test_evidence_1.isPushEvidence)(ev, c.sha))
|
|
39
|
+
continue;
|
|
22
40
|
notices.push(`[Holmes-Kit] 커밋 ${c.sha.slice(0, 7)}의 메시지가 테스트 성공을 주장하지만 test_run 원장이 그 커밋을 뒷받침하지 않습니다: "${flatSubject(c.subject)}"`);
|
|
23
41
|
}
|
|
42
|
+
// @implements A-SPEC-128.5 — an unreadable ledger is a run history the gate cannot read: refused, not the unrun pass
|
|
43
|
+
if (input.evidence === 'unreadable') {
|
|
44
|
+
return {
|
|
45
|
+
allow: false,
|
|
46
|
+
reason: `[Holmes-Kit push 게이트] test-evidence 원장 파일(${test_evidence_1.EVIDENCE_FILE})이 있지만 읽을 수 있는 기록이 아닙니다 — full test_run 필요. ${RECOVERY}`,
|
|
47
|
+
notices,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
24
50
|
if (!ev) {
|
|
51
|
+
// @implements A-SPEC-128.3 — a repository whose runs have all been scoped has run tests: it is not the unrun pass.
|
|
52
|
+
// @implements A-SPEC-128.4 — a scoped record that exists but cannot be read is still a run history
|
|
53
|
+
if (input.scopedEvidence === 'unreadable') {
|
|
54
|
+
return {
|
|
55
|
+
allow: false,
|
|
56
|
+
reason: `[Holmes-Kit push 게이트] full 실행 원장이 없고, 범위 실행 기록 파일(${test_evidence_1.SCOPED_EVIDENCE_FILE})이 있지만 읽을 수 있는 기록이 아닙니다 — 실행 이력이 있으므로 full test_run 필요. ${RECOVERY}`,
|
|
57
|
+
notices,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (input.scopedEvidence) {
|
|
61
|
+
noticeNotDetected(input.scopedEvidence, notices);
|
|
62
|
+
// @implements A-SPEC-128.5 — a full attempt (red, stopped, or short of an ecosystem) is named as such
|
|
63
|
+
// @implements A-SPEC-128.6 — the ecosystems that ran nothing are named
|
|
64
|
+
// @implements A-SPEC-128.7 — with the act that clears it (I2), read fail-closed on shape
|
|
65
|
+
if (input.scopedEvidence.mode === 'full-attempt') {
|
|
66
|
+
const allowed = nothingTestable(input.scopedEvidence, input.pushedHead, notices);
|
|
67
|
+
if (allowed)
|
|
68
|
+
return allowed;
|
|
69
|
+
const v = (0, test_evidence_1.attemptVerdict)(input.scopedEvidence, input.pushedHead);
|
|
70
|
+
return { allow: false, reason: `[Holmes-Kit push 게이트] full 실행 원장이 없고 full 실행 시도 기록만 있습니다: ${v.problem} — ${recoveryFor(v)}`, notices };
|
|
71
|
+
}
|
|
72
|
+
return {
|
|
73
|
+
allow: false,
|
|
74
|
+
reason: `[Holmes-Kit push 게이트] full 실행 원장이 없고 범위 실행 기록만 있습니다(${(0, test_evidence_1.evidenceKind)(input.scopedEvidence)}) — 범위 초록은 증빙이 아닙니다, full test_run 필요. ${RECOVERY}`,
|
|
75
|
+
notices,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
25
78
|
// Adopted but no ledger yet: pass honestly, say how to activate. A broken ledger folds here
|
|
26
79
|
// too — the gate is a default-safener, not a security boundary, so it must not dead-lock a
|
|
27
80
|
// repo whose ledger file was corrupted.
|
|
28
|
-
notices.push(
|
|
81
|
+
notices.push(`[Holmes-Kit] test-evidence 원장이 없어 push 증빙 대조를 건너뜁니다 — ${evidence_mode_1.FULL_RUN_CALL}를 실행하면 다음 push부터 대조가 활성화됩니다`);
|
|
29
82
|
return { allow: true, notices };
|
|
30
83
|
}
|
|
31
|
-
|
|
32
|
-
|
|
84
|
+
// @implements A-SPEC-128.2, A-SPEC-128.5 — only a full run's record, counting what the runner ran, is push evidence
|
|
85
|
+
// @implements A-SPEC-128.6 — decided by THE predicate the writer and mrp read; its reason is the refusal's
|
|
86
|
+
// @implements A-SPEC-128.7 — and its act words the recovery (I2)
|
|
87
|
+
noticeNotDetected(ev, notices);
|
|
88
|
+
// also where an attempt voided the older evidence in place
|
|
89
|
+
const allowed = nothingTestable(ev, input.pushedHead, notices);
|
|
90
|
+
if (allowed)
|
|
91
|
+
return allowed;
|
|
92
|
+
const v = (0, test_evidence_1.pushEvidenceVerdict)(ev, input.pushedHead);
|
|
93
|
+
if (v === null)
|
|
33
94
|
return { allow: true, notices };
|
|
34
|
-
}
|
|
35
|
-
const why = ev.head !== input.pushedHead
|
|
36
|
-
? `원장 head ${ev.head.slice(0, 7)} ≠ push head ${input.pushedHead.slice(0, 7)} — 증빙 이후 커밋이 있습니다`
|
|
37
|
-
: ev.passed !== true
|
|
38
|
-
? `원장이 붉은 실행(passed: false)입니다 — 붉은 스위트는 기준선이 될 수 없습니다`
|
|
39
|
-
: `원장이 아무것도 실행하지 않았습니다(executed 0) — no-op 초록은 증빙이 아닙니다`;
|
|
40
95
|
return {
|
|
41
96
|
allow: false,
|
|
42
|
-
reason: `[Holmes-Kit push 게이트] ${
|
|
97
|
+
reason: `[Holmes-Kit push 게이트] 원장이 push 증빙이 아닙니다: ${v.problem} — ${recoveryFor(v)}`,
|
|
43
98
|
notices,
|
|
44
99
|
};
|
|
45
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* @implements A-SPEC-128.7 — I2: the recovery a refusal carries is the act that reaches allow. Running the same call again
|
|
103
|
+
* cannot pass a real red or a suite of the project's own that ran nothing, so those say the fix is the tests.
|
|
104
|
+
*/
|
|
105
|
+
function recoveryFor(v) {
|
|
106
|
+
if (v.act === 'fix-tests') {
|
|
107
|
+
return `복구: 고칠 것은 시험입니다 — 시험을 고쳐 커밋한 뒤 ${evidence_mode_1.FULL_RUN_CALL}로 다시 증빙하십시오(같은 상태에서 다시 실행해도 결과는 같습니다). 의도적 우회는 git push --no-verify.`;
|
|
108
|
+
}
|
|
109
|
+
// @implements A-SPEC-128.9 — E4: environment carries its own words and no generic recovery (A L1)
|
|
110
|
+
if (v.act === 'environment')
|
|
111
|
+
return '복구: 실행 환경을 고치십시오(위 사유). 같은 환경에서 다시 실행해도 결과는 같습니다. 의도적 우회는 git push --no-verify.';
|
|
112
|
+
// @implements A-SPEC-128.10 — I3: a fact about tests that did not run; the remedy is the runner's configuration or the
|
|
113
|
+
// user's own exclusion, then the full call
|
|
114
|
+
if (v.act === 'collect')
|
|
115
|
+
return `복구: 위 시험이 실행되도록 러너 설정을 고치거나, 프로젝트 것이 아니면 제외한 뒤 ${evidence_mode_1.FULL_RUN_CALL}를 실행하십시오. 의도적 우회는 git push --no-verify.`;
|
|
116
|
+
return `full test_run 필요. ${RECOVERY}`;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @implements A-SPEC-128.9 — E2, one place (B L3: the D3 notice was written twice): a full attempt that found nothing
|
|
120
|
+
* testable — no unit and no implementation code — is allowed, said, and recorded by the runner.
|
|
121
|
+
*/
|
|
122
|
+
function nothingTestable(rec, head, notices) {
|
|
123
|
+
if (!(0, test_evidence_1.noTestableCode)(rec, head))
|
|
124
|
+
return null;
|
|
125
|
+
notices.push('[Holmes-Kit] 시험할 대상이 없습니다(시험 파일도 구현 코드도 없음) — 이 push는 증빙 없이 허용되고 원장(no-evidence-pushes)에 기록됩니다');
|
|
126
|
+
return { allow: true, notices, noEvidencePush: true };
|
|
127
|
+
}
|
|
128
|
+
/** @implements A-SPEC-128.7 — build files the run left out are named on every push that reads the record. */
|
|
129
|
+
function noticeNotDetected(rec, notices) {
|
|
130
|
+
const list = rec.notDetected;
|
|
131
|
+
if (!Array.isArray(list) || list.length === 0)
|
|
132
|
+
return;
|
|
133
|
+
const names = list.map((n) => (n && typeof n === 'object' ? `${String(n.path)} (${String(n.ecosystem)})` : String(n)));
|
|
134
|
+
// @implements A-SPEC-128.10 — B M4: sub-modules run as units now; what is named here is a file no unit runs
|
|
135
|
+
// @implements A-SPEC-128.12 — and git submodules, which are always outside the evidence: one heading for both
|
|
136
|
+
notices.push(`[Holmes-Kit] 증빙 밖에 둔 것 — full 실행이 판정하지 않았습니다: ${names.join(', ')}`);
|
|
137
|
+
}
|
|
46
138
|
/** One control-character-free line of a commit subject for interpolation into gate text. */
|
|
47
139
|
function flatSubject(s) {
|
|
48
140
|
return s.replace(/[\u0000-\u001f\u007f]+/g, ' ').replace(/\s{2,}/g, ' ').trim().slice(0, 80);
|