mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Add a Combine phases quick answer to a plan's Build order card
AI Assisted
This commit is contained in:
1 parent
cb6468577d
commit
bdc4decbb4
4 files changed
+38
-12
No files matched your search
@@ -14,6 +14,7 @@ All notable changes to Plan2Code will be documented in this file.
|
||||
### 🔧 Changed
|
||||
|
||||
- **launcher**: `plan2code` no longer treats an SSH or service session on macOS or Windows as having a desktop, and asks before opening a folder that looks like it is not a project (no `.git`, `AGENTS.md` or `specs/`).
|
||||
- **web console**: a plan's **Build order** card has a **Combine phases** button beside **No changes**. One click fills the box with a request to merge phases where possible while keeping each to a clear concern. It shows only in Plan and Revise plan, where the breakdown is phases.
|
||||
|
||||
## v2.11.1
|
||||
|
||||
|
||||
@@ -395,6 +395,23 @@ test("Skip this one and a comment box's quick answer are the same small accent b
|
||||
assert.equal(colour, await accentOf(s.page), "in the accent");
|
||||
});
|
||||
|
||||
// What a person sees break: Combine phases is missing from a plan's breakdown,
|
||||
// fills nothing, or shows on a list that is not phases.
|
||||
test("a plan's breakdown offers Combine phases beside No changes, and other workflows do not", async (t) => {
|
||||
const rows = [{ id: "a", title: "Read the data", body: "x" }];
|
||||
let s = await openSession(await suite.browser(), { t, workflow: "plan" });
|
||||
let card = await ask(s, { id: "l1", kind: "list", title: "Build order", body: "Reorder.", rows });
|
||||
const quicks = card.locator(".quick-answer");
|
||||
assert.deepEqual(await quicks.allTextContents(), ["No changes", "Combine phases"]);
|
||||
await card.getByRole("button", { name: "Combine phases" }).click();
|
||||
const got = await sendAndCollect(s);
|
||||
assert.match(answerTo(got, "l1").text, /^Combine phases where possible/);
|
||||
|
||||
s = await openSession(await suite.browser(), { t, workflow: "quick-task" });
|
||||
card = await ask(s, { id: "l2", kind: "list", title: "Steps", body: "Reorder.", rows });
|
||||
assert.deepEqual(await card.locator(".quick-answer").allTextContents(), ["No changes"]);
|
||||
});
|
||||
|
||||
// What a person sees break: a safe yes looks like any button, or a risky yes
|
||||
// stops warning.
|
||||
test("a confirm's safe yes and a recap's yes are outlined in the accent, and a dangerous yes stays red", async (t) => {
|
||||
|
||||
@@ -1495,22 +1495,29 @@ function buildList(card, item, staged) {
|
||||
}
|
||||
card.appendChild(row);
|
||||
card.appendChild(el("p", "help", "Drag to reorder, click a name to rename it."));
|
||||
commentField(card, item, "Anything else about this breakdown?", false, "no changes");
|
||||
const quick = [{ label: "No changes", text: "no changes" }];
|
||||
// Only a plan's breakdown is phases; a list card elsewhere is something else.
|
||||
if (PHASE_WORKFLOWS.includes(page.S.workflow)) quick.push({ label: "Combine phases", text: COMBINE_PHASES });
|
||||
commentField(card, item, "Anything else about this breakdown?", false, quick);
|
||||
}
|
||||
|
||||
function commentField(card, item, labelText, required, quickText) {
|
||||
const PHASE_WORKFLOWS = ["plan", "revise-plan"];
|
||||
const COMBINE_PHASES =
|
||||
"Combine phases where possible to simplify and reduce the total number of phases, while still keeping a clear separation of concerns.";
|
||||
|
||||
function commentField(card, item, labelText, required, quickAnswers = []) {
|
||||
const wrap = el("div", "field");
|
||||
const id = "note-" + item.id;
|
||||
const label = el("label", null, labelText);
|
||||
label.htmlFor = id;
|
||||
wrap.appendChild(label);
|
||||
let quick = null;
|
||||
if (quickText) {
|
||||
quick = el("button", "btn tiny", quickText.charAt(0).toUpperCase() + quickText.slice(1));
|
||||
quick.type = "button";
|
||||
quick.title = "Fill in \"" + quickText + "\"";
|
||||
wrap.appendChild(quick);
|
||||
}
|
||||
const quicks = quickAnswers.map(({ label, text }) => {
|
||||
const b = el("button", "btn tiny quick-answer", label);
|
||||
b.type = "button";
|
||||
b.title = "Fill in \"" + text + "\"";
|
||||
wrap.appendChild(b);
|
||||
return [b, text];
|
||||
});
|
||||
const ta = el("textarea");
|
||||
ta.id = id;
|
||||
ta.placeholder = required ? "Tell Plan2Code what to change." : "Optional.";
|
||||
@@ -1531,9 +1538,9 @@ function commentField(card, item, labelText, required, quickText) {
|
||||
stagedChanged();
|
||||
});
|
||||
wrap.appendChild(ta);
|
||||
if (quick)
|
||||
quick.addEventListener("click", () => {
|
||||
ta.value = quickText;
|
||||
for (const [b, text] of quicks)
|
||||
b.addEventListener("click", () => {
|
||||
ta.value = text;
|
||||
ta.dispatchEvent(new Event("input", { bubbles: true }));
|
||||
ta.focus();
|
||||
});
|
||||
|
||||
@@ -441,6 +441,7 @@ input[type="text"].invalid { border-color: var(--warn); }
|
||||
margin-bottom: 6px;
|
||||
}
|
||||
.btn.tiny:hover:not(:disabled) { background: var(--accent-soft); filter: brightness(1.04); }
|
||||
.quick-answer + .quick-answer { margin-left: 6px; }
|
||||
|
||||
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; align-items: center; }
|
||||
|
||||
|
||||
Reference in new issue
Block a user