Compare commits

...
22 changed files with 491 additions and 87 deletions

No files matched your search

+7 -2
View File
@@ -49,11 +49,16 @@ node scripts/bench-web-console.mjs [--runs 7] [--workflow dashboard]
# PLAN2CODE_TEST_BROWSER=chrome|msedge forces which browser the page tests and these scripts use # PLAN2CODE_TEST_BROWSER=chrome|msedge forces which browser the page tests and these scripts use
node scripts/capture-screenshots.mjs # every screen node scripts/capture-screenshots.mjs # every screen
node scripts/capture-screenshots.mjs --only dashboard # one screen (dashboard-utilities scrolls to the utility cards) node scripts/capture-screenshots.mjs --only dashboard # one screen (dashboard-utilities scrolls to the utility cards)
# The desktop app's five pictures (app-launch, app-terminal, loop-setup, loop-banner, loop-stop; dark only):
# the app's own page (plan2code-app/ui) in Chrome with a stand-in for its Rust side, framing a real staged
# console. Needs plan2code-app's vendor files (`npm install` and `node scripts/vendor.mjs` there)
node scripts/capture-screenshots.mjs --app
node scripts/capture-screenshots.mjs --app --only loop-stop # one of them
# After a full capture, rebuild what the landing page derives from it (hero 1280px variants, the 1200x630 # After a full capture, rebuild what the landing page derives from it (hero 1280px variants, the 1200x630
# social card) and, until the owner has real desktop app pictures, the labeled placeholders (never overwrites a real file) # social card), and the README banner (docs/banner.jpg) when the tagline, license or a step pose changes
node scripts/make-site-images.mjs node scripts/make-site-images.mjs
node scripts/make-social-card.mjs node scripts/make-social-card.mjs
node scripts/make-app-placeholders.mjs node scripts/make-banner.mjs
# Compare every element's computed style on every screen before and after a stylesheet change # Compare every element's computed style on every screen before and after a stylesheet change
# (dev-only, not in npm test): take a baseline first, then compare after each move # (dev-only, not in npm test): take a baseline first, then compare after each move
+13
View File
@@ -283,8 +283,21 @@ button, a different color.
```bash ```bash
node scripts/capture-screenshots.mjs # every screen node scripts/capture-screenshots.mjs # every screen
node scripts/capture-screenshots.mjs --only dashboard # one screen node scripts/capture-screenshots.mjs --only dashboard # one screen
node scripts/capture-screenshots.mjs --app # the desktop app's five pictures
``` ```
`--app` takes the desktop app's pictures (`app-launch`, `app-terminal`,
`loop-setup`, `loop-banner`, `loop-stop`, dark only). It runs the app's own
page from `plan2code-app/ui` in Chrome with a stand-in for its Rust side, so the
bar, the launch card, the loop banner and the terminal panel are the real ones,
and frames a real staged console with the app's settings on. No agent runs: the
terminal text is written by `scripts/capture-app-shots.mjs`. It needs the app's
vendor files (`npm install` and `node scripts/vendor.mjs` in `plan2code-app`).
The README banner, `docs/banner.jpg`, is drawn by `node scripts/make-banner.mjs`
from the console's own step poses. Rerun it when the tagline, the license or a
step pose changes.
Each screen is staged with no agent, from the payloads in Each screen is staged with no agent, from the payloads in
`scripts/screenshots/` (its README names the file behind each screen), in a `scripts/screenshots/` (its README names the file behind each screen), in a
throwaway sample project and console home that the script removes when it is throwaway sample project and console home that the script removes when it is
+11
View File
@@ -4,6 +4,17 @@ All notable changes to Plan2Code will be documented in this file.
<!-- Format from 3.1.0 on: `## vX.Y.Z (YYYY-MM-DD)` with the date from version.json; a minor release opens with a three-bullet `### Highlights`; sections run Added, Changed, Fixed; game changes sit under one Activities line; tooling and test lines go under "For contributors". Older headings have no date and are not backfilled. --> <!-- Format from 3.1.0 on: `## vX.Y.Z (YYYY-MM-DD)` with the date from version.json; a minor release opens with a three-bullet `### Highlights`; sections run Added, Changed, Fixed; game changes sit under one Activities line; tooling and test lines go under "For contributors". Older headings have no date and are not backfilled. -->
## v3.2.3 (2026-12-02)
### 🔧 Changed
- **Docs**: the README banner carries the tagline "Plan it. Approve it. Let it build." and the Apache 2.0 license.
### 🐛 Fixed
- **Docs**: the desktop app pictures in the README, the desktop app guide and the landing page (the launch card, the app with its terminal docked, and the Implementation Loop's setup, banner and stop screen) are real captures instead of labeled placeholders.
- **For contributors**: `node scripts/capture-screenshots.mjs --app` captures the five desktop app pictures from the app's own page with a stand-in for its Rust side, `node scripts/make-banner.mjs` draws the banner from the console's step poses, and `make-app-placeholders` is gone.
## v3.2.2 (2026-11-30) ## v3.2.2 (2026-11-30)
### ✨ Added ### ✨ Added
+1 -1
View File
@@ -13,7 +13,7 @@
Plan2Code is a spec-driven workflow for AI coding agents. You work through it on a page in your browser: the dashboard lists every step as a card, and each step's questions, progress and sign-offs arrive on that same page while your agent does the work. An approved plan becomes phase documents, and the agent builds to them one phase at a time. Plan2Code is a spec-driven workflow for AI coding agents. You work through it on a page in your browser: the dashboard lists every step as a card, and each step's questions, progress and sign-offs arrive on that same page while your agent does the work. An approved plan becomes phase documents, and the agent builds to them one phase at a time.
Version 3.2.2 · Apache 2.0 · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com) Version 3.2.3 · Apache 2.0 · 📖 [plan2code.jparkerweb.com](https://plan2code.jparkerweb.com)
--- ---
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

After

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 125 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 147 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 131 KiB

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "plan2code", "name": "plan2code",
"version": "3.2.2", "version": "3.2.3",
"private": true, "private": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {
+2 -2
View File
@@ -957,7 +957,7 @@ dependencies = [
[[package]] [[package]]
name = "fake-agent" name = "fake-agent"
version = "3.2.2" version = "3.2.3"
dependencies = [ dependencies = [
"serde_json", "serde_json",
"terminal_size", "terminal_size",
@@ -2647,7 +2647,7 @@ checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548"
[[package]] [[package]]
name = "plan2code-app" name = "plan2code-app"
version = "3.2.2" version = "3.2.3"
dependencies = [ dependencies = [
"chrono", "chrono",
"libc", "libc",
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "fake-agent" name = "fake-agent"
version = "3.2.2" version = "3.2.3"
description = "A stand-in agent program for the Plan2Code app's tests" description = "A stand-in agent program for the Plan2Code app's tests"
edition = "2021" edition = "2021"
publish = false publish = false
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "plan2code-app", "name": "plan2code-app",
"version": "3.2.2", "version": "3.2.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "plan2code-app", "name": "plan2code-app",
"version": "3.2.2", "version": "3.2.3",
"dependencies": { "dependencies": {
"@tauri-apps/api": "2.12.4", "@tauri-apps/api": "2.12.4",
"@xterm/addon-fit": "0.11.0", "@xterm/addon-fit": "0.11.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "plan2code-app", "name": "plan2code-app",
"version": "3.2.2", "version": "3.2.3",
"private": true, "private": true,
"description": "Plan2Code desktop app (Tauri). Separate from the repo root so the root and the web console stay dependency-free.", "description": "Plan2Code desktop app (Tauri). Separate from the repo root so the root and the web console stay dependency-free.",
"scripts": { "scripts": {
+1 -1
View File
@@ -1,6 +1,6 @@
[package] [package]
name = "plan2code-app" name = "plan2code-app"
version = "3.2.2" version = "3.2.3"
description = "Plan2Code desktop app" description = "Plan2Code desktop app"
edition = "2021" edition = "2021"
publish = false publish = false
+1 -1
View File
@@ -1,7 +1,7 @@
{ {
"$schema": "https://schema.tauri.app/config/2", "$schema": "https://schema.tauri.app/config/2",
"productName": "Plan2Code", "productName": "Plan2Code",
"version": "3.2.2", "version": "3.2.3",
"identifier": "com.plan2code.desktop", "identifier": "com.plan2code.desktop",
"build": { "build": {
"frontendDist": "../ui", "frontendDist": "../ui",
+322
View File
@@ -0,0 +1,322 @@
// The desktop app's five pictures for the docs, taken by
// `node scripts/capture-screenshots.mjs --app`. Dev-only.
//
// The app's own page (plan2code-app/ui: the bar, the launch card, the loop
// banner, the terminal panel) runs in Chrome from a small static server, with
// a stand-in for the Rust side of window.__TAURI__: `invoke` answers from a
// fixed table, `listen` keeps the handlers so a scene can fire `console-page`
// and the agent's output channel. The dashboard in its frame is a real console
// session staged the same way as every other shot (capture-screenshots.mjs),
// with PLAN2CODE_IN_APP and PLAN2CODE_EMBED_ORIGIN set so it may be framed and
// draws its app-only parts (the loop cards, the loop setup, the stop screen).
// The terminal text is written by the scene: no agent runs.
//
// Each shot is dark only, 1280x800 at twice the pixel density, Ocean highlight.
import fs from "node:fs";
import http from "node:http";
import path from "node:path";
export const APP_SHOTS = ["app-launch", "app-terminal", "loop-setup", "loop-banner", "loop-stop"];
const TYPES = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png", ".woff2": "font/woff2" };
/** Serves plan2code-app/ui on 127.0.0.1. Resolves { origin, close }. */
export function serveAppUi(root) {
const dir = path.join(root, "plan2code-app", "ui");
for (const f of ["xterm.js", "addon-fit.js", "xterm.css", "tokens.css"]) {
if (!fs.existsSync(path.join(dir, "vendor", f))) {
throw new Error(`plan2code-app/ui/vendor/${f} is missing: run \`npm install\` and \`node scripts/vendor.mjs\` in plan2code-app first.`);
}
}
const server = http.createServer((req, res) => {
const rel = decodeURIComponent(new URL(req.url, "http://x").pathname).replace(/^\/+/, "") || "index.html";
const abs = path.join(dir, rel);
if (!abs.startsWith(dir + path.sep) || !fs.existsSync(abs) || !fs.statSync(abs).isFile()) {
res.writeHead(404);
return res.end();
}
res.writeHead(200, { "content-type": TYPES[path.extname(abs)] || "application/octet-stream", "cache-control": "no-store" });
fs.createReadStream(abs).pipe(res);
});
return new Promise((resolve) => {
server.listen(0, "127.0.0.1", () => {
resolve({ origin: `http://127.0.0.1:${server.address().port}`, close: () => new Promise((r) => server.close(r)) });
});
});
}
// The launch card's agents, the way the Rust side lists them: the three
// built-ins, installed, with the shipped model menu.
function availability(root) {
const models = JSON.parse(fs.readFileSync(path.join(root, "src", "launcher", "models.json"), "utf8"));
const entry = (id, label) => ({ id, label, installed: true, state: "found", path: null, folder: null, installHint: "", installUrl: null, hasEffort: id !== "devin", custom: false, models: models[id] || [] });
return { agents: [entry("claude", "Claude Code"), entry("codex", "Codex"), entry("devin", "Devin")], warnings: [] };
}
// Runs in the app page only (the console's frame gets nothing): the stand-in
// for the Tauri globals. `config` comes from the scene.
function tauriStub(config) {
if (window.top !== window) return;
const hub = { listeners: {}, channel: null, config };
window.__p2c = hub;
class Channel {
constructor() {
this.onmessage = null;
}
}
const answers = {
app_state: () => ({
projectDir: config.projectDir,
firstRunDone: true,
nodeChecked: true,
nodeVersion: "22.11.0",
// Nothing saved: the app's own default split for this window width.
termPanel: null,
// One step under the default, so the scenes' lines fit the default pane.
terminalFontSize: 12,
copyOnSelect: false,
lastAgent: "claude",
launchModel: "",
}),
agent_availability: () => config.availability,
platform_info: () => ({ os: "windows", windowsBuild: 26100 }),
agent_reattach: (args) => {
hub.channel = args.onOutput;
return { state: "idle", generation: 0 };
},
loop_state: () => config.loopState,
loop_facts: () => config.loopFacts,
console_status: () => ({ state: "running" }),
console_start: () => ({ url: hub.consoleUrl }),
version_status: () => ({ mismatch: false }),
check_new_release: () => ({ latest: null, problem: null }),
recent_folders: () => [],
};
const windowApi = new Proxy({}, { get: (_, name) => (name === "setTitle" ? async (t) => { document.title = t; } : async () => {}) });
window.__TAURI__ = {
core: {
Channel,
invoke: async (cmd, args) => (answers[cmd] ? answers[cmd](args || {}) : null),
},
event: {
listen: async (name, cb) => {
(hub.listeners[name] ||= []).push(cb);
return () => {};
},
},
window: { getCurrentWindow: () => windowApi },
};
hub.emit = (name, payload) => (hub.listeners[name] || []).forEach((cb) => cb({ payload }));
hub.agent = (state) => hub.channel && hub.channel.onmessage(state);
hub.write = (text) => hub.channel && hub.channel.onmessage(new TextEncoder().encode(text).buffer);
}
// What the terminal shows in each scene. Plain words in the shape of an agent's
// session, not any agent's real screen.
const DIM = "\x1b[2m";
const OFF = "\x1b[0m";
const BLUE = "\x1b[38;5;75m";
const GREEN = "\x1b[32m";
const RED = "\x1b[31m";
const lines = (...rows) => rows.join("\r\n") + "\r\n";
const TERM_DASHBOARD = lines(
`${DIM}~/code/task-api${OFF}`,
"",
`${BLUE}>${OFF} /plan2code`,
"",
"● Opening the dashboard.",
"",
"● Bash(console.mjs open)",
` ${DIM}⎿ → See the dashboard${OFF}`,
` ${DIM}beside this terminal.${OFF}`,
"",
"● The dashboard is open.",
" Phases 1 and 2 are done.",
" Implement is next, for",
" Phase 3. Pick a card",
" when you are ready.",
"",
`${DIM} Waiting for your pick...${OFF}`,
);
const TERM_BUILDING = lines(
`${DIM}Phase 3 of 4, by the loop${OFF}`,
"",
"● Read(phase-3.md)",
"",
"● Update(routes.js)",
` ${DIM}⎿ GET /tasks, paged${OFF}`,
"",
"● Update(tasks.test.js)",
` ${DIM}⎿ 6 tests for paging${OFF}`,
"",
"● Bash(npm test)",
` ${DIM}⎿${OFF} ${GREEN}✔ 41 passed${OFF} ${DIM}(1.8s)${OFF}`,
"",
"● Task 3.1 done.",
" Next: POST /tasks.",
"",
"● Update(routes.js)",
` ${DIM}⎿ POST /tasks with Zod${OFF}`,
);
const TERM_STOPPED = lines(
`${DIM}Phase 3 of 4, by the loop${OFF}`,
"",
"● Update(routes.js)",
` ${DIM}⎿ PATCH, DELETE /tasks/:id${OFF}`,
"",
"● Bash(npm test)",
` ${DIM}⎿${OFF} ${RED}✖ 2 failed${OFF}, 46 passed`,
"",
"● Still failing after a fix",
" round. Reporting to the",
" loop.",
);
const LOOP_FACTS = { agent: "claude", agentLabel: "Claude Code", model: "opus", effort: "high", permissionMode: "bypass", promptSupport: true, running: false };
const LOOP_RUNNING = {
running: true,
kind: "phases",
phase: 3,
phases: 4,
phaseName: "API endpoints",
step: "Building",
specName: "task-api",
strength: "balanced",
model: "sonnet",
effort: "high",
retriesUsed: 0,
canStopAfter: true,
};
const LOOP_STOPPED = {
kind: "stopped",
reason: "Phase 3 stopped: its tests still failed after a fix round.",
line: "npm test failed twice in Phase 3: PATCH /tasks/:id answers 200 for a deleted task, and a second DELETE answers 204 (test/tasks.test.js)",
advice: "Decide whether a deleted task should answer 404 or 410, then fix it together with an agent.",
recommend: "fix",
phase: 3,
phases: [
{ n: 3, name: "API endpoints", commit: null, unfixed: 0, retries: 1 },
{ n: 4, name: "Authentication", commit: null, unfixed: 0, retries: 0 },
],
uncommitted: ["src/tasks/routes.js", "test/tasks.test.js"],
can: ["ask", "resume", "fix", "dashboard"],
};
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
/**
* Takes one app shot. `h` carries what capture-screenshots.mjs owns: the
* browser, the app page's origin, the sample project, `cli`, `post`, `stage`
* and the output folder.
*/
export async function captureAppShot(name, h) {
const { browser, origin, project, cli, post, stage, root, out } = h;
const config = { projectDir: project, availability: availability(root), loopFacts: LOOP_FACTS, loopState: null };
let sid = null;
let url = null;
if (name === "app-terminal" || name === "loop-setup") {
({ sid, url } = stage(project, { workflow: "dashboard", posts: ["dashboard"] }));
} else if (name === "loop-banner" || name === "loop-stop") {
// A loop phase's page: opened with --loop, which only works under the app.
const r = cli(project, "open", "--workflow", "implement", "--spec", "specs/task-api", "--loop", "--no-open");
if (r.code !== 0 || !r.out || !r.out.url) throw new Error(`open --loop failed (${r.code}): ${r.err.trim()}`);
({ sid, url } = { sid: r.out.sid, url: r.out.url });
post(project, sid, "build");
if (name === "loop-banner") config.loopState = { ...LOOP_RUNNING, startedAtMs: 0 };
else {
const file = path.join(path.dirname(r.out.session), `loop-end-${sid}.json`);
fs.writeFileSync(file, JSON.stringify({ loopEnd: LOOP_STOPPED, agent: { status: "waiting" } }));
const p = cli(project, "post", "--session", sid, "--file", file);
if (p.code !== 0) throw new Error(`posting the loop's end failed (${p.code}): ${p.err.trim()}`);
}
}
const ctx = await browser.newContext({ viewport: { width: 1280, height: 800 }, deviceScaleFactor: 2, colorScheme: "dark" });
try {
await ctx.addInitScript(tauriStub, config);
const page = await ctx.newPage();
page.on("pageerror", (e) => console.log(` page error: ${e.message}`));
await page.goto(origin + "/index.html", { waitUntil: "domcontentloaded" });
await page.waitForFunction(() => window.__p2c && window.__p2c.channel, null, { timeout: 15000 });
// The banner's clock: started 23 minutes ago, set once the page is up.
if (config.loopState) {
await page.evaluate(() => {
const s = { ...window.__p2c.config.loopState, startedAtMs: Date.now() - 23 * 60 * 1000 - 12000 };
window.__p2c.emit("loop-state", s);
});
}
if (name === "app-launch") {
await page.locator("#launch-card:not([hidden])").waitFor({ timeout: 10000 });
await page.selectOption("#launch-model", "opus");
await page.selectOption("#launch-effort", "high");
await sleep(800);
} else {
const ended = name === "loop-stop";
await page.evaluate(
({ text, ended, loop }) => {
const p = window.__p2c;
p.agent({ state: "running", kind: "claude", generation: 1, mode: "bypass", model: loop ? "sonnet" : "opus", effort: "high" });
p.write(text);
if (ended) p.agent({ state: "ended", kind: "claude", generation: 1, mode: "bypass", model: "sonnet", effort: "high", reason: "exited with code 0" });
},
{ text: name === "loop-banner" ? TERM_BUILDING : name === "loop-stop" ? TERM_STOPPED : TERM_DASHBOARD, ended, loop: name.startsWith("loop-") && name !== "loop-setup" },
);
await page.evaluate((u) => {
window.__p2c.consoleUrl = u;
window.__p2c.emit("console-page", { url: u, sid: "", workflow: "" });
}, url);
const frame = page.frameLocator("iframe");
// The dashboard in the app opens on Planny asleep: wake him the way a
// person would, past the intro.
if (name === "app-terminal" || name === "loop-setup") {
const skip = frame.getByRole("button", { name: "Skip the intro" });
await skip.waitFor({ timeout: 20000 });
await skip.click();
await skip.waitFor({ state: "hidden" });
}
// Anything drawn in the main column: cards, the loop's end, or a phase's
// build-in-progress heading.
const drawn = frame.locator(".dash-card, .card, .handoff, .loop-end, #main h1, #main h2").first();
await drawn.waitFor({ timeout: 20000 }).catch(async () => {
const text = await frame.locator("body").innerText().catch(() => "");
console.log(` warning: ${name}: nothing known drew in the frame; it reads: ${text.slice(0, 300).replace(/\s+/g, " ")}`);
});
// The cards' entrance.
await sleep(3500);
// The dashboard: the suggested card in view, as in the console's own shot.
if (name === "app-terminal") {
await frame.locator(".dash-toggle").evaluate((n) => n.scrollIntoView({ block: "start", behavior: "instant" }));
await sleep(400);
}
if (name === "loop-setup") {
// The card is the button itself.
await frame.locator(".dash-card", { hasText: "Implementation Loop" }).first().click();
await frame.locator("#loop-start").waitFor({ timeout: 10000 });
await sleep(1500);
// From its top: the spec, the phases left and the strength.
await frame.locator(".loop-setup, #main").first().evaluate((n) => n.scrollIntoView({ block: "start", behavior: "instant" }));
await sleep(400);
}
if (name === "loop-stop") await frame.locator(".loop-end-actions").waitFor({ timeout: 10000 });
}
const cdp = await ctx.newCDPSession(page);
const clip = { x: 0, y: 0, width: 1280, height: 800, scale: 2 };
const { data } = await cdp.send("Page.captureScreenshot", { format: "webp", quality: 85, captureBeyondViewport: false, clip });
await cdp.detach();
const file = path.join(out, `${name}-dark.webp`);
fs.writeFileSync(file, Buffer.from(data, "base64"));
console.log(`${path.basename(file)} ${Math.round(fs.statSync(file).size / 1024)} KB`);
return file;
} finally {
await ctx.close();
if (sid) cli(project, "stop", "--session", sid);
}
}
+20 -3
View File
@@ -16,6 +16,10 @@
// //
// Shots: dashboard, dashboard-plan, dashboard-utilities, question, doc, build, signoff, signoff-changes, finish, ask, git, // Shots: dashboard, dashboard-plan, dashboard-utilities, question, doc, build, signoff, signoff-changes, finish, ask, git,
// notebook, learning, lessons, deps, activities and prototypes. // notebook, learning, lessons, deps, activities and prototypes.
// --app takes the desktop app's five pictures instead (app-launch, app-terminal,
// loop-setup, loop-banner, loop-stop; dark only): the app's own page with a
// stand-in for its Rust side, framing a real staged console. See
// scripts/capture-app-shots.mjs. --only picks one of them.
// --compare adds workspace, stop, delete, help, prefs and cleanup: screens the // --compare adds workspace, stop, delete, help, prefs and cleanup: screens the
// docs never show, for checking a change by eye against a "before" set. Its // docs never show, for checking a change by eye against a "before" set. Its
// --out must be outside docs/screenshots/, so the set is never published. // --out must be outside docs/screenshots/, so the set is never published.
@@ -37,6 +41,7 @@ import path from "node:path";
import { spawnSync } from "node:child_process"; import { spawnSync } from "node:child_process";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { launchBrowser } from "./browser.mjs"; import { launchBrowser } from "./browser.mjs";
import { APP_SHOTS, captureAppShot, serveAppUi } from "./capture-app-shots.mjs";
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url))); const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
const CONSOLE_CLI = path.join(ROOT, "src", "web-console", "console.mjs"); const CONSOLE_CLI = path.join(ROOT, "src", "web-console", "console.mjs");
@@ -659,8 +664,12 @@ async function main() {
fail(`--compare never writes into ${path.relative(ROOT, docs)}: pass --out with a folder outside it.`); fail(`--compare never writes into ${path.relative(ROOT, docs)}: pass --out with a folder outside it.`);
} }
const table = args.compare ? { ...SHOTS, ...COMPARE_SHOTS } : SHOTS; const table = args.compare ? { ...SHOTS, ...COMPARE_SHOTS } : SHOTS;
const names = args.only ? [args.only] : Object.keys(table); const known = args.app ? APP_SHOTS : Object.keys(table);
for (const n of names) if (!table[n]) fail(`Unknown shot "${n}". Shots: ${Object.keys(table).join(", ")}`); const names = args.only ? [args.only] : known;
for (const n of names) if (!known.includes(n)) fail(`Unknown shot "${n}". Shots: ${known.join(", ")}`);
// The app's page is served before any console starts: the console is told
// its origin is allowed to frame it.
const appUi = args.app ? await serveAppUi(ROOT) : null;
SCRATCH = fs.mkdtempSync(path.join(SCRATCH_ROOT, "p2c-shots-")); SCRATCH = fs.mkdtempSync(path.join(SCRATCH_ROOT, "p2c-shots-"));
HOME = path.join(SCRATCH, "console-home"); HOME = path.join(SCRATCH, "console-home");
@@ -672,7 +681,11 @@ async function main() {
PLAN2CODE_NOTEPADS_DIR: path.join(SCRATCH, "notepads"), PLAN2CODE_NOTEPADS_DIR: path.join(SCRATCH, "notepads"),
PLAN2CODE_LEARNING_DIR: path.join(SCRATCH, "learning"), PLAN2CODE_LEARNING_DIR: path.join(SCRATCH, "learning"),
PLAN2CODE_NO_BROWSER: "1", PLAN2CODE_NO_BROWSER: "1",
...(appUi ? { PLAN2CODE_IN_APP: "1", PLAN2CODE_EMBED_ORIGIN: appUi.origin } : {}),
}; };
// Never announce to a real app window this shell may have inherited.
for (const k of ["PLAN2CODE_APP_TOKEN", "PLAN2CODE_APP_ANNOUNCE", "PLAN2CODE_CONSOLE_SID", "PLAN2CODE_APP_VERSION"]) delete ENV[k];
if (!appUi) delete ENV.PLAN2CODE_IN_APP;
fs.mkdirSync(HOME, { recursive: true }); fs.mkdirSync(HOME, { recursive: true });
fs.mkdirSync(OUT, { recursive: true }); fs.mkdirSync(OUT, { recursive: true });
let browser = null; let browser = null;
@@ -687,7 +700,10 @@ async function main() {
...(typeof args.browser === "string" ? { executablePath: args.browser } : {}), ...(typeof args.browser === "string" ? { executablePath: args.browser } : {}),
args: ["--no-first-run", "--no-default-browser-check", "--mute-audio"], args: ["--no-first-run", "--no-default-browser-check", "--mute-audio"],
}); });
for (const name of names) { if (appUi) {
for (const name of names) await captureAppShot(name, { browser, origin: appUi.origin, project, cli, post, stage, root: ROOT, out: OUT });
}
for (const name of appUi ? [] : names) {
const spec = table[name]; const spec = table[name];
const where = spec.repo const where = spec.repo
? makeGitProject() ? makeGitProject()
@@ -709,6 +725,7 @@ async function main() {
if (args.snapshot) fs.writeFileSync(path.resolve(String(args.snapshot)), JSON.stringify(SNAP)); if (args.snapshot) fs.writeFileSync(path.resolve(String(args.snapshot)), JSON.stringify(SNAP));
} finally { } finally {
if (browser) await browser.close(); if (browser) await browser.close();
if (appUi) await appUi.close();
if (project) cli(project, "stop", "--all"); if (project) cli(project, "stop", "--all");
removeScratch(); removeScratch();
} }
-70
View File
@@ -1,70 +0,0 @@
#!/usr/bin/env node
// Writes labeled placeholder pictures for the desktop app and the Implementation
// Loop (docs/screenshots/app-*.webp, loop-*.webp) so the docs and the landing page
// carry their final markup before the owner has captured the real window.
// Replace each file with the real capture (same name, same 2560x1600 size);
// nothing else needs editing. The shot list (state, window size, theme) is in
// specs/polish-3-2/phase-11.md's completion summary. Dev-only.
//
// node scripts/make-app-placeholders.mjs [--browser <path>] [--force]
//
// Never overwrites a file that exists unless --force: a real capture stays.
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { launchBrowser } from "./browser.mjs";
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
const DIR = path.join(ROOT, "docs", "screenshots");
const SHOTS = [
["app-launch-dark", "The launch card", "Which agent, model and effort to start on"],
["app-terminal-dark", "The app with the terminal docked", "The dashboard beside the agent's terminal"],
["loop-setup-dark", "Implementation Loop setup", "The setup screen before a run"],
["loop-banner-dark", "The Loop mid-run", "The banner while a phase builds"],
["loop-stop-dark", "The Loop's stop screen", "Why it stopped, with the evidence"],
];
const force = process.argv.includes("--force");
const flag = process.argv.indexOf("--browser");
const browser = await launchBrowser(flag > 0 ? { executablePath: process.argv[flag + 1] } : {});
try {
const page = await browser.newPage();
for (const [name, title, line] of SHOTS) {
const out = path.join(DIR, `${name}.webp`);
if (fs.existsSync(out) && !force) {
console.log(`${name}.webp exists, kept`);
continue;
}
const data = await page.evaluate(
([t, l]) => {
const c = document.createElement("canvas");
c.width = 2560;
c.height = 1600;
const g = c.getContext("2d");
g.fillStyle = "#171513";
g.fillRect(0, 0, 2560, 1600);
g.strokeStyle = "#46403a";
g.setLineDash([24, 16]);
g.lineWidth = 4;
g.strokeRect(60, 60, 2440, 1480);
g.fillStyle = "#f0ece5";
g.textAlign = "center";
g.font = "700 96px sans-serif";
g.fillText(t, 1280, 740);
g.fillStyle = "#b6afa3";
g.font = "400 56px sans-serif";
g.fillText(l, 1280, 840);
g.fillStyle = "#e0a24a";
g.font = "600 44px sans-serif";
g.fillText("Placeholder: the real capture goes here", 1280, 960);
return c.toDataURL("image/webp", 0.85).split(",")[1];
},
[title, line],
);
fs.writeFileSync(out, Buffer.from(data, "base64"));
console.log(`${name}.webp ${Math.round(fs.statSync(out).size / 1024)} KB`);
}
} finally {
await browser.close();
}
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/env node
// Renders the README banner, docs/banner.jpg (2048x600: 1024x300 at twice the
// pixel density). Dev-only.
//
// node scripts/make-banner.mjs [--browser <path>]
//
// The five Plannys are the console's own step poses (the <svg data-pose> in
// src/web-console/public/index.html), drawn with its tokens.css and poses.css
// in the dark theme, held still. Rerun it when the tagline, the license or a
// step pose changes. Needs playwright-core (a root devDependency) and a local
// Chrome or Edge.
import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { launchBrowser } from "./browser.mjs";
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
const PUBLIC = path.join(ROOT, "src", "web-console", "public");
const STEPS = [
["pathfinder", "Pathfinder"],
["plan", "Plan"],
["document", "Document"],
["implement", "Implement"],
["finalize", "Finalize"],
];
const TAGLINE = "Plan it. Approve it. Let it build.";
const FOOT = "plan2code.jparkerweb.com · Apache 2.0";
// One pose's <svg> from the console page, by its data-pose.
function pose(html, name) {
const m = new RegExp(`<svg class="pose[^"]*" data-pose="${name}"[\\s\\S]*?</svg>`).exec(html);
if (!m) throw new Error(`no data-pose="${name}" in index.html`);
return m[0];
}
// A fixed sky, so two runs draw the same picture.
function stars() {
let seed = 7;
const rand = () => ((seed = (seed * 16807) % 2147483647) / 2147483647);
const out = [];
// Kept off the words and the step labels, where a dot reads as punctuation.
const onText = (x, y) => (x < 40 && y > 15 && y < 82) || (x > 43 && y > 58 && y < 76);
while (out.length < 34) {
const blue = rand() < 0.35;
const x = rand() * 100;
const y = rand() * 100;
if (onText(x, y)) continue;
out.push(`<i style="left:${x.toFixed(2)}%;top:${y.toFixed(2)}%;width:${blue ? 3 : 2 + Math.round(rand())}px;height:${blue ? 3 : 2 + Math.round(rand())}px;background:${blue ? "var(--accent)" : "var(--ink-3)"};opacity:${(0.35 + rand() * 0.5).toFixed(2)}"></i>`);
}
return out.join("");
}
const index = fs.readFileSync(path.join(PUBLIC, "index.html"), "utf8");
const css = (f) => pathToFileURL(path.join(PUBLIC, "styles", f)).href;
const page = `<!doctype html>
<html data-theme="dark"><head><meta charset="utf-8">
<link rel="stylesheet" href="${css("tokens.css")}">
<link rel="stylesheet" href="${css("poses.css")}">
<style>
*, *::before, *::after { animation: none !important; transition: none !important; }
html, body { margin: 0; background: var(--bg); }
.banner { position: relative; width: 1024px; height: 300px; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--sans); }
.sky i { position: absolute; border-radius: 50%; }
.words { position: absolute; left: 44px; top: 62px; }
h1 { margin: 0; font: 700 74px/1 var(--serif); letter-spacing: -1px; color: var(--ink); }
h1 b { color: var(--accent); font-weight: 700; }
.tag { margin: 22px 0 0; font-size: 23px; color: var(--ink-2); }
.tag em { font-style: normal; color: var(--accent); }
.foot { margin: 22px 0 0; font-size: 12px; font-weight: 600; letter-spacing: 2.4px; text-transform: uppercase; color: var(--ink-3); }
.steps { position: absolute; left: 462px; right: 40px; top: 86px; display: flex; justify-content: space-between; }
.path { position: absolute; left: 470px; right: 52px; top: 176px; border-top: 2px dashed var(--rule-2); }
.step { width: 104px; text-align: center; position: relative; }
.step .pose { height: 92px; width: auto; margin: 0 auto; display: block; }
.step span { display: block; margin-top: 14px; font-size: 12px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase; color: var(--ink-2); }
</style></head><body>
<div class="banner">
<div class="sky">${stars()}</div>
<div class="words">
<h1>Plan<b>2</b>Code</h1>
<p class="tag">Plan it. Approve it. <em>Let it build.</em></p>
<p class="foot">${FOOT}</p>
</div>
<div class="path"></div>
<div class="steps">${STEPS.map(([id, label]) => `<div class="step">${pose(index, id)}<span>${label}</span></div>`).join("")}</div>
</div>
</body></html>`;
if (!page.includes(TAGLINE.split(" Let")[0])) throw new Error("tagline drifted");
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "p2c-banner-"));
const file = path.join(tmp, "banner.html");
fs.writeFileSync(file, page);
const flag = process.argv.indexOf("--browser");
const browser = await launchBrowser(flag > 0 ? { executablePath: process.argv[flag + 1] } : {});
try {
const tab = await browser.newPage({ viewport: { width: 1024, height: 300 }, deviceScaleFactor: 2, colorScheme: "dark" });
await tab.goto(pathToFileURL(file).href);
await tab.evaluate(() => document.fonts.ready);
const out = path.join(ROOT, "docs", "banner.jpg");
await tab.screenshot({ path: out, type: "jpeg", quality: 90, clip: { x: 0, y: 0, width: 1024, height: 300 } });
console.log(`wrote ${path.relative(ROOT, out)} (${Math.round(fs.statSync(out).size / 1024)} KB)`);
} finally {
await browser.close();
fs.rmSync(tmp, { recursive: true, force: true });
}
+2 -2
View File
@@ -1,6 +1,6 @@
{ {
"name": "Plan2Code", "name": "Plan2Code",
"version": "3.2.2", "version": "3.2.3",
"description": "A structured workflow of six steps (Pathfinder, Plan, Document, Implement, Review, Finalize) for AI-assisted software development", "description": "A structured workflow of six steps (Pathfinder, Plan, Document, Implement, Review, Finalize) for AI-assisted software development",
"keywords": [ "keywords": [
"ai", "ai",
@@ -17,6 +17,6 @@
"url": "https://github.com/jparkerweb/plan2code" "url": "https://github.com/jparkerweb/plan2code"
}, },
"homepage": "https://github.com/jparkerweb/plan2code", "homepage": "https://github.com/jparkerweb/plan2code",
"releaseDate": "2026-11-30", "releaseDate": "2026-12-02",
"mode": "utility" "mode": "utility"
} }