Skip to content

Commit e66ba91

Browse files
committed
Refresh CLAUDE.md for the shipped v1 architecture
1 parent 612ba0c commit e66ba91

1 file changed

Lines changed: 36 additions & 19 deletions

File tree

CLAUDE.md

Lines changed: 36 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ progress log so the next session can pick up cleanly. See
1616
## What this is
1717

1818
`@reuters-graphics/bluprint` — a CLI and library for dead-easy application
19-
scaffolding from reusable "bluprints" (templates hosted in git repos).
20-
21-
> **Note:** the project is mid-rewrite to v1.0.0. The architecture below
22-
> describes the _target_ design. Pre-rewrite code is parked in
23-
> [`src/__archive/`](./src/__archive/) for reference and is not part of the build.
19+
scaffolding from reusable "bluprints" (templates hosted in git repos). Shipped as
20+
v1.0.0: a typed `bluprint.config.ts` API replacing the old `.bluprintrc` JSON.
2421

2522
## Tech stack
2623

2724
- **Runtime:** Node ≥ 20, ES modules (`"type": "module"`)
2825
- **Language:** TypeScript
2926
- **Package manager:** pnpm (`pnpm@9.13.2`) — **use pnpm, not npm/yarn**
30-
- **Tests:** Vitest (co-located `*.test.ts` files)
31-
- **Validation:** Valibot
32-
- **Build:** Rollup v4 → `dist/`
27+
- **Tests:** Vitest (co-located `*.test.ts` files; a network E2E in `src/__e2e__/`)
28+
- **Build:** Rollup v4 → `dist/` (separate `index.js` library + `cli.js` bin)
29+
- **Templating:** mustache (default) / ejs, via the `render` action
3330
- **Prompts:** `@clack/prompts` (wrapped in [`src/prompts/`](./src/prompts/))
3431
- **CLI framework:** `sade`
3532
- **Docs:** Astro + Starlight (source in [`docs/`](./docs), _not_ `src`)
@@ -45,27 +42,46 @@ npx tsc --noEmit # typecheck
4542
pnpm build # build the library + CLI to dist/ (rollup)
4643
pnpm lint # eslint --fix
4744
pnpm format # prettier --write
45+
pnpm knip # find unused deps / exports
46+
pnpm publint # validate the publishable package
4847
pnpm docs:dev # run the docs site locally (astro dev)
4948
pnpm build:docs # build docs site
5049
```
5150

52-
## Architecture (target v1 design)
51+
> CI also runs `pnpm exec prettier . --check` — run `pnpm format` before pushing,
52+
> or the Lint workflow fails on unformatted files.
53+
54+
## Architecture
5355

5456
Source lives in [`src/`](./src):
5557

5658
- **`config/`** — a bluprint's typed `bluprint.config.ts` (authored with
5759
`defineConfig`). `Config` singleton loads it via `jiti`
58-
([`load.ts`](./src/config/load.ts)); [`fetch.ts`](./src/config/fetch.ts) reads
59-
it locally (`file://…`) or remotely over HTTPS from the repo.
60+
([`load.ts`](./src/config/load.ts), which aliases `@reuters-graphics/bluprint`
61+
so a fetched config resolves the library from a temp dir);
62+
[`fetch.ts`](./src/config/fetch.ts) reads it locally (`file://…`) or remotely
63+
over HTTPS from the repo. `checkVersion.ts` guards the `bluprint` semver range.
64+
- **`actions/`** — the action factory functions (`copy`, `move`, `remove`,
65+
`render`, `regexreplace`, `execute`, `log`, `prompt`, `run`, `json`, `yaml`,
66+
`append`, `prepend`) exported from the root, plus `runActions` (the runner),
67+
`context.ts` (`getDefaultContext`), and the typed-context generics.
68+
- **`scaffold/`** — copies a bluprint's files into the target: remote via tarball
69+
fetch + `tar.extract` ([`extract.ts`](./src/scaffold/extract.ts)), local via
70+
[`copyLocal.ts`](./src/scaffold/copyLocal.ts) (`git ls-files`), sharing the
71+
`files`/`ignores` glob filter.
6072
- **`profile/`** — the user's own config at `~/.bluprint/profile.json` (GitHub
6173
token + installed bluprints). Use the `profile` singleton
62-
(`profile.token`, `.addBluprint()`, `.removeBluprint()`).
63-
- **`context/`** — a `context` singleton holding the resolved config for a run.
64-
- **`prompts/`** — thin typed wrappers over `@clack/prompts`.
65-
- **`commands/`** — one directory per CLI command (`add`, and — being ported from
66-
`__archive/``start`, `clone`, `new`, `remove`, `token`).
67-
- **`index.ts`** — public library entry (exports `defineConfig`).
68-
- **`cli.ts`** — CLI entry (bin `bluprint`). _Not yet recreated in the rewrite._
74+
(`profile.token`, `.addBluprint()`, `.removeBluprint()`). First run migrates a
75+
legacy `~/.bluprintrc`.
76+
- **`prompts/`** — thin typed wrappers over `@clack/prompts` (incl. a custom
77+
`datetime` prompt).
78+
- **`runtime.ts`** — interactive-mode flag (env-backed so it crosses the
79+
`cli.js`/`index.js` bundle split); actions read it to stay non-interactive in CI.
80+
- **`commands/`** — one directory per CLI command: `add`, `start`, `clone`,
81+
`new`, `remove`, `token`, `preview`.
82+
- **`index.ts`** — public library entry (exports `defineConfig`, all action
83+
factories, and the public types).
84+
- **`cli.ts`** — CLI entry (bin `bluprint`, wired with `sade`).
6985

7086
The key API shift: bluprints are configured with a **`bluprint.config.ts`**
7187
module, replacing the old `.bluprintrc` JSON.
@@ -74,5 +90,6 @@ module, replacing the old `.bluprintrc` JSON.
7490

7591
- Tests are co-located with source as `*.test.ts`.
7692
- Prefer the shared `prompts/` wrappers over calling `@clack/prompts` directly.
77-
- Don't add code to `src/__archive/` — it's a read-only reference for porting.
93+
- Add a changeset (`pnpm changeset`) for any user-facing change — releases are
94+
published to npm from CI when the "Version Packages" PR merges.
7895
- Use absolute dates in notes/changesets, never relative ones.

0 commit comments

Comments
 (0)