@brainervirus/workit-pi 8.11.0 → 8.12.0

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/worker.js CHANGED
@@ -8494,6 +8494,7 @@ var workspaceConfigSchema = object({
8494
8494
  autoApprove: union([boolean2(), array(nonBlank)]).optional(),
8495
8495
  defaultEndpoint: unknown().optional(),
8496
8496
  verification: _enum(["self", "independent"]).optional(),
8497
+ trailers: boolean2().optional(),
8497
8498
  autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
8498
8499
  kind,
8499
8500
  union([boolean2(), literal("verified")]).optional()
package/dist/workit.js CHANGED
@@ -12422,7 +12422,7 @@ function loadCheckConfig(cwd) {
12422
12422
  gates[gate] = names;
12423
12423
  }
12424
12424
  }
12425
- return { source: CHECKS_FILE, root, checks, gates, error: null };
12425
+ return { source: CHECKS_FILE, root, checks, gates, error: null, resources: parsed.resources };
12426
12426
  }
12427
12427
  var sameArgv = (left, right) => left.length === right.length && left.every((item, index) => item === right[index]);
12428
12428
  function matchesNamedCheck(config, name, argv, cwd) {
@@ -13006,6 +13006,7 @@ var workspaceConfigSchema = object({
13006
13006
  autoApprove: union([boolean2(), array(nonBlank)]).optional(),
13007
13007
  defaultEndpoint: unknown().optional(),
13008
13008
  verification: _enum(["self", "independent"]).optional(),
13009
+ trailers: boolean2().optional(),
13009
13010
  autonomy: object(Object.fromEntries(["push", "pr", "merge", "release", "rerun"].map((kind) => [
13010
13011
  kind,
13011
13012
  union([boolean2(), literal("verified")]).optional()
@@ -13287,8 +13288,8 @@ var resolveRuntimeWorkspaceVcs = (cwd) => resolveRuntimeWorkspaceCandidate(cwd,
13287
13288
  var runtimeWorkspaceIndexSchema = object({
13288
13289
  workspaces: array(object({ name: nonBlank, glob: nonBlank }).passthrough()).optional()
13289
13290
  }).passthrough();
13290
- var matchRuntimeWorkspace = (cwd) => {
13291
- const file = path11.join(configDir(), "workspaces.json");
13291
+ var matchRuntimeWorkspace = (cwd, dir = configDir()) => {
13292
+ const file = path11.join(dir, "workspaces.json");
13292
13293
  let raw;
13293
13294
  try {
13294
13295
  raw = readFileSync3(file, "utf8");
@@ -13317,12 +13318,30 @@ var matchRuntimeWorkspace = (cwd) => {
13317
13318
  const matches = matchingEntries(cwd, entries ?? []);
13318
13319
  const workspaceName = process.env.WORKFLOW_WORKSPACE_NAME?.trim() || undefined;
13319
13320
  const selected = selectWorkspaceMatch(matches, cwd, workspaceName);
13320
- return selected ? { file, selected } : null;
13321
+ return selected ? { file, selected, matches } : null;
13321
13322
  };
13322
13323
  var resolveRuntimeReleaseTracks = (cwd) => {
13323
13324
  const matched = matchRuntimeWorkspace(cwd);
13324
13325
  return matched ? { workspace: matched.selected.name, releaseTracks: matched.selected.releaseTracks } : null;
13325
13326
  };
13327
+ var workspaceTrailers = (cwd, dir) => {
13328
+ let matched;
13329
+ try {
13330
+ matched = matchRuntimeWorkspace(cwd, dir);
13331
+ } catch {
13332
+ return { enabled: true, workspace: null, from: null };
13333
+ }
13334
+ if (!matched)
13335
+ return { enabled: true, workspace: null, from: null };
13336
+ const { selected, matches } = matched;
13337
+ const enclosing = matches.filter((entry) => entry !== selected).toSorted((a, b) => globSpecificity(b.glob) - globSpecificity(a.glob));
13338
+ const source = [selected, ...enclosing].find((entry) => typeof entry.trailers === "boolean");
13339
+ return {
13340
+ enabled: source?.trailers !== false,
13341
+ workspace: selected.name,
13342
+ from: source?.name ?? null
13343
+ };
13344
+ };
13326
13345
  var resolveRuntimeWorkspaceCandidate = (cwd, kind) => {
13327
13346
  const matched = matchRuntimeWorkspace(cwd);
13328
13347
  if (!matched)
@@ -15695,9 +15714,9 @@ Autonomy contract:
15695
15714
  ship), go to the effective endpoint in \`workit grant show\`: \`pr\` opens
15696
15715
  the PR; \`green\` babysits it without asking (workit-ship) to merge-ready,
15697
15716
  never merging; \`merged\` also lands it with \`workit pr merge\`.
15698
- Merge and release need a workspace grant, which only the user raises from
15699
- their own terminal (a blocked verb names how); never edit workspaces.json or
15700
- route around a grant_required.
15717
+ Merge and release need a workspace grant only the user raises from their
15718
+ own terminal (a blocked verb names how); never edit workspaces.json or route
15719
+ around a grant_required.
15701
15720
  - Ask only for a product or preference choice, or for authority you lack, with
15702
15721
  your recommended answer. Facts are yours: read, run or prototype.
15703
15722
  - Label claims measured (run and seen this session), inferred, or guess.
@@ -15706,17 +15725,19 @@ Autonomy contract:
15706
15725
  - Author is not verifier: your own verdict is \`--self\`, shown as
15707
15726
  self-reviewed, never verified. High risk, \`verification: independent\` and
15708
15727
  merge need a verifier with its own host-derived session (a subagent's
15709
- \`<lead>:<child>\`, set by the host); never hand-mint one such as \`<lead>-v1\`.
15728
+ \`<lead>:<child>\`); never hand-mint one (\`<lead>-v1\`).
15710
15729
  - A local-commit endpoint does not imply PR readiness, and a local commit alone
15711
15730
  is not evidence of a requested remote push. Before reporting delivery,
15712
15731
  reconcile every requested item and observe it (\`workit verify-delivery\`).
15713
15732
 
15714
15733
  CLI first: if a step has one right answer, use the \`workit\` verb instead of
15715
15734
  hand-running git, gh or glab (\`workit git|pr|ci|check\`; \`workit help\` lists
15716
- the rest; without \`workit\` on PATH, \`npx -y @brainervirus/workit-cli\`).
15735
+ the rest; lacking \`workit\`, \`npx -y @brainervirus/workit-cli\`).
15736
+ Add Co-Authored-By via \`workit git commit --trailer "K: v" -- <paths>\`, never
15737
+ an amend.
15717
15738
  The task families (task, policy, evidence, finding, decision, worker, state)
15718
15739
  are optional continuity for tracked work; each branch has one implicit task,
15719
- created by the first recording, and a solo edit needs no task. A decision
15740
+ and a solo edit needs no task. A decision
15720
15741
  records a user choice; it never authorizes an effect. Judge work once with
15721
15742
  \`workit policy assess --judge risk= behavior= product-choice= plan=\`.
15722
15743
  Across repositories, bind each item to its checkout, branch and endpoint,
@@ -20950,7 +20971,7 @@ var workitRole = (descriptor, agentType) => {
20950
20971
  };
20951
20972
  var subagentSession = (session, agentId) => [session, agentId].filter((part) => Boolean(part)).join(":").replace(/[^A-Za-z0-9_.:@/+-]/g, "-").slice(0, 128);
20952
20973
  var CLAUDE_WORKTREE = /[\\/]\.claude[\\/]worktrees[\\/]/;
20953
- var ISOLATED_GIT = 'Run git as plain, separate commands inside your worktree (`git switch -c <branch> <base>`, `git commit --trailer "Workit-Session=<your session>"`, `git push`; `workit doctor --fix` can install a commit-msg hook that adds the trailer), never `workit git …`: Claude Code\'s worktree isolation refuses a command that wraps git and cannot be turned off (https://code.claude.com/docs/en/worktrees#how-claude-code-enforces-isolation). Never dodge that check by renaming or re-wrapping git. Use workit for the non-git verbs (`workit check`, `workit ledger`, `workit pr`).';
20974
+ var isolatedGit = (cwd) => `Run git as plain, separate commands inside your worktree (\`git switch -c <branch> <base>\`, ${workspaceTrailers(cwd).enabled ? '`git commit --trailer "Workit-Session=<your session>"`, `git push`; `workit doctor --fix` can install a prepare-commit-msg hook that adds the trailer' : "`git commit` (this workspace sets trailers: false: add no Workit-Session trailer), `git push`"}; add Co-Authored-By with \`git commit --trailer\` in the same commit, never by amending), never \`workit git …\`: Claude Code's worktree isolation refuses a command that wraps git and cannot be turned off (https://code.claude.com/docs/en/worktrees#how-claude-code-enforces-isolation). Never dodge that check by renaming or re-wrapping git. Use workit for the non-git verbs (\`workit check\`, \`workit ledger\`, \`workit pr\`).`;
20954
20975
  var subagentStartText = (input, descriptor, event) => {
20955
20976
  const session = input.session.id ?? null;
20956
20977
  const role = workitRole(descriptor, event.agentType);
@@ -20958,9 +20979,9 @@ var subagentStartText = (input, descriptor, event) => {
20958
20979
  const isolated = descriptor.subagents.worktreeIsolation === "native" && (role === "implementer" || CLAUDE_WORKTREE.test(input.cwd));
20959
20980
  const guide = role === "implementer" ? branchGuidance(input.cwd) : null;
20960
20981
  if (role === "implementer" && isolated)
20961
- return `Workit observed ${who} working in its own git worktree: it may edit and commit there, within its brief's scope. ${ISOLATED_GIT} Plain git is expected here, and the branch name is still policy-checked: a raw \`git switch -c\`, \`git checkout -b\`, \`git branch\` or \`git worktree add -b\` onto a protected or non-compliant name is denied, so use a policy-compliant branch.${guide ? ` ${guide}` : " (e.g. feature/<slug>)"} Never record a verdict on your own work. Never push, open a PR, or merge unless the brief asks for it.`;
20982
+ return `Workit observed ${who} working in its own git worktree: it may edit and commit there, within its brief's scope. ${isolatedGit(input.cwd)} Plain git is expected here, and the branch name is still policy-checked: a raw \`git switch -c\`, \`git checkout -b\`, \`git branch\` or \`git worktree add -b\` onto a protected or non-compliant name is denied, so use a policy-compliant branch.${guide ? ` ${guide}` : " (e.g. feature/<slug>)"} Never record a verdict on your own work. Never push, open a PR, or merge unless the brief asks for it.`;
20962
20983
  if (isolated)
20963
- return `${ISOLATED_GIT}
20984
+ return `${isolatedGit(input.cwd)}
20964
20985
  ${subagentStartText({ ...input, cwd: "" }, descriptor, event)}`;
20965
20986
  if (role === "implementer")
20966
20987
  return `Workit observed ${who} as an implementer: it edits and commits only in its own git worktree (the lead makes one with \`workit fanout worktree create <slice>\`), never in the lead's checkout, within its brief's scope. Before the first commit, switch to a policy-compliant branch with \`workit git branch <branch> --base <base>\` (or \`--kind <kind> --slug <slug>\`, which picks the base); branch policy hooks still deny protected or non-compliant branches, raw git included.${guide ? ` ${guide}` : " (e.g. feature/<slug>)"} Never record a verdict on your own work. Never push, open a PR, or merge unless the brief asks for it.`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brainervirus/workit-pi",
3
- "version": "8.11.0",
3
+ "version": "8.12.0",
4
4
  "description": "Workit native extension for Pi — tools, method skills, and session continuity",
5
5
  "keywords": [
6
6
  "agentic-coding",
@@ -25,7 +25,7 @@ REPORT: branch, head SHA, files changed, each VERIFY command with its exit code,
25
25
  each ACCEPTANCE line met / not met, rulings you made (`workit ledger ruling`),
26
26
  anything out of scope as a follow-up, not a diff.
27
27
  STANDING: <the standing orders, verbatim: `workit ledger standing add` records each one>
28
- export WORKIT_SESSION_ID=<lead>-w<n> (set by the lead for a worker's commits; a verifier brief sets none: the host derives it)
28
+ <identity line, per the lead's host: see "Identity and git rules per host" below>
29
29
  ```
30
30
 
31
31
  ## Worked example
@@ -97,17 +97,32 @@ is the slice's STUCK threshold in `workit fanout status`. `"fanIn":
97
97
  }
98
98
  ```
99
99
 
100
+ ## Identity and git rules per host
101
+
102
+ `workit fanout brief` renders the identity line and RULES 1 and 3 for the
103
+ lead's host (`WORKIT_HOST`, or the host's own session variable):
104
+
105
+ | Lead's host | Identity line | RULES 1 and 3 |
106
+ | --- | --- | --- |
107
+ | Claude Code | `Session: your env already has WORKIT_SESSION_ID (the lead's id)`; no `export`, no hand-minted id (SubagentStart issues `<lead>:<agent id>` only to verifiers and reviewers, never to an implementer, so the worker's commits carry the lead's id) | plain git: `git fetch origin && git switch -c <branch> origin/<base>` and `git commit -m <msg> --trailer "Workit-Session: <the env WORKIT_SESSION_ID>" --trailer "<host attribution>" -- <paths in SCOPE>`, because worktree isolation refuses every `workit git` form |
108
+ | OpenCode, Pi, Codex | `Session: your host already sets WORKIT_SESSION_ID in your shell`; export nothing (the host derives the id and an export cannot replace it) | `workit git branch <branch> --base <base>`, `workit git commit -m <msg> -- <paths in SCOPE>` |
109
+ | Cursor, CI, a plain terminal | `export WORKIT_SESSION_ID=<lead>-w-<slice>` (`+try<n>` for a race attempt): declared, not checked | the same `workit git` forms |
110
+
111
+ `MODE: resume` is `git switch <branch>` on every host (the branch exists; the
112
+ lead removed the dead worker's worktree after its exit, so the switch
113
+ succeeds), then continue from its head. A race attempt (`--attempt <n>`)
114
+ follows its host's row with the branch `<branch>-try<n>`.
115
+
100
116
  ## Worker rules (`workit fanout brief` appends them as RULES)
101
117
 
102
- 1. First command. `MODE: new`: `workit git branch <branch> --base <base>` (the
103
- worktree may start on a name that breaks branch policy). `MODE: resume`:
104
- `git switch <branch>` (the branch exists; the lead removed the dead
105
- worker's worktree after its exit, so the switch succeeds), then continue
106
- from its head.
118
+ 1. First command: create the branch (`MODE: new`; the worktree may start on a
119
+ name that breaks branch policy) or `git switch` to it (`MODE: resume`),
120
+ as the table above says for your host.
107
121
  2. Decide ambiguities yourself and record them:
108
122
  `workit ledger ruling "<what>" --why "<why>" --cost-if-wrong "<cost>"`.
109
123
  Stop only for an irreversible action, a security-sensitive one, or a side
110
124
  effect outside the worktree.
111
- 3. Commit with `workit git commit -m "<msg>" -- <paths in SCOPE>`; push only if
112
- the brief says so.
125
+ 3. Commit as the table says (`workit git commit -m "<msg>" -- <paths in SCOPE>`,
126
+ or plain git with the trailers on Claude Code); push only if the brief says
127
+ so.
113
128
  4. Never record a verdict on your own work.
@@ -73,8 +73,8 @@ Which session id a verdict carries, per host:
73
73
  - Claude Code: subagents inherit your `WORKIT_SESSION_ID`, so the
74
74
  SubagentStart hook names each `verifier` and `reviewer` its own session
75
75
  (`<lead>:<agent id>`), passed exactly as `--session`: the hook records the
76
- ids it issues, and only those are accepted. An `implementer` uses the
77
- session its brief exports for its workit commands.
76
+ ids it issues, and only those are accepted. An `implementer` is issued
77
+ none: it keeps your id in its env for its workit commands and commits.
78
78
  - Codex: the `workit-verifier` and `workit-reviewer` agents get the same
79
79
  issued `--session` from SubagentStart; any other verifier passes
80
80
  `--as verifier`.
@@ -84,8 +84,13 @@ Which session id a verdict carries, per host:
84
84
  - Cursor (no session id in the shell): the brief sets the verifier's
85
85
  `WORKIT_SESSION_ID=<lead>:verifier-<random hex>`, a fresh suffix per
86
86
  verifier. Cursor cannot check it: it is declared, not derived.
87
- - A worker's commits use `export WORKIT_SESSION_ID=<lead>-w-<slice>` from
88
- `workit fanout brief`. A verdict under an id you made up (`<lead>-v1`,
87
+ - A worker's commits: on Claude Code the lead's `WORKIT_SESSION_ID` already in
88
+ its env (SubagentStart issues no implementer id; plain git, no export, so the
89
+ lead authored those commits: a verifier or reviewer records the verdict, not
90
+ the lead); on OpenCode, Pi and Codex the id the host already
91
+ puts in its shell; on Cursor, CI and a plain terminal the brief's
92
+ `export WORKIT_SESSION_ID=<lead>-w-<slice>` (see `brief.md`, "Identity and
93
+ git rules per host"). A verdict under an id you made up (`<lead>-v1`,
89
94
  `<lead>:v1`) is refused as `forged_session` on Claude Code, Codex,
90
95
  OpenCode and Pi.
91
96