mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-19 05:11:18 -08:00
Add the UI Prototype skill, and have Quick Task confirm a saved prototype's brief before planning
AI Assisted
This commit is contained in:
1 parent
2f790027a9
commit
54b316cdf3
130 files changed
+8065
-50
No files matched your search
@@ -6,7 +6,7 @@ The meter is advice and never blocks. The console scores these launches itself w
|
||||
|
||||
Per-unit work is yours: `{"run":{"event":"implement-phase","id":"phase-2","tasks":9}}`, one `run` per post, never reaching the page state.
|
||||
|
||||
- `event`: `pathfinder-chart`, `pathfinder-question` (scores nothing now), `pathfinder-research`, `plan`, `revise-plan`, `document`, `implement-phase`, `implement-review-phase`, `review`, `quick-task`, `init`, `init-update`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `git-commits`, `git-conflict`. An unknown event is exit 3. Post only the events your notes name: a launch the console scores already has its points.
|
||||
- `event`: `pathfinder-chart`, `pathfinder-question` (scores nothing now), `pathfinder-research`, `plan`, `revise-plan`, `document`, `implement-phase`, `implement-review-phase`, `review`, `quick-task`, `init`, `init-update`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `git-commits`, `git-conflict`, `ui-prototype-round`. An unknown event is exit 3. Post only the events your notes name: a launch the console scores already has its points.
|
||||
- `id`: the unit (a question's slug, `phase-N`, `map`), non-empty. The same id in the same skill run is ignored.
|
||||
- `tasks`: only with `implement-phase` and `implement-review-phase`; the tasks completed (`[x]`, not blocked), a whole number 1 to 999. A phase scores one point per 3 tasks rounded up (Implement + Review one more for the review); without it, a flat 2 (or 3). It takes over the count from `headline.cleared`, never adding to it.
|
||||
- `commits`: only with `git-commits`; commits made, 1 to 999, one point per 2 rounded down.
|
||||
@@ -6,7 +6,7 @@ A local page where the person answers your questions, reads your drafts and appr
|
||||
|
||||
## Start
|
||||
|
||||
`node "<CONSOLE>" open --workflow <w>` (add `--spec specs/<idea>` when known). `<w>` is one of `dashboard`, `init`, `init-update`, `pathfinder`, `quick-task`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `review`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`. Launched from the dashboard? The session is open: run the `resume` command the launch carried instead.
|
||||
`node "<CONSOLE>" open --workflow <w>` (add `--spec specs/<idea>` when known). `<w>` is one of `dashboard`, `init`, `init-update`, `pathfinder`, `quick-task`, `plan`, `revise-plan`, `document`, `implement`, `implement-review`, `review`, `finalize`, `handoff`, `git`, `changelog`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `ui-prototype`. Launched from the dashboard? The session is open: run the `resume` command the launch carried instead.
|
||||
|
||||
Keep `sid`: every later command takes `--session <sid>`. `open` failing: carry on in the terminal. When `open` adds `remote` and a `note`, give the link, ask whether it opened, and move to the terminal if not. Tell the person the link (with `"inApp":true`, never print it: only how many questions are waiting) and end every terminal message with the latest `terminalLine`, verbatim.
|
||||
|
||||
|
||||
@@ -25,3 +25,5 @@ The page shows **Write a brief** for this workflow. It arrives as a send:
|
||||
```
|
||||
|
||||
Say in chat where the file went.
|
||||
|
||||
A UI prototype run inside this skill posts `{"run":{"event":"ui-prototype-round","id":"<name>-round-<N>"}}` once per round drawn, uses a `text` card to paste the choice into, and opens its page in a separate browser tab.
|
||||
@@ -5,3 +5,4 @@
|
||||
- Nothing is saved before the Large checkpoint or Phase 7: a stop before then has `finish.body` say nothing was kept, `"command":"/plan2code-1-plan"`. After the checkpoint post `"stopWarning":""`.
|
||||
- Completion finish `command`: `/plan2code-2-document`. The Large checkpoint finish is a pause: headline starts "Paused", `command` `/plan2code-1-plan`, no `dashboard`.
|
||||
- Helpers are reported as `helpers`, each `done` or `failed` before the sign-off it feeds. Questions, sign-offs and the PLAN-DRAFT stay with you.
|
||||
- A UI prototype run inside this skill posts `{"run":{"event":"ui-prototype-round","id":"<name>-round-<N>"}}` once per round drawn, uses a `text` card to paste the choice into, and opens its page in a separate browser tab.
|
||||
@@ -3,6 +3,7 @@
|
||||
Read `building.md` first.
|
||||
|
||||
- Clarifying questions are `text` or `choice`. The first (what to build) carries `"templates":"idea"`, `"fill":"note"`.
|
||||
- Launched on saved prototypes: the first card (after a `choice` of which prototype, if several) is a `recap` "What the prototype says" (`summary`: the request, the chosen variant, what carried over) in place of that `text` card; `{ok:false,text}` adds to the brief.
|
||||
- A note on an open question: reword it, `"_delete":true` it or send `"stands":true` (still fits), with your reply.
|
||||
- Post `"stopWarning":"A quick task saves nothing until it is built, so stopping now loses what we have worked out."` at the start and `""` once the build is under way.
|
||||
- **Scope check:** `choice` "Too big for a quick task?": `1` Continue (lightweight format), `2` Escalate to a full plan; measured counts against thresholds in `body`.
|
||||
@@ -33,3 +34,5 @@ Read `building.md` first.
|
||||
- **Escalated / aborted:** settle the verdict in the finish post: `"command":"/plan2code-1-plan"` with the PLAN-DRAFT's path in `body`, no review; or `"command":"/plan2code-quick-task"`. Both `"dashboard":true`.
|
||||
|
||||
Stop requests during a build: `building.md`.
|
||||
|
||||
A UI prototype run inside this skill posts `{"run":{"event":"ui-prototype-round","id":"<name>-round-<N>"}}` once per round drawn, uses a `text` card to paste the choice into, and opens its page in a separate browser tab.
|
||||
@@ -10,3 +10,5 @@
|
||||
No option, verdict, label, or helper `title`, `ask` or `result` ever offers to execute or implement. Pass `--spec specs/<feature>` to `open` or post `specDir`. Finish `command`: `/plan2code-3-implement specs/<feature>/overview.md`; abort: `/plan2code-1b-revise-plan specs/<feature>/overview.md`.
|
||||
|
||||
Helpers: lookup helpers report before the Step 2 review goes up; phase-file helpers before the Step 4 check.
|
||||
|
||||
A UI prototype run inside this skill posts `{"run":{"event":"ui-prototype-round","id":"<name>-round-<N>"}}` once per round drawn, uses a `text` card to paste the choice into, and opens its page in a separate browser tab.
|
||||
@@ -0,0 +1,31 @@
|
||||
# UI Prototype
|
||||
|
||||
## 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:
|
||||
|
||||
```jsonc
|
||||
{"title":"UI prototype","headline":{"stage":"Start","cleared":0,"total":3},"items":[{"id":"carry","kind":"multi","title":"Carry over","required":false,"body":"Ticked items look the same in every variant; unticked ones are where each variant tries its own take. Skip keeps everything found; tick only what should stay the same to free the rest. Attach screenshots or images in this card's note.","options":[{"k":"1","text":"Colors","detail":"src/styles/theme.css: accent #0f766e, gray #64748b"},{"k":"2","text":"Fonts","detail":"none found"}],"presets":[{"label":"Everything found","ks":["1"]}]},{"id":"spread","kind":"choice","title":"How different","allowOther":false,"body":"How far apart should the variants be?","options":[{"text":"Subtle","detail":"Same layout, different treatment"},{"text":"Balanced","detail":"One layout difference each","recommended":true},{"text":"Radical","detail":"Different layouts"}]},{"id":"direction","kind":"text","title":"Direction","required":false,"body":"Anything every variant should stay inside.","placeholder":"Calmer colors, bigger type, room around the totals."}]}
|
||||
```
|
||||
|
||||
A "none found" option is never in the preset. Attached files arrive as `Image:` and `File:` paths in `reply`: open each, then say per image, in your next post, whether it goes in the page or is a look to match (a `notice`, or the line in the paste card's `body`).
|
||||
|
||||
## The page
|
||||
|
||||
The prototype opens in its own browser tab through `open`; it is never a doc or an image on the console. Post one `{"run":{"event":"ui-prototype-round","id":"<name>-round-<N>"}}` for each round drawn, with the paste card.
|
||||
|
||||
## Paste card
|
||||
|
||||
A `text` item, `--wait`, `"title":"Paste your choice"`, a new id per round (`paste-2`). `body`: the three closing lines, the page's path, and the plain line when `check` left findings. `placeholder`: `Plan2Code UI prototype choice` and a few lines of the block. The answer arrives as `Paste your choice: Plan2Code UI prototype choice` with the rest indented: drop the `Paste your choice: ` prefix and the two-space indent before `read-block` and `choice.txt`.
|
||||
|
||||
## Next steps
|
||||
|
||||
After the read-back, a `menu`, `--wait`: Save, Narrow from my pick, Fresh set, Done, each with a one-line `detail`; the read-back is its `body`. Fresh set's brief goes back up as the three starting cards with new ids (`carry-2`, `spread-2`, `direction-2`), each choice as it stood marked `recommended` or in the preset.
|
||||
|
||||
## Save questions
|
||||
|
||||
One batch, `--wait`: a `choice` "Save where" (the spec folders, the launched one first and `recommended`, then "New spec", whose name comes in the note or a follow-up `text`), a `text` "Prototype name" (the proposed name in `placeholder`, `"pattern":"^[a-z0-9]+(-[a-z0-9]+)*$"`, `"patternHint":"lowercase words joined by hyphens"`), and a `text` "Why the others lost" (`required:false`, left out when already said). `exists`: a `confirm` "Replace it?", `"yesLabel":"Replace","noLabel":"Pick another name"`.
|
||||
|
||||
## The finish
|
||||
|
||||
`headline` "Prototype saved" or "Prototype done"; `body` the saved paths and the `specs/` git line, or the draft's path and that it stays for 30 days; `"dashboard":true`; `command` `/plan2code-1-plan` or `/plan2code-0-pathfinder` as fits, none when nothing was saved; never `commit`. A stop before a save: `body` says the draft is kept for 30 days and gives its path, `"command":"/plan2code-ui-prototype"`.
|
||||
@@ -757,12 +757,16 @@ export function toggleNoteTick(ticked, id) {
|
||||
/**
|
||||
* The spec a card's launch carries: the picker's selection for the cards that
|
||||
* take a spec, and for Quick Task only a diagnosed bug, whose write-up it reads
|
||||
* first. Every other card launches untargeted.
|
||||
* first, or a folder holding only saved prototypes (files on disk with a
|
||||
* `prototypes` count), which it builds from. A mid-pipeline spec with
|
||||
* prototypes is Implement's to build. Every other card launches untargeted.
|
||||
*/
|
||||
export function launchTarget(entry, sel) {
|
||||
if (!entry || !sel) return null;
|
||||
if (entry.spec) return sel;
|
||||
return entry.skill === "plan2code-quick-task" && sel.state === "diagnosed" ? sel : null;
|
||||
if (entry.skill !== "plan2code-quick-task") return null;
|
||||
const prototypeOnly = sel.state === "unrecognized" && sel.prototypes > 0;
|
||||
return sel.state === "diagnosed" || prototypeOnly ? sel : null;
|
||||
}
|
||||
|
||||
export function cardPresentation(entry, scan, sel, menu = {}) {
|
||||
|
||||
@@ -446,6 +446,14 @@
|
||||
<circle cx="14.5" cy="11" r="1.5" />
|
||||
<path d="M10 19v2M12 19v2M14 19v2" />
|
||||
</symbol>
|
||||
<!-- UI Prototype: a framed screen with three sliders. -->
|
||||
<symbol id="ci-ui-prototype" viewBox="0 0 24 24" fill="none">
|
||||
<rect x="3" y="4" width="18" height="16" rx="2" />
|
||||
<path d="M7 9h10M7 12h10M7 15h10" />
|
||||
<circle cx="10" cy="9" r="1.2" />
|
||||
<circle cx="14.5" cy="12" r="1.2" />
|
||||
<circle cx="9" cy="15" r="1.2" />
|
||||
</symbol>
|
||||
<!-- Changelog: a version tag. -->
|
||||
<symbol id="ci-changelog" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M3 4a1 1 0 0 1 1-1h7.6a2 2 0 0 1 1.4.6l7.4 7.4a2 2 0 0 1 0 2.8l-5.6 5.6a2 2 0 0 1-2.8 0L4.6 12a2 2 0 0 1-.6-1.4z" />
|
||||
@@ -734,6 +742,32 @@
|
||||
<g class="ho-arrow"><path class="as" d="M178 64 L214 64 M204 54 L216 64 L204 74" /></g>
|
||||
</svg>
|
||||
|
||||
<!-- UI Prototype: showing a screen off. He holds a framed screen up
|
||||
beside him, and its three dials slide in turn as he tunes it. -->
|
||||
<svg class="pose pose-ui-prototype" data-pose="ui-prototype" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
<ellipse class="shadow" cx="126" cy="198" rx="44" ry="5" />
|
||||
<g class="bob">
|
||||
<g class="up-screen">
|
||||
<rect class="sh" x="166" y="50" width="62" height="70" rx="8" />
|
||||
<line class="lt" x1="178" y1="70" x2="216" y2="70" />
|
||||
<line class="lt" x1="178" y1="86" x2="216" y2="86" />
|
||||
<line class="lt" x1="178" y1="102" x2="216" y2="102" />
|
||||
<g class="up-knob k1"><circle class="ac" cx="188" cy="70" r="4.5" /></g>
|
||||
<g class="up-knob k2"><circle class="ac" cx="204" cy="86" r="4.5" /></g>
|
||||
<g class="up-knob k3"><circle class="ac" cx="186" cy="102" r="4.5" /></g>
|
||||
</g>
|
||||
<g transform="translate(-14 0)">
|
||||
<rect class="fl foot f1" x="94" y="179" width="20" height="10" rx="5" />
|
||||
<rect class="fl foot f2" x="126" y="179" width="20" height="10" rx="5" />
|
||||
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
|
||||
<path class="ln" d="M80 126 L66 150" /><circle class="fl" cx="66" cy="150" r="5.5" />
|
||||
<path class="ey blink" d="M126 86 L129.64 94.98 L139.31 95.67 L131.9 101.92 L134.23 111.33 L126 106.2 L117.77 111.33 L120.1 101.92 L112.69 95.67 L122.36 94.98 Z" />
|
||||
<path class="es" d="M110 120 Q122 129 134 120" />
|
||||
<line class="ln" x1="160" y1="126" x2="192" y2="122" />
|
||||
<circle class="fl" cx="194" cy="122" r="5.5" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
<!-- Changelog: keeping the record. A page of release notes stands beside him,
|
||||
and one arm reaches over to write the newest line onto it. -->
|
||||
<svg class="pose pose-changelog" data-pose="changelog" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
|
||||
|
||||
@@ -22,6 +22,9 @@ const EVENT_WEIGHTS = {
|
||||
// Scores 0 itself: Git's commits are tallied per run (COMMITS_PER_POINT).
|
||||
"git-commits": 0,
|
||||
"git-conflict": 1,
|
||||
// UI Prototype scores per round drawn, not per launch: one point a round,
|
||||
// wherever the round runs (its own skill or a host skill that offers it).
|
||||
"ui-prototype-round": 1,
|
||||
};
|
||||
// A skill's fields as a table by workflow, leaving out the entries without one.
|
||||
const bySkill = (field) => Object.fromEntries(FLOW_SKILLS.filter((s) => s[field] !== null).map((s) => [s.workflow, s[field]]));
|
||||
@@ -137,6 +140,7 @@ export const RUN_LABELS = Object.freeze({
|
||||
"implement-review-phase": "Implement + Review phase built",
|
||||
"git-commits": "Commits in Git",
|
||||
"git-conflict": "Git conflict help",
|
||||
"ui-prototype-round": "Prototype round drawn",
|
||||
...bySkill("ran"),
|
||||
});
|
||||
|
||||
|
||||
@@ -1123,7 +1123,8 @@ export async function launchSkill(entry) {
|
||||
};
|
||||
// The picker's spec goes to the skill being launched, not to the card:
|
||||
// cards that take no spec (utilities, setup) launch untargeted even while
|
||||
// a spec is selected, save Quick Task on a diagnosed bug.
|
||||
// a spec is selected, save Quick Task on a diagnosed bug or a folder of
|
||||
// saved prototypes (launchTarget).
|
||||
if (target) action.spec = target.dir;
|
||||
// A Notebook tab picked in the pane rides the hop in this page only, never
|
||||
// on the action: the launched skill's `fill: "note"` box is filled from it
|
||||
|
||||
@@ -448,6 +448,31 @@ export const SKILLS = Object.freeze([
|
||||
"For code nothing calls anymore. Dead Code uses the project's own dead-code tool when there is one (Knip, vulture, cargo check and others), or searches by itself when there is not, then checks every item for callers across the whole project. Each one gets a label: Safe to remove, Check first or Warning, with the reason. It removes only what you pick, runs the tests and build, and puts back anything that breaks them. It never commits and never installs anything.",
|
||||
},
|
||||
}),
|
||||
skill({
|
||||
skill: "plan2code-ui-prototype",
|
||||
workflow: "ui-prototype",
|
||||
label: "UI prototype",
|
||||
name: "UI Prototype",
|
||||
pose: "ui-prototype",
|
||||
// The launch scores nothing (not metered, no `weight`, as Pathfinder): each
|
||||
// round drawn scores through the `ui-prototype-round` run event in meter.js.
|
||||
builds: false, phased: false, metered: false, templates: false,
|
||||
weight: null, started: null, ran: null, resume: null,
|
||||
subagents: null,
|
||||
states: "any",
|
||||
greyed: null,
|
||||
card: {
|
||||
group: "extra",
|
||||
chip: "Utility",
|
||||
spec: true,
|
||||
title: "Prototype a screen",
|
||||
icon: "ui-prototype",
|
||||
blurb: "Several versions of a screen on one page, tuned with live dials, and your pick brought back.",
|
||||
help: "Draws several versions of a screen or flow on one page with live dials; Copy and paste brings your pick back, saved into a spec only when you say.",
|
||||
about:
|
||||
"For when you want to see a screen before it gets built. UI Prototype draws several versions of a screen or flow on one page that opens in your browser. Flip between them, tune fonts, colors, spacing and feel with live dials, then press Copy and paste the result back so the next round starts from your pick. Nothing is saved into a spec until you say so, and it never changes your code.",
|
||||
},
|
||||
}),
|
||||
skill({
|
||||
skill: "plan2code-changelog",
|
||||
workflow: "changelog",
|
||||
|
||||
@@ -488,6 +488,17 @@
|
||||
14%, 56% { transform: translate(5px, -2px); }
|
||||
}
|
||||
|
||||
/* UI Prototype -- he holds a screen up, and its three dials slide one after
|
||||
another, as if he were tuning it. */
|
||||
.pose .up-knob { animation: up-knob 4.2s ease-in-out infinite; }
|
||||
.pose .up-knob.k2 { animation-delay: -1.4s; }
|
||||
.pose .up-knob.k3 { animation-delay: -2.8s; }
|
||||
@keyframes up-knob {
|
||||
0%, 20%, 100% { transform: translateX(0); }
|
||||
40%, 60% { transform: translateX(12px); }
|
||||
80% { transform: translateX(4px); }
|
||||
}
|
||||
|
||||
@media (max-width: 720px) {
|
||||
.dash { padding-top: 0; }
|
||||
.launch-stage { height: 140px; }
|
||||
|
||||
@@ -81,10 +81,35 @@ function planChangeWaiting(dir, phases) {
|
||||
return files.some((f) => PLAN_CHANGE_RE.test(notesOf(readText(path.join(dir, f)))));
|
||||
}
|
||||
|
||||
// A spec folder's pipeline position and detail, with the count of its saved
|
||||
// prototypes added to the detail and kept as `prototypes` (the dashboard
|
||||
// hands a prototype-only folder to Quick Task as what to build from). A
|
||||
// folder holding only prototypes stays `unrecognized` ("Files on disk"); its
|
||||
// detail says how many it holds.
|
||||
function classifySpec(dir, names) {
|
||||
const result = specPosition(dir, names);
|
||||
const count = prototypeCount(dir, names);
|
||||
if (!count) return { ...result, prototypes: 0 };
|
||||
const noun = count === 1 ? "prototype" : "prototypes";
|
||||
const detail = result.state === "unrecognized" ? `${count} ${noun} saved` : `${result.detail} · ${count} ${noun}`;
|
||||
return { ...result, detail, prototypes: count };
|
||||
}
|
||||
|
||||
// How many prototypes a spec has saved: the .html files directly inside its
|
||||
// prototypes/ folder (each saved with a .md beside it).
|
||||
function prototypeCount(dir, names) {
|
||||
if (!names.includes("prototypes")) return 0;
|
||||
try {
|
||||
return fs.readdirSync(path.join(dir, "prototypes"), { withFileTypes: true }).filter((e) => e.isFile() && /\.html$/i.test(e.name)).length;
|
||||
} catch {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// A spec folder's pipeline position, from its files alone. Furthest artifact
|
||||
// wins: an overview beats a draft beats a map, so a spec mid-way through two
|
||||
// stages reports the later one.
|
||||
function classifySpec(dir, names) {
|
||||
function specPosition(dir, names) {
|
||||
const has = (re) => names.some((n) => re.test(n));
|
||||
const pfDir = path.join(dir, "pathfinder");
|
||||
const overview = names.includes("overview.md");
|
||||
|
||||
@@ -374,7 +374,7 @@ const KEPT_CONSOLE_ENTRIES = new Set([...PROTECTED_CONSOLE_FILES, "sessions", "r
|
||||
// (~/.plan2code/console/<version>/) and removes the old ones, so Cleanup never
|
||||
// offers it.
|
||||
export const CONSOLE_VERSION_DIR = /^\d+\.\d+\.\d+$/;
|
||||
export const KEPT_PLAN2CODE_ENTRIES = new Set(["console", "bin", "launcher.json", "install.json", "models.json", "handoffs", "notepads", "app", "app.json", "agents.json"]);
|
||||
export const KEPT_PLAN2CODE_ENTRIES = new Set(["console", "bin", "launcher.json", "install.json", "models.json", "handoffs", "notepads", "app", "app.json", "agents.json", "prototypes"]);
|
||||
// A stray must sit untouched this long before Cleanup lists it. The same
|
||||
// folders hold files that live for milliseconds -- a held
|
||||
// `workspaces.json.lock`, a `<file>.<pid>.tmp` between its write and its
|
||||
|
||||
Reference in new issue
Block a user