mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Let UI Prototype start from a Notebook tab, filling its request box on Start fresh
AI Assisted
This commit is contained in:
1 parent
fde92ef4d2
commit
c6265795ea
9 files changed
+38
-12
No files matched your search
@@ -2429,6 +2429,9 @@ test("noteSwitchShows: Pathfinder, Plan and Quick Task on Start fresh, Revise pl
|
||||
const diagnose = entry("plan2code-diagnose");
|
||||
assert.equal(noteSwitchShows(diagnose, scan, null), true, "Diagnose on Start fresh");
|
||||
assert.equal(noteSwitchShows(diagnose, scan, sel("documented")), true, "Diagnose launches untargeted, so a picked spec does not hide it");
|
||||
const prototype = entry("plan2code-ui-prototype");
|
||||
assert.equal(noteSwitchShows(prototype, scan, null), true, "UI Prototype on Start fresh");
|
||||
assert.equal(noteSwitchShows(prototype, scan, sel("documented")), false, "UI Prototype on a picked spec");
|
||||
const revise = entry("plan2code-1b-revise-plan");
|
||||
assert.equal(noteSwitchShows(revise, scan, null), false, "Revise plan is grayed on Start fresh");
|
||||
for (const state of ["documented", "building", "built"]) {
|
||||
|
||||
@@ -974,6 +974,7 @@ test("POST /notepad/tab/sent answers 200, 400 and 404, and GET /notepad carries
|
||||
assert.equal(ok.body.sent.workflow, "quick-task");
|
||||
assert.deepEqual((await getJson(s, "/notepad")).body.tabs, [{ id, name: "Idea", sent: ok.body.sent }]);
|
||||
assert.equal((await post({ id, workflow: "diagnose" })).status, 200, "Diagnose can be sent from a tab");
|
||||
assert.equal((await post({ id, workflow: "ui-prototype" })).status, 200, "UI Prototype can be sent from a tab");
|
||||
assert.equal((await post({ id, workflow: "quick-task" })).status, 200);
|
||||
assert.deepEqual(await post({ id, workflow: "document" }), { status: 400, body: { error: "bad-sent" } });
|
||||
assert.deepEqual(await post({ id, workflow: "revise-plan", spec: "../x" }), { status: 400, body: { error: "bad-sent" } });
|
||||
|
||||
@@ -124,6 +124,7 @@ const CASES = [
|
||||
{ workflow: "plan", chip: "Start from scratch", command: "/plan2code-1-plan" },
|
||||
{ workflow: "quick-task", chip: "Start from scratch", command: "/plan2code-quick-task" },
|
||||
{ workflow: "revise-plan", chip: "ready", command: "/plan2code-1b-revise-plan", spec: "specs/ready" },
|
||||
{ workflow: "ui-prototype", chip: "Start from scratch", command: "/plan2code-ui-prototype" },
|
||||
];
|
||||
|
||||
for (const c of CASES) {
|
||||
|
||||
@@ -537,6 +537,15 @@ test("prefs: Help and the readme name every tab and section, and the dialog's un
|
||||
}
|
||||
});
|
||||
|
||||
test("UI Prototype's request card is the box a Notebook tab fills, and the prompt asks for the request first", () => {
|
||||
const notes = fs.readFileSync(path.join(ROOT, "src", "web-console", "notes", "ui-prototype.md"), "utf8");
|
||||
const batch = JSON.parse(notes.match(/## The request[\s\S]*?```jsonc\n(.*)\n```/)[1]);
|
||||
assert.deepEqual(batch.items.map((item) => [item.id, item.kind, item.fill]), [["request", "text", "note"]]);
|
||||
assert.ok(notes.indexOf("## The request") < notes.indexOf("## Starting card"), "it comes before the starting card");
|
||||
const prompt = fs.readFileSync(path.join(ROOT, "src", "plan2code-ui-prototype.md"), "utf8");
|
||||
assert.match(prompt, /\*\*The request\.\*\* When nothing yet says what to prototype/, "Step 1 asks for the request when none came");
|
||||
});
|
||||
|
||||
test("Diagnose's opening cards: only What is wrong is required", () => {
|
||||
const notes = fs.readFileSync(path.join(ROOT, "src", "web-console", "notes", "diagnose.md"), "utf8");
|
||||
const batch = JSON.parse(notes.match(/```jsonc\n(.*)\n```/)[1]);
|
||||
|
||||
@@ -57,8 +57,9 @@ Read `./AGENTS.md` when it exists: its stack, its style files and its convention
|
||||
### Step 1: Start
|
||||
|
||||
1. Run `sweep --project .` silently.
|
||||
2. **The kind.** From the request: a **screen**, a **flow** (several screens of one journey, shown side by side, not linked) or a **terminal** screen. Ask only when it cannot be told.
|
||||
3. **What can be carried over.** Read source files only: stylesheets, theme and config files (a Tailwind or theme config, CSS custom properties, design files), and component files. For each of the five items (colors, fonts, spacing, components, layout) note what you found and where (`src/styles/theme.css`: accent #0f766e, gray #64748b), or "none found". Note the app's own font files when it ships some (at most 4, 2 MB together). A project with no screens yet skips the checklist: say you found no existing look and start fresh.
|
||||
2. **The request.** When nothing yet says what to prototype (no argument, no host handing it over), ask for it first, in one question (console: the request card in `notes/ui-prototype.md`). Images sent with the answer are Step 2's images.
|
||||
3. **The kind.** From the request: a **screen**, a **flow** (several screens of one journey, shown side by side, not linked) or a **terminal** screen. Ask only when it cannot be told.
|
||||
4. **What can be carried over.** Read source files only: stylesheets, theme and config files (a Tailwind or theme config, CSS custom properties, design files), and component files. For each of the five items (colors, fonts, spacing, components, layout) note what you found and where (`src/styles/theme.css`: accent #0f766e, gray #64748b), or "none found". Note the app's own font files when it ships some (at most 4, 2 MB together). A project with no screens yet skips the checklist: say you found no existing look and start fresh.
|
||||
|
||||
### Step 2: The starting screen
|
||||
|
||||
|
||||
@@ -114,7 +114,7 @@ const isFile = (p) => {
|
||||
|
||||
// The workflows a tab can be sent to from the dashboard, and the spec a Revise
|
||||
// plan send names.
|
||||
export const SENT_WORKFLOWS = ["pathfinder", "plan", "quick-task", "revise-plan", "diagnose"];
|
||||
export const SENT_WORKFLOWS = ["pathfinder", "plan", "quick-task", "revise-plan", "diagnose", "ui-prototype"];
|
||||
const SENT_SPEC_RE = /^specs\/[A-Za-z0-9._-]+$/;
|
||||
|
||||
// A tab's `sent` record as stored, or null when it does not hold up.
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# UI Prototype
|
||||
|
||||
## The request
|
||||
|
||||
Nothing yet says what to prototype: before Step 1, one `--wait` card (a Notebook tab fills it):
|
||||
|
||||
```jsonc
|
||||
{"title":"UI prototype","items":[{"id":"request","kind":"text","title":"What to prototype","fill":"note","body":"The screen or flow, and what it is for."}]}
|
||||
```
|
||||
|
||||
## Starting card
|
||||
|
||||
One `--wait` batch after Step 1. A card cannot open with its boxes ticked, so the carry-over card's preset ticks every found item in one press, and a Skip on it keeps everything found (all ticked is the default); leave the card out for a project with no screens:
|
||||
|
||||
@@ -710,15 +710,17 @@ export function cardAvailability(entry, scan, sel, lookup = stateFor) {
|
||||
}
|
||||
|
||||
// The cards whose confirm pane offers "Start with a note from your Notebook"
|
||||
// on Start fresh: the three that open on an idea box.
|
||||
const NOTE_FRESH_CARDS = new Set(["plan2code-0-pathfinder", "plan2code-1-plan", "plan2code-quick-task"]);
|
||||
// on Start fresh: the three that open on an idea box, and UI Prototype, whose
|
||||
// request box it fills.
|
||||
const NOTE_FRESH_CARDS = new Set(["plan2code-0-pathfinder", "plan2code-1-plan", "plan2code-quick-task", "plan2code-ui-prototype"]);
|
||||
|
||||
/**
|
||||
* Whether a lit card's confirm pane offers the Notebook switch: Pathfinder,
|
||||
* Plan and Quick Task on Start fresh (no spec picked), Diagnose whenever it is
|
||||
* lit (it launches untargeted, so a picked spec does not matter), and Revise
|
||||
* plan on a picked spec with no plan change brief waiting (a waiting brief is
|
||||
* what that revision is about). Never on a grayed card, never on any other card.
|
||||
* Plan, Quick Task and UI Prototype on Start fresh (no spec picked), Diagnose
|
||||
* whenever it is lit (it launches untargeted, so a picked spec does not
|
||||
* matter), and Revise plan on a picked spec with no plan change brief waiting
|
||||
* (a waiting brief is what that revision is about). Never on a grayed card,
|
||||
* never on any other card.
|
||||
*/
|
||||
export function noteSwitchShows(entry, scan, sel) {
|
||||
if (!entry || !cardAvailability(entry, scan, sel).on) return false;
|
||||
|
||||
@@ -1564,9 +1564,10 @@
|
||||
</li>
|
||||
<li>
|
||||
A lit card's confirm pane can offer <strong>Start with a note from
|
||||
your Notebook</strong>. On the dashboard, Pathfinder, Plan and Quick
|
||||
Task offer it on Start fresh, and Revise plan on a picked spec with
|
||||
no plan change waiting. A tab you started a workflow with wears a
|
||||
your Notebook</strong>. On the dashboard, Pathfinder, Plan, Quick
|
||||
Task and UI Prototype offer it on Start fresh, Diagnose whenever
|
||||
it is lit, and Revise plan on a picked spec with no plan change
|
||||
waiting. A tab you started a workflow with wears a
|
||||
small <strong>sent</strong> badge.
|
||||
</li>
|
||||
<li>
|
||||
|
||||
Reference in new issue
Block a user