arbiterdesign 0.1.7 → 0.1.8

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
@@ -76,8 +76,13 @@ Arbiter fixes that without adding work:
76
76
  npx arbiterdesign init
77
77
  ```
78
78
 
79
+ > [!NOTE]
80
+ > On Windows, in PowerShell, type `npx.cmd` instead of `npx`, here and in every command after. PowerShell blocks plain `npx` out of the box, with "running scripts is disabled on this system". Command Prompt and Git Bash don't.
81
+
79
82
  That's the whole install. Run it in the folder your agent works in, or ask the agent to run it. It detects Claude Code or Cursor, teaches your agent the protocol, and adds `arbiterdesign` to your devDependencies, which is what makes the shorter `npx arbiter` work from then on. Running it twice changes nothing.
80
83
 
84
+ It asks one question, once: how often the agent should check in about decisions while you work. If the agent ran the install, it asks you in chat instead.
85
+
81
86
  No `package.json` in the project? Add `arbiterdesign` as a dev dependency yourself. New to the terminal? Follow the [step-by-step guide](https://arbiter.design/get-started).
82
87
 
83
88
  If you want the agent to take screenshots of the screens it changes, tell it where your app runs:
@@ -205,13 +210,19 @@ npx arbiter pull
205
210
 
206
211
  Brings their comments back into your repo, where `arbiter review` shows them next to each screen.
207
212
 
208
- Git stays the source of truth. The service only holds the latest board and its comments, and only `publish` and `pull` ever touch the network.
213
+ Git stays the source of truth. The service only holds the latest board and its comments, and only `publish` and `pull` ever touch the network. A board holds up to 100 pictures (25 MB); a picture that doesn't fit is left off and `publish` says so.
209
214
 
210
215
  **Keep it current automatically:**
211
216
 
212
217
  - `npx arbiter publish --auto` republishes whenever the record changes. Works anywhere: no GitHub, no CI, no repo needed. If a republish fails (offline, service down) the command still succeeds and tells you the board is behind. `--no-auto` turns it off.
213
218
  - `npx arbiter publish --on-push` writes a GitHub Actions workflow that republishes when decisions land on your default branch, and sets the `ARBITER_PUBLISH_TOKEN` secret through `gh` if you're signed in. Commit the workflow along with `.arbiter/hosted.json`.
214
219
 
220
+ **Keep it private, or take it down:**
221
+
222
+ - `npx arbiter publish --password` puts the board behind a password. It makes up a strong one and prints it once, so send it with the link. `--password "<yours>"` sets your own (8 characters or more), `--no-password` takes it off, and a plain `publish` leaves it as it is.
223
+ - `npx arbiter unpublish --yes` deletes the board, its pictures and its comments from the service, saving the comments into `.arbiter/comments.json` first. Without `--yes` it only says what it would delete.
224
+ - Lost the project folder, so you can't run it? Use **Report or remove this board** at the bottom of the board, and it's taken down by hand.
225
+
215
226
  ### Change requests
216
227
 
217
228
  A comment is just input. **Request change** is different: someone wants something changed, so it gets a proper answer.
@@ -256,6 +267,8 @@ The agent renders pictures with a headless browser. If it can't (no browser, app
256
267
  > [!TIP]
257
268
  > Name each piece of work after the screen it changed, like `Settings, billing` instead of one `Settings build` across four routes. Then one picture per piece of work means one per screen.
258
269
 
270
+ Named it something else first? `arbiter rename "Settings build" "Settings, billing"` moves its decisions, its picture and its comments on the board to the new name.
271
+
259
272
  Cards without a picture show an icon of the kind of change, so the board never looks broken. To make sure missing pictures still get noticed, `record` tells the agent the command to add one, the review page marks the group "No picture", and `publish` lists the cards that are missing one.
260
273
 
261
274
  ## Keeping the record honest
@@ -355,6 +368,7 @@ npx arbiter pull # bring comments and requests back
355
368
  | `arbiter candidate C-0002 --state …` | Set its state. |
356
369
  | `arbiter board` | Candidates and their states. |
357
370
  | `arbiter unlink D-0004` | Detach a decision from the screen it was recorded against. |
371
+ | `arbiter rename "<work>" "<new name>"` | Rename a piece of work everywhere the record keeps it. Its comments on the board follow at the next publish. |
358
372
  | `arbiter remove <id>` | Remove a decision, a screen (`C-0001`) or a picture (`--snapshot "<work>"`) that was never real. |
359
373
 
360
374
  #### Sharing
@@ -365,6 +379,9 @@ npx arbiter pull # bring comments and requests back
365
379
  | `arbiter publish --to <url\|pages>` | Your own hosted Arbiter, or GitHub Pages. |
366
380
  | `arbiter publish --auto` | Republish whenever the record changes. |
367
381
  | `arbiter publish --on-push` | Write a GitHub Actions workflow that republishes on every push. |
382
+ | `arbiter publish --password [pw]` | Ask for a password before showing the board. No value makes one up. `--no-password` takes it off. |
383
+ | `arbiter unpublish --yes` | Delete the board, its pictures and its comments, saving the comments to the repo first. |
384
+ | `arbiter unpublish <board link> --admin --yes` | For whoever runs the server: take down any board on it, with the admin token in `ARBITER_ADMIN_TOKEN`. |
368
385
  | `arbiter pull` | Bring comments and reactions into `.arbiter/comments.json`, and requests into `.arbiter/requests.json`. |
369
386
  | `arbiter export [--feature f] [--include-rules] [--open]` | Static folder of the board for people without the repo. |
370
387
 
@@ -436,7 +453,7 @@ A call the agent made where a reasonable alternative existed: layout, flow, word
436
453
  <details>
437
454
  <summary><b>How do I set it up?</b></summary>
438
455
 
439
- Run `npx arbiterdesign init` in the folder your agent works in, or ask the agent to run it. It adds a few plain files and a one-line note telling the agent to read the rules before UI work. Nothing to sign up for, nothing to configure. From the next session, the agent records as it goes. Step by step, with what you'll see: [Get started](https://arbiter.design/get-started).
456
+ Run `npx arbiterdesign init` in the folder your agent works in, or ask the agent to run it. It adds a few plain files and a one-line note telling the agent to read the rules before UI work, and asks one question: how often to check in. Nothing to sign up for. From the next session, the agent records as it goes. Step by step, with what you'll see: [Get started](https://arbiter.design/get-started).
440
457
 
441
458
  </details>
442
459
 
@@ -478,7 +495,7 @@ Yes. Make the new call and the old rule steps aside. It stays in the archive wit
478
495
  <details>
479
496
  <summary><b>Where does the record live, and who can see it?</b></summary>
480
497
 
481
- In your project, as plain-text files you own: `DECISIONS.md` and the `.arbiter/` folder beside it. The board is a copy at a private link. It's unlisted and never indexed, and people sign in by email to comment. Delete the board and you lose the comments, nothing else.
498
+ In your project, as plain-text files you own: `DECISIONS.md` and the `.arbiter/` folder beside it. The board is a copy at a private link. It's unlisted and never indexed, people sign in by email to comment, and `publish --password` puts it behind a password. `arbiter unpublish` deletes it from the service, after saving its comments into your repo.
482
499
 
483
500
  </details>
484
501
 
@@ -15,6 +15,8 @@ exports.selfVersion = selfVersion;
15
15
  exports.skillPath = skillPath;
16
16
  exports.init = init;
17
17
  exports.detectClient = detectClient;
18
+ exports.askCheckin = askCheckin;
19
+ exports.checkinHandoff = checkinHandoff;
18
20
  exports.detectPm = detectPm;
19
21
  exports.addDevDependency = addDevDependency;
20
22
  const node_fs_1 = __importDefault(require("node:fs"));
@@ -24,6 +26,7 @@ const node_child_process_1 = require("node:child_process");
24
26
  const store_1 = require("../store");
25
27
  const format_1 = require("../format");
26
28
  const prompt_1 = require("./prompt");
29
+ const setup_1 = require("./setup");
27
30
  const AGENTS_MARKER = '<!-- arbiter -->';
28
31
  /**
29
32
  * The one line in AGENTS.md and CLAUDE.md. It's always loaded, so it carries the one thing that has
@@ -87,8 +90,36 @@ async function init(opts = {}) {
87
90
  author = guess;
88
91
  }
89
92
  }
93
+ // ── Question 3: how Arbiter checks in while you work ─────────────────
94
+ // Asked once, here, so no /arbiter has to. Nobody at the terminal (an agent ran this, or
95
+ // --yes): it stays unanswered, and the closing lines hand the question to the agent.
96
+ let checkin = existing?.checkin;
97
+ let onboarded = existing?.onboarded;
98
+ if (opts.checkin !== undefined) {
99
+ if (!setup_1.CHECKINS.includes(opts.checkin))
100
+ throw new Error(`--checkin must be one of ${setup_1.CHECKINS.join(' | ')}`);
101
+ checkin = opts.checkin;
102
+ onboarded ??= (0, store_1.now)();
103
+ }
104
+ else if (!onboarded && ask) {
105
+ const picked = await askCheckin(ask);
106
+ if (picked) {
107
+ checkin = picked;
108
+ onboarded = (0, store_1.now)();
109
+ }
110
+ }
90
111
  // ── arbiter.json ─────────────────────────────────────────────────────
91
- const config = { version: 1, destination: 'local', hosted: { url: 'https://arbiter.design' }, ...existing, author, client, ...(opts.destination && { destination: opts.destination }) };
112
+ const config = {
113
+ version: 1,
114
+ destination: 'local',
115
+ hosted: { url: 'https://arbiter.design' },
116
+ ...existing,
117
+ author,
118
+ client,
119
+ ...(opts.destination && { destination: opts.destination }),
120
+ ...(checkin && { checkin }),
121
+ ...(onboarded && { onboarded }),
122
+ };
92
123
  if (!existing) {
93
124
  (0, store_1.writeConfig)(paths, config);
94
125
  steps.push({ file: 'arbiter.json', outcome: 'created' });
@@ -149,6 +180,51 @@ function detectClient(root) {
149
180
  return out;
150
181
  }
151
182
  const label = (c) => (c === 'cursor' ? 'Cursor' : 'Claude Code');
183
+ /** The one preference Arbiter asks for. The skill asks the same, in the same words, when install couldn't. */
184
+ const CHECKIN_QUESTION = 'When should Arbiter check in about decisions while you work?';
185
+ const CHECKIN_OPTIONS = [
186
+ { mode: 'feature', label: 'A line after big work (recommended)', detail: 'When a feature-sized piece settles, one sentence saying what changed. Every 5 changes waiting, a yes/no on reviewing. Never mid-iteration.' },
187
+ { mode: 'quiet', label: 'Nothing until I ask', detail: 'Saved silently. Asks only when something clashes with a rule. /arbiter whenever you want to see it.' },
188
+ { mode: 'every', label: 'A line after everything', detail: 'One sentence every time a piece of work settles, big or small. Every 5 changes waiting, a yes/no on reviewing.' },
189
+ ];
190
+ /**
191
+ * The check-in question at the terminal. Enter takes the recommended one. Null when input ended
192
+ * with no answer: an agent ran install, and a choice nobody made mustn't be recorded as theirs.
193
+ */
194
+ async function askCheckin(ask) {
195
+ const menu = CHECKIN_OPTIONS.map((o, i) => ` ${i + 1}. ${o.label}. ${o.detail}`).join('\n');
196
+ let q = `\n${CHECKIN_QUESTION}\n${menu}\n(1): `;
197
+ for (;;) {
198
+ const a = await ask.answer(q);
199
+ if (a === null)
200
+ return null;
201
+ const t = a.trim().toLowerCase();
202
+ if (!t)
203
+ return 'feature';
204
+ const n = Number(t);
205
+ if (Number.isInteger(n) && n >= 1 && n <= CHECKIN_OPTIONS.length)
206
+ return CHECKIN_OPTIONS[n - 1].mode;
207
+ if (setup_1.CHECKINS.includes(t))
208
+ return t;
209
+ q = 'Pick 1, 2 or 3 (1): ';
210
+ }
211
+ }
212
+ /**
213
+ * Install's closing lines when nobody at the terminal answered the check-in question. Usually an
214
+ * agent ran it: it asks the user in chat, on its own, then saves the answer. Bundled with review
215
+ * questions it got dismissed with them and came back on every /arbiter.
216
+ */
217
+ function checkinHandoff() {
218
+ const w = Math.max(...setup_1.CHECKINS.map((c) => c.length));
219
+ return [
220
+ '',
221
+ `One question left, asked once. ${CHECKIN_QUESTION}`,
222
+ ...CHECKIN_OPTIONS.map((o) => ` ${o.mode.padEnd(w)} ${o.label}. ${o.detail}`),
223
+ 'Save the answer: npx arbiter setup --checkin feature (or quiet, or every)',
224
+ 'Agent: ask the user now, in chat, as one pick-one question on its own, then save their answer. No answer means feature.',
225
+ '',
226
+ ].join('\n');
227
+ }
152
228
  function skillFor(client) {
153
229
  // A Windows checkout with autocrlf hands us CRLF; the frontmatter regex and the marker line assume LF.
154
230
  const template = node_fs_1.default.readFileSync(SKILL_TEMPLATE, 'utf8').replace(/\r\n/g, '\n');
@@ -12,11 +12,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.Prompter = void 0;
13
13
  const node_readline_1 = __importDefault(require("node:readline"));
14
14
  class Prompter {
15
- rl = node_readline_1.default.createInterface({ input: process.stdin, terminal: false });
15
+ rl;
16
16
  lines = [];
17
17
  waiting = [];
18
18
  closed = false;
19
- constructor() {
19
+ constructor(input = process.stdin) {
20
+ this.rl = node_readline_1.default.createInterface({ input, terminal: false });
20
21
  this.rl.on('line', (l) => {
21
22
  const w = this.waiting.shift();
22
23
  if (w)
@@ -27,16 +28,23 @@ class Prompter {
27
28
  this.rl.on('close', () => {
28
29
  this.closed = true;
29
30
  for (const w of this.waiting.splice(0))
30
- w('');
31
+ w(null);
31
32
  });
32
33
  }
33
34
  question(q) {
35
+ return this.answer(q).then((a) => a ?? '');
36
+ }
37
+ /**
38
+ * Like question, but null when input ended with no line for it: nobody is there to answer.
39
+ * That's an agent running the command (its input is closed), not someone pressing Enter.
40
+ */
41
+ answer(q) {
34
42
  process.stdout.write(q);
35
43
  const l = this.lines.shift();
36
44
  if (l !== undefined)
37
45
  return Promise.resolve(l);
38
46
  if (this.closed)
39
- return Promise.resolve('');
47
+ return Promise.resolve(null);
40
48
  return new Promise((res) => this.waiting.push(res));
41
49
  }
42
50
  /** Ask until non-empty, or return the default. */
@@ -40,11 +40,28 @@ async function publish(opts = {}) {
40
40
  // Hosted by default: the flag, then arbiter.json, then arbiter.design. `--to pages` is the git route.
41
41
  const chosen = opts.to ?? (0, store_1.readConfig)(paths)?.hosted?.url ?? exports.DEFAULT_HOST;
42
42
  const to = chosen === 'pages' || chosen === 'git' ? null : chosen;
43
+ if (opts.password !== undefined && !to) {
44
+ fail('password', 'a GitHub Pages site is public; only a hosted board can ask for a password');
45
+ return { ok: false, steps, url: null };
46
+ }
47
+ // Checked before anything is created, so a short one never leaves a new board up without it.
48
+ if (typeof opts.password === 'string' && opts.password.length < hosted_1.PASSWORD_MIN) {
49
+ fail('password', `at least ${hosted_1.PASSWORD_MIN} characters — or leave it out and get one made up: npx arbiter publish --password`);
50
+ return { ok: false, steps, url: null };
51
+ }
43
52
  if (to) {
53
+ const password = opts.password === undefined ? undefined : opts.password === false ? null : opts.password === true ? (0, hosted_1.newPassword)() : opts.password;
44
54
  try {
45
- const r = await (0, hosted_1.publishHosted)(paths, to, { admin: opts.admin });
55
+ const r = await (0, hosted_1.publishHosted)(paths, to, { admin: opts.admin, password });
46
56
  if (r.created)
47
57
  done('project', `created on ${to} — link in .arbiter/hosted.json (commit it); token in .arbiter/hosted.token (git-ignored — teammates set ARBITER_PUBLISH_TOKEN)`);
58
+ // A made-up password is printed once, here: the service keeps only a hash. One you chose isn't echoed.
59
+ if (password === null)
60
+ done('password', 'off — anyone with the link can see the board');
61
+ else if (password !== undefined)
62
+ done('password', opts.password === true
63
+ ? `${password} — send it with the link. It isn't saved anywhere it can be read back; to change it, run --password again`
64
+ : 'set — send it with the link');
48
65
  // No image count: a card without a picture shows an icon of its kind, and that's usually right.
