@giamme/forge 0.15.0 → 0.17.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 +48 -0
- package/VERSION +1 -1
- package/docs/artifacts.md +1 -1
- package/docs/commands.md +14 -3
- package/docs/dataset.md +8 -0
- package/docs/forge-ui.md +14 -0
- package/docs/memory.md +22 -0
- package/docs/reviews.md +22 -1
- package/forge +11 -0
- package/package.json +1 -1
- package/references/dataset.md +129 -7
- package/references/decision-models.md +15 -2
- package/references/decompose.md +95 -13
- package/references/harnesses.md +4 -1
- package/references/planning.md +3 -2
- package/references/solo.md +5 -1
- package/references/ui.md +10 -1
- package/scripts/forge-artifact.sh +53 -0
- package/scripts/forge-contract.py +107 -9
- package/scripts/forge-control.py +0 -2
- package/scripts/forge-dispatch.sh +28 -12
- package/scripts/forge-fail-first.py +3 -1
- package/scripts/forge-guard.py +247 -8
- package/scripts/forge-issues.py +16 -3
- package/scripts/forge-ledger.py +3 -1
- package/scripts/forge-lib-adopt.sh +266 -0
- package/scripts/forge-lib-attribute.sh +10 -2
- package/scripts/forge-lib-plans.sh +16 -4
- package/scripts/forge-lib-review.sh +8 -2
- package/scripts/forge-lib-task.sh +19 -5
- package/scripts/forge-memory.sh +41 -4
- package/scripts/forge-metrics.sh +29 -0
- package/scripts/forge-parallel.sh +99 -14
- package/scripts/forge-plan-check.py +25 -2
- package/scripts/forge-planner.py +20 -6
- package/scripts/forge-route.py +16 -2
- package/scripts/forge-runs-rm.py +23 -7
- package/scripts/forge-runtime.py +25 -2
- package/scripts/forge-schedule.py +5 -2
- package/scripts/forge-shadow.py +30 -9
- package/scripts/forge-solo.sh +6 -0
- package/scripts/forge-sweep.py +25 -10
- package/scripts/forge_dataset/cli.py +99 -0
- package/scripts/forge_dataset/export.py +1 -0
- package/scripts/forge_dataset/facts.py +278 -0
- package/scripts/forge_dataset/harvest.py +27 -3
- package/scripts/forge_dataset/history.py +126 -0
- package/scripts/forge_dataset/outcomes.py +206 -58
- package/scripts/forge_dataset/pairs.py +174 -0
- package/scripts/forge_dataset/risk.py +108 -0
- package/scripts/forge_dataset/tiers.py +427 -0
- package/scripts/forge_dataset/worktrees.py +95 -0
- package/scripts/forge_decide/cli.py +23 -2
- package/scripts/forge_decide/labels.py +30 -6
- package/scripts/forge_decide/replay.py +10 -4
- package/scripts/forge_memory_list.py +153 -0
- package/scripts/forge_worktrees.py +88 -0
- package/ui/README.md +31 -0
- package/ui/docs/api.md +92 -6
- package/ui/forge_ui/__init__.py +14 -1
- package/ui/forge_ui/__main__.py +1 -1
- package/ui/forge_ui/control.py +77 -0
- package/ui/forge_ui/export.py +9 -2
- package/ui/forge_ui/findings.py +11 -2
- package/ui/forge_ui/projects.py +571 -0
- package/ui/forge_ui/reader.py +96 -9
- package/ui/forge_ui/server.py +8 -0
- package/ui/forge_ui/static/app.js +105 -22
- package/ui/forge_ui/static/cloudui.js +6 -2
- package/ui/forge_ui/static/convo.js +1 -1
- package/ui/forge_ui/static/diffview.js +9 -5
- package/ui/forge_ui/static/files.js +1 -1
- package/ui/forge_ui/static/index.html +5 -1
- package/ui/forge_ui/static/panel.js +69 -2
- package/ui/forge_ui/static/projectsview.js +372 -0
- package/ui/forge_ui/static/settings.js +136 -4
- package/ui/forge_ui/static/style.css +94 -3
- package/ui/forge_ui/static/uikit.js +94 -1
- package/ui/forge_ui/static/worktreesview.js +250 -0
- package/ui/forge_ui/worktrees.py +570 -0
|
@@ -26,6 +26,74 @@
|
|
|
26
26
|
'coverage', 'retry-addressed', 'dwarf-message', 'attribution', 'findings'];
|
|
27
27
|
const MODES = ['off', 'shadow', 'on'];
|
|
28
28
|
const ADD_COMMAND = 'forge decide provider add …';
|
|
29
|
+
// What turning a gate on means, per gate: references/decision-models.md in words a first-time reader can act on. `sends`
|
|
30
|
+
// follows the state the site builds in scripts/forge_jev/; a change there changes what a user agreed to send.
|
|
31
|
+
const GATE_HELP = {
|
|
32
|
+
drift: { summary: 'Predicts files a task will edit but did not declare, so two tasks that touch one file do not run at once.',
|
|
33
|
+
when: 'At plan, once per task.', sends: "The goal, and the task's title, declared files, prompt and approach.",
|
|
34
|
+
on: "Adds each predicted file to the task's files before the waves are computed." },
|
|
35
|
+
forward: { summary: 'Spots an earlier task written against something a later task builds.',
|
|
36
|
+
when: 'At plan, once.', sends: 'The title, files and prompt of the tasks in each pair it checks.',
|
|
37
|
+
on: 'Makes the earlier task wait for the later one, unless that forms a cycle.' },
|
|
38
|
+
prompt: { summary: "Checks that a reviewer could judge a task from the task's own text.",
|
|
39
|
+
when: 'At plan, once per task.', sends: "The goal, the task and its prompt and approach, the plan's other tasks, excerpts of its files, and project memory.",
|
|
40
|
+
on: 'Sends a task whose prompt falls short back to the planner, once.' },
|
|
41
|
+
'memory-curate': { summary: 'Keeps project memory clean as reviewers and implementers record facts.',
|
|
42
|
+
when: 'Each time a fact is recorded.', sends: 'The new fact and the existing memory entries.',
|
|
43
|
+
on: 'Refiles the fact, merges it with an existing one, or withholds it. The ledger keeps everything.' },
|
|
44
|
+
'memory-slice': { summary: 'Leaves out memory lines that do not concern the task about to run.',
|
|
45
|
+
when: 'Each time memory is added to a prompt.', sends: 'The task and the memory facts.',
|
|
46
|
+
on: 'Removes lines from what the model is given. It never adds or reorders any.' },
|
|
47
|
+
'memory-stale': { summary: 'Finds memory facts that are no longer true.',
|
|
48
|
+
when: 'Only during a deep memory prune.', sends: 'The fact and the path of the file it is about.',
|
|
49
|
+
on: 'Drops a fact that went false.' },
|
|
50
|
+
'verify-discover': { summary: 'Picks a verification command for a repository that has none configured.',
|
|
51
|
+
when: 'When neither --verify nor .forge/verify exists.', sends: "The repository's file list, the candidate commands, and memory's lines about verifying.",
|
|
52
|
+
on: "Runs the chosen command. That command's own result decides verification." },
|
|
53
|
+
coverage: { summary: 'Finds parts of your request that no task covers.',
|
|
54
|
+
when: 'At plan, once.', sends: "Your request, its requirements, and each task's acceptance criteria.",
|
|
55
|
+
on: 'Sends each uncovered requirement back to the planner, once.' },
|
|
56
|
+
'retry-addressed': { summary: 'Checks that a retry actually touched what its review asked to fix.',
|
|
57
|
+
when: 'On a retry after a review, before the next review.', sends: "The review's blocking findings and the retry's diff.",
|
|
58
|
+
on: 'Sends the retry back to its implementer without paying for a review.' },
|
|
59
|
+
'dwarf-message': { summary: "Reads an implementer's final message for unfinished work or a question for you.",
|
|
60
|
+
when: "On each implementer's final message, before any review.", sends: "The task's title and the end of the message.",
|
|
61
|
+
on: 'Skips the review of an attempt that says it did not finish, or stops the task to ask you.' },
|
|
62
|
+
attribution: { summary: 'Guesses which merged task broke the combined verification, to shorten the search.',
|
|
63
|
+
when: 'After a combined verification fails.', sends: "The end of the failing log, and each merged task's title, files and diff.",
|
|
64
|
+
on: "Checks the likeliest task first. Nothing is merged, reverted or accepted." },
|
|
65
|
+
findings: { summary: 'Finds review findings that repeat an open issue, and the ones concrete enough to file.',
|
|
66
|
+
when: 'When you run forge issues.', sends: "The findings, and open issues' titles and bodies.",
|
|
67
|
+
on: 'Turns a duplicate into a comment on that issue (posted by forge issues --apply), and pre-selects concrete findings.' },
|
|
68
|
+
};
|
|
69
|
+
// The setup guide, as data. A key never passes through this page: each command runs in the reader's own terminal.
|
|
70
|
+
const SETUP_GUIDE = {
|
|
71
|
+
intro: 'A decision model is a small hosted model that answers narrow questions about your run, in about a second. It is optional and off until you turn a gate on. It never changes a review verdict or makes work pass, and if it fails, the run goes on as if it were off.',
|
|
72
|
+
steps: [
|
|
73
|
+
{ title: 'Add a provider', text: 'Run one of these in a terminal. A key is read from stdin or the environment and is stored outside your repositories.',
|
|
74
|
+
commands: [
|
|
75
|
+
['TypeSafe (Jev)', 'printf \'%s\\n\' "$TYPESAFE_API_KEY" | forge decide provider add jev --name typesafe --key-stdin'],
|
|
76
|
+
['Cloudflare (Clef)', 'forge decide provider add clef --name cloudflare --account-id <id> --key-env CLOUDFLARE_API_TOKEN'],
|
|
77
|
+
['A local server, no key', 'forge decide provider add jev --name local --url http://127.0.0.1:8080 --local'],
|
|
78
|
+
] },
|
|
79
|
+
{ title: 'Check that it answers', text: 'This sends one fixed test request with no data from your repositories.',
|
|
80
|
+
commands: [['', 'forge decide doctor --live']] },
|
|
81
|
+
{ title: 'Start one gate in shadow', text: 'In shadow a gate asks and records the answer, and the run goes on exactly as if it were off. It does send data: open a gate below to see what. Use the gate\'s mode and provider below, or run:',
|
|
82
|
+
commands: [['', 'forge decide gate memory-curate shadow --provider typesafe']] },
|
|
83
|
+
{ title: 'Run forge as usual, then look', text: 'Each answer is kept with the run. These show the gates in effect and how they did.',
|
|
84
|
+
commands: [['', 'forge decide status'], ['', 'forge decide report']] },
|
|
85
|
+
{ title: 'Turn a gate on when it has earned it', text: 'A gate goes on only after a replay of its recorded requests passes, which takes about 15 runs of shadow data. Without --send a replay only counts what it would send.',
|
|
86
|
+
commands: [
|
|
87
|
+
['', 'forge decide replay --site jev-drift --provider typesafe --model jev-latest'],
|
|
88
|
+
['', 'forge decide replay --site jev-drift --provider typesafe --model jev-latest --send'],
|
|
89
|
+
['', 'forge decide gate drift on --provider typesafe'],
|
|
90
|
+
] },
|
|
91
|
+
],
|
|
92
|
+
stop: [
|
|
93
|
+
['Keep one repository out', 'forge decide privacy never-send --repo DIR'],
|
|
94
|
+
['Send nothing while this is set', 'export FORGE_JEV=off'],
|
|
95
|
+
],
|
|
96
|
+
};
|
|
29
97
|
const POLL_MS = 20000; // the config rarely changes, and each read starts a CLI process
|
|
30
98
|
// The same order as forge_decide.profiles. A tier or key the body carries and this list does not still shows, after these.
|
|
31
99
|
const TIERS = ['any', 'low', 'medium', 'high'];
|
|
@@ -717,7 +785,9 @@
|
|
|
717
785
|
return () => { if (gen !== s.gen) return; s.hold--; if (!s.hold && s.redraw) { s.redraw = false; drawBody(); } };
|
|
718
786
|
}
|
|
719
787
|
|
|
720
|
-
|
|
788
|
+
// A held draw runs later, when a confirm may have opened: it then waits for that hold, as load() does.
|
|
789
|
+
function drawBody() { UI.guard(body, drawBodyNow, () => { if (s.hold > 0) s.redraw = true; else drawBodyNow(); }); }
|
|
790
|
+
function drawBodyNow() {
|
|
721
791
|
const focus = document.activeElement && body.contains(document.activeElement) ? document.activeElement : null;
|
|
722
792
|
const at = focus && focus.dataset.editor ? { kind: 'editor', name: focus.dataset.editor, a: focus.selectionStart, b: focus.selectionEnd }
|
|
723
793
|
: focus && focus.dataset.model ? { kind: 'model', name: focus.dataset.model, a: focus.selectionStart, b: focus.selectionEnd }
|
|
@@ -776,7 +846,11 @@
|
|
|
776
846
|
|
|
777
847
|
function decideSection() {
|
|
778
848
|
const view = describeDecide(s.data.decide);
|
|
779
|
-
const sec = section('decide', 'Decision models', 'Each gate is off, shadow or on, with a provider and a model. A change writes your forge config (the user level), so it applies to every repository. The mode shown is the one in effect for this repository, and where it came from.');
|
|
849
|
+
const sec = section('decide', 'Decision models', 'Each gate is off, shadow or on, with a provider and a model. Off asks nothing. Shadow asks and records, and changes nothing. On lets the gate act. A change writes your forge config (the user level), so it applies to every repository. The mode shown is the one in effect for this repository, and where it came from.');
|
|
850
|
+
const guide = el('button', 'How to set this up', 'set-guide-open');
|
|
851
|
+
guide.type = 'button'; guide.id = 'set-decide-guide';
|
|
852
|
+
guide.addEventListener('click', openGuide);
|
|
853
|
+
sec.append(guide);
|
|
780
854
|
const where = text(object(s.data.decide).user_path);
|
|
781
855
|
if (where) sec.append(pathLine('config', where));
|
|
782
856
|
if (view.privacyFloor) {
|
|
@@ -799,6 +873,64 @@
|
|
|
799
873
|
return sec;
|
|
800
874
|
}
|
|
801
875
|
|
|
876
|
+
// The guide lives on document.body, so a refresh of the page's body never closes it.
|
|
877
|
+
function openGuide() {
|
|
878
|
+
let dlg = document.getElementById('set-guide');
|
|
879
|
+
if (!dlg) {
|
|
880
|
+
dlg = el('dialog', undefined, 'set-guide');
|
|
881
|
+
dlg.id = 'set-guide'; dlg.setAttribute('aria-labelledby', 'set-guide-h');
|
|
882
|
+
const title = el('h2', 'Set up a decision model'); title.id = 'set-guide-h';
|
|
883
|
+
const close = el('button', 'Close', 'set-guide-close'); close.type = 'button';
|
|
884
|
+
close.addEventListener('click', () => dlg.close());
|
|
885
|
+
const head = el('div', undefined, 'set-guide-head');
|
|
886
|
+
head.append(title, close);
|
|
887
|
+
dlg.append(head, el('p', SETUP_GUIDE.intro));
|
|
888
|
+
const steps = el('ol', undefined, 'set-guide-steps');
|
|
889
|
+
for (const step of SETUP_GUIDE.steps) {
|
|
890
|
+
const li = el('li');
|
|
891
|
+
li.append(el('strong', step.title), el('p', step.text, 'muted'));
|
|
892
|
+
for (const [label, command] of step.commands) li.append(commandLine(label, command));
|
|
893
|
+
steps.append(li);
|
|
894
|
+
}
|
|
895
|
+
dlg.append(steps, el('h3', 'To stop sending'));
|
|
896
|
+
for (const [label, command] of SETUP_GUIDE.stop) dlg.append(commandLine(label, command));
|
|
897
|
+
dlg.addEventListener('click', e => { if (e.target === dlg) dlg.close(); }); // a click on the backdrop
|
|
898
|
+
document.body.append(dlg);
|
|
899
|
+
}
|
|
900
|
+
if (!dlg.open) dlg.showModal();
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
function commandLine(label, command) {
|
|
904
|
+
const line = el('div', undefined, 'set-guide-command');
|
|
905
|
+
if (label) line.append(el('span', label, 'muted'));
|
|
906
|
+
const row = el('div', undefined, 'set-guide-row');
|
|
907
|
+
const copy = el('button', 'Copy', 'set-guide-copy'); copy.type = 'button';
|
|
908
|
+
copy.addEventListener('click', async () => {
|
|
909
|
+
try { await navigator.clipboard.writeText(command); copy.textContent = 'Copied'; }
|
|
910
|
+
catch { copy.textContent = 'Copy failed'; }
|
|
911
|
+
});
|
|
912
|
+
const code = el('code', command, 'mono');
|
|
913
|
+
code.tabIndex = 0; // one line, scrolled: a wrap inside `--local` misleads anyone retyping it
|
|
914
|
+
row.append(code, copy);
|
|
915
|
+
line.append(row);
|
|
916
|
+
return line;
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// What a gate does. Its open state outlives a refresh, which rebuilds the row.
|
|
920
|
+
function gateHelp(gate) {
|
|
921
|
+
const help = GATE_HELP[gate.name];
|
|
922
|
+
if (!help) return [];
|
|
923
|
+
const more = el('details', undefined, 'set-gate-more');
|
|
924
|
+
more.id = 'set-gate-' + gate.name + '-help';
|
|
925
|
+
more.open = !!s.gateHelpOpen?.[gate.name];
|
|
926
|
+
more.addEventListener('toggle', () => { (s.gateHelpOpen ||= {})[gate.name] = more.open; });
|
|
927
|
+
more.append(el('summary', 'What it sends and what on does'));
|
|
928
|
+
const dl = el('dl');
|
|
929
|
+
for (const [term, value] of [['When', help.when], ['Sends', help.sends], ['When on', help.on]]) dl.append(el('dt', term), el('dd', value));
|
|
930
|
+
more.append(dl);
|
|
931
|
+
return [el('p', help.summary, 'set-gate-summary'), more];
|
|
932
|
+
}
|
|
933
|
+
|
|
802
934
|
const providerLabel = p => [p.name, p.type, p.local ? 'local' : ''].filter(Boolean).join(' · ');
|
|
803
935
|
|
|
804
936
|
function gateRow(gate, providers) {
|
|
@@ -818,7 +950,7 @@
|
|
|
818
950
|
if (gate.skip) status.append(el('span', 'skip: ' + gate.skip, 'set-gate-skip'));
|
|
819
951
|
const top = el('div', undefined, 'set-file-head');
|
|
820
952
|
top.append(h, status);
|
|
821
|
-
art.append(top);
|
|
953
|
+
art.append(top, ...gateHelp(gate));
|
|
822
954
|
if (!s.writes) {
|
|
823
955
|
const bits = ['mode ' + gate.mode, gate.provider ? 'provider ' + gate.provider : 'no provider', gate.model ? 'model ' + gate.model : 'no model'];
|
|
824
956
|
art.append(el('p', bits.join(', '), 'muted'));
|
|
@@ -1603,7 +1735,7 @@
|
|
|
1603
1735
|
return { poll, pick };
|
|
1604
1736
|
}
|
|
1605
1737
|
|
|
1606
|
-
return { render, configBody, repoKey, gateKey, targetPath, subsetOk, valueProblem, decideTextProblem, describeDecide, gateTags, replayDate,
|
|
1738
|
+
return { render, configBody, repoKey, gateKey, targetPath, subsetOk, valueProblem, decideTextProblem, describeDecide, gateTags, replayDate, GATES, GATE_HELP, SETUP_GUIDE,
|
|
1607
1739
|
pickDefault, groupRuns, optionLabel, typeAhead, editorOf, isDirty, dirtyState, edited, typed, shown, readFailure,
|
|
1608
1740
|
unsavedLabels, departedRun,
|
|
1609
1741
|
describeProfile, profileRequest, profileCopySpec, clearDefaultLevel, profileOffers, profileRowText, shadowLabel, refusalReasons, profileText, profileJsonProblem, profileNameProblem,
|
|
@@ -242,6 +242,7 @@ label { cursor: pointer; }
|
|
|
242
242
|
.brand { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); margin-right: var(--s-2); }
|
|
243
243
|
.brand-plate { font-family: var(--font-plate); font-weight: 700; font-size: 1.15rem; letter-spacing: .08em; text-transform: uppercase; padding: 3px 9px 1px; border-radius: 4px; background: var(--plate); color: var(--plate-ink); line-height: 1.2; }
|
|
244
244
|
.brand-sub { font-family: var(--font-plate); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-size: .857rem; }
|
|
245
|
+
.brand-version { color: var(--muted); font-size: var(--t-xs); font-variant-numeric: tabular-nums; }
|
|
245
246
|
.desk-nav { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--rule-2); border-radius: var(--r-key); background: var(--module-2); }
|
|
246
247
|
.top-link { display: inline-flex; align-items: center; gap: 7px; min-height: 28px; padding: 0 10px; border-radius: var(--r-small); text-decoration: none; color: var(--ink-2);
|
|
247
248
|
font-family: var(--font-plate); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .929rem; transition: background-color var(--relay), color var(--relay); }
|
|
@@ -336,7 +337,7 @@ body.no-tasks .tasks-module { display: none; }
|
|
|
336
337
|
body[data-shell=workbench].no-tasks .run-view { grid-template-rows: auto minmax(0, 1fr) auto 0; }
|
|
337
338
|
body[data-shell=immersive] .sidebar { position: absolute; z-index: 4; left: var(--gap); top: var(--gap); bottom: var(--gap); width: var(--runs-w); box-shadow: var(--ply-1); }
|
|
338
339
|
body[data-shell=immersive][data-runs=closed] .sidebar { display: none; }
|
|
339
|
-
body[data-shell=immersive]:is([data-view=models], [data-view=findings], [data-view=settings], [data-view=waiting], [data-view=loading], [data-view=first-run]) #main { left: calc(var(--L) - var(--gap)); }
|
|
340
|
+
body[data-shell=immersive]:is([data-view=models], [data-view=findings], [data-view=settings], [data-view=worktrees], [data-view=projects], [data-view=waiting], [data-view=loading], [data-view=first-run]) #main { left: calc(var(--L) - var(--gap)); }
|
|
340
341
|
body[data-shell=immersive] .stage-row, body[data-shell=immersive] .stage-col { position: absolute; inset: 0; }
|
|
341
342
|
body[data-shell=immersive] .stage-col .stage-slot { position: absolute; inset: 0; }
|
|
342
343
|
body[data-shell=immersive] .insp-module { position: absolute; z-index: 3; right: var(--gap); top: var(--gap); bottom: var(--gap); width: var(--insp-w); box-shadow: var(--ply-1); }
|
|
@@ -391,7 +392,7 @@ body[data-shell=workbench] .map-cards-host { overflow: auto; }
|
|
|
391
392
|
body[data-shell=workbench] .map-cards { padding: var(--s-4); }
|
|
392
393
|
|
|
393
394
|
/* content views: the leaderboard and the waiting pages */
|
|
394
|
-
body:is([data-view=models], [data-view=findings], [data-view=settings], [data-view=waiting], [data-view=loading], [data-view=first-run]) #main { padding: var(--s-6) var(--s-6) var(--s-8); }
|
|
395
|
+
body:is([data-view=models], [data-view=findings], [data-view=settings], [data-view=worktrees], [data-view=projects], [data-view=waiting], [data-view=loading], [data-view=first-run]) #main { padding: var(--s-6) var(--s-6) var(--s-8); }
|
|
395
396
|
|
|
396
397
|
/* ---------- the stage: the panel the run is inlaid on ---------- */
|
|
397
398
|
.stage-slot { position: relative; background: var(--stage-bg); }
|
|
@@ -1209,7 +1210,11 @@ dialog.export-dialog h2 { margin-bottom: var(--s-2); }
|
|
|
1209
1210
|
html, body { height: auto; }
|
|
1210
1211
|
body { overflow: auto; min-height: 100%; }
|
|
1211
1212
|
.topbar { flex-wrap: wrap; gap: var(--s-2); padding: var(--s-2) var(--s-3); }
|
|
1212
|
-
|
|
1213
|
+
/* seven views: the nav takes its own row and scrolls sideways rather than widening the page */
|
|
1214
|
+
.desk-nav { order: 3; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
|
|
1215
|
+
.desk-nav::-webkit-scrollbar { display: none; }
|
|
1216
|
+
.desk-nav .top-link { flex: none; }
|
|
1217
|
+
.brand-sub, .brand-version, .top-search kbd, .top-search-label span { display: none; }
|
|
1213
1218
|
.top-search { min-width: 0; margin-left: auto; }
|
|
1214
1219
|
.desk-tools { width: 100%; flex-wrap: wrap; }
|
|
1215
1220
|
.desk-tools .shell-switch { display: none; }
|
|
@@ -1296,6 +1301,62 @@ dialog.fnd-dialog::backdrop { background: light-dark(rgb(17 22 19 / .35), rgb(0
|
|
|
1296
1301
|
.fnd-created li { display: flex; align-items: flex-start; gap: 7px; overflow-wrap: anywhere; }
|
|
1297
1302
|
.findings-link .findings-count:not(:empty) { font-family: var(--mono); }
|
|
1298
1303
|
|
|
1304
|
+
/* ---------- worktrees (#/worktrees) ---------- */
|
|
1305
|
+
.worktrees-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); max-width: 1600px; }
|
|
1306
|
+
.wt-table { min-width: 0; overflow-x: auto; }
|
|
1307
|
+
.wt-head { display: flex; align-items: baseline; gap: var(--s-4); flex-wrap: wrap; }
|
|
1308
|
+
.wt-stamp { font-size: var(--t-sm); font-variant-numeric: tabular-nums; }
|
|
1309
|
+
.wt-lede, .wt-totals, .wt-run-note { margin: 0; }
|
|
1310
|
+
.wt-totals { font-variant-numeric: tabular-nums; }
|
|
1311
|
+
.wt-notes p { margin: 0; font-size: var(--t-sm); }
|
|
1312
|
+
.wt-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
|
|
1313
|
+
.wt-status { white-space: nowrap; }
|
|
1314
|
+
.wt-derived { margin-left: 4px; font-size: var(--t-xs); }
|
|
1315
|
+
.wt-cmds { display: grid; gap: 4px; width: 30em; }
|
|
1316
|
+
.wt-cmd { display: flex; min-width: 0; align-items: flex-start; gap: var(--s-2); padding: 3px var(--s-2); border: 1px solid var(--rule); border-radius: var(--r-key); background: var(--module-2); }
|
|
1317
|
+
.wt-cmd code { min-width: 0; flex: 1; overflow-x: auto; white-space: pre; font-size: var(--t-xs); }
|
|
1318
|
+
.wt-copy { flex: none; }
|
|
1319
|
+
.wt-note { margin: 0; font-size: var(--t-xs); white-space: normal; }
|
|
1320
|
+
.wt-commit { display: inline-block; max-width: 28em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1321
|
+
table.wt-grid { width: max-content; min-width: 100%; }
|
|
1322
|
+
.wt-grid td { vertical-align: top; white-space: nowrap; max-width: 16em; overflow: hidden; text-overflow: ellipsis; }
|
|
1323
|
+
.wt-grid td.wt-command-col { white-space: normal; max-width: none; overflow: visible; }
|
|
1324
|
+
.wt-row-removed { color: var(--muted); }
|
|
1325
|
+
.wt-groups summary { cursor: pointer; }
|
|
1326
|
+
.wt-group { display: grid; grid-template-columns: minmax(8em, max-content) 1fr; align-items: center; gap: var(--s-3); margin: var(--s-2) 0; }
|
|
1327
|
+
.wt-copy:focus-visible, .wt-cmd code:focus-visible, .wt-groups summary:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }
|
|
1328
|
+
|
|
1329
|
+
/* ---------- projects (#/projects) ---------- */
|
|
1330
|
+
.projects-view { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); max-width: 1600px; }
|
|
1331
|
+
.prj-head { display: flex; align-items: baseline; gap: var(--s-4); flex-wrap: wrap; }
|
|
1332
|
+
.prj-links { display: flex; gap: var(--s-3); font-size: var(--t-sm); }
|
|
1333
|
+
.prj-lede, .prj-root, .prj-count, .prj-empty, .prj-differs { margin: 0; }
|
|
1334
|
+
.prj-root { overflow-wrap: anywhere; font-size: var(--t-sm); }
|
|
1335
|
+
.prj-tabs { justify-self: start; }
|
|
1336
|
+
.prj-tabs { display: inline-flex; gap: 2px; }
|
|
1337
|
+
.prj-tabs a { padding: 6px 14px; text-decoration: none; color: inherit; border-radius: var(--r-key); }
|
|
1338
|
+
.prj-tabs a[aria-current=page] { background: var(--module); box-shadow: var(--ply-1, none); }
|
|
1339
|
+
.prj-tabs a[aria-current=page] { font-weight: 600; }
|
|
1340
|
+
.prj-notes p { margin: 0; font-size: var(--t-sm); }
|
|
1341
|
+
.prj-filters { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-3); }
|
|
1342
|
+
.prj-table { min-width: 0; overflow-x: auto; }
|
|
1343
|
+
.prj-name { display: inline-flex; align-items: center; gap: 6px; }
|
|
1344
|
+
.prj-count-chip { margin-left: 6px; font-variant-numeric: tabular-nums; }
|
|
1345
|
+
.prj-occ { margin: var(--s-2) 0 0; padding-left: 1.2em; font-size: var(--t-xs); }
|
|
1346
|
+
.prj-given, .prj-learnings { display: grid; gap: var(--s-2); }
|
|
1347
|
+
.prj-given h2, .prj-learnings h2, .prj-section h3 { margin: 0; }
|
|
1348
|
+
.prj-lines { margin: 4px 0 0; padding-left: 1.2em; }
|
|
1349
|
+
.prj-lines li, .prj-learning { overflow-wrap: anywhere; }
|
|
1350
|
+
.prj-learnings td, .prj-findings td { vertical-align: top; }
|
|
1351
|
+
.prj-table td.prj-cut, .prj-body td.prj-cut { white-space: nowrap; max-width: 18em; overflow: hidden; text-overflow: ellipsis; }
|
|
1352
|
+
.prj-body td { white-space: nowrap; }
|
|
1353
|
+
.prj-findings td { white-space: nowrap; }
|
|
1354
|
+
.prj-findings td.prj-wide { white-space: normal; min-width: 26em; }
|
|
1355
|
+
.prj-summary { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; max-width: 46em; }
|
|
1356
|
+
.prj-learning { display: inline-block; max-width: 48em; }
|
|
1357
|
+
.prj-where a, .project-link { white-space: nowrap; }
|
|
1358
|
+
.prj-tabs a:focus-visible, .prj-links a:focus-visible, .project-link:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }
|
|
1359
|
+
|
|
1299
1360
|
/* ---------- delete a run ---------- */
|
|
1300
1361
|
.del-gap { align-self: stretch; width: 1px; margin: 0 6px; background: var(--rule-2); }
|
|
1301
1362
|
button.del-key { border-color: var(--lamp-red); color: var(--lamp-red); }
|
|
@@ -1440,3 +1501,33 @@ button.set-profile[aria-pressed=true] { border-color: var(--route); background:
|
|
|
1440
1501
|
.set-reasons li { overflow-wrap: anywhere; }
|
|
1441
1502
|
button.set-profile:focus-visible, .set-profile-form select:focus-visible, .set-profile-form input:focus-visible,
|
|
1442
1503
|
.set-profile-editor textarea:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }
|
|
1504
|
+
|
|
1505
|
+
/* Decision models: what a gate does, and the setup guide */
|
|
1506
|
+
.set-gate-summary { font-size: var(--t-sm); }
|
|
1507
|
+
.set-gate-more > summary { cursor: pointer; font-size: var(--t-sm); }
|
|
1508
|
+
.set-gate-more > summary:focus-visible, .set-guide-open:focus-visible, .set-guide-close:focus-visible, .set-guide-copy:focus-visible { outline: 2px solid var(--route); outline-offset: 2px; }
|
|
1509
|
+
.set-gate-more dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--s-1) var(--s-3); margin: var(--s-2) 0 0; font-size: var(--t-sm); }
|
|
1510
|
+
.set-gate-more dt { font-weight: 600; }
|
|
1511
|
+
.set-gate-more dd { margin: 0; text-wrap: pretty; }
|
|
1512
|
+
.set-guide-open { justify-self: start; }
|
|
1513
|
+
dialog.set-guide { width: min(720px, calc(100vw - 24px)); max-height: 86vh; overflow: auto; padding: 18px 20px; border: 1px solid var(--rule); border-radius: var(--r-module); background: var(--module); color: var(--ink); box-shadow: var(--ply-2); }
|
|
1514
|
+
dialog.set-guide::backdrop { background: light-dark(rgb(17 22 19 / .35), rgb(0 0 0 / .55)); }
|
|
1515
|
+
.set-guide-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
|
|
1516
|
+
.set-guide-head h2 { margin: 0; text-wrap: balance; }
|
|
1517
|
+
.set-guide h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--t-sm); }
|
|
1518
|
+
.set-guide p { text-wrap: pretty; }
|
|
1519
|
+
.set-guide-steps { display: grid; gap: var(--s-4); margin: var(--s-3) 0 0; padding-inline-start: 1.4em; }
|
|
1520
|
+
.set-guide-steps p { margin: var(--s-1) 0 var(--s-2); font-size: var(--t-sm); }
|
|
1521
|
+
.set-guide-command { display: grid; gap: 2px; margin-top: var(--s-2); font-size: var(--t-xs); }
|
|
1522
|
+
.set-guide-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2); padding: var(--s-2); border: 1px solid var(--rule); border-radius: var(--r-key); background: var(--module-2); }
|
|
1523
|
+
.set-guide-row code { min-width: 0; flex: 1; overflow-x: auto; white-space: pre; }
|
|
1524
|
+
.set-guide-copy { flex: none; }
|
|
1525
|
+
|
|
1526
|
+
/* Commits adopted from outside a run */
|
|
1527
|
+
.adoptions { display: grid; gap: var(--s-2); margin: 0; padding: 0; list-style: none; font-size: var(--t-sm); }
|
|
1528
|
+
.adoptions p { margin: var(--s-1) 0 0; text-wrap: pretty; }
|
|
1529
|
+
.adoption-links { display: flex; flex-wrap: wrap; gap: var(--s-3); }
|
|
1530
|
+
|
|
1531
|
+
/* A held redraw that has lasted (#115) */
|
|
1532
|
+
.live-held { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 30; display: flex; align-items: center; gap: var(--s-2); padding: var(--s-2) var(--s-3); border: 1px solid var(--rule); border-radius: var(--r-key); background: var(--module); color: var(--ink); box-shadow: var(--ply-2); font-size: var(--t-sm); }
|
|
1533
|
+
.live-held[hidden] { display: none; }
|
|
@@ -6,6 +6,9 @@
|
|
|
6
6
|
get(path) / post(path, body) Promise<{ok, status, data, error, detail, result}>; post sends the token and never retries
|
|
7
7
|
outcome(host, res, okText) an inline result line (a lamp and a sentence) in an aria-live region
|
|
8
8
|
confirmInline(host, text, {danger}) Promise<bool>: an inline Confirm / Cancel strip, Escape cancels
|
|
9
|
+
guard(region, draw, later) draw now, or, while the user is using the region, hold the latest (`later`, else draw) (#115)
|
|
10
|
+
forget(region) drop a held draw: the view it would draw has gone
|
|
11
|
+
keepOpen(region, draw) draw, with each details[data-keep] as open as it was
|
|
9
12
|
The write API is described in ui/docs/api.md, "Controls (write endpoints)". All API values enter the DOM as text. */
|
|
10
13
|
(function (root, factory) {
|
|
11
14
|
'use strict';
|
|
@@ -154,7 +157,97 @@
|
|
|
154
157
|
});
|
|
155
158
|
}
|
|
156
159
|
|
|
157
|
-
|
|
160
|
+
/* A live refresh never cancels what the user is doing (#115). Replacing a node cancels a press on it, a selection in
|
|
161
|
+
it and an open native list, so a redraw waits while a pointer is down in the region, a selection touches it or a
|
|
162
|
+
<select> in it has focus, and the latest one runs when that ends. What the user just did draws at once: a click
|
|
163
|
+
on a task, or a change of the filter that has the focus, is the thing they asked for. A selection left in place would
|
|
164
|
+
hold a region for ever, so a held redraw that lasts says so and offers to run. */
|
|
165
|
+
const doc = env && env.document;
|
|
166
|
+
const HOLD_NOTE_MS = 5000;
|
|
167
|
+
const held = new Map(); // region -> its latest draw
|
|
168
|
+
let pressed = null, userTurn = 0, note = null, noteTimer = null;
|
|
169
|
+
|
|
170
|
+
function selectionTouches(region) {
|
|
171
|
+
const s = env.getSelection && env.getSelection();
|
|
172
|
+
if (!s || s.isCollapsed || !s.rangeCount) return false;
|
|
173
|
+
try { return s.getRangeAt(0).intersectsNode(region); } catch (_) { return false; }
|
|
174
|
+
}
|
|
175
|
+
function inUse(region) {
|
|
176
|
+
if (!doc) return false;
|
|
177
|
+
if (pressed && region.contains(pressed)) return true;
|
|
178
|
+
const active = doc.activeElement;
|
|
179
|
+
if (active && active.tagName === 'SELECT' && region.contains(active)) return true;
|
|
180
|
+
return selectionTouches(region);
|
|
181
|
+
}
|
|
182
|
+
function syncNote() {
|
|
183
|
+
if (!doc) return;
|
|
184
|
+
if (!held.size) {
|
|
185
|
+
clearTimeout(noteTimer); noteTimer = null;
|
|
186
|
+
if (note) note.hidden = true;
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
if (noteTimer || (note && !note.hidden)) return;
|
|
190
|
+
noteTimer = setTimeout(() => {
|
|
191
|
+
noteTimer = null;
|
|
192
|
+
if (!held.size) return;
|
|
193
|
+
if (!note) {
|
|
194
|
+
note = el('div', undefined, 'live-held'); note.id = 'live-held'; note.setAttribute('role', 'status');
|
|
195
|
+
const go = el('button', 'Show it'); go.type = 'button';
|
|
196
|
+
go.addEventListener('click', () => {
|
|
197
|
+
const s = env.getSelection && env.getSelection();
|
|
198
|
+
if (s) s.removeAllRanges();
|
|
199
|
+
if (doc.activeElement && doc.activeElement.tagName === 'SELECT') doc.activeElement.blur();
|
|
200
|
+
flushHeld();
|
|
201
|
+
});
|
|
202
|
+
note.append(el('span', 'Newer data is waiting while you use this.'), go);
|
|
203
|
+
doc.body.append(note);
|
|
204
|
+
}
|
|
205
|
+
note.hidden = false;
|
|
206
|
+
}, HOLD_NOTE_MS);
|
|
207
|
+
}
|
|
208
|
+
function flushHeld() {
|
|
209
|
+
for (const [region, draw] of [...held]) {
|
|
210
|
+
if (!region.isConnected) held.delete(region);
|
|
211
|
+
else if (!inUse(region)) {
|
|
212
|
+
held.delete(region);
|
|
213
|
+
// One draw that throws must not strand the others behind it; it is still reported.
|
|
214
|
+
try { draw(); } catch (error) { setTimeout(() => { throw error; }, 0); }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
syncNote();
|
|
218
|
+
}
|
|
219
|
+
function guard(region, draw, later) {
|
|
220
|
+
if (userTurn || !inUse(region)) {
|
|
221
|
+
held.delete(region);
|
|
222
|
+
draw();
|
|
223
|
+
syncNote();
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
held.set(region, later || draw);
|
|
227
|
+
syncNote();
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
function forget(region) { if (held.delete(region)) syncNote(); }
|
|
231
|
+
function keepOpen(region, draw) {
|
|
232
|
+
const open = new Map(Array.from(region.querySelectorAll('details[data-keep]'), n => [n.dataset.keep, n.open]));
|
|
233
|
+
draw();
|
|
234
|
+
for (const node of region.querySelectorAll('details[data-keep]')) if (open.has(node.dataset.keep)) node.open = open.get(node.dataset.keep);
|
|
235
|
+
}
|
|
236
|
+
if (doc && env.addEventListener) {
|
|
237
|
+
// The click follows the release in the same task, so the redraw waits for the next one.
|
|
238
|
+
const released = () => { pressed = null; setTimeout(flushHeld, 0); };
|
|
239
|
+
env.addEventListener('pointerdown', e => { pressed = e.target; }, true);
|
|
240
|
+
env.addEventListener('pointerup', released, true);
|
|
241
|
+
env.addEventListener('pointercancel', released, true);
|
|
242
|
+
env.addEventListener('blur', released);
|
|
243
|
+
doc.addEventListener('selectionchange', () => { if (held.size) flushHeld(); });
|
|
244
|
+
doc.addEventListener('focusout', () => { if (held.size) setTimeout(flushHeld, 0); });
|
|
245
|
+
for (const type of ['click', 'change', 'input', 'keydown', 'submit', 'hashchange', 'popstate']) {
|
|
246
|
+
env.addEventListener(type, () => { userTurn += 1; setTimeout(() => { userTurn -= 1; }, 0); }, true);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return { el, token, controlsEnabled, get, post, outcome, confirmInline, requestInit, mapResponse, outcomeText, guard, forget, keepOpen };
|
|
158
251
|
}
|
|
159
252
|
|
|
160
253
|
return { create, requestInit, mapResponse, outcomeText, TOKEN_HEADER };
|