@sjawhar/pi-legion 10.3.2 → 10.3.4

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/dist/legion.js CHANGED
@@ -16148,7 +16148,7 @@ function onEnvoyRoleRegained(listener) {
16148
16148
  // package.json
16149
16149
  var package_default = {
16150
16150
  name: "@sjawhar/pi-legion",
16151
- version: "10.3.2",
16151
+ version: "10.3.4",
16152
16152
  license: "Apache-2.0",
16153
16153
  type: "module",
16154
16154
  omp: {
@@ -16160,7 +16160,7 @@ var package_default = {
16160
16160
  ]
16161
16161
  },
16162
16162
  legion: {
16163
- daemonApiVersion: 25
16163
+ daemonApiVersion: 27
16164
16164
  },
16165
16165
  repository: {
16166
16166
  type: "git",
@@ -17385,7 +17385,7 @@ function workspaceRecreatedNotice(environment, issue2) {
17385
17385
  return;
17386
17386
  return {
17387
17387
  id: crypto.randomUUID(),
17388
- content: `Your workspace was recreated since your last turn: it holds what was pushed to legion/${issue2} ` + "(main if nothing was), and anything you had not pushed is gone. Before you continue, check " + "the workspace against what you remember doing and re-read your last handoff."
17388
+ content: `Your workspace was recreated since your last turn: it holds what was pushed to legion/${issue2} ` + "(the repository's default branch if nothing was), and anything you had not pushed is gone. " + "Before you continue, check the workspace against what you remember doing and re-read your " + "last handoff."
17389
17389
  };
17390
17390
  }
17391
17391
  function workspaceRecreatedMessage(notice) {
@@ -133,8 +133,8 @@ merger.
133
133
  they derive nothing, skip steps 2 to 4 and go on to the push.
134
134
  2. Compute it the way they say, for the paths the pull request changes at your head, the files
135
135
  GitHub lists on it:
136
- `cd -- "$LEGION_WORKSPACE" && jj -R "$LEGION_WORKSPACE" git fetch && jj -R "$LEGION_WORKSPACE" diff --from 'fork_point(<base>@origin | <head>)' --to <head> --name-only`
137
- lists them, `<base>` the pull request's base branch and `<head>` your removal commit. Where a
136
+ `base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && cd -- "$LEGION_WORKSPACE" && jj -R "$LEGION_WORKSPACE" git fetch && jj -R "$LEGION_WORKSPACE" diff --from "fork_point(${base}@origin | <head>)" --to <head> --name-only`
137
+ lists them, `base` the pull request's base branch as a jj string literal (never a name pasted between quotes) and `<head>` your removal commit. Where a
138
138
  line affirms work, such as a checklist completed for a class of path, do that work for the
139
139
  paths your commits add before you write the line: the line is a claim. That work may change
140
140
  files under `docs/solutions/` only, folded into your docs commit before the push, since
@@ -176,8 +176,8 @@ config is one file shared by every issue workspace of the clone. Legion has two
176
176
  one per role: your role's App is the **implement** App if you are the implementer or the merger,
177
177
  and the **review** App if you are the planner, tester, reviewer, or an architect; your pane's
178
178
  `JJ_USER` and `JJ_EMAIL` name your role's App's bot account. A planner's commits authored
179
- by the review App are right. Before a push, check
180
- `jj -R "$LEGION_WORKSPACE" log -r 'main@origin..@' -T 'author.email() ++ " | " ++ committer.email() ++ " " ++ description.first_line() ++ "\n"'`
179
+ by the review App are right. Before a push, check, with GitHub's default branch read as a jj string literal in the same command (never a name pasted between quotes),
180
+ `default=$(gh api repos/<owner>/<repo> --jq '.default_branch | @json') && jj -R "$LEGION_WORKSPACE" log -r "${default}@origin..@" -T 'author.email() ++ " | " ++ committer.email() ++ " " ++ description.first_line() ++ "\n"'`
181
181
  shows your role's App in both columns **on every commit you made** — not on the whole list:
182
182
  earlier phases' commits are legitimately authored by their own role's App. Their *committer* is
183
183
  a different matter, and no longer noise to accept. Resolving a conflict rewrites nothing — it is a
@@ -11,7 +11,7 @@ Every path it cites is in sjawhar/legion.
11
11
  merge, never `jj rebase`.**
12
12
  The implementer merges the base into the issue branch only when GitHub reports it `CONFLICTING`, the controller asks
13
13
  because of a conflict, or after the pull request is retargeted to a new base. Otherwise, never reintegrate the base to
14
- pick up `main` or refresh CI (a single failed CI job is re-run on its own: *A red CI job* in
14
+ pick up the default branch or refresh CI (a single failed CI job is re-run on its own: *A red CI job* in
15
15
  `skill://legion-worker`). A conflict-forced rebase that leaves the branch's diff unchanged is a
16
16
  confirmation, not a new round (see *The unchanged-diff check* below); that name is the event's,
17
17
  kept by the rules below and the learnings that cite it, and the operation it names is always
@@ -28,10 +28,15 @@ Every path it cites is in sjawhar/legion.
28
28
  `-r` all rewrite descendants; `-r` only re-parents them to fill the hole, which is worse).
29
29
  Resolve the conflict with a forward merge instead of a rewrite — merge the branch's own
30
30
  bookmark with the destination in one new commit, so nothing existing is rewritten and nothing
31
- built on your prior commits, in this tree or another, ever moves:
31
+ built on your prior commits, in this tree or another, ever moves. `base` is the pull request's
32
+ base branch (the repository's default branch unless the pull request is stacked), read as a jj
33
+ string literal: jj parses a bare bookmark name as an expression, and a name pasted between
34
+ quotes can close them itself (`release"@origin|"stable` would select `release` and `stable`), so
35
+ the revset is built from the serialized name alone:
32
36
 
33
37
  ```bash
34
- jj -R "$LEGION_WORKSPACE" new legion/<KEY> main@origin -m "merge: resolve conflict against main@origin"
38
+ base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && \
39
+ jj -R "$LEGION_WORKSPACE" new legion/<KEY> "${base}@origin" -m "merge: resolve conflict against ${base}@origin"
35
40
  ```
36
41
 
37
42
  Merge from the bookmark, never from `@`: a handoff split leaves `@` an empty, undescribed
@@ -44,8 +49,9 @@ Every path it cites is in sjawhar/legion.
44
49
  pushes its own commits* in `skill://legion-worker`; a merge is a code push, so its head carries
45
50
  no `skip-checks: true` line): the merge descends from both the bookmark's old position and the
46
51
  destination, so it is a genuine fast-forward and *Rewriting pushed commits* never applies.
47
- - **After a retarget.** Retargeting a pull request to a new base does not re-run Tests. Merge the
48
- bookmark onto the new base (`jj new legion/<KEY> <new base> -m "<message>"`) and push it the
52
+ - **After a retarget.** Retargeting a pull request to a new base does not re-run Tests. Read
53
+ `base` again and merge the bookmark onto it in one command
54
+ (`base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && jj -R "$LEGION_WORKSPACE" new legion/<KEY> "${base}@origin" -m "<message>"`) and push it the
49
55
  ordinary way — a genuine fast-forward, never `--allow-backwards` — so the new head runs Tests
50
56
  against the new merge result, and cite that run in the PR body.
51
57
 
@@ -55,20 +61,23 @@ The fingerprint every role compares after a conflict-forced rebase (every flag a
55
61
  verified on jj 0.45.1):
56
62
 
57
63
  ```bash
64
+ base=$(gh pr view <n> -R <owner>/<repo> --json baseRefName -q '.baseRefName | @json') && \
58
65
  cd -- "$LEGION_WORKSPACE" && jj -R "$LEGION_WORKSPACE" git fetch && \
59
- jj -R "$LEGION_WORKSPACE" diff --from "fork_point(main@origin | <head-sha>)" --to <head-sha> \
66
+ fingerprint=$(set -o pipefail; jj -R "$LEGION_WORKSPACE" diff --from "fork_point(${base}@origin | <head-sha>)" --to <head-sha> \
60
67
  --git --context 0 '~(.legion | docs/solutions)' \
61
- | sed -e '/^@@/d' -e '/^index /d' | sha256sum
68
+ | sed -e '/^@@/d' -e '/^index /d' | sha256sum) && echo "$fingerprint"
62
69
  ```
63
70
 
64
71
  - `<head-sha>` is a full commit SHA; a jj commit id is the git SHA GitHub shows.
65
- - `fork_point(main@origin | <head-sha>)` is the base the branch was cut from *at that head*:
66
- the old base for the pre-rebase head, the new base for the rebased one, so one command
67
- serves both sides. On a stacked PR substitute its base branch for `main`
68
- (`gh pr view <n> --json baseRefName`).
69
- - A head the rebase hid is still addressable by its SHA in the shared workspace. A SHA the
70
- workspace cannot resolve (`jj -R "$LEGION_WORKSPACE" log -r <sha>` errors) counts as a
71
- changed diff — never as unchanged.
72
+ - `fork_point(${base}@origin | <head-sha>)` is the base the branch was cut from *at that head*:
73
+ the old base for the pre-rebase head, the new base for the rebased one, so one command serves
74
+ both sides. `base` is the pull request's base branch as a jj string literal, as in the merge
75
+ above.
76
+ - A head the rebase hid is still addressable by its SHA in the shared workspace. The check
77
+ prints a fingerprint only when every step of it succeeded: the base read, the fetch and the
78
+ diff (`pipefail` keeps the diff's failure through `sed` and `sha256sum`, which would otherwise
79
+ hash empty input to `e3b0c442…`). A nonzero exit or no printed fingerprint (a failed read of the
80
+ base, or a SHA the workspace cannot resolve) counts as a changed diff — never as unchanged.
72
81
  - `--context 0` drops context lines; the `sed` drops `@@` hunk headers (line positions move
73
82
  on a rebase) and `index` lines (blob ids move when the base's copy of a file changed). What
74
83
  is left is exactly the added and removed lines per file.
@@ -25,12 +25,20 @@ the head voids it.
25
25
  every commit above that push's head changes only `.legion/` (a push that changes only
26
26
  `.legion/` carries `skip-checks: true`, so GitHub runs no workflow for it). With `<o>/<r>`,
27
27
  `<n>`, `<base>`, `<headRefName>` and `<headRefOid>` from
28
- `gh pr view <n> --json baseRefName,headRefOid,headRefName`, four reads. The required set, from
29
- the base branch's rulesets
30
- (`gh api repos/<o>/<r>/rules/branches/<base> --jq '.[] | select(.type=="required_status_checks") | .parameters.required_status_checks[].context'`)
31
- and its branch protection, when it has any
32
- (`gh api repos/<o>/<r>/branches/<base> --jq '.protection.required_status_checks.checks[].context'`);
33
- a read GitHub refuses is reported to the architect, never guessed. The CI head, the head of the
28
+ `gh pr view <n> --json baseRefName,headRefOid,headRefName`, four reads. The required set is the
29
+ base branch's rulesets' required checks and its branch protection's, when it has any. Both
30
+ branch endpoints take the base as a URL path, each segment escaped and each `/` kept (a raw `#`
31
+ or `%` reads another branch), built in the same command from the name GitHub returns, never
32
+ pasted or carried over from an earlier command:
33
+
34
+ ```bash
35
+ base=$(gh pr view <n> -R <o>/<r> --json baseRefName -q .baseRefName) && \
36
+ base_path=$(jq -rn --arg b "$base" '$b | split("/") | map(@uri) | join("/")') && \
37
+ echo rulesets: && gh api "repos/<o>/<r>/rules/branches/$base_path" --jq '.[] | select(.type=="required_status_checks") | .parameters.required_status_checks[].context' && \
38
+ echo protection: && gh api "repos/<o>/<r>/branches/$base_path" --jq '.protection.required_status_checks.checks[].context'
39
+ ```
40
+
41
+ A read GitHub refuses stops the command there, and is reported to the architect, never guessed. The CI head, the head of the
34
42
  branch's newest `pull_request` run
35
43
  (`gh api 'repos/<o>/<r>/actions/runs?branch=<headRefName>&event=pull_request&per_page=30' --jq '.workflow_runs[0].head_sha'`,
36
44
  newest first); the PR body's `CI:` line names runs at that same commit
@@ -62,7 +70,8 @@ the head voids it.
62
70
  `APPROVE`: submit one more `APPROVE` naming the new head by SHA, its body naming both SHAs
63
71
  and the fingerprint — a confirmation, not a round; no thermo pass, no thread pass. Equal and
64
72
  that review was `COMMENT` or `REQUEST_CHANGES`: continue that round against the new head;
65
- nothing restarts. Different: a new round — thermo again, one review.
73
+ nothing restarts. Different, or either run printed no fingerprint: a new round — thermo again,
74
+ one review.
66
75
  - Answer every thread you opened, and every thread a bot opened that is none of Legion's role
67
76
  Apps, as `skill://legion-worker/references/review-threads.md` says; the same reference says
68
77
  when every thread is settled enough to approve, and resolving one never gates your approval.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "10.3.2",
3
+ "version": "10.3.4",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {
@@ -12,7 +12,7 @@
12
12
  ]
13
13
  },
14
14
  "legion": {
15
- "daemonApiVersion": 25
15
+ "daemonApiVersion": 27
16
16
  },
17
17
  "repository": {
18
18
  "type": "git",