diff --git a/.agents-docs/AGENTS-architecture-console.md b/.agents-docs/AGENTS-architecture-console.md index 4efd093..0ffc6dd 100644 --- a/.agents-docs/AGENTS-architecture-console.md +++ b/.agents-docs/AGENTS-architecture-console.md @@ -45,5 +45,5 @@ Optional local browser UI shipped with **every** skill. Source lives in `src/web | `update-check.mjs` | the dashboard's release check, server-only (never in `SERVABLE`): `compareVersions()` (numeric X.Y.Z, `null` otherwise), `latestTag()` (the highest `refs/tags/vX.Y.Z`, peeled `^{}` and pre-release tags skipped), `checkForUpdate({ installed, cacheFile, now, run })` (never throws) and `runLsRemote()` (`git ls-remote --tags` on the repo: no shell, `GIT_TERMINAL_PROMPT=0`, `GCM_INTERACTIVE=never`, SSH `BatchMode` when `GIT_SSH_COMMAND` is unset, `windowsHide`, killed at 10 s; git authenticates itself, the console never touches a credential). The answer, failures included, is cached for an hour in `~/.plan2code/console/update-check.json` (`UPDATE_CHECK_FILE`, in `PROTECTED_CONSOLE_FILES` so no sweep removes it). `server.mjs` starts it after the ready line and never awaits it; `stateFrame()` carries `update: { installed, latest }` only when a newer release exists (its `latest` is part of `haveKey()`, so a page that connected first still gets it), and `GET /version` returns `{ version, latest }`. Tests seed a fresh cached failure in every console home, so no test server reaches the network. The `plan2code` launcher reads the same cache for its terminal release notice (a copy of this module sits in `~/.plan2code/bin/`) | | `console.md` | the core of the agent-facing contract, read once per conversation (every skill ships the same copy, so a dashboard hop never re-reads it): starting, the turn (`post --wait`, the exit codes, handling a send, `settle`), posting, the payload and its kinds, documents (including `file` blocks), the house rules, and an index of the topic files below with the moment each is read. A test caps it at 24,000 characters | | `console-finish.md` · `console-stop.md` · `console-chat.md` · `console-workspace.md` · `console-subagents.md` · `console-launches.md` · `console-meter.md` · `console-attachments.md` · `console-trouble.md` | topic files, each read only when its moment first comes: finishing (the finish and its buttons), stop requests (the way home mid-workflow, `stopWarning`, resuming a pause), Quick questions, the Workspace, standing instructions and helper reports, dashboard launches and the menu payload, the session meter's `run` events (read only when a `run` is refused: the notes inline every `run`), keeping a cited note attachment, and recovery | -| `notes/.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`). Each skill's Interface line reads `/console.md` and its own notes file right after `open`; a test checks every skill names one that exists | +| `notes/.md` | per-workflow notes (`init` for both inits, `pathfinder` with Briefs, `plan`, `revise-plan`, `document`, `implement` for both builds, `loop` for a build the desktop app's Implementation Loop runs with `--loop` (where it reports a `loopOutcome` instead of asking for sign-off), `quick-task`, `review`, `finalize`, `handoff`, `changelog`, `git`, `xray`, `diagnose`, `pr-prep`, `test`, `dead-code`, `ui-prototype`). Each skill's Interface line reads `/console.md` and its own notes file right after `open`; a test checks every skill names one that exists | | `building.md` · `building-review.md` | the build half of the contract, for `implement`, `implement-review` and `quick-task`: progress posts (`agent.activity`, `agent.quietMinutes`, `file` blocks re-read with `refresh`), the chat check between tasks, questions mid-build and stop requests; `building-review.md` is the review run on the page (the sign-off's `review` verdict, **Review it now**, Implement + Review's Stage 2, Finalize's Step 2.5), read only when asked for | diff --git a/.agents-docs/AGENTS-architecture-install.md b/.agents-docs/AGENTS-architecture-install.md index 7f49373..80782df 100644 --- a/.agents-docs/AGENTS-architecture-install.md +++ b/.agents-docs/AGENTS-architecture-install.md @@ -5,7 +5,7 @@ ``` plan2code/ -├── src/ # Source workflow prompts (20 markdown files) +├── src/ # Source workflow prompts (21 markdown files) │ ├── plan2code-0-pathfinder-references/ # Reference files for pathfinder skill │ │ ├── brief.md # Dated plain-English decision briefs │ │ ├── chart.md # MODE A: destination + frontier grills, templates @@ -32,6 +32,11 @@ plan2code/ │ │ └── community-feedback-submission.md # STEP 6.5 payload schema + submission tiers │ ├── plan2code-dead-code-references/ # Reference files for dead-code skill │ │ └── caller-search.md # How to search for a symbol's callers before calling it dead +│ ├── plan2code-ui-prototype-references/ # Reference files for ui-prototype skill +│ │ ├── ui-prototype-contract.md # The contract between model-written variants and the shipped shell +│ │ ├── ui-prototype-design.md # Making each variant look designed: structure, type, color, the dials +│ │ ├── ui-prototype-rounds.md # Rounds, the paste back, the save into a spec +│ │ └── ui-prototype-shell/ # The page shell the script assembles every round from (shell.html, shell.js, shell.css, base.css) │ ├── skill-scripts/ # Scripts shared across skills: install.js copies the ones a skill lists into skills//scripts/ (specs, commit-msg, review-scope, agents-md, agent-files, glob, test-map, test-match, test-commands, run-check, common) │ └── plan2code--scripts/ # A skill's own scripts, same copy rule (pathfinder, finalize, changelog, git, xray, pr-prep, test and dead-code each have one) ├── plan2code-bot/ # Autonomous end-to-end workflow test runner (TypeScript, tsup, Claude Agent SDK, vitest); user docs in .readme/test-bot.md @@ -134,10 +139,10 @@ plan2code/ | `plan2code.md` | — | The dashboard: opens the web console's skill menu and launches the picked skill into its own session | | `plan2code-init.md` | Init | Generate AGENTS.md as index + `.agents-docs/` section files (progressive discovery) | | `plan2code-init-update.md` | Update | Update AGENTS.md with learnings; detects and routes edits to `.agents-docs/` files | -| `plan2code-0-pathfinder.md` | 0 | Chart a foggy idea as a map (local files, or GitHub Issues) of decision questions under `specs//pathfinder/`, resolve them one at a time, hand a seeded PLAN-DRAFT to Step 1 | -| `plan2code-quick-task.md` | quick | Lightweight planning for small tasks (standalone — not a pipeline step) | -| `plan2code-1-plan.md` | 1 | Requirements analysis & architecture | -| `plan2code-1b-revise-plan.md` | 1b | Mid-implementation revisions | +| `plan2code-0-pathfinder.md` | 0 | Chart a foggy idea as a map (local files, or GitHub Issues) of decision questions under `specs//pathfinder/`, resolve them one at a time, hand a seeded PLAN-DRAFT to Step 1; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype, which replaces the runnable UI sketch | +| `plan2code-quick-task.md` | quick | Lightweight planning for small tasks (standalone — not a pipeline step); ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype | +| `plan2code-1-plan.md` | 1 | Requirements analysis & architecture; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype | +| `plan2code-1b-revise-plan.md` | 1b | Mid-implementation revisions; ships `ui-prototype.md`, its `ui-prototype-*` references, the shell and the five `ui-prototype*.mjs` scripts (ride-along) for its offer of a UI prototype | | `plan2code-2-document.md` | 2 | Create implementation specs | | `plan2code-3-implement.md` | 3 | Execute implementation (phase by phase) | | `plan2code-3-implement-review.md` | 3 | Execute one phase, run focused review and fixes, then request approval | @@ -149,6 +154,7 @@ plan2code/ | `plan2code-pr-prep.md` | pr-prep | Get a branch ready for review: pick the checks its changes need from the project's `## Test map` (or its config files), let the person trim the plan, run it, give Ready, Ready with notes or Not ready, and write a PR description to copy (following the repo's template) with the create-a-PR link; offers to save `PR-READINESS-.md` into the branch's spec folder; never commits, pushes or opens the PR | | `plan2code-test.md` | test | Write missing tests: ask where to look, find source files no test covers (matching, plus real coverage when the project already has a coverage tool, offered first), show a plan opening with how this project writes tests, then write and run unit and integration tests; escalates past 8 source files, 8 new test files or 2 runners to a PLAN-DRAFT for Plan, hands a real bug to Diagnose, never changes source code | | `plan2code-dead-code.md` | dead-code | Find unused code and dead code: use the project's own dead-code tools, one per language that has files (Knip, vulture, cargo check and others), or search by itself, check every item for callers across the project (`references/caller-search.md`), label each Safe to remove, Check first or Warning, remove only what the person picks, then run the tests and build and put back anything that breaks them, then offer a final review of the removals in the same session (Step 7.5, recommended yes; ships `review.md`, `review-in-build.md`, `test-runs.md` and the review references, as Finalize does); never commits, never installs a tool. Scripts: `dead-code.mjs` (own), `test-map.mjs`, `glob.mjs`, `test-commands.mjs`, `run-check.mjs`, `specs.mjs`, `commit-msg.mjs`, `review-scope.mjs` | +| `plan2code-ui-prototype.md` | ui-prototype | Draw several versions of a screen or flow on one page with live dials (drafts under `~/.plan2code/prototypes/`), bring the pick back by Copy and paste for the next round, and save the pair into `specs//prototypes/` only on a yes; never changes code | | `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer to commit the result through Git | | `plan2code-git.md` | git | Branches, pull (with conflict help), push, publish and commits (clear message, suggested splits) on the web console's git board, or plain instructions in the terminal (`switch to main`, `commit and push`); asks before every push, publish and delete | diff --git a/.agents-docs/AGENTS-architecture-skill-scripts.md b/.agents-docs/AGENTS-architecture-skill-scripts.md index b77672c..a2e2992 100644 --- a/.agents-docs/AGENTS-architecture-skill-scripts.md +++ b/.agents-docs/AGENTS-architecture-skill-scripts.md @@ -32,6 +32,7 @@ Anything a workflow step decides with one correct answer (parsing a spec's check | `xray.mjs` (own) | xray | `hotspots` (churn, files changed together, often-changed files with no test, from `git log` over a capped window) and `history ` (commits following renames, a blame summary, PR titles and first paragraphs through `gh` when signed in, and which sources were used). Read-only | | `changelog-state.mjs` (own) | changelog | `state`, `bump`, `set-package-version`: the default branch's version, whether the branch's entry can be extended (not released, not on another branch), the file's heading style, the gap since the entry was last touched; only `set-package-version` writes, and only the version field | | `git.mjs` (own) | git | `state`, `plan`, `branch-check`, `init-check`, `delete-check`, `cleanup-list`, `conflicts`, `pr-url`, `classify-error`: the repo snapshot, each action's exact command and confirm text (shared by the terminal and the board), branch-name, delete, cleanup and git init checks, a stopped rebase's conflicts, the pull-request link and git's errors sorted into kinds with a next step. Read-only: the agent runs every command it prints, and `guard()` refuses force push, hook skipping, amend, remote delete and blanket add | +| `ui-prototype.mjs` (shared, with `ui-prototype-round.mjs`, `ui-prototype-page.mjs`, `ui-prototype-drafts.mjs`, `ui-prototype-block.mjs`) | ui-prototype, pathfinder, plan, revise-plan, quick-task (ride-along) | `sweep` (drafts older than 30 days), `new-round`, `assemble` (the page from `round.json`, the variant files and the shell in `references/ui-prototype-shell/`, images and fonts embedded; exit 4 `round-mismatch` when a drafts round's `round.json` names another `name` or `round` than its folder), `check` (the contract's rules, the three image rules `image-type`, `image-size` and `image-missing`, and the size ceiling), `open` (the default browser), `read-block` (a pasted choice block from stdin into fields) and `save` (the pair `specs//prototypes/.html` and `.md`, then that prototype's drafts removed). Writes only under `~/.plan2code/prototypes//` and, on `save`, the spec's `prototypes/`; never writes project code, never opens a page outside the drafts or `specs/`, never fetches anything over the network. The helper modules are imported only by `ui-prototype.mjs` | **Conventions** (`common.mjs`): Node 18+ built-ins only; one JSON object on stdout (`ok: false` plus `error`, `message`, `next` on a handled failure, the same line on stderr); exit 0 ok, 1 crash, 2 bad arguments, 3 not found, 4 invalid or check failed, 5 refused; `--help` documents commands and exit codes; writes take `--dry-run`; `PLAN2CODE_NOW` pins the clock for tests. A SKILL.md names a script as `node "/.mjs"`, where `` is `scripts/` beside it. diff --git a/.agents-docs/AGENTS-development-commands.md b/.agents-docs/AGENTS-development-commands.md index bd7de65..fb6ebe3 100644 --- a/.agents-docs/AGENTS-development-commands.md +++ b/.agents-docs/AGENTS-development-commands.md @@ -90,6 +90,7 @@ The same areas as one-command rows live in the [Test map](./AGENTS-test-map.md), | The launcher (`src/launcher/`) | `node --test scripts/test-launcher.mjs` | | A skill's script | `npm run build:skills`, then `node --test scripts/test-script-.mjs` (and `test-skill-scripts.mjs` for the shared plumbing) | | Dead Code (`src/plan2code-dead-code-scripts/`, `scripts/fixtures/dead-code/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-dead-code.mjs` | +| UI Prototype (`src/skill-scripts/ui-prototype*.mjs`, `src/plan2code-ui-prototype-references/`, `scripts/fixtures/ui-prototype/`) | `npm run build:skills`, then `node scripts/node-test.mjs scripts/test-script-ui-prototype.mjs scripts/test-ui-prototype-page.mjs` | | A workflow prompt (`src/plan2code-*.md`) | `node scripts/validate-char-count.js` and `node scripts/check-skill-table.mjs` | | A new skill or console workflow | First update the hand-written tables that list every workflow: the `SUBAGENT_WORKFLOWS` count and the meter's `WEIGHTS`, `LAUNCH_LABELS` and `RUN_LABELS` in `test-web-console-logic.mjs`, `notesFor` in `test-web-console-speed.mjs`, the event list in `src/web-console/console-meter.md` (checked by `test-web-console-chat-stress.mjs`) and a `BUDGETS.notes` entry in `test-console-wire-budgets.mjs`. Then run those four suites plus `test-web-console-skills.mjs` and `test-web-console-spec-states.mjs`; the PR Prep and Test build missed all five tables and only the full suite caught them | | Docs or comments only | `node --test scripts/test-us-english.mjs scripts/test-line-endings.mjs` | diff --git a/.agents-docs/AGENTS-test-map.md b/.agents-docs/AGENTS-test-map.md index 7222dc2..68caee5 100644 --- a/.agents-docs/AGENTS-test-map.md +++ b/.agents-docs/AGENTS-test-map.md @@ -8,6 +8,7 @@ Which checks cover which files, read by PR Prep and Test (`test-map.mjs read` ch | Activities games | `src/web-console/public/activities/**`, `src/web-console/public/tones.js`, `src/web-console/public/music.js` | `node --test scripts/test-web-console-tones.mjs scripts/test-web-console-activities.mjs` | no | | Launcher | `src/launcher/**` | `node --test scripts/test-launcher.mjs` | no | | Dead Code script | `src/plan2code-dead-code-scripts/**`, `scripts/fixtures/dead-code/**` | `npm run build:skills && node scripts/node-test.mjs scripts/test-script-dead-code.mjs` | no | +| UI Prototype script and shell | `src/skill-scripts/ui-prototype*.mjs`, `src/plan2code-ui-prototype-references/**`, `scripts/fixtures/ui-prototype/**` | `npm run build:skills && node scripts/node-test.mjs scripts/test-script-ui-prototype.mjs scripts/test-ui-prototype-page.mjs` | no | | Workflow prompts | `src/plan2code-*.md` | `node scripts/validate-char-count.js && node scripts/check-skill-table.mjs` | no | | Desktop app | `plan2code-app/**` | `cd plan2code-app && cargo test` | no | | Metrics | `plan2code-metrics/**` | `cd plan2code-metrics && npm test` | no | diff --git a/.readme/web-console.md b/.readme/web-console.md index a35f95f..c4ea114 100644 --- a/.readme/web-console.md +++ b/.readme/web-console.md @@ -55,7 +55,7 @@ Scroll down for the utilities. Outside a git repository the **Git** card says so - The utility cards: Get a PR ready, Write missing tests, Clear out dead code, Changelog, Git, which notes that the folder is not a git repository yet and offers to start one, and Handoff. + The utility cards: Get a PR ready, Write missing tests, Clear out dead code, Prototype a screen, Changelog, and Git, which notes that the folder is not a git repository yet and offers to start one. --- diff --git a/AGENTS.md b/AGENTS.md index fb12d7f..3e49984 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -36,7 +36,7 @@ Details: [Status line](./.agents-docs/AGENTS-architecture-statusline.md) ## Web Console -Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console//` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-.js`, and keeps a best per course, `activityBestGolf`), and one number a game may keep between sessions in `activityMemo` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, setup, Changelog, Git and Handoff) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the sixteen helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live in one list, `public/skills.js`, from which the meter, the resume command, Help's card list and the CLI's workflow list are derived; task files are read through `spec-files.mjs` (shared with the `specs.mjs` skill script), and the rule for which hops start the page clean is `startsClean()` in `public/hops.js`. The agent contract is a card plus pointers: `console.md` (the card) once per conversation, then a topic file (`console-*.md` such as `console-docs.md`, `notes/.md`, `building*.md`) only when the console names it in its own `read` output, once per session per topic (remembered in `pointers.json` in the session folder, owned by `pointers.mjs`); the console refuses the slips it can see (a `stop` with no `finish`, a `finish` while `stopWarning` is set, with `stop --force` for a dead page) instead of the docs repeating each rule. Byte budgets for the card, every notes file and a sample session's outputs run in `npm test` (`scripts/test-console-wire-budgets.mjs`). The server never writes into a project; the one thing it deletes there is an old `specs--completed/` the person picks in Cleanup, and only when git tracks it (an untracked one is refused, with the reason on the page). +Optional local browser UI (`src/web-console/`, zero dependencies, detached `node` server on `127.0.0.1`) installed once under `~/.plan2code/console//` (`installSharedConsole` in `install.js`) and reached from every skill through a forwarding stub, `src/web-console-stub/console.mjs`. The bare `plan2code` skill opens its dashboard, a card menu that launches any skill in the same session. Pages cover questions, sign-off gates (with an in-page code review), build progress, the living document, an **Ask** chat, a read-only **Workspace** of extra folders (remembered per folder and spec in `~/.plan2code/console/workspaces.json`), a session meter, a **git board** for the `git` workflow (three tabs, Changes, Branches and Sync, opening on the likely next step; branches, pull, push, commits and pull-request links, drawn from `state.git`; contract in `notes/git.md`), **Stop with a handoff** (handoffs live in `~/.plan2code/handoffs/`, owned by `handoffs.mjs`, swept after 30 days, and offered as dashboard chips to pick up in the same session), a private **Notebook** in the top bar (named tabs of Markdown and pictures, a live-preview CodeMirror editor, one notepad per folder in `~/.plan2code/notepads/`, owned by `notepads.mjs`, private: the agent reads a tab only when you start Pathfinder, Plan, Quick Task or Revise plan from the dashboard with it and send the box it fills (an idea box marked `fill: "note"`, up to five ticked pictures attached), which then marks the tab sent via `POST /notepad/tab/sent`; the agent CLI never imports the store; removed only through Cleanup once a month untouched), **Activities** behind the top bar's die (thirteen small games, Snake, Mini golf, Light Trails, Bug Hunt, Sunset Drive, Stack Deploy, Bumper Ring, Rapids Run, Hot Potato, Crossing Rush, Bounce Road, Ghoul Rush and Flock Dash, listed in `public/activities.js` with one module per game under `public/activities/` (Ghoul Rush is its own folder of modules, `public/activities/ghoul-rush/`) and a card line (`blurb`) each, a picker page of game cards once two are listed that plays one game at a time (another pick drops the last game's round), driven by `screens/activities.js` (keys, key releases for a game with `release()`, canvas pointer events for a game with `pointer()`, one frame timer), paused whenever the person's turn comes and resumed only by the person (while that pause's banner is up, only by its **Unpause game** button), best scores in flat `activityBest` keys in `looks.json` (lowest wins for a game that sets `lowerIsBetter`; Mini golf opens on a dashboard of its six 18-hole courses, one file each under `public/activities/golf-course-.js`, and keeps a best per course, `activityBestGolf`), and one number a game may keep between sessions in `activityMemo` (Snake's tally of surprises found, Light Trails' furthest arena, Bug Hunt's tally of finds, Sunset Drive's roads found, Stack Deploy's highest floor, Bumper Ring's furthest arena, Rapids Run's furthest dam, Hot Potato's furthest venue, Crossing Rush's furthest zone, Bounce Road's furthest stage, Ghoul Rush's most stages cleared in a run, Flock Dash's furthest stage), never shown to the agent), a built-in 21-topic Help, the app-only **Implementation Loop** (a dashboard card and a setup screen drawn by the page, `public/screens/loop-setup.js`; the last setup remembered per project in `~/.plan2code/console/loop-setup.json`, owned by `loop-setup.mjs`; a page that locks while `state.loop.driving` is set, until the app posts `loopEnd`; a skill run with `--loop` reports a `loopOutcome` instead of asking for sign-off, per `notes/loop.md`), a first-run Welcome, User Preferences (gear: four tabs, Appearance, Agents & models, System and Sounds & activities, on the `public/tabs.js` helper Help also uses, with `public/prefs.js`, `screens/prefs-dialog.js` and `screens/agents-view.js`), an agent-less **setup** page (the `setup` workflow `plan2code` or the desktop app opens when no agent can run: each built-in's found / outside-PATH / missing state from `agent-lookup.mjs`, install lines, Check again, Use it from here, starter templates and Start, which hands the tab to the new agent through a token-guarded `POST /handover` and a `move` event; the app shows it in its window from a Set up an agent button instead) and a bug/idea link to GitHub issues. On opted-in skills (every workflow but the dashboard, setup, Changelog, Git, Handoff and UI Prototype) a **Subagents** button in the top bar turns helpers on or off per project and skill (on by default for those skills until switched off, saved in `~/.plan2code/console/subagents.json`), and a Helper strength choice (Balanced, Thrifty, Best, Match my session; rules in `src/shared-references/helper-strength.md`, shipped in the sixteen helper skills); the agent hears of it as a standing instruction only when it changes, and reports its helpers in a **Subagents** tab beside Ask (contract in `console-subagents.md`). Per-skill facts live in one list, `public/skills.js`, from which the meter, the resume command, Help's card list and the CLI's workflow list are derived; task files are read through `spec-files.mjs` (shared with the `specs.mjs` skill script), and the rule for which hops start the page clean is `startsClean()` in `public/hops.js`. The agent contract is a card plus pointers: `console.md` (the card) once per conversation, then a topic file (`console-*.md` such as `console-docs.md`, `notes/.md`, `building*.md`) only when the console names it in its own `read` output, once per session per topic (remembered in `pointers.json` in the session folder, owned by `pointers.mjs`); the console refuses the slips it can see (a `stop` with no `finish`, a `finish` while `stopWarning` is set, with `stop --force` for a dead page) instead of the docs repeating each rule. Byte budgets for the card, every notes file and a sample session's outputs run in `npm test` (`scripts/test-console-wire-budgets.mjs`). The server never writes into a project; the one thing it deletes there is an old `specs--completed/` the person picks in Cleanup, and only when git tracks it (an untracked one is refused, with the reason on the page). One agent list and one lookup rule serve the launcher, the console and the app: `src/launcher/agents.json` (the built-ins and starter templates with per-OS install data) and `src/web-console/agent-lookup.mjs` (`loadAgentList()` and `findAgent()`, both copied by `install.js` into `~/.plan2code/bin/`); the app carries a Rust twin held to the same cases by `scripts/fixtures/agent-lookup-cases.json`. Building or changing an Activities game: follow the game rules in [Activities](./.agents-docs/AGENTS-architecture-activities.md) ("Building an Activities game": lives in the solid lives pill, the endless-lives code (`cheat(on)`) in every game with lives, banners placed away from the player and see-through over what matters, pausing left to the window). diff --git a/QUICK-REFERENCE.md b/QUICK-REFERENCE.md index 03fb369..763392b 100644 --- a/QUICK-REFERENCE.md +++ b/QUICK-REFERENCE.md @@ -51,6 +51,7 @@ Every command below is what a dashboard card runs. Typed on its own, each one as | pr-prep | /plan2code-pr-prep | Your branch | A readiness verdict (Ready, Ready with notes, Not ready) and a PR description to copy; no commits, no push | | test | /plan2code-test | An area, or none | New unit and integration tests in the project's style, run; a bug handed to Diagnose; no source changes | | dead-code | /plan2code-dead-code | A folder, or none | Findings labeled Safe, Check first or Warning, then only the removals you pick, checked by the tests and build; no commits, no installs | +| ui-prototype | /plan2code-ui-prototype | A screen or flow, or none | One page of several versions with live dials, your pick pasted back; `prototypes/.html` and `.md` in a spec on a yes; no code changes | | changelog | /plan2code-changelog | Your branch | `CHANGELOG.md` entries and the `package.json` version, from the default branch's latest version | | git | /plan2code-git | Your repo | Commits (`` / `AI Assisted`), branches, pull with conflict help, push, publish | diff --git a/README.md b/README.md index d49eb0e..bd6ec3d 100644 --- a/README.md +++ b/README.md @@ -260,9 +260,12 @@ The dashboard's cards, and when each one lights up for the spec you pick: | Get a PR ready | Runs the checks your branch needs, says if it is ready, and writes the PR description to copy. Never commits, pushes or opens the PR. | Always | | Write missing tests | Finds code with no tests and writes unit and integration tests in your project's own style. Never changes source code. | Always | | Clear out dead code | Finds code nothing uses, says how safe each piece is to remove, and removes only what you pick. Uses the dead-code tools your project already has, and never commits. | Always | +| Prototype a screen | Several versions of a screen on one page, tuned with live dials, and your pick brought back by Copy and paste. Saved into a spec only when you say, and never changes your code. | Always (takes the picked spec as the save folder) | | Changelog | Checks the CHANGELOG version against the main branch and suggests entries for what is new. | Always | | Git | Branches, pull, push and commits on one board, asking before anything leaves your machine. | Always (offers to start a repository outside one) | +Pathfinder, Plan, Revise the plan and Quick task can each offer a prototype when a decision is about how a screen looks or flows, and run it right there in the same session; nothing is drawn without your yes. + --- ## The four rules that do most of the work @@ -433,6 +436,7 @@ console or the terminal; add `--web` to skip the question and go straight to the | `/plan2code-pr-prep` | Before you open a pull request. Picks the checks the branch's changes need from the project's `## Test map` (or its config files), runs the ones you keep, says Ready, Ready with notes or Not ready, and writes a PR description to copy with the create-a-PR link; never commits, pushes or opens the PR | | `/plan2code-test` | Parts of the code have no tests. Asks where to look, finds the untested files (plus real coverage when the project already has a coverage tool), shows a plan in the project's own style, then writes and runs unit and integration tests; never changes source code, hands a real bug to `/plan2code-diagnose` | | `/plan2code-dead-code` | Code nothing calls anymore. Uses the project's own dead-code tools, one per language (Knip, vulture, cargo check and others), or searches by itself, checks every item for callers across the project, labels each Safe to remove, Check first or Warning, removes only what you pick, then runs the tests and build and puts back anything that breaks them; never commits, never installs anything | +| `/plan2code-ui-prototype` | See a screen before it gets built. Draws several versions of a screen or flow on one page that opens in your browser, with live dials for fonts, colors, spacing and feel; Copy and paste brings your pick back for the next round, and a yes saves it as `specs//prototypes/.html` and `.md`; never changes your code | | `/plan2code-changelog` | Check the CHANGELOG version against the default branch, suggest entries for new work you can edit, keep `package.json` aligned, then hand off to Git to commit | | `/plan2code-git` | Branches, pull, push and commits on one board (or plain instructions in the terminal); asks before every push, publish and delete | diff --git a/docs/index.html b/docs/index.html index 1a27c5e..b6ee833 100644 --- a/docs/index.html +++ b/docs/index.html @@ -641,6 +641,7 @@ footer .brand { margin-right: auto; }

