mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 20:45:33 -08:00
Show a landed git result as its own zone beside the leftover work
AI Assisted
This commit is contained in:
1 parent
899359806a
commit
0454bdd19a
6 files changed
+104
-6
No files matched your search
@@ -21,11 +21,11 @@ A click arrives as one session action per send, and the board locks until your n
|
||||
**After an action**, ONE post with `--wait`:
|
||||
|
||||
```jsonc
|
||||
{"reread":true,"items":[{"id":"git-result","kind":"notice","title":"Pushed 2 commits to origin/feature/x","body":"a1b2c3d, e4f5a6b. [Open pull request](https://github.com/...)"}],"board":{"describe":"export-csv-button"}}
|
||||
{"reread":true,"items":[{"id":"git-result","kind":"notice","op":"push","title":"Pushed 2 commits to origin/feature/x","body":"a1b2c3d, e4f5a6b. [Open pull request](https://github.com/...)"}],"board":{"describe":"export-csv-button"}}
|
||||
```
|
||||
|
||||
- `reread` is `true`, or `{"refreshFailed":true}` after a failed Refresh. Only with the `git` workflow, else exit 3.
|
||||
- `git-result` is one `notice` replaced every action: what happened, short hashes, the `pr-url` link after a push or publish. A failure quotes git's stderr verbatim with `classify-error`'s `next`.
|
||||
- `git-result` is one `notice` replaced every action: what happened, short hashes, the `pr-url` link after a push or publish, and `op` naming the action that succeeded (`"commit"`, `"push"`, `"pull"`, `"switch"`, `"create"`, `"cleanup"`, `"refresh"`, `"init"`, `"publish"`): the board shows it as the landed zone beside the leftover work. A failure quotes git's stderr verbatim with `classify-error`'s `next` and carries no `op`.
|
||||
- `board.describe`: short kebab-case description of the changes still on the tree (prefills Create); leave out when none remain.
|
||||
|
||||
**Cards per `plan`** (`git.mjs plan <op>`):
|
||||
|
||||
@@ -130,7 +130,8 @@ export function drawGitBoard(ctx) {
|
||||
}
|
||||
const tab = activeTab(ctx);
|
||||
node.appendChild(header(ctx));
|
||||
if (ctx.notice) node.appendChild(resultLine(ctx, ctx.notice));
|
||||
// A landed result (`op` set) lives in the step strip's two zones instead.
|
||||
if (ctx.notice && !ctx.notice.op) node.appendChild(resultLine(ctx, ctx.notice));
|
||||
node.appendChild(tabStrip(ctx, tab));
|
||||
node.appendChild(cardSlot);
|
||||
node.appendChild(tabPanel(ctx, tab));
|
||||
@@ -280,6 +281,51 @@ function stepStrip(ctx, id) {
|
||||
}
|
||||
// Mid-operation, Sync's own block is the step (syncBody).
|
||||
if (id === "sync" && git.inProgress) return null;
|
||||
// A landed result: the notice (it carries `op`) becomes the left zone and
|
||||
// the leftover step the right, muted, so the board reads "done, and this
|
||||
// much is not yours" rather than one loud suggestion to commit it all.
|
||||
if (ctx.notice && ctx.notice.op) {
|
||||
const duo = h.el("div", "git-duo");
|
||||
const landed = h.el("div", "git-landed");
|
||||
landed.setAttribute("role", "status");
|
||||
landed.appendChild(h.el("div", "git-step-kicker", "Just landed"));
|
||||
landed.appendChild(h.el("h3", "git-step-title", ctx.notice.title || ""));
|
||||
if (ctx.notice.body) landed.appendChild(h.md(ctx.notice.body, "md git-result-body"));
|
||||
if (ctx.mode === "running") landed.appendChild(activityLine(ctx, "p", ctx.activity || "Plan2Code is working on it."));
|
||||
// The landed zone's one action is the follow-through on their work, which
|
||||
// only exists beside a leftover-commit primary (Push 5 there). Every other
|
||||
// shape leaves the exit to the right zone, which always names the board's
|
||||
// real next step, muted.
|
||||
const theirs = p && p.op === "commit" ? p : null;
|
||||
if (theirs && step.secondary[0]) {
|
||||
const acts = h.el("div", "git-step-actions");
|
||||
acts.appendChild(stepButton(ctx, step.secondary[0], "btn primary"));
|
||||
landed.appendChild(acts);
|
||||
}
|
||||
duo.appendChild(landed);
|
||||
const left = h.el("div", "git-left");
|
||||
left.appendChild(h.el("div", "git-step-kicker", theirs ? "Still on the tree" : p ? "Still to do" : "All caught up"));
|
||||
if (theirs) left.appendChild(h.el("h3", "git-step-title", theirs.label));
|
||||
else left.appendChild(h.el("h3", "git-step-title", p ? p.label : step.line));
|
||||
if (p && p.why) left.appendChild(h.el("p", "git-step-why", p.why));
|
||||
if (step.stale) left.appendChild(staleLine(ctx, step.stale));
|
||||
if (step.held) {
|
||||
const held = h.el("div", "git-held");
|
||||
held.appendChild(h.md(step.held, "md git-held-body"));
|
||||
left.appendChild(held);
|
||||
}
|
||||
const acts = h.el("div", "git-step-actions");
|
||||
if (theirs) {
|
||||
acts.appendChild(stepButton(ctx, { ...theirs, label: "Commit other changes" }, "btn primary"));
|
||||
for (const s of step.secondary.slice(1)) acts.appendChild(stepButton(ctx, s, "btn small"));
|
||||
} else {
|
||||
if (p) acts.appendChild(stepButton(ctx, p, "btn primary"));
|
||||
for (const s of step.secondary) acts.appendChild(stepButton(ctx, s, "btn small"));
|
||||
}
|
||||
if (acts.children.length) left.appendChild(acts);
|
||||
duo.appendChild(left);
|
||||
return duo;
|
||||
}
|
||||
const box = h.el("div", "git-step" + (git.inProgress ? " is-warn" : "") + (p ? "" : " is-calm"));
|
||||
box.appendChild(h.el("div", "git-step-kicker", p ? "Next step" : "Nothing to do"));
|
||||
box.appendChild(h.el("h3", "git-step-title", p ? p.label : step.line));
|
||||
|
||||
@@ -472,6 +472,9 @@
|
||||
/* The bar's gap sets the rhythm; the row's own margin is for loop-setup,
|
||||
which has no tail. */
|
||||
.confirm-tail .confirm-actions { margin-top: 0; }
|
||||
/* The Notebook box frames itself, so the rule line is one separation too
|
||||
many when it is on the pane; the shadow still marks the bar in a scroll. */
|
||||
.dash-confirm:has(.confirm-note-box) .confirm-tail { border-top: 0; }
|
||||
|
||||
/* "Start with a note from your Notebook": the switch, then the tabs beside a
|
||||
preview of the picked one, its pictures each with a tick. */
|
||||
|
||||
@@ -128,6 +128,17 @@
|
||||
.git-wait { margin: 0; font-size: 13.5px; color: var(--stage); }
|
||||
.git-fresh { margin: 0; font-size: 13px; color: var(--ink-3); }
|
||||
.git-fresh.is-stale { color: var(--stage); }
|
||||
/* A landed result fills the step strip's place with two zones: the result
|
||||
itself (green, "Just landed") beside the leftover step (muted). The big
|
||||
headline belongs to what happened, not to the work that is not yours. */
|
||||
.git-duo { display: grid; grid-template-columns: 3fr 2fr; gap: 10px; align-items: start; }
|
||||
.git-landed, .git-left { display: grid; gap: 6px; padding: 14px 18px; border-radius: var(--radius); }
|
||||
.git-landed { background: var(--ok-soft); border: 1px solid var(--ok); border-left-width: 4px; }
|
||||
.git-landed .git-step-kicker { color: var(--ok); }
|
||||
.git-landed .git-result-body { font-size: 14px; color: var(--ink-2); }
|
||||
.git-landed .git-result-body .md-p { margin: 0; }
|
||||
.git-left { background: var(--panel-2); border: 1px solid var(--rule-2); }
|
||||
.git-left .git-step-title { font-size: 16px; }
|
||||
.git-panel-tab { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
|
||||
.git-changes, .git-sync { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
|
||||
.git-sweep-offer { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; font-size: 14px; color: var(--ink-2); }
|
||||
@@ -248,6 +259,7 @@
|
||||
|
||||
/* Last on purpose: the narrow layout overrides the board rules above it. */
|
||||
@container git-board (max-width: 720px) {
|
||||
.git-duo { grid-template-columns: 1fr; }
|
||||
.git-tab-bar { flex-wrap: wrap; }
|
||||
.git-tabs { flex-wrap: wrap; }
|
||||
.git-done { margin: 0 0 6px; }
|
||||
|
||||
Reference in new issue
Block a user