@bluenyang/reins 0.1.4 → 0.1.5-rc.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/README.md CHANGED
@@ -14,10 +14,13 @@ loop that works only with Claude. The full list (P1–P6) is in [docs/proposal.m
14
14
 
15
15
  ## Status
16
16
 
17
- Version 0.1.0 is on npm: `npx @bluenyang/reins <command>`. It is round one of the plan — the graph
17
+ Version 0.1.4 is on npm: `npx @bluenyang/reins <command>`. It is round one of the plan — the graph
18
18
  tier, with generated vendor files verified for Claude Code only; the loop and harness tiers are
19
- carved out of it in 0.2. Known issues are listed in [CHANGELOG.md](CHANGELOG.md); their fixes ship
20
- as 0.1.1, and 0.1.2 adds a Claude Code plugin.
19
+ carved out of it in 0.2. 0.1.3 split the loop into stage skills with a PR → CI → rc release flow,
20
+ 0.1.4 prepares large repositories (release settings, monorepo gates, migrate fixes), and 0.1.5
21
+ (in rc) states which rules are enforced and which are only advised, splits model bindings into a team
22
+ and a per-user layer, and runs CI on Ubuntu, Windows and macOS with Node 22 and 24. What
23
+ changed in each version is in [CHANGELOG.md](CHANGELOG.md); what comes next is in the roadmap.
21
24
 
22
25
  reins develops itself through its own loop: intents 001 (`reins status`), 002 (`reins metrics`) and
23
26
  003 (violation scenarios) each went intent → spec → plan → tickets, with the checks at T1 to T5
@@ -46,10 +49,12 @@ separation is not model separation: every role can run on one model, and `bindin
46
49
  vendor and model per role. By design, a role bound to a vendor that is not detected falls back to its
47
50
  fallback, else to the pm model, so all twelve roles can run on Claude alone.
48
51
 
49
- **Red lines.** Ten rules (C1–C10) apply to every role and are enforced by the verifier, for
52
+ **Red lines.** Ten rules (C1–C10) apply to every role, for
50
53
  example: no implementing "to pass" (C1), no editing managed blocks, policy or roles (C2), no
51
54
  editing one's own permission file (C3), no reading secrets (C4), no bypassing hooks (C5), and no
52
- push, PR, merge or release outside the deploy role (C6). The list is in [docs/design.md](docs/design.md) section 2.
55
+ push, PR, merge or release outside the deploy role (C6). The list is in [docs/design.md](docs/design.md) section 2. How
56
+ each rule is actually held is in [Enforced versus advised](#enforced-versus-advised) below: some are blocked, some are checked at a
57
+ transition, and some are only written in a role or skill.
53
58
 
54
59
  **The verifier.** `reins check` runs at transition points and prints one verdict. It does not call
55
60
  a model; roles write their judgement to a handoff file and the verifier applies it.
@@ -78,6 +83,79 @@ reviewed by roles. Verification output is pasted as produced; a bare "passed" is
78
83
  | `.claude/` | yes | generated from `.agents/`; do not edit |
79
84
  | `.loctx/` | no (gitignored) | tickets, reports, handoff `bus/`, `history/`, local roadmap |
80
85
 
86
+ ## Enforced versus advised
87
+
88
+ Not every rule is enforced. Each one is held in one of three ways, and `harness/policy/enforcement.yaml` says which, one line per rule.
89
+
90
+ - **blocked**: a script, hook or permission deny stops the action before it happens.
91
+ - **checked**: a transition check, the drift check or CI catches it afterwards.
92
+ - **advised**: it is written in a role or skill only; nothing in code catches it.
93
+
94
+ The grade is the strongest part that really holds, and the `gap` column says what is left open. Hooks apply only when they are installed, and deny rules and agent tool limits exist for Claude Code only. Rule ids are in [docs/design.md](docs/design.md) sections 2 and 3, and the evidence is in [docs/violations.md](docs/violations.md). The advised rules are the input for [0.2](docs/ROADMAP.md).
95
+
96
+ <!-- enforcement:begin -->
97
+ | id | held | by | gap |
98
+ |---|---|---|---|
99
+ | C1 | advised | `role` | judged by reviewers only; nothing detects a hard-coded pass |
100
+ | C2 | blocked | `hook:pre-commit`, `check:drift` | only when the hook is installed; the edit itself is not prevented |
101
+ | C3 | blocked | `hook:pre-commit`, `check:drift` | only when the hook is installed; no deny rule covers .claude/settings.json itself |
102
+ | C4 | blocked | `deny`, `hook:pre-commit` | Claude Code only; .env.* is a finite list, so names such as .env.custom have no deny rule; the hook sees staged paths, not reads |
103
+ | C5 | blocked | `deny`, `gate`, `check:verdict` | combined or later-position forms such as git commit -nm are not denied |
104
+ | C6 | advised | `role` | pre-push holds pushes to the default branch (A4) and the deny rules stop force and --no-verify pushes; any other push, PR, merge, release or tag is not blocked |
105
+ | C7 | advised | `role` | — |
106
+ | C8 | advised | `role` | — |
107
+ | C9 | advised | `role` | — |
108
+ | C10 | advised | `role` | T2 lists it but the pre-commit check does not compare the diff with plan.md |
109
+ | A1 | blocked | `deny`, `hook:pre-push` | moving a published tag forward to a descendant passes the ancestry test |
110
+ | A2 | advised | `role` | — |
111
+ | A3 | advised | `role` | — |
112
+ | A4 | blocked | `hook:pre-push` | only a push to the default branch is held; other ways of leaving the machine are not detected |
113
+ | B1 | checked | `check:ticket-start` | — |
114
+ | B2 | advised | `role` | — |
115
+ | B3 | advised | `role`, `check:ticket-start` | the scope conflict is a role's judgement; ticket-start checks only the approval chain |
116
+ | B4 | advised | `role` | — |
117
+ | B5 | advised | `role` | — |
118
+ | P1 | advised | `role` | — |
119
+ | P2 | checked | `check:ticket-start`, `check:rc-close` | only ticket-in-plan; a diff is not compared with plan.md |
120
+ | D1 | checked | `check:verdict` | does not tell a ticket before rc.1 from an rc after |
121
+ | D2 | advised | `role` | no memory across runs |
122
+ | D3 | advised | `role` | no alone-versus-full-run comparison |
123
+ | D4 | blocked | `gate`, `check:verdict` | an empty gate output is only a WARN |
124
+ | D5 | checked | `check:verdict` | — |
125
+ | E1 | advised | `role` | nothing reads a budget or a token count |
126
+ | E2 | advised | `role` | nothing reads a budget or a token count |
127
+ | E3 | advised | `role` | T5 lists it but nothing reads a budget or a token count |
128
+ | F1 | advised | `role` | the deny rules stop some attempts in Claude Code, but no stop is recorded |
129
+ | F2 | blocked | `hook:pre-commit`, `check:drift`, `check:ticket-start`, `check:rc-close` | — |
130
+ | F3 | advised | `role` | — |
131
+ | G1 | advised | `role` | no signal handler and no resume record on an interrupt |
132
+ | G2 | advised | `role` | — |
133
+ | T1 | checked | `check:ticket-start` | budget-left is not implemented |
134
+ | T2 | blocked | `hook:pre-commit` | only when the hook is installed; the P2 and C10 diff checks do not exist |
135
+ | T3 | checked | `check:verdict` | — |
136
+ | T4 | blocked | `hook:pre-push` | implements A1 and the default-branch push (A4); A2, A3, C6 and the loop-step check do not exist |
137
+ | T5 | checked | `check:rc-close` | E3 is not implemented |
138
+ | T6 | advised | `role` | no code runs on an interrupt or a violation signal |
139
+
140
+ | role | blocked | checked | advised | blocked items |
141
+ |---|---|---|---|---|
142
+ | advisor | 0 | 0 | 2 | — |
143
+ | code-review | 1 | 0 | 2 | edit code |
144
+ | deploy | 1 | 0 | 2 | force-push, delete or move tags, rewrite main |
145
+ | docs | 0 | 0 | 3 | — |
146
+ | implementer | 0 | 0 | 5 | — |
147
+ | lookup | 3 | 0 | 0 | write any file; produce reports or context files; run gates or tests |
148
+ | planner | 0 | 0 | 3 | — |
149
+ | pl | 0 | 0 | 3 | — |
150
+ | pm | 0 | 1 | 2 | — |
151
+ | qa-design | 0 | 0 | 3 | — |
152
+ | qa-run | 0 | 0 | 2 | — |
153
+ | verify-tool | 0 | 2 | 1 | — |
154
+ | budget scopes | 0 | 0 | 6 | — |
155
+ <!-- enforcement:end -->
156
+
157
+ The tables are rendered by `pnpm docs:enforcement` and a test keeps them equal to the YAML.
158
+
81
159
  ## Quick start
82
160
 
83
161
  In Claude Code, install the plugin and let it set the repository up:
@@ -88,7 +166,7 @@ In Claude Code, install the plugin and let it set the repository up:
88
166
  /reins:reins-setup
89
167
  ```
90
168
 
91
- For Codex, Antigravity, Cursor or a plain terminal, use the CLI. It requires Node 20 or later. Run it from the root of the repository you want to set up; the repository
169
+ For Codex, Antigravity, Cursor or a plain terminal, use the CLI. It requires Node 22 or later. Run it from the root of the repository you want to set up; the repository
92
170
  needs at least one commit (`check` fails on an empty history in 0.1.0):
93
171
 
94
172
  ```sh
@@ -370,7 +370,7 @@ export function runCheck(opts) {
370
370
  : verdictCheck(root, opts.ticket)));
371
371
  }
372
372
  else if (opts.stage === 'rc-close')
373
- findings.push(...rcClose(root, opts.release));
373
+ findings.push(...rcClose(root, opts.release, opts.stable));
374
374
  if (opts.drift || !opts.stage)
375
375
  findings.push(...driftFormat(root), ...driftConvention(root), ...driftMatch(root), ...driftBlocks(root), ...driftGenerated(root));
376
376
  if (!currentBranch(root))
@@ -2,6 +2,7 @@ import { existsSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { parse, parseDocument, stringify } from 'yaml';
4
4
  import { CONFIRMED_MODELS, checkBinding, newModelCache, subdirProposals, vendorOf, vendors, } from '../lib/detect.js';
5
+ import { readLocal, recordDetection, resolveBindings, writeLocal, } from '../lib/bindings.js';
5
6
  import { generateVendorFiles } from '../lib/generate.js';
6
7
  import { repoRoot } from '../lib/git.js';
7
8
  import { writeGenerated } from '../lib/vendor-write.js';
@@ -19,8 +20,37 @@ export async function configureBindings(o) {
19
20
  let doc = parse(readFileSync(path, 'utf8'));
20
21
  const changed = [];
21
22
  const cache = o.modelCache ?? newModelCache();
23
+ const detect = o.detectVendors ?? vendors;
24
+ const teamTable = () => Object.entries(doc.roles)
25
+ .map(([role, b]) => ({ role, vendor: b.vendor, model: b.model }))
26
+ .toSorted((a, b) => a.role.localeCompare(b.role));
27
+ if (o.show)
28
+ return { changed, table: teamTable(), resolved: resolveBindings(root, detect) };
29
+ if (o.local) {
30
+ // per-user overrides: roles only; the team file and generated files stay untouched
31
+ const local = readLocal(root);
32
+ for (const pair of o.set ?? []) {
33
+ const [role, model] = pair.split('=').map((s) => s.trim());
34
+ if (!role || !model)
35
+ return { refused: `"${pair}" is not role=model`, changed: [], table: [] };
36
+ if (!roles.has(role))
37
+ return {
38
+ refused: `unknown role "${role}" — roles: ${[...roles].toSorted().join(', ')}`,
39
+ changed: [],
40
+ table: [],
41
+ };
42
+ if (local.roles[role]?.model !== model) {
43
+ local.roles[role] = { model };
44
+ changed.push(role);
45
+ }
46
+ }
47
+ if (changed.length)
48
+ writeLocal(root, local);
49
+ return { changed, table: teamTable(), resolved: resolveBindings(root, detect) };
50
+ }
22
51
  if (o.vendors?.length) {
23
- const vs = (o.detectVendors ?? vendors)();
52
+ const vs = detect();
53
+ recordDetection(root, vs);
24
54
  const avail = new Set([
25
55
  'claude',
26
56
  ...o.vendors.filter((v) => ['openai', 'google', 'cursor'].includes(v)),
@@ -72,10 +102,7 @@ export async function configureBindings(o) {
72
102
  const generated = changed.length
73
103
  ? writeGenerated(root, generateVendorFiles(root), false)
74
104
  : undefined;
75
- const table = Object.entries(doc.roles)
76
- .map(([role, b]) => ({ role, vendor: b.vendor, model: b.model }))
77
- .toSorted((a, b) => a.role.localeCompare(b.role));
78
- return { changed, table, generated };
105
+ return { changed, table: teamTable(), generated, resolved: resolveBindings(root, detect) };
79
106
  }
80
107
  /** `reins configure gates [--add <name>…]` (spec S-7): subdirectory proposals, appended after the existing gates. */
81
108
  export function configureGates(o = {}) {
@@ -56,7 +56,7 @@ export function runGates(o) {
56
56
  }
57
57
  /** One line per failing gate for stdout: the first failure signature and the first file:line in the raw report. */
58
58
  export function failureSummary(report) {
59
- const lines = report.split('\n').filter((l) => l.trim() && !l.startsWith('$ '));
59
+ const lines = report.split(/\r?\n/).filter((l) => l.trim() && !l.startsWith('$ '));
60
60
  const sig = lines.find((l) => /\b(error|fail(ed|ure)?|assertion|✗|×)\b/i.test(l) && !/^exit \d+$/.test(l)) ??
61
61
  lines.find((l) => !/^exit \d+$/.test(l)) ??
62
62
  '';
@@ -10,6 +10,7 @@ import { repoRoot } from '../lib/git.js';
10
10
  import { SKILLS_INDEX_HEADER, skillsIndex, splitFrontmatter } from '../lib/skills.js';
11
11
  import { harnessVersion, packageHarness, packageSkills, packageVersion, tierSkills, } from '../lib/upstream.js';
12
12
  import { generateVendorFiles } from '../lib/generate.js';
13
+ import { recordDetection } from '../lib/bindings.js';
13
14
  import { writeGenerated } from '../lib/vendor-write.js';
14
15
  /** Which upstream harness files a tier installs (design §1, tier table). */
15
16
  export function tierFiles(all, tier) {
@@ -89,10 +90,7 @@ export function buildBindings(harness, available, vs, mode, cache) {
89
90
  const doc = {
90
91
  schema: 'reins/bindings@1',
91
92
  mode,
92
- vendors: Object.fromEntries(vs.map((v) => [
93
- v.name,
94
- { cli: v.cli, detected: v.detected, available: available.has(v.name) },
95
- ])),
93
+ vendors: Object.fromEntries(vs.map((v) => [v.name, { cli: v.cli, available: available.has(v.name) }])),
96
94
  roles,
97
95
  escalation: ['pl', 'pm', 'advisor', 'user'],
98
96
  limits: {},
@@ -201,8 +199,12 @@ export async function runInstall(o) {
201
199
  add('.agents/harness/gates.yaml', buildGates(root, [...(/^y/i.test(okGates) ? proposal.gates : []), ...chosen]), 'declared gates');
202
200
  }
203
201
  // 3. generated configuration
204
- if (o.tier === 'graph' && !hasBindings)
202
+ if (o.tier === 'graph' && !hasBindings) {
203
+ // detection results are per-user: .loctx/bindings.local.yaml, never the committed file
204
+ if (!o.dryRun)
205
+ recordDetection(root, vs);
205
206
  add('.agents/harness/bindings.yaml', buildBindings(up, avail, vs, o.mode, o.modelCache ?? newModelCache()), 'role ↔ model bindings');
207
+ }
206
208
  add('.agents/harness/install.yaml', `# version pin and install settings (R25) — read by reins update\n${stringify({ ...pinned, schema: 'reins/install@1', tier: o.tier, version, cli: packageVersion(), mode: o.mode, language })}`, 'version pin');
207
209
  // 4. layout skeleton (design §1); never overwrite project files
208
210
  if (o.tier !== 'harness') {
@@ -35,7 +35,7 @@ export function proposeKnowledge(key, o = {}) {
35
35
  for (const f of o.from ?? []) {
36
36
  const abs = resolve(root, f.includes('/') ? f : join('.loctx', 'history', f));
37
37
  const rel = relative(hist, abs);
38
- if (rel.startsWith('..') || rel.includes('/') || !existsSync(abs))
38
+ if (rel.startsWith('..') || /[\\/]/.test(rel) || !existsSync(abs))
39
39
  return { refused: `--from ${f}: not a page under .loctx/history/` };
40
40
  const text = readFileSync(abs, 'utf8');
41
41
  const lines = [...text.matchAll(/^(?:decisions|reasons):\s*(.+)$/gm)].flatMap((m) => m[1].split(',').map((x) => x.trim()));
@@ -1,6 +1,7 @@
1
1
  import { existsSync, mkdirSync, readFileSync, readdirSync, renameSync, rmdirSync, statSync, unlinkSync, writeFileSync, } from 'node:fs';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { applyBlocks, parseBlocks, swapSections } from '../lib/blocks.js';
4
+ import { relPath } from '../lib/fsx.js';
4
5
  import { generation } from '../lib/detect.js';
5
6
  import { repoRoot } from '../lib/git.js';
6
7
  import { convertWorkToTicket, planMigration } from '../lib/migrate-plan.js';
@@ -112,8 +113,8 @@ export async function runMigrate(o) {
112
113
  else {
113
114
  const alt = to.replace(/(\.[^./]+)?$/, '.from-ai$1');
114
115
  renameSync(from, alt);
115
- res.moves.push({ ...m, to: alt.slice(root.length + 1), result: 'kept-both' });
116
- res.report.push(`${m.to} already existed — the old file is next to it as ${alt.slice(root.length + 1)}`);
116
+ res.moves.push({ ...m, to: relPath(root, alt), result: 'kept-both' });
117
+ res.report.push(`${m.to} already existed — the old file is next to it as ${relPath(root, alt)}`);
117
118
  }
118
119
  }
119
120
  if (!o.dryRun)
@@ -1,5 +1,5 @@
1
1
  import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync } from 'node:fs';
2
- import { dirname, join } from 'node:path';
2
+ import { basename, dirname, join } from 'node:path';
3
3
  import { harnessDir } from '../lib/harness.js';
4
4
  import { loadSchemas, validateFile } from '../lib/schema.js';
5
5
  import { intentDir, intentFile, intentIds, openTickets } from '../lib/work.js';
@@ -41,7 +41,7 @@ function historyTicketIds(root, intent) {
41
41
  const out = [];
42
42
  for (const f of ls(dir).filter((e) => e.endsWith('.md'))) {
43
43
  const head = readFileSync(join(dir, f), 'utf8')
44
- .split('\n')
44
+ .split(/\r?\n/)
45
45
  .find((l) => l.startsWith('# ')) ?? '';
46
46
  for (const m of `${f}\n${head}`.matchAll(re))
47
47
  out.push(m[1]);
@@ -129,10 +129,7 @@ export function newTicket(root, intent, step, slug, o = {}) {
129
129
  : [];
130
130
  const open = openTickets(root).map((f) => String(f.data['id'] ?? ''));
131
131
  const n = ticketNumber(intent, planned, [...open, ...historyTicketIds(root, intent)]);
132
- const iSlug = idir
133
- .split('/')
134
- .pop()
135
- .replace(/^\d{3}_/, '');
132
+ const iSlug = basename(idir).replace(/^\d{3}_/, '');
136
133
  const branch = typeof plan.data['branch'] === 'string' ? plan.data['branch'] : `feat/${intent}-${iSlug}`;
137
134
  const depends = (o.depends ?? '')
138
135
  .split(',')
@@ -1,7 +1,8 @@
1
1
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
2
  import { isAbsolute, join, relative, sep } from 'node:path';
3
+ import { isWithin, realPath } from '../lib/fsx.js';
3
4
  import { harnessDir, readYaml } from '../lib/harness.js';
4
- import { dispatchLines, readRelease } from '../lib/release.js';
5
+ import { checkDoc, dispatchLines, readRelease, readReleaseDocs } from '../lib/release.js';
5
6
  import { loadSchemas, validateFile } from '../lib/schema.js';
6
7
  import { compound } from './gate.js';
7
8
  import { approvedBy, busFor, historyPages, intentFile, intentIds, openTickets, recordedDecisions, ticketFile, } from '../lib/work.js';
@@ -189,10 +190,9 @@ export function ticketStart(root, id) {
189
190
  export function readEvidence(root, evidence) {
190
191
  const tokens = evidence.split(/\s+/).filter(Boolean);
191
192
  // an absolute path inside the repository reads like a relative one; outside it is refused
192
- const inside = (t) => {
193
- const rel = relative(root, t);
194
- return rel !== '..' && !rel.startsWith(`..${sep}`) && !isAbsolute(rel);
195
- };
193
+ // macOS: tmpdir() is /var/... while git reports /private/var/...; Windows: RUNNER~1 vs the long name
194
+ const real = realPath;
195
+ const inside = (t) => isWithin(real(root), real(t));
196
196
  const outside = tokens.filter((t) => isAbsolute(t) && !inside(t));
197
197
  const resolve = (t) => (isAbsolute(t) ? t : join(root, t));
198
198
  const files = tokens.length > 0 && tokens.every((t) => existsSync(resolve(t)));
@@ -200,7 +200,7 @@ export function readEvidence(root, evidence) {
200
200
  ? outside.map((t) => ({ source: t, text: '', outside: true }))
201
201
  : files
202
202
  ? tokens.map((t) => ({
203
- source: isAbsolute(t) ? relative(root, t) : t,
203
+ source: isAbsolute(t) ? relative(real(root), real(t)).split(sep).join('/') : t,
204
204
  text: readFileSync(resolve(t), 'utf8'),
205
205
  }))
206
206
  : [{ source: 'inline', text: evidence }];
@@ -366,7 +366,7 @@ export function verdictCheck(root, id) {
366
366
  return findings;
367
367
  }
368
368
  /** T5 — an rc closes: every planned ticket of the release's intents is done and recorded. */
369
- export function rcClose(root, release) {
369
+ export function rcClose(root, release, stable = false) {
370
370
  if (!release)
371
371
  return [
372
372
  {
@@ -433,11 +433,34 @@ export function rcClose(root, release) {
433
433
  });
434
434
  }
435
435
  if (findings.length === 0)
436
- findings.push(...nextRc(root, release));
436
+ findings.push(...(stable ? noRcRecorded(root, release) : nextRc(root, release)));
437
437
  if (findings.every((f) => f.verdict === 'WARN'))
438
- findings.push(...dispatchFindings(root, findings));
438
+ findings.push(...(stable ? stableFindings(root, release) : dispatchFindings(root, findings)));
439
+ findings.push(...docsFindings(root, release, stable ? 'stable' : 'rc'));
439
440
  return findings;
440
441
  }
442
+ /** One F2 WARN per `release.docs` file that still describes the previous state (S-7); never a STOP. */
443
+ export function docsFindings(root, release, stage) {
444
+ const out = [];
445
+ for (const d of readReleaseDocs(root)) {
446
+ let text = null;
447
+ try {
448
+ text = readFileSync(join(root, d.file), 'utf8');
449
+ }
450
+ catch {
451
+ // missing, a directory or unreadable: the same advisory warning, and the other documents are still checked
452
+ }
453
+ if (text !== null && checkDoc(text, d.check, release, stage))
454
+ continue;
455
+ out.push({
456
+ reason: 'F2',
457
+ verdict: 'WARN',
458
+ path: d.file,
459
+ message: `docs: ${d.file} still describes the previous state (${d.check})`,
460
+ });
461
+ }
462
+ return out;
463
+ }
441
464
  /** The rc dispatch lines (S-3) from install.yaml `release:`; the rc number comes from the ledger finding. */
442
465
  function dispatchFindings(root, found) {
443
466
  const rc = found.map((f) => /^next rc: (\S+)$/.exec(f.message)?.[1]).find(Boolean);
@@ -455,7 +478,44 @@ function dispatchFindings(root, found) {
455
478
  return [
456
479
  { reason: 'F2', verdict: 'WARN', message: 'no release workflow is set for the rc stage' },
457
480
  ];
458
- return lines.map((l) => ({ reason: 'F2', verdict: 'WARN', message: `dispatch: ${l}` }));
481
+ return [
482
+ ...lines.map((l) => ({ reason: 'F2', verdict: 'WARN', message: `dispatch: ${l}` })),
483
+ {
484
+ reason: 'F2',
485
+ verdict: 'WARN',
486
+ message: "stable: rerun with --stable on the user's instruction",
487
+ },
488
+ ];
489
+ }
490
+ /** The stable dispatch lines (S-9): printed only under --stable, labelled so an agent does not run them unasked. */
491
+ function stableFindings(root, release) {
492
+ const ws = readRelease(root);
493
+ if (!ws)
494
+ return [
495
+ {
496
+ reason: 'F2',
497
+ verdict: 'WARN',
498
+ message: 'no release settings (install.yaml has no release:) — merge only',
499
+ },
500
+ ];
501
+ const lines = dispatchLines(ws, 'stable', release);
502
+ if (lines.length === 0)
503
+ return [
504
+ { reason: 'F2', verdict: 'WARN', message: 'no release workflow is set for the stable stage' },
505
+ ];
506
+ return lines.map((l) => ({
507
+ reason: 'F2',
508
+ verdict: 'WARN',
509
+ message: `dispatch (stable — user's instruction only, A2): ${l}`,
510
+ }));
511
+ }
512
+ /** A stable normally follows an rc: WARN when the ledger records none. */
513
+ function noRcRecorded(root, release) {
514
+ const path = join(root, '.loctx', 'release', `${release}.md`);
515
+ const has = existsSync(path) && /^\s*[-*]\s*rc\.\d+\b/m.test(readFileSync(path, 'utf8'));
516
+ return has
517
+ ? []
518
+ : [{ reason: 'F2', verdict: 'WARN', path, message: `no rc recorded for ${release}` }];
459
519
  }
460
520
  /**
461
521
  * The next rc number from the local ledger `.loctx/release/<V>.md` (one `- rc.N …` line per rc):
@@ -1,6 +1,7 @@
1
1
  import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
2
  import { basename, join } from 'node:path';
3
3
  import { parse } from 'yaml';
4
+ import { resolveBindings } from '../lib/bindings.js';
4
5
  import { repoRoot } from '../lib/git.js';
5
6
  import { harnessVersion, packageHarness, packageVersion } from '../lib/upstream.js';
6
7
  import { candidateCount } from '../lib/retro.js';
@@ -213,6 +214,7 @@ export function collectStatus(root) {
213
214
  bus: safe(() => busCount(root), 0),
214
215
  lastHistory: pages.length ? basename(pages[pages.length - 1].path) : null,
215
216
  knowledgeCandidates: safe(() => candidateCount(root), 0),
217
+ bindings: safe(() => (existsSync(join(root, '.agents/harness/bindings.yaml')) ? resolveBindings(root) : []), []),
216
218
  };
217
219
  }
218
220
  /** The text view of the same object `--json` prints. */
@@ -252,6 +254,12 @@ export function formatStatus(d) {
252
254
  out.push(`bus: ${d.bus} file${d.bus === 1 ? '' : 's'}`);
253
255
  out.push(`last history: ${d.lastHistory ?? '—'}`);
254
256
  out.push(`knowledge candidates: ${d.knowledgeCandidates}`);
257
+ if (d.bindings.length) {
258
+ out.push('');
259
+ out.push('bindings (resolved):');
260
+ for (const b of d.bindings)
261
+ out.push(` ${b.role.padEnd(12)} ${b.vendor.padEnd(7)} ${b.model} (${b.source})`);
262
+ }
255
263
  return `${out.join('\n')}\n`;
256
264
  }
257
265
  /** `reins status [--json]`: exit 0 anywhere inside a git repository, 2 outside one. */
@@ -2,6 +2,7 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { parse } from 'yaml';
4
4
  import { defaultsAsker } from '../lib/ask.js';
5
+ import { migrateDetected } from '../lib/bindings.js';
5
6
  import { overrides } from '../lib/blocks.js';
6
7
  import { repoRoot } from '../lib/git.js';
7
8
  import { harnessVersion, packageHarness, packageVersion } from '../lib/upstream.js';
@@ -21,7 +22,7 @@ export function newer(a, b) {
21
22
  export function changesBetween(changelog, from, to) {
22
23
  const out = [];
23
24
  let take = false;
24
- for (const line of changelog.split('\n')) {
25
+ for (const line of changelog.split(/\r?\n/)) {
25
26
  const h = /^## (\S+)/.exec(line);
26
27
  if (h)
27
28
  take = newer(h[1] ?? '0', from) && !newer(h[1] ?? '0', to);
@@ -58,6 +59,9 @@ export async function runUpdate(o) {
58
59
  const agents = join(root, 'AGENTS.md');
59
60
  if (existsSync(agents))
60
61
  res.overrides = [...overrides(readFileSync(agents, 'utf8'))];
62
+ const moved = migrateDetected(root, o.dryRun);
63
+ if (moved.length > 0)
64
+ res.bindingsMoved = moved;
61
65
  res.install = await runInstall({
62
66
  tier: pin.tier,
63
67
  mode: pin.mode,