And a drawer of skills for any time

Each one is a card on the dashboard and a command in the terminal.

    +
  • /plan2code-ui-prototypeSeveral versions of a screen on one page, tuned with live dials; never changes your code.
  • /plan2code-quick-taskToo small for the full process: a quick plan, then it builds.
  • /plan2code-diagnoseFinds a bug's cause and writes it up, without fixing it.
  • /plan2code-xrayExplains how and why an area of the code works.
  • diff --git a/docs/screenshots/dashboard-utilities-dark.webp b/docs/screenshots/dashboard-utilities-dark.webp index 3b5ad33..dcb7698 100644 Binary files a/docs/screenshots/dashboard-utilities-dark.webp and b/docs/screenshots/dashboard-utilities-dark.webp differ diff --git a/docs/screenshots/dashboard-utilities-light.webp b/docs/screenshots/dashboard-utilities-light.webp index cbbff57..8b28e9d 100644 Binary files a/docs/screenshots/dashboard-utilities-light.webp and b/docs/screenshots/dashboard-utilities-light.webp differ diff --git a/install.js b/install.js index e2d2f06..80ccbc2 100644 --- a/install.js +++ b/install.js @@ -180,9 +180,15 @@ const SOURCE_PROMPTS = [ name: 'pathfinder', displayName: 'Pathfinder Mode', description: 'charting of a foggy idea as a map of decision questions, cleared one at a time', + // ui-prototype.md rides along (with its references, shell and scripts) for the + // offer of a UI prototype, which runs in the same conversation; every carried + // name starts with ui-prototype so none collides with this skill's own files. + scripts: ['ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'], additionalReferences: [ { source: 'web-console', target: 'web-console' }, - { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } + { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }, + { source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' }, + { source: 'plan2code-ui-prototype-references' } ] }, { @@ -194,7 +200,10 @@ const SOURCE_PROMPTS = [ isUtility: true, // review.md rides along for the web console's "Review it now" button, which // runs the review in the same session once the quick task is built. - scripts: ['specs.mjs', 'commit-msg.mjs', 'review-scope.mjs', 'glob.mjs', 'test-map.mjs', 'test-match.mjs', 'run-check.mjs'], + // ui-prototype.md rides along (with its references, shell and scripts) for the + // offer of a UI prototype, which runs in the same conversation; every carried + // name starts with ui-prototype so none collides with this skill's own files. + scripts: ['specs.mjs', 'commit-msg.mjs', 'review-scope.mjs', 'glob.mjs', 'test-map.mjs', 'test-match.mjs', 'run-check.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'], additionalReferences: [ { source: 'web-console', target: 'web-console' }, { source: 'shared-references/building-habits.md', target: 'building-habits.md' }, @@ -202,7 +211,9 @@ const SOURCE_PROMPTS = [ { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }, { source: 'shared-references/test-runs.md', target: 'test-runs.md' }, { source: 'plan2code-review.md', target: 'review.md' }, - { source: 'plan2code-review-references' } + { source: 'plan2code-review-references' }, + { source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' }, + { source: 'plan2code-ui-prototype-references' } ] }, { @@ -211,10 +222,15 @@ const SOURCE_PROMPTS = [ name: 'plan', displayName: 'Planning Mode', description: 'Requirements analysis and architecture design', - scripts: ['specs.mjs'], + // ui-prototype.md rides along (with its references, shell and scripts) for the + // offer of a UI prototype, which runs in the same conversation; every carried + // name starts with ui-prototype so none collides with this skill's own files. + scripts: ['specs.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'], additionalReferences: [ { source: 'web-console', target: 'web-console' }, - { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } + { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }, + { source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' }, + { source: 'plan2code-ui-prototype-references' } ] }, { @@ -223,10 +239,15 @@ const SOURCE_PROMPTS = [ name: 'revise-plan', displayName: 'Revision Mode', description: 'Modify specs mid-implementation when requirements change', - scripts: ['specs.mjs'], + // ui-prototype.md rides along (with its references, shell and scripts) for the + // offer of a UI prototype, which runs in the same conversation; every carried + // name starts with ui-prototype so none collides with this skill's own files. + scripts: ['specs.mjs', 'ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'], additionalReferences: [ { source: 'web-console', target: 'web-console' }, - { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' } + { source: 'shared-references/helper-strength.md', target: 'helper-strength.md' }, + { source: 'plan2code-ui-prototype.md', target: 'ui-prototype.md' }, + { source: 'plan2code-ui-prototype-references' } ] }, { @@ -411,6 +432,18 @@ const SOURCE_PROMPTS = [ { source: 'plan2code-review-references' } ] }, + { + source: 'plan2code-ui-prototype.md', + stepNumber: 'ui-prototype', + name: 'ui-prototype', + displayName: 'UI Prototype Mode', + description: 'Draw several versions of a screen or flow on one page, tune them with live dials, and bring the choice back', + // Shown to the agent in place of the generic header text: when the skill fits and its command. + skillDescription: "Use when you want to see several versions of a screen or flow, tune them with live dials and bring your choice back. Run it as /plan2code-ui-prototype.", + isUtility: true, + scripts: ['ui-prototype.mjs', 'ui-prototype-round.mjs', 'ui-prototype-page.mjs', 'ui-prototype-drafts.mjs', 'ui-prototype-block.mjs'], + additionalReferences: [{ source: 'web-console', target: 'web-console' }] + }, { source: 'plan2code-changelog.md', stepNumber: 'changelog', @@ -464,6 +497,7 @@ function generateStepLabel(prompt) { if (prompt.stepNumber === 'pr-prep') return 'PR Prep'; if (prompt.stepNumber === 'test') return 'Test'; if (prompt.stepNumber === 'dead-code') return 'Dead Code'; + if (prompt.stepNumber === 'ui-prototype') return 'UI Prototype'; if (prompt.stepNumber === 'changelog') return 'Changelog'; if (prompt.stepNumber === 'quick') return 'Quick Task'; return `Step ${prompt.stepNumber}`; diff --git a/package.json b/package.json index 17749aa..a6b3f23 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "play": "node scripts/play.mjs", "pretest": "node scripts/fix-line-endings.mjs", "test:fast": "node scripts/test-fast.mjs", - "test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-dead-code.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-spec-carry.mjs scripts/test-spec-carry-page.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-standalone-check.mjs scripts/test-check-versions.mjs scripts/test-app-meter.mjs scripts/test-check-test-lanes.mjs scripts/test-check-doc-size.mjs scripts/test-set-version.mjs scripts/test-console-stub.mjs scripts/test-check-prompt-wording.mjs scripts/test-check-console-openings.mjs" + "test": "node scripts/check-test-lanes.mjs && node scripts/validate-char-count.js && node install.js --build-skills && node scripts/check-versions.mjs && node scripts/check-doc-size.mjs && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node scripts/check-prompt-wording.mjs && node scripts/check-console-openings.mjs && node scripts/node-test.mjs scripts/test-line-endings.mjs scripts/test-us-english.mjs scripts/test-script-git.mjs scripts/test-git-repo.mjs scripts/test-skill-scripts.mjs scripts/test-script-test-map.mjs scripts/test-script-test-match.mjs scripts/test-script-test-commands.mjs scripts/test-script-run-check.mjs scripts/test-script-pr-prep.mjs scripts/test-script-dead-code.mjs scripts/test-script-ui-prototype.mjs scripts/test-script-coverage.mjs scripts/test-script-changelog.mjs scripts/test-web-console-git.mjs scripts/test-web-console-git-board.mjs scripts/test-web-console-chat.mjs scripts/test-web-console-subagents.mjs scripts/test-web-console-pointers.mjs scripts/test-console-wire-budgets.mjs scripts/test-web-console-speed.mjs scripts/test-web-console-qa.mjs scripts/test-web-console-concurrency.mjs scripts/test-web-console-workspace.mjs scripts/test-web-console-lifecycle.mjs scripts/test-web-console-chat-stress.mjs scripts/test-web-console-server.mjs scripts/test-web-console-session.mjs scripts/test-web-console-logic.mjs scripts/test-web-console-agents-doc.mjs scripts/test-web-console-activities.mjs scripts/test-web-console-activities-rapids.mjs scripts/test-web-console-activities-flock.mjs scripts/test-web-console-activities-bounce.mjs scripts/test-web-console-activities-bounce-game.mjs scripts/test-web-console-activities-ghoul.mjs scripts/test-web-console-activities-ghoul-graveyard.mjs scripts/test-web-console-activities-ghoul-grounds.mjs scripts/test-web-console-activities-ghoul-chapel.mjs scripts/test-web-console-activities-ghoul-sanatorium.mjs scripts/test-web-console-activities-ghoul-village.mjs scripts/test-web-console-activities-ghoul-mine.mjs scripts/test-web-console-activities-ghoul-carnival.mjs scripts/test-web-console-activities-ghoul-frozen.mjs scripts/test-web-console-activities-ghoul-bog.mjs scripts/test-web-console-activities-ghoul-lantern.mjs scripts/test-web-console-activities-ghoul-marrow.mjs scripts/test-web-console-activities-ghoul-mat.mjs scripts/test-web-console-activities-ghoul-eye.mjs scripts/test-web-console-activities-ghoul-bonestair.mjs scripts/test-web-console-activities-ghoul-heart.mjs scripts/test-web-console-activities-ghoul-ending.mjs scripts/test-web-console-activities-ghoul-ride.mjs scripts/test-web-console-activities-ghoul-cart.mjs scripts/test-web-console-activities-ghoul-sled.mjs scripts/test-web-console-activities-ghoul-banister.mjs scripts/test-web-console-activities-ghoul-gurney.mjs scripts/test-web-console-activities-ghoul-hearse.mjs scripts/test-web-console-activities-ghoul-wagon.mjs scripts/test-web-console-activities-ghoul-pew.mjs scripts/test-web-console-activities-ghoul-mower.mjs scripts/test-web-console-activities-ghoul-tray.mjs scripts/test-web-console-activities-ghoul-arms.mjs scripts/test-web-console-activities-ghoul-dice.mjs scripts/test-web-console-activities-ghoul-gameover.mjs scripts/test-web-console-activities-ghoul-intro.mjs scripts/test-web-console-activities-ghoul-bossintro.mjs scripts/test-web-console-activities-ghoul-story.mjs scripts/test-web-console-activities-ghoul-bones.mjs scripts/test-web-console-activities-ghoul-retry.mjs scripts/test-web-console-activities-bounce-cars.mjs scripts/test-web-console-tones.mjs scripts/test-web-console-skills.mjs scripts/test-web-console-spec-states.mjs scripts/test-spec-carry.mjs scripts/test-spec-carry-page.mjs scripts/test-web-console-state.mjs scripts/test-web-console-send-state.mjs scripts/test-web-console-strengths.mjs scripts/test-web-console-shape.mjs scripts/test-script-pathfinder.mjs scripts/test-skill-test-runs.mjs scripts/test-launcher.mjs scripts/test-agents-file.mjs scripts/test-agent-lookup.mjs scripts/test-web-console-source.mjs scripts/test-web-console-hardening.mjs scripts/test-web-console-embed.mjs scripts/test-web-console-in-app.mjs scripts/test-web-console-loop.mjs scripts/test-web-console-handoffs.mjs scripts/test-web-console-notepad.mjs scripts/test-script-xray.mjs scripts/test-script-finalize.mjs scripts/test-getting-started.mjs scripts/test-install-update.mjs scripts/test-browser-helper.mjs scripts/test-web-console-page-cards.mjs scripts/test-web-console-page-dashboard.mjs scripts/test-web-console-page-session.mjs scripts/test-web-console-page-ask.mjs scripts/test-web-console-page-workspace.mjs scripts/test-web-console-page-help.mjs scripts/test-web-console-page-prefs.mjs scripts/test-web-console-page-git.mjs scripts/test-web-console-page-notepad.mjs scripts/test-web-console-page-send.mjs scripts/test-web-console-page-loop.mjs scripts/test-web-console-page-activities.mjs scripts/test-web-console-page-setup.mjs scripts/test-ui-prototype-page.mjs scripts/test-standalone-check.mjs scripts/test-check-versions.mjs scripts/test-app-meter.mjs scripts/test-check-test-lanes.mjs scripts/test-check-doc-size.mjs scripts/test-set-version.mjs scripts/test-console-stub.mjs scripts/test-check-prompt-wording.mjs scripts/test-check-console-openings.mjs" }, "devDependencies": { "gpt-tokenizer": "2.9.0", diff --git a/scripts/check-console-openings.mjs b/scripts/check-console-openings.mjs index b965fb0..374eb4c 100644 --- a/scripts/check-console-openings.mjs +++ b/scripts/check-console-openings.mjs @@ -76,7 +76,7 @@ export function check(srcDir) { if (!note) problems.push(`${file}: names no /notes/.md file`); else if (!fs.existsSync(path.join(notesDir, `${note[1]}.md`))) problems.push(`${file}: notes file ${note[1]}.md is not in src/web-console/notes/`); } - if (seen !== 19) problems.push(`expected 19 skills with a console opening, found ${seen}`); + if (seen !== 20) problems.push(`expected 20 skills with a console opening, found ${seen}`); return problems; } @@ -87,5 +87,5 @@ if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.me for (const p of problems) console.error(` FAIL ${p}`); process.exit(1); } - console.log("All 19 console openings share their sentences."); + console.log("All 20 console openings share their sentences."); } diff --git a/scripts/fixtures/ui-prototype/bad-length-missing/round.json b/scripts/fixtures/ui-prototype/bad-length-missing/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-length-missing/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-length-missing/variant-a.html b/scripts/fixtures/ui-prototype/bad-length-missing/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-length-missing/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-length-missing/variant-b.html b/scripts/fixtures/ui-prototype/bad-length-missing/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-length-missing/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-length-missing/variant-c.html b/scripts/fixtures/ui-prototype/bad-length-missing/variant-c.html new file mode 100644 index 0000000..6bf4141 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-length-missing/variant-c.html @@ -0,0 +1,18 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-outside-link/round.json b/scripts/fixtures/ui-prototype/bad-outside-link/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-outside-link/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-outside-link/variant-a.html b/scripts/fixtures/ui-prototype/bad-outside-link/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-outside-link/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-outside-link/variant-b.html b/scripts/fixtures/ui-prototype/bad-outside-link/variant-b.html new file mode 100644 index 0000000..2bfcaa8 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-outside-link/variant-b.html @@ -0,0 +1,22 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-outside-link/variant-c.html b/scripts/fixtures/ui-prototype/bad-outside-link/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-outside-link/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/round.json b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-a.html b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-b.html b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/missing-variant-file/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/round.json b/scripts/fixtures/ui-prototype/bad-round/six-variants/round.json new file mode 100644 index 0000000..ffb6dfb --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/round.json @@ -0,0 +1,107 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": [ + "colors", + "fonts", + "spacing" + ], + "freed": [ + "components" + ], + "notFound": [ + "layout" + ], + "variants": [ + { + "letter": "A", + "name": "Variant A", + "file": "variant-a.html", + "what": "One of six", + "starts": {} + }, + { + "letter": "B", + "name": "Variant B", + "file": "variant-b.html", + "what": "One of six", + "starts": {} + }, + { + "letter": "C", + "name": "Variant C", + "file": "variant-c.html", + "what": "One of six", + "starts": {} + }, + { + "letter": "D", + "name": "Variant D", + "file": "variant-d.html", + "what": "One of six", + "starts": {} + }, + { + "letter": "E", + "name": "Variant E", + "file": "variant-e.html", + "what": "One of six", + "starts": {} + }, + { + "letter": "F", + "name": "Variant F", + "file": "variant-f.html", + "what": "One of six", + "starts": {} + } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { + "name": "shadows", + "label": "Shadows", + "type": "pick", + "choices": [ + "none", + "soft", + "strong" + ], + "start": "soft", + "look": true + }, + { + "name": "columns", + "label": "Columns", + "type": "slider", + "min": 1, + "max": 4, + "step": 1, + "start": 2, + "look": false + }, + { + "name": "dividers", + "label": "Row dividers", + "type": "toggle", + "start": true, + "look": true + } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-a.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-b.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-c.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-d.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-d.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-d.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-e.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-e.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-e.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-f.html b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-f.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/six-variants/variant-f.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/round.json b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/round.json new file mode 100644 index 0000000..b9eb083 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/round.json @@ -0,0 +1,92 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": [ + "colors", + "fonts", + "spacing" + ], + "freed": [ + "components" + ], + "notFound": [ + "layout" + ], + "variants": [ + { + "letter": "A", + "name": "Dense table", + "file": "variant-a.html", + "what": "A table with overdue rows tinted", + "starts": { + "radius": 4 + } + }, + { + "letter": "B", + "name": "Split view", + "file": "variant-b.html", + "what": "A list on the left, the open invoice on the right", + "starts": { + "radius": 10 + } + }, + { + "letter": "C", + "name": "Cards", + "file": "variant-c.html", + "what": "One card per invoice, overdue ones first", + "starts": { + "radius": 16 + } + } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "Comic Sans", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { + "name": "shadows", + "label": "Shadows", + "type": "pick", + "choices": [ + "none", + "soft", + "strong" + ], + "start": "soft", + "look": true + }, + { + "name": "columns", + "label": "Columns", + "type": "slider", + "min": 1, + "max": 4, + "step": 1, + "start": 2, + "look": false + }, + { + "name": "dividers", + "label": "Row dividers", + "type": "toggle", + "start": true, + "look": true + } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-a.html b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-b.html b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-c.html b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-round/unknown-font-set/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-script/round.json b/scripts/fixtures/ui-prototype/bad-script/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-script/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-script/variant-a.html b/scripts/fixtures/ui-prototype/bad-script/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-script/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-script/variant-b.html b/scripts/fixtures/ui-prototype/bad-script/variant-b.html new file mode 100644 index 0000000..9eb1c67 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-script/variant-b.html @@ -0,0 +1,22 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    + +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-script/variant-c.html b/scripts/fixtures/ui-prototype/bad-script/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-script/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-state-missing/round.json b/scripts/fixtures/ui-prototype/bad-state-missing/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-state-missing/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-state-missing/variant-a.html b/scripts/fixtures/ui-prototype/bad-state-missing/variant-a.html new file mode 100644 index 0000000..7fb9288 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-state-missing/variant-a.html @@ -0,0 +1,22 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-state-missing/variant-b.html b/scripts/fixtures/ui-prototype/bad-state-missing/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-state-missing/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-state-missing/variant-c.html b/scripts/fixtures/ui-prototype/bad-state-missing/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-state-missing/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-step-missing/round.json b/scripts/fixtures/ui-prototype/bad-step-missing/round.json new file mode 100644 index 0000000..0375411 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-step-missing/round.json @@ -0,0 +1,29 @@ +{ + "name": "signup-flow", + "round": 1, + "kind": "flow", + "request": "The three screens of signing up: account, team, done.", + "direction": "", + "carried": ["colors", "fonts", "spacing", "components", "layout"], + "freed": [], + "notFound": [], + "variants": [ + { "letter": "A", "name": "Single column", "file": "variant-a.html", "what": "One centered form per step", "starts": {} }, + { "letter": "B", "name": "Side rail", "file": "variant-b.html", "what": "Steps listed in a rail beside each form", "starts": {} } + ], + "starts": { + "screen": "Phone 390", + "theme": "dark", + "accent": "#1a7f37", + "neutral": "#5b6170", + "fontSet": "Humanist", + "textSize": 15, + "space": 1.25, + "radius": 12, + "state": "ready", + "length": "typical" + }, + "extras": [], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-step-missing/variant-a.html b/scripts/fixtures/ui-prototype/bad-step-missing/variant-a.html new file mode 100644 index 0000000..78d945f --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-step-missing/variant-a.html @@ -0,0 +1,21 @@ + +
    +

    Join

    +

    Create your account

    +

    Create your account to start tracking the invoices of every customer you bill

    +

    Email and a password.

    +

    Start with your work email.

    +

    Checking...

    +

    That email is already taken.

    + +
    +
    +

    Invite your team

    + +
    +
    +

    You are all set

    +
    diff --git a/scripts/fixtures/ui-prototype/bad-step-missing/variant-b.html b/scripts/fixtures/ui-prototype/bad-step-missing/variant-b.html new file mode 100644 index 0000000..8505a0a --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-step-missing/variant-b.html @@ -0,0 +1,14 @@ + +
    +

    Join

    +

    Create your account

    +

    Create your account to start tracking the invoices of every customer you bill

    +

    Email and a password.

    +

    Start with your work email.

    +

    Checking...

    +

    That email is already taken.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-value-unused/round.json b/scripts/fixtures/ui-prototype/bad-value-unused/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-value-unused/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/bad-value-unused/variant-a.html b/scripts/fixtures/ui-prototype/bad-value-unused/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-value-unused/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/bad-value-unused/variant-b.html b/scripts/fixtures/ui-prototype/bad-value-unused/variant-b.html new file mode 100644 index 0000000..8437075 --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-value-unused/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/bad-value-unused/variant-c.html b/scripts/fixtures/ui-prototype/bad-value-unused/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/bad-value-unused/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/blocks/edited.txt b/scripts/fixtures/ui-prototype/blocks/edited.txt new file mode 100644 index 0000000..154b939 --- /dev/null +++ b/scripts/fixtures/ui-prototype/blocks/edited.txt @@ -0,0 +1,21 @@ +``` +Plan2Code UI prototype choice +Prototype: invoices-screen +Round: 2 +File: +Chosen: C "Cards" (others: A "Dense table", B "Split view") +Carried over: colors, fonts, spacing +Freed up: components, layout +Screen size: Phone 390 (changed from Desktop 1280) +Theme: Light +Accent color: #d9480f (changed from #2f6fed) +Neutral color: #6b7280 +Font set: System UI +Text size: 16px +Spacing: 1 +Corners: 16px (changed from 8px) +State: Empty (changed from Ready) +Content length: Long (changed from Typical) +Mood: warmer, like the old app +Note: keep the overdue badge +``` diff --git a/scripts/fixtures/ui-prototype/blocks/not-a-block.txt b/scripts/fixtures/ui-prototype/blocks/not-a-block.txt new file mode 100644 index 0000000..520c1a5 --- /dev/null +++ b/scripts/fixtures/ui-prototype/blocks/not-a-block.txt @@ -0,0 +1,3 @@ +I like the second one best, but with a darker header. +Theme: Dark +Spacing: 1.25 diff --git a/scripts/fixtures/ui-prototype/blocks/screen.txt b/scripts/fixtures/ui-prototype/blocks/screen.txt new file mode 100644 index 0000000..42959db --- /dev/null +++ b/scripts/fixtures/ui-prototype/blocks/screen.txt @@ -0,0 +1,21 @@ +Plan2Code UI prototype choice +Prototype: invoices-screen +File: +Round: 2 +Chosen: B "Split view" (others: A "Dense table", C "Cards") +Carried over: colors, fonts, spacing +Freed up: components, layout +Direction: calmer, more room around totals +Preset: Airy +Screen size: Desktop 1280 +Theme: Dark (changed from Light) +Accent color: #2f6fed +Neutral color: #6b7280 +Font set: Humanist (changed from System UI) +Text size: 16px +Spacing: 1.25 (changed from 1) +Corners: 8px +State: Ready +Content length: Typical +Extra, Shadows: Soft +Note: header from A with these cards diff --git a/scripts/fixtures/ui-prototype/blocks/terminal.txt b/scripts/fixtures/ui-prototype/blocks/terminal.txt new file mode 100644 index 0000000..cc14eb1 --- /dev/null +++ b/scripts/fixtures/ui-prototype/blocks/terminal.txt @@ -0,0 +1,13 @@ +Plan2Code UI prototype choice +Prototype: deploy-status +File: +Round: 1 +Chosen: A "Progress lines" (others: B "Table") +Carried over: none +Freed up: none +Window size: 80x24 (changed from 120x30) +Theme: Dark +Palette: Ocean (changed from Graphite) +Density: 1.5 (changed from 1.4) +State: Ready +Content length: Typical diff --git a/scripts/fixtures/ui-prototype/contract-example/round.json b/scripts/fixtures/ui-prototype/contract-example/round.json new file mode 100644 index 0000000..735cfb4 --- /dev/null +++ b/scripts/fixtures/ui-prototype/contract-example/round.json @@ -0,0 +1,29 @@ +{ + "name": "team-members", + "round": 1, + "kind": "screen", + "request": "A screen listing the people on a team, with a way to invite someone.", + "direction": "", + "carried": ["colors", "fonts", "spacing", "components"], + "freed": ["layout"], + "notFound": [], + "variants": [ + { "letter": "A", "name": "Plain list", "file": "variant-a.html", "what": "One row per person, role on the right", "starts": {} }, + { "letter": "B", "name": "Card grid", "file": "variant-b.html", "what": "One card per person, invite as the last card", "starts": {} } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#0f766e", + "neutral": "#64748b", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/contract-example/variant-a.html b/scripts/fixtures/ui-prototype/contract-example/variant-a.html new file mode 100644 index 0000000..31d7b70 --- /dev/null +++ b/scripts/fixtures/ui-prototype/contract-example/variant-a.html @@ -0,0 +1,27 @@ + +
    +

    Team members

    +
      +
    • + Ana Ruiz + Ana Ruiz-Okafor + Anastasia Ruiz-Okafor, Regional Accounts Lead, Northern Office + Admin +
    • +
    • Tomas BergEditor
    • +
    +
    +

    No one else is on this team yet. Invite a teammate to share the work.

    +

    The team list did not load. Check your connection, then reload this page.

    + +
    diff --git a/scripts/fixtures/ui-prototype/contract-example/variant-b.html b/scripts/fixtures/ui-prototype/contract-example/variant-b.html new file mode 100644 index 0000000..1c13c79 --- /dev/null +++ b/scripts/fixtures/ui-prototype/contract-example/variant-b.html @@ -0,0 +1,19 @@ + +
    +
    + Ana Ruiz + Ana Ruiz-Okafor + Anastasia Ruiz-Okafor, Regional Accounts Lead, Northern Office +

    Admin since March 2024

    +
    +
    Tomas Berg

    Editor since June 2025

    +

    Loading team members…

    +

    Just you so far. Invite a teammate to share the work.

    +

    The team did not load. Check your connection, then reload.

    +
    Invite a teammate
    +
    diff --git a/scripts/fixtures/ui-prototype/good-flow/expected-block.txt b/scripts/fixtures/ui-prototype/good-flow/expected-block.txt new file mode 100644 index 0000000..24df226 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-flow/expected-block.txt @@ -0,0 +1,20 @@ +Plan2Code UI prototype choice +Prototype: signup-flow +File: +Round: 1 +Chosen: A "Single column" (others: B "Side rail") +Carried over: colors, fonts, spacing, components, layout +Freed up: none +Preset: Compact +Screen size: Tablet 820 (changed from Phone 390) +Theme: Dark +Accent color: #1a7f37 +Neutral color: #5b6170 +Font set: Humanist +Text size: 14px (changed from 15px) +Spacing: 0.75 (changed from 1.25) +Corners: 4px (changed from 12px) +State: Empty (changed from Ready) +Content length: Typical +Extra, Progress bar: Off (changed from On) +Note: keep the rail diff --git a/scripts/fixtures/ui-prototype/good-flow/round.json b/scripts/fixtures/ui-prototype/good-flow/round.json new file mode 100644 index 0000000..0375411 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-flow/round.json @@ -0,0 +1,29 @@ +{ + "name": "signup-flow", + "round": 1, + "kind": "flow", + "request": "The three screens of signing up: account, team, done.", + "direction": "", + "carried": ["colors", "fonts", "spacing", "components", "layout"], + "freed": [], + "notFound": [], + "variants": [ + { "letter": "A", "name": "Single column", "file": "variant-a.html", "what": "One centered form per step", "starts": {} }, + { "letter": "B", "name": "Side rail", "file": "variant-b.html", "what": "Steps listed in a rail beside each form", "starts": {} } + ], + "starts": { + "screen": "Phone 390", + "theme": "dark", + "accent": "#1a7f37", + "neutral": "#5b6170", + "fontSet": "Humanist", + "textSize": 15, + "space": 1.25, + "radius": 12, + "state": "ready", + "length": "typical" + }, + "extras": [], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/good-flow/variant-a.html b/scripts/fixtures/ui-prototype/good-flow/variant-a.html new file mode 100644 index 0000000..78d945f --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-flow/variant-a.html @@ -0,0 +1,21 @@ + +
    +

    Join

    +

    Create your account

    +

    Create your account to start tracking the invoices of every customer you bill

    +

    Email and a password.

    +

    Start with your work email.

    +

    Checking...

    +

    That email is already taken.

    + +
    +
    +

    Invite your team

    + +
    +
    +

    You are all set

    +
    diff --git a/scripts/fixtures/ui-prototype/good-flow/variant-b.html b/scripts/fixtures/ui-prototype/good-flow/variant-b.html new file mode 100644 index 0000000..068d7e2 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-flow/variant-b.html @@ -0,0 +1,21 @@ + +
    +

    Join

    +

    Create your account

    +

    Create your account to start tracking the invoices of every customer you bill

    +

    Email and a password.

    +

    Start with your work email.

    +

    Checking...

    +

    That email is already taken.

    + +
    +
    +

    Invite your team

    + +
    +
    +

    You are all set

    +
    diff --git a/scripts/fixtures/ui-prototype/good-screen/expected-block.txt b/scripts/fixtures/ui-prototype/good-screen/expected-block.txt new file mode 100644 index 0000000..ad7b0c6 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-screen/expected-block.txt @@ -0,0 +1,23 @@ +Plan2Code UI prototype choice +Prototype: invoices-screen +File: +Round: 1 +Chosen: B "Split view" (others: A "Dense table", C "Cards") +Carried over: colors, fonts, spacing +Freed up: components +Direction: calm, plenty of room around totals +Preset: Airy +Screen size: Desktop 1280 +Theme: Dark (changed from Light) +Accent color: #d9480f (changed from #2f6fed) +Neutral color: #6b7280 +Font set: System UI +Text size: 17px (changed from 16px) +Spacing: 1.5 (changed from 1) +Corners: 12px (changed from 10px) +State: Ready +Content length: Typical +Extra, Shadows: strong (changed from soft) +Extra, Columns: 2 +Extra, Row dividers: On +Note: header from A with these cards diff --git a/scripts/fixtures/ui-prototype/good-screen/round.json b/scripts/fixtures/ui-prototype/good-screen/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-screen/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/good-screen/variant-a.html b/scripts/fixtures/ui-prototype/good-screen/variant-a.html new file mode 100644 index 0000000..785d13e --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-screen/variant-a.html @@ -0,0 +1,23 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    diff --git a/scripts/fixtures/ui-prototype/good-screen/variant-b.html b/scripts/fixtures/ui-prototype/good-screen/variant-b.html new file mode 100644 index 0000000..24ad8c6 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-screen/variant-b.html @@ -0,0 +1,22 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/good-screen/variant-c.html b/scripts/fixtures/ui-prototype/good-screen/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-screen/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/good-terminal/expected-block.txt b/scripts/fixtures/ui-prototype/good-terminal/expected-block.txt new file mode 100644 index 0000000..31b0d4b --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-terminal/expected-block.txt @@ -0,0 +1,17 @@ +Plan2Code UI prototype choice +Prototype: deploy-status +File: +Round: 2 +Chosen: A "Progress lines" (others: B "Table") +Carried over: none +Freed up: none +Direction: quiet unless something fails +Preset: Bold +Window size: 80x24 (changed from 120x30) +Theme: Dark +Palette: Ocean (changed from Graphite) +Density: 1.5 (changed from 1.4) +State: Ready +Content length: Typical +Extra, Spinner: line (changed from dots) +Note: fewer lines while it runs diff --git a/scripts/fixtures/ui-prototype/good-terminal/round.json b/scripts/fixtures/ui-prototype/good-terminal/round.json new file mode 100644 index 0000000..87a2538 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-terminal/round.json @@ -0,0 +1,25 @@ +{ + "name": "deploy-status", + "round": 2, + "kind": "terminal", + "request": "What the deploy command prints while it runs.", + "direction": "quiet unless something fails", + "carried": [], + "freed": [], + "notFound": ["colors", "fonts", "spacing", "components", "layout"], + "variants": [ + { "letter": "A", "name": "Progress lines", "file": "variant-a.html", "what": "One line per step with a check mark", "starts": {} }, + { "letter": "B", "name": "Table", "file": "variant-b.html", "what": "A live table of services and their state", "starts": { "palette": "Amber" } } + ], + "starts": { + "window": "120x30", + "theme": "dark", + "palette": "Graphite", + "density": 1.4, + "state": "ready", + "length": "typical" + }, + "extras": [], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/good-terminal/variant-a.html b/scripts/fixtures/ui-prototype/good-terminal/variant-a.html new file mode 100644 index 0000000..d2d73d7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-terminal/variant-a.html @@ -0,0 +1,7 @@ + +
    deploy apiapi-gatewayapi-gateway-northern-region-billing-service-primary-cluster
    +ok  build    12s
    +ok  upload    4snothing to deploywaiting for the build...failed: upload timed out (try again with --retry)
    diff --git a/scripts/fixtures/ui-prototype/good-terminal/variant-b.html b/scripts/fixtures/ui-prototype/good-terminal/variant-b.html new file mode 100644 index 0000000..974e14d --- /dev/null +++ b/scripts/fixtures/ui-prototype/good-terminal/variant-b.html @@ -0,0 +1,7 @@ + +
    deploy apiapi-gatewayapi-gateway-northern-region-billing-service-primary-cluster
    +ok  build    12s
    +ok  upload    4snothing to deploywaiting for the build...failed: upload timed out (try again with --retry)
    diff --git a/scripts/fixtures/ui-prototype/hostile-text/round.json b/scripts/fixtures/ui-prototype/hostile-text/round.json new file mode 100644 index 0000000..3c625a7 --- /dev/null +++ b/scripts/fixtures/ui-prototype/hostile-text/round.json @@ -0,0 +1,34 @@ +{ + "name": "invoices-screen", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": ["colors", "fonts", "spacing"], + "freed": ["components"], + "notFound": ["layout"], + "variants": [ + { "letter": "A", "name": "Dense table", "file": "variant-a.html", "what": "A table with overdue rows tinted", "starts": { "radius": 4 } }, + { "letter": "B", "name": "Split view", "file": "variant-b.html", "what": "A list on the left, the open invoice on the right", "starts": { "radius": 10 } }, + { "letter": "C", "name": "Cards", "file": "variant-c.html", "what": "One card per invoice, overdue ones first", "starts": { "radius": 16 } } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { "name": "shadows", "label": "Shadows", "type": "pick", "choices": ["none", "soft", "strong"], "start": "soft", "look": true }, + { "name": "columns", "label": "Columns", "type": "slider", "min": 1, "max": 4, "step": 1, "start": 2, "look": false }, + { "name": "dividers", "label": "Row dividers", "type": "toggle", "start": true, "look": true } + ], + "images": [], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/hostile-text/variant-a.html b/scripts/fixtures/ui-prototype/hostile-text/variant-a.html new file mode 100644 index 0000000..1242e42 --- /dev/null +++ b/scripts/fixtures/ui-prototype/hostile-text/variant-a.html @@ -0,0 +1,25 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    +

    She said "pay now" & left; 3 < 4 > 2.

    +

    Literal text: and "> and <b> and 'single'.

    + +
    diff --git a/scripts/fixtures/ui-prototype/hostile-text/variant-b.html b/scripts/fixtures/ui-prototype/hostile-text/variant-b.html new file mode 100644 index 0000000..0563478 --- /dev/null +++ b/scripts/fixtures/ui-prototype/hostile-text/variant-b.html @@ -0,0 +1,21 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/hostile-text/variant-c.html b/scripts/fixtures/ui-prototype/hostile-text/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/hostile-text/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/fixtures/ui-prototype/images/avatar.webp b/scripts/fixtures/ui-prototype/images/avatar.webp new file mode 100644 index 0000000..5e2d3e0 Binary files /dev/null and b/scripts/fixtures/ui-prototype/images/avatar.webp differ diff --git a/scripts/fixtures/ui-prototype/images/badge.svg b/scripts/fixtures/ui-prototype/images/badge.svg new file mode 100644 index 0000000..8acb6be --- /dev/null +++ b/scripts/fixtures/ui-prototype/images/badge.svg @@ -0,0 +1 @@ + diff --git a/scripts/fixtures/ui-prototype/images/hero.jpg b/scripts/fixtures/ui-prototype/images/hero.jpg new file mode 100644 index 0000000..6878c90 Binary files /dev/null and b/scripts/fixtures/ui-prototype/images/hero.jpg differ diff --git a/scripts/fixtures/ui-prototype/images/logo.png b/scripts/fixtures/ui-prototype/images/logo.png new file mode 100644 index 0000000..613754c Binary files /dev/null and b/scripts/fixtures/ui-prototype/images/logo.png differ diff --git a/scripts/fixtures/ui-prototype/images/photo.png b/scripts/fixtures/ui-prototype/images/photo.png new file mode 100644 index 0000000..313443d --- /dev/null +++ b/scripts/fixtures/ui-prototype/images/photo.png @@ -0,0 +1 @@ +This is a text file with a .png name, not a picture. diff --git a/scripts/fixtures/ui-prototype/with-images/round.json b/scripts/fixtures/ui-prototype/with-images/round.json new file mode 100644 index 0000000..f2465a2 --- /dev/null +++ b/scripts/fixtures/ui-prototype/with-images/round.json @@ -0,0 +1,113 @@ +{ + "name": "team-page", + "round": 1, + "kind": "screen", + "request": "A screen listing a customer's invoices, with what is overdue easy to spot.", + "direction": "calm, plenty of room around totals", + "carried": [ + "colors", + "fonts", + "spacing" + ], + "freed": [ + "components" + ], + "notFound": [ + "layout" + ], + "variants": [ + { + "letter": "A", + "name": "Dense table", + "file": "variant-a.html", + "what": "A table with overdue rows tinted", + "starts": { + "radius": 4 + } + }, + { + "letter": "B", + "name": "Split view", + "file": "variant-b.html", + "what": "A list on the left, the open invoice on the right", + "starts": { + "radius": 10 + } + }, + { + "letter": "C", + "name": "Cards", + "file": "variant-c.html", + "what": "One card per invoice, overdue ones first", + "starts": { + "radius": 16 + } + } + ], + "starts": { + "screen": "Desktop 1280", + "theme": "light", + "accent": "#2f6fed", + "neutral": "#6b7280", + "fontSet": "System UI", + "textSize": 16, + "space": 1, + "radius": 8, + "state": "ready", + "length": "typical" + }, + "extras": [ + { + "name": "shadows", + "label": "Shadows", + "type": "pick", + "choices": [ + "none", + "soft", + "strong" + ], + "start": "soft", + "look": true + }, + { + "name": "columns", + "label": "Columns", + "type": "slider", + "min": 1, + "max": 4, + "step": 1, + "start": 2, + "look": false + }, + { + "name": "dividers", + "label": "Row dividers", + "type": "toggle", + "start": true, + "look": true + } + ], + "images": [ + { + "name": "logo.png", + "path": "../images/logo.png" + }, + { + "name": "hero.jpg", + "path": "../images/hero.jpg" + }, + { + "name": "avatar.webp", + "path": "../images/avatar.webp" + }, + { + "name": "badge.svg", + "path": "../images/badge.svg" + }, + { + "name": "photo.png", + "path": "../images/photo.png" + } + ], + "fonts": [] +} diff --git a/scripts/fixtures/ui-prototype/with-images/variant-a.html b/scripts/fixtures/ui-prototype/with-images/variant-a.html new file mode 100644 index 0000000..b049607 --- /dev/null +++ b/scripts/fixtures/ui-prototype/with-images/variant-a.html @@ -0,0 +1,32 @@ + +
    +

    + Bills + Invoices for Harbor Supply + Invoices for Harbor Supply and Logistics Cooperative, Northern Region +

    + + + +
    INV-1042Overdue 12 days$1,240.00
    INV-1043Due Dec 2$310.50
    +

    No invoices yet. The first one appears here once it is sent.

    +

    Loading invoices...

    +

    The invoices could not be loaded. Try again in a minute.

    + +
    +
    + Acme logo + Office + Dana Ruiz + +
    +
    diff --git a/scripts/fixtures/ui-prototype/with-images/variant-b.html b/scripts/fixtures/ui-prototype/with-images/variant-b.html new file mode 100644 index 0000000..24ad8c6 --- /dev/null +++ b/scripts/fixtures/ui-prototype/with-images/variant-b.html @@ -0,0 +1,22 @@ + +
    + +
    +

    Harbor

    +

    Harbor Supply, net 30

    +

    Harbor Supply and Logistics Cooperative, net 30, billed to the Northern Region office

    +

    $1,240.00

    +
    +
    diff --git a/scripts/fixtures/ui-prototype/with-images/variant-c.html b/scripts/fixtures/ui-prototype/with-images/variant-c.html new file mode 100644 index 0000000..d0a8fcc --- /dev/null +++ b/scripts/fixtures/ui-prototype/with-images/variant-c.html @@ -0,0 +1,19 @@ + +
    +
    + $1,240.00 +

    Overdue 12 days

    +

    Harbor

    +

    Harbor Supply

    +

    Harbor Supply and Logistics Cooperative, Northern Region office

    +
    +
    No invoices yet.
    +
    Loading invoices...
    +
    Something went wrong loading invoices.
    +
    diff --git a/scripts/test-check-console-openings.mjs b/scripts/test-check-console-openings.mjs index 36bc9f9..1cfdd06 100644 --- a/scripts/test-check-console-openings.mjs +++ b/scripts/test-check-console-openings.mjs @@ -58,7 +58,7 @@ test("a wrong workflow name or a missing notes file is reported", () => { test("a skill that loses its opening is caught by the count", () => { const dir = copySrc(); fs.rmSync(path.join(dir, "plan2code-pr-prep.md")); - assert.match(check(dir).join("\n"), /expected 19 skills with a console opening, found 18/); + assert.match(check(dir).join("\n"), /expected 20 skills with a console opening, found 19/); }); test("helpers", () => { @@ -67,6 +67,7 @@ test("helpers", () => { assert.equal(workflowOf("plan2code-3-implement-review"), "implement-review"); assert.equal(workflowOf("plan2code-pr-prep"), "pr-prep"); assert.equal(workflowOf("plan2code-dead-code"), "dead-code"); + assert.equal(workflowOf("plan2code-ui-prototype"), "ui-prototype"); }); test("the CLI exits 1 on drift", () => { diff --git a/scripts/test-console-wire-budgets.mjs b/scripts/test-console-wire-budgets.mjs index a98752c..404b172 100644 --- a/scripts/test-console-wire-budgets.mjs +++ b/scripts/test-console-wire-budgets.mjs @@ -38,13 +38,14 @@ export const BUDGETS = { "implement.md": 5700, "init.md": 300, "loop.md": 11600, - "pathfinder.md": 2400, - "plan.md": 800, + "pathfinder.md": 2622, // raised by the UI prototype line's bytes only + "plan.md": 1023, // raised by the UI prototype line's bytes only "pr-prep.md": 4500, - "quick-task.md": 4100, + "quick-task.md": 4589, // raised by the UI prototype line's and the prototype recap line's bytes only "review.md": 1000, - "revise-plan.md": 1200, + "revise-plan.md": 1422, // raised by the UI prototype line's bytes only "test.md": 5400, + "ui-prototype.md": 4000, "xray.md": 2500, }, // One printed line each, for a session with one choice card. diff --git a/scripts/test-lanes.json b/scripts/test-lanes.json index 3615452..95f27b1 100644 --- a/scripts/test-lanes.json +++ b/scripts/test-lanes.json @@ -24,6 +24,7 @@ "test-script-test-commands.mjs", "test-script-test-map.mjs", "test-script-test-match.mjs", + "test-script-ui-prototype.mjs", "test-script-xray.mjs", "test-set-version.mjs", "test-skill-scripts.mjs", @@ -47,6 +48,7 @@ "test-fast.mjs", "test-launcher.mjs", "test-standalone-check.mjs", + "test-ui-prototype-page.mjs", "test-web-console-activities-bounce-cars.mjs", "test-web-console-activities-bounce-game.mjs", "test-web-console-activities-bounce.mjs", diff --git a/scripts/test-script-ui-prototype.mjs b/scripts/test-script-ui-prototype.mjs new file mode 100644 index 0000000..b271e3c --- /dev/null +++ b/scripts/test-script-ui-prototype.mjs @@ -0,0 +1,1025 @@ +// Tests for plan2code-ui-prototype's scripts/ui-prototype.mjs: assemble turns a +// round folder into one page around the shipped shell, unpackPage reads it +// back, and check reports every broken contract rule by rule and variant. See +// skill-script-helpers.mjs for how these run (from the built skills/ tree). + +import { test, after } from "node:test"; +import assert from "node:assert/strict"; +import fs from "node:fs"; +import path from "node:path"; +import { pathToFileURL } from "node:url"; +import { ROOT, SKILLS, runScript, tmp, copyFixture, fixtureCleanup } from "./skill-script-helpers.mjs"; + +const madeDirs = []; +after(() => { + fixtureCleanup(); + for (const dir of madeDirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true }); +}); + +/** A temp folder removed when the suite ends. */ +function scratch(name) { + const dir = tmp(name); + madeDirs.push(dir); + return dir; +} + +const SCRIPTS = path.join(SKILLS, "plan2code-ui-prototype", "scripts"); +const { unpackPage, placeholderUrl } = await import(pathToFileURL(path.join(SCRIPTS, "ui-prototype-page.mjs")).href); +const { projectKey } = await import(pathToFileURL(path.join(SCRIPTS, "ui-prototype-drafts.mjs")).href); +const { notepadKey } = await import(pathToFileURL(path.join(ROOT, "src", "web-console", "notepads.mjs")).href); +const FIXTURES = path.join(ROOT, "scripts", "fixtures", "ui-prototype"); + +const proto = (args) => runScript("plan2code-ui-prototype", "ui-prototype.mjs", args); + +/** A fresh copy of a fixture round as /round-1; returns the round folder. */ +function roundFrom(name) { + const dir = copyFixture("ui-prototype", name, (into) => fs.cpSync(path.join(FIXTURES, name), path.join(into, "round-1"), { recursive: true })); + return path.join(dir, "round-1"); +} + +/** Assemble a fixture and return { r, html, round }. */ +function assembled(name) { + const round = roundFrom(name); + const r = proto(["assemble", "--round", round]); + assert.equal(r.code, 0, `${name}: ${r.stdout} ${r.stderr}`); + return { r, round, html: fs.readFileSync(r.json.file, "utf8") }; +} + +const variantText = (name, file) => fs.readFileSync(path.join(FIXTURES, name, file), "utf8"); +const roundJson = (name) => JSON.parse(fs.readFileSync(path.join(FIXTURES, name, "round.json"), "utf8")); +const GOOD = ["good-screen", "good-flow", "good-terminal"]; + +/* ------------------------------------------------------------- help, usage */ + +test("ui-prototype --help names every command and the exit codes", () => { + const r = proto(["--help"]); + assert.equal(r.code, 0, r.stderr); + for (const command of ["sweep", "new-round", "assemble", "check", "open", "read-block", "save"]) { + assert.match(r.stdout, new RegExp(`ui-prototype\\.mjs ${command}\\b`), command); + } + for (const exit of ["0 ok", "1 crash", "2 bad arguments", "3 not found", "4 invalid", "5 refused"]) assert.ok(r.stdout.includes(exit), exit); +}); + +test("ui-prototype: an unknown command and a missing one exit 2", () => { + for (const args of [["frobnicate"], []]) { + const r = proto(args); + assert.equal(r.code, 2, args.join(" ")); + assert.equal(r.json.error, "unknown-command"); + } +}); + +test("ui-prototype: assemble and check without their flag exit 2", () => { + assert.equal(proto(["assemble"]).code, 2); + assert.equal(proto(["check"]).code, 2); +}); + +/* ---------------------------------------------------------------- assemble */ + +for (const name of GOOD) { + test(`assemble ${name}: one page beside the round folder, with its parts`, () => { + const { r, round, html } = assembled(name); + const facts = roundJson(name); + assert.equal(r.json.ok, true); + assert.equal(r.json.file, path.join(path.dirname(round), `${facts.name}-round-${facts.round}.html`)); + assert.equal(r.json.bytes, Buffer.byteLength(html, "utf8")); + assert.deepEqual(r.json.warnings, []); + const whats = r.json.parts.map((p) => p.what); + assert.deepEqual([...whats].sort(), ["shell", "base stylesheet", ...facts.variants.map((v) => `variant ${v.letter}`), "round facts"].sort()); + // Largest first. + for (let i = 1; i < r.json.parts.length; i++) assert.ok(r.json.parts[i - 1].bytes >= r.json.parts[i].bytes, whats.join(", ")); + for (const p of r.json.parts) assert.ok(Number.isInteger(p.bytes) && p.bytes > 0, p.what); + // Only the page was added: the round folder holds what it held. + assert.deepEqual(fs.readdirSync(path.dirname(round)).sort(), [`${facts.name}-round-${facts.round}.html`, "round-1"].sort()); + }); + + test(`assemble ${name}: one sandboxed frame per variant, the policy line, nothing outside data:`, () => { + const { html } = assembled(name); + const facts = roundJson(name); + const frames = [...html.matchAll(/']) assert.ok(hostile.includes(s), `the fixture holds ${s}`); + // Counted outside the srcdoc values, where a quoted attribute may hold any + // text but a raw " (the hostile text's own "> sits there legally). + const tags = html.replace(/srcdoc="[^"]*"/g, 'srcdoc=""'); + assert.equal((tags.match(//g) || []).length, 3); + assert.equal((tags.match(/<\/iframe>/); + assert.ok(a, "frame A's attribute runs to its own closing tag"); + assert.equal(unpackPage(html).frames.A.content, hostile); +}); + +test("unpackPage returns null for a page with no round facts", () => { + assert.equal(unpackPage("

    not a prototype

    "), null); +}); + +/* ------------------------------------------------------------------- check */ + +for (const name of [...GOOD, "hostile-text"]) { + test(`check passes ${name} with exit 0`, () => { + const { r } = assembled(name); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 0, c.stdout); + assert.deepEqual(c.json, { ok: true, findings: [], bytes: r.json.bytes, overCeiling: false }); + }); +} + +test("the contract reference's example variant is the contract-example fixture's variant A, and that round passes check", () => { + const contract = fs.readFileSync(path.join(SKILLS, "plan2code-ui-prototype", "references", "ui-prototype-contract.md"), "utf8"); + const section = contract.split(/^## 10\. Writing a round$/m)[1]; + assert.ok(section, "the contract has a '## 10. Writing a round' section"); + const shown = section.match(/```html\n([\s\S]*?)```/); + assert.ok(shown, "the section shows an html example"); + assert.equal(shown[1], variantText("contract-example", "variant-a.html")); + const { r } = assembled("contract-example"); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 0, c.stdout); + assert.deepEqual(c.json.findings, []); +}); + +const BROKEN = [ + ["bad-outside-link", "outside-link", "B"], + ["bad-script", "script", "B"], + ["bad-state-missing", "state-missing", "A"], + ["bad-length-missing", "length-missing", "C"], + ["bad-value-unused", "value-unused", "B"], + ["bad-step-missing", "step-missing", "B"], +]; + +for (const [name, rule, variant] of BROKEN) { + test(`check reports ${name} as ${rule} in variant ${variant}, and nothing else`, () => { + const { r } = assembled(name); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 4, c.stdout); + assert.equal(c.json.ok, false); + assert.equal(c.json.findings.length, 1, JSON.stringify(c.json.findings)); + const [f] = c.json.findings; + assert.equal(f.rule, rule); + assert.equal(f.variant, variant); + assert.equal(typeof f.message, "string"); + assert.ok(f.message.length > 10); + }); +} + +test("check: a terminal variant is held to the palette and density values, not fonts and corners", () => { + const round = roundFrom("good-terminal"); + const file = path.join(round, "variant-b.html"); + fs.writeFileSync(file, fs.readFileSync(file, "utf8").replace("line-height: var(--p2c-density); ", "")); + const r = proto(["assemble", "--round", round]); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 4); + assert.deepEqual(c.json.findings.map((f) => [f.rule, f.variant]), [["value-unused", "B"]]); + assert.match(c.json.findings[0].message, /density/); +}); + +test("check: inline SVG with xmlns and url(#id) is not an outside link; a // src is", () => { + const round = roundFrom("good-screen"); + const file = path.join(round, "variant-a.html"); + const svg = ''; + fs.writeFileSync(file, fs.readFileSync(file, "utf8") + svg); + let r = proto(["assemble", "--round", round]); + assert.equal(proto(["check", "--file", r.json.file]).code, 0); + fs.writeFileSync(file, fs.readFileSync(file, "utf8") + ''); + r = proto(["assemble", "--round", round]); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 4); + assert.deepEqual(c.json.findings.map((f) => [f.rule, f.variant]), [["outside-link", "A"]]); +}); + +/** Check good-screen with `extra` appended to variant A (and `edit` applied first); returns the findings as [rule, variant]. */ +function checkWith(extra, edit = (t) => t) { + const round = roundFrom("good-screen"); + const file = path.join(round, "variant-a.html"); + fs.writeFileSync(file, edit(fs.readFileSync(file, "utf8")) + extra); + const r = proto(["assemble", "--round", round]); + assert.equal(r.code, 0, r.stdout); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, c.json.findings.length ? 4 : 0); + return c.json.findings.map((f) => [f.rule, f.variant]); +} + +test("check: every kind of script is reported, wherever the handler sits in the tag", () => { + for (const extra of [ + "", + 'Pay', + '', + '

    Pay

    ', + "", + ]) { + assert.deepEqual(checkWith(extra), [["script", "A"]], extra); + } + // Text that only reads like a handler is not one. + assert.deepEqual(checkWith("

    Turn on = off

    "), []); +}); + +test("check: a // URL is reported wherever one can begin", () => { + for (const extra of [ + '', + '', + `

    x

    `, + ]) { + assert.deepEqual(checkWith(extra), [["outside-link", "A"]], extra); + } +}); + +test("check: file:// URLs and // URLs to a dotless host are reported; plain text that only looks like one is not", () => { + for (const extra of [ + '', + '', + '', + "

    x

    ", + ]) { + assert.deepEqual(checkWith(extra), [["outside-link", "A"]], extra); + } + assert.deepEqual(checkWith("

    Attach file: invoice.pdf. //TODO later

    "), []); +}); + +test("check: a handler on a tag written inside an svg style block is reported", () => { + assert.deepEqual(checkWith(''), [["script", "A"]]); + // In an ordinary style block the same text is CSS, not markup. + assert.deepEqual(checkWith(""), []); +}); + +test("check: an outside link in the page around the frames is reported with no variant", () => { + const { html, r } = assembled("good-screen"); + const at = html.lastIndexOf(""); + fs.writeFileSync(r.json.file, html.slice(0, at) + '' + html.slice(at)); + const c = proto(["check", "--file", r.json.file]); + assert.equal(c.code, 4, c.stdout); + assert.deepEqual(c.json.findings.map((f) => [f.rule, f.variant]), [["outside-link", null]]); +}); + +test("check: a variant whose frame is gone from the page is reported as frame-missing", () => { + const { html, r } = assembled("good-screen"); + const cut = html.replace(/`; + }); + + const factsJson = scriptJson(facts); + add("round facts", bytes(factsJson)); + + if (/<\/script/i.test(shell.js)) throw new Error("shell.js must not hold a closing script tag."); + if (/<\/style/i.test(shell.css)) throw new Error("shell.css must not hold a closing style tag."); + + // The frames go in last: variant text is the model's, and escapeAttr leaves + // a comment such as in it untouched, so no placeholder + // search may run over it. + let html = shell.html; + html = fill(html, PLACEHOLDERS.styles, ``); + html = fill( + html, + PLACEHOLDERS.script, + `\n` + ); + html = fill(html, PLACEHOLDERS.frames, frames.join("\n")); + parts.sort((a, b) => b.bytes - a.bytes); + return { html, parts }; +} + +/** A built page with its round facts' `file` set to `file`; null when it is not a prototype page. */ +export function withFile(html, file) { + const m = FACTS_RE.exec(html); + if (!m) return null; + let facts; + try { + facts = JSON.parse(m[1]); + } catch { + return null; + } + facts.file = file; + const open = m[0].slice(0, m[0].length - m[1].length - "".length); + return html.slice(0, m.index) + open + scriptJson(facts) + "" + html.slice(m.index + m[0].length); +} + +export function unpackPage(html) { + const factsMatch = FACTS_RE.exec(html); + if (!factsMatch) return null; + let facts; + try { + facts = JSON.parse(factsMatch[1]); + } catch { + return null; + } + const frames = {}; + for (const m of html.matchAll(FRAME_RE)) { + const doc = unescapeAttr(m[2]); + const open = doc.indexOf(BODY_OPEN); + const content = open !== -1 && doc.endsWith(BODY_CLOSE) ? doc.slice(open + BODY_OPEN.length, doc.length - BODY_CLOSE.length) : null; + frames[m[1]] = { doc, content }; + } + const outside = html.replace(FRAME_RE, "").replace(FACTS_RE, ""); + return { facts, frames, outside }; +} diff --git a/src/skill-scripts/ui-prototype-round.mjs b/src/skill-scripts/ui-prototype-round.mjs new file mode 100644 index 0000000..1412a72 --- /dev/null +++ b/src/skill-scripts/ui-prototype-round.mjs @@ -0,0 +1,178 @@ +// ui-prototype-round.mjs: read and validate a round folder's round.json and +// variant files, against the contract in ui-prototype-contract.md (section 7). +// +// readRound(folder) returns { folder, facts, variants: [{ letter, name, file, +// content }] } or fails with EXIT.NOT_FOUND (a missing round.json or variant +// file) or EXIT.INVALID (anything malformed, the message naming the field or +// file). + +import fs from "node:fs"; +import path from "node:path"; +import { EXIT, fail } from "./common.mjs"; + +export const KINDS = ["screen", "flow", "terminal"]; +export const ITEMS = ["colors", "fonts", "spacing", "components", "layout"]; +export const FONT_SETS = ["System UI", "Humanist", "Transitional", "Slab Serif", "Rounded Sans", "Monospace Code"]; +export const SCREENS = ["Phone 390", "Tablet 820", "Desktop 1280"]; +export const WINDOWS = ["80x24", "120x30", "160x48"]; +export const PALETTES = ["Graphite", "Amber", "Phosphor", "Ocean"]; +export const THEMES = ["light", "dark"]; +export const STATES = ["ready", "empty", "loading", "error"]; +export const LENGTHS = ["short", "typical", "long"]; +export const LETTERS = ["A", "B", "C", "D", "E"]; +export const MIN_VARIANTS = 2; +export const MAX_VARIANTS = 5; +export const MAX_EXTRAS = 6; +export const EXTRA_TYPES = ["slider", "pick", "toggle"]; + +/** A prototype's name: lowercase letters and digits joined by single hyphens. */ +export const NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/; +const EXTRA_NAME_RE = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/; +const COLOR_RE = /^#[0-9a-fA-F]{6}$/; +const FILE_RE = /^[A-Za-z0-9][A-Za-z0-9._-]*\.html$/; +const WHOLE_PAGE_RE = /<\/?(?:html|head|body)\b/i; + +const isText = (v) => typeof v === "string"; +const isNum = (v) => typeof v === "number" && Number.isFinite(v); +const oneOf = (list) => (v) => list.includes(v); +const between = (lo, hi) => (v) => isNum(v) && v >= lo && v <= hi; + +// The dial starts, by kind: each key's check and what to say when it fails. +const SCREEN_STARTS = { + screen: [oneOf(SCREENS), `one of ${SCREENS.join(", ")}`], + theme: [oneOf(THEMES), `one of ${THEMES.join(", ")}`], + accent: [(v) => isText(v) && COLOR_RE.test(v), "a color as #rrggbb"], + neutral: [(v) => isText(v) && COLOR_RE.test(v), "a color as #rrggbb"], + fontSet: [oneOf(FONT_SETS), `one of ${FONT_SETS.join(", ")}`], + textSize: [between(12, 24), "a number of pixels from 12 to 24"], + space: [between(0.5, 2), "a number from 0.5 to 2"], + radius: [between(0, 32), "a number of pixels from 0 to 32"], + state: [oneOf(STATES), `one of ${STATES.join(", ")}`], + length: [oneOf(LENGTHS), `one of ${LENGTHS.join(", ")}`], +}; +const TERMINAL_STARTS = { + window: [oneOf(WINDOWS), `one of ${WINDOWS.join(", ")}`], + theme: SCREEN_STARTS.theme, + palette: [oneOf(PALETTES), `one of ${PALETTES.join(", ")}`], + density: [between(1, 2), "a number from 1 to 2"], + state: SCREEN_STARTS.state, + length: SCREEN_STARTS.length, +}; + +export function startsSpec(kind) { + return kind === "terminal" ? TERMINAL_STARTS : SCREEN_STARTS; +} + +function invalid(error, message, next) { + fail(EXIT.INVALID, error, message, next || "Fix round.json against ui-prototype-contract.md (section 7), then run assemble again."); +} + +function checkStarts(where, starts, kind, { all }) { + if (!starts || typeof starts !== "object" || Array.isArray(starts)) invalid("bad-starts", `${where} must be an object.`); + const spec = startsSpec(kind); + for (const key of Object.keys(starts)) { + if (!Object.hasOwn(spec, key)) invalid("bad-starts", `${where}.${key} is not a dial for a ${kind} (allowed: ${Object.keys(spec).join(", ")}).`); + const [ok, want] = spec[key]; + if (!ok(starts[key])) invalid("bad-starts", `${where}.${key} is ${JSON.stringify(starts[key])}; it must be ${want}.`); + } + if (all) { + const missing = Object.keys(spec).filter((k) => !(k in starts)); + if (missing.length) invalid("bad-starts", `${where} is missing ${missing.join(", ")}.`); + } +} + +function checkItems(field, value) { + if (!Array.isArray(value)) invalid("bad-field", `round.json "${field}" must be a list.`); + for (const item of value) { + if (!ITEMS.includes(item)) invalid("bad-field", `round.json "${field}" holds "${item}"; carry-over items are ${ITEMS.join(", ")}.`); + } +} + +function checkExtra(x, i) { + const where = `extras[${i}]`; + if (!x || typeof x !== "object" || Array.isArray(x)) invalid("bad-extra", `${where} must be an object.`); + if (!isText(x.name) || !EXTRA_NAME_RE.test(x.name)) invalid("bad-extra", `${where}.name must be lowercase letters, digits and hyphens, starting with a letter.`); + if (x.label !== undefined && !isText(x.label)) invalid("bad-extra", `${where}.label must be text.`); + // The copied block writes "Extra,