arbiterdesign 0.1.6 → 0.1.7

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.
@@ -10,7 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.skillMarker = exports.SKILL_MARKER = exports.PKG_ROOT = void 0;
13
+ exports.skillMarker = exports.SKILL_MARKER = exports.PKG_ROOT = exports.AGENTS_LINE = void 0;
14
14
  exports.selfVersion = selfVersion;
15
15
  exports.skillPath = skillPath;
16
16
  exports.init = init;
@@ -25,7 +25,14 @@ const store_1 = require("../store");
25
25
  const format_1 = require("../format");
26
26
  const prompt_1 = require("./prompt");
27
27
  const AGENTS_MARKER = '<!-- arbiter -->';
28
- const AGENTS_LINE = `Before any UI work, read \`DECISIONS.md\` — the design decisions this project has already made. Follow them; don't re-decide them. Record new ones with the \`arbiter\` skill. ${AGENTS_MARKER}`;
28
+ /**
29
+ * The one line in AGENTS.md and CLAUDE.md. It's always loaded, so it carries the one thing that has
30
+ * to hold even when the skill isn't: which wins when a decision and the design system disagree.
31
+ * Without it the decision won 17 times in 20; with it the design system won 20 in 20, and an
32
+ * exception won 20 in 20 (clash study, Opus 5.5, October 2026).
33
+ */
34
+ exports.AGENTS_LINE = `Before any UI work, read \`DECISIONS.md\` — the design decisions this project has already made. Follow them; don't re-decide them. Record new ones with the \`arbiter\` skill. ` +
35
+ `If the request, or the design system (DESIGN.md, design-system or pattern docs, component guidelines, or the shared components), goes against a decision, don't build yet: ask first, the way the \`arbiter\` skill shows. A decision written as an exception ("Exception to the design system: …") beats the design system without asking: follow it and say so. ${AGENTS_MARKER}`;
29
36
  exports.PKG_ROOT = node_path_1.default.join(__dirname, '..', '..');
30
37
  const SKILL_TEMPLATE = node_path_1.default.join(exports.PKG_ROOT, 'templates', 'SKILL.md');
31
38
  /** The version of the package that's running. */
@@ -173,14 +180,21 @@ function mergeAgentsLine(root, file, createIfMissing) {
173
180
  if (!node_fs_1.default.existsSync(abs)) {
174
181
  if (!createIfMissing)
175
182
  return { file, outcome: 'skipped', note: 'not present' };
176
- node_fs_1.default.writeFileSync(abs, `# Agent instructions\n\n${AGENTS_LINE}\n`);
183
+ node_fs_1.default.writeFileSync(abs, `# Agent instructions\n\n${exports.AGENTS_LINE}\n`);
177
184
  return { file, outcome: 'created' };
178
185
  }
179
186
  const before = node_fs_1.default.readFileSync(abs, 'utf8');
180
- if (before.includes(AGENTS_MARKER))
181
- return { file, outcome: 'unchanged' };
187
+ if (before.includes(AGENTS_MARKER)) {
188
+ // The marked line is Arbiter's: an older Arbiter wrote different words, so swap in these.
189
+ // Only that line — whatever else the file says, and where the line sits in it, stays.
190
+ const after = before.replace(/^.*<!-- arbiter -->.*$/m, () => exports.AGENTS_LINE);
191
+ if (after === before)
192
+ return { file, outcome: 'unchanged' };
193
+ node_fs_1.default.writeFileSync(abs, after);
194
+ return { file, outcome: 'updated', note: 'Arbiter line refreshed' };
195
+ }
182
196
  const sep = before.endsWith('\n') ? (before.endsWith('\n\n') ? '' : '\n') : '\n\n';
183
- node_fs_1.default.writeFileSync(abs, before + sep + AGENTS_LINE + '\n');
197
+ node_fs_1.default.writeFileSync(abs, before + sep + exports.AGENTS_LINE + '\n');
184
198
  return { file, outcome: 'updated', note: 'one line appended' };
185
199
  }
