@jjanczur/tyran 0.1.50 → 0.1.51

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.
@@ -11,7 +11,7 @@
11
11
  {
12
12
  "name": "tyran",
13
13
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
14
- "version": "0.1.50",
14
+ "version": "0.1.51",
15
15
  "source": "./",
16
16
  "author": {
17
17
  "name": "Jacek Janczura",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tyran",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "A task conductor for Claude Code: multi-agent orchestration with an enforced evidence contract, repo-specific learning, and update-safe local evolution.",
5
5
  "author": {
6
6
  "name": "Jacek Janczura",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,44 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.51 — 2026-11-21
4
+
5
+ ### `secrets-gate`: deleting a remote branch is no longer refused for gigabytes it never sends
6
+
7
+ Reported from a real install. `git push origin --delete <branch>` was refused
8
+ with *"this would publish 4060145442 bytes in 29635 object(s)"*. A second
9
+ report was `git push -q origin --delete review/a review/b` at 1,370,527,212
10
+ bytes. Agents could not clean up merged branches.
11
+
12
+ The cause: the deleted names were read as refspec sources. They did not
13
+ resolve locally, and `pushRange` then widened to `--all --not
14
+ --remotes=<target>`, which is every unpushed commit on every local branch.
15
+ `git push origin :refs/heads/x` took the same path, because its empty source
16
+ was dropped and an empty list is the wide range.
17
+
18
+ `isDeletionOnly` now recognises the two spellings that cannot publish. The
19
+ first is `--delete` or `-d` (an unambiguous abbreviation of `--delete`, or `-d`
20
+ inside a cluster of `q`/`v`/`n`/`4`/`6`) beside nothing but output flags. The
21
+ second is refspecs that are all `:<ref>` or `+:<ref>`. For those, no range is
22
+ listed. The command line is still scanned, like every other command the gate
23
+ sees, and the policy gate still reads where the push lands. Anything else stays
24
+ scanned: a bare `:` (the matching refspec), `--no-delete`, `-o <value>`,
25
+ `--push-option`, `--all`, `--mirror`, `--tags`, `-f`, a refspec the shell would
26
+ rewrite, and a deletion beside a real refspec (`:old main` scans `main`).
27
+
28
+ Found on the way and fixed in the same change: two pushes on one command line
29
+ kept only the last segment's refs. So `git push origin leaky && git push origin
30
+ main` passed the real gate with a private key on `leaky`. The refs are now
31
+ unioned. A deletion never replaces an earlier push, and a wide range stays
32
+ wide.
33
+
34
+ 13 new tests in `hook-secrets-gate-delete-refspec.test.mjs`, end to end against
35
+ real git and gitleaks. On the unpatched gate 10 of them are red, the ticket's
36
+ own `git push origin --delete gone` among them.
37
+
38
+ The gate change is in `hooks/scripts/`, which is KERNEL in this repository. It
39
+ was made in a session the operator opened for it with `boundaries.kernel:
40
+ allow`, and the key was removed again afterwards.
41
+
3
42
  ## 0.1.50 — 2026-11-19
4
43
 
5
44
  ### `boundaries.kernel: allow` — no floor in a bypassPermissions session
package/README.md CHANGED
@@ -329,7 +329,7 @@ enforces the cap (3947 of 5000 characters). What each one assumes, when it
329
329
  fires and who invokes it, is in
330
330
  [skills and agents](https://jjanczur.github.io/tyran/skills/); the prompts
331
331
  themselves are in [`skills/`](skills/) and [`agents/`](agents/). Behind all of
332
- it: 1721 unit tests, run with `node --test "tests/**/*.test.mjs"`.
332
+ it: 1734 unit tests, run with `node --test "tests/**/*.test.mjs"`.
333
333
 
334
334
  ## Documentation
335
335
 
@@ -412,6 +412,57 @@ export function isAbbreviationOf(token, longOption, minimum = 4) {
412
412
  return token.length >= minimum && token.length <= longOption.length && longOption.startsWith(token);
413
413
  }
414
414
 
415
+ /**
416
+ * `git push` flags that change neither WHICH refs are sent nor where a value
417
+ * sits on the command line, so a deletion carrying them still publishes
418
+ * nothing. Exact spellings only: anything else (`-o <value>`, `--all`,
419
+ * `--mirror`, `--tags`, `--force`, an abbreviation) keeps the push scanned.
420
+ */
421
+ const DELETION_NEUTRAL_FLAGS = Object.freeze([
422
+ '--quiet', '--verbose', '--dry-run', '--porcelain', '--progress', '--no-progress', '--ipv4', '--ipv6',
423
+ ]);
424
+
425
+ /** A short cluster of neutral letters, at least one of which is `d`. */
426
+ const DELETE_CLUSTER = /^-[qvn46]*d[qvnd46]*$/;
427
+
428
+ /**
429
+ * True when a `git push` with these arguments can only DELETE remote refs.
430
+ *
431
+ * A deletion publishes no objects, so the wide range a push falls back to
432
+ * (`--all`, every unpushed commit on every branch) is the wrong thing to scan,
433
+ * and it made a deletion fail on the size of unrelated work: measured on a
434
+ * real install, `git push -q origin --delete review/a review/b` was refused
435
+ * for 1,370,527,212 bytes in 9,130 objects. Two spellings delete, and only
436
+ * these are recognised:
437
+ *
438
+ * - `--delete` / `-d` (or an unambiguous abbreviation of `--delete`, or `-d`
439
+ * inside a cluster of neutral letters): every named ref is deleted. Git
440
+ * refuses it together with `--all`, `--mirror` and `--tags`; those are not
441
+ * neutral, so such a line stays scanned rather than trusted.
442
+ * - a refspec with an EMPTY source and a non-empty destination, `:dst` or
443
+ * `+:dst`. A bare `:` is the MATCHING refspec, which pushes every branch
444
+ * both sides have, and is never a deletion.
445
+ *
446
+ * Anything else answers false and the push is scanned as before: an unknown
447
+ * flag may take a value and shift the positions read here, and failing to
448
+ * recognise a deletion costs a scan while misreading a push as one would
449
+ * publish it unscanned.
450
+ */
451
+ export function isDeletionOnly(pushArgv, specs) {
452
+ if (specs.length === 0) return false;
453
+ let deleteFlag = false;
454
+ for (const token of pushArgv) {
455
+ if (!token.startsWith('-')) continue;
456
+ if (token === '-d' || DELETE_CLUSTER.test(token) || (token.startsWith('--') && isAbbreviationOf(token, '--delete'))) {
457
+ deleteFlag = true;
458
+ } else if (!DELETION_NEUTRAL_FLAGS.includes(token) && !/^-[qvn46]+$/.test(token)) {
459
+ return false;
460
+ }
461
+ }
462
+ if (deleteFlag) return true;
463
+ return specs.every((spec) => /^\+?:[^:]+$/.test(spec));
464
+ }
465
+
415
466
  // ------------------------------------------------------ the subcommand slot
416
467
 
417
468
  /**
@@ -766,8 +817,32 @@ export function planCommand(command, startDir) {
766
817
  // (ADR-21), and the one that decides whether a push reaches production is
767
818
  // not the place to start diverging.
768
819
  const pushArgv = tokens.slice(op.index + 1);
769
- note(dir, { scanPush: true, pushRemote: remote, pushRefs: refs, pushArgv, pushReadable: readable });
770
- triggers.push('a git push (every commit not already on the target remote is scanned)');
820
+ const deletesOnly = readable && isDeletionOnly(pushArgv, after.slice(1));
821
+ // One line can push the same repository more than once. The scan is the
822
+ // UNION of what every segment publishes: letting the last segment's refs
823
+ // replace the earlier ones let `git push origin leaky && git push origin
824
+ // main` publish `leaky` unscanned, and a deletion, which adds nothing,
825
+ // must not replace a real push either. `pushRefs: []` is the wide range
826
+ // and stays wide.
827
+ const prior = targets.get(dir);
828
+ const priorPush = prior !== undefined && prior.scanPush === true ? prior : null;
829
+ let scan;
830
+ if (deletesOnly) {
831
+ scan = priorPush !== null ? {} : { pushRemote: remote, pushRefs: [], pushDeletesOnly: true };
832
+ } else if (priorPush === null || priorPush.pushDeletesOnly === true) {
833
+ scan = { pushRemote: remote, pushRefs: refs, pushDeletesOnly: false };
834
+ } else {
835
+ // A prior `gh` publish can leave `pushRefs` unset, which is wide too.
836
+ const priorRefs = priorPush.pushRefs ?? [];
837
+ const wide = priorRefs.length === 0 || refs.length === 0;
838
+ scan = { pushRemote: remote, pushRefs: wide ? [] : [...new Set([...priorRefs, ...refs])] };
839
+ }
840
+ note(dir, { scanPush: true, ...scan, pushArgv, pushReadable: readable });
841
+ triggers.push(
842
+ deletesOnly
843
+ ? 'a git push that only deletes remote refs (it publishes no objects; the command line is scanned)'
844
+ : 'a git push (every commit not already on the target remote is scanned)',
845
+ );
771
846
  }
772
847
  if (ghPublishes) {
773
848
  // `gh pr create` publishes ONE branch — the PR's head — and adds no git
@@ -853,16 +928,20 @@ export function planCommand(command, startDir) {
853
928
  }
854
929
  if (unreadable) prHead = null;
855
930
  }
931
+ // An earlier push that only DELETED refs published nothing, so it is no
932
+ // prior range at all: neither wide nor something to union with.
856
933
  const existing = targets.get(dir);
934
+ const priorDeletes = existing?.pushDeletesOnly === true;
857
935
  const priorWide =
858
936
  existing !== undefined &&
859
937
  existing.scanPush === true &&
938
+ !priorDeletes &&
860
939
  !(Array.isArray(existing.pushRefs) && existing.pushRefs.length > 0);
861
940
  if (prHead !== null && !priorWide) {
862
- const prior = existing?.pushRefs ?? [];
863
- note(dir, { scanPush: true, pushRefs: [...new Set([...prior, prHead])] });
941
+ const prior = priorDeletes ? [] : (existing?.pushRefs ?? []);
942
+ note(dir, { scanPush: true, pushRefs: [...new Set([...prior, prHead])], pushDeletesOnly: false });
864
943
  } else {
865
- note(dir, { scanPush: true });
944
+ note(dir, { scanPush: true, pushDeletesOnly: false });
866
945
  }
867
946
  triggers.push('a gh command that publishes');
868
947
  if (words.has('release') || words.has('gist')) {
@@ -1490,7 +1569,10 @@ export async function buildPayload(target, extraFiles, { runner, budget }) {
1490
1569
  await addBlobs(target.dir, wanted.filter((e) => !/^0+$/.test(e.sha)), add, { runner, budget });
1491
1570
  }
1492
1571
 
1493
- if (target !== null && target.scanPush) {
1572
+ // A push that only deletes remote refs sends no objects (`isDeletionOnly`),
1573
+ // so there is no range to list. Its command line is still scanned by
1574
+ // `decide`, like every other command this gate sees.
1575
+ if (target !== null && target.scanPush && target.pushDeletesOnly !== true) {
1494
1576
  const range = await pushRange(target.dir, target.pushRemote, target.pushRefs, {
1495
1577
  runner, timeoutMs: budget(GIT_BUDGET_MS),
1496
1578
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jjanczur/tyran",
3
- "version": "0.1.50",
3
+ "version": "0.1.51",
4
4
  "description": "Command-line scripts for the Tyran task conductor (doctor, journal, schema, and repo tooling) for CI and terminals outside Claude Code. Installing this package does NOT install the Claude Code plugin — add that separately with `/plugin marketplace add jjanczur/tyran` inside Claude Code.",
5
5
  "type": "module",
6
6
  "engines": {