mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-04 00:15:41 -08:00
Sync upstream v3.2.4: slim install refs, a crash-safe installer, Change project restarts the agent (v3.2.4)
AI Assisted
This commit is contained in:
1 parent
50319aa332
commit
f997a82c4d
45 files changed
+7851
-306
No files matched your search
@@ -62,6 +62,8 @@ plan2code/
|
||||
│ └── public/ # Page assets served to the browser
|
||||
├── scripts/ # Development scripts
|
||||
│ ├── bench-web-console.mjs # Start-path timing
|
||||
│ ├── bench-install-update.mjs # Isolated install/update benchmark, with optional local `--repo-url`
|
||||
│ ├── publish-install-refs.mjs, install-ref-fixtures.mjs, install-e2e-fixture.mjs # Slim install-ref publisher and its local release fixture builders
|
||||
│ ├── capture-screenshots.mjs # Stages web console screens and saves the docs screenshots (needs a local Chrome or Edge, through `playwright-core`)
|
||||
│ ├── browser.mjs # The one place a browser is launched (Chrome, then Edge, through `playwright-core`; `PLAN2CODE_TEST_BROWSER` forces one); page tests, the screenshots and the bench use it
|
||||
│ ├── css-snapshot.mjs # Dev-only: every element's computed style on every screen, both themes; take one before a stylesheet move and `--compare` after
|
||||
@@ -90,7 +92,8 @@ plan2code/
|
||||
├── docs/ # Landing page `index.html` served at plan2code.jparkerweb.com (GitHub Pages, `CNAME`) and assets
|
||||
│ └── screenshots/ # Web console screenshots, <shot>-light.webp and <shot>-dark.webp (generated)
|
||||
├── specs/ # Feature specs (if any in-progress)
|
||||
├── install.js # Interactive installer (Node.js)
|
||||
├── install.js # Interactive installer entry point (Node.js)
|
||||
├── src/installer/ # Shared install/update modules: timing, canonical skills, console staging, skills CLI resolution
|
||||
├── package.json # Root package (husky only, private: true)
|
||||
├── version.json # Version metadata
|
||||
├── CHANGELOG.md, QUICK-REFERENCE.md, LICENSE
|
||||
@@ -103,7 +106,8 @@ plan2code/
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `install.js` | Interactive installer — builds `skills/` from `src/`, then delegates installation to the skills CLI |
|
||||
| `install.js` | Interactive installer/update entry point — builds `skills/` from `src/`, coordinates the shared modules below and delegates link refresh to the pinned `skills` CLI |
|
||||
| `src/installer/` | Shared zero-dependency installer seams: timing JSONL, canonical skill staging/manifests/rollback, shared console staging/commit, exact `skills` CLI resolution and npx-cache reuse |
|
||||
| `src/plan2code-*.md` | Source workflow prompts (the "source of truth") |
|
||||
| `skills/` | Generated Agent Skills, gitignored build output regenerated by the installer (and `npm run build:skills`) before every `skills add` |
|
||||
| `scripts/validate-char-count.js` | Pre-commit validator ensuring all source prompts ≤ 20,000 chars |
|
||||
@@ -130,11 +134,13 @@ plan2code/
|
||||
|
||||
### Release channel
|
||||
|
||||
Install and update follow release tags, never `main`. `release-app.yml`'s `publish` job ends by fast-forwarding the `release` branch to the tag it just published (no force: a tag not ahead of the branch fails the job), and the README's first install is `npx --allow-git=all git+https://github.com/jparkerweb/plan2code.git#release`. `plan2code update` installs the newest `vX.Y.Z` tag (`newestReleaseTag()` in `src/launcher/plan2code.js`, using `latestTag()` and `runLsRemote()` from the copy of `update-check.mjs` beside it); `--main` installs the tip of `main`, `--tag <ref>` any ref (how to go back to a release); `--main` and a `--tag` naming a branch always pass `--force`, since unreleased work keeps the last release's version and the installer's `Already on` check would install nothing. `plan2code uninstall` runs the newest release's installer the same way, falling back to `main` only when no release tag can be found. Launchers older than the channel (and install commands copied without `#release`) still fetch `main`, so `install.js` redirects itself (`redirectToRelease()`): when npx fetched it from a commit no `vX.Y.Z` tag points at (`fetchedCommit()` reads npm's hidden `node_modules/.package-lock.json`; `releaseRedirectRef()` decides), it reruns the same options from `#v<newest>`. The launcher sets `PLAN2CODE_INSTALL_REF` on every installer run (`main` for `--main`) so a deliberate ref is never redirected, a checkout is not under `node_modules` so it never is either, and anything unknown (no lock file, no network) runs in place. The redirect lives on `main` for old launchers to find, so it must stay there. The console's release check (`update-check.mjs`) and the app's notice (`versions.rs` `latest_tag()`) use the same rule: the highest plain `vX.Y.Z` in `git ls-remote --tags`, peeled and pre-release tags skipped. The app's Update skills still pins to the app's own tag.
|
||||
Install and update follow release refs, never unreleased `main` by accident. `release-app.yml`'s `publish` job ends with `scripts/publish-install-refs.mjs`: one synthetic slim runtime commit is pushed as immutable `refs/tags/install-vX.Y.Z` and as the fast-forward tip of `refs/heads/release` (no force). It refuses to move `release` to a version that is not newer than the one it installs (`--allow-older` for a deliberate rollback), exits 0 with nothing pushed when the release is already fully published (a second trigger), and refuses a `package.json` with a script npm runs when preparing a git package (`prepare`, `build`, `install`, `preinstall`, `postinstall`, `prepack`), which would make every user's npx do a full dev install. The README's first install is `npx --allow-git=all git+https://github.com/jparkerweb/plan2code.git#release`, so it fetches the slim payload rather than the full source tree; a payload carries `.plan2code-install-ref.json` beside `install.js`, so `redirectToRelease()` skips its `git ls-remote` for it.
|
||||
|
||||
### Agents file
|
||||
Canonical skills (`src/installer/canonical-skills.js`, called by `installCanonicalSkills()`): the store is staged, checked and swapped in with a journal; retired skills go only after the swap worked; a skill folder Windows will not let go of is written over in place (its old files copied aside for a rollback); a failed roll back names the skills left missing; stages and backups another live install owns are left alone; `.DS_Store`, `Thumbs.db` and `desktop.ini` never count as a change. Links come from one `skills add`: the current `skills` pin takes the store itself as the source, but the legacy `1.5.x` pin (Node below 22.20.0) is given the built `skills/` folder (`agentLinkSource()`), because 1.5.x skips every agent when the source is the canonical store. With no cached pin, `skillsCliReachable()` checks the CLI runs before anything is replaced; a cached copy missing a dependency is retried once through npx. After a successful install from an npx copy, `removeNpxLeftovers()` drops the built `skills/` and day-old Plan2Code `_npx/<hash>` folders. Uninstall also removes the store's manifest, journal and stage or backup folders, and the console's `<version>.install-*` / `.backup-*` leftovers.
|
||||
|
||||
`~/.plan2code/agents.json` holds the person's custom agent CLIs. The web console is its only writer (User Preferences → Agents & models, through `POST /agents`); the `plan2code` launcher and the desktop app only read it. Each reader carries its own copy of the rules (`src/web-console/agents.mjs` for the console, a copy in `src/launcher/plan2code.js`, `agents.rs` in the app), and `scripts/fixtures/agents-cases.json` is the contract all three readers' tests load: file normalization with its warnings, `buildArgs` command lines and `makeId` ids. Change a rule in the fixture first.
|
||||
`plan2code update` resolves one promptless `git ls-remote --tags --heads` snapshot through `src/web-console/update-check.mjs`: a default update always takes the newest plain `vX.Y.Z` (the release the banner and the app report), fetched as its `install-vX.Y.Z` when that tag exists, exact `--tag vX.Y.Z` uses the matching install tag when present, and a release without one falls back to the plain heavyweight tag. `--main` installs the tip of `main`, a branch `--tag` stays on that branch, and both force-reinstall because unreleased work can carry the last release's version. `PLAN2CODE_INSTALL_REF` is the intentional fetch ref; `PLAN2CODE_RELEASE_REF` is the logical release when they differ. `plan2code uninstall` runs the newest release's installer the same way, falling back to `main` only when no release can be found.
|
||||
|
||||
Launchers older than the release channel can still fetch `main`, so `install.js` keeps `redirectToRelease()`: `fetchedCommit()` reads npm's hidden lock file, `releaseRedirectRef()` leaves release tags, install tags, peeled commits, `release`, intentional launcher refs and non-main branches where they are, and only unreleased/unknown main-tip work is rerun at the newest release (its install tag when advertised). The redirect lives on `main` for old launchers to find, so it must stay there. The console's release check and the app's notice still mean the highest plain logical `vX.Y.Z`, never an `install-v*` ref. The app's Update skills still pins to the app's own tag.
|
||||
|
||||
`src/launcher/agents.json` is the shipped list: `kind: "builtin"` entries (Claude Code, Devin, Codex) with `installUrl`, per-OS `install` lines and `installDirs`, and `kind: "template"` entries other CLIs can be saved from. Each entry may carry `helpers` beside `bypassArgs`: the agent can start a subagent from inside a session (`true` for Claude Code, `false` for every other built-in and template); missing means it cannot. `loadAgentList()` and the app's `AgentEntry` both read it as a boolean, so a custom agent without it reads `false`. `install.js` copies it to `~/.plan2code/bin/agents.json` beside `agent-lookup.mjs`, which all JS readers share: `loadAgentList()` reads it, `findAgent()` gives a command its `found` / `outside` / `missing` state (PATH, the saved Windows PATH, npm's global bin, the entry's `installDirs`). The app reads the same JSON with `serde_json` at run time (`include_str!` of the repo file baked in as fallback) and `find_on_path` in `agents.rs` is its Rust twin: `scripts/fixtures/agent-lookup-cases.json`, loaded by `scripts/test-agent-lookup.mjs` and by `cargo test` through `include_str!`, is the contract both lookups are held to.
|
||||
|
||||
@@ -195,7 +201,7 @@ Reference files are NOT subject to the 20,000 character limit. The review workfl
|
||||
|
||||
## Shared Console
|
||||
|
||||
The web console is built once into `skills/_console/<version>/` and installed by `installSharedConsole()` in `install.js` to `<console home>/<version>/` (`~/.plan2code/console`, or `PLAN2CODE_CONSOLE_HOME`, which tests set). Each skill carries only `src/web-console-stub/console.mjs`, with the version baked in at build. The stub tries `<home>/<version>/` first, then the `console-dir` pointer, and needs a matching `version.txt`; with neither it prints one line and exits 5. Only an installed console's `open` writes `console-dir` (a source checkout's does not, or every stub would point at the checkout). `install()` and `installProjectSkills()` call `installSharedConsole({ sweep: false })` before `skills add` and `sweepOldConsoles()` only after it succeeds, so a failed update leaves the old stubs able to find their old console. A test that runs a built skill's `console.mjs` must point `PLAN2CODE_CONSOLE_HOME` at a folder whose `console-dir` names `skills/_console/<version>/`, and a shared console finds skill files in `~/.agents/skills/`.
|
||||
The web console is built once into `skills/_console/<version>/` and installed by `installSharedConsole()` in `install.js` to `<console home>/<version>/` (`~/.plan2code/console`, or `PLAN2CODE_CONSOLE_HOME`, which tests set). Each skill carries only `src/web-console-stub/console.mjs`, with the version baked in at build. The stub tries `<home>/<version>/` first, then the `console-dir` pointer, and needs a matching `version.txt`; with neither it prints one line and exits 5. Only an installed console's `open` writes `console-dir` (a source checkout's does not, or every stub would point at the checkout). `installSharedConsole()` stages and commits through `src/installer/console-stage.js` (a validated `<version>.install-*` copy with a manifest and a `.complete` marker written last, renamed in with a `<version>.backup-*`, copied in place when a lock refuses the rename). `install()` stages and commits the console itself before canonical skill replacement, and `installProjectSkills()` calls `installSharedConsole({ sweep: false })` before `skills add`; both run `sweepOldConsoles()` (old version folders and other versions' leftover stages and backups) only after it succeeds, so a failed update leaves the old stubs able to find their old console. A test that runs a built skill's `console.mjs` must point `PLAN2CODE_CONSOLE_HOME` at a folder whose `console-dir` names `skills/_console/<version>/`, and a shared console finds skill files in `~/.agents/skills/`.
|
||||
|
||||
## Repo-Local Skills (`.claude/skills/`)
|
||||
|
||||
|
||||
Reference in new issue
Block a user