rungate 0.8.1 → 0.8.2
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/gates/.gate-salt +1 -1
- package/hooks/BashWriteGuard.hook.ts +19 -0
- package/hooks/VerifyPhaseLock.hook.ts +51 -11
- package/lib/ai-review-rounds.ts +462 -0
- package/lib/bash-file-read.ts +17 -3
- package/lib/bash-write-guard.ts +1028 -47
- package/lib/distribution-standing.ts +75 -4
- package/lib/failure-intake.ts +12 -4
- package/lib/file-extensions.ts +81 -0
- package/lib/finding-arbiter.ts +1015 -0
- package/lib/finding-jury.ts +537 -0
- package/lib/github.ts +55 -0
- package/lib/interpreters.ts +64 -0
- package/lib/issue-create-override.ts +69 -8
- package/lib/issue-filing-gate.ts +605 -0
- package/lib/publish-window.ts +287 -0
- package/lib/scaffold/ai-review-step.ts +878 -13
- package/lib/scaffold/managed-workflow.ts +163 -4
- package/lib/scaffold/steps.ts +381 -101
- package/lib/scanner.ts +10 -3
- package/lib/ticked-sc-symbols.ts +361 -0
- package/lib/workflow-actions.ts +18 -0
- package/package.json +2 -1
- package/scripts/arbitrate-finding.ts +224 -0
- package/scripts/generate-code-map.ts +6 -3
- package/scripts/sync-sc-status.ts +82 -8
|
@@ -284,11 +284,63 @@ const BOOLEAN_FLAGS = new Set(["-w", "--web", "-h", "--help", "--recover-only"])
|
|
|
284
284
|
* MISSED — and a missed label is a refusal, the direction this guard is
|
|
285
285
|
* allowed to be wrong in.
|
|
286
286
|
*/
|
|
287
|
-
export
|
|
287
|
+
export interface FlagQuery {
|
|
288
|
+
/** The long form, with its dashes: `--label`. */
|
|
289
|
+
long: string;
|
|
290
|
+
/** The short form, with its dash: `-l`. Omit when there is none to read. */
|
|
291
|
+
short?: string;
|
|
292
|
+
/** `gh` reads `--label a,b` as two labels. A title is one value. */
|
|
293
|
+
commaSeparated?: boolean;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/** `--label` / `-l`, the one query this file's own decision needs. */
|
|
297
|
+
export const LABEL_FLAG: FlagQuery = { long: "--label", short: "-l", commaSeparated: true };
|
|
298
|
+
|
|
299
|
+
/**
|
|
300
|
+
* Short flags of `gh issue create` whose value may be ATTACHED: `-lfollow-up`.
|
|
301
|
+
*
|
|
302
|
+
* `-a` assignee, `-b` body, `-F` body-file, `-l` label, `-m` milestone,
|
|
303
|
+
* `-p` project, `-t` title, `-T` template, `-R` repo. `-w` and `-h` are
|
|
304
|
+
* boolean and live in `BOOLEAN_FLAGS`.
|
|
305
|
+
*
|
|
306
|
+
* **One table, consulted by every query, because where a token ends is a
|
|
307
|
+
* property of the COMMAND and not of the question being asked.** The first
|
|
308
|
+
* cut of this made it a per-query letter, so a walk looking for `--title`
|
|
309
|
+
* recognised `-tFoo` as attached while a walk looking for `--label` read the
|
|
310
|
+
* same token as an unknown flag and blindly consumed the one after it. Two
|
|
311
|
+
* readings of one command line, disagreeing about token boundaries — found
|
|
312
|
+
* by the AI review on #1282, which is right that the consequence is a
|
|
313
|
+
* silently dropped argument: `gh issue create -tFoo --body "…"` lost the
|
|
314
|
+
* body, so the finding arrived with no symptom and escaped the dedupe.
|
|
315
|
+
*
|
|
316
|
+
* It is a real change to `labelValues`, and in the direction of accuracy.
|
|
317
|
+
* `gh issue create -aalice --label follow-up` applies the override label and
|
|
318
|
+
* was REFUSED before this, because `-aalice` ate the `--label`. That was the
|
|
319
|
+
* accepted error direction — a missed label is a refusal — but it was still
|
|
320
|
+
* a wrong answer about a command somebody can type, and nothing about the
|
|
321
|
+
* widening lets a label be read where none was written: the token after an
|
|
322
|
+
* attached short is now parsed on its own merits rather than swallowed, and
|
|
323
|
+
* it still has to BE a `--label` argument to count. An unknown short flag is
|
|
324
|
+
* absent from this table and keeps the old conservative default.
|
|
325
|
+
*/
|
|
326
|
+
const VALUE_SHORT_FLAGS = new Set(["a", "b", "F", "l", "m", "p", "t", "T", "R"]);
|
|
327
|
+
|
|
328
|
+
/** `-lfollow-up` — a short flag with its value glued on. */
|
|
329
|
+
const ATTACHED_SHORT = /^-([A-Za-z])[^-=]/;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* The values passed to one flag of a `gh issue create` clause.
|
|
333
|
+
*
|
|
334
|
+
* One arity walk, parameterised, so a second reader of the same clause — see
|
|
335
|
+
* `lib/issue-filing-gate.ts`, which needs `--title` and `--body` — agrees with
|
|
336
|
+
* this one about where a flag's value is. Two walks would disagree the first
|
|
337
|
+
* time either learned a flag the other did not have.
|
|
338
|
+
*/
|
|
339
|
+
export function flagValues(tokens: string[], q: FlagQuery): string[] {
|
|
288
340
|
const out: string[] = [];
|
|
289
341
|
const add = (v: string) => {
|
|
290
|
-
for (const part of v.split(",")) {
|
|
291
|
-
const t = part.trim();
|
|
342
|
+
for (const part of q.commaSeparated === true ? v.split(",") : [v]) {
|
|
343
|
+
const t = q.commaSeparated === true ? part.trim() : part;
|
|
292
344
|
if (t) out.push(t);
|
|
293
345
|
}
|
|
294
346
|
};
|
|
@@ -299,16 +351,21 @@ export function labelValues(tokens: string[]): string[] {
|
|
|
299
351
|
const eq = t.indexOf("=");
|
|
300
352
|
if (eq !== -1) {
|
|
301
353
|
const name = t.slice(0, eq);
|
|
302
|
-
if (name ===
|
|
354
|
+
if (name === q.long || name === q.short) add(t.slice(eq + 1));
|
|
303
355
|
continue; // `--flag=value` carries its own value; it consumes nothing
|
|
304
356
|
}
|
|
305
|
-
if (t ===
|
|
357
|
+
if (t === q.long || t === q.short) {
|
|
306
358
|
if (i + 1 < tokens.length) add(tokens[++i]);
|
|
307
359
|
continue;
|
|
308
360
|
}
|
|
309
|
-
// `-lfollow-up` — pflag lets a short flag carry its value attached.
|
|
310
|
-
|
|
311
|
-
|
|
361
|
+
// `-lfollow-up` — pflag lets a short flag carry its value attached. Its
|
|
362
|
+
// value is IN the token, so it consumes nothing whether or not it is the
|
|
363
|
+
// flag this query is collecting. That second half is the fix: a query
|
|
364
|
+
// that skipped it here would also skip the `continue` and eat the next
|
|
365
|
+
// token, which is the desync `VALUE_SHORT_FLAGS` exists to prevent.
|
|
366
|
+
const attached = ATTACHED_SHORT.exec(t);
|
|
367
|
+
if (attached !== null && VALUE_SHORT_FLAGS.has(attached[1])) {
|
|
368
|
+
if (q.short === `-${attached[1]}`) add(t.slice(2));
|
|
312
369
|
continue;
|
|
313
370
|
}
|
|
314
371
|
if (!BOOLEAN_FLAGS.has(t)) i++; // this flag eats the next token
|
|
@@ -316,6 +373,10 @@ export function labelValues(tokens: string[]): string[] {
|
|
|
316
373
|
return out;
|
|
317
374
|
}
|
|
318
375
|
|
|
376
|
+
export function labelValues(tokens: string[]): string[] {
|
|
377
|
+
return flagValues(tokens, LABEL_FLAG);
|
|
378
|
+
}
|
|
379
|
+
|
|
319
380
|
/**
|
|
320
381
|
* The single place that decides. `null` means allow.
|
|
321
382
|
*
|