arbiterdesign 0.1.3 → 0.1.6
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 +65 -10
- package/dist/autopublish.js +81 -0
- package/dist/commands/export.js +9 -6
- package/dist/commands/init.js +4 -0
- package/dist/commands/publish.js +33 -5
- package/dist/commands/pull.js +25 -4
- package/dist/commands/record.js +80 -14
- package/dist/commands/remove.js +248 -0
- package/dist/commands/request.js +123 -0
- package/dist/commands/review.js +109 -9
- package/dist/commands/rules.js +61 -7
- package/dist/commands/setup.js +39 -2
- package/dist/commands/snapshot.js +17 -2
- package/dist/findings.js +10 -1
- package/dist/format.js +21 -13
- package/dist/hosted.js +60 -13
- package/dist/index.js +62 -11
- package/dist/pictures.js +52 -0
- package/dist/requests.js +194 -0
- package/dist/store.js +19 -0
- package/package.json +1 -1
- package/templates/SKILL.md +233 -32
- package/templates/review.html +114 -4
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ That's the whole install. It writes:
|
|
|
16
16
|
| `.arbiter/candidates/` | One page per generated screen or direction, with its state, snapshot, decisions, and why it lost. |
|
|
17
17
|
| `CANDIDATES.md` | Index of candidates — written only when `destination` is `git`. |
|
|
18
18
|
| `.claude/skills/arbiter/SKILL.md` or `.cursor/rules/arbiter.mdc` | Tells the agent to surface its decisions after UI work and record what you confirm. |
|
|
19
|
-
| `arbiter.json` | Config. `destination: "local"`. |
|
|
19
|
+
| `arbiter.json` | Config. `destination: "local"`. `app.url` (from `npx arbiter setup --app http://localhost:3000`) is where the agent opens screens for pictures. |
|
|
20
20
|
| `AGENTS.md` | One line appended, pointing at `DECISIONS.md`. Merged, never overwritten. |
|
|
21
21
|
| `CLAUDE.md` (Claude Code) / `.cursor/commands/arbiter.md` (Cursor) | Same pointer line in Claude Code's own context file; a `/arbiter` command for Cursor. |
|
|
22
22
|
|
|
@@ -24,10 +24,10 @@ Running `init` twice changes nothing.
|
|
|
24
24
|
|
|
25
25
|
## How it works
|
|
26
26
|
|
|
27
|
-
1. You ask the agent to build a screen. It reads `DECISIONS.md` first.
|
|
27
|
+
1. You ask the agent to build a screen. It reads `DECISIONS.md` first. After a sizeable piece of work it names up to three rules that shaped it, *Following D-0001 (removing asks first, no undo bar)*, so you can see the record working. How often follows the check-in setting: never under `quiet`, every time a rule changed something under `every`.
|
|
28
28
|
2. You iterate. It says nothing about decisions while you're iterating — each version you move past becomes a rejected alternative on the one that replaced it.
|
|
29
|
-
3. When you move on, it queues the design calls it made — sized as `feature`, `pattern`, or `polish` — and, after feature-level work, says one line about what changed.
|
|
30
|
-
4. You judge them when you want — in chat with `/arbiter`, or in the browser with `npx arbiter review`. Grouped by piece of work; each item reads **Change** (what happened) / **Pattern** (the rule) / **Rejected** (what lost). Per item: **Confirm**, **Make it a rule**, **Skip**, or type a correction. Polish is one line per group — **Confirm all**.
|
|
29
|
+
3. When you move on, it queues the design calls it made — sized as `feature`, `pattern`, or `polish` — and, after feature-level work, says one line about what changed. When 5 changes are waiting (then 10, 15…), it asks in plain text whether you want to review them now; polish doesn't count, and `setup --checkin quiet` turns both off.
|
|
30
|
+
4. You judge them when you want — in chat with `/arbiter`, or in the browser with `npx arbiter review`. Grouped by piece of work; each item reads **Change** (what happened) / **Pattern** (the rule) / **Rejected** (what lost). Per item: **Confirm**, **Make it a rule**, **Skip**, or type a correction. Polish is one line per group — **Confirm all**. In chat, an item that goes against an active rule says so (*Clashes — D-0009*) and asks which wins: **Follow D-0009**, **Replace D-0009**, or **Keep as exception**.
|
|
31
31
|
5. Rules enter `DECISIONS.md`. Everything judged enters the archive. Skips vanish.
|
|
32
32
|
|
|
33
33
|
You can also just say it: *"make that a rule"*, *"reject the tabs, going with a single page"*. It records without asking.
|
|
@@ -38,14 +38,21 @@ Nothing enforces anything. Rules inform generation; they don't gate it.
|
|
|
38
38
|
|
|
39
39
|
```
|
|
40
40
|
arbiter init install into this project [--destination git]
|
|
41
|
+
arbiter setup --checkin <mode> how often the agent checks in: feature | quiet | every
|
|
42
|
+
arbiter setup --app <url> where the app runs, so the agent can open screens for pictures
|
|
41
43
|
arbiter snapshot "<work>" --file x.png a picture for a piece of work (or --capture on macOS); publish carries it
|
|
42
44
|
arbiter record walk through a decision at the terminal
|
|
43
45
|
arbiter record '<json>' record now (what the agent calls)
|
|
44
46
|
arbiter record --pending '<json>' queue for later
|
|
45
|
-
arbiter record P-0003 --as rule judge a queued one: accept | rule | skip | fix --to "…"
|
|
47
|
+
arbiter record P-0003 --as rule judge a queued one: accept | rule | skip | fix --to "…" [--candidate C-0001]
|
|
46
48
|
arbiter record --all --as accept judge every queued item [--level polish] [--trigger "Settings build"]
|
|
47
49
|
arbiter record --findings f.json queue a scanner's findings for verdicts
|
|
48
50
|
arbiter record --retire D-0003 --why "…" drop a rule with no replacement
|
|
51
|
+
arbiter record R-0001 --as apply answer a request from the board: apply [--to "<instead>"] | decline --why "…"
|
|
52
|
+
arbiter record '<json>' --request R-0001 record the change made for an approved request; it's applied
|
|
53
|
+
arbiter remove D-0004 take out a record that was never real: a decision, a screen (C-0001),
|
|
54
|
+
or a picture (--snapshot "<work>")
|
|
55
|
+
arbiter unlink D-0004 detach a decision from the screen it was recorded against
|
|
49
56
|
arbiter review judge the queue in a browser page
|
|
50
57
|
arbiter verify [id] re-check a decision's claim against its files
|
|
51
58
|
arbiter sweep D-0004 [--queue] find existing violations of a mechanical rule
|
|
@@ -56,17 +63,45 @@ arbiter export static folder of the board for people withou
|
|
|
56
63
|
arbiter publish board online at arbiter.design, with comments; prints the share link. Nothing to set up.
|
|
57
64
|
arbiter publish --to <url|pages> your own hosted Arbiter, or GitHub Pages (git destination + export + commit + push)
|
|
58
65
|
arbiter publish --on-push also write a GitHub Actions workflow that republishes on every push, and set its secret
|
|
59
|
-
arbiter
|
|
66
|
+
arbiter publish --auto republish whenever the record changes — no GitHub, no CI, no repository needed
|
|
67
|
+
arbiter pull bring comments and "looks good" reactions down into .arbiter/comments.json;
|
|
68
|
+
"Request change" becomes a request (R-0001) in .arbiter/requests.json
|
|
60
69
|
arbiter drift deviations per screen: accepts, unverified claims, rules broken
|
|
61
70
|
arbiter rules active rules [--dimension <name>] [--json]
|
|
62
|
-
arbiter rules --pending the queue
|
|
71
|
+
arbiter rules --pending the queue, and requests waiting on an answer
|
|
63
72
|
arbiter rules --archive everything ever
|
|
64
|
-
arbiter rules D-0003 one decision in full
|
|
73
|
+
arbiter rules D-0003 one decision in full (R-0001: one request)
|
|
65
74
|
arbiter update newest Arbiter: install it, refresh the skill file, re-pin the workflow [--check]
|
|
66
75
|
```
|
|
67
76
|
|
|
68
77
|
`record` exit codes: `0` recorded · `1` invalid · `2` overlap — re-run with `--supersedes <id>` or `--keep-both` · `3` cap reached · `4` contradicted — the named files don't match the claim.
|
|
69
78
|
|
|
79
|
+
## Screenshots
|
|
80
|
+
|
|
81
|
+
The agent takes one picture per piece of work, when the work settles and it changed how a specific screen looks. Size isn't the test — a small pattern change on one screen earns a picture; a font or token change has no single screen to point at and doesn't. Motion and anything behavioural can't be carried by a still, so they don't either. Work that's only polish gets none: polish never reaches the board, so there'd be no card to show it on.
|
|
82
|
+
|
|
83
|
+
The agent's own screenshot tool hands it an image, not a file, so it renders to disk with a headless browser (`chrome --headless --screenshot=…`) and attaches that. When it can't — no browser, app not running, screen behind a login — it says so once, naming the reason, whatever the check-in setting. `--capture` is the manual fallback and is macOS only; elsewhere, save a screenshot and pass `--file`.
|
|
84
|
+
|
|
85
|
+
Name a piece of work after the screen it changed where the work splits that way — `Settings — billing` rather than one `Settings build` across four routes — and one picture per piece of work is one per screen.
|
|
86
|
+
|
|
87
|
+
The board shows an icon of the kind of change where a card has no picture, so a missing one never looks broken there. That's also why nobody notices, so Arbiter says it where it can still be fixed. A change asks for a picture when it's about one screen (not `global`) and is layout, words or looks (`structure`, `content`, `visual`); interaction, states, motion and access are right as an icon. When such a card has none, `record` adds a `picture` line with the command to the agent's reply, the review page marks the group "No picture", and `publish` to arbiter.design lists the card (the agent passes the list on). Scanner findings never ask: they're a line in a file, not a screen. Nothing on the board changes.
|
|
88
|
+
|
|
89
|
+
## Taking something out
|
|
90
|
+
|
|
91
|
+
Three acts, and only one is a removal.
|
|
92
|
+
|
|
93
|
+
| | What it means | Command |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| **Retire** | It was real, it's over | `arbiter record --retire D-0003 --why "…"` |
|
|
96
|
+
| **Remove** | It was never real | `arbiter remove D-0004` |
|
|
97
|
+
| **Unlink** | Real, attached to the wrong screen | `arbiter unlink D-0004` |
|
|
98
|
+
|
|
99
|
+
The archive is append-only for judgments: a call you changed your mind about is superseded, and that history is the point. It isn't append-only for mistakes. A test entry, an agent misfire, or a screen invented to work around a bug is a record that says something false, and keeping it forever makes the archive less trustworthy, not more.
|
|
100
|
+
|
|
101
|
+
So `remove` deletes — from the archive, from `DECISIONS.md`, from the candidate files — and prints the full record it removed, because git holds the history only for people who have a repo. It refuses while anything still points at the record: an active rule (retire it), a decision another one supersedes, or a screen with decisions still linked (`--force` unlinks them in one go).
|
|
102
|
+
|
|
103
|
+
`arbiter remove --snapshot "<work>"` takes only the picture; the work and its decisions stay, and the board keeps the old image until the next publish.
|
|
104
|
+
|
|
70
105
|
## Verification
|
|
71
106
|
|
|
72
107
|
A mechanical decision can name `files` and an `expect` — literal strings that must be `present` in / `absent` from them (write `regex:<pattern>` for a pattern, e.g. `regex:#[0-9a-fA-F]{6}\b` for any hex colour). Arbiter reads only those files, never the repo. A claim that doesn't hold is refused. `accept` verdicts are never checked: an exception is a deviation by definition.
|
|
@@ -94,9 +129,29 @@ The scan set is the rule's `paths` (directories or files) if it names any, else
|
|
|
94
129
|
|
|
95
130
|
## Hosted board
|
|
96
131
|
|
|
97
|
-
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.
|
|
132
|
+
The hosted board at [arbiter.design](https://arbiter.design) serves a board at a share link and lets people comment, request a change, 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.
|
|
133
|
+
|
|
134
|
+
Two ways to keep the board current without anyone remembering.
|
|
135
|
+
|
|
136
|
+
`npx arbiter publish --auto` is the one that works anywhere. It sets `hosted.auto` in `arbiter.json`, and from then on the board republishes whenever the record changes — after judging, after a screen changes state, after a picture is attached or removed. No GitHub, no CI, no git repository. Queueing decisions doesn't trigger it, since the queue is never published. If a republish fails — offline, service down — the command still succeeds and says the board is behind; the record is already written, and git is what holds it. `--no-auto` turns it off.
|
|
137
|
+
|
|
138
|
+
`npx arbiter publish --on-push` is the GitHub route, and it writes `.github/workflows/arbiter.yml`, which runs `publish` when decisions land on the default branch, and sets the `ARBITER_PUBLISH_TOKEN` repository secret through `gh` if it's signed in (otherwise it prints the one-line instruction). Commit the workflow together with `.arbiter/hosted.json`. Under CI, `publish` only ever updates the board that file names — it refuses to create one, so a repo where the file wasn't committed can't mint orphan boards on every push.
|
|
139
|
+
|
|
140
|
+
## Requests from the board
|
|
141
|
+
|
|
142
|
+
A comment is input; it waits until the owner points at it. **Request change** on the board is different: someone wants something changed, so it gets an answer.
|
|
143
|
+
|
|
144
|
+
1. `npx arbiter pull` turns each one into a request, `R-0001`, in `.arbiter/requests.json` (commit it — everyone sees the same answers). Pulling twice never asks twice. If the person who asked deletes it on the board before the change is made, the next pull takes it off the queue and says so.
|
|
145
|
+
2. The owner answers — in chat with `/arbiter`, or on the **Requests** tab of `arbiter review`:
|
|
146
|
+
- **Apply** — `record R-0001 --as apply`
|
|
147
|
+
- **Apply, but…** — `record R-0001 --as apply --to "keep the tab, make the button red"`: do this instead of what was asked
|
|
148
|
+
- **Decline** — `record R-0001 --as decline --why "…"`: the reason is required, because the requester reads it
|
|
149
|
+
3. Approving changes no code — only the agent can. In chat it makes the change right away; approved from the review page, it's made at the next `/arbiter`. The agent records what it did with `--request R-0001`, and that's what applies it. Only an approved request can be applied; a change the owner hasn't said yes to is refused.
|
|
150
|
+
4. `publish` carries the answers back: the requester sees *Open*, *Approved*, *Applied* — with what actually changed — or *Declined* with the reason, under their request.
|
|
151
|
+
|
|
152
|
+
Nothing is applied without the owner, and the board never writes to git: requests come in through `pull`, answers go out through `publish`. Removing the last decision that applied a request opens the request again, for a fresh answer — the agent never remakes it unasked. A screen or decision with a request waiting on it (open, or approved and not yet made) can't be removed until the request is declined or applied.
|
|
98
153
|
|
|
99
|
-
|
|
154
|
+
Whoever is signed in on the board chooses their own display name, and what they write is theirs, so neither is trusted: names arrive as one line, and the record can't be given a line, an entry or a field by anything it stores.
|
|
100
155
|
|
|
101
156
|
## Candidates
|
|
102
157
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Keeping a board current without GitHub, CI, or even a git repository.
|
|
4
|
+
*
|
|
5
|
+
* `publish --on-push` needs GitHub Actions, which needs GitHub. A git hook would at least need a
|
|
6
|
+
* repository. Plenty of projects have neither — local only, or deployed straight to a server — and
|
|
7
|
+
* for them the board goes stale the moment someone forgets to publish.
|
|
8
|
+
*
|
|
9
|
+
* The board changes when the record changes, so that's the moment to republish: after judging,
|
|
10
|
+
* after a screen changes state, after a picture is attached or removed. `hosted.auto` in
|
|
11
|
+
* arbiter.json turns it on. Nothing watches anything; this runs inside a command the user ran.
|
|
12
|
+
*
|
|
13
|
+
* Still only two things touch the network — publish and pull — and this is publish, switched on
|
|
14
|
+
* deliberately in a committed file where everyone on the project can see it.
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.autoPublishOn = autoPublishOn;
|
|
51
|
+
exports.autoPublish = autoPublish;
|
|
52
|
+
const hosted_1 = require("./hosted");
|
|
53
|
+
const store_1 = require("./store");
|
|
54
|
+
/** Off unless arbiter.json says `hosted.auto` and the project has been published once. */
|
|
55
|
+
function autoPublishOn(cwd) {
|
|
56
|
+
const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(cwd));
|
|
57
|
+
return !!(0, store_1.readConfig)(paths)?.hosted?.auto && !!(0, hosted_1.readLink)(paths);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Republish, if it's on. Returns a line to print, or null. Never throws and never changes an exit
|
|
61
|
+
* code: a board that failed to update is worth a sentence, not a failed command — the record is
|
|
62
|
+
* already written, and git is what actually holds it.
|
|
63
|
+
*/
|
|
64
|
+
async function autoPublish(cwd) {
|
|
65
|
+
if (!autoPublishOn(cwd))
|
|
66
|
+
return null;
|
|
67
|
+
const link = (0, hosted_1.readLink)((0, store_1.resolvePaths)((0, store_1.findRoot)(cwd)));
|
|
68
|
+
const { publish } = await Promise.resolve().then(() => __importStar(require('./commands/publish')));
|
|
69
|
+
try {
|
|
70
|
+
// Always the board this project is already linked to. Falling through to the default host
|
|
71
|
+
// would create a second, empty board somewhere else entirely.
|
|
72
|
+
const r = await publish({ cwd, to: link.url });
|
|
73
|
+
if (r.ok && r.url)
|
|
74
|
+
return `Board updated — ${r.url}`;
|
|
75
|
+
const failed = r.steps.find((s) => s.outcome === 'failed');
|
|
76
|
+
return `Board not updated: ${failed?.note ?? 'publish failed'} — run \`npx arbiter publish\` when you can.`;
|
|
77
|
+
}
|
|
78
|
+
catch (e) {
|
|
79
|
+
return `Board not updated: ${e.message} — run \`npx arbiter publish\` when you can.`;
|
|
80
|
+
}
|
|
81
|
+
}
|
package/dist/commands/export.js
CHANGED
|
@@ -23,7 +23,8 @@ const schema_1 = require("../schema");
|
|
|
23
23
|
const format_1 = require("../format");
|
|
24
24
|
const store_1 = require("../store");
|
|
25
25
|
const STATE_ORDER = ['approved', 'in_review', 'generated', 'rejected', 'superseded'];
|
|
26
|
-
|
|
26
|
+
/** In a designer's words, as the hosted board says them. The record keeps its own (`generated`, `superseded`). */
|
|
27
|
+
const STATE_LABEL = { approved: 'Approved', in_review: 'In review', generated: 'Draft', rejected: 'Rejected', superseded: 'Replaced' };
|
|
27
28
|
function exportBoard(opts = {}) {
|
|
28
29
|
const root = (0, store_1.findRoot)(opts.cwd);
|
|
29
30
|
const paths = (0, store_1.resolvePaths)(root);
|
|
@@ -90,6 +91,7 @@ function page(d) {
|
|
|
90
91
|
h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 44px 0 14px; }
|
|
91
92
|
.cand { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 24px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; margin-bottom: 14px; }
|
|
92
93
|
.cand.lesser { grid-template-columns: 220px minmax(0,1fr); padding: 16px 20px; opacity: .85; }
|
|
94
|
+
.cand.noshot { grid-template-columns: minmax(0,1fr); }
|
|
93
95
|
@media (max-width: 680px) { .cand, .cand.lesser { grid-template-columns: 1fr; } }
|
|
94
96
|
.shot { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--tag); min-height: 60px; display:flex; align-items:center; justify-content:center; color: var(--muted); font-size: 13px; }
|
|
95
97
|
.shot img { display:block; width:100%; height:auto; }
|
|
@@ -130,14 +132,15 @@ function section(feature, cands, d) {
|
|
|
130
132
|
function card(c, d) {
|
|
131
133
|
const lesser = c.state === 'rejected' || c.state === 'superseded';
|
|
132
134
|
const by = c.supersededBy ? d.byId.get(c.supersededBy) : null;
|
|
133
|
-
const state = c.state === 'superseded' && by ? `
|
|
134
|
-
|
|
135
|
+
const state = c.state === 'superseded' && by ? `Replaced by ${esc(by.name)}` : STATE_LABEL[c.state];
|
|
136
|
+
// No picture, no frame — the card is its words alone, as on the hosted board.
|
|
137
|
+
const shot = c.snapshot ? `<div class="shot"><img src="snapshots/${esc(c.snapshot)}" alt="${esc(c.name)}"></div>` : '';
|
|
135
138
|
const decs = d.decisions(c.id);
|
|
136
139
|
const decisions = decs.length
|
|
137
140
|
? `<div class="decs"><h4>Decided here</h4><ul>${decs.map((x) => `<li>${esc(x.change ?? x.decision)}${x.rejected.length ? `<small>over ${esc(x.rejected.map((r) => r.split(' — ')[0]).join(', '))}</small>` : ''}</li>`).join('')}</ul></div>`
|
|
138
141
|
: '';
|
|
139
|
-
return `<article class="cand${lesser ? ' lesser' : ''}">
|
|
140
|
-
|
|
142
|
+
return `<article class="cand${lesser ? ' lesser' : ''}${shot ? '' : ' noshot'}">
|
|
143
|
+
${shot}
|
|
141
144
|
<div>
|
|
142
145
|
<h3>${esc(c.name)}<span class="state ${c.state}">${state}</span></h3>
|
|
143
146
|
<p class="who">${esc(c.author)} · ${c.date.slice(0, 10)}</p>
|
|
@@ -151,7 +154,7 @@ function rulesSection(rules) {
|
|
|
151
154
|
if (!rules.length)
|
|
152
155
|
return '';
|
|
153
156
|
const groups = schema_1.DIMENSIONS.map((dim) => [dim, rules.filter((r) => r.dimension === dim)]).filter(([, rs]) => rs.length);
|
|
154
|
-
return `<section class="rules"><h2>
|
|
157
|
+
return `<section class="rules"><h2>Design rules · ${rules.length}</h2>${groups
|
|
155
158
|
.map(([dim, rs]) => `<h4>${format_1.DIMENSION_LABELS[dim]}</h4><ul>${rs.map((r) => `<li>${esc(r.decision)}<small>${esc(r.rationale)}</small></li>`).join('')}</ul>`)
|
|
156
159
|
.join('')}</section>`;
|
|
157
160
|
}
|
package/dist/commands/init.js
CHANGED
|
@@ -218,6 +218,10 @@ function installSelf(root) {
|
|
|
218
218
|
return { file: 'package.json', outcome: 'skipped', note: `no package.json here — add ${self.name} as a dev dependency yourself` };
|
|
219
219
|
}
|
|
220
220
|
const host = JSON.parse(node_fs_1.default.readFileSync(hostPkgPath, 'utf8'));
|
|
221
|
+
// Arbiter's own repo, dogfooding: `npx arbiter` already resolves to the package itself.
|
|
222
|
+
if (host.name === self.name) {
|
|
223
|
+
return { file: 'package.json', outcome: 'unchanged', note: `this is ${self.name} itself — not adding it as its own dependency` };
|
|
224
|
+
}
|
|
221
225
|
if (host.devDependencies?.[self.name] || host.dependencies?.[self.name]) {
|
|
222
226
|
return { file: 'package.json', outcome: 'unchanged', note: `${self.name} already a dependency` };
|
|
223
227
|
}
|
package/dist/commands/publish.js
CHANGED
|
@@ -24,6 +24,7 @@ const candidates_1 = require("../candidates");
|
|
|
24
24
|
const destination_1 = require("../destination");
|
|
25
25
|
const store_1 = require("../store");
|
|
26
26
|
const hosted_1 = require("../hosted");
|
|
27
|
+
const pictures_1 = require("../pictures");
|
|
27
28
|
const init_1 = require("./init");
|
|
28
29
|
/** Where `arbiter publish` goes when nothing says otherwise. */
|
|
29
30
|
exports.DEFAULT_HOST = 'https://arbiter.design';
|
|
@@ -44,12 +45,21 @@ async function publish(opts = {}) {
|
|
|
44
45
|
const r = await (0, hosted_1.publishHosted)(paths, to, { admin: opts.admin });
|
|
45
46
|
if (r.created)
|
|
46
47
|
done('project', `created on ${to} — link in .arbiter/hosted.json (commit it); token in .arbiter/hosted.token (git-ignored — teammates set ARBITER_PUBLISH_TOKEN)`);
|
|
47
|
-
|
|
48
|
+
// No image count: a card without a picture shows an icon of its kind, and that's usually right.
|
|
49
|
+
done('board', `${r.candidates} screen${r.candidates === 1 ? '' : 's'} published`);
|
|
48
50
|
for (const s of r.skipped)
|
|
49
51
|
skip('snapshot', s);
|
|
52
|
+
steps.push(...pictureSteps(paths));
|
|
50
53
|
if (opts.onPush)
|
|
51
54
|
for (const s of onPush(root, paths))
|
|
52
55
|
steps.push(s);
|
|
56
|
+
if (opts.auto !== undefined) {
|
|
57
|
+
const config = (0, store_1.readConfig)(paths) ?? { version: 1, destination: 'local' };
|
|
58
|
+
(0, store_1.writeConfig)(paths, { ...config, hosted: { ...config.hosted, auto: opts.auto } });
|
|
59
|
+
done('auto', opts.auto
|
|
60
|
+
? 'on — the board republishes whenever the record changes (arbiter.json, commit it)'
|
|
61
|
+
: 'off — publish by hand from now on');
|
|
62
|
+
}
|
|
53
63
|
return { ok: steps.every((s) => s.outcome !== 'failed'), steps, url: r.link.shareUrl };
|
|
54
64
|
}
|
|
55
65
|
catch (e) {
|
|
@@ -119,6 +129,14 @@ async function publish(opts = {}) {
|
|
|
119
129
|
const ok = steps.every((s) => s.outcome !== 'failed');
|
|
120
130
|
return { ok, steps, url };
|
|
121
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* The last chance to notice before someone opens the board: a line per card that should have a
|
|
134
|
+
* picture and doesn't, with the command. Cards that are right as an icon say nothing. Hosted
|
|
135
|
+
* only: the Pages export has no work cards, so it would be asking for pictures nobody sees.
|
|
136
|
+
*/
|
|
137
|
+
function pictureSteps(paths) {
|
|
138
|
+
return (0, pictures_1.missingPictures)(paths, (0, store_1.readArchive)(paths).filter(hosted_1.publishable)).map((m) => ({ step: 'picture', outcome: 'missing', note: `${m.name}: ${m.command}` }));
|
|
139
|
+
}
|
|
122
140
|
/**
|
|
123
141
|
* Keep the board current without anyone remembering to publish: a workflow that runs `publish`
|
|
124
142
|
* when decisions land on the default branch. The publish token becomes a repository secret —
|
|
@@ -127,6 +145,20 @@ async function publish(opts = {}) {
|
|
|
127
145
|
*/
|
|
128
146
|
function onPush(root, paths) {
|
|
129
147
|
const steps = [];
|
|
148
|
+
// A GitHub Actions file is worthless anywhere but GitHub, and writing one anyway used to report
|
|
149
|
+
// success for automation that could never run. Say what will actually work here instead.
|
|
150
|
+
const inRepo = !!git(root, ['rev-parse', '--is-inside-work-tree']);
|
|
151
|
+
const remote = inRepo ? git(root, ['remote', 'get-url', 'origin']) : null;
|
|
152
|
+
const gh = remote && /github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?$/.exec(remote);
|
|
153
|
+
if (!gh) {
|
|
154
|
+
const why = !inRepo ? 'this project is not a git repository' : !remote ? 'there is no remote named origin' : `${remote.replace(/^.*@/, '')} is not GitHub`;
|
|
155
|
+
steps.push({
|
|
156
|
+
step: 'on-push',
|
|
157
|
+
outcome: 'skipped',
|
|
158
|
+
note: `${why}, and --on-push writes a GitHub Actions workflow. For a board that keeps itself current without GitHub: npx arbiter publish --auto`,
|
|
159
|
+
});
|
|
160
|
+
return steps;
|
|
161
|
+
}
|
|
130
162
|
const branch = git(root, ['rev-parse', '--abbrev-ref', 'HEAD']) || 'main';
|
|
131
163
|
const file = node_path_1.default.join(root, exports.WORKFLOW_FILE);
|
|
132
164
|
const content = workflow(branch, (0, init_1.selfVersion)());
|
|
@@ -142,13 +174,9 @@ function onPush(root, paths) {
|
|
|
142
174
|
steps.push({ step: 'workflow', outcome: 'skipped', note: `${exports.WORKFLOW_FILE} exists and differs — leaving your edits` });
|
|
143
175
|
}
|
|
144
176
|
const token = (0, hosted_1.readToken)(paths);
|
|
145
|
-
const remote = git(root, ['remote', 'get-url', 'origin']);
|
|
146
|
-
const gh = remote && /github\.com[:/]([^/]+)\/([^/]+?)(?:\.git)?$/.exec(remote);
|
|
147
177
|
const manual = `once, on github.com: Settings → Secrets and variables → Actions → New repository secret → ${hosted_1.TOKEN_ENV} = the contents of .arbiter/hosted.token`;
|
|
148
178
|
if (!token)
|
|
149
179
|
steps.push({ step: 'secret', outcome: 'skipped', note: `no publish token here — ${manual}` });
|
|
150
|
-
else if (!gh)
|
|
151
|
-
steps.push({ step: 'secret', outcome: 'skipped', note: `no GitHub remote named origin — ${manual}` });
|
|
152
180
|
else if (!has('gh') || !ghOk(root))
|
|
153
181
|
steps.push({ step: 'secret', outcome: 'skipped', note: `gh not ${has('gh') ? 'signed in' : 'installed'} — ${manual}` });
|
|
154
182
|
else {
|
package/dist/commands/pull.js
CHANGED
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* `arbiter pull` — bring comments and "looks good" reactions down from the hosted board. A
|
|
4
|
+
* "Request change" becomes a request (R-0001) waiting on the owner's answer.
|
|
5
|
+
*/
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
exports.pull = pull;
|
|
5
8
|
const candidates_1 = require("../candidates");
|
|
6
9
|
const hosted_1 = require("../hosted");
|
|
10
|
+
const requests_1 = require("../requests");
|
|
7
11
|
const store_1 = require("../store");
|
|
8
12
|
async function pull(opts = {}) {
|
|
9
13
|
const paths = (0, store_1.resolvePaths)((0, store_1.findRoot)(opts.cwd));
|
|
10
|
-
const { link, fresh, total } = await (0, hosted_1.pullHosted)(paths);
|
|
14
|
+
const { link, fresh, current, total } = await (0, hosted_1.pullHosted)(paths);
|
|
15
|
+
// Withdrawn first: a request deleted on the board leaves the queue before anything new arrives.
|
|
16
|
+
const withdrawn = (0, requests_1.dropWithdrawn)(paths, new Set(current.filter((c) => c.kind === 'request').map((c) => c.id)));
|
|
17
|
+
// Every request on the board, not only the fresh ones: one pulled by an older Arbiter still counts.
|
|
18
|
+
const opened = new Map((0, requests_1.openRequests)(paths, current).map((r) => [r.comment, r.id]));
|
|
19
|
+
const waiting = (0, requests_1.readRequests)(paths).filter((r) => r.status === 'open').length;
|
|
20
|
+
const toAnswer = `${waiting} request${waiting === 1 ? '' : 's'} to answer — /arbiter in chat, or npx arbiter review.`;
|
|
21
|
+
const gone = withdrawn.map((r) => `${r.author} withdrew ${r.id} on the board, so it's off your queue: ${(0, requests_1.oneLine)(r.body)}`);
|
|
11
22
|
if (!fresh.length)
|
|
12
|
-
return `Nothing new on ${link.shareUrl} (${total} comment${total === 1 ? '' : 's'} so far)
|
|
23
|
+
return [`Nothing new on ${link.shareUrl} (${total} comment${total === 1 ? '' : 's'} so far).`, ...gone, ...(waiting ? [toAnswer] : [])].join('\n');
|
|
13
24
|
const names = new Map((0, candidates_1.readCandidates)(paths).map((c) => [c.id, c.name]));
|
|
14
25
|
const lines = [`${fresh.length} new from ${link.shareUrl}:`, ''];
|
|
15
26
|
const byCand = new Map();
|
|
@@ -19,9 +30,19 @@ async function pull(opts = {}) {
|
|
|
19
30
|
lines.push(` ${cid} ${names.get(cid) ?? (cid.startsWith('W-') ? cid.slice(2).replace(/-/g, ' ').replace(/^\w/, (ch) => ch.toUpperCase()) : '')}`);
|
|
20
31
|
for (const c of cs) {
|
|
21
32
|
const stale = c.board_version && link.boardVersion && c.board_version !== link.boardVersion ? ' (earlier version)' : '';
|
|
22
|
-
|
|
33
|
+
const on = c.decision_id ? ` on ${c.decision_id}` : '';
|
|
34
|
+
if (c.kind === 'approve')
|
|
35
|
+
lines.push(` ✓ ${c.author_name} — looks good${stale}`);
|
|
36
|
+
else if (c.kind === 'request')
|
|
37
|
+
lines.push(` ${c.author_name} requests a change${on}: ${c.body}${stale}${opened.has(c.id) ? ` → ${opened.get(c.id)}` : ''}`);
|
|
38
|
+
else
|
|
39
|
+
lines.push(` ${c.author_name}${on}: ${c.body}${stale}`);
|
|
23
40
|
}
|
|
24
41
|
}
|
|
25
42
|
lines.push('', 'Saved to .arbiter/comments.json — npx arbiter review shows them beside each screen. Say "record Sam\'s comment as a rule" in a session to act on one.');
|
|
43
|
+
if (gone.length)
|
|
44
|
+
lines.push(...gone);
|
|
45
|
+
if (waiting)
|
|
46
|
+
lines.push(toAnswer);
|
|
26
47
|
return lines.join('\n');
|
|
27
48
|
}
|