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

+9 -2
View File
@@ -236,12 +236,18 @@ says, and `stop`:
"body": "9 of 9 tasks, all on disk.\n\n| Phase | Tasks | Goal |\n| --- | --- | --- |\n| Phase 4: ... | 6 | ... |\n\nCommit it with:\n\n```\ngit add -A && git commit -m \"...\" -m \"AI Assisted\"\n```",
"command": "/plan2code-3-implement specs/lunch-vote/overview.md",
"doc": "report",
"commit": true,
"dashboard": true
},
"agent": { "status": "waiting" }
}
```
`"commit": true` is there because the body prints a git command: the finished
screen gets a **Commit it now** button, and its `__commit` press is handled as
console.md → Finishing says (resume as `git-commit`, same session). Leave it out
when the body prints no commit.
`finish.command` is the next pipeline step, the same one the terminal names:
the next `/plan2code-3-implement`, or `/plan2code-4-finalize` after the last
phase. An `implement` finish never carries `review`: the offer was on the
@@ -464,8 +470,9 @@ with the count of completed tasks.
in the project's commit format (AGENTS.md), with
`"where": "When you are happy with it, commit it from your terminal:"`, and
`review` on offer — the **Review it now** button, since a quick task has no
sign-off card to put it on — and `"dashboard": true`, so the finished screen
also offers **Back to the dashboard**. Both are required: a finish without
sign-off card to put it on — `"commit": true` (the **Commit it now** button;
console.md → Finishing) and `"dashboard": true`, so the finished screen
also offers **Back to the dashboard**. Review and dashboard are required: a finish without
`dashboard` leaves the person on a dead end. Keep waiting for whichever
button is pressed, and everything after that is "The review, mid-session"
above.
+8 -4
View File
@@ -652,7 +652,7 @@ for permission is not a failure; report only a read that failed after it.
On the skills that offer it (`implement`, `implement-review`, `quick-task`,
`review`, `pathfinder`), the person can turn **helpers** (subagents) on or off
from the top bar's Subagents button. Their pick is saved per project and per
skill, off by default, and reaches you as a standing instruction, only when it
skill, on until switched off, and reaches you as a standing instruction, only when it
changes.
### What arrives
@@ -776,13 +776,15 @@ where its real work starts.
The menu itself is the page's own list — you never send it. The page knows
the repo too: `open` scans `AGENTS.md` and `specs/` into `state.scan`
(`{ hasAgents, isGit, specs: [{ dir, name, state, detail, touched }] }`), and the
(`{ hasAgents, isGit, pending, specs: [{ dir, name, state, detail, touched }] }`), and the
picker at the top of the menu greys the cards that do not fit the selected
spec's pipeline stage — or hides them outright while the **Hide unavailable
workflows** switch under the picker is on (the default; kept in `looks.json`
as `hideUnavailable`). The scan is a snapshot of that `open` — a spec created
mid-session appears the next time the session resumes as a dashboard, not
live. What a dashboard posts is what it knows about this project:
live. `pending` is how many files a commit would take (modified, staged, deleted
and untracked, `null` when git cannot say): the Git commit card greys out at 0
and shows the count above it. What a dashboard posts is what it knows about this project:
```jsonc
{
@@ -902,7 +904,7 @@ card per step, each asked only when the step needs it:
| Step | On the page |
| --- | --- |
| Branch offer | A `choice`, "Which branch?": the suggested `<type>/<name>` (recommended), "Another name" (`allowOther` with a `pattern` for a branch name's shape; run what they type through `branch-check`) and "Stay on the current branch". |
| One commit | A `text` card whose `placeholder` is the drafted subject and whose `pattern` caps it at 100 characters, then a `confirm` "Commit this?" with the files in `consequences`. With the subject given as the argument there is no card. |
| One commit | A `text` card whose `placeholder` is the drafted subject and whose `pattern` caps it at 100 characters, then a `confirm` "Commit this?" with the files in `consequences` and, as `files: [{ "path": "src/a.js", "state": "modified" }]` (states: modified, new, deleted, renamed), a collapsed **Show the N files** table on the card. With the subject given as the argument there is no card. |
| A split | The groups as a doc (`id: "commits"`: each group's subject and files, and any file that mixes concerns) plus a `review` card with verdicts `approve`, `change` and `single` ("One commit instead"). Asked even when the subject came as the argument. |
| Push | A `confirm` with `push.command` and the commit list in `consequences`. |
| `git init` | A `confirm` naming the folder (`danger: false`). |
@@ -1333,6 +1335,7 @@ The same closer you are about to print in the terminal, as data:
| `where` | optional | Overrides "Run this in the terminal where you started Plan2Code, in a new conversation:". |
| `doc` | optional | Id of the document to offer as a Markdown download on the way out. Defaults to the first one. |
| `console` | optional | Whether the copied text asks the next session to use the web console. Leave it out: it follows from the command. |
| `commit` | optional | `true` on a finished `quick-task` or `implement` whose finish prints a git command puts a **Commit it now** button on the finished screen. The press arrives as `__commit` (below). |
| `review` | optional | A finished `quick-task` only: `true` or `{ "label": "..." }` puts a **Review it now** button on the finished screen. `implement` offers the review on its sign-off card instead — before approval, where it can still change the outcome. See `building.md`. |
**Write the bare command.** Every Plan2Code skill has a console — the
@@ -1379,6 +1382,7 @@ usual slices for up to about ten minutes:
| --- | --- |
| An action `{ "i": "__dashboard", "type": "dashboard" }` | `open --resume <sid> --no-open --workflow dashboard` (the resume re-runs the project scan), then ONE post with `"finish": null`, the `menu` payload and `"agent": { "status": "waiting" }`. Then read the dashboard skill (`~/.agents/skills/plan2code/SKILL.md`) and carry on as the dashboard from its "The menu" section, in this same conversation. The same action can also arrive before any finish, from the top bar's triangle: see Stop requests → "Back to the dashboard, mid-workflow". |
| An action `__review` or `__done` | As `building.md` says (quick task only). |
| An action `{ "i": "__commit", "type": "commit" }` | Commit it now: `open --resume <sid> --no-open --workflow git-commit` (no `finish`, no `stop`), then open `~/.agents/skills/plan2code-git-commit/SKILL.md` with your file-read tool and follow it from the top, as if the dashboard's Git commit card had been clicked. Leave the commit command you printed in the finish where it is for the terminal. |
| `wait` exit `20` | The server is gone, not necessarily the tab. `open --resume <sid> --no-open --workflow <yours>`, then keep waiting: their Ask messages and the dashboard button still need you. Give up only when the resume itself fails. |
| Nothing after about ten minutes | `stop` the server. The page swaps the button for the `/plan2code` command. |
+36 -2
View File
@@ -358,6 +358,34 @@ export function insideGitRepo(dir) {
}
}
// How many paths git would commit from `dir`: modified, staged, deleted and
// untracked (an untracked folder counts once), from one bounded `git status`.
// null when git cannot say (not installed, not a repository, too slow), which
// the page reads as "unknown", never as a clean tree. --no-optional-locks keeps
// this background look from taking the index lock out from under a commit.
export function pendingFiles(dir) {
try {
const out = execFileSync("git", ["--no-optional-locks", "status", "--porcelain", "-z"], {
cwd: dir,
encoding: "utf8",
timeout: 3000,
windowsHide: true,
maxBuffer: 8 * 1024 * 1024,
stdio: ["ignore", "pipe", "ignore"],
});
const parts = out.split("\0").filter(Boolean);
let n = 0;
for (let i = 0; i < parts.length; i++) {
n++;
// A rename or copy carries its old path as one more field.
if (/^[RC]/.test(parts[i])) i++;
}
return n;
} catch {
return null;
}
}
export function projectRoot(cwd = process.cwd()) {
return repoRoots(cwd).project;
}
@@ -871,7 +899,8 @@ function isDir(p) {
* Scan <root>/specs into picker entries, most recently touched first.
* `touched` is the newest file mtime inside the folder — last write wins,
* which is the honest reading of "the one you were working on".
* `isGit` says whether `root` sits inside a git repository (no git process).
* `isGit` says whether `root` sits inside a git repository (no git process);
* `pending` is how many paths a commit would take, or null when unknown.
*/
export function scanProject(root) {
const specsDir = path.join(root, "specs");
@@ -900,10 +929,12 @@ export function scanProject(root) {
});
}
specs.sort((a, b) => b.touched - a.touched || a.name.localeCompare(b.name));
const isGit = insideGitRepo(root);
return {
at: nowIso(),
hasAgents: fs.existsSync(path.join(root, "AGENTS.md")),
isGit: insideGitRepo(root),
isGit,
pending: isGit ? pendingFiles(root) : null,
specs,
};
}
@@ -1467,6 +1498,9 @@ export function validate(state) {
if (fin.dashboard != null && typeof fin.dashboard !== "boolean") {
problems.push('"finish.dashboard" must be true or false (or left out: no dashboard button)');
}
if (fin.commit != null && typeof fin.commit !== "boolean") {
problems.push('"finish.commit" must be true or false (or left out: no commit button)');
}
// The review offer on a finished build: true, or an object carrying the
// button's heading. The heading is read by the person, so it faces the
// same vocabulary check as a title.
+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 };
}
/**