mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-19 05:11:18 -08:00
Fix narrow git board cards and lost scroll place on redraw, and outline yes verdicts
AI Assisted
This commit is contained in:
1 parent
17dffac1ea
commit
2ab57d9a7e
5 files changed
+85
-13
No files matched your search
@@ -33,6 +33,9 @@ All notable changes to Plan2Code will be documented in this file.
|
|||||||
- **handoff**: every handoff now lives in `~/.plan2code/handoffs/` (a Markdown file plus a small `.json` beside it), owned by the web console, and handoffs older than 30 days are swept when the console opens. The Handoff skill writes there with no folder or `.gitignore` question, and Cleanup never lists the folder. Handoffs written to the OS temp folder or a `handoffs/` folder before this change are not listed.
|
- **handoff**: every handoff now lives in `~/.plan2code/handoffs/` (a Markdown file plus a small `.json` beside it), owned by the web console, and handoffs older than 30 days are swept when the console opens. The Handoff skill writes there with no folder or `.gitignore` question, and Cleanup never lists the folder. Handoffs written to the OS temp folder or a `handoffs/` folder before this change are not listed.
|
||||||
- **dashboard**: a **Bug fixed** spec has a visible **Delete** that needs one confirm, and its chip no longer repeats the "bug fixed" line.
|
- **dashboard**: a **Bug fixed** spec has a visible **Delete** that needs one confirm, and its chip no longer repeats the "bug fixed" line.
|
||||||
- **web console**: the review sign-off card lists **Approve this phase** before **Show me it working**, with the approve button outlined in the accent colour.
|
- **web console**: the review sign-off card lists **Approve this phase** before **Show me it working**, with the approve button outlined in the accent colour.
|
||||||
|
- **web console**: a sign-off's **yes** button (Quick Task's **Build it**, Finalize's **Archive it**) is outlined in your highlight colour too, like **Approve**.
|
||||||
|
- **init**, **init-update**: the *Keeping this file current* section they write into `AGENTS.md` gains three rules: a rule broken twice becomes an automated check, a new Failure log line first looks for one on the same topic to sharpen instead, and the log holds 17 entries at most (over the cap, merge entries that share a cause, then drop the lowest-value ones). Init update offers the missing rules to an existing section and tidies the log on every run, showing each merge and removal for a yes before it writes.
|
||||||
|
- **contributors**: this repo's `AGENTS.md` follows the same Failure log rules, and its three post-sync grep entries are merged into one.
|
||||||
|
|
||||||
### 🗑️ Removed
|
### 🗑️ Removed
|
||||||
|
|
||||||
@@ -40,6 +43,8 @@ All notable changes to Plan2Code will be documented in this file.
|
|||||||
|
|
||||||
### 🐛 Fixed
|
### 🐛 Fixed
|
||||||
|
|
||||||
|
- **web console**: a short card on the git board (a confirm such as *Delete 2 branches?*) fills the board's width instead of sitting narrow in the middle.
|
||||||
|
- **web console**: a redraw no longer throws you back to the top of the finished screen, a doc tab, the Overview or the dashboard menu (pressing **Review it now**, or an agent update landing while you read). The page kept your place only on question cards; it now keeps it for whatever is scrolling, as long as the same thing is still on screen.
|
||||||
- **dashboard**: a bug folder whose diagnosis Quick Task had marked `Fixed` no longer sits on the dashboard forever as *Files on disk*, pre-selected as the most recent spec with no card to clear it. The scan reports it as a new spec state, **Bug fixed**: no pipeline card lights for it, the picker never opens on it (it opens on the most recent spec still in play, or *Start from scratch*), and it is hidden while *Hide unavailable workflows* is on, dimmed otherwise. Quick Task, right after marking a diagnosis-only folder `Fixed`, offers to archive it to `specs--completed/<bug>/` with the same `specs.mjs archive` Finalize uses (a confirm card on the web console).
|
- **dashboard**: a bug folder whose diagnosis Quick Task had marked `Fixed` no longer sits on the dashboard forever as *Files on disk*, pre-selected as the most recent spec with no card to clear it. The scan reports it as a new spec state, **Bug fixed**: no pipeline card lights for it, the picker never opens on it (it opens on the most recent spec still in play, or *Start from scratch*), and it is hidden while *Hide unavailable workflows* is on, dimmed otherwise. Quick Task, right after marking a diagnosis-only folder `Fixed`, offers to archive it to `specs--completed/<bug>/` with the same `specs.mjs archive` Finalize uses (a confirm card on the web console).
|
||||||
|
|
||||||
## v2.8.1
|
## v2.8.1
|
||||||
|
|||||||
@@ -319,7 +319,8 @@ test("sign-off: approve leads show, and the approve button wears the accent", ()
|
|||||||
assert.ok(approve > 0 && show > approve, `${f} lists Approve this phase before Show me it working`);
|
assert.ok(approve > 0 && show > approve, `${f} lists Approve this phase before Show me it working`);
|
||||||
}
|
}
|
||||||
const app = doc("public/app.js");
|
const app = doc("public/app.js");
|
||||||
assert.match(app, /v\.id === "approve" \? " is-approve"/, "an unpicked approve verdict gets is-approve");
|
assert.match(app, /const forward = v\.id === "approve" \|\| v\.id === "yes";/, "approve and yes are the forward verdicts");
|
||||||
|
assert.match(app, /forward \? " is-approve"/, "an unpicked forward verdict gets is-approve");
|
||||||
assert.match(doc("public/app.css"), /\.btn\.is-approve\s*\{[^}]*border-color:\s*var\(--accent\)/, "is-approve borders in the accent");
|
assert.match(doc("public/app.css"), /\.btn\.is-approve\s*\{[^}]*border-color:\s*var\(--accent\)/, "is-approve borders in the accent");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -554,3 +555,17 @@ test("getting started: the new help, status and finished-screen strings carry no
|
|||||||
const fresh = stuck.slice(0, stuck.indexOf("<h4>Not running, or not connected?</h4>"));
|
const fresh = stuck.slice(0, stuck.indexOf("<h4>Not running, or not connected?</h4>"));
|
||||||
assert.ok(!fresh.includes(EM), "the callout and rows have no em dash");
|
assert.ok(!fresh.includes(EM), "the callout and rows have no em dash");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("a redraw keeps the place of whatever scrolls: question card, finished screen, doc column", () => {
|
||||||
|
const app = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "app.js"), "utf8");
|
||||||
|
const fn = app.slice(app.indexOf("function withFocus("), app.indexOf("// Scroll memory across tab switches."));
|
||||||
|
assert.ok(fn.includes("const place = mainPlace();") && fn.includes("restoreMainPlace(place);"), "withFocus saves and restores the main column's place");
|
||||||
|
assert.ok(!fn.includes('querySelector(".card.question")'), "not only a question card");
|
||||||
|
const scrollers = app.match(/const MAIN_SCROLLERS = "([^"]+)"/);
|
||||||
|
assert.ok(scrollers, "MAIN_SCROLLERS lists the column's scrolling children");
|
||||||
|
for (const s of [".card", ".dash", ".waiting-pane"]) assert.ok(scrollers[1].includes(":scope > " + s), `${s} keeps its place`);
|
||||||
|
const place = app.slice(app.indexOf("function mainPlace("), app.indexOf("function withFocus("));
|
||||||
|
assert.match(place, /if \(drawnView === place\.key\) main\.scrollTop = place\.top;/, "the doc column comes back only on the same tab");
|
||||||
|
assert.match(place, /scrollerKey\(inner\) === place\.key/, "a card comes back only while it shows the same thing");
|
||||||
|
assert.match(place, /:scope > \.git-board/, "the git board keeps its own per-tab place");
|
||||||
|
});
|
||||||
@@ -723,6 +723,15 @@ test("a card with a note box over the git board flows at its own height, never s
|
|||||||
assert.ok(fn.includes("isGitBoard()"), "no box grows over the board");
|
assert.ok(fn.includes("isGitBoard()"), "no box grows over the board");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("a card and its pager in the git board's card slot fill the board's width, never shrink to their content", () => {
|
||||||
|
const css = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "app.css"), "utf8");
|
||||||
|
// .card and .pager centre with auto inline margins; in the slot's grid those
|
||||||
|
// would shrink a short confirm, and the pager under it, to fit their content.
|
||||||
|
assert.match(css, /\.card\s*\{[^}]*margin:\s*0 auto/, "the base card still centres outside the board");
|
||||||
|
assert.match(css, /\.pager\s*\{[^}]*margin:\s*0 auto/, "the base pager still centres outside the board");
|
||||||
|
assert.match(css, /\.git-cards > \.card,\s*\.git-cards > \.pager\s*\{\s*margin:\s*0;\s*\}/, "the card slot drops the auto margins for both");
|
||||||
|
});
|
||||||
|
|
||||||
test("long task lines, long words, a narrow board and a narrow Ask pane never widen the page", () => {
|
test("long task lines, long words, a narrow board and a narrow Ask pane never widen the page", () => {
|
||||||
const css = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "app.css"), "utf8");
|
const css = fs.readFileSync(path.join(ROOT, "src", "web-console", "public", "app.css"), "utf8");
|
||||||
const rule = (sel) => {
|
const rule = (sel) => {
|
||||||
|
|||||||
@@ -3882,6 +3882,12 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
|
|||||||
it does not stretch), so a note box grows with what is typed instead, where
|
it does not stretch), so a note box grows with what is typed instead, where
|
||||||
the browser can, rather than scrolling inside a 96px box. */
|
the browser can, rather than scrolling inside a 96px box. */
|
||||||
.git-cards > .card textarea { field-sizing: content; max-height: 50vh; }
|
.git-cards > .card textarea { field-sizing: content; max-height: 50vh; }
|
||||||
|
/* The card and the pager centre themselves with auto inline margins, and a
|
||||||
|
grid item with auto margins shrinks to its content, so a short confirm sat
|
||||||
|
narrow in the middle of the board. In the slot both fill the board's width
|
||||||
|
instead; the slot's gap spaces them. */
|
||||||
|
.git-cards > .card,
|
||||||
|
.git-cards > .pager { margin: 0; }
|
||||||
.main > .git-board {
|
.main > .git-board {
|
||||||
padding-right: 32px;
|
padding-right: 32px;
|
||||||
display: grid;
|
display: grid;
|
||||||
|
|||||||
@@ -1604,26 +1604,61 @@ function trackAbout() {
|
|||||||
// stages an answer went through this path -- checkboxes, radios, the Yes/No
|
// stages an answer went through this path -- checkboxes, radios, the Yes/No
|
||||||
// buttons -- because staging an answer is a full render.
|
// buttons -- because staging an answer is a full render.
|
||||||
//
|
//
|
||||||
// The scroll is restored only while the same question is on screen. Moving to
|
// Not only a question card: the finished screen's card and the dashboard
|
||||||
// another one should start at its top, not part-way down it.
|
// menu scroll themselves too, and a doc or the Overview scrolls the column.
|
||||||
|
// Each of those lost its place on every redraw (a click that staged a send,
|
||||||
|
// an agent post landing mid-read), until all of them came through here.
|
||||||
|
//
|
||||||
|
// The scroll is restored only while the same thing is on screen: the same
|
||||||
|
// question, the same kind of card, the same tab. Moving to another one should
|
||||||
|
// start at its top, not part-way down it. The git board keeps its own place
|
||||||
|
// per tab, so it is left to itself.
|
||||||
|
const MAIN_SCROLLERS = ":scope > .card, :scope > .dash, :scope > .launching, :scope > .dash-confirm, :scope > .waiting-pane";
|
||||||
|
|
||||||
|
// What a scrolling card shows: the question it holds, asked of the card
|
||||||
|
// itself, else its kind ("card handoff"), without the state classes a redraw
|
||||||
|
// may change. The `selected` variable is no use here: the rail and the pager
|
||||||
|
// both set it and then call render, so by now it already names where we are
|
||||||
|
// going.
|
||||||
|
function scrollerKey(node) {
|
||||||
|
if (node.dataset.item) return "item:" + node.dataset.item;
|
||||||
|
return [...node.classList].filter((c) => !c.startsWith("is-") && !c.startsWith("has-")).join(" ");
|
||||||
|
}
|
||||||
|
|
||||||
|
function mainPlace() {
|
||||||
|
const main = $("main");
|
||||||
|
if (main.querySelector(":scope > .git-board")) return null;
|
||||||
|
const inner = main.querySelector(MAIN_SCROLLERS);
|
||||||
|
if (inner && inner.scrollTop) return { inner: true, key: scrollerKey(inner), top: inner.scrollTop };
|
||||||
|
if (main.scrollTop) return { inner: false, key: drawnView, top: main.scrollTop };
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function restoreMainPlace(place) {
|
||||||
|
if (!place) return;
|
||||||
|
const main = $("main");
|
||||||
|
if (main.querySelector(":scope > .git-board")) return;
|
||||||
|
if (!place.inner) {
|
||||||
|
if (drawnView === place.key) main.scrollTop = place.top;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const inner = main.querySelector(MAIN_SCROLLERS);
|
||||||
|
if (inner && scrollerKey(inner) === place.key) inner.scrollTop = place.top;
|
||||||
|
}
|
||||||
|
|
||||||
function withFocus(fn) {
|
function withFocus(fn) {
|
||||||
const a = document.activeElement;
|
const a = document.activeElement;
|
||||||
const keep =
|
const keep =
|
||||||
a && (a.tagName === "TEXTAREA" || a.tagName === "INPUT" || a.tagName === "SELECT") && a.id
|
a && (a.tagName === "TEXTAREA" || a.tagName === "INPUT" || a.tagName === "SELECT") && a.id
|
||||||
? { id: a.id, start: a.selectionStart, end: a.selectionEnd }
|
? { id: a.id, start: a.selectionStart, end: a.selectionEnd }
|
||||||
: null;
|
: null;
|
||||||
const before = $("main").querySelector(".card.question");
|
const place = mainPlace();
|
||||||
const place = before && before.scrollTop ? { of: before.dataset.item, top: before.scrollTop } : null;
|
|
||||||
|
|
||||||
fn();
|
fn();
|
||||||
|
|
||||||
// Scroll first, then focus: focusing an element that is off screen scrolls it
|
// Scroll first, then focus: focusing an element that is off screen scrolls it
|
||||||
// into view, which would undo the restore we just did.
|
// into view, which would undo the restore we just did.
|
||||||
const after = $("main").querySelector(".card.question");
|
restoreMainPlace(place);
|
||||||
// Which question the card on screen HOLDS, asked of the card itself. The
|
|
||||||
// `selected` variable is no use here: the rail and the pager both set it and
|
|
||||||
// then call render, so by now it already names where we are going.
|
|
||||||
if (place && after && after.dataset.item === place.of) after.scrollTop = place.top;
|
|
||||||
if (keep) {
|
if (keep) {
|
||||||
const n = $(keep.id);
|
const n = $(keep.id);
|
||||||
if (n) {
|
if (n) {
|
||||||
@@ -5417,11 +5452,13 @@ function buildReview(card, item, staged) {
|
|||||||
for (const v of verdicts) {
|
for (const v of verdicts) {
|
||||||
const on = staged && staged.verdict === v.id;
|
const on = staged && staged.verdict === v.id;
|
||||||
// A picked danger verdict stays red (filled), so choosing "Abort" never
|
// A picked danger verdict stays red (filled), so choosing "Abort" never
|
||||||
// reads like choosing the safe default. An unpicked approve is outlined
|
// reads like choosing the safe default. An unpicked approve or yes (Build
|
||||||
// in the accent, so the main way forward stands out.
|
// it, Archive it) is outlined in the accent, so the main way forward
|
||||||
|
// stands out.
|
||||||
|
const forward = v.id === "approve" || v.id === "yes";
|
||||||
const b = el(
|
const b = el(
|
||||||
"button",
|
"button",
|
||||||
"btn" + (on ? (v.danger ? " danger is-on" : " primary") : v.danger ? " danger" : v.id === "approve" ? " is-approve" : ""),
|
"btn" + (on ? (v.danger ? " danger is-on" : " primary") : v.danger ? " danger" : forward ? " is-approve" : ""),
|
||||||
verdictText(v)
|
verdictText(v)
|
||||||
);
|
);
|
||||||
b.type = "button";
|
b.type = "button";
|
||||||
|
|||||||
Reference in new issue
Block a user