create-heresay 0.2.15 → 0.2.16

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-heresay",
3
- "version": "0.2.15",
3
+ "version": "0.2.16",
4
4
  "description": "Set up your own Heresay: in-app feedback that every report gets a hearing. Creates a Firebase project in your Google account and deploys the dashboard, API and SDK to it.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/release/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.15
1
+ 0.2.16
@@ -1,3 +1,3 @@
1
1
  /** The Heresay release. Bumped by the release script; the CLI and /v1/health report it. */
2
- export const VERSION = '0.2.15';
2
+ export const VERSION = '0.2.16';
3
3
  //# sourceMappingURL=version.js.map
@@ -144,17 +144,57 @@ a.platform:hover { border-color:var(--acc); box-shadow:0 0 0 3px var(--mist); }
144
144
  .filters button { font:inherit; font-weight:600; border:1px solid var(--line); background:none; color:var(--mute); border-radius:999px; padding:4px 12px; cursor:pointer; }
145
145
  .filters button .n { font-weight:500; }
146
146
  .filters button[aria-pressed=true] { color:var(--deep); border-color:var(--acc); background:var(--mist); }
147
- .report { border:1px solid var(--line); border-radius:14px; padding:16px 18px; margin-bottom:10px; }
147
+ .report { position:relative; border:1px solid var(--line); border-radius:14px; padding:16px 18px 16px 20px; margin-bottom:10px; overflow:hidden;
148
+ transition:border-color .2s, box-shadow .2s, background-color .3s, opacity .3s, height .3s ease, margin .3s ease, padding .3s ease; }
149
+ .report { --strip:var(--line); box-shadow:inset 3px 0 0 var(--strip); }
150
+ .report.t-broken { --strip:var(--broken); } .report.t-confusing { --strip:var(--confusing); }
151
+ .report.t-improvement { --strip:var(--improvement); } .report.t-idea { --strip:var(--idea); }
152
+ .report:hover { border-color:#cfd4da; box-shadow:inset 3px 0 0 var(--strip), 0 1px 3px rgb(21 23 28 / .06); }
153
+ .report.working { background:var(--soft); }
154
+ .report.settled { border-color:var(--acc); background:var(--mist); box-shadow:inset 3px 0 0 var(--strip), 0 0 0 3px var(--mist); }
155
+ .report.leaving { opacity:0; margin-bottom:0; padding-top:0; padding-bottom:0; border-width:0; }
148
156
  .report .meta { display:flex; gap:10px; align-items:center; font-size:13px; color:var(--mute); flex-wrap:wrap; }
149
157
  .pill { font-weight:700; font-size:12px; letter-spacing:.02em; }
158
+ .report .pill:first-child { padding:1px 9px; border-radius:999px; background:var(--soft); }
150
159
  .pill.broken { color:var(--broken); } .pill.confusing { color:var(--confusing); }
151
160
  .pill.improvement { color:var(--improvement); } .pill.idea { color:var(--idea); }
152
- .status { margin-left:auto; font-weight:600; }
161
+ .report .pill.broken { background:#fbeceb; } .report .pill.confusing { background:#fbf1e3; }
162
+ .report .pill.improvement { background:#eaf0fa; } .report .pill.idea { background:#f1edf9; }
163
+ .status { margin-left:auto; font-weight:600; font-size:12px; padding:1px 9px; border-radius:999px; background:var(--soft); transition:background-color .3s, color .3s; }
164
+ .s-open { color:var(--fg); }
153
165
  .s-accepted { color:var(--deep); }
166
+ .status.s-accepted { background:var(--mist); }
167
+ .status.s-fixed { color:#fff; background:var(--acc); }
168
+ .status.s-declined { color:var(--mute); }
154
169
  .report .text { margin:8px 0 6px; white-space:pre-wrap; word-break:break-word; font-size:16px; }
155
170
  .ctx { font-size:13px; color:var(--mute); }
156
171
  .actions { display:flex; gap:8px; margin-top:12px; flex-wrap:wrap; align-items:flex-start; }
157
172
  .actions textarea { flex:1 1 100%; min-height:70px; }
173
+ .done-line { display:flex; align-items:center; gap:8px; font-weight:600; font-size:14px; color:var(--deep); animation:pop-in .25s ease-out; }
174
+ .done-line.s-declined { color:var(--fg); }
175
+ .done-tick, .toast-tick { width:20px; height:20px; flex:none; border-radius:50%; background:var(--acc) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L19 7'/%3E%3C/svg%3E") center/12px no-repeat; }
176
+ .done-line.s-declined .done-tick { background-color:var(--fg); }
177
+ @keyframes pop-in { from { opacity:0; transform:translateY(4px); } }
178
+
179
+ /* a button at work */
180
+ .btn { transition:background-color .15s, border-color .15s, color .15s, transform .1s; }
181
+ .btn:active:not(:disabled) { transform:scale(.97); }
182
+ .btn.busy, .btn.busy:disabled { opacity:1; cursor:progress; }
183
+ .btn.busy::before { content:""; width:14px; height:14px; border-radius:50%; border:2px solid currentColor; border-right-color:transparent; animation:spin .7s linear infinite; }
184
+
185
+ /* toast */
186
+ .toast { position:fixed; left:50%; bottom:24px; z-index:10; display:flex; align-items:center; gap:12px; max-width:calc(100vw - 32px);
187
+ padding:10px 12px 10px 14px; border-radius:12px; background:var(--fg); color:#fff; font-size:14px; font-weight:500;
188
+ box-shadow:0 10px 30px rgb(21 23 28 / .25); transform:translate(-50%, 16px); opacity:0; pointer-events:none; transition:opacity .2s, transform .2s; }
189
+ .toast.on { opacity:1; transform:translate(-50%, 0); pointer-events:auto; }
190
+ .toast button { font:inherit; font-weight:700; color:#7dd3c8; background:none; border:0; padding:4px 6px; border-radius:6px; cursor:pointer; }
191
+ .toast button:hover { background:rgb(255 255 255 / .1); }
192
+ .toast button:focus-visible { outline:2px solid #7dd3c8; }
193
+ @media (prefers-reduced-motion: reduce) {
194
+ .report, .toast, .btn { transition:none; }
195
+ .done-line { animation:none; }
196
+ .btn.busy::before { animation-duration:2s; }
197
+ }
158
198
  .reason { margin-top:8px; font-size:14px; padding:10px 12px; border-radius:10px; background:var(--soft); }
159
199
  .empty { text-align:center; color:var(--mute); padding:40px 0; }
160
200
 
@@ -65,6 +65,33 @@
65
65
  return el('div', { class: 'code' }, [el('pre', { text: text }), copyButton(function () { return text; })]);
66
66
  }
67
67
 
68
+ /** One message at a time, bottom of the screen, with an optional action. Read out by screen readers. */
69
+ var toastBox = null, toastTimer = null;
70
+ function toast(text, action) {
71
+ if (!toastBox) {
72
+ toastBox = el('div', { class: 'toast', role: 'status', 'aria-live': 'polite' });
73
+ document.body.appendChild(toastBox);
74
+ }
75
+ clearTimeout(toastTimer);
76
+ toastBox.textContent = '';
77
+ toastBox.appendChild(el('span', { class: 'toast-tick', 'aria-hidden': 'true' }));
78
+ toastBox.appendChild(el('span', { text: text }));
79
+ if (action) toastBox.appendChild(el('button', { type: 'button', text: action.label, onclick: function () { hideToast(); action.run(); } }));
80
+ toastBox.classList.add('on');
81
+ toastTimer = setTimeout(hideToast, 6000);
82
+ }
83
+ function hideToast() { if (toastBox) toastBox.classList.remove('on'); }
84
+
85
+ /** A button that is working: spinner, a new label, and no second click. */
86
+ function busyButton(b, label) {
87
+ var was = b.textContent;
88
+ b.disabled = true;
89
+ b.classList.add('busy');
90
+ b.setAttribute('aria-busy', 'true');
91
+ b.textContent = label;
92
+ return function () { b.disabled = false; b.classList.remove('busy'); b.removeAttribute('aria-busy'); b.textContent = was; };
93
+ }
94
+
68
95
  function stopTimer() { if (timer) { clearInterval(timer); timer = null; } }
69
96
  function every(ms, fn) {
70
97
  stopTimer();
@@ -1260,14 +1287,7 @@
1260
1287
  });
1261
1288
  }
1262
1289
  var here = reports.filter(function (r) { return where === 'all' || r.project_id === where; });
1263
- filters.textContent = '';
1264
- ['open', 'accepted', 'fixed', 'declined', 'all'].forEach(function (f) {
1265
- var n = f === 'all' ? here.length : here.filter(function (r) { return r.status === f; }).length;
1266
- filters.appendChild(el('button', {
1267
- 'aria-pressed': String(filter === f),
1268
- onclick: function () { filter = f; render(); },
1269
- }, [(f === 'all' ? 'All' : STATUS_LABEL[f]) + ' ', el('span', { class: 'n', text: String(n) })]));
1270
- });
1290
+ drawFilters(here);
1271
1291
  list.textContent = '';
1272
1292
  var shown = here.filter(function (r) { return filter === 'all' || r.status === filter; });
1273
1293
  empty.hidden = shown.length > 0;
@@ -1278,13 +1298,48 @@
1278
1298
  } else empty.textContent = filter === 'open' ? 'Nothing waiting. Every report has had its hearing.' : 'Nothing here.';
1279
1299
  shown.forEach(function (r) {
1280
1300
  var c = ctxs[r.project_id];
1281
- list.appendChild(row(c.project, r, load, c, many));
1301
+ list.appendChild(row(c.project, r, settled, c, many));
1282
1302
  });
1283
1303
  }
1284
1304
 
1305
+ function drawFilters(here) {
1306
+ here = here || reports.filter(function (r) { return where === 'all' || r.project_id === where; });
1307
+ filters.textContent = '';
1308
+ ['open', 'accepted', 'fixed', 'declined', 'all'].forEach(function (f) {
1309
+ var n = f === 'all' ? here.length : here.filter(function (r) { return r.status === f; }).length;
1310
+ filters.appendChild(el('button', {
1311
+ 'aria-pressed': String(filter === f),
1312
+ onclick: function () { filter = f; render(); },
1313
+ }, [(f === 'all' ? 'All' : STATUS_LABEL[f]) + ' ', el('span', { class: 'n', text: String(n) })]));
1314
+ });
1315
+ }
1316
+
1317
+ /**
1318
+ * A report moved. The card says so where the click was, the counts move at once, and only
1319
+ * then does it leave this filter, so nothing vanishes without a word.
1320
+ */
1321
+ function settled(r, card, done) {
1322
+ if (!done) return load(); // someone else got there first: show what they did
1323
+ drawFilters();
1324
+ var to = r.status;
1325
+ toast(DONE_TOAST[to], filter === to || filter === 'all' ? null : {
1326
+ label: 'View ' + STATUS_LABEL[to].toLowerCase(), run: function () { filter = to; render(); window.scrollTo(0, 0); },
1327
+ });
1328
+ card.classList.add('settled');
1329
+ setTimeout(function () {
1330
+ if (!card.isConnected) return;
1331
+ if (filter === 'all' || filter === to) return load(); // it stays in this list
1332
+ card.style.height = card.offsetHeight + 'px';
1333
+ card.getBoundingClientRect();
1334
+ card.classList.add('leaving');
1335
+ card.style.height = '0px';
1336
+ setTimeout(load, 320);
1337
+ }, 2200);
1338
+ }
1339
+
1285
1340
  load();
1286
- // Reports arrive while you read. Don't refresh under someone typing a decline reason.
1287
- every(30000, function () { if (!list.querySelector('textarea')) load(); });
1341
+ // Reports arrive while you read. Don't refresh under someone typing, or a card on its way out.
1342
+ every(30000, function () { if (!list.querySelector('textarea, .report.settled, .report .busy')) load(); });
1288
1343
  }
1289
1344
 
1290
1345
  function ctxLine(c) {
@@ -1313,41 +1368,88 @@
1313
1368
  ]);
1314
1369
  }
1315
1370
 
1316
- function row(p, r, reload, ctx, showPlatform) {
1371
+ var DONE_TOAST = {
1372
+ accepted: 'Accepted. It is waiting for a coding agent.',
1373
+ declined: 'Declined. They will see your reason.',
1374
+ fixed: 'Marked fixed. They will see it in “Your reports”.',
1375
+ };
1376
+ var BUSY_LABEL = { accept: 'Accepting…', decline: 'Declining…', fixed: 'Saving…' };
1377
+
1378
+ function row(p, r, settled, ctx, showPlatform) {
1317
1379
  var brief = ctx.briefs[r.id];
1318
- var err = el('span', { class: 'err' });
1380
+ var err = el('span', { class: 'err', role: 'alert' });
1319
1381
  var actions = el('div', { class: 'actions' });
1320
- var act = function (action, body) {
1382
+ var card, sentTo = null;
1383
+ var act = function (action, body, b) {
1384
+ if (action === 'accept') sentTo = (body && body.repo) || ctx.repos[0] || null;
1321
1385
  err.textContent = '';
1386
+ var undo = busyButton(b, BUSY_LABEL[action]);
1387
+ actions.querySelectorAll('button, select, textarea').forEach(function (c) { if (c !== b) c.disabled = true; });
1388
+ card.classList.add('working');
1322
1389
  return api('POST', '/projects/' + p.id + '/reports/' + r.id + '/' + action, body)
1323
- .then(reload)
1324
- .catch(function (x) { err.textContent = x.message; if (x.status === 409) reload(); });
1390
+ .then(function (x) {
1391
+ Object.assign(r, x.report || {});
1392
+ card.classList.remove('working');
1393
+ showDone();
1394
+ settled(r, card, true);
1395
+ })
1396
+ .catch(function (x) {
1397
+ undo();
1398
+ card.classList.remove('working');
1399
+ actions.querySelectorAll('button, select, textarea').forEach(function (c) { c.disabled = false; });
1400
+ err.textContent = x.message;
1401
+ if (x.status === 409) settled(r, card, false);
1402
+ });
1325
1403
  };
1326
1404
 
1405
+ /** In place of the buttons: what just happened, in the colour of the new status. */
1406
+ function showDone() {
1407
+ status.className = 'status s-' + r.status;
1408
+ status.textContent = STATUS_LABEL[r.status];
1409
+ var line = r.status === 'accepted'
1410
+ ? 'Accepted. Waiting for an agent' + (sentTo ? ' in ' + sentTo : '') + '.'
1411
+ : r.status === 'declined' ? 'Declined. They will read your reason.' : 'Marked fixed. They will see it.';
1412
+ actions.textContent = '';
1413
+ actions.appendChild(el('div', { class: 'done-line s-' + r.status }, [
1414
+ el('span', { class: 'done-tick', 'aria-hidden': 'true' }), document.createTextNode(line),
1415
+ ]));
1416
+ }
1417
+
1418
+ function submitOnCmdEnter(area, go) {
1419
+ area.addEventListener('keydown', function (e) { if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) { e.preventDefault(); go.click(); } });
1420
+ }
1421
+
1327
1422
  function buttons() {
1328
1423
  actions.textContent = '';
1329
1424
  if (r.status === 'open') {
1330
1425
  // Several repos hold this app's code: say where the fix goes, defaulting to the first.
1331
1426
  var pick = ctx.repos.length > 1 ? el('select', { 'aria-label': 'Where the fix goes' },
1332
1427
  ctx.repos.map(function (x) { return el('option', { value: x, text: 'Fix in ' + x }); })) : null;
1333
- actions.appendChild(el('button', { class: 'btn primary', text: 'Accept', onclick: function () {
1334
- act('accept', pick ? { repo: pick.value } : undefined);
1428
+ actions.appendChild(el('button', { class: 'btn primary', type: 'button', text: 'Accept', onclick: function (e) {
1429
+ act('accept', pick ? { repo: pick.value } : undefined, e.currentTarget);
1335
1430
  } }));
1336
1431
  if (pick) actions.appendChild(pick);
1337
- actions.appendChild(el('button', { class: 'btn', text: 'Decline…', onclick: declineForm }));
1432
+ actions.appendChild(el('button', { class: 'btn', type: 'button', text: 'Decline…', onclick: declineForm }));
1338
1433
  }
1339
1434
  if (r.status === 'accepted') {
1340
1435
  actions.appendChild(el('button', {
1341
1436
  class: 'btn primary', text: 'Copy prompt for agent',
1437
+ type: 'button',
1342
1438
  onclick: function (e) {
1343
- var b = e.target;
1439
+ var b = e.currentTarget;
1440
+ var undo = busyButton(b, 'Copying…');
1344
1441
  api('GET', '/projects/' + p.id + '/reports/' + r.id + '/prompt')
1345
1442
  .then(function (x) { return navigator.clipboard.writeText(x.prompt); })
1346
- .then(function () { b.textContent = 'Copied'; })
1347
- .catch(function (x) { err.textContent = x.message; });
1443
+ .then(function () {
1444
+ undo();
1445
+ b.textContent = 'Copied ✓';
1446
+ toast('Prompt copied. Paste it into your coding agent.');
1447
+ setTimeout(function () { b.textContent = 'Copy prompt for agent'; }, 2000);
1448
+ })
1449
+ .catch(function (x) { undo(); err.textContent = x.message; });
1348
1450
  },
1349
1451
  }));
1350
- actions.appendChild(el('button', { class: 'btn', text: 'Mark fixed…', onclick: fixedForm }));
1452
+ actions.appendChild(el('button', { class: 'btn', type: 'button', text: 'Mark fixed…', onclick: fixedForm }));
1351
1453
  }
1352
1454
  actions.appendChild(err);
1353
1455
  }
@@ -1355,11 +1457,13 @@
1355
1457
  function fixedForm() {
1356
1458
  actions.textContent = '';
1357
1459
  var note = el('textarea', { placeholder: 'What changed, in their words. The person who sent this will read it. Optional.', 'aria-label': 'Note for the reporter' });
1460
+ var go = el('button', { class: 'btn primary', type: 'button', text: 'Mark fixed', onclick: function (e) {
1461
+ act('fixed', note.value.trim() ? { note: note.value } : undefined, e.currentTarget);
1462
+ } });
1463
+ submitOnCmdEnter(note, go);
1358
1464
  actions.appendChild(note);
1359
- actions.appendChild(el('button', { class: 'btn primary', text: 'Mark fixed', onclick: function () {
1360
- act('fixed', note.value.trim() ? { note: note.value } : undefined);
1361
- } }));
1362
- actions.appendChild(el('button', { class: 'btn ghost', text: 'Cancel', onclick: buttons }));
1465
+ actions.appendChild(go);
1466
+ actions.appendChild(el('button', { class: 'btn ghost', type: 'button', text: 'Cancel', onclick: buttons }));
1363
1467
  actions.appendChild(err);
1364
1468
  note.focus();
1365
1469
  }
@@ -1367,23 +1471,26 @@
1367
1471
  function declineForm() {
1368
1472
  actions.textContent = '';
1369
1473
  var reason = el('textarea', { placeholder: 'Why? The person who sent this will read it.', 'aria-label': 'Reason for declining' });
1370
- actions.appendChild(reason);
1371
- actions.appendChild(el('button', { class: 'btn', text: 'Decline', onclick: function () {
1474
+ var go = el('button', { class: 'btn primary', type: 'button', text: 'Decline', onclick: function (e) {
1372
1475
  if (!reason.value.trim()) { err.textContent = 'Give a reason. They will see it.'; reason.focus(); return; }
1373
- act('decline', { reason: reason.value });
1374
- } }));
1375
- actions.appendChild(el('button', { class: 'btn ghost', text: 'Cancel', onclick: buttons }));
1476
+ act('decline', { reason: reason.value }, e.currentTarget);
1477
+ } });
1478
+ submitOnCmdEnter(reason, go);
1479
+ actions.appendChild(reason);
1480
+ actions.appendChild(go);
1481
+ actions.appendChild(el('button', { class: 'btn ghost', type: 'button', text: 'Cancel', onclick: buttons }));
1376
1482
  actions.appendChild(err);
1377
1483
  reason.focus();
1378
1484
  }
1379
1485
  buttons();
1380
1486
 
1381
- return el('article', { class: 'report' }, [
1487
+ var status = el('span', { class: 'status s-' + r.status, text: STATUS_LABEL[r.status] });
1488
+ card = el('article', { class: 'report t-' + r.type }, [
1382
1489
  el('div', { class: 'meta' }, [
1383
1490
  el('span', { class: 'pill ' + r.type, text: TYPE_LABEL[r.type] }),
1384
1491
  showPlatform ? el('span', { class: 'pill platform-pill', text: platformOf(p.platform).label }) : null,
1385
1492
  el('time', { datetime: r.created_at, text: new Date(r.created_at).toLocaleString() }),
1386
- el('span', { class: 'status s-' + r.status, text: STATUS_LABEL[r.status] }),
1493
+ status,
1387
1494
  ]),
1388
1495
  el('p', { class: 'text', text: r.text }),
1389
1496
  el('div', { class: 'ctx', text: ctxLine(r.context) }),
@@ -1398,6 +1505,7 @@
1398
1505
  .concat(brief.notes.map(function (n) { return el('p', {}, [el('span', { class: 'mute', text: n.by.replace(/^agent:/, '') + ' · ' + new Date(n.at).toLocaleString() + ': ' }), n.text]); }))) : null,
1399
1506
  r.status === 'fixed' || r.status === 'declined' ? null : actions,
1400
1507
  ]);
1508
+ return card;
1401
1509
  }
1402
1510
 
1403
1511
  // ---- delete an app ---------------------------------------------------------------------