arbiterdesign 0.1.0 → 0.1.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
@@ -53,8 +53,8 @@ arbiter candidate add "<name>" track a generated direction [--feature f] [
53
53
  arbiter candidate C-0002 --state … generated | in_review | approved | rejected | superseded
54
54
  arbiter board candidates and their states
55
55
  arbiter export static folder of the board for people without the repo [--feature f] [--include-rules] [--open]
56
- arbiter publish board online via GitHub Pages: git destination + export + commit + push
57
- arbiter publish --to <url> board online on a hosted Arbiter (hosted/), with comments; prints the share link
56
+ arbiter publish board online at arbiter.design, with comments; prints the share link. Nothing to set up.
57
+ arbiter publish --to <url|pages> your own hosted Arbiter, or GitHub Pages (git destination + export + commit + push)
58
58
  arbiter pull bring comments and "looks good" reactions down into .arbiter/comments.json
59
59
  arbiter drift deviations per screen: accepts, unverified claims, rules broken
60
60
  arbiter rules active rules [--dimension <name>] [--json]
@@ -92,7 +92,7 @@ The scan set is the rule's `paths` (directories or files) if it names any, else
92
92
 
93
93
  ## Hosted board
94
94
 
95
- `hosted/` is a small Next.js + Supabase app — the same stack as your other projects — that serves a board at a share link and lets people comment or say "looks good" after a magic-link sign-in. Git stays the record: the service holds one board version per project and the comments, nothing else. `npx arbiter publish --to https://your-deployment` uploads; `npx arbiter pull` brings comments back, where `arbiter review` shows them beside each screen. Deploy steps in [hosted/README.md](hosted/README.md). Only `publish` and `pull` ever touch the network.
95
+ The hosted board at [arbiter.design](https://arbiter.design) serves a board at a share link and lets people comment or say "looks good" after a magic-link sign-in. Git stays the record: the service holds one board version per project and the comments, nothing else. `npx arbiter publish` uploads; `npx arbiter pull` brings comments back, where `arbiter review` shows them beside each screen. Only `publish` and `pull` ever touch the network. The service itself is a separate, private codebase.
96
96
 
97
97
  ## Candidates
98
98
 
@@ -60,7 +60,7 @@ async function init(opts = {}) {
60
60
  }
61
61
  }
62
62
  // ── arbiter.json ─────────────────────────────────────────────────────
63
- const config = { version: 1, destination: 'local', ...existing, author, client, ...(opts.destination && { destination: opts.destination }) };
63
+ const config = { version: 1, destination: 'local', hosted: { url: 'https://arbiter.design' }, ...existing, author, client, ...(opts.destination && { destination: opts.destination }) };
64
64
  if (!existing) {
65
65
  (0, store_1.writeConfig)(paths, config);
66
66
  steps.push({ file: 'arbiter.json', outcome: 'created' });
@@ -12,12 +12,15 @@
12
12
  * 5. print the link
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.DEFAULT_HOST = void 0;
15
16
  exports.publish = publish;
16
17
  const node_child_process_1 = require("node:child_process");
17
18
  const candidates_1 = require("../candidates");
18
19
  const destination_1 = require("../destination");
19
20
  const store_1 = require("../store");
20
21
  const hosted_1 = require("../hosted");
22
+ /** Where `arbiter publish` goes when nothing says otherwise. */
23
+ exports.DEFAULT_HOST = 'https://arbiter.design';
21
24
  async function publish(opts = {}) {
22
25
  const root = (0, store_1.findRoot)(opts.cwd);
23
26
  const paths = (0, store_1.resolvePaths)(root);
@@ -25,7 +28,9 @@ async function publish(opts = {}) {
25
28
  const done = (step, note) => steps.push({ step, outcome: 'done', note });
26
29
  const skip = (step, note) => steps.push({ step, outcome: 'skipped', note });
27
30
  const fail = (step, note) => steps.push({ step, outcome: 'failed', note });
28
- const to = opts.to ?? (0, store_1.readConfig)(paths)?.hosted?.url;
31
+ // Hosted by default: the flag, then arbiter.json, then arbiter.design. `--to pages` is the git route.
32
+ const chosen = opts.to ?? (0, store_1.readConfig)(paths)?.hosted?.url ?? exports.DEFAULT_HOST;
33
+ const to = chosen === 'pages' || chosen === 'git' ? null : chosen;
29
34
  if (to) {
30
35
  try {
31
36
  const r = await (0, hosted_1.publishHosted)(paths, to, { admin: opts.admin });
@@ -71,6 +71,7 @@ function queue(rawJson, opts = {}) {
71
71
  dimension: entry.dimension,
72
72
  verified: entry.verified,
73
73
  pending: pending.length + 1,
74
+ checkin: (0, store_1.readConfig)(paths)?.checkin ?? 'feature',
74
75
  review: 'npx arbiter review',
75
76
  },
76
77
  };
@@ -17,6 +17,7 @@ const format_1 = require("../format");
17
17
  const store_1 = require("../store");
18
18
  function rules(id, opts = {}) {
19
19
  const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
20
+ opts = { ...opts, config: (0, store_1.readConfig)(paths) };
20
21
  const cap = (0, store_1.readConfig)(paths)?.activeCap ?? store_1.ACTIVE_CAP;
21
22
  if (id)
22
23
  return one(id, paths, opts.json);
@@ -59,6 +60,8 @@ function pendingList(pending, opts) {
59
60
  const groups = groupByTrigger(pending);
60
61
  if (opts.json) {
61
62
  return JSON.stringify({
63
+ firstRun: !opts.config?.onboarded,
64
+ checkin: opts.config?.checkin ?? 'feature',
62
65
  count: pending.length,
63
66
  polish: pending.filter((d) => d.level === 'polish').length,
64
67
  groups: groups.map((g) => ({ trigger: g.trigger, items: g.items, polish: g.polish })),
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ /**
3
+ * `arbiter setup --checkin <feature|quiet|every>` — the one preference the first `/arbiter` asks
4
+ * for, written to arbiter.json. Running it also marks the project as onboarded, so the intro
5
+ * never shows twice. Later: "be quieter" → the agent runs it again.
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.CHECKINS = void 0;
9
+ exports.setup = setup;
10
+ const store_1 = require("../store");
11
+ exports.CHECKINS = ['feature', 'quiet', 'every'];
12
+ function setup(opts) {
13
+ const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
14
+ const config = (0, store_1.readConfig)(paths);
15
+ if (!config)
16
+ return { exitCode: 1, output: { status: 'invalid', errors: ['no arbiter.json here — run `npx arbiter init` first'] } };
17
+ const checkin = (opts.checkin ?? config.checkin ?? 'feature');
18
+ if (!exports.CHECKINS.includes(checkin))
19
+ return { exitCode: 1, output: { status: 'invalid', errors: [`--checkin must be one of ${exports.CHECKINS.join(' | ')}`] } };
20
+ const next = { ...config, checkin, onboarded: config.onboarded ?? (0, store_1.now)() };
21
+ (0, store_1.writeConfig)(paths, next);
22
+ return { exitCode: 0, output: { status: 'saved', checkin, onboarded: next.onboarded } };
23
+ }
package/dist/hosted.js CHANGED
@@ -168,7 +168,9 @@ async function publishHosted(paths, serviceUrl, opts = {}) {
168
168
  const admin = opts.admin ?? process.env[exports.ADMIN_ENV];
169
169
  const r = await api(`${base}/api/projects`, { method: 'POST', body: JSON.stringify({ name: node_path_1.default.basename(paths.root) }), admin });
170
170
  if (r.status === 401)
171
- throw new Error(`${base} needs an admin token to create projects. Ask whoever runs it, then: ${exports.ADMIN_ENV}=<token> npx arbiter publish --to ${base}`);
171
+ throw new Error(`${base} only lets an admin create boards. Ask whoever runs it for the token, then: npx arbiter publish --to ${base} --admin-token <token>`);
172
+ if (r.status === 429)
173
+ throw new Error(`${base} is busy right now — try again in an hour`);
172
174
  if (!r.ok)
173
175
  throw new Error(`could not create project on ${base}: ${r.body.error ?? r.status}`);
174
176
  link = { url: base, projectId: String(r.body.id), slug: String(r.body.slug), shareUrl: String(r.body.url) };
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ const export_1 = require("./commands/export");
12
12
  const publish_1 = require("./commands/publish");
13
13
  const pull_1 = require("./commands/pull");
14
14
  const snapshot_1 = require("./commands/snapshot");
15
+ const setup_1 = require("./commands/setup");
15
16
  const rules_1 = require("./commands/rules");
16
17
  const init_1 = require("./commands/init");
17
18
  const review_1 = require("./commands/review");
@@ -123,6 +124,15 @@ program
123
124
  const r = (0, sweep_1.sweepCommand)(id, opts);
124
125
  process.stdout.write(r.text + '\n');
125
126
  });
127
+ program
128
+ .command('setup')
129
+ .description('Save how Arbiter checks in while you work: --checkin feature (one line after big work) | quiet | every. Marks the project as onboarded.')
130
+ .option('--checkin <mode>', 'feature | quiet | every')
131
+ .action((opts) => {
132
+ const result = (0, setup_1.setup)(opts);
133
+ process.stdout.write(JSON.stringify(result.output, null, 2) + '\n');
134
+ process.exit(result.exitCode);
135
+ });
126
136
  program
127
137
  .command('snapshot <work>')
128
138
  .description('Attach a picture to a piece of work, named as its decisions named it: snapshot "Settings build" --file shot.png')
@@ -179,9 +189,9 @@ program
179
189
  });
180
190
  program
181
191
  .command('publish')
182
- .description('Put the board online. Default: GitHub Pages (git destination, export, commit, push). --to <url>: a hosted Arbiter board with comments.')
183
- .option('--to <url>', 'hosted board service (the hosted/ app); saved to .arbiter/hosted.json on first publish')
184
- .option('--admin-token <token>', 'the site\'s admin token, needed once to create the project (or set ARBITER_ADMIN_TOKEN)')
192
+ .description('Put the board online at arbiter.design and print the link. --to <url> for your own hosted Arbiter; --to pages for GitHub Pages (git destination, export, commit, push). Nothing to set up first.nts.')
193
+ .option('--to <url|pages>', 'where to publish: a hosted Arbiter (default arbiter.design), or `pages` for GitHub Pages')
194
+ .option('--admin-token <token>', 'only for a self-hosted Arbiter that gates board creation')
185
195
  .option('--no-push', 'GitHub Pages mode: do everything except push')
186
196
  .action(async (opts) => {
187
197
  const r = await (0, publish_1.publish)({ noPush: opts.push === false, to: opts.to, admin: opts.adminToken });
@@ -179,7 +179,7 @@ function fakeService() {
179
179
  try {
180
180
  const r = await (0, publish_1.publish)({ cwd, to: url });
181
181
  strict_1.default.equal(r.ok, false);
182
- strict_1.default.ok(r.steps[0].note.includes('ARBITER_ADMIN_TOKEN'));
182
+ strict_1.default.ok(r.steps[0].note.includes('--admin-token'));
183
183
  const r2 = await (0, publish_1.publish)({ cwd, to: url, admin: 'admin-1' });
184
184
  strict_1.default.ok(r2.steps.some((s) => s.step === 'project' && s.outcome === 'done'));
185
185
  }
@@ -12,6 +12,7 @@ const node_http_1 = __importDefault(require("node:http"));
12
12
  const record_1 = require("../commands/record");
13
13
  const rules_1 = require("../commands/rules");
14
14
  const review_1 = require("../commands/review");
15
+ const setup_1 = require("../commands/setup");
15
16
  const store_1 = require("../store");
16
17
  const tmp = () => node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'arbiter-pending-'));
17
18
  const input = (over = {}) => JSON.stringify({
@@ -196,3 +197,18 @@ function post(port, p, body) {
196
197
  // And it's in the file as its own line, so a URL never collides with the separator.
197
198
  strict_1.default.match(node_fs_1.default.readFileSync(p.archive, 'utf8'), /^- \*\*Ref:\*\* ENG-2$/m);
198
199
  });
200
+ (0, node_test_1.test)('first /arbiter: the queue reports firstRun until setup records the check-in answer', () => {
201
+ const cwd = node_fs_1.default.mkdtempSync(node_path_1.default.join(node_os_1.default.tmpdir(), 'arbiter-onboard-'));
202
+ (0, store_1.writeConfig)((0, store_1.resolvePaths)(cwd), { version: 1, destination: 'local', author: 'test' });
203
+ const before = JSON.parse((0, rules_1.rules)(undefined, { cwd, pending: true, json: true }));
204
+ strict_1.default.equal(before.firstRun, true);
205
+ strict_1.default.equal(before.checkin, 'feature');
206
+ const r = (0, setup_1.setup)({ cwd, checkin: 'quiet' });
207
+ strict_1.default.equal(r.exitCode, 0);
208
+ const after = JSON.parse((0, rules_1.rules)(undefined, { cwd, pending: true, json: true }));
209
+ strict_1.default.equal(after.firstRun, false);
210
+ strict_1.default.equal(after.checkin, 'quiet');
211
+ const queued = (0, record_1.queue)(JSON.stringify({ change: 'c', decision: 'd', rationale: 'r', trigger: 'T', scope: 'global', dimension: 'visual', class: 'judgment', level: 'polish' }), { cwd, author: 'test' });
212
+ strict_1.default.equal(queued.output.checkin, 'quiet', 'record --pending tells the agent the setting');
213
+ strict_1.default.equal((0, setup_1.setup)({ cwd, checkin: 'loud' }).exitCode, 1, 'unknown modes are refused');
214
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arbiterdesign",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
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": {
@@ -23,13 +23,54 @@ Design work is iterative. A screen redesigned six times is one piece of work, no
23
23
  npx arbiter record --pending '<json>'
24
24
  ```
25
25
 
26
- (JSON shape below). Then — **only if the piece of work included a `feature`-level decision** — add one line to your reply carrying its Change line, not a count:
26
+ (JSON shape below). The output carries `checkin`, the user's answer from their first `/arbiter`:
27
+
28
+ - `feature` (default) — **only if the piece of work included a `feature`-level decision**, add one line to your reply carrying its Change line, not a count. At most once per session.
29
+ - `quiet` — say nothing. Ever. They run `/arbiter` when they want it.
30
+ - `every` — one line each time a piece of work settles and you queue, whatever its level.
31
+
32
+ The line, when there is one:
27
33
 
28
34
  ```
29
35
  Queued: Settings is now a tab-row shell with four routes under it (+2 pattern, +4 polish) — /arbiter when you're ready.
30
36
  ```
31
37
 
32
- A count on every reply gets ignored; a sentence about what changed, only after something big, gets read. **At most once per session.** After that, queue silently — the user knows the queue exists. If the work was only patterns and polish, say nothing. Never phrase it as a question ("should we run arbiter?") — it's a statement of what was queued, and the user decides when. Do not show the widget. Do not list the decisions. The queue lives in `.arbiter/pending.md`, so it survives the session; the user can judge it here, in the review page, or never.
38
+ A count on every reply gets ignored; a sentence about what changed, only after something big, gets read. After the line, queue silently — the user knows the queue exists. If the work was only patterns and polish, say nothing. Never phrase it as a question ("should we run arbiter?") — it's a statement of what was queued, and the user decides when. Do not show the widget. Do not list the decisions. The queue lives in `.arbiter/pending.md`, so it survives the session; the user can judge it here, in the review page, or never.
39
+
40
+ ## The first `/arbiter` — intro, then the queue
41
+
42
+ The queue JSON carries `firstRun: true` until the project has been through this once. When it does, before anything else, say this — verbatim, it's been written for the reader:
43
+
44
+ > **Arbiter's on.** While I build UI, I record the design decisions I make — what changed, the rule behind it, what was rejected — so nothing gets re-decided and your team can see why things are the way they are.
45
+ >
46
+ > **How it works**
47
+ > 1. You build as usual. I say nothing about decisions until a piece of work settles — then one line.
48
+ > 2. `/arbiter` shows what's queued. For each: **Confirm**, **Make it a rule**, or **Skip**. Rules go into `DECISIONS.md`, and I read them before touching UI.
49
+ > 3. When you want the team to see it, say **publish** — I'll give you a link to a board they can read and comment on.
50
+ >
51
+ > **Commands**
52
+ > - `/arbiter` — review what's queued
53
+ > - **publish** — say it, get the board link
54
+ > - **"record that"** / **"make that a rule"** — mid-chat, recorded, no questions
55
+
56
+ Then one question, with the selection widget (text fallback: the same three lines, numbered):
57
+
58
+ - **header** — `While you work`
59
+ - **question** — `When should Arbiter check in about decisions?`
60
+ - **options** —
61
+ - `A line after big work` (Recommended) — *When a feature-sized piece settles, one sentence saying what was queued. Never mid-iteration, at most once a session.*
62
+ - `Nothing until I ask` — *Queued silently. /arbiter whenever you want to see it.*
63
+ - `A line after everything` — *One sentence every time a piece of work settles, big or small.*
64
+
65
+ Record the answer — Skip means the recommended one:
66
+
67
+ ```
68
+ npx arbiter setup --checkin feature # A line after big work
69
+ npx arbiter setup --checkin quiet # Nothing until I ask
70
+ npx arbiter setup --checkin every # A line after everything
71
+ ```
72
+
73
+ That also marks the project as onboarded. Then continue with the queue as below; if it's empty, one line: `Nothing queued yet — build something.`
33
74
 
34
75
  **When they ask** — `/arbiter`, "let's review", "what did you decide" — read the queue with `npx arbiter rules --pending --json`. It comes back grouped by piece of work (`groups[].trigger`), feature and pattern items in `items`, polish in `polish`. Present the feature and pattern items (below); polish is never presented individually. Judge each answer with:
35
76
 
@@ -285,6 +326,16 @@ npx arbiter record --findings <file.json> --tool <scanner name>
285
326
 
286
327
  Each finding becomes a pending item with a verdict to attach. Then one line: `12 findings queued — /arbiter to review, or npx arbiter review.`
287
328
 
329
+ ## Publishing a board
330
+
331
+ When the user wants a board — *"publish this"*, *"share it"*, *"get me a link"* — run one command and paste back the link it prints:
332
+
333
+ ```
334
+ npx arbiter publish
335
+ ```
336
+
337
+ It goes to arbiter.design. Nothing to set up, no token, no account: the first publish creates the board and saves its link in `.arbiter/hosted.json` (commit it) and a publish token in `.arbiter/hosted.token` (git-ignored — a teammate sets `ARBITER_PUBLISH_TOKEN` to republish). Later publishes replace the board. **Don't ask where to publish, and don't ask for a token.** Only a self-hosted Arbiter takes `--to <url>`; `--to pages` is GitHub Pages instead.
338
+
288
339
  ## Comments from stakeholders
289
340
 
290
341
  If the project publishes to a hosted board, `npx arbiter pull` brings comments and "looks good" reactions into `.arbiter/comments.json`, keyed by candidate. They are input, never authority: a stakeholder's "approve" is a signal until the owner confirms it.
@@ -293,6 +344,10 @@ If the project publishes to a hosted board, `npx arbiter pull` brings comments a
293
344
  - When the user says *"approve C-0001, Sam signed off"*: `npx arbiter candidate C-0001 --state approved --why "Sam: <their words>"`.
294
345
  - Never act on a comment the user hasn't pointed at. Don't summarise the comments file unprompted; `arbiter review` shows them beside each screen.
295
346
 
347
+ ## Changing how often Arbiter checks in
348
+
349
+ *"Be quieter about decisions"*, *"stop telling me"*, *"tell me after everything"* — run `npx arbiter setup --checkin quiet|feature|every` and confirm in four words. No question.
350
+
296
351
  ## Retiring a rule
297
352
 
298
353
  If the user says a rule is dead with nothing replacing it — *"we don't need the empty-state rule any more"* — retire it, reason in their words: