Add the changelog skill and dashboard card to v2.6.0

AI Assisted
This commit is contained in:
jparkerweb committed 2026-10-08 07:22:26 -07:00
1 parent 50a78a6917
commit 3414a19ce6
18 files changed
+754 -11

No files matched your search

+3 -1
View File
@@ -104,6 +104,7 @@ plan2code/
| `plan2code-review.md` | review | Post-implementation comprehensive review |
| `plan2code-4-finalize.md` | 4 | Validate, summarize, feedback, archive (steps 1–7, +optional 6.5) |
| `plan2code-handoff.md` | handoff | Compact the conversation into a self-contained handoff document for a fresh session |
| `plan2code-changelog.md` | changelog | Check the CHANGELOG version against the default branch, suggest editable entries for new work, keep `package.json` aligned, offer Git commit |
| `plan2code-git-commit.md` | git-commit | Commit with a clear message, suggested splits, a branch offer on the default branch, and an optional push |
## Naming Convention
@@ -149,6 +150,7 @@ Anything a workflow step decides with one correct answer (parsing a spec's check
| `pathfinder.mjs` (own) | 0-pathfinder | `reconcile`, `frontier`, `claim`, `resolve`, `rule-out`, `trail`, `gate`, `lint`, `brief-data` |
| `feedback-payload.mjs` (own) | 4-finalize | STEP 6.5's payload (real sha256 prompt hashes) and the gh / browser / print submission tiers |
| `handoff-path.mjs` (own) | handoff | Timestamped path, OS temp dir, git ignore check |
| `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-state.mjs` (own) | git-commit | `state`, `branch-check`, `init-check`: the repo snapshot, branch-name check and git init safety check, read-only |
**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 "<S>/<name>.mjs"`, where `<S>` is `scripts/` beside it.
@@ -245,7 +247,7 @@ Key design points:
- **Help is in the page, built on first open.** The **?** button (`#btn-about`) opens `<dialog id="help-modal">`, which replaced the old "What this page is" About dialog. Its 17 panels and their icon sheet are hand-written HTML and SVG in `<template id="help-content">` in `index.html` (after `#start-poses`), cloned into `#help-panels` the first time **?** is pressed, so first load builds nothing and Help still reads fully once the server is gone. `help.js` supplies the tab list and rules, `app.js` the wiring (tab buttons, roving focus, `renderAbout()` for the live connection line on tab 1, `lightDismiss()`, and a Ctrl/⌘+Enter guard scoped to this dialog). SVG is styled by class and CSS variables only — a `style=` attribute is dropped by the CSP, and a test fails on one — and every number the prose quotes sits in a `data-fact` span a test checks against the constant it comes from.
- **Markdown is rendered to DOM nodes, never to an HTML string** (`public/render.js`), so agent-authored text that quotes a hostile source cannot execute. Only `marked.lexer()` is used.
Tests: `npm test` runs, in order, `validate-char-count.js`, `install.js --build-skills`, `parse-check.mjs`, `check-skill-table.mjs`, then `node --test scripts/test-web-console.mjs scripts/test-launcher.mjs scripts/test-skill-scripts.mjs scripts/test-script-pathfinder.mjs scripts/test-script-finalize.mjs scripts/test-script-handoff.mjs scripts/test-script-git-commit.mjs`. The parse check exists because `node --check` parses a `.js` file as a CommonJS script and has already let a browser-fatal string literal through; it imports each shipped module as a real ES module instead. They live in `scripts/`, not `src/web-console/`, because everything under the latter ships into every skill.
Tests: `npm test` runs, in order, `validate-char-count.js`, `install.js --build-skills`, `parse-check.mjs`, `check-skill-table.mjs`, then `node --test scripts/test-web-console.mjs scripts/test-launcher.mjs scripts/test-skill-scripts.mjs scripts/test-script-pathfinder.mjs scripts/test-script-finalize.mjs scripts/test-script-handoff.mjs scripts/test-script-git-commit.mjs scripts/test-script-changelog.mjs`. The parse check exists because `node --check` parses a `.js` file as a CommonJS script and has already let a browser-fatal string literal through; it imports each shipped module as a real ES module instead. They live in `scripts/`, not `src/web-console/`, because everything under the latter ships into every skill.
**Adding a file under `public/` needs three edits, not one:** the file itself, the `SERVABLE` allow-list in `server.mjs`, and (for a module the page imports) a `<link rel="modulepreload">` in `index.html`. The set is hardcoded rather than a directory lookup so there is nothing to traverse; a new module missing from it 404s and the page dies at import with no useful error (a test fetches every import and fails naming the file). A module missing its preload still works, but loads serially after `app.js` and slows the first paint.
+1
View File
@@ -8,6 +8,7 @@ All notable changes to Plan2Code will be documented in this file.
- **web-console**: the breakdown question's "Anything else about this breakdown?" field has a **No changes** button. One click fills the box with "no changes", so you no longer type it. The old "(type 'no changes' if none)" hint is gone from the label.
- **git-commit**: a new `/plan2code-git-commit` skill and dashboard card. It reads what changed, drafts the commit message for your approval, offers a new branch first on the default branch, suggests splitting work that is really two jobs, and asks before every commit and push (never a force-push). Outside a git repository it offers to start one.
- **changelog**: a new `/plan2code-changelog` skill and dashboard card, just left of Git commit. It reads the default branch's latest version, classifies the branch's work and picks the version. When the branch already owns a version that is not released and not on another branch, it adds to that entry instead of starting a new one. It compares the branch with the newest entry, suggests the entries that are missing for you to edit, keeps `package.json` aligned, and offers to run Git commit next. The facts come from `changelog-state.mjs`, with tests in `scripts/test-script-changelog.mjs`.
- **web-console**: the dashboard scan reports `isGit`, found from the filesystem without spawning git (linked worktrees count). The Git commit card stays clickable outside a repository and says "Not a git repository yet: it offers to start one". The skill has its own Planny pose and a Help entry.
### 🔧 Changed
+1
View File
@@ -32,6 +32,7 @@ Every command below is what a dashboard card runs. Typed on its own, each one as
| 3+review | /plan2code-3-implement-review | overview.md | Reviewed implementation ready for approval (alternative to `/plan2code-3-implement`) |
| 4 | /plan2code-4-finalize | overview.md | Archived specs |
| handoff | /plan2code-handoff | Conversation | Self-contained handoff doc (OS temp dir by default, or a folder you pick such as `handoffs/`) |
| changelog | /plan2code-changelog | Your branch | `CHANGELOG.md` entries and the `package.json` version, from the default branch's latest version |
| git-commit | /plan2code-git-commit | Your changes | A commit (`<subject>` / `AI Assisted`): suggested splits, a branch offer on the default branch, optional push |
**Terminal instead:** run any command without `--web` and answer the interface question with **terminal**. Nothing is lost: same questions, same gates, same files under `specs/`. You can switch between the two mid-feature.
+2
View File
@@ -183,6 +183,7 @@ The dashboard's cards, and when each one lights up for the spec you pick:
| Quick task | Too small for the full process? A quick plan, then it just builds it. | Always |
| Review | A second opinion on the changes. Problems ranked, and you pick what gets fixed. | Always |
| Handoff | Pack this conversation into a document a fresh session can pick up cold. | Always |
| Changelog | Checks the CHANGELOG version against the main branch and suggests entries for what is new. | Always |
| Git commit | Commits your changes with a clear message, suggests a split when it is really two jobs, and offers to push. | Always (offers to start a repository outside one) |
---
@@ -350,6 +351,7 @@ console or the terminal; add `--web` to skip the question and go straight to the
| `/plan2code-quick-task` | A small change that doesn't warrant the full sequence |
| `/plan2code-1b-revise-plan` | Requirements moved mid-build. Revise the specs, not the code |
| `/plan2code-handoff` | Compact this conversation into a doc the next one resumes from |
| `/plan2code-changelog` | Check the CHANGELOG version against the default branch, suggest entries for new work you can edit, keep `package.json` aligned, then offer Git commit |
| `/plan2code-git-commit` | Commit with a clear message, suggested splits, a branch offer on the default branch, and an optional push |
---
+11
View File
@@ -263,6 +263,16 @@ const SOURCE_PROMPTS = [
scripts: ['specs.mjs'],
additionalReferences: [{ source: 'web-console', target: 'web-console' }]
},
{
source: 'plan2code-changelog.md',
stepNumber: 'changelog',
name: 'changelog',
displayName: 'Changelog Mode',
description: 'Check the CHANGELOG version against the default branch, suggest entries for new work, keep package.json aligned',
isUtility: true,
scripts: [],
additionalReferences: [{ source: 'web-console', target: 'web-console' }]
},
{
source: 'plan2code-git-commit.md',
stepNumber: 'git-commit',
@@ -299,6 +309,7 @@ function generateStepLabel(prompt) {
if (prompt.stepNumber === 'review') return 'Review';
if (prompt.stepNumber === 'handoff') return 'Handoff';
if (prompt.stepNumber === 'git-commit') return 'Git Commit';
if (prompt.stepNumber === 'changelog') return 'Changelog';
if (prompt.stepNumber === 'quick') return 'Quick Task';
return `Step ${prompt.stepNumber}`;
}
+1 -1
View File
@@ -8,7 +8,7 @@
"scripts": {
"prepare": "husky",
"build:skills": "node install.js --build-skills",
"test": "node scripts/validate-char-count.js && node install.js --build-skills && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node --test scripts/test-web-console.mjs scripts/test-launcher.mjs scripts/test-skill-scripts.mjs scripts/test-script-pathfinder.mjs scripts/test-script-finalize.mjs scripts/test-script-handoff.mjs scripts/test-script-git-commit.mjs"
"test": "node scripts/validate-char-count.js && node install.js --build-skills && node scripts/parse-check.mjs && node scripts/check-skill-table.mjs && node --test scripts/test-web-console.mjs scripts/test-launcher.mjs scripts/test-skill-scripts.mjs scripts/test-script-pathfinder.mjs scripts/test-script-finalize.mjs scripts/test-script-handoff.mjs scripts/test-script-git-commit.mjs scripts/test-script-changelog.mjs"
},
"devDependencies": {
"husky": "^9.0.0"
+186
View File
@@ -0,0 +1,186 @@
// Tests for plan2code-changelog's scripts/changelog-state.mjs.
//
// See skill-script-helpers.mjs for how these run.
import { test } from "node:test";
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { runScript, tmp, write, read, gitInit } from "./skill-script-helpers.mjs";
const S = (cwd, ...a) => runScript("plan2code-changelog", "changelog-state.mjs", a, { cwd });
const V = (version, body = "### ✨ Added\n\n- **x**: a thing.\n") => `## v${version}\n\n${body}\n`;
const LOG = (...entries) => `# Changelog\n\nAll notable changes.\n\n${entries.join("")}`;
// A repo whose main has CHANGELOG at `top`, plus the runner.
function repo(name, { changelog = LOG(V("1.0.0")), pkg = true } = {}) {
const dir = tmp(name);
const g = gitInit(dir, "main");
write(dir, "CHANGELOG.md", changelog);
if (pkg) write(dir, "package.json", `{\n "name": "x",\n "version": "1.0.0",\n "private": true\n}\n`);
write(dir, "a.txt", "a\n");
g("add", "-A");
g("commit", "-q", "-m", "init");
return { dir, g };
}
const commitAll = (g, msg) => {
g("add", "-A");
g("commit", "-q", "-m", msg);
};
test("changelog-state: not a repository and no CHANGELOG are exit 3", () => {
const plain = tmp("cl-plain");
const a = S(plain, "state");
assert.equal(a.code, 3);
assert.equal(a.json.error, "not-a-repo");
const { dir } = repo("cl-nolog", { changelog: "x" });
execFileSync("git", ["rm", "-q", "CHANGELOG.md"], { cwd: dir });
const b = S(dir, "state");
assert.equal(b.code, 3);
assert.equal(b.json.error, "no-changelog");
});
test("changelog-state: on the default branch there is no new entry and the version is the base's", () => {
const { dir } = repo("cl-main");
const r = S(dir, "state");
assert.equal(r.code, 0, r.stderr);
assert.equal(r.json.branch, "main");
assert.equal(r.json.onDefault, true);
assert.deepEqual([r.json.base.ref, r.json.base.version], ["main", "1.0.0"], "no origin: the local default branch is the base");
assert.equal(r.json.topIsNew, false);
});
test("changelog-state: a branch with no entry above main needs a new version, not an extension", () => {
const { dir, g } = repo("cl-noentry");
g("switch", "-q", "-c", "feature/x");
write(dir, "b.txt", "b\n");
commitAll(g, "add b");
const r = S(dir, "state");
assert.equal(r.json.base.version, "1.0.0");
assert.equal(r.json.topIsNew, false);
assert.equal(r.json.canExtend, false);
assert.equal(r.json.entryBump, "none");
assert.deepEqual(r.json.commits.map((c) => c.subject), ["add b"]);
assert.deepEqual(r.json.files, ["b.txt"]);
assert.equal(r.json.entry, "", "main's released entry is not this branch's to compare against");
});
test("changelog-state: an entry above main that nobody else has can be extended", () => {
const { dir, g } = repo("cl-extend");
g("switch", "-q", "-c", "feature/x");
write(dir, "CHANGELOG.md", LOG(V("1.1.0"), V("1.0.0")));
commitAll(g, "changelog 1.1.0");
write(dir, "b.txt", "b\n");
commitAll(g, "later work");
write(dir, "c.txt", "c\n");
const r = S(dir, "state");
assert.equal(r.json.branchTop.version, "1.1.0");
assert.equal(r.json.topIsNew, true);
assert.equal(r.json.entryBump, "minor");
assert.equal(r.json.released, false);
assert.deepEqual(r.json.takenBy, []);
assert.equal(r.json.canExtend, true);
// The gap is what came after the entry was last touched, plus the working tree.
assert.deepEqual(r.json.commits.map((c) => c.subject), ["later work"]);
assert.deepEqual(r.json.files, ["b.txt"]);
assert.deepEqual(r.json.uncommitted, ["c.txt"]);
assert.match(r.json.entry, /^## v1\.1\.0/);
assert.deepEqual(r.json.sectionHeadings, ["### ✨ Added"]);
});
test("changelog-state: a tagged version is released, and one on another branch is taken", () => {
const { dir, g } = repo("cl-spent");
g("switch", "-q", "-c", "feature/x");
write(dir, "CHANGELOG.md", LOG(V("1.1.0"), V("1.0.0")));
commitAll(g, "changelog 1.1.0");
g("switch", "-q", "-c", "feature/other");
write(dir, "o.txt", "o\n");
commitAll(g, "other work");
g("switch", "-q", "feature/x");
assert.deepEqual(S(dir, "state").json.takenBy, ["feature/other"], "a branch that already holds the version");
assert.equal(S(dir, "state").json.canExtend, false);
g("branch", "-D", "feature/other");
g("tag", "v1.1.0");
const r = S(dir, "state");
assert.equal(r.json.released, true);
assert.equal(r.json.canExtend, false);
});
test("changelog-state: a branch that is only part of this one's history is no claim", () => {
const { dir, g } = repo("cl-history");
g("switch", "-q", "-c", "feature/x");
write(dir, "CHANGELOG.md", LOG(V("1.1.0"), V("1.0.0")));
commitAll(g, "changelog 1.1.0");
g("branch", "behind-me");
write(dir, "b.txt", "b\n");
commitAll(g, "more");
assert.deepEqual(S(dir, "state").json.takenBy, []);
});
test("changelog-state: reads the heading style and package.json alignment", () => {
const log = `# Changelog\n\n## [2.0.0] - 2026-01-02\n\n### Fixed\n\n- y\n\n## [1.0.0] - 2025-12-01\n\n### Added\n\n- x\n`;
const { dir } = repo("cl-style", { changelog: log });
const r = S(dir, "state");
assert.equal(r.json.heading.style, "bracketed");
assert.equal(r.json.heading.dated, true);
assert.equal(r.json.heading.separator, "-");
assert.equal(r.json.package.version, "1.0.0");
assert.equal(r.json.package.matches, false, "package.json lags the CHANGELOG's 2.0.0");
const b = S(dir, "bump", "--from", "2.0.0", "--kind", "patch");
assert.equal(b.json.version, "2.0.1");
assert.equal(b.json.heading, "## [2.0.1] - 2026-08-03");
});
test("changelog-state: an Unreleased heading is not a version and package.json is not aligned to it", () => {
const log = `# Changelog\n\n## [Unreleased]\n\n### Added\n\n- soon\n\n## [1.0.0] - 2025-12-01\n\n- x\n`;
const { dir } = repo("cl-unreleased", { changelog: log });
const r = S(dir, "state");
assert.equal(r.json.branchTop.unreleased, true);
assert.equal(r.json.branchTop.version, null);
assert.equal(r.json.topIsNew, false);
assert.equal(r.json.package.matches, false);
assert.match(r.json.entry, /^## \[Unreleased\]/);
});
test("changelog-state bump: kinds and bad input", () => {
const { dir } = repo("cl-bump");
assert.equal(S(dir, "bump", "--from", "1.2.3", "--kind", "major").json.version, "2.0.0");
assert.equal(S(dir, "bump", "--from", "1.2.3", "--kind", "minor").json.version, "1.3.0");
assert.equal(S(dir, "bump", "--from", "v1.2.3", "--kind", "patch").json.version, "1.2.4");
assert.equal(S(dir, "bump", "--from", "1.2.3", "--kind", "huge").code, 2);
const bad = S(dir, "bump", "--from", "one", "--kind", "patch");
assert.equal(bad.code, 4);
assert.equal(bad.json.error, "bad-version");
});
test("changelog-state set-package-version: changes the version field and nothing else", () => {
const { dir } = repo("cl-pkg");
const before = read(dir, "package.json");
const r = S(dir, "set-package-version", "--version", "1.1.0");
assert.equal(r.code, 0, r.stderr);
assert.deepEqual([r.json.from, r.json.to, r.json.changed], ["1.0.0", "1.1.0", true]);
assert.equal(read(dir, "package.json"), before.replace('"1.0.0"', '"1.1.0"'));
assert.equal(S(dir, "set-package-version", "--version", "1.1.0").json.changed, false);
write(dir, "package.json", `{ "name": "x" }\n`);
assert.equal(S(dir, "set-package-version", "--version", "1.1.0").code, 4);
write(dir, "package.json", `{
"config": {
"version": "9.9.9"
},
"version": "1.0.0"
}
`);
const nested = S(dir, "set-package-version", "--version", "1.1.0");
assert.equal(nested.code, 5);
assert.equal(nested.json.error, "ambiguous-version");
assert.equal(read(dir, "package.json").includes("9.9.9"), true, "nothing was written");
});
test("changelog-state: new SKILL.md files are reported", () => {
const { dir, g } = repo("cl-skill");
g("switch", "-q", "-c", "feature/skill");
write(dir, "skills/new-thing/SKILL.md", "---\nname: new-thing\n---\n");
commitAll(g, "add a skill");
assert.deepEqual(S(dir, "state").json.addedSkills, ["skills/new-thing/SKILL.md"]);
});
+14 -1
View File
@@ -5374,7 +5374,7 @@ test("subagents: the page shows the switch only when offered and supported, and
assert.equal(showTab(on, undefined), false);
assert.equal(showTab(off, [helper]), true, "a helper shows with the switch off (Pathfinder research)");
assert.equal(showTab({ ...on, supported: false }, [helper]), false, "no tab where the switch cannot show");
assert.ok(CHECKIN_LINE.includes("check-ins, not live"));
assert.ok(CHECKIN_LINE.includes("checks in, not live"));
});
test("subagents: helperRows labels each state, shows a result only once a helper ended, and collapses to working alone", () => {
@@ -6958,3 +6958,16 @@ test("update banner: built only on the dashboard, dismissed per session, and Hel
assert.ok(help, "app.js has renderHelpVersion");
assert.match(help[1], /releasesLink\(/, "the help version is a Releases link");
});
// The Changelog card sits left of Git commit, always clickable, and a launch
// from it resumes the session under its own workflow.
test("the Changelog card comes just before Git commit and is always on", () => {
const skills = SKILL_CATALOG.map((e) => e.skill);
assert.equal(skills.indexOf("plan2code-changelog") + 1, skills.indexOf("plan2code-git-commit"));
const entry = SKILL_CATALOG.find((e) => e.skill === "plan2code-changelog");
assert.equal(entry.workflow, "changelog");
assert.equal(entry.command, "/plan2code-changelog");
for (const scan of [{ hasAgents: true, isGit: false }, { hasAgents: false }, null]) {
assert.equal(cardAvailability(entry, scan, null).on, true);
}
});
@@ -0,0 +1,396 @@
#!/usr/bin/env node
// changelog-state.mjs: what the Changelog skill needs to know about CHANGELOG.md.
//
// The skill's questions about versions have one correct answer each: which
// version is the default branch at, does this branch already own an entry above
// it, has that entry been released or claimed by another branch, what is the
// next version, what has the branch done since the entry was last touched. They
// live here so no prompt works them out by eye or per shell. This script only
// reads, except `set-package-version`, which changes the one `version` field of
// package.json and nothing else. The agent writes CHANGELOG.md itself, behind a
// yes.
import fs from "node:fs";
import path from "node:path";
import { execFileSync } from "node:child_process";
import { EXIT, fail, isoDate, out, parseArgs, run } from "./common.mjs";
const USAGE = `
changelog-state.mjs: read-only facts about CHANGELOG.md and its versions. JSON on
stdout. It never changes CHANGELOG.md.
node changelog-state.mjs state
node changelog-state.mjs bump --from <x.y.z> --kind major|minor|patch
node changelog-state.mjs set-package-version --version <x.y.z>
state Run from inside a repository. Prints { ok, root, branch,
defaultBranch, base, onDefault, today, changelog, base,
branchTop, topIsNew, entryBump, released, takenBy, canExtend,
heading, sectionHeadings, entry, package, commits, files,
uncommitted, addedSkills }.
base { ref, version, date } the default branch's top
version (origin/<default> when it exists).
branchTop { version, line, unreleased } this branch's top
entry in the working file, else null.
topIsNew the branch's top version is above the base's.
entryBump major, minor, patch or none: how far the branch's
top version is above the base's.
released the top version is a tag or already in the base.
takenBy other branches whose CHANGELOG has that version.
canExtend topIsNew and not released and not takenBy: new
entries can go under that version, no new one.
heading { style, bracket, v, dated, separator, example }
the file's own heading style, to be copied.
sectionHeadings
the "###" lines the file uses, in first-seen order.
entry the branch's own top entry (up to 200 lines); empty
when the top entry is the default branch's.
package { exists, version, lockfile, matches }.
commits [{ hash, subject }] since the entry was last
touched on this branch (else since the base).
files paths changed in those commits.
uncommitted paths changed in the working tree, CHANGELOG.md
left out.
addedSkills SKILL.md files the branch adds against the base.
bump The next version: { ok, from, kind, version, heading } where
heading is the new "## ..." line in the file's own style.
set-package-version
Set package.json's "version" and nothing else (the file's
formatting is kept). Exit 4 when it has no version field.
Exit: 0 ok · 1 crash · 2 bad arguments · 3 not a git repository or no
CHANGELOG.md · 4 invalid version · 5 package.json's first "version" is not the
top-level field.
`;
const CHANGELOG = "CHANGELOG.md";
const HEADING = /^##[ \t]+(\[)?(v)?(\d+)\.(\d+)\.(\d+)(\])?(.*)$/;
const UNRELEASED = /^##[ \t]+\[?unreleased\]?/i;
const LIST_CAP = 300;
function git(args, cwd, { raw = false } = {}) {
try {
const stdout = execFileSync("git", args, {
cwd,
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
maxBuffer: 64 * 1024 * 1024,
env: { ...process.env, GIT_OPTIONAL_LOCKS: "0" },
});
return { ok: true, out: raw ? stdout : stdout.trim() };
} catch {
return { ok: false, out: "" };
}
}
const lines = (s) => s.split(/\r?\n/).filter(Boolean);
function requireRepo() {
const top = git(["rev-parse", "--show-toplevel"], process.cwd());
if (!top.ok || !top.out) {
fail(EXIT.NOT_FOUND, "not-a-repo", "This directory is not inside a git repository.", "Run the Git commit skill to start one, then come back.");
}
return top.out;
}
/* --------------------------------------------------------------- versions */
const cmp = (a, b) => a[0] - b[0] || a[1] - b[1] || a[2] - b[2];
const str = (v) => v.join(".");
function parseVersion(text, what = "version") {
const m = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(text || "").trim());
if (!m) fail(EXIT.INVALID, "bad-version", `"${text}" is not a ${what} like 1.2.3.`, "Use three numbers joined by dots.");
return [+m[1], +m[2], +m[3]];
}
function bumpOf(from, to) {
if (cmp(to, from) <= 0) return "none";
if (to[0] > from[0]) return "major";
if (to[1] > from[1]) return "minor";
return "patch";
}
function nextVersion(from, kind) {
if (kind === "major") return [from[0] + 1, 0, 0];
if (kind === "minor") return [from[0], from[1] + 1, 0];
return [from[0], from[1], from[2] + 1];
}
/* -------------------------------------------------------------- changelog */
// Every version heading in a CHANGELOG, top to bottom, with the style it uses.
function readHeadings(text) {
const found = [];
const all = text.split(/\r?\n/);
all.forEach((line, i) => {
const m = HEADING.exec(line);
if (!m) return;
const rest = m[7] || "";
const dateM = /^\s*([-–—]|\()\s*(\d{4}-\d{2}-\d{2})\)?\s*$/.exec(rest);
found.push({
line: i,
text: line,
version: [+m[3], +m[4], +m[5]],
bracket: !!m[1],
v: !!m[2],
dated: !!dateM,
separator: dateM ? dateM[1] : null,
date: dateM ? dateM[2] : null,
});
});
return { all, found };
}
// The style most of the headings share; ties go to the topmost.
function dominantStyle(found) {
if (!found.length) return { style: "v-prefixed", bracket: false, v: true, dated: false, separator: null, example: null };
const tally = new Map();
for (const h of found) {
const key = `${h.bracket}|${h.v}|${h.dated}|${h.separator}`;
tally.set(key, (tally.get(key) || 0) + 1);
}
let best = found[0];
let bestN = 0;
for (const h of found) {
const n = tally.get(`${h.bracket}|${h.v}|${h.dated}|${h.separator}`);
if (n > bestN) [best, bestN] = [h, n];
}
const style = best.bracket ? "bracketed" : best.v ? "v-prefixed" : "bare";
return { style, bracket: best.bracket, v: best.v, dated: best.dated, separator: best.separator, example: best.text };
}
function headingFor(style, version, date) {
const core = `${style.v ? "v" : ""}${str(version)}`;
const shown = style.bracket ? `[${core}]` : core;
let head = `## ${shown}`;
if (style.dated) head += style.separator === "(" ? ` (${date})` : ` ${style.separator} ${date}`;
return head;
}
function sectionHeadings(all) {
const seen = [];
let versions = 0;
for (const line of all) {
if (HEADING.test(line) || UNRELEASED.test(line)) {
if (++versions > 3) break;
continue;
}
if (/^###[ \t]/.test(line) && !seen.includes(line.trim())) seen.push(line.trim());
}
return seen;
}
function entryText(all, startLine) {
const end = all.findIndex((l, i) => i > startLine && (HEADING.test(l) || UNRELEASED.test(l) || /^##[ \t]/.test(l)));
const slice = all.slice(startLine, end === -1 ? undefined : end);
return slice.slice(0, 200).join("\n").trimEnd();
}
function showAt(root, ref, file) {
const res = git(["show", `${ref}:${file}`], root);
return res.ok ? res.out : null;
}
/* ----------------------------------------------------------------- branch */
function defaultBranch(root, branch) {
const head = git(["symbolic-ref", "-q", "--short", "refs/remotes/origin/HEAD"], root);
if (head.ok && head.out) return head.out.replace(/^origin\//, "");
if (git(["show-ref", "--verify", "-q", "refs/heads/main"], root).ok) return "main";
if (git(["show-ref", "--verify", "-q", "refs/heads/master"], root).ok) return "master";
return branch === "main" || branch === "master" ? branch : null;
}
function baseRef(root, def) {
if (!def) return null;
if (git(["show-ref", "--verify", "-q", `refs/remotes/origin/${def}`], root).ok) return `origin/${def}`;
if (git(["show-ref", "--verify", "-q", `refs/heads/${def}`], root).ok) return def;
return null;
}
// Other branches (remote and local) whose CHANGELOG already holds `version`.
function claimedBy(root, version, skip) {
const refs = lines(git(["for-each-ref", "--format=%(refname:short)", "refs/remotes", "refs/heads"], root).out)
.filter((r) => !r.endsWith("/HEAD") && !skip.has(r))
.slice(0, 80);
const hits = [];
for (const ref of refs) {
const text = showAt(root, ref, CHANGELOG);
if (!text) continue;
if (!readHeadings(text).found.some((h) => cmp(h.version, version) === 0)) continue;
// A branch that is only part of this one's history shares its entry; it is no claim.
if (!git(["merge-base", "--is-ancestor", ref, "HEAD"], root).ok) hits.push(ref);
}
return hits;
}
function readPackage(root) {
const file = path.join(root, "package.json");
if (!fs.existsSync(file)) return { exists: false, version: null, lockfile: false };
let version = null;
try {
version = JSON.parse(fs.readFileSync(file, "utf8")).version ?? null;
} catch {
// an unreadable package.json is reported as having no version
}
return { exists: true, version, lockfile: fs.existsSync(path.join(root, "package-lock.json")) };
}
/* --------------------------------------------------------------- commands */
function state() {
const root = requireRepo();
const file = path.join(root, CHANGELOG);
if (!fs.existsSync(file)) {
fail(EXIT.NOT_FOUND, "no-changelog", `There is no ${CHANGELOG} at ${root}.`, "Ask whether to start one, in the Keep a Changelog layout.");
}
const branchRef = git(["symbolic-ref", "--short", "-q", "HEAD"], root);
const branch = branchRef.ok && branchRef.out ? branchRef.out : null;
const def = defaultBranch(root, branch);
const base = baseRef(root, def);
const working = readHeadings(fs.readFileSync(file, "utf8"));
const style = dominantStyle(working.found);
const top = working.found[0] || null;
const topLine = working.all.findIndex((l) => UNRELEASED.test(l));
const unreleased = topLine !== -1 && (!top || topLine < top.line);
const branchTop = unreleased
? { version: null, line: working.all[topLine], unreleased: true }
: top
? { version: str(top.version), line: top.text, unreleased: false }
: null;
let baseInfo = null;
let baseVersion = null;
if (base) {
const text = showAt(root, base, CHANGELOG);
const h = text ? readHeadings(text).found[0] : null;
baseInfo = { ref: base, version: h ? str(h.version) : null, date: h ? h.date : null };
baseVersion = h ? h.version : null;
}
const topVersion = top ? top.version : null;
const topIsNew = !!(topVersion && !unreleased && (!baseVersion || cmp(topVersion, baseVersion) > 0));
const entryBump = topIsNew ? (baseVersion ? bumpOf(baseVersion, topVersion) : "major") : "none";
let released = false;
let takenBy = [];
if (topIsNew) {
const tagged = git(["tag", "-l", `v${str(topVersion)}`, str(topVersion)], root).out;
released = !!tagged;
const upstream = branch ? git(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}"], root).out : "";
const skip = new Set([base, branch, upstream, branch ? `origin/${branch}` : null].filter(Boolean));
takenBy = claimedBy(root, topVersion, skip);
}
const canExtend = topIsNew && !released && takenBy.length === 0;
// The gap: what the branch did since its top entry was last touched.
const range = base ? `${base}..HEAD` : "HEAD";
let sinceRef = base;
const touched = base ? git(["log", "-1", "--format=%H", range, "--", CHANGELOG], root) : { ok: false, out: "" };
if (touched.ok && touched.out) sinceRef = touched.out;
const gapRange = sinceRef ? `${sinceRef}..HEAD` : "HEAD";
const commits = lines(git(["log", "--format=%h%x09%s", gapRange], root).out)
.slice(0, LIST_CAP)
.map((l) => {
const [hash, ...subject] = l.split("\t");
return { hash, subject: subject.join("\t") };
});
const filesList = sinceRef ? lines(git(["diff", "--name-only", `${sinceRef}..HEAD`], root).out) : [];
const files = filesList.filter((f) => f !== CHANGELOG).slice(0, LIST_CAP);
const uncommitted = [];
const porcelain = git(["status", "--porcelain=v1", "-z", "--untracked-files=normal"], root, { raw: true });
const fields = porcelain.out.split("\0");
for (let i = 0; i < fields.length; i++) {
const f = fields[i];
if (f.length < 4) continue;
if (/[RC]/.test(f.slice(0, 2))) i++; // a rename or copy carries its old path as the next field
const p = f.slice(3);
if (p !== CHANGELOG) uncommitted.push(p);
}
const added = base
? lines(git(["diff", "--name-only", "--diff-filter=A", `${base}...HEAD`], root).out).filter((p) => /(^|\/)SKILL\.md$/.test(p))
: [];
const pkg = readPackage(root);
// package.json tracks the newest concrete version heading, never Unreleased.
pkg.matches = pkg.exists && !!pkg.version && !!top && !unreleased && pkg.version === str(top.version);
out({
ok: true,
root,
branch,
defaultBranch: def,
onDefault: !!branch && !!def && branch === def,
today: isoDate(),
changelog: CHANGELOG,
base: baseInfo,
branchTop,
topIsNew,
entryBump,
released,
takenBy,
canExtend,
heading: style,
sectionHeadings: sectionHeadings(working.all),
entry: unreleased ? entryText(working.all, topLine) : topIsNew ? entryText(working.all, top.line) : "",
package: pkg,
commits,
files,
uncommitted: uncommitted.slice(0, LIST_CAP),
addedSkills: added,
});
}
function bump(args) {
if (!args.from) fail(EXIT.USAGE, "missing-from", "--from is required.", "Example: bump --from 2.5.1 --kind minor");
if (!["major", "minor", "patch"].includes(args.kind)) {
fail(EXIT.USAGE, "bad-kind", "--kind must be major, minor or patch.", "Example: bump --from 2.5.1 --kind minor");
}
const from = parseVersion(args.from);
const next = nextVersion(from, args.kind);
const root = git(["rev-parse", "--show-toplevel"], process.cwd()).out;
let style = dominantStyle([]);
if (root && fs.existsSync(path.join(root, CHANGELOG))) {
style = dominantStyle(readHeadings(fs.readFileSync(path.join(root, CHANGELOG), "utf8")).found);
}
out({ ok: true, from: str(from), kind: args.kind, version: str(next), heading: headingFor(style, next, isoDate()) });
}
function setPackageVersion(args) {
if (!args.version) fail(EXIT.USAGE, "missing-version", "--version is required.", "Example: set-package-version --version 2.6.0");
const next = str(parseVersion(args.version));
const root = requireRepo();
const file = path.join(root, "package.json");
if (!fs.existsSync(file)) fail(EXIT.NOT_FOUND, "no-package", "There is no package.json here.", "Nothing to align.");
const text = fs.readFileSync(file, "utf8");
const re = /^(\s*"version"\s*:\s*")([^"]*)(")/m;
const m = re.exec(text);
if (!m) fail(EXIT.INVALID, "no-version-field", 'package.json has no "version" field.', "Leave it alone.");
const before = m[2];
let declared;
try {
declared = JSON.parse(text).version;
} catch {
// reported below
}
if (declared !== before) {
fail(EXIT.REFUSED, "ambiguous-version", 'The first "version" in package.json is not the top-level field.', "Edit package.json by hand.");
}
if (before !== next) fs.writeFileSync(file, text.replace(re, `$1${next}$3`));
out({ ok: true, file: "package.json", from: before, to: next, changed: before !== next, lockfile: fs.existsSync(path.join(root, "package-lock.json")) });
}
run(USAGE, async (argv) => {
const args = parseArgs(argv, { values: ["from", "kind", "version"] });
const [cmd, ...extra] = args._;
if (!cmd) fail(EXIT.USAGE, "missing-command", "A subcommand is required: state, bump or set-package-version.", "Run with --help for usage.");
if (extra.length) fail(EXIT.USAGE, "stray-argument", `Unexpected argument(s): ${extra.join(" ")}.`, "Run with --help for usage.");
if (cmd === "state") return state();
if (cmd === "bump") return bump(args);
if (cmd === "set-package-version") return setPackageVersion(args);
fail(EXIT.USAGE, "unknown-command", `Unknown subcommand "${cmd}".`, "Use state, bump or set-package-version.");
});
+59
View File
@@ -0,0 +1,59 @@
# 📝 CHANGELOG MODE
Start all CHANGELOG MODE responses with '📝'
## Role
Careful release scribe. Work out the right version from the default branch, find what this branch did that the CHANGELOG does not say yet, suggest entries for you to edit, and keep `package.json` in step. Nothing is written without a yes, and nothing is committed here.
## Interface
The FIRST thing you do, before anything else in this file, before reading the repository: ask **web console** (browser page, suggested) or **terminal**? Console → run `node "<D>/console.mjs" open --workflow changelog` before reading (<D>: references/web-console/ beside this SKILL.md, ~/.agents/skills/plan2code-changelog/references/web-console/ globally, or the dir in ~/.plan2code/console/console-dir), then read <D>/console.md → Changelog. Every question goes through it. Switchable anytime. If the argument already says which (`--web` or `Use the web console for this session.`) take it and do not ask; drop the flag. Launched by the dashboard? Its session is already open: resume it (console.md → Launches), then Step 1. On the console, a `__stop` action is the person ending the session (console.md → Stop requests); at every session end post `finish` BEFORE `stop`.
## Scripts
`<S>` is `scripts/` beside this SKILL.md (`~/.agents/skills/plan2code-changelog/scripts/` globally). Run them from the project folder. Each prints one JSON object; on a non-zero exit read `message` and do what `next` says.
- `node "<S>/changelog-state.mjs" state`: read-only snapshot. `defaultBranch`, `base` (`ref`, `version`, `date`), `branchTop` (`version`, `line`, `unreleased`), `topIsNew`, `entryBump`, `released`, `takenBy`, `canExtend`, `heading` (the file's own style), `sectionHeadings`, `entry` (the top entry's text), `package` (`exists`, `version`, `lockfile`, `matches`), `commits`, `files`, `uncommitted`, `addedSkills`, `today`. Exit 3 `not-a-repo` or `no-changelog`.
- `node "<S>/changelog-state.mjs" bump --from <x.y.z> --kind major|minor|patch`: the next version and its heading line, in the file's own style.
- `node "<S>/changelog-state.mjs" set-package-version --version <x.y.z>`: sets `package.json`'s `version` and nothing else.
## Project context
Read `./AGENTS.md` when it exists, for versioning and CHANGELOG conventions (which changes are minor, section names). Its rules beat the table below. Never block on it.
## Argument
Optional: a note on what the work is, for example `/plan2code-changelog the export fix`. `--web` is the console flag, not part of the note.
## Rules
- Derive the version from the default branch (`base`), never from memory. Compare the three numbers, never the strings.
- Copy the file's heading style (`heading`: bracketed or `v`-prefixed, dated or not, the separator) and its `sectionHeadings` (emoji included) exactly. Never convert the file or mix styles.
- Show every change and get a yes before writing it.
- Edit only `CHANGELOG.md` and the `version` field of `package.json`. Stage nothing, commit nothing, push nothing.
- One entry per change a reader would notice, in one sentence about what changed and why. Not one per commit; leave out internal-only work and say you did.
- Never align `package.json` to an Unreleased heading.
- Keep the file's own wording and voice. Do not tidy old entries.
## Steps
1. **State.** Run `state`. Exit 3 `not-a-repo` → say so and stop (the Git commit skill can start one). Exit 3 `no-changelog` → offer to start `CHANGELOG.md` with a `# Changelog` title and one entry for this work, then continue. `onDefault` with no `commits` and no `uncommitted` → say there is nothing new on this branch and stop.
2. **Classify.** Use the highest that applies. **Major**: a breaking change (ask, never assume). **Minor**: a new capability a user can see, or any path in `addedSkills`. **Patch**: fixes, behavior changes, docs, internals. Read `commits`, `files`, `uncommitted` and the diff where the subject is unclear.
3. **Version.**
- `canExtend` (the branch already owns an entry above `base`, it is not released and no other branch has it): keep `branchTop.version` and add to it. If the classification needs more than `entryBump` (a minor change under a patch-sized version), propose renumbering with `bump --from <base.version> --kind <kind>`: the heading changes, the content stays.
- `topIsNew` but not `canExtend` (`released`, or `takenBy` lists branches): that number is spent. Say why in one line, then `bump --from <branchTop.version> --kind <kind>` and renumber the branch's heading.
- No entry above `base`: `bump --from <base.version> --kind <kind>` and a new entry on top.
- `branchTop.unreleased`: put the entries under that heading and leave it as it is.
- No `base` (no default branch to compare): ask which version to start from.
Show the choice as `main is at X, the branch has Y, so Z (reason)`. A new or renumbered dated heading gets `today`; when you extend a dated entry whose date is not `today`, offer to refresh it.
4. **Suggest entries.** Compare `entry` with the gap (`commits`, `files`, `uncommitted`). Anything the entry already says is covered. Group the rest into one or several entries under the file's own section headings (Added, Changed, Fixed, in the order and spelling `sectionHeadings` shows). Name the internal-only work you left out. Nothing left to add and the version is right → say the CHANGELOG is ready and go to Step 6.
5. **Edit and approve.** Show the suggested entries so each can be edited, removed or added to (console.md → Changelog has the cards). Apply the edits, show the final entry text and the heading line, and ask Write it / Change it / Stop. On yes, write `CHANGELOG.md`: a new heading goes above the newest entry; entries for an existing version go into its matching section, adding a section heading in the file's order when it is missing.
6. **package.json.** When `package.exists`, `package.version` differs from the version the CHANGELOG now ends on, and that heading is not Unreleased: show `old → new` and ask. On yes run `set-package-version`. When `package.lockfile`, remind the person to refresh it (`npm install`); do not run it. When it already matches, say so.
7. **Hand off.** Ask: run Git commit next? (yes / no). Yes → launch Git commit right here, as the dashboard's card does: on the console run `open --resume <sid> --no-open --workflow git-commit` (no `finish`, no `stop`), then open `~/.agents/skills/plan2code-git-commit/SKILL.md` with your file-read tool (never a skill-invocation tool) and follow it from the top, its Interface step already answered; in the terminal just read and follow it. No → Session End. This skill never commits itself.
## Session End
Reached only when they declined Git commit (a yes hands the session to that skill instead). Terminal: the version, the entries written and the `package.json` change. Web console: post `finish` (headline, a body with the version and entries, `"dashboard": true`, no `command`) BEFORE `stop`, then keep waiting for the dashboard press (console.md → Finishing). A `__stop` posts a finish whose headline starts "Paused" with `"command": "/plan2code-changelog"`; nothing is written before Step 5's yes, so stopping loses only the suggestions.
Returning context: run `/plan2code-changelog` again after more work lands on the branch.
+2 -1
View File
@@ -58,6 +58,7 @@ Ground truth for menu notes and Ask-tab answers. For anything beyond this table,
| review | spec, diff | the fixes picked; no spec writes |
| 4-finalize | spec + code | summary in `overview.md`; moves the spec to `specs--completed/` |
| handoff | conversation, spec, git | `<timestamp>-handoff.md` (OS temp or `handoffs/`) |
| changelog | `CHANGELOG.md`, `package.json`, git history | `CHANGELOG.md` entries, `package.json` version; no commits |
| git-commit | git status, diffs, `AGENTS.md` | commits; optional branch, `.gitignore`, push; no spec writes |
## A pick arrives
@@ -100,7 +101,7 @@ If `skill` is not in the table below, say so on the page and stay the dashboard.
| plan2code-1-plan | plan | | plan2code-review | review |
| plan2code-1b-revise-plan | revise-plan | | plan2code-4-finalize | finalize |
| plan2code-quick-task | quick-task | | plan2code-handoff | handoff |
| plan2code-git-commit | git-commit | | | |
| plan2code-git-commit | git-commit | | plan2code-changelog | changelog |
## Coming back from another skill
+23 -3
View File
@@ -97,7 +97,7 @@ files under `specs/` are the only source of truth, and neither channel owns them
`--workflow` is whichever you are running: `dashboard`, `init`,
`init-update`, `pathfinder`, `quick-task`, `plan`, `revise-plan`,
`document`, `implement`, `implement-review`, `review`, `finalize`,
`handoff` or `git-commit`. Get it
`handoff`, `git-commit` or `changelog`. Get it
right: the page decides from it whether to offer a brief, what stopping
early costs, and which command resumes the session if you cannot say.
`dashboard` is the special one: the page draws the skill menu itself, and
@@ -873,6 +873,26 @@ that is what the person is there to download. The finish carries no
`command`: the doc download is the point, and the dashboard button and the
"All done" line cover what comes next.
### Changelog (`changelog`)
Open with `--workflow changelog` (launched from the dashboard: resume the
session instead). Post `activity` while you read the history and the diff. One
card per step, each asked only when the step needs it:
| Step | On the page |
| --- | --- |
| Version | A `choice`, "Which version?": the computed version (recommended) with its reason in `body` (main is at X, the branch has Y), "Keep Y" when the branch's own entry could stay, and "Another version" (`allowOther`, with a `pattern` of `^[0-9]+.[0-9]+.[0-9]+$`). Left out when the entry is already right. |
| Entries | A `list` titled "Entries to add": one row per suggested entry (`title` the section, `body` the line), editable, removable and reorderable. Anything they add arrives as a row. |
| The result | The final entry as a doc (`id: "entry"`, marked `"saved": "CHANGELOG.md"` once written) plus a `review` card with verdicts `write` ("Write it"), `change` and `stop`. |
| package.json | A `confirm` with the `old → new` in `consequences`. |
| Git commit next | A `confirm`, "Run Git commit next?". |
A yes to "Run Git commit next?" ends no session: settle the card, resume as
`git-commit` (`open --resume <sid> --no-open --workflow git-commit`) and run
that skill in this same session, as a dashboard launch does (Launches).
Finish, on a no: `"dashboard": true` and the version and entries in `body`,
with no `command`. A stop's finish is the bare `/plan2code-changelog`.
### Git commit (`git-commit`)
Open with `--workflow git-commit` (launched from the dashboard: resume the
@@ -1013,7 +1033,7 @@ The page's top bar shows a meter of how much work this console session has
done (green, yellow, red), so the person knows when a fresh session would be
sharper. It is advice only and never blocks anything. The console counts
launches itself: Plan, Revise plan, Document, Review, Quick task, Init, Init
update, Finalize and Git commit score when their session opens, and there is nothing to
update, Finalize, Git commit and Changelog score when their session opens, and there is nothing to
post for them.
It counts answers itself too: every card the person answers in a send adds to
@@ -1031,7 +1051,7 @@ Per-unit work is yours to report, with `run` in any post:
nothing now: answers count instead), `pathfinder-research`, `plan`,
`revise-plan`, `document`, `implement-phase`, `implement-review-phase`,
`review`, `quick-task`, `init`, `init-update`, `finalize`, `handoff`,
`git-commit` (counted when its session opens, so never post it).
`git-commit`, `changelog` (both counted when their session opens, so never post them).
An unknown event is exit `3`.
- `id` names the unit: a question's file slug, `phase-N`, `map`. The same id
posted again in the same skill run is ignored, so a repeated post never
+1 -1
View File
@@ -1108,7 +1108,7 @@ port, and the filesystem as transport; this CLI is the whole agent surface.
workflows: dashboard · init · init-update · pathfinder · quick-task · plan ·
revise-plan · document · implement · implement-review · review ·
finalize · handoff · git-commit
finalize · handoff · git-commit · changelog
A session handed to you by the dashboard (a --session id): resume it with
"open --resume <sid> --no-open --workflow <yours> --title <t>" -- never a
+17
View File
@@ -248,6 +248,7 @@ export const WORKFLOW_LABEL = {
finalize: "Wrapping up",
handoff: "Handoff",
"git-commit": "Git commit",
changelog: "Changelog",
};
export function workflowLabel(workflow) {
@@ -273,6 +274,7 @@ export const CONSOLE_WORKFLOWS = [
"/plan2code-4-finalize",
"/plan2code-handoff",
"/plan2code-git-commit",
"/plan2code-changelog",
];
// Rides on the end of the command as part of the skill's argument. Every
@@ -438,6 +440,8 @@ export function resumeCommand({ workflow, specDir } = {}) {
return "/plan2code-handoff";
case "git-commit":
return "/plan2code-git-commit";
case "changelog":
return "/plan2code-changelog";
default:
return dir ? `/plan2code-0-pathfinder ${dir}/pathfinder` : "/plan2code-0-pathfinder";
}
@@ -642,6 +646,17 @@ export const SKILL_CATALOG = [
about:
"Writes down everything a new session would need, as a single document: what was decided, what is done, what is left. Use it when a conversation got long, a machine changed, or tomorrow-you deserves the context today-you has.",
},
{
skill: "plan2code-changelog",
command: "/plan2code-changelog",
workflow: "changelog",
group: "extra",
chip: "Utility",
title: "Changelog",
blurb: "Checks the CHANGELOG version against the main branch and suggests entries for what is new.",
about:
"Works out the right version from the default branch, then compares your branch with the latest CHANGELOG entry and suggests the entries it is missing. You edit them before anything is written, it keeps package.json in step, and it offers to run Git commit next. If the newest version is not released or on another branch yet, it adds to that entry instead of starting a new one.",
},
{
skill: "plan2code-git-commit",
command: "/plan2code-git-commit",
@@ -676,6 +691,7 @@ export const START_POSES = [
"review",
"handoff",
"git-commit",
"changelog",
];
const POSE_ALIASES = { "init-update": "init", "revise-plan": "plan", "implement-review": "implement" };
@@ -744,6 +760,7 @@ export function cardAvailability(entry, scan, sel) {
case "plan2code-quick-task":
case "plan2code-review":
case "plan2code-handoff":
case "plan2code-changelog":
return ON;
case "plan2code-git-commit":
return scan && scan.isGit === false ? { on: true, note: GIT_INIT_NOTE } : ON;
+3
View File
@@ -3433,6 +3433,9 @@ a.icon-btn { box-sizing: border-box; text-decoration: none; }
100% { opacity: 0; transform: translateY(0); }
}
/* Changelog -- the arm reaches the page and the newest line is written in step. */
.pose .cl-line { animation: gc-dot 2.4s ease-in-out infinite; }
@media (max-width: 720px) {
.dash { padding-top: 0; }
.launch-stage { height: 140px; }
+27
View File
@@ -539,6 +539,32 @@
<g class="ho-arrow"><path class="as" d="M178 64 L214 64 M204 54 L216 64 L204 74" /></g>
</svg>
<!-- Changelog: keeping the record. A page of release notes stands beside him,
and one arm reaches over to write the newest line onto it. -->
<svg class="pose pose-changelog" data-pose="changelog" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
<ellipse class="shadow" cx="126" cy="198" rx="44" ry="5" />
<g class="prop">
<rect class="sh" x="176" y="58" width="44" height="116" rx="6" />
<line class="lt" x1="186" y1="76" x2="206" y2="76" />
<circle class="ac" cx="186" cy="94" r="3" /><line class="lt" x1="194" y1="94" x2="210" y2="94" />
<circle class="ac" cx="186" cy="112" r="3" /><line class="lt" x1="194" y1="112" x2="206" y2="112" />
<g class="cl-line"><circle class="ac" cx="186" cy="130" r="3" /><line class="lt" x1="194" y1="130" x2="210" y2="130" /></g>
</g>
<g class="bob">
<g transform="translate(-14 0)">
<rect class="fl foot f1" x="94" y="179" width="20" height="10" rx="5" />
<rect class="fl foot f2" x="126" y="179" width="20" height="10" rx="5" />
<rect class="sh" x="80" y="72" width="80" height="108" rx="16" />
<path class="ln" d="M80 126 L66 150" /><circle class="fl" cx="66" cy="150" r="5.5" />
<path class="ey blink" d="M126 86 L129.64 94.98 L139.31 95.67 L131.9 101.92 L134.23 111.33 L126 106.2 L117.77 111.33 L120.1 101.92 L112.69 95.67 L122.36 94.98 Z" />
<path class="es" d="M110 120 Q122 129 134 120" />
<g class="gc-reach">
<line class="ln" x1="160" y1="126" x2="196" y2="132" />
<circle class="fl" cx="196" cy="132" r="5.5" />
</g>
</g>
</g>
</svg>
<!-- Git commit: saving a step. Beside a branch line with two commits on
it, one arm reaches to set a third commit onto the line. -->
<svg class="pose pose-git-commit" data-pose="git-commit" viewBox="0 4 240 216" aria-hidden="true" focusable="false">
@@ -1367,6 +1393,7 @@
<li><strong>Quick task.</strong> Too small for the full process? A quick plan, then it just builds it.</li>
<li><strong>Review.</strong> A second opinion on the changes. Problems ranked, and you pick what gets fixed.</li>
<li><strong>Handoff.</strong> Pack this conversation into a document a fresh session can pick up cold.</li>
<li><strong>Changelog.</strong> Checks the CHANGELOG version against the main branch and suggests entries for what is new.</li>
<li><strong>Git commit.</strong> Commits your changes with a clear message, suggests a split when it is really two jobs, and offers to push.</li>
</ul>
<h4>Picking a spec</h4>
+6 -2
View File
@@ -26,13 +26,14 @@ export const WEIGHTS = Object.freeze({
finalize: 1,
handoff: 0,
"git-commit": 1,
changelog: 1,
});
// Workflows whose launch itself scores WEIGHTS[workflow]. Pathfinder,
// implement and implement-review score only through the agent's `run`
// reports; dashboard and handoff never score; git-commit scores 1 on launch.
// reports; dashboard and handoff never score; git-commit and changelog score 1 on launch.
export const LAUNCH_COUNTED = Object.freeze(
new Set(["plan", "revise-plan", "document", "review", "quick-task", "init", "init-update", "finalize", "git-commit"])
new Set(["plan", "revise-plan", "document", "review", "quick-task", "init", "init-update", "finalize", "git-commit", "changelog"])
);
const weightOf = (key) => (Object.prototype.hasOwnProperty.call(WEIGHTS, key) ? WEIGHTS[key] : 0);
@@ -128,6 +129,7 @@ const WORKFLOW_NAMES = Object.freeze({
finalize: "Finalize",
handoff: "Handoff",
"git-commit": "Git commit",
changelog: "Changelog",
});
// The skill run an entry belongs to, from its ledger id ("L3:..." -> "L3").
@@ -144,6 +146,7 @@ const LAUNCH_LABELS = Object.freeze({
"init-update": "Init update started",
finalize: "Finalize started",
"git-commit": "Git commit started",
changelog: "Changelog started",
});
const RUN_LABELS = Object.freeze({
"pathfinder-chart": "Pathfinder map written",
@@ -161,6 +164,7 @@ const RUN_LABELS = Object.freeze({
finalize: "Finalize run",
handoff: "Handoff written",
"git-commit": "Git commit run",
changelog: "Changelog run",
});
// The unit a run names, from its ledger id ("L3:phase-2" -> "phase-2").
+1 -1
View File
@@ -185,7 +185,7 @@ export function checkHelpers(list) {
// are tested without a browser. `frame` is the state frame's `subagents`
// block; app.js only renders what these say.
export const CHECKIN_LINE = "Helpers report through Plan2Code, so their progress is shown as it checks-in, not live.";
export const CHECKIN_LINE = "Helpers report through Plan2Code, so their progress is shown as it checks in, not live.";
const STATE_LABELS = Object.freeze({ running: "Running", done: "Done", failed: "Failed" });