Show pending files on the Git commit card, add Commit it now, and default Subagents to on

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-08 08:52:52 -07:00
1 parent 3414a19ce6
commit 3dfd44ba88
12 files changed
+242 -26

No files matched your search

+20 -2
View File
@@ -456,6 +456,7 @@ export const REVIEW_REPLY =
"Review what was just built before I go: run the focused code review on this session's changes, here on the page.";
export const DONE_REPLY = "No review, thanks. I am done: close the session.";
export const DASHBOARD_REPLY = "Take me back to the dashboard, right here in this session.";
export const COMMIT_REPLY = "Commit what was just built: start Git commit, right here in this session.";
// Shown under the Back to the dashboard button: the press picks up in the same
// conversation, which carries a long skill's context into the next one.
@@ -471,6 +472,16 @@ export function dashboardOffer(fin) {
return Boolean(fin && fin.dashboard === true && !finishPaused(fin));
}
/**
* Whether a finish offers to commit what was just built from this page. The
* agent opts in with `finish.commit: true` on a build that ended with a git
* command; the press starts Git commit in the same session, as the dashboard's
* card does. A pause never offers it.
*/
export function commitOffer(fin) {
return Boolean(fin && fin.commit === true && !finishPaused(fin));
}
/**
* Whether a finish carries the offer to review what was just built. The agent
* posts `finish.review` as `true` or as `{ "label": "..." }` on a finished
@@ -732,12 +743,14 @@ const NEXT_FOR_STATE = {
const ON = { on: true };
export const GIT_INIT_NOTE = "Not a git repository yet: it offers to start one";
export const GIT_CLEAN_REASON = "Nothing to commit: no changed or new files";
export const pendingNote = (n) => `${n} file${n === 1 ? "" : "s"} to commit`;
const off = (reason) => ({ on: false, reason });
/**
* Whether a catalog card is clickable for the current picker selection.
*
* `scan` is the server's project scan ({ hasAgents, isGit, specs }); `sel` is the
* `scan` is the server's project scan ({ hasAgents, isGit, pending, specs }); `sel` is the
* picked spec object or null for "start from scratch". A spec whose files
* match no pipeline shape ("unrecognized") behaves like no spec at all for
* availability — but its folder still goes along on a Pathfinder or Plan
@@ -763,7 +776,12 @@ export function cardAvailability(entry, scan, sel) {
case "plan2code-changelog":
return ON;
case "plan2code-git-commit":
return scan && scan.isGit === false ? { on: true, note: GIT_INIT_NOTE } : ON;
if (scan && scan.isGit === false) return { on: true, note: GIT_INIT_NOTE };
// `pending` is null when git could not say: stay clickable then.
if (scan && scan.isGit && Number.isInteger(scan.pending)) {
return scan.pending === 0 ? off(GIT_CLEAN_REASON) : { on: true, note: pendingNote(scan.pending) };
}
return ON;
case "plan2code-0-pathfinder":
if (!state || state === "exploring") return { ...ON, next };
return off("This spec is already past the questions");
+15
View File
@@ -1248,6 +1248,21 @@ h1 {
.card .md, .card .prompt { max-width: none; }
.card .prompt p:first-child { margin-top: 0; }
.card-files {
margin-top: 10px;
font-size: 0.9em;
}
.card-files summary {
cursor: pointer;
color: var(--ink-2);
}
.card-files table {
margin-top: 6px;
}
.card-files td:last-child {
word-break: break-all;
}
.card-note {
background: var(--accent-soft);
border: 1px solid var(--accent-line);
+62 -6
View File
@@ -26,7 +26,9 @@ import {
choiceAnswer,
DASHBOARD_COMMAND,
DASHBOARD_NOTE,
COMMIT_REPLY,
DASHBOARD_REPLY,
commitOffer,
dashboardOffer,
DONE_REPLY,
finishPaused,
@@ -567,7 +569,7 @@ let cardMarks = null;
function fresh() {
// `stopping` is set once a stop request has been accepted, and kept here so
// a reload in the middle of wrapping up comes back to the same screen.
// `afterBuild` is "review", "done" or "dashboard" once a finished session's
// `afterBuild` is "review", "commit", "done" or "dashboard" once a finished session's
// offer has been answered, so the buttons do not come back on a reload.
// `homeward` is set once the top bar's Back to the dashboard request has
// been accepted mid-workflow: { at }. The resume through the dashboard
@@ -717,7 +719,7 @@ const selSpec = () => {
// the finish goes away, which is the agent taking the review up.
function reviewPending() {
const fin = finish();
if (!fin || !reviewOffer(fin) || local.afterBuild === "done" || local.afterBuild === "dashboard") return null;
if (!fin || !reviewOffer(fin) || ["done", "dashboard", "commit"].includes(local.afterBuild)) return null;
if (local.afterBuild === "review") return gone ? null : "asked";
return gone ? null : "open";
}
@@ -1667,6 +1669,7 @@ function renderStatus() {
// offer has something left to press here, and only while the server is
// there to take the press.
if (local.afterBuild === "dashboard" && !gone) return say("work", "Opening the dashboard…", "", true);
if (local.afterBuild === "commit" && !gone) return say("work", "Opening Git commit…", "", true);
const offer = reviewPending();
if (dashboardLive(finish()) && !gone && !offer) {
return say("point", "Done. Head back to the dashboard, or close this tab.");
@@ -2318,10 +2321,15 @@ function renderHandoff(fin) {
// A finished build offers its review first, above the next step, because it
// is the one thing on this screen that has to happen before they leave.
const offer = reviewOffer(fin);
if (offer && local.afterBuild !== "done" && local.afterBuild !== "dashboard") {
if (offer && !["done", "dashboard", "commit"].includes(local.afterBuild)) {
card.appendChild(renderReviewOffer(offer));
}
// The commit, right after the review: one press starts Git commit here.
if (commitOffer(fin) && !gone && local.afterBuild !== "done" && local.afterBuild !== "dashboard") {
card.appendChild(renderCommitOffer());
}
// Three shapes: a next step to run, a pause with its resume command, or a
// session with nothing left to run, which gets a quiet pointer at the
// dashboard instead of a Next step block.
@@ -2500,6 +2508,31 @@ function renderReviewOffer(offer) {
return box;
}
// Commit what was just built without leaving the page. Like the review button
// it is a request to an agent still in its wait loop, so it is only drawn
// while the server is there; the command printed below stays for the terminal.
function renderCommitOffer() {
const box = el("section", "review-offer");
box.appendChild(el("p", "handoff-label", "Commit it"));
box.appendChild(
el(
"p",
"review-offer-text",
"Git commit reads what changed, drafts the message and asks before it commits or pushes. " +
"It opens right here, the same as the dashboard's Git commit card."
)
);
const asked = local.afterBuild === "commit";
const row = el("div", "btn-row");
const go = el("button", "btn primary", asked ? "Opening Git commit…" : "Commit it now");
go.type = "button";
go.disabled = asked || pendingResult;
go.addEventListener("click", () => sendAfterBuild("commit"));
row.appendChild(go);
box.appendChild(row);
return box;
}
// The way back to the dashboard, on a finished screen whose agent opted in
// with `finish.dashboard`. Like the review button it is a request to an agent
// still in its wait loop, so once the server is gone it turns into the
@@ -2546,9 +2579,9 @@ function textWithCode(tag, className, text) {
}
// Any answer to a finished session's offers, as one send through the ordinary
// submit. Like a brief, it names no question: `__review`, `__done` and
// `__dashboard` are about the session.
const AFTER_FINISH_REPLIES = { review: REVIEW_REPLY, done: DONE_REPLY, dashboard: DASHBOARD_REPLY };
// submit. Like a brief, it names no question: `__review`, `__commit`, `__done`
// and `__dashboard` are about the session.
const AFTER_FINISH_REPLIES = { review: REVIEW_REPLY, done: DONE_REPLY, dashboard: DASHBOARD_REPLY, commit: COMMIT_REPLY };
async function sendAfterBuild(kind) {
if (gone || pendingResult || local.afterBuild) return;
try {
@@ -2572,6 +2605,7 @@ async function sendAfterBuild(kind) {
const started = {
review: "Review requested. It starts here in a moment.",
dashboard: "Opening the dashboard. It appears here in a moment.",
commit: "Opening Git commit. It appears here in a moment.",
}[kind];
if (started) {
banner(started, "good");
@@ -4406,9 +4440,31 @@ function buildConfirm(card, item, staged) {
note.appendChild(md(item.consequences, "md"));
card.appendChild(note);
}
if (Array.isArray(item.files) && item.files.length) card.appendChild(filesTable(item.files));
commentField(card, item, "Anything to add?");
}
// A collapsed list of the files a confirm is about ({ path, state } rows), so
// "15 files" can be opened up and read before the person says yes.
function filesTable(files) {
const box = el("details", "card-files");
box.appendChild(el("summary", "", `Show the ${files.length} file${files.length === 1 ? "" : "s"}`));
const table = el("table", "md-table");
const head = el("tr");
head.appendChild(el("th", "", "State"));
head.appendChild(el("th", "", "File"));
table.appendChild(head);
for (const f of files) {
if (!f || typeof f.path !== "string") continue;
const row = el("tr");
row.appendChild(el("td", "", typeof f.state === "string" ? f.state : ""));
row.appendChild(el("td", "", f.path));
table.appendChild(row);
}
box.appendChild(table);
return box;
}
function buildRecap(card, item, staged) {
// The recap is not optional: a click captured the pick, this captures the
// agreement. Rendered as a document so it reads like a summary, not a form.
+1 -1
View File
@@ -1570,7 +1570,7 @@
shipped one back), and say how many may run at once.
</li>
<li>
It is off by default and saved for this project and this skill, so
It is on until you turn it off, and saved for this project and this skill, so
the next session of the same skill here starts the same way.
</li>
<li>
+2 -1
View File
@@ -58,7 +58,8 @@ export function effectiveInstruction(setting) {
}
export function defaultSetting(workflow) {
return { workflow, on: false, instruction: null, max: DEFAULT_MAX };
// On until the person turns it off, for the workflows that offer the switch.
return { workflow, on: offered(workflow), instruction: null, max: DEFAULT_MAX };
}
/**