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/templates/review.html
CHANGED
|
@@ -59,6 +59,7 @@
|
|
|
59
59
|
.group { display: flex; align-items: baseline; gap: 10px; margin: 32px 0 10px; }
|
|
60
60
|
.group h2 { margin: 0; text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); }
|
|
61
61
|
.group span { color: var(--muted); font-size: 13px; }
|
|
62
|
+
.group .nopic { color: var(--warn); cursor: help; }
|
|
62
63
|
.polish { background: var(--card); border: 1px dashed var(--line); border-radius: 12px; padding: 12px 20px; margin-bottom: 12px; }
|
|
63
64
|
.polish .row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
|
|
64
65
|
.polish .row .n { color: var(--muted); flex: 1; }
|
|
@@ -123,6 +124,12 @@
|
|
|
123
124
|
.comments { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 10px; font-size: 14px; }
|
|
124
125
|
.comments .ok { color: var(--ok); }
|
|
125
126
|
.comments p { margin: 4px 0; } .comments b { font-weight: 500; }
|
|
127
|
+
/* requests */
|
|
128
|
+
.card .asker { margin: 0 0 4px; color: var(--muted); font-size: 13px; }
|
|
129
|
+
.card h3.ask { font-weight: 500; white-space: pre-line; }
|
|
130
|
+
.card.approved { border-style: dashed; }
|
|
131
|
+
.card.approved h3.ask { color: var(--muted); }
|
|
132
|
+
code { font: 13px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: var(--tag); padding: 1px 5px; border-radius: 4px; }
|
|
126
133
|
#lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: none; align-items: center; justify-content: center; cursor: zoom-out; z-index: 10; padding: 24px; }
|
|
127
134
|
#lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; }
|
|
128
135
|
footer {
|
|
@@ -146,13 +153,17 @@
|
|
|
146
153
|
<script>
|
|
147
154
|
const DIMS = ['structure','interaction','states','content','visual','motion','access'];
|
|
148
155
|
const LABEL = { structure:'Structure', interaction:'Interaction', states:'States', content:'Content', visual:'Visual', motion:'Motion', access:'Accessibility' };
|
|
149
|
-
const STATE_LABEL = { generated:'
|
|
156
|
+
const STATE_LABEL = { generated:'Draft', in_review:'In review', approved:'Approved', rejected:'Rejected', superseded:'Replaced' };
|
|
150
157
|
const results = {}; // pending id -> {item, kind, text}
|
|
151
158
|
let state = null;
|
|
152
159
|
let tab = 'decisions';
|
|
153
160
|
|
|
161
|
+
let first = true;
|
|
154
162
|
async function load() {
|
|
155
163
|
state = await (await fetch('/api/state')).json();
|
|
164
|
+
// Someone is waiting on an answer: open there.
|
|
165
|
+
if (first && state.requests.some(r => r.status === 'open')) tab = 'requests';
|
|
166
|
+
first = false;
|
|
156
167
|
render();
|
|
157
168
|
}
|
|
158
169
|
|
|
@@ -161,11 +172,13 @@ function render() {
|
|
|
161
172
|
document.getElementById('count').textContent = `${state.active} of ${state.cap} rules`;
|
|
162
173
|
const nav = document.getElementById('nav');
|
|
163
174
|
nav.innerHTML = '';
|
|
175
|
+
const asks = state.requests.filter(r => r.status === 'open').length;
|
|
176
|
+
if (state.requests.length || Object.keys(answered).length) nav.appendChild(tabBtn('requests', `Requests · ${asks}`));
|
|
164
177
|
nav.appendChild(tabBtn('decisions', `Decisions · ${state.pending.length}`));
|
|
165
178
|
nav.appendChild(tabBtn('candidates', `Candidates · ${state.candidates.length}`));
|
|
166
179
|
const main = document.getElementById('main');
|
|
167
180
|
main.innerHTML = '';
|
|
168
|
-
(
|
|
181
|
+
({ requests: renderRequests, decisions: renderDecisions, candidates: renderCandidates })[tab](main);
|
|
169
182
|
}
|
|
170
183
|
|
|
171
184
|
function tabBtn(id, label) {
|
|
@@ -223,6 +236,9 @@ function renderDecisions(main) {
|
|
|
223
236
|
head.appendChild(el('h2', null, g.trigger));
|
|
224
237
|
const n = items.filter(d => !results[d.id]).length;
|
|
225
238
|
head.appendChild(el('span', null, `${n} decision${n === 1 ? '' : 's'}${polish.length ? ` · +${polish.length} polish` : ''}`));
|
|
239
|
+
// The board shows an icon where a picture is missing, so this is the place to notice.
|
|
240
|
+
const pics = [...new Map(items.filter(d => !results[d.id] && d.picture).map(d => [d.picture.command, d.picture])).values()];
|
|
241
|
+
if (pics.length) { const p = el('span', 'nopic', '· No picture'); p.title = 'Take one while the screen is open:\n' + pics.map(m => m.command).join('\n'); head.appendChild(p); }
|
|
226
242
|
main.appendChild(head);
|
|
227
243
|
for (const d of items) main.appendChild(results[d.id] ? doneCard(d) : card(d));
|
|
228
244
|
for (const d of g.polish.filter(d => promoted[d.id])) main.appendChild(results[d.id] ? doneCard(d) : card(d));
|
|
@@ -391,6 +407,100 @@ function doneCard(d) {
|
|
|
391
407
|
return c;
|
|
392
408
|
}
|
|
393
409
|
|
|
410
|
+
/* ── requests tab ────────────────────────────────────────────────────── */
|
|
411
|
+
const answered = {}; // request id -> {item, text} once declined here
|
|
412
|
+
|
|
413
|
+
function renderRequests(main) {
|
|
414
|
+
const open = state.requests.filter(r => r.status === 'open');
|
|
415
|
+
const approved = state.requests.filter(r => r.status === 'approved');
|
|
416
|
+
const declined = Object.values(answered);
|
|
417
|
+
if (!open.length && !approved.length && !declined.length) {
|
|
418
|
+
main.innerHTML = '<div class="empty"><h2>No requests.</h2><p>When someone presses Request change on the board, it lands here after <code>npx arbiter pull</code>.</p></div>';
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if (open.length || declined.length) {
|
|
422
|
+
main.appendChild(el('h2', null, 'To answer'));
|
|
423
|
+
for (const r of open) main.appendChild(requestCard(r));
|
|
424
|
+
for (const a of declined) {
|
|
425
|
+
const c = el('div', 'card done'); const row = el('div', 'result');
|
|
426
|
+
row.appendChild(el('span', 'skip', '—')); row.appendChild(el('span', null, a.item.body)); row.appendChild(el('span', 'meta', a.text));
|
|
427
|
+
c.appendChild(row); main.appendChild(c);
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
if (approved.length) {
|
|
431
|
+
main.appendChild(el('h2', null, 'Approved — the agent makes these at your next /arbiter'));
|
|
432
|
+
for (const r of approved) main.appendChild(requestCard(r));
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function requestCard(r) {
|
|
437
|
+
const c = el('div', 'card' + (r.status === 'approved' ? ' approved' : '')); c.dataset.id = r.id;
|
|
438
|
+
const split = el('div', 'split');
|
|
439
|
+
const body = el('div', 'body');
|
|
440
|
+
body.appendChild(el('p', 'asker', `${r.author} asks`));
|
|
441
|
+
body.appendChild(el('h3', 'ask', r.body));
|
|
442
|
+
const meta = el('div', 'meta');
|
|
443
|
+
meta.appendChild(el('span', null, r.screenName ? `on ${r.screenName}` : `on ${r.screen}`));
|
|
444
|
+
if (r.decision) meta.appendChild(el('span', null, `· about ${r.decision}`));
|
|
445
|
+
meta.appendChild(el('span', null, '· ' + r.date.slice(0, 10)));
|
|
446
|
+
if (r.earlierVersion) { const s = el('span', null, '· earlier version'); s.title = 'Asked about a version of the board that has since been republished'; meta.appendChild(s); }
|
|
447
|
+
meta.appendChild(el('span', null, '· ' + r.id));
|
|
448
|
+
body.appendChild(meta);
|
|
449
|
+
if (r.status === 'approved') {
|
|
450
|
+
const dl = el('dl', 'lines');
|
|
451
|
+
dl.appendChild(el('dt', null, 'Doing')); dl.appendChild(el('dd', null, r.instead ? r.instead : 'As asked'));
|
|
452
|
+
body.appendChild(dl);
|
|
453
|
+
} else {
|
|
454
|
+
const a = el('div', 'actions');
|
|
455
|
+
a.appendChild(btn('Apply', 'primary', () => sendRequest(r, c, { as: 'apply' })));
|
|
456
|
+
a.appendChild(btn('Apply, but…', null, () => insteadPanel(r, c)));
|
|
457
|
+
a.appendChild(btn('Decline', 'quiet', () => declinePanel(r, c)));
|
|
458
|
+
body.appendChild(a);
|
|
459
|
+
}
|
|
460
|
+
split.appendChild(body);
|
|
461
|
+
if (r.snapshotUrl) {
|
|
462
|
+
const t = el('div', 'thumb'); t.onclick = () => zoom(r.snapshotUrl);
|
|
463
|
+
const img = el('img'); img.src = r.snapshotUrl; img.alt = r.screenName || r.screen; t.appendChild(img);
|
|
464
|
+
t.appendChild(el('div', 'cap', r.screenName || r.screen));
|
|
465
|
+
split.appendChild(t);
|
|
466
|
+
}
|
|
467
|
+
c.appendChild(split);
|
|
468
|
+
return c;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
function insteadPanel(r, c) {
|
|
472
|
+
clearPanel(c);
|
|
473
|
+
const p = el('div', 'panel');
|
|
474
|
+
p.appendChild(el('p', null, `What should happen instead? ${r.author} sees what was actually done.`));
|
|
475
|
+
const ta = el('textarea'); ta.placeholder = 'e.g. keep it where it is, make the button red'; p.appendChild(ta);
|
|
476
|
+
const row = el('div', 'actions');
|
|
477
|
+
row.appendChild(btn('Apply this instead', 'primary', () => { if (ta.value.trim()) sendRequest(r, c, { as: 'apply', to: ta.value.trim() }); }));
|
|
478
|
+
row.appendChild(btn('Cancel', 'quiet', () => clearPanel(c)));
|
|
479
|
+
p.appendChild(row);
|
|
480
|
+
c.appendChild(p); ta.focus();
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
function declinePanel(r, c) {
|
|
484
|
+
clearPanel(c);
|
|
485
|
+
const p = el('div', 'panel');
|
|
486
|
+
p.appendChild(el('p', null, `Why not? ${r.author} reads this on the board.`));
|
|
487
|
+
const ta = el('textarea'); ta.placeholder = 'One line'; p.appendChild(ta);
|
|
488
|
+
const row = el('div', 'actions');
|
|
489
|
+
row.appendChild(btn('Decline', 'primary', () => { if (ta.value.trim()) sendRequest(r, c, { as: 'decline', why: ta.value.trim() }); else ta.focus(); }));
|
|
490
|
+
row.appendChild(btn('Cancel', 'quiet', () => clearPanel(c)));
|
|
491
|
+
p.appendChild(row);
|
|
492
|
+
c.appendChild(p); ta.focus();
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
async function sendRequest(r, c, body) {
|
|
496
|
+
c.querySelectorAll('button').forEach(b => b.disabled = true);
|
|
497
|
+
const res = await (await fetch('/api/request', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ id: r.id, ...body }) })).json();
|
|
498
|
+
c.querySelectorAll('button').forEach(b => b.disabled = false);
|
|
499
|
+
if (res.exitCode !== 0) return messagePanel(c, (res.errors || ['Something went wrong']).join(' · '), 'bad');
|
|
500
|
+
if (res.status === 'declined') answered[r.id] = { item: r, text: `Declined — ${res.reason}` };
|
|
501
|
+
await load();
|
|
502
|
+
}
|
|
503
|
+
|
|
394
504
|
/* ── candidates tab ──────────────────────────────────────────────────── */
|
|
395
505
|
function renderCandidates(main) {
|
|
396
506
|
const all = state.candidates;
|
|
@@ -442,7 +552,7 @@ function candCard(c) {
|
|
|
442
552
|
grid.appendChild(body);
|
|
443
553
|
const shot = el('div', 'shot');
|
|
444
554
|
if (c.snapshotUrl) { const img = el('img'); img.src = c.snapshotUrl; img.alt = c.name; shot.appendChild(img); shot.onclick = () => zoom(c.snapshotUrl); }
|
|
445
|
-
else { shot.textContent = 'No
|
|
555
|
+
else { shot.textContent = 'No picture'; shot.style.cursor = 'default'; shot.title = `npx arbiter candidate ${c.id} --snapshot shot.png`; }
|
|
446
556
|
grid.appendChild(shot);
|
|
447
557
|
card.appendChild(grid);
|
|
448
558
|
return card;
|
|
@@ -469,7 +579,7 @@ async function sendCand(card, c, body) {
|
|
|
469
579
|
}
|
|
470
580
|
|
|
471
581
|
document.getElementById('done').onclick = async () => {
|
|
472
|
-
await fetch('/api/done', { method: 'POST' });
|
|
582
|
+
await fetch('/api/done', { method: 'POST', headers: { 'content-type': 'application/json' }, body: '{}' });
|
|
473
583
|
document.body.innerHTML = '<div class="empty"><h2>Review closed.</h2><p>You can close this tab.</p></div>';
|
|
474
584
|
};
|
|
475
585
|
|