186
200
  const CURSOR_COMMAND = `# Arbiter — review queued design decisions
@@ -7,6 +7,7 @@
7
7
  * record P-0003 --as rule judge a queued decision (accept | rule | skip | fix --to "<what instead>")
8
8
  * record --all --as accept judge every queued decision the same way [--level polish] [--trigger "…"]
9
9
  * record --retire D-0003 --why "…" drop a rule from DECISIONS.md with no replacement; the archive keeps both
10
+ * record --reword D-0003 --to "…" change a rule's wording, same id; the old wording stays on the entry
10
11
  * record R-0001 --as apply answer a request from the board (apply [--to "<instead>"] | decline --why "…")
11
12
  * record '<json>' --request R-0001 record the change made for an approved request; it's applied
12
13
  * record (a person at a terminal) walk through it step by step
@@ -29,6 +30,7 @@ exports.record = record;
29
30
  exports.queue = queue;
30
31
  exports.queueFindings = queueFindings;
31
32
  exports.retire = retire;
33
+ exports.reword = reword;
32
34
  exports.judge = judge;
33
35
  exports.judgeAll = judgeAll;
34
36
  exports.recordInput = recordInput;
@@ -51,8 +53,21 @@ function record(rawJson, opts = {}) {
51
53
  const parsed = parse(rawJson);
52
54
  if (!parsed.ok)
53
55
  return parsed.result;
56
+ const bad = againstError((0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd)), parsed.input);
57
+ if (bad)
58
+ return bad;
54
59
  return recordInput(parsed.input, opts);
55
60
  }
61
+ /**
62
+ * `against` has to name a rule that's in force now: an exception to a rule nobody follows any more
63
+ * isn't one. Checked when a decision comes in, not when a queued one is judged — by then the rule
64
+ * may have been replaced, and the clash is still part of the record.
65
+ */
66
+ function againstError(paths, input) {
67
+ if (!input.against || (0, store_1.readActive)(paths).some((d) => d.id === input.against))
68
+ return null;
69
+ return fail([`against: ${input.against} is not an active rule`]);
70
+ }
56
71
  function queue(rawJson, opts = {}) {
57
72
  if (opts.request)
58
73
  return fail([`--request records a change made for an approved request, directly: drop --pending. Nothing is queued for a request.`]);
@@ -60,7 +75,15 @@ function queue(rawJson, opts = {}) {
60
75
  if (!parsed.ok)
61
76
  return parsed.result;
62
77
  const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
78
+ const bad = againstError(paths, parsed.input);
79
+ if (bad)
80
+ return bad;
63
81
  const pending = (0, store_1.readPending)(paths);
82
+ // "Not now" on the same screen against the same rule, a second time: it's on the review list
83
+ // already. Asking about it again is what the list is there to stop.
84
+ const same = parsed.input.against && pending.find((d) => d.against === parsed.input.against && d.trigger === parsed.input.trigger);
85
+ if (same)
86
+ return { exitCode: 0, output: { status: 'already-queued', id: same.id, against: same.against, pending: pending.length } };
64
87
  const entry = { ...fill(parsed.input, opts, paths.root), id: (0, store_1.nextPendingId)(pending), verdict: 'pending' };
65
88
  const checked = check(entry, paths.root, opts);
66
89
  if (checked)
@@ -192,6 +215,51 @@ function retire(ruleId, why, opts = {}) {
192
215
  };
193
216
  return recordInput(input, opts);
194
217
  }
218
+ // ── Reword a rule ──────────────────────────────────────────────────────────
219
+ /**
220
+ * Same rule, clearer words: "Pills are outlined" becomes "Status pills are outlined", or a rule that
221
+ * beats the design system on purpose becomes "Exception to the design system: …". The id stays, so
222
+ * everything that names it still points at it. Rewording isn't a change of mind — that's a new rule
223
+ * that supersedes this one — so the entry is changed in place, in DECISIONS.md and the archive
224
+ * both, and keeps the wording it replaced.
225
+ */
226
+ function reword(ruleId, to, opts = {}) {
227
+ if (!schema_1.DECISION_ID.test(ruleId))
228
+ return fail([`not a rule id: ${ruleId} (looks like D-0003)`]);
229
+ const next = to?.trim();
230
+ if (!next)
231
+ return fail(['reword needs --to "<the new wording>"']);
232
+ if (/[\r\n]/.test(next))
233
+ return fail(['the new wording must be a single line']);
234
+ const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
235
+ const active = (0, store_1.readActive)(paths);
236
+ const rule = active.find((d) => d.id === ruleId);
237
+ if (!rule)
238
+ return fail([`${ruleId} is not an active rule`]);
239
+ if (next === rule.decision)
240
+ return fail([`${ruleId} already says that`]);
241
+ const was = `${rule.decision} (until ${(0, store_1.now)().slice(0, 10)})`;
242
+ const change = (d) => (d.id === ruleId ? { ...d, decision: next, reworded: [...d.reworded, was] } : d);
243
+ const archive = (0, store_1.readArchive)(paths);
244
+ if (!opts.dryRun) {
245
+ (0, store_1.writeActive)(paths, active.map(change), (0, store_1.readConfig)(paths)?.activeCap ?? store_1.ACTIVE_CAP);
246
+ // A rule recorded before the archive existed lives only in DECISIONS.md; there's nothing to rewrite.
247
+ if (archive.some((d) => d.id === ruleId))
248
+ (0, store_1.writeArchive)(paths, archive.map(change));
249
+ if (rule.candidate)
250
+ (0, candidate_1.refreshCandidates)(paths);
251
+ }
252
+ return {
253
+ exitCode: 0,
254
+ output: {
255
+ status: opts.dryRun ? 'dry-run' : 'reworded',
256
+ id: ruleId,
257
+ decision: next,
258
+ was: rule.decision,
259
+ wrote: opts.dryRun ? [] : ['DECISIONS.md', '.arbiter/archive.md'],
260
+ },
261
+ };
262
+ }
195
263
  // ── Judge a pending item ───────────────────────────────────────────────────
196
264
  function judge(pendingId, opts) {
197
265
  if (!schema_1.PENDING_ID.test(pendingId))
@@ -218,11 +286,21 @@ function judge(pendingId, opts) {
218
286
  decision: to,
219
287
  rejected: [`${item.decision} — corrected by ${opts.author ?? item.author}`, ...item.rejected],
220
288
  verdict: 'fix',
289
+ // Whoever made the call before, the user just changed it.
290
+ call: 'corrected',
221
291
  };
222
292
  }
223
293
  else {
224
294
  input = { ...base, verdict: opts.as };
225
295
  }
296
+ if (opts.against) {
297
+ if (!schema_1.DECISION_ID.test(opts.against))
298
+ return fail([`--against needs a rule id like D-0009, not ${opts.against}`]);
299
+ input = { ...input, against: opts.against };
300
+ const bad = againstError(paths, input);
301
+ if (bad)
302
+ return bad;
303
+ }
226
304
  const result = recordInput(input, opts);
227
305
  if (result.exitCode === 0 && !opts.dryRun)
228
306
  (0, store_1.writePending)(paths, rest);
@@ -238,6 +316,8 @@ function judgeAll(opts) {
238
316
  // A request is applied by the change made for it, not by everything that happens to be queued.
239
317
  if (opts.request)
240
318
  return fail([`--request links one change to ${opts.request}; it can't go on --all`]);
319
+ if (opts.against)
320
+ return fail([`--against marks one exception to ${opts.against}; it can't go on --all`]);
241
321
  const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
242
322
  const targets = (0, store_1.readPending)(paths).filter((d) => (!opts.level || d.level === opts.level) && (!opts.trigger || d.trigger === opts.trigger));
243
323
  if (!targets.length)
@@ -376,6 +456,7 @@ function recordInput(input, opts = {}) {
376
456
  supersedes: entry.supersedes,
377
457
  verified: entry.verified,
378
458
  candidate: entry.candidate,
459
+ ...(entry.against && { against: entry.against }),
379
460
  active: `${nextActive.length} of ${cap}`,
380
461
  wrote: opts.dryRun ? [] : entry.verdict === 'rule' || entry.verdict === 'retire' ? ['.arbiter/archive.md', 'DECISIONS.md'] : ['.arbiter/archive.md'],
381
462
  ...(request && { request: { id: request.id, status: opts.dryRun ? request.status : 'applied', author: request.author } }),
@@ -434,6 +515,9 @@ function fill(input, opts, root) {
434
515
  expect: input.expect ?? null,
435
516
  verified: null,
436
517
  candidate: opts.candidate ?? input.candidate ?? null,
518
+ against: input.against ?? null,
519
+ call: input.call ?? null,
520
+ reworded: [],
437
521
  };
438
522
  }
439
523
  function fail(errors) {
@@ -49,10 +49,13 @@ function review(opts = {}) {
49
49
  const f = (0, work_1.workSnapshot)(paths, screen);
50
50
  return f ? `/snapshots/${node_path_1.default.basename(f)}` : null;
51
51
  };
52
+ const active = (0, store_1.readActive)(paths);
52
53
  return {
53
54
  project: node_path_1.default.basename(root),
54
55
  pending: (0, store_1.readPending)(paths).map((d) => ({
55
56
  ...d,
57
+ // The rule a clash is with, while it's still in force: the page offers Follow / Replace / Keep as exception.
58
+ againstRule: d.against ? active.filter((r) => r.id === d.against).map((r) => ({ id: r.id, decision: r.decision }))[0] ?? null : null,
56
59
  candidateName: d.candidate ? byId.get(d.candidate)?.name ?? null : null,
57
60
  snapshotUrl: d.candidate ? byId.get(d.candidate)?.snapshotUrl ?? null : null,
58
61
  picture: (0, pictures_1.missingPictures)(paths, [d], candidates)[0] ?? null,
@@ -64,7 +67,7 @@ function review(opts = {}) {
64
67
  candidates,
65
68
  hosted: (0, hosted_1.readLinkOrNull)(paths)?.shareUrl ?? null,
66
69
  boardVersion: (0, hosted_1.readLinkOrNull)(paths)?.boardVersion ?? null,
67
- active: (0, store_1.readActive)(paths).length,
70
+ active: active.length,
68
71
  cap: (0, store_1.readConfig)(paths)?.activeCap ?? store_1.ACTIVE_CAP,
69
72
  };
70
73
  };
@@ -147,6 +147,8 @@ function reviewLines(d) {
147
147
  lines.push(`${pad}Pattern ${d.decision}`);
148
148
  for (const r of d.rejected)
149
149
  lines.push(`${pad}Rejected ${r}`);
150
+ if (d.against)
151
+ lines.push(`${pad}Against ${d.against}`);
150
152
  lines.push(`${pad}${d.level} · ${d.dimension} · ${d.scope}`);
151
153
  return lines;
152
154
  }
@@ -176,9 +178,20 @@ function one(id, paths, json) {
176
178
  const later = all.find((x) => x.supersedes === id);
177
179
  const supersededBy = later?.id ?? null;
178
180
  const status = d.verdict !== 'rule' ? d.verdict : activeIds.has(id) ? 'active' : later ? `${later.verdict === 'retire' ? 'retired' : 'superseded'} by ${later.id}` : 'inactive';
181
+ // Where a rule doesn't hold, and why that's settled: the exceptions confirmed to it, and the
182
+ // clashes waiting on the review list. The agent checks these before asking about a screen twice.
183
+ const short = (x) => ({ id: x.id, trigger: x.trigger, change: x.change ?? x.decision });
184
+ const exceptions = id.startsWith('D-') ? all.filter((x) => x.against === id && x.verdict === 'accept').map(short) : [];
185
+ const waiting = id.startsWith('D-') ? (0, store_1.readPending)(paths).filter((x) => x.against === id).map(short) : [];
179
186
  if (json)
180
- return JSON.stringify({ ...d, status, supersededBy }, null, 2);
181
- return `${(0, format_1.formatEntry)(d).trimEnd()}\n- **Status:** ${status}`;
187
+ return JSON.stringify({ ...d, status, supersededBy, exceptions, waiting }, null, 2);
188
+ const list = (xs) => xs.map((x) => `${x.id} (${x.trigger})`).join(' · ');
189
+ return [
190
+ (0, format_1.formatEntry)(d).trimEnd(),
191
+ `- **Status:** ${status}`,
192
+ ...(exceptions.length ? [`- **Exceptions:** ${list(exceptions)}`] : []),
193
+ ...(waiting.length ? [`- **Waiting:** ${list(waiting)}`] : []),
194
+ ].join('\n');
182
195
  }
183
196
  function archive(all, active, opts) {
184
197
  const activeIds = new Set(active.map((d) => d.id));
@@ -49,6 +49,9 @@ function sweepCommand(id, opts = {}) {
49
49
  expect: rule.expect,
50
50
  verified: false,
51
51
  candidate: null,
52
+ against: rule.id,
53
+ call: null,
54
+ reworded: [],
52
55
  };
53
56
  pending.push(entry);
54
57
  queued.push(entry.id);
package/dist/format.js CHANGED
@@ -9,8 +9,10 @@
9
9
  * - **Rejected:**
10
10
  * - Inline confirm — clicked through without reading
11
11
  * - **Trigger:** Delete-project flow used an inline "Are you sure?" link
12
- * - **Scope:** pattern:destructive-confirm · **Dimension:** interaction · **Level:** pattern · **Class:** judgment · **Verdict:** rule
13
- * - **Author:** edmond · **Date:** 2026-09-15T14:32:10Z · **Commit:** a1b2c3d · **Supersedes:** —
12
+ * - **Scope:** pattern:destructive-confirm · **Dimension:** interaction · **Level:** pattern · **Class:** judgment · **Verdict:** rule · **Call:** asked
13
+ * - **Author:** edmond · **Date:** 2026-09-15T14:32:10Z · **Commit:** a1b2c3d · **Supersedes:** — · **Against:** D-0004
14
+ *
15
+ * `Call`, `Against`, `Candidate` and the `Reworded:` list appear only when set.
14
16
  *
15
17
  * DECISIONS.md groups entries under `## <Dimension>` headings; the archive is
16
18
  * flat and chronological. Round-trip is lossless: parse(format(d)) deep-equals d.
@@ -29,7 +31,7 @@ const schema_1 = require("./schema");
29
31
  const SEP = ' · ';
30
32
  const NONE = '—';
31
33
  const HEADING = /^#{2,3} ([DP]-\d{4,}) · (.*)$/;
32
- const REJECTED_ITEM = /^ {2}- (.*)$/;
34
+ const LIST_ITEM = /^ {2}- (.*)$/;
33
35
  const FIELD = /\*\*([A-Za-z]+):\*\* (.*?)(?=\s·\s\*\*|$)/g;
34
36
  /**
35
37
  * A value as an entry may hold it: one line, with no `**Field:**` marker of its own. Input is
@@ -45,9 +47,10 @@ function formatEntry(d) {
45
47
  ...(d.change ? [`- **Change:** ${text(d.change)}`] : []),
46
48
  `- **Rationale:** ${text(d.rationale)}`,
47
49
  ...(d.rejected.length ? ['- **Rejected:**', ...d.rejected.map((r) => ` - ${text(r)}`)] : []),
50
+ ...(d.reworded.length ? ['- **Reworded:**', ...d.reworded.map((r) => ` - ${text(r)}`)] : []),
48
51
  `- **Trigger:** ${text(d.trigger)}`,
49
- `- **Scope:** ${text(d.scope)}${SEP}**Dimension:** ${d.dimension}${SEP}**Level:** ${d.level}${SEP}**Class:** ${d.class}${SEP}**Verdict:** ${d.verdict}`,
50
- `- **Author:** ${text(d.author)}${SEP}**Date:** ${text(d.date)}${SEP}**Commit:** ${d.commit ?? NONE}${SEP}**Supersedes:** ${d.supersedes ?? NONE}${d.candidate ? `${SEP}**Candidate:** ${d.candidate}` : ''}`,
52
+ `- **Scope:** ${text(d.scope)}${SEP}**Dimension:** ${d.dimension}${SEP}**Level:** ${d.level}${SEP}**Class:** ${d.class}${SEP}**Verdict:** ${d.verdict}${d.call ? `${SEP}**Call:** ${d.call}` : ''}`,
53
+ `- **Author:** ${text(d.author)}${SEP}**Date:** ${text(d.date)}${SEP}**Commit:** ${d.commit ?? NONE}${SEP}**Supersedes:** ${d.supersedes ?? NONE}${d.candidate ? `${SEP}**Candidate:** ${d.candidate}` : ''}${d.against ? `${SEP}**Against:** ${d.against}` : ''}`,
51
54
  ...(d.ref ? [`- **Ref:** ${text(d.ref)}`] : []),
52
55
  ...(d.files.length ? [`- **Files:** ${d.files.map(text).join(SEP)}`] : []),
53
56
  ...(d.paths.length ? [`- **Paths:** ${d.paths.map(text).join(SEP)}`] : []),
@@ -83,7 +86,8 @@ function parseEntries(md) {
83
86
  const out = [];
84
87
  const lines = md.split('\n');
85
88
  let cur = null;
86
- let inRejected = false;
89
+ // The two indented lists an entry can carry.
90
+ let inList = null;
87
91
  const flush = () => {
88
92
  if (!cur)
89
93
  return;
@@ -95,8 +99,8 @@ function parseEntries(md) {
95
99
  const h = HEADING.exec(line);
96
100
  if (h) {
97
101
  flush();
98
- cur = { id: h[1], decision: h[2].trim(), rejected: [] };
99
- inRejected = false;
102
+ cur = { id: h[1], decision: h[2].trim(), rejected: [], reworded: [] };
103
+ inList = null;
100
104
  continue;
101
105
  }
102
106
  if (/^#{1,6} /.test(line)) {
@@ -106,18 +110,18 @@ function parseEntries(md) {
106
110
  }
107
111
  if (!cur)
108
112
  continue;
109
- if (inRejected) {
110
- const item = REJECTED_ITEM.exec(line);
113
+ if (inList) {
114
+ const item = LIST_ITEM.exec(line);
111
115
  if (item) {
112
- cur.rejected.push(item[1].trim());
116
+ cur[inList].push(item[1].trim());
113
117
  continue;
114
118
  }
115
- inRejected = false;
119
+ inList = null;
116
120
  }
117
121
  if (!line.startsWith('- **'))
118
122
  continue;
119
- if (line === '- **Rejected:**') {
120
- inRejected = true;
123
+ if (line === '- **Rejected:**' || line === '- **Reworded:**') {
124
+ inList = line === '- **Rejected:**' ? 'rejected' : 'reworded';
121
125
  continue;
122
126
  }
123
127
  for (const m of line.slice(2).matchAll(FIELD)) {
@@ -166,6 +170,12 @@ function parseEntries(md) {
166
170
  case 'candidate':
167
171
  cur.candidate = val === NONE ? null : val;
168
172
  break;
173
+ case 'against':
174
+ cur.against = val === NONE ? null : val;
175
+ break;
176
+ case 'call':
177
+ cur.call = val === NONE ? null : val;
178
+ break;
169
179
  case 'files':
170
180
  cur.files = val.split(SEP).map((f) => f.trim()).filter(Boolean);
171
181
  break;
@@ -215,6 +225,9 @@ function complete(p) {
215
225
  expect: p.expect ?? null,
216
226
  verified: p.expect ? (p.verified ?? null) : null,
217
227
  candidate: p.candidate ?? null,
228
+ against: p.against ?? null,
229
+ call: p.call ?? null,
230
+ reworded: p.reworded ?? [],
218
231
  };
219
232
  }
220
233
  function activeHeader(count, cap) {
package/dist/index.js CHANGED
@@ -33,6 +33,7 @@ program
33
33
  .option('--tool <name>', 'with --findings: the scanner name for the record')
34
34
  .option('--candidate <id>', 'the candidate (C-0001) this decision was made for')
35
35
  .option('--retire <rule-id>', 'drop an active rule with no replacement (needs --why)')
36
+ .option('--reword <rule-id>', 'change an active rule\'s wording, same id (needs --to); the old wording stays on the entry')
36
37
  .option('--why <reason>', 'with --retire: why the rule is dead; with a request and --as decline: why not')
37
38
  .option('--unverified', 'record even if the named files contradict the claim')
38
39
  .option('--as <action>', 'judge a pending id: accept | rule | skip | fix; answer a request id: apply | decline')
@@ -40,8 +41,9 @@ program
40
41
  .option('--all', 'with --as: judge every pending item the same way')
41
42
  .option('--level <level>', 'with --all: only this level (feature | pattern | polish)')
42
43
  .option('--trigger <text>', 'with --all: only items queued for this piece of work')
43
- .option('--to <decision>', 'with --as fix: what it should be instead; with a request and --as apply: what to do instead of what was asked')
44
+ .option('--to <decision>', 'with --as fix: what it should be instead; with --reword: the new wording; with a request and --as apply: what to do instead of what was asked')
44
45
  .option('--supersedes <id>', 'the active rule this one replaces')
46
+ .option('--against <rule-id>', 'judging a pending id: the rule it goes against — with --as accept, the logged exception to it')
45
47
  .option('--ref <url|key>', 'the ticket this was for: a URL or an issue key like ENG-123')
46
48
  .option('--keep-both', 'record alongside overlapping rules instead of replacing one')
47
49
  .option('--author <name>', 'override the author')
@@ -51,6 +53,9 @@ program
51
53
  if (opts.retire) {
52
54
  result = (0, record_1.retire)(opts.retire, opts.why, opts);
53
55
  }
56
+ else if (opts.reword) {
57
+ result = (0, record_1.reword)(opts.reword, opts.to, opts);
58
+ }
54
59
  else if (opts.findings) {
55
60
  result = (0, record_1.queueFindings)(opts.findings, opts);
56
61
  }
package/dist/schema.js CHANGED
@@ -6,7 +6,7 @@
6
6
  * nowhere to live.
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.CANDIDATE_ID = exports.PENDING_ID = exports.DECISION_ID = exports.ID_PATTERN = exports.FIELDS = exports.DIMENSIONS = exports.SCOPE_KINDS = exports.VERDICTS = exports.LEVELS = exports.CLASSES = void 0;
9
+ exports.CANDIDATE_ID = exports.PENDING_ID = exports.DECISION_ID = exports.ID_PATTERN = exports.FIELDS = exports.CALLS = exports.DIMENSIONS = exports.SCOPE_KINDS = exports.VERDICTS = exports.LEVELS = exports.CLASSES = void 0;
10
10
  exports.validateInput = validateInput;
11
11
  exports.parseScope = parseScope;
12
12
  exports.CLASSES = ['mechanical', 'judgment'];
@@ -21,6 +21,13 @@ exports.VERDICTS = ['fix', 'accept', 'rule', 'retire'];
21
21
  exports.SCOPE_KINDS = ['global', 'file', 'pattern'];
22
22
  /** What the decision is about. Fixed order — DECISIONS.md groups by it in this order. */
23
23
  exports.DIMENSIONS = ['structure', 'interaction', 'states', 'content', 'visual', 'motion', 'access'];
24
+ /**
25
+ * Who made the call. What lets a real choice be told from the agent's habit:
26
+ * asked the user asked for it
27
+ * corrected the user changed what the agent did — what they rejected is on record
28
+ * agent the agent weighed real options and picked one
29
+ */
30
+ exports.CALLS = ['asked', 'corrected', 'agent'];
24
31
  /** Fields in file order. Also the order they're serialized in. */
25
32
  exports.FIELDS = [
26
33
  'id',
@@ -44,6 +51,9 @@ exports.FIELDS = [
44
51
  'expect',
45
52
  'verified',
46
53
  'candidate',
54
+ 'against',
55
+ 'call',
56
+ 'reworded',
47
57
  ];
48
58
  exports.ID_PATTERN = /^[DP]-\d{4,}$/;
49
59
  exports.DECISION_ID = /^D-\d{4,}$/;
@@ -86,6 +96,7 @@ function validateInput(raw, options = {}) {
86
96
  const commit = line('commit', false);
87
97
  const date = line('date', false);
88
98
  const ref = line('ref', false);
99
+ const call = line('call', false);
89
100
  const supersedesRaw = obj.supersedes;
90
101
  if (cls !== undefined && !exports.CLASSES.includes(cls)) {
91
102
  errors.push(`class must be one of ${exports.CLASSES.join(' | ')}`);
@@ -99,6 +110,9 @@ function validateInput(raw, options = {}) {
99
110
  if (level !== undefined && !exports.LEVELS.includes(level)) {
100
111
  errors.push(`level must be one of ${exports.LEVELS.join(' | ')}`);
101
112
  }
113
+ if (call !== undefined && !exports.CALLS.includes(call)) {
114
+ errors.push(`call must be one of ${exports.CALLS.join(' | ')}`);
115
+ }
102
116
  if (scope !== undefined && !SCOPE_PATTERN.test(scope)) {
103
117
  errors.push('scope must be `global`, `file:<path>`, or `pattern:<name>`');
104
118
  }
@@ -193,8 +207,19 @@ function validateInput(raw, options = {}) {
193
207
  }
194
208
  if (verdict === 'retire' && !supersedes)
195
209
  errors.push('retire needs supersedes: the rule being retired');
210
+ let against;
211
+ if (obj.against !== undefined) {
212
+ if (obj.against === null || obj.against === '')
213
+ against = null;
214
+ else if (typeof obj.against !== 'string' || !exports.DECISION_ID.test(obj.against.trim()))
215
+ errors.push('against must be a rule id like D-0011, or null');
216
+ else
217
+ against = obj.against.trim();
218
+ }
219
+ if (against && verdict === 'retire')
220
+ errors.push('against does not apply to a retire');
196
221
  for (const key of Object.keys(obj)) {
197
- if (!exports.FIELDS.includes(key) || key === 'verified' || key === 'id')
222
+ if (!exports.FIELDS.includes(key) || key === 'verified' || key === 'id' || key === 'reworded')
198
223
  errors.push(`unknown field: ${key}`);
199
224
  }
200
225
  if (errors.length)
@@ -221,6 +246,8 @@ function validateInput(raw, options = {}) {
221
246
  ...(date !== undefined && { date }),
222
247
  ...(supersedes !== undefined && { supersedes }),
223
248
  ...(ref !== undefined && { ref }),
249
+ ...(against !== undefined && { against }),
250
+ ...(call !== undefined && { call: call }),
224
251
  },
225
252
  };
226
253
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arbiterdesign",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Records design decisions made during agent-assisted UI work and feeds them back into the agent's context.",
5
5
  "homepage": "https://arbiter.design",
6
6
  "repository": {