@bugb-technologies/bravos 1.9.2 → 1.9.3
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/dist/review.js +3 -1
- package/docs/UPGRADING.md +5 -0
- package/package.json +1 -1
- package/templates/review/review.html +60 -4
package/dist/review.js
CHANGED
|
@@ -243,7 +243,9 @@ function effective(q, a) {
|
|
|
243
243
|
return 'no';
|
|
244
244
|
const legacy = a.verdict === 'choice' ? a.choice : a.verdict === 'change' ? a.text : undefined;
|
|
245
245
|
const asIs = a.verdict === 'accepted' || a.verdict === 'agree' ? (q.suggested ?? 'agree') : undefined;
|
|
246
|
-
|
|
246
|
+
// An answer in the reviewer's own words (a choice or multi question none of whose options fit) is carried as text.
|
|
247
|
+
const own = a.verdict === 'edited' && a.value === undefined && a.text ? `own answer: "${a.text}"` : undefined;
|
|
248
|
+
const v = a.value ?? legacy ?? asIs ?? own ?? a.verdict;
|
|
247
249
|
return Array.isArray(v) ? [...v].sort().join(', ') : String(v);
|
|
248
250
|
}
|
|
249
251
|
// @comment -- "Plain-text summary for the agent, most important first: disagreements, edits and rejections, the must-touch decisions with who made them, unanswered questions, then one line per group of suggestions accepted as is, with names; no model involved."
|
package/docs/UPGRADING.md
CHANGED
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
After `npm install -g @bugb-technologies/bravos`, run **`bravos setup`** in a repository you work in: it brings this machine and that repository up to date. In repositories you work in with an agent you can skip even that: the agent runs it at the start of a session. The notes below say what else changes, newest first. (Before 1.9 the same was `bravos setup --tools -y` per machine and `bravos sync` per repository; both still work.)
|
|
4
4
|
|
|
5
|
+
## 1.9.3
|
|
6
|
+
|
|
7
|
+
- **Answer in your own words on the context page.** A question with set options (for example "What should bravos rate this against?") now has **✎ My own answer**. Your text is the decision, and the agent receives it as written. Before, typing into the comment box was the only option, and it did not count, so Confirm stayed off.
|
|
8
|
+
- **Done is honest.** Pressing Done before Confirm says what is still open instead of closing as if your answers had been saved.
|
|
9
|
+
|
|
5
10
|
## 1.9.2
|
|
6
11
|
|
|
7
12
|
- **Joining a repository shows its setup.** In a repository that already has Bravos, `bravos setup` lists what it is set up with (agents, pull-request checks, autopilot, schedule, testing) and asks whether to keep it or change it. Keep is the default and changes nothing; Change asks the repository's questions with what is there selected.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bugb-technologies/bravos",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"description": "Skills pack and installer that make Claude Code and Codex power users of guardlink (threat-model-as-code) and cert-x-gen (pentest-as-code).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"security",
|
|
@@ -231,10 +231,13 @@ textarea.comment { min-height: 37px; }
|
|
|
231
231
|
state[q.id] = { verdict: has ? 'accepted' : null, value: Array.isArray(initial) ? [...initial] : initial, touched: false, comment: '' };
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
|
|
234
|
+
// A decision is made by picking an option, or by writing an answer of one's own (s.own, choice and multi questions); an own answer left empty is not one yet.
|
|
235
|
+
const needsCall = (q) => q.mustTouch && (!state[q.id].touched || (state[q.id].own !== undefined && !state[q.id].own.trim()));
|
|
235
236
|
const decide = (q, value, explicit, editInPlace = false) => {
|
|
236
237
|
const s = state[q.id];
|
|
237
238
|
s.value = value;
|
|
239
|
+
// Picking an option replaces an answer written in one's own words.
|
|
240
|
+
if (value !== null) delete s.own;
|
|
238
241
|
s.touched = s.touched || explicit;
|
|
239
242
|
if (q.type === 'item' && value === 'no') s.verdict = 'no';
|
|
240
243
|
else if (q.suggested !== undefined && sameValue(value, q.suggested)) s.verdict = q.mustTouch ? (s.touched ? 'chosen' : 'accepted') : 'accepted';
|
|
@@ -254,6 +257,22 @@ textarea.comment { min-height: 37px; }
|
|
|
254
257
|
refresh();
|
|
255
258
|
};
|
|
256
259
|
|
|
260
|
+
// @comment -- "An answer in the reviewer's own words, for a choice or multi question whose options all miss: it is the decision (verdict edited, the text sent as `text`), so a must-touch question no longer stays red when none of bravos's options fits."
|
|
261
|
+
const decideOwn = (q, text, editInPlace = false) => {
|
|
262
|
+
const s = state[q.id];
|
|
263
|
+
s.own = text;
|
|
264
|
+
s.value = null;
|
|
265
|
+
s.touched = true;
|
|
266
|
+
s.verdict = text.trim() ? 'edited' : null;
|
|
267
|
+
if (editInPlace) {
|
|
268
|
+
const card = cards[q.id];
|
|
269
|
+
card.replaceChild(badges(q), card.firstElementChild);
|
|
270
|
+
const keep = card.querySelector('.keep');
|
|
271
|
+
if (keep && !needsCall(q)) keep.remove();
|
|
272
|
+
} else render(q);
|
|
273
|
+
refresh();
|
|
274
|
+
};
|
|
275
|
+
|
|
257
276
|
const stateLabels = {
|
|
258
277
|
pending: 'Needs your call', reviewed: 'Reviewed', suggested: 'Suggested', optional: 'Optional',
|
|
259
278
|
};
|
|
@@ -410,8 +429,28 @@ textarea.comment { min-height: 37px; }
|
|
|
410
429
|
button.addEventListener('click', fn);
|
|
411
430
|
row.append(button);
|
|
412
431
|
};
|
|
432
|
+
const own = () => {
|
|
433
|
+
btn('✎ My own answer', s.own !== undefined, () => {
|
|
434
|
+
decideOwn(q, s.own ?? '');
|
|
435
|
+
const box = cards[q.id].querySelector('textarea.own');
|
|
436
|
+
if (box) box.focus();
|
|
437
|
+
});
|
|
438
|
+
};
|
|
439
|
+
const ownBox = () => {
|
|
440
|
+
if (s.own === undefined) return;
|
|
441
|
+
const t = el('textarea', 'own');
|
|
442
|
+
t.setAttribute('aria-label', 'Your own answer to ' + (q.title || q.id));
|
|
443
|
+
t.placeholder = 'Your answer, in your own words';
|
|
444
|
+
t.value = s.own;
|
|
445
|
+
t.maxLength = 4000;
|
|
446
|
+
t.addEventListener('input', () => decideOwn(q, t.value, true));
|
|
447
|
+
card.appendChild(row);
|
|
448
|
+
card.appendChild(t);
|
|
449
|
+
};
|
|
413
450
|
if (q.type === 'choice') {
|
|
414
451
|
for (const o of q.options) btn(`${o.id === q.suggested ? '★ ' : ''}${o.label}`, s.value === o.id, () => decide(q, o.id, true));
|
|
452
|
+
own();
|
|
453
|
+
ownBox();
|
|
415
454
|
} else if (q.type === 'multi') {
|
|
416
455
|
for (const o of q.options) {
|
|
417
456
|
const on = Array.isArray(s.value) && s.value.includes(o.id);
|
|
@@ -421,6 +460,8 @@ textarea.comment { min-height: 37px; }
|
|
|
421
460
|
decide(q, q.options.map((x) => x.id).filter((id) => next.has(id)), true);
|
|
422
461
|
});
|
|
423
462
|
}
|
|
463
|
+
own();
|
|
464
|
+
ownBox();
|
|
424
465
|
} else if (q.type === 'item') {
|
|
425
466
|
const isText = typeof s.value === 'string' && s.value !== 'agree' && s.value !== 'no';
|
|
426
467
|
btn('Agree', s.value === 'agree', () => decide(q, 'agree', true));
|
|
@@ -453,7 +494,7 @@ textarea.comment { min-height: 37px; }
|
|
|
453
494
|
}
|
|
454
495
|
const c = el('textarea', 'comment');
|
|
455
496
|
c.setAttribute('aria-label', 'Comment on ' + (q.title || q.id));
|
|
456
|
-
c.placeholder = 'Comment (optional)';
|
|
497
|
+
c.placeholder = q.type === 'choice' || q.type === 'multi' ? 'Comment (optional; to answer differently, choose ✎ My own answer)' : 'Comment (optional)';
|
|
457
498
|
c.maxLength = 4000;
|
|
458
499
|
c.value = s.comment;
|
|
459
500
|
c.addEventListener('input', () => { s.comment = c.value; });
|
|
@@ -509,7 +550,8 @@ textarea.comment { min-height: 37px; }
|
|
|
509
550
|
for (const q of qs) {
|
|
510
551
|
const s = state[q.id];
|
|
511
552
|
if (!s.verdict && !s.comment) continue;
|
|
512
|
-
|
|
553
|
+
const ownText = s.own !== undefined && s.own.trim() ? { text: s.own.trim() } : {};
|
|
554
|
+
answers[q.id] = { verdict: s.verdict || 'comment', ...(s.verdict && s.verdict !== 'accepted' && s.value !== null ? { value: s.value } : {}), ...ownText, ...(s.comment ? { comment: s.comment } : {}) };
|
|
513
555
|
}
|
|
514
556
|
return { schema: 'bravos.review-answers/v1', kind: draft.kind, by, date: new Date().toISOString().slice(0, 10), answers };
|
|
515
557
|
};
|
|
@@ -537,6 +579,9 @@ textarea.comment { min-height: 37px; }
|
|
|
537
579
|
};
|
|
538
580
|
load();
|
|
539
581
|
|
|
582
|
+
// Whether this page saved anyone's answers; Done says so plainly when it did not.
|
|
583
|
+
let saved = false;
|
|
584
|
+
let doneArmed = false;
|
|
540
585
|
$('save').addEventListener('click', async () => {
|
|
541
586
|
const p = payload();
|
|
542
587
|
if (!slug(p.by)) { status('Enter a name containing a letter a–z or a digit to identify your answers file.'); $('who').focus(); return; }
|
|
@@ -546,6 +591,7 @@ textarea.comment { min-height: 37px; }
|
|
|
546
591
|
const r = await api('/answers', p);
|
|
547
592
|
if (r.status === 400) { status(await r.text()); return; }
|
|
548
593
|
if (!r.ok) throw new Error(await r.text());
|
|
594
|
+
saved = true;
|
|
549
595
|
status(`Confirmed and saved to .guardlink/${draft.kind}-answers/${slug(p.by)}.json. Teammates can run bravos review ${draft.kind} and add theirs; click Done when you are finished.`);
|
|
550
596
|
load();
|
|
551
597
|
return;
|
|
@@ -553,6 +599,7 @@ textarea.comment { min-height: 37px; }
|
|
|
553
599
|
const db = await artifactDb();
|
|
554
600
|
if (db) {
|
|
555
601
|
await db.doc(`answers/${slug(p.by)}`).set(p);
|
|
602
|
+
saved = true;
|
|
556
603
|
status('Saved. Everyone with this link sees it; the agent will read it back into the repo.');
|
|
557
604
|
load();
|
|
558
605
|
return;
|
|
@@ -562,9 +609,18 @@ textarea.comment { min-height: 37px; }
|
|
|
562
609
|
status(`Downloaded ${slug(p.by)}.json. Put it in .guardlink/${draft.kind}-answers/ and commit it.`);
|
|
563
610
|
});
|
|
564
611
|
|
|
612
|
+
// @comment -- "Done closes the review. When nothing was confirmed on this page it says so and waits for a second click, because closing then means the agent finds no answers and cannot record any decision. It never claims answers were read when none were saved."
|
|
565
613
|
$('done').addEventListener('click', async () => {
|
|
614
|
+
if (!saved && !doneArmed) {
|
|
615
|
+
const left = qs.filter(needsCall).length;
|
|
616
|
+
doneArmed = true;
|
|
617
|
+
status(`Nothing is saved yet${left ? `: ${left} decision${left === 1 ? '' : 's'} marked "needs your call" ${left === 1 ? 'is' : 'are'} still open` : ''}. ${left ? 'Make ' + (left === 1 ? 'it' : 'them') + ', then ' : ''}press Confirm, then Done. To close without saving anything, press Done again.`);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
566
620
|
if (mode.kind === 'serve') { try { await api('/done', {}); } catch { /* already gone */ } }
|
|
567
|
-
status(
|
|
621
|
+
status(saved
|
|
622
|
+
? 'Thanks. The agent reads everyone\'s answers now; if it does not carry on, tell it "done". You can close this tab.'
|
|
623
|
+
: 'Closed without saving. The agent will find no answers from you; run bravos review ' + draft.kind + ' to answer later.');
|
|
568
624
|
});
|
|
569
625
|
})();
|
|
570
626
|
</script>
|