@giamme/forge 0.17.0 → 0.19.0
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/CHANGELOG.md +57 -0
- package/README.md +1 -0
- package/SKILL.md +32 -5
- package/VERSION +1 -1
- package/docs/artifacts.md +33 -1
- package/docs/commands.md +147 -16
- package/docs/dataset.md +5 -0
- package/docs/decomposed-runs.md +122 -1
- package/docs/development.md +2 -1
- package/docs/forge-ui.md +98 -8
- package/docs/memory.md +27 -4
- package/docs/models.md +8 -0
- package/docs/reviews.md +122 -0
- package/docs/safety.md +8 -0
- package/forge +44 -4
- package/package.json +2 -1
- package/references/dataset.md +39 -1
- package/references/decompose.md +737 -16
- package/references/harnesses.md +18 -3
- package/references/planning.md +43 -14
- package/references/solo.md +2 -1
- package/references/ui.md +56 -6
- package/registry.tsv +8 -3
- package/scripts/forge-artifact.sh +14 -0
- package/scripts/forge-brief.py +217 -0
- package/scripts/forge-compare.py +13 -2
- package/scripts/forge-config.py +176 -9
- package/scripts/forge-contract.py +246 -28
- package/scripts/forge-control.py +200 -15
- package/scripts/forge-dispatch.sh +48 -15
- package/scripts/forge-du.py +167 -0
- package/scripts/forge-group.py +496 -0
- package/scripts/forge-groups.py +89 -0
- package/scripts/forge-handoff.py +1128 -0
- package/scripts/forge-lib-adopt.sh +1 -0
- package/scripts/forge-lib-group.sh +641 -0
- package/scripts/forge-lib-plans.sh +343 -4
- package/scripts/forge-lib-review.sh +29 -1
- package/scripts/forge-lib-task.sh +197 -4
- package/scripts/forge-memory.sh +245 -3
- package/scripts/forge-metrics.sh +7 -3
- package/scripts/forge-parallel-options.sh +4 -0
- package/scripts/forge-parallel.sh +1216 -41
- package/scripts/forge-planner.py +104 -8
- package/scripts/forge-prompt.py +120 -0
- package/scripts/forge-retro.py +115 -0
- package/scripts/forge-route.py +190 -12
- package/scripts/forge-runs-compact.py +443 -0
- package/scripts/forge-runs-rm.py +2 -0
- package/scripts/forge-runs.py +27 -8
- package/scripts/forge-schedule.py +633 -49
- package/scripts/forge-shadow.py +7 -1
- package/scripts/forge-solo.sh +4 -0
- package/scripts/forge-summarize.py +698 -0
- package/scripts/forge-ui-options.sh +10 -0
- package/scripts/forge-worktrees.py +243 -0
- package/scripts/forge_brief/__init__.py +831 -0
- package/scripts/forge_brief/answers.py +506 -0
- package/scripts/forge_brief/proposals.py +1630 -0
- package/scripts/forge_dataset/__init__.py +10 -0
- package/scripts/forge_dataset/efforts.py +4 -3
- package/scripts/forge_dataset/export.py +36 -10
- package/scripts/forge_dataset/facts.py +8 -4
- package/scripts/forge_dataset/forecast.py +8 -18
- package/scripts/forge_dataset/harvest.py +241 -12
- package/scripts/forge_dataset/history.py +13 -6
- package/scripts/forge_dataset/importer.py +65 -1
- package/scripts/forge_dataset/names.py +66 -0
- package/scripts/forge_dataset/reviewers.py +5 -2
- package/scripts/forge_dataset/risk.py +6 -3
- package/scripts/forge_dataset/routing.py +6 -1
- package/scripts/forge_decide/__init__.py +11 -1
- package/scripts/forge_groups/__init__.py +308 -0
- package/scripts/forge_groups/attribute.py +289 -0
- package/scripts/forge_groups/review.py +286 -0
- package/scripts/forge_locations.py +366 -0
- package/scripts/forge_owner.py +152 -0
- package/scripts/forge_registry.py +19 -0
- package/scripts/forge_retro/__init__.py +417 -0
- package/scripts/forge_retro/issues.py +1193 -0
- package/scripts/forge_retro/report.py +671 -0
- package/scripts/forge_side/__init__.py +482 -0
- package/scripts/forge_storage.py +515 -0
- package/ui/README.md +68 -8
- package/ui/docs/api.md +375 -31
- package/ui/forge_ui/control.py +451 -11
- package/ui/forge_ui/executions.py +8 -1
- package/ui/forge_ui/export.py +53 -7
- package/ui/forge_ui/groups.py +264 -0
- package/ui/forge_ui/links.py +337 -0
- package/ui/forge_ui/models.py +125 -10
- package/ui/forge_ui/projects.py +4 -1
- package/ui/forge_ui/reader.py +919 -45
- package/ui/forge_ui/server.py +4 -0
- package/ui/forge_ui/static/app.js +173 -11
- package/ui/forge_ui/static/briefview.js +605 -0
- package/ui/forge_ui/static/checksview.js +6 -2
- package/ui/forge_ui/static/controls.js +5 -0
- package/ui/forge_ui/static/diffview.js +86 -1
- package/ui/forge_ui/static/groupsview.js +332 -0
- package/ui/forge_ui/static/index.html +4 -0
- package/ui/forge_ui/static/panel.js +394 -8
- package/ui/forge_ui/static/projectsview.js +189 -10
- package/ui/forge_ui/static/runmodel.js +27 -4
- package/ui/forge_ui/static/storageview.js +352 -0
- package/ui/forge_ui/static/style.css +176 -6
- package/ui/forge_ui/static/worktreesview.js +235 -14
- package/ui/forge_ui/storage.py +150 -0
- package/ui/forge_ui/transcripts.py +35 -10
- package/ui/forge_ui/worktrees.py +154 -13
|
@@ -47,6 +47,66 @@
|
|
|
47
47
|
return list(rows).filter(r => (cat === 'all' || r.category === cat) && (st === 'all' || stateFor(r, source).state === st)
|
|
48
48
|
&& (!text || String(r.text || '').toLowerCase().includes(text)));
|
|
49
49
|
}
|
|
50
|
+
// The forget wire key is the learning's own category and key, joined once. A row missing either is not selectable.
|
|
51
|
+
function learningKey(row) {
|
|
52
|
+
if (!row || row.category == null || row.key == null) return '';
|
|
53
|
+
const category = String(row.category), key = String(row.key);
|
|
54
|
+
return category && key ? category + ':' + key : '';
|
|
55
|
+
}
|
|
56
|
+
// Keys to forget, in learning order. `selected` is a Set or array of learning rows or of "category:key" strings.
|
|
57
|
+
function forgetKeys(learnings, selected) {
|
|
58
|
+
const want = selected instanceof Set ? selected : new Set(list(selected));
|
|
59
|
+
const out = [], seen = new Set();
|
|
60
|
+
for (const row of list(learnings)) {
|
|
61
|
+
const key = learningKey(row);
|
|
62
|
+
if (!key || seen.has(key) || (!want.has(row) && !want.has(key))) continue;
|
|
63
|
+
seen.add(key);
|
|
64
|
+
out.push(key);
|
|
65
|
+
}
|
|
66
|
+
return out;
|
|
67
|
+
}
|
|
68
|
+
function forgetData(res) {
|
|
69
|
+
const body = res && res.data && res.data.checkouts ? res.data : res;
|
|
70
|
+
return body && body.checkouts ? body : null;
|
|
71
|
+
}
|
|
72
|
+
// The confirm sentence: the chosen learnings, then the memory.md lines the dry run says go. All of it is text.
|
|
73
|
+
function forgetConfirmText(learnings, keys, res) {
|
|
74
|
+
const byKey = new Map();
|
|
75
|
+
for (const row of list(learnings)) { const key = learningKey(row); if (key && !byKey.has(key)) byKey.set(key, row); }
|
|
76
|
+
const lines = ['Forget these learnings?'];
|
|
77
|
+
for (const key of keys) {
|
|
78
|
+
const row = byKey.get(key), text = row && row.text != null ? String(row.text) : '';
|
|
79
|
+
lines.push(text ? key + ' — ' + text : key);
|
|
80
|
+
}
|
|
81
|
+
const removed = [];
|
|
82
|
+
for (const checkout of list(forgetData(res) && forgetData(res).checkouts)) {
|
|
83
|
+
for (const line of list(checkout && checkout.result && checkout.result.memory_lines_removed)) {
|
|
84
|
+
if (line != null && String(line) !== '') removed.push(String(line));
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
lines.push(removed.length ? 'memory.md lines that go:' : 'No memory.md line goes.');
|
|
88
|
+
return lines.concat(removed).join('\n');
|
|
89
|
+
}
|
|
90
|
+
// One line per key after the real call: how many ledger rows went, or that the key was not found.
|
|
91
|
+
function forgetResultLines(res) {
|
|
92
|
+
const lines = [];
|
|
93
|
+
for (const checkout of list(forgetData(res) && forgetData(res).checkouts)) {
|
|
94
|
+
const result = checkout && checkout.result;
|
|
95
|
+
if (!result) {
|
|
96
|
+
const err = checkout && checkout.error;
|
|
97
|
+
const why = typeof err === 'string' ? err : err && (err.detail || err.error);
|
|
98
|
+
lines.push(why || 'Could not forget in this checkout');
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
for (const item of list(result.keys)) {
|
|
102
|
+
if (!item || item.key == null) continue;
|
|
103
|
+
if (!item.found) { lines.push(String(item.key) + ': not found'); continue; }
|
|
104
|
+
const rows = typeof item.rows === 'number' && Number.isFinite(item.rows) ? item.rows : 0;
|
|
105
|
+
lines.push(String(item.key) + ': ' + rows + (rows === 1 ? ' row' : ' rows') + ' removed');
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
return lines;
|
|
109
|
+
}
|
|
50
110
|
// what the Memories tab says when there is nothing to show
|
|
51
111
|
function memoryEmpty(data) {
|
|
52
112
|
if (!data) return null;
|
|
@@ -74,7 +134,8 @@
|
|
|
74
134
|
const guard = (region, draw) => { if (UI.guard) UI.guard(region, draw); else draw(); };
|
|
75
135
|
const s = { id: ctx.id || null, tab: TABS.includes(ctx.tab) ? ctx.tab : 'runs', list: null, detail: null, findings: null, memories: null,
|
|
76
136
|
ffilter: { severity: 'all', status: 'open', run: '', reviewer: '', path: '', since: 0, shadow: false },
|
|
77
|
-
mfilter: { category: 'all', state: 'all', text: '' }, source: null, checkout: '', error: null, seq: 0, timer: null
|
|
137
|
+
mfilter: { category: 'all', state: 'all', text: '' }, source: null, checkout: '', error: null, seq: 0, timer: null,
|
|
138
|
+
writes: false, picked: new Set(), forgetNote: null, forgetting: false, forgetEpoch: 0, forgetHost: null };
|
|
78
139
|
const tablePrefs = id => ctx.tablePrefs ? ctx.tablePrefs(id) : null, savePrefs = id => p => ctx.saveTablePrefs && ctx.saveTablePrefs(id, p);
|
|
79
140
|
|
|
80
141
|
function table(parent, id, label, columns, rows, extra) {
|
|
@@ -85,11 +146,35 @@
|
|
|
85
146
|
const b = el('button', 'Read again'); b.type = 'button'; b.title = 'Read the run dirs, forge issues, the ledgers and the dataset again now';
|
|
86
147
|
b.addEventListener('click', onClick); return b;
|
|
87
148
|
}
|
|
149
|
+
// confirmInline settles only when its own host answers. A redraw drops that host (another checkout,
|
|
150
|
+
// Read again, leaving the tab), the await never finishes, and `forgetting` stays true, so every later
|
|
151
|
+
// checkbox and the Forget button are drawn disabled. Cancel the strip now and retire the attempt.
|
|
152
|
+
function press(node) {
|
|
153
|
+
if (node && typeof node.click === 'function') node.click();
|
|
154
|
+
}
|
|
155
|
+
function dismissConfirm(host) {
|
|
156
|
+
if (!host) return;
|
|
157
|
+
for (const child of [...(host.children || [])]) {
|
|
158
|
+
if (!child.classList || !child.classList.contains('ui-confirm')) continue;
|
|
159
|
+
for (const button of child.children || []) {
|
|
160
|
+
if (button.tagName === 'BUTTON' && button.textContent === 'Cancel') { press(button); return; }
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function abandonForget() {
|
|
165
|
+
if (!s.forgetting) return;
|
|
166
|
+
const host = s.forgetHost;
|
|
167
|
+
s.forgetting = false;
|
|
168
|
+
s.forgetEpoch += 1;
|
|
169
|
+
s.forgetHost = null;
|
|
170
|
+
dismissConfirm(host);
|
|
171
|
+
}
|
|
88
172
|
const notes = n => el('div', undefined, 'prj-notes muted');
|
|
89
173
|
function fill(node, items) { node.replaceChildren(...list(items).map(t => el('p', String(t)))); }
|
|
90
174
|
|
|
91
175
|
/* the list */
|
|
92
176
|
function drawList() {
|
|
177
|
+
abandonForget();
|
|
93
178
|
const head = el('div', undefined, 'prj-head'), body = el('div', undefined, 'prj-body');
|
|
94
179
|
head.append(el('h1', 'Projects', 'module-title'));
|
|
95
180
|
host.replaceChildren(head, el('p', 'Each repository forge has run in: its runs, every finding its reviews wrote and every memory forge keeps for it, whichever checkout a run started in.', 'muted prj-lede'), body);
|
|
@@ -117,6 +202,7 @@
|
|
|
117
202
|
|
|
118
203
|
/* one project */
|
|
119
204
|
function drawProject() {
|
|
205
|
+
abandonForget();
|
|
120
206
|
const head = el('div', undefined, 'prj-head'), tabs = el('nav', undefined, 'seg prj-tabs'), body = el('div', undefined, 'prj-body');
|
|
121
207
|
tabs.setAttribute('aria-label', 'Project tabs');
|
|
122
208
|
for (const t of TABS) { const a = el('a', t[0].toUpperCase() + t.slice(1)); a.href = routeOf(s.id, t); a.dataset.tab = t; if (t === s.tab) a.setAttribute('aria-current', 'page'); tabs.append(a); }
|
|
@@ -139,7 +225,7 @@
|
|
|
139
225
|
return draw;
|
|
140
226
|
}
|
|
141
227
|
function drawTab(body, note) {
|
|
142
|
-
if (!s.detail) { body.replaceChildren(el('p', s.error ? `Could not read this project (${s.error}).` : 'Reading the project…', s.error ? 'warn' : 'muted')); return; }
|
|
228
|
+
if (!s.detail) { abandonForget(); body.replaceChildren(el('p', s.error ? `Could not read this project (${s.error}).` : 'Reading the project…', s.error ? 'warn' : 'muted')); return; }
|
|
143
229
|
if (s.tab === 'runs') return drawRuns(body, note);
|
|
144
230
|
if (s.tab === 'findings') return drawFindings(body, note);
|
|
145
231
|
return drawMemories(body, note);
|
|
@@ -147,6 +233,7 @@
|
|
|
147
233
|
|
|
148
234
|
/* Runs */
|
|
149
235
|
function drawRuns(body, note) {
|
|
236
|
+
abandonForget();
|
|
150
237
|
fill(note, []);
|
|
151
238
|
const runs = list(s.detail.runs), checkouts = list(s.detail.checkouts);
|
|
152
239
|
const bar = el('div', undefined, 'prj-filters');
|
|
@@ -175,6 +262,7 @@
|
|
|
175
262
|
|
|
176
263
|
/* Findings */
|
|
177
264
|
function drawFindings(body, note) {
|
|
265
|
+
abandonForget();
|
|
178
266
|
const d = s.findings;
|
|
179
267
|
if (!d) { fill(note, []); body.replaceChildren(el('p', s.ferror ? `Could not read the findings (${s.ferror}).` : 'Reading every review of every run… the first read parses each reply, so it can take a few seconds.', s.ferror ? 'warn' : 'muted')); return; }
|
|
180
268
|
fill(note, list(d.notes).concat(d.dataset_runs ? [`${d.dataset_runs} run(s) whose directory is gone are read from the dataset: their findings link to no run page or diff.`] : []));
|
|
@@ -257,6 +345,7 @@
|
|
|
257
345
|
|
|
258
346
|
/* Memories */
|
|
259
347
|
function drawMemories(body, note) {
|
|
348
|
+
abandonForget();
|
|
260
349
|
const d = s.memories;
|
|
261
350
|
if (!d) { fill(note, []); body.replaceChildren(el('p', s.merror ? `Could not read the memories (${s.merror}).` : 'Reading each checkout\'s ledger…', s.merror ? 'warn' : 'muted')); return; }
|
|
262
351
|
fill(note, d.notes);
|
|
@@ -266,7 +355,7 @@
|
|
|
266
355
|
if (sources.length > 1) {
|
|
267
356
|
const l = el('label', undefined, 'fnd-field'), sel = el('select'); sel.dataset.filter = 'source';
|
|
268
357
|
for (const x of sources) { const o = el('option', basename(x.path) + (x.root ? ' (root)' : x.branch ? ` (${x.branch})` : '')); o.value = x.path; sel.append(o); }
|
|
269
|
-
sel.value = s.source || ''; sel.addEventListener('change', () => { s.source = sel.value; drawMemories(body, note); });
|
|
358
|
+
sel.value = s.source || ''; sel.addEventListener('change', () => { s.source = sel.value; s.picked = new Set(); s.forgetNote = null; drawMemories(body, note); });
|
|
270
359
|
l.append(el('span', 'Checkout', 'plate'), sel); bar.append(l);
|
|
271
360
|
}
|
|
272
361
|
bar.append(readAgain(() => loadTab(true)));
|
|
@@ -295,15 +384,93 @@
|
|
|
295
384
|
lsel('state', 'State', [['all', 'all']].concat(Object.entries(STATES).map(([k, v]) => [k, v])));
|
|
296
385
|
const tl = el('label', undefined, 'fnd-field'), tx = el('input'); tx.type = 'search'; tx.placeholder = 'text contains…'; tx.value = s.mfilter.text; tx.dataset.filter = 'm-text';
|
|
297
386
|
tx.addEventListener('input', () => { s.mfilter.text = tx.value; drawLearnings(); }); tl.append(el('span', 'Text', 'plate'), tx); lbar.append(tl);
|
|
387
|
+
let allBox = null, forget = null;
|
|
388
|
+
const faction = el('div'), noteHost = el('div'); faction.append(noteHost);
|
|
389
|
+
s.forgetHost = faction;
|
|
390
|
+
if (s.writes) {
|
|
391
|
+
const lab = el('label', undefined, 'fnd-toggle');
|
|
392
|
+
allBox = el('input'); allBox.type = 'checkbox'; allBox.setAttribute('aria-label', 'Select all shown learnings');
|
|
393
|
+
lab.append(allBox, el('span', 'Select all'));
|
|
394
|
+
forget = el('button', 'Forget selected (0)', 'ui-danger'); forget.type = 'button';
|
|
395
|
+
forget.addEventListener('click', () => { forgetSelected(); });
|
|
396
|
+
allBox.addEventListener('change', () => {
|
|
397
|
+
const shown = filterLearnings(learnings, s.mfilter, s.source);
|
|
398
|
+
for (const row of shown) {
|
|
399
|
+
const key = learningKey(row);
|
|
400
|
+
if (!key) continue;
|
|
401
|
+
if (allBox.checked) s.picked.add(key); else s.picked.delete(key);
|
|
402
|
+
}
|
|
403
|
+
drawLearnings();
|
|
404
|
+
});
|
|
405
|
+
lbar.append(lab, forget);
|
|
406
|
+
}
|
|
298
407
|
const lcount = el('p', '', 'muted prj-count'), lhost = el('div', undefined, 'prj-table');
|
|
299
|
-
all.append(lbar, lcount, lhost); parts.push(all);
|
|
408
|
+
all.append(lbar, faction, lcount, lhost); parts.push(all);
|
|
300
409
|
body.replaceChildren(...parts);
|
|
301
410
|
const learnings = list(d.learnings);
|
|
411
|
+
const shownNow = () => filterLearnings(learnings, s.mfilter, s.source);
|
|
412
|
+
function syncForget() {
|
|
413
|
+
if (!forget) return;
|
|
414
|
+
const keys = forgetKeys(shownNow(), s.picked);
|
|
415
|
+
forget.textContent = `Forget selected (${keys.length})`;
|
|
416
|
+
forget.disabled = s.forgetting || keys.length === 0;
|
|
417
|
+
if (allBox) {
|
|
418
|
+
const selectable = shownNow().map(learningKey).filter(Boolean);
|
|
419
|
+
allBox.checked = selectable.length > 0 && selectable.every(key => s.picked.has(key));
|
|
420
|
+
allBox.disabled = s.forgetting || selectable.length === 0;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
function paintNote() {
|
|
424
|
+
noteHost.replaceChildren(...list(s.forgetNote).map(line => el('p', line, 'muted')));
|
|
425
|
+
}
|
|
426
|
+
async function forgetSelected() {
|
|
427
|
+
if (s.forgetting) return;
|
|
428
|
+
const keys = forgetKeys(shownNow(), s.picked);
|
|
429
|
+
if (!keys.length) return;
|
|
430
|
+
const epoch = s.forgetEpoch;
|
|
431
|
+
const host = faction;
|
|
432
|
+
const current = () => epoch === s.forgetEpoch && host.isConnected;
|
|
433
|
+
s.forgetting = true; s.forgetNote = null; syncForget(); paintNote();
|
|
434
|
+
for (const child of [...host.children]) if (child !== noteHost) child.remove();
|
|
435
|
+
const path = '/api/projects/' + encodeURIComponent(s.id) + '/memories/forget';
|
|
436
|
+
const base = { keys }; if (s.source) base.path = s.source;
|
|
437
|
+
try {
|
|
438
|
+
// Dry run first. Nothing is forgotten until the confirm, and a cancel sends nothing more.
|
|
439
|
+
const preview = await UI.post(path, { ...base, dry_run: true });
|
|
440
|
+
if (!current()) return;
|
|
441
|
+
if (!preview || !preview.ok || (preview.data && preview.data.ok === false)) {
|
|
442
|
+
UI.outcome(host, preview && preview.ok ? { ok: false, status: preview.status || 500, error: 'failed', detail: 'Could not preview what would be forgotten' } : preview);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
const yes = await UI.confirmInline(host, forgetConfirmText(learnings, keys, preview), { danger: true });
|
|
446
|
+
if (!current() || !yes) return;
|
|
447
|
+
const res = await UI.post(path, { ...base, dry_run: false });
|
|
448
|
+
// Once sent, the forget happened whatever the screen did meanwhile (Read again, another checkout,
|
|
449
|
+
// another tab): its result line is kept for the next draw rather than dropped with this strip.
|
|
450
|
+
if (!current()) {
|
|
451
|
+
s.forgetNote = res && res.ok ? forgetResultLines(res)
|
|
452
|
+
: ['Could not forget: ' + ((res && (res.detail || res.error)) || 'no answer')];
|
|
453
|
+
if (res && res.ok) for (const key of keys) s.picked.delete(key);
|
|
454
|
+
if (s.tab === 'memories') await loadTab(true);
|
|
455
|
+
return;
|
|
456
|
+
}
|
|
457
|
+
if (!res || !res.ok) { UI.outcome(host, res); return; }
|
|
458
|
+
s.forgetNote = forgetResultLines(res);
|
|
459
|
+
for (const key of keys) s.picked.delete(key);
|
|
460
|
+
s.forgetting = false;
|
|
461
|
+
await loadTab(true);
|
|
462
|
+
} finally {
|
|
463
|
+
if (epoch !== s.forgetEpoch) return;
|
|
464
|
+
s.forgetting = false;
|
|
465
|
+
if (host.isConnected) syncForget();
|
|
466
|
+
}
|
|
467
|
+
}
|
|
302
468
|
function drawLearnings() {
|
|
303
|
-
const shown =
|
|
469
|
+
const shown = shownNow();
|
|
304
470
|
lcount.textContent = `${shown.length} of ${learnings.length} learnings`;
|
|
471
|
+
paintNote(); syncForget();
|
|
305
472
|
if (!shown.length) { lhost.replaceChildren(el('p', 'No learnings match these filters.', 'muted')); return; }
|
|
306
|
-
|
|
473
|
+
const columns = [
|
|
307
474
|
{ id: 'category', label: 'Category', value: r => r.category, cell: r => r.category },
|
|
308
475
|
{ id: 'text', label: 'Learning', value: r => r.text, cell: r => el('span', r.text, 'prj-learning') },
|
|
309
476
|
{ id: 'state', label: 'State', value: r => stateFor(r, s.source).state, cell: r => { const st = stateFor(r, s.source), b = el('span', STATES[st.state] || st.state); if (st.from && st.from !== 'dataset') b.title = 'from ' + st.from + ', not this checkout\'s ledger'; return b; } },
|
|
@@ -314,7 +481,14 @@
|
|
|
314
481
|
{ id: 'model', label: 'Model', value: r => (list(r.rows).slice(-1)[0] || {}).model, cell: r => (list(r.rows).slice(-1)[0] || {}).model || '—' },
|
|
315
482
|
{ id: 'from', label: 'From', value: r => r.dataset_only ? 'dataset' : '', cell: r => r.dataset_only ? 'dataset' : Array.from(new Set(list(r.rows).flatMap(x => list(x.from)))).map(basename).join(', ') },
|
|
316
483
|
{ id: 'last', label: 'Last seen', value: r => r.last, cell: r => r.last || '—' },
|
|
317
|
-
]
|
|
484
|
+
];
|
|
485
|
+
if (s.writes) columns.unshift({ id: 'pick', label: '', title: 'Select', sortable: false, hideable: false, cell: r => {
|
|
486
|
+
const key = learningKey(r), box = el('input'); box.type = 'checkbox'; box.checked = !!(key && s.picked.has(key));
|
|
487
|
+
box.disabled = s.forgetting || !key; box.setAttribute('aria-label', 'Select ' + (key || 'learning'));
|
|
488
|
+
box.addEventListener('change', () => { if (!key) return; if (box.checked) s.picked.add(key); else s.picked.delete(key); syncForget(); });
|
|
489
|
+
return box;
|
|
490
|
+
} });
|
|
491
|
+
table(lhost, 'project-learnings', 'Learnings', columns, shown);
|
|
318
492
|
}
|
|
319
493
|
drawLearnings();
|
|
320
494
|
}
|
|
@@ -346,7 +520,12 @@
|
|
|
346
520
|
if (s.id) { redraw = drawProject(); redraw(); loadDetail().then(() => { if (s.tab !== 'runs') loadTab(false); }); }
|
|
347
521
|
else { redraw = drawList(); redraw(); loadList(); }
|
|
348
522
|
}
|
|
349
|
-
UI.controlsEnabled().then(on => {
|
|
523
|
+
UI.controlsEnabled().then(on => {
|
|
524
|
+
const next = !!on;
|
|
525
|
+
if (s.writes === next) return;
|
|
526
|
+
s.writes = next;
|
|
527
|
+
if ((s.tab === 'findings' && s.findings) || (s.tab === 'memories' && s.memories)) redraw();
|
|
528
|
+
});
|
|
350
529
|
open();
|
|
351
530
|
return {
|
|
352
531
|
go(id, tab) {
|
|
@@ -354,7 +533,7 @@
|
|
|
354
533
|
if (id === s.id && t === s.tab) return; // the page's own refresh: nothing changed here
|
|
355
534
|
const same = id === s.id;
|
|
356
535
|
s.id = id || null; s.tab = t;
|
|
357
|
-
if (!same) { s.detail = s.findings = s.memories = null; s.source = null; s.checkout = ''; }
|
|
536
|
+
if (!same) { s.detail = s.findings = s.memories = null; s.source = null; s.checkout = ''; s.picked = new Set(); s.forgetNote = null; }
|
|
358
537
|
if (same && s.id) { redraw = drawProject(); redraw(); if (t === 'runs') loadDetail(); else if (!(t === 'findings' ? s.findings : s.memories)) loadTab(false); }
|
|
359
538
|
else open();
|
|
360
539
|
},
|
|
@@ -368,5 +547,5 @@
|
|
|
368
547
|
};
|
|
369
548
|
}
|
|
370
549
|
|
|
371
|
-
return { render, cleanSummary, filterFindings, filterLearnings, stateFor, memoryEmpty, routeOf, STATUSES, STATES };
|
|
550
|
+
return { render, cleanSummary, filterFindings, filterLearnings, stateFor, memoryEmpty, routeOf, forgetKeys, STATUSES, STATES };
|
|
372
551
|
});
|
|
@@ -236,10 +236,21 @@
|
|
|
236
236
|
const CAUSE_LABELS = { capacity: 'at capacity', rate_limit: 'rate limited', usage_limit: 'usage limit', budget: 'out of budget',
|
|
237
237
|
auth: 'login needed', network: 'network down', provider_down: 'provider down', empty: 'empty answer', cancelled: 'cancelled' };
|
|
238
238
|
const causeLabel = cause => cause ? (Object.prototype.hasOwnProperty.call(CAUSE_LABELS, cause) ? CAUSE_LABELS[cause] : String(cause)) : null;
|
|
239
|
+
// Words the page shows in place of a status word. IMPLEMENTED is a member whose work is in and whose group has not reviewed it.
|
|
240
|
+
const STATUS_LABELS = { IMPLEMENTED: 'awaiting group review' };
|
|
241
|
+
function statusLabel(status) {
|
|
242
|
+
const word = status == null ? '' : String(status);
|
|
243
|
+
return Object.prototype.hasOwnProperty.call(STATUS_LABELS, word) ? STATUS_LABELS[word] : word;
|
|
244
|
+
}
|
|
239
245
|
// The status word, with an INFRA task's cause after it (`INFRA · usage limit`); plain `INFRA` when no cause was recorded.
|
|
246
|
+
// IMPLEMENTED reads as its label. The word itself stays the lamp class (taskStatus).
|
|
240
247
|
function statusText(t) {
|
|
241
|
-
const status = taskStatus(t)
|
|
242
|
-
|
|
248
|
+
const status = taskStatus(t);
|
|
249
|
+
if (status === 'INFRA') {
|
|
250
|
+
const label = causeLabel(t.infra && t.infra.cause);
|
|
251
|
+
return label ? `INFRA · ${label}` : status;
|
|
252
|
+
}
|
|
253
|
+
return statusLabel(status);
|
|
243
254
|
}
|
|
244
255
|
const DAY_NAMES = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
|
|
245
256
|
const MONTH_NAMES = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
@@ -914,6 +925,18 @@
|
|
|
914
925
|
return s ? { lamp: s[0], text: s[1] } : { lamp: 'pending', text: 'its fix task has not merged' };
|
|
915
926
|
}
|
|
916
927
|
|
|
928
|
+
/* ---------- the retro report (retro.md, retro/notes.jsonl) ---------- */
|
|
929
|
+
// RunDetail.retro → the Retro section's one line, e.g. "5 notes: 3 you can fix, 2 for forge · 4 verified, 1 claimed · 1 blocking".
|
|
930
|
+
// Unsure notes are named only when there are some. Null when the run has no retro record.
|
|
931
|
+
function retroSummary(retro) {
|
|
932
|
+
if (!retro || typeof retro !== 'object') return null;
|
|
933
|
+
const n = key => num(retro[key]) || 0, word = (count, one, many) => `${count} ${count === 1 ? one : many}`;
|
|
934
|
+
if (!n('notes')) return '0 notes';
|
|
935
|
+
const fixable = [`${n('user')} you can fix`, `${n('forge')} for forge`];
|
|
936
|
+
if (n('unsure')) fixable.push(`${n('unsure')} not sure who`);
|
|
937
|
+
return `${word(n('notes'), 'note', 'notes')}: ${fixable.join(', ')} · ${n('verified')} verified, ${n('claimed')} claimed · ${n('blocking')} blocking`;
|
|
938
|
+
}
|
|
939
|
+
|
|
917
940
|
/* ---------- Fractal: a task's child tasks as a tidy tree (depth across, siblings down) ---------- */
|
|
918
941
|
// nodes: TaskFractal.nodes (tree order, parent ids); returns {pos: {id: {col, row, depth}}, edges: [[parent, child]], cols, rows}
|
|
919
942
|
function fractalTree(nodes) {
|
|
@@ -939,8 +962,8 @@
|
|
|
939
962
|
}
|
|
940
963
|
|
|
941
964
|
return { liveNow, runState, execStatus, matchRun, filterOptions, atlasModel, repoKey, repoLabel, compareRepo, columns, planModel, finishState,
|
|
942
|
-
finalStatus, runReviewStatus, reviewSinceLine, reviewAt, taskStatus, statusText, causeLabel, resetText, taskVerdict, attemptStatus, attemptNote, attemptFailed, isWaiting,
|
|
965
|
+
finalStatus, runReviewStatus, reviewSinceLine, reviewAt, taskStatus, statusText, statusLabel, causeLabel, resetText, taskVerdict, attemptStatus, attemptNote, attemptFailed, isWaiting,
|
|
943
966
|
attributionLine, taskParts,
|
|
944
967
|
taskTimes, metricValue, overlap, projectSchedule, execModel, verifyLeds, criticalPath, concurrency, stateAt, timeRange, events, lineage, structureKey, innerKey,
|
|
945
|
-
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, fractalTree, sweepLine, sweepState };
|
|
968
|
+
fmtDur, alias, basename, weight, searchIndex, searchRank, statusEvents, fractalTree, sweepLine, sweepState, retroSummary };
|
|
946
969
|
});
|