✨ feat(work): a Slice: line can name a slice in another repository

Merged
AT
3d ago
+610-139

Slice: #559

A Slice: line can now name a slice in another repository, as
Slice: OWNER/REPO#N or Slice: https://github.com/OWNER/REPO/issues/N.
That slice is read in OWNER/REPO and checked as a local one is. This
covers pre-push, the Work rules check, Guard's Guards: read, Slice
started's board move and the design check.

Why. On 2026-11-21 Alok approved athya-rules 0.5.12 under athya_mono
slice W-82 (athya-hq/athya_mono#3850). niyam's pre-push looked the number
up as athya-rules#3850 and refused the agent's push, so Alok pushed the
branch himself. athya-rules has no Work items of its own: its work is
planned in athya_mono. W-65 (athya-hq/athya-rules#89) and L-12
(athya-hq/athya-rules#100) are queued behind the same refusal. Before
this change, the URL form already parsed, but the owner/name was thrown
away.

What it checks, for a foreign slice:

  • It is a Slice under a Work item labeled approved by an owner that the
    checked repository's settings name.
  • If it was added after that approval, it needs one of: a šŸ‘ on the
    agent's proposal, a Decision: comment, a linked request, or a batch
    answer on that repository's Approvals issue, read from its
    .github/niyam.json. The checked repository's own approvals number is
    never used there.
  • A repository the token cannot read (401, 403 or 404) is refused, naming
    OWNER/REPO#N in full. The PR check runs on the workflow's
    GITHUB_TOKEN, which reads only its own repository, so it still refuses
    a private repository such as athya_mono, and says why. That check is
    not required on athya-rules. Widening its token is out of scope (#558).

Behaviour that stays as it was, and the edges:

  • Slice: #N, or a link or shorthand naming the checked repository in any
    case, is local, as before.
  • "One slice, one pull request" compares the whole reference: local #12
    and OWNER/REPO#12 are two different slices.
  • State: lines take the same forms. A bare #N is always local.
  • Slice done never comments on or closes a local issue for a foreign
    slice or State; it says it left it.
  • Guard reads the foreign slice's parent, approval and body revisions
    (GraphQL) in that repository. It fails closed where it cannot.
  • Owner/name is limited to GitHub's characters, in both src/work.ts and
    scripts/guard.mjs, so nothing else reaches an API path.

Evidence:

  • pnpm check: exit 0. 2173 pass, 0 fail, coverage 99.56% lines and 97.20% branches. test:scripts: 136 pass, 0 fail.
  • New tests:
    • parsing both forms, a same-repository link and other shapes;
    • a foreign slice passing;
    • refusals: 404, 403, a pull request, not a Slice, no Work item,
      unapproved, approved by the agent;
    • šŸ‘ and batch answers read there;
    • State lines;
    • the one-slice collision;
    • pre-push and Work rules end to end, in both forms;
    • Slice done leaving it alone;
    • Guard judging there, and refusing where it cannot read.
  • Live and read-only, with AthyaBot's token, sliceProblems for
    athya-hq/athya-rules naming athya_mono#3850 gives [] in both forms.
    A repository the token cannot read gives the refusal above.

After merge:

  • A release.
  • athya-rules' pre-push runs this Mac's installed niyam, through the
    ~/.config/niyam/bin/niyam launcher. So niyam upgrade here unblocks
    #89 and #100's pushes.
  • athya-rules' own onboard moves its workflow pins.

šŸ¤– Generated with Claude Code


Summary by cubic

Allows a Slice: line to name a slice in another repository, as Slice: OWNER/REPO#N or as a full issue URL, for repositories whose work is planned elsewhere. The foreign slice is read and checked in that repository, under the checked repository's owners and that repository's own Approvals issue.

  • A foreign slice must be a Slice under a Work item the owners labeled approved; one added after that approval needs a šŸ‘, a Decision: comment, or a batch answer on the foreign Approvals issue.
  • The foreign issue is read once; a slice the token cannot read (401, 403, or 404) is refused and named in full, and any other status throws. The PR check's GITHUB_TOKEN reads only its own repository, so a private one is refused with the reason; a public one it can read.
  • State: lines take the same named forms, and Guard, board moves, Slice started, the design check, and keep-going's closed-branch check read the foreign repository. Guard never reads the checked repository's own Approvals issue for a foreign slice.
  • Local references (#N, or any link or shorthand naming the checked repository) behave as before, and Slice done never comments on or closes a local issue for a foreign slice.
  • Asks name a foreign slice by that repository's own address, and "one slice, one pull request" compares the whole reference, so local #N and OWNER/REPO#N are two distinct slices.