diff --git a/AGENTS.md b/AGENTS.md index c4e938c..3fa75d0 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -98,4 +98,5 @@ When you make a mistake, get corrected, or discover something about this codebas - When a new first-run dialog is added to the web console, set its seen flag in `scripts/capture-screenshots.mjs`'s `looks.json` too: the Welcome dialog once covered the regenerated dashboard screenshots until `welcomeSeen: true` was added. - After a sync, grep for the upstream brand word on its own too, not only the full product name: the rebrand map misses a bare brand word inside identifiers and fixtures (a `KEPT__ENTRIES` constant, a `Dir` option, a `""` test folder, an owner slug in a git remote URL), and v2.7.0's sync let all four through until the residual grep caught them. - After a sync, grep for the upstream ticket key followed by anything, not only by digits: v2.8.0's git board fixtures built branch names as `` `feature/-${11000 + i}-…` `` template literals, which a digits-only rewrite to `ABC-` misses. +- Import `scripts/skill-script-helpers.mjs` in any test that builds git fixtures for a skill script or `git-repo.mjs`: it scrubs the whole test process's git config, so fixtures, imported modules and spawned scripts agree. Mixed configs broke `git plan switch` once (a global `core.autocrlf=true` checked fixtures out with CRLF the scrubbed script read as changed). - Before deleting a test file that upstream split or removed, diff plan2code's copy against the rebranded upstream base and port the plan2code-only tests: v2.7.0's split of the web console suite would otherwise have dropped seven hardening tests (now in `scripts/test-web-console-hardening.mjs`). diff --git a/CHANGELOG.md b/CHANGELOG.md index 2fcb2fd..4b13822 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,17 @@ All notable changes to Plan2Code will be documented in this file. +## v2.8.1 + +### 📚 Documentation + +- **docs**: the docs site now shows the git board, with a light and dark screenshot under the pipeline's "Any time" cards: the Changes, Branches and Sync tabs, opening on the likely next step, the tab badges, the single block for a stopped rebase or merge, and asking before every push, publish or delete. +- **docs**: `scripts/capture-screenshots.mjs` gains a `git` shot. It builds a sample repository with a pushed feature branch and three changes to commit, so `node scripts/capture-screenshots.mjs --only git` regenerates the images. + +### 🐛 Fixed + +- **tests**: `npm test` no longer fails `git plan switch` on a machine with a global `core.autocrlf=true`. `scripts/skill-script-helpers.mjs` now strips back the git config for the whole test process, so test fixtures, imported modules and the scripts under test always use the same settings. + ## v2.8.0 ### 🔧 Changed diff --git a/docs/index.html b/docs/index.html index 0d93a4b..6042246 100644 --- a/docs/index.html +++ b/docs/index.html @@ -310,6 +310,17 @@ footer a { color: inherit; }
Any time

Changelog

Picks the next version and drafts the entries, which you edit before Git commits them.

Any time

Git

A board for branches, pull, push and commits that opens on the likely next step.

+ +
+ + + The git board on feature/task-endpoints: the Changes tab, badged 3, opens on a Next step card reading Commit 3 files, above the three changed files ticked for the commit. Branches and Sync tabs and a Done with git button sit beside it. + +
+

The git board

+

Three tabs, Changes, Branches and Sync, and it opens on the one holding your likely next step: commit, pull, push, publish, open a pull request or tidy up branches. That step is one main button. Each tab badges what is waiting on it, a stopped rebase or merge gets one block with every file marked, and nothing is pushed, published or deleted without asking. It never force-pushes.

+
+
diff --git a/docs/screenshots/git-dark.webp b/docs/screenshots/git-dark.webp new file mode 100644 index 0000000..8d7a6c4 Binary files /dev/null and b/docs/screenshots/git-dark.webp differ diff --git a/docs/screenshots/git-light.webp b/docs/screenshots/git-light.webp new file mode 100644 index 0000000..94ff5a3 Binary files /dev/null and b/docs/screenshots/git-light.webp differ diff --git a/package.json b/package.json index 09982c4..75f03f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "plan2code", - "version": "2.8.0", + "version": "2.8.1", "private": true, "bin": { "plan2code-install": "./install.js" diff --git a/scripts/capture-screenshots.mjs b/scripts/capture-screenshots.mjs index 74866c8..808062a 100644 --- a/scripts/capture-screenshots.mjs +++ b/scripts/capture-screenshots.mjs @@ -13,7 +13,7 @@ // The shots use the console's Ocean highlight rather than its default orange: // it is the console's nearest to the Plan2Code blue the site and README use. // -// Shots: dashboard, dashboard-utilities, question, doc, build, signoff, finish, ask. +// Shots: dashboard, dashboard-utilities, question, doc, build, signoff, finish, ask, git. // // Needs puppeteer-core (`npm i --no-save puppeteer-core`, never added to // package.json) and a local Chrome or Edge. Writes nothing outside its temp @@ -67,6 +67,9 @@ const SHOTS = { signoff: { workflow: "implement", posts: ["signoff"] }, finish: { workflow: "implement", posts: ["signoff", "finish"] }, ask: { workflow: "plan", posts: ["question"], ask: "Where are tasks paged?" }, + // The git board draws itself from a real repository, so this shot runs in + // its own git sample project; the post only hands the board back to you. + git: { workflow: "git", posts: ["git"], repo: true }, }; // On Windows the temp dir sits under the user's profile, and the page can @@ -166,6 +169,46 @@ function makeSampleProject() { return project; } +function git(cwd, ...gitArgs) { + const r = spawnSync("git", gitArgs, { cwd, env: ENV, encoding: "utf8" }); + if (r.status !== 0) throw new Error(`git ${gitArgs.join(" ")} failed: ${(r.stderr || "").trim()}`); +} + +// The git shot's project: the same sample in a repository whose feature branch +// is pushed to a local bare "origin" and has three changes to commit, so the +// board opens on Changes with Commit as the next step. It sits in its own +// folder so the other shots never see a repository. +let GIT_PROJECT = null; +function makeGitProject() { + if (GIT_PROJECT) return GIT_PROJECT; + const parent = path.join(SCRATCH, "git"); + fs.mkdirSync(parent, { recursive: true }); + const origin = path.join(parent, "origin.git"); + git(parent, "init", "--bare", "--initial-branch=main", origin); + const prev = SCRATCH; + SCRATCH = parent; + const project = makeSampleProject(); + SCRATCH = prev; + const id = ["-c", "user.name=Sam Rivera", "-c", "user.email=sam@example.com", "-c", "commit.gpgsign=false"]; + git(project, "init", "--initial-branch=main"); + git(project, "remote", "add", "origin", origin); + git(project, "add", "-A"); + git(project, ...id, "commit", "-m", "Scaffold the task API and its specs"); + git(project, "push", "-u", "origin", "main"); + git(project, "switch", "-c", "feature/task-endpoints"); + fs.writeFileSync(path.join(project, "src", "tasks", "routes.js"), "// The /tasks routes.\nexport default async function routes(app) {}\n"); + git(project, "add", "-A"); + git(project, ...id, "commit", "-m", "Register the /tasks routes plugin"); + git(project, "push", "-u", "origin", "feature/task-endpoints"); + // A fetch stamps FETCH_HEAD, so the board says "Last refreshed" rather than "Never". + git(project, "fetch", "origin"); + fs.appendFileSync(path.join(project, "src", "tasks", "paginate.js"), "\nexport const MAX_LIMIT = 50;\n"); + fs.writeFileSync(path.join(project, "src", "tasks", "schema.js"), "// The Zod schema for a task.\nexport const taskSchema = {};\n"); + fs.appendFileSync(path.join(project, "specs", "task-api", "phase-3.md"), "\n\n"); + GIT_PROJECT = project; + return project; +} + function cli(cwd, ...cliArgs) { const r = spawnSync(process.execPath, [CONSOLE_CLI, ...cliArgs], { cwd, env: ENV, encoding: "utf8" }); const line = (r.stdout || "").trim().split("\n").pop() || ""; @@ -194,7 +237,7 @@ function stage(project, shot) { // (the dashboard's wake-up is the longest). async function settle(page) { await page.waitForNetworkIdle({ idleTime: 500, timeout: 15000 }).catch(() => {}); - await page.waitForSelector(".dash-card, .card, .handoff, .ask-pane, .doc", { timeout: 15000 }).catch(() => {}); + await page.waitForSelector(".dash-card, .card, .handoff, .ask-pane, .doc, .git-board", { timeout: 15000 }).catch(() => {}); await sleep(3500); } @@ -348,12 +391,13 @@ async function main() { args: ["--no-first-run", "--no-default-browser-check", "--mute-audio"], }); for (const name of names) { - const { sid, url } = stage(project, name); + const where = SHOTS[name].repo ? makeGitProject() : project; + const { sid, url } = stage(where, name); try { - if (SHOTS[name].ask) await captureAsk(browser, project, sid, url, SHOTS[name].ask); + if (SHOTS[name].ask) await captureAsk(browser, where, sid, url, SHOTS[name].ask); else await capture(browser, url, name, SHOTS[name]); } finally { - cli(project, "stop", "--session", sid); + cli(where, "stop", "--session", sid); } } } finally { diff --git a/scripts/screenshots/README.md b/scripts/screenshots/README.md index 0ec0cde..e57223e 100644 --- a/scripts/screenshots/README.md +++ b/scripts/screenshots/README.md @@ -13,6 +13,7 @@ and dark WebP images in `docs/screenshots/`. | `build.json` | A phase being built: the progress bar, the task list and the current task | | `signoff.json` | The completion report and the sign-off card | | `finish.json` | The finished screen after sign-off (posted after `signoff.json`) | +| `git.json` | The git board, handed back to you in a sample repository with three changes to commit (the script builds the repository) | Refresh every image with `node scripts/capture-screenshots.mjs`, or one with `--only `. diff --git a/scripts/screenshots/git.json b/scripts/screenshots/git.json new file mode 100644 index 0000000..cb78e4b --- /dev/null +++ b/scripts/screenshots/git.json @@ -0,0 +1,5 @@ +{ + "reread": true, + "board": { "describe": "task-schema-and-paging" }, + "agent": { "status": "waiting" } +} diff --git a/scripts/skill-script-helpers.mjs b/scripts/skill-script-helpers.mjs index aba65ed..121fa48 100644 --- a/scripts/skill-script-helpers.mjs +++ b/scripts/skill-script-helpers.mjs @@ -57,6 +57,13 @@ export function scrubbedEnv(extra = {}) { return { ...e, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: EMPTY_GITCONFIG, ...extra }; } +// Every git in a test process that imports this file runs under that same +// scrubbed config: fixture commands, the modules a test imports and the +// scripts it spawns. Mixed configs disagree: a global core.autocrlf=true once +// checked fixtures out with CRLF that the scrubbed scripts read as changed. +for (const k of AMBIENT_GIT_ENV) delete process.env[k]; +Object.assign(process.env, { GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: EMPTY_GITCONFIG }); + export function runScript(skill, script, args, { cwd, env } = {}) { const r = spawnSync(process.execPath, [path.join(SKILLS, skill, "scripts", script), ...args], { cwd: cwd || ROOT, @@ -83,7 +90,7 @@ export function write(root, rel, content) { export const read = (root, rel) => fs.readFileSync(path.join(root, rel), "utf8"); -/** A git runner for `dir`. */ +/** A git runner for `dir`, under the scrubbed config set beside `scrubbedEnv`. */ export const gitIn = (dir) => (...a) => execFileSync("git", a, { cwd: dir, stdio: "pipe", encoding: "utf8" }); export function gitInit(dir, branch = "main") { diff --git a/version.json b/version.json index 08153fa..4a6432f 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { "name": "Plan2Code", - "version": "2.8.0", + "version": "2.8.1", "description": "A structured 4-step workflow methodology for AI-assisted software development", "keywords": [ "ai",