49
66
  done('board', `${r.candidates} screen${r.candidates === 1 ? '' : 's'} published`);
50
67
  for (const s of r.skipped)
@@ -48,11 +48,15 @@ const candidate_1 = require("./candidate");
48
48
  const update_1 = require("./update");
49
49
  const pictures_1 = require("../pictures");
50
50
  const request_1 = require("./request");
51
+ const wording_1 = require("../wording");
51
52
  // ── Parse + record ─────────────────────────────────────────────────────────
52
53
  function record(rawJson, opts = {}) {
53
54
  const parsed = parse(rawJson);
54
55
  if (!parsed.ok)
55
56
  return parsed.result;
57
+ const unclear = plainWords(parsed.input);
58
+ if (unclear)
59
+ return unclear;
56
60
  const bad = againstError((0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd)), parsed.input);
57
61
  if (bad)
58
62
  return bad;
@@ -68,12 +72,32 @@ function againstError(paths, input) {
68
72
  return null;
69
73
  return fail([`against: ${input.against} is not an active rule`]);
70
74
  }
75
+ /**
76
+ * A PM or a designer reads these lines, so one in code words or one that runs on is refused
77
+ * before it's written, and the agent says it again. Nothing is written either way.
78
+ */
79
+ function plainWords(input) {
80
+ const problems = (0, wording_1.unclearLines)(input);
81
+ if (!problems.length)
82
+ return null;
83
+ return {
84
+ exitCode: 1,
85
+ output: {
86
+ status: 'unclear',
87
+ errors: problems,
88
+ hint: "Nothing was written. Rewrite these lines in a PM's or designer's words, 20 words or fewer, and run it again.",
89
+ },
90
+ };
91
+ }
71
92
  function queue(rawJson, opts = {}) {
72
93
  if (opts.request)
73
94
  return fail([`--request records a change made for an approved request, directly: drop --pending. Nothing is queued for a request.`]);
74
95
  const parsed = parse(rawJson, { pending: true });
75
96
  if (!parsed.ok)
76
97
  return parsed.result;
98
+ const unclear = plainWords(parsed.input);
99
+ if (unclear)
100
+ return unclear;
77
101
  const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
78
102
  const bad = againstError(paths, parsed.input);
79
103
  if (bad)
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ /**
3
+ * `arbiter rename "<old name>" "<new name>"` — rename a piece of work, keeping its comments.
4
+ *
5
+ * A piece of work is the decisions that share a `trigger`, and its card id on the board comes from
6
+ * that name (`Settings build` → `W-settings-build`). Changing the name by hand made a new card and
7
+ * left every comment on the old one, which the board no longer shows. This renames it everywhere
8
+ * the repo keeps it — the archive, the queue, DECISIONS.md, its picture, requests and comments —
9
+ * and notes the move in .arbiter/renamed.json, so the next publish moves the board's comments too.
10
+ *
11
+ * Screens (C-0002) aren't renamed here: their id is a number, so a new name never moves a comment.
12
+ */
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.renameWork = renameWork;
18
+ const node_fs_1 = __importDefault(require("node:fs"));
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const store_1 = require("../store");
21
+ const candidates_1 = require("../candidates");
22
+ const hosted_1 = require("../hosted");
23
+ const requests_1 = require("../requests");
24
+ const work_1 = require("../work");
25
+ const fail = (errors) => ({ exitCode: 1, output: { status: 'invalid', errors } });
26
+ function renameWork(from, to, opts = {}) {
27
+ const root = (0, store_1.findRoot)(opts.cwd);
28
+ const paths = (0, store_1.resolvePaths)(root);
29
+ const oldName = (0, requests_1.oneLine)(from ?? '');
30
+ const newName = (0, requests_1.oneLine)(to ?? '');
31
+ if (!oldName || !newName)
32
+ return fail(['name the piece of work and what to call it: npx arbiter rename "Settings build" "Settings — billing"']);
33
+ const screen = (0, candidates_1.readCandidates)(paths).find((c) => c.id === oldName || c.name === oldName);
34
+ if (screen)
35
+ return fail([`${screen.id} is a screen, not a piece of work. Its id doesn't come from its name, so its comments stay with it whatever it's called.`]);
36
+ // By id, so case and punctuation don't matter, the way `snapshot` finds work. The id itself works too.
37
+ const oldId = /^W-[a-z0-9-]+$/.test(oldName) ? oldName : (0, work_1.workId)(oldName);
38
+ const newId = (0, work_1.workId)(newName);
39
+ if (newId === 'W-')
40
+ return fail([`"${newName}" has no letters or numbers to name a card by`]);
41
+ const mine = (d) => (0, work_1.workId)(d.trigger) === oldId;
42
+ const archive = (0, store_1.readArchive)(paths);
43
+ const pending = (0, store_1.readPending)(paths);
44
+ const active = (0, store_1.readActive)(paths);
45
+ const all = [...archive, ...pending];
46
+ const found = all.filter(mine);
47
+ if (!found.length)
48
+ return fail([`no piece of work called "${oldName}" — name it as its decisions did (npx arbiter rules --archive shows them)`]);
49
+ const current = found[0].trigger;
50
+ if (current === newName)
51
+ return fail([`"${current}" is already called that`]);
52
+ // Two pieces of work with one id would be one card with two names. Merging them is a different act.
53
+ const taken = newId !== oldId ? all.find((d) => (0, work_1.workId)(d.trigger) === newId) : undefined;
54
+ if (taken)
55
+ return fail([`there's already a piece of work called "${taken.trigger}" — renaming "${current}" onto it would merge the two`]);
56
+ const wrote = [];
57
+ const rename = (ds) => ds.map((d) => (mine(d) ? { ...d, trigger: newName } : d));
58
+ if (archive.some(mine)) {
59
+ (0, store_1.writeArchive)(paths, rename(archive));
60
+ wrote.push('.arbiter/archive.md');
61
+ }
62
+ if (pending.some(mine)) {
63
+ (0, store_1.writePending)(paths, rename(pending));
64
+ wrote.push('.arbiter/pending.md');
65
+ }
66
+ if (active.some(mine)) {
67
+ (0, store_1.writeActive)(paths, rename(active));
68
+ wrote.push('DECISIONS.md');
69
+ }
70
+ if (newId !== oldId) {
71
+ // The picture is filed under the id; it follows. Anything already filed under the new id belongs
72
+ // to no decision (that was checked above), so it's a leftover and goes.
73
+ const shot = (0, work_1.workSnapshot)(paths, oldId);
74
+ if (shot) {
75
+ const stale = (0, work_1.workSnapshot)(paths, newId);
76
+ if (stale)
77
+ node_fs_1.default.rmSync(stale, { force: true });
78
+ const next = node_path_1.default.join((0, work_1.workDir)(paths), newId + node_path_1.default.extname(shot));
79
+ node_fs_1.default.renameSync(shot, next);
80
+ wrote.push(`.arbiter/work/${node_path_1.default.basename(next)}`);
81
+ }
82
+ const requests = (0, requests_1.readRequests)(paths);
83
+ if (requests.some((r) => r.screen === oldId)) {
84
+ (0, requests_1.writeRequests)(paths, requests.map((r) => (r.screen === oldId ? { ...r, screen: newId } : r)));
85
+ wrote.push('.arbiter/requests.json');
86
+ }
87
+ const comments = (0, hosted_1.readComments)(paths);
88
+ if (comments.some((c) => c.candidate_id === oldId)) {
89
+ (0, hosted_1.writeComments)(paths, comments.map((c) => (c.candidate_id === oldId ? { ...c, candidate_id: newId } : c)));
90
+ wrote.push('.arbiter/comments.json');
91
+ }
92
+ (0, work_1.addRename)(paths, oldId, newId);
93
+ wrote.push('.arbiter/renamed.json');
94
+ }
95
+ return {
96
+ exitCode: 0,
97
+ output: {
98
+ status: 'renamed',
99
+ from: current,
100
+ to: newName,
101
+ decisions: found.length,
102
+ ...(newId !== oldId ? { card: { from: oldId, to: newId } } : {}),
103
+ wrote,
104
+ note: newId !== oldId
105
+ ? 'the board shows the new name, with its comments, after the next `npx arbiter publish`'
106
+ : 'same card on the board; only its name changes, at the next `npx arbiter publish`',
107
+ },
108
+ };
109
+ }
@@ -27,6 +27,9 @@ const requests_1 = require("../requests");
27
27
  const work_1 = require("../work");
28
28
  const request_1 = require("./request");
29
29
  const PAGE = node_path_1.default.join(__dirname, '..', '..', 'templates', 'review.html');
30
+ // Geist, as on arbiter.design. Shipped with the package: the page never loads anything from the network.
31
+ const FONTS = node_path_1.default.join(__dirname, '..', '..', 'templates', 'fonts');
32
+ const FONT_FILES = new Set(['Geist-Variable.woff2', 'GeistMono-Variable.woff2']);
30
33
  function review(opts = {}) {
31
34
  const root = (0, store_1.findRoot)(opts.cwd);
32
35
  const paths = (0, store_1.resolvePaths)(root);
@@ -67,6 +70,8 @@ function review(opts = {}) {
67
70
  candidates,
68
71
  hosted: (0, hosted_1.readLinkOrNull)(paths)?.shareUrl ?? null,
69
72
  boardVersion: (0, hosted_1.readLinkOrNull)(paths)?.boardVersion ?? null,
73
+ // The rules in force, for the Rules tab: what's already settled before you make another.
74
+ rules: active,
70
75
  active: active.length,
71
76
  cap: (0, store_1.readConfig)(paths)?.activeCap ?? store_1.ACTIVE_CAP,
72
77
  };
@@ -150,6 +155,17 @@ function review(opts = {}) {
150
155
  node_fs_1.default.createReadStream(abs).pipe(res);
151
156
  return;
152
157
  }
158
+ if (req.method === 'GET' && url.pathname.startsWith('/fonts/')) {
159
+ const file = node_path_1.default.basename(url.pathname);
160
+ if (!FONT_FILES.has(file)) {
161
+ res.writeHead(404);
162
+ res.end();
163
+ return;
164
+ }
165
+ res.writeHead(200, { 'content-type': 'font/woff2', 'cache-control': 'max-age=86400' });
166
+ node_fs_1.default.createReadStream(node_path_1.default.join(FONTS, file)).pipe(res);
167
+ return;
168
+ }
153
169
  if (req.method === 'POST' && url.pathname === '/api/candidate') {
154
170
  const body = JSON.parse(await readBody(req));
155
171
  const result = (0, candidate_1.updateCandidate)(body.id, { state: body.state, why: body.why, keepOthers: body.keepOthers, cwd });
@@ -76,7 +76,9 @@ function pendingList(pending, opts, paths) {
76
76
  const active = (0, store_1.readActive)(paths);
77
77
  const ignore = opts.config?.overlap?.ignore;
78
78
  return JSON.stringify({
79
- firstRun: !opts.config?.onboarded,
79
+ // Judged decisions mean someone has been through a review, whatever arbiter.json says: the
80
+ // stamp lives in a committed file, and a branch that never merged takes it along.
81
+ firstRun: !opts.config?.onboarded && !archiveAll.length && !active.length,
80
82
  checkin: opts.config?.checkin ?? 'feature',
81
83
  ...(0, update_1.updateNotice)(paths),
82
84
  requests: { open, approved },
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * `arbiter unpublish --yes` — take the hosted board down, for everyone.
4
+ *
5
+ * The board is a window onto the record, so deleting it loses nothing the repo holds: decisions,
6
+ * rules, pictures and requests all stay. What lives only on the board is what people said there,
7
+ * so the comments are pulled into .arbiter/comments.json first. Then the board, its pictures and
8
+ * its comments are deleted from the service, and the link here goes with them.
9
+ *
10
+ * Without --yes it deletes nothing and says what it would, because nothing brings a board back:
11
+ * publishing again makes a new one, at a new link, with no comments.
12
+ */
13
+ var __importDefault = (this && this.__importDefault) || function (mod) {
14
+ return (mod && mod.__esModule) ? mod : { "default": mod };
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.unpublish = unpublish;
18
+ const node_fs_1 = __importDefault(require("node:fs"));
19
+ const node_path_1 = __importDefault(require("node:path"));
20
+ const hosted_1 = require("../hosted");
21
+ const store_1 = require("../store");
22
+ const publish_1 = require("./publish");
23
+ /**
24
+ * With `board` and `admin`: a takedown of any board on a server you run, by its link, with the
25
+ * server's admin token from ARBITER_ADMIN_TOKEN. Needs no project here and changes nothing in one.
26
+ */
27
+ async function unpublish(opts = {}) {
28
+ if (opts.board || opts.admin)
29
+ return takedown(opts);
30
+ const root = (0, store_1.findRoot)(opts.cwd);
31
+ const paths = (0, store_1.resolvePaths)(root);
32
+ const steps = [];
33
+ const link = (0, hosted_1.readLinkOrNull)(paths);
34
+ if (!link) {
35
+ steps.push({ step: 'board', outcome: 'failed', note: 'this project has no hosted board (.arbiter/hosted.json)' });
36
+ return { ok: false, steps, url: null };
37
+ }
38
+ if (!opts.yes) {
39
+ steps.push({
40
+ step: 'board',
41
+ outcome: 'skipped',
42
+ note: `nothing deleted. This deletes ${link.shareUrl} for everyone: the board, its pictures and every comment on it, saving the comments to .arbiter/comments.json first. To go ahead: npx arbiter unpublish --yes`,
43
+ });
44
+ return { ok: false, steps, url: link.shareUrl };
45
+ }
46
+ try {
47
+ const r = await (0, hosted_1.unpublishHosted)(paths);
48
+ steps.push({ step: 'comments', outcome: 'done', note: `${r.saved} saved to .arbiter/comments.json` });
49
+ steps.push({ step: 'board', outcome: 'done', note: `deleted ${r.link.shareUrl}, with ${r.pictures} picture${r.pictures === 1 ? '' : 's'} and ${r.comments} comment${r.comments === 1 ? '' : 's'}` });
50
+ steps.push({ step: 'link', outcome: 'done', note: 'removed .arbiter/hosted.json and .arbiter/hosted.token — commit that, so teammates stop publishing to it' });
51
+ }
52
+ catch (e) {
53
+ steps.push({ step: 'board', outcome: 'failed', note: e.message });
54
+ return { ok: false, steps, url: null };
55
+ }
56
+ // The workflow would now run on every push and fail: it never creates a board from CI.
57
+ if (node_fs_1.default.existsSync(node_path_1.default.join(root, publish_1.WORKFLOW_FILE))) {
58
+ steps.push({ step: 'workflow', outcome: 'skipped', note: `${publish_1.WORKFLOW_FILE} still runs on every push, and will fail now there's no board. Delete it` });
59
+ }
60
+ return { ok: true, steps, url: null };
61
+ }
62
+ async function takedown(opts) {
63
+ const fail = (note) => ({ ok: false, steps: [{ step: 'board', outcome: 'failed', note }], url: null });
64
+ if (!opts.admin)
65
+ return fail("a board link is for taking down someone else's board, with --admin. To delete this project's own board, leave the link out");
66
+ if (!opts.board)
67
+ return fail('--admin needs the link of the board to take down: npx arbiter unpublish <board link> --admin --yes');
68
+ const board = (0, hosted_1.parseBoardLink)(opts.board);
69
+ if (!board)
70
+ return fail(`${opts.board} isn't a board link. One looks like https://arbiter.design/p/abc123`);
71
+ const admin = process.env[hosted_1.ADMIN_ENV]?.trim();
72
+ if (!admin)
73
+ return fail(`set ${hosted_1.ADMIN_ENV} to the admin token of ${board.origin} first`);
74
+ if (!opts.yes) {
75
+ return {
76
+ ok: false,
77
+ steps: [{ step: 'board', outcome: 'skipped', note: `nothing deleted. This deletes ${board.shareUrl} for everyone: the board, its pictures and every comment on it, and its owner can't get the comments back. To go ahead: npx arbiter unpublish ${board.shareUrl} --admin --yes` }],
78
+ url: board.shareUrl,
79
+ };
80
+ }
81
+ try {
82
+ const r = await (0, hosted_1.takedownHosted)(board.shareUrl, admin);
83
+ return { ok: true, steps: [{ step: 'board', outcome: 'done', note: `deleted ${r.shareUrl}, with ${r.pictures} picture${r.pictures === 1 ? '' : 's'} and ${r.comments} comment${r.comments === 1 ? '' : 's'}` }], url: null };
84
+ }
85
+ catch (e) {
86
+ return fail(e.message);
87
+ }
88
+ }