@pharn-dev/pharn 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +134 -385
- package/dist/add-RYPFFPXB.js +3 -0
- package/dist/{chunk-LVAJFL6J.js → chunk-256AIEPX.js} +1 -1
- package/dist/{chunk-KZCUUHJT.js → chunk-26RZI2K7.js} +1 -1
- package/dist/chunk-2UADMP7W.js +1 -0
- package/dist/{chunk-LF4PFADC.js → chunk-5YCL3WDS.js} +1 -1
- package/dist/chunk-KAXAEUPE.js +2 -0
- package/dist/{chunk-BCURDSJC.js → chunk-NE4LZ2VE.js} +1 -1
- package/dist/{chunk-ZQWLF3HH.js → chunk-ONK3I3FO.js} +1 -1
- package/dist/chunk-PL5ALKBN.js +6 -0
- package/dist/{chunk-DFMTJQO7.js → chunk-QZ4LYI42.js} +1 -1
- package/dist/{chunk-B4EM6WAR.js → chunk-TUHBDIL2.js} +1 -1
- package/dist/chunk-VWZNENTT.js +1 -0
- package/dist/chunk-W3TXAEBT.js +1 -0
- package/dist/{chunk-6LOUFC5E.js → chunk-YG2GHTWC.js} +1 -1
- package/dist/chunk-ZL3KBIIS.js +2 -0
- package/dist/index.js +3 -3
- package/dist/init-ZFHRQ5DR.js +29 -0
- package/dist/{list-DZPSZHUH.js → list-JME23KNT.js} +1 -1
- package/dist/remove-B5F6HDFM.js +1 -0
- package/dist/status-XGNMVK36.js +7 -0
- package/dist/uninstall-4BWRYLXI.js +4 -0
- package/dist/update-BHK2J6Z5.js +13 -0
- package/package.json +1 -1
- package/dist/add-7RVWOQW6.js +0 -3
- package/dist/chunk-62AJFPPH.js +0 -3
- package/dist/chunk-7LD2OYB4.js +0 -2
- package/dist/chunk-FUQURK5N.js +0 -6
- package/dist/chunk-KKY6HERY.js +0 -1
- package/dist/chunk-NVSBRL4G.js +0 -2
- package/dist/chunk-PDDT7V7X.js +0 -1
- package/dist/chunk-SQLIXTIY.js +0 -1
- package/dist/init-VXZACXMC.js +0 -32
- package/dist/remove-5VT6T7R5.js +0 -1
- package/dist/status-2HLMKYJM.js +0 -9
- package/dist/uninstall-WCWOJPEM.js +0 -4
- package/dist/update-YTKILGYA.js +0 -15
package/README.md
CHANGED
|
@@ -28,268 +28,113 @@ npx @pharn-dev/pharn@latest init
|
|
|
28
28
|
|
|
29
29
|
## Contents
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
- [Why use it?](#why-use-it)
|
|
33
|
-
- [Quick start](#quick-start)
|
|
34
|
-
- [How it works](#how-it-works)
|
|
35
|
-
- [What gets installed](#what-gets-installed)
|
|
36
|
-
- [After install](#after-install)
|
|
37
|
-
- [Day-to-day workflow](#day-to-day-workflow)
|
|
38
|
-
- [CLI commands](#cli-commands)
|
|
39
|
-
- [Agent skills](#agent-skills)
|
|
40
|
-
- [Safety model](#safety-model)
|
|
41
|
-
- [Current scope](#current-scope)
|
|
42
|
-
- [Documentation](#documentation)
|
|
43
|
-
- [Development](#development)
|
|
44
|
-
- [Security](#security)
|
|
45
|
-
- [License](#license)
|
|
31
|
+
[What is PHARN?](#what-is-pharn) · [Why use it?](#why-use-it) · [Quick start](#quick-start) · [How it works](#how-it-works) · [What gets installed](#what-gets-installed) · [After install](#after-install) · [Day-to-day workflow](#day-to-day-workflow) · [CLI commands](#cli-commands) · [Agent skills](#agent-skills) · [Safety model](#safety-model) · [Current scope](#current-scope) · [Documentation](#documentation) · [Development](#development) · [Security](#security) · [License](#license)
|
|
46
32
|
|
|
47
33
|
---
|
|
48
34
|
|
|
49
35
|
## What is PHARN?
|
|
50
36
|
|
|
51
|
-
PHARN is a repo-local methodology for making AI-assisted development easier to
|
|
52
|
-
|
|
53
|
-
feature intent to implementation review:
|
|
37
|
+
PHARN is a repo-local methodology for making AI-assisted development easier to review, repeat, and
|
|
38
|
+
maintain. It gives Claude Code a structured path from feature intent to implementation review:
|
|
54
39
|
|
|
55
40
|
```text
|
|
56
41
|
spec -> plan -> grill -> test -> build -> regress -> verify -> ship
|
|
57
42
|
```
|
|
58
43
|
|
|
59
|
-
The npm package, `@pharn-dev/pharn`, is the installer. It does not scaffold your
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
44
|
+
The npm package, `@pharn-dev/pharn`, is the installer. It does not scaffold your app. It detects what kind
|
|
45
|
+
of project you already have, installs the matching PHARN capabilities from
|
|
46
|
+
[`pharn-dev/pharn-oss`](https://github.com/pharn-dev/pharn-oss), and records the install in
|
|
47
|
+
`pharn.config.json` and `pharn.records.json`.
|
|
63
48
|
|
|
64
49
|
## Why use it?
|
|
65
50
|
|
|
66
|
-
AI agents can move fast, but a fast diff without durable context is hard to
|
|
67
|
-
|
|
68
|
-
be committed beside the change.
|
|
69
|
-
|
|
70
|
-
- **Preserve intent.** Specs, plans, constraints, and review notes live in the
|
|
71
|
-
repository, not only in an agent transcript.
|
|
72
|
-
- **Make work inspectable.** PHARN installs grillers and lenses: pipeline
|
|
73
|
-
checks and review perspectives that help interrogate a plan or diff before
|
|
74
|
-
it ships.
|
|
75
|
-
- **Keep updates safe.** `pharn update` uses per-file hashes to avoid
|
|
76
|
-
overwriting local edits unless you explicitly choose `--force`.
|
|
77
|
-
- **Stay tool-shaped, not service-shaped.** The CLI fetches open content,
|
|
78
|
-
copies files into your project, and leaves the state in version-controlled
|
|
79
|
-
markdown and JSON.
|
|
51
|
+
AI agents can move fast, but a fast diff without durable context is hard to trust. PHARN is built around a
|
|
52
|
+
simple idea: the reasoning behind a change should be committed beside the change.
|
|
80
53
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
54
|
+
- **Preserve intent.** Specs, plans, constraints, and review notes live in the repository, not only in an
|
|
55
|
+
agent transcript.
|
|
56
|
+
- **Make work inspectable.** PHARN installs grillers and lenses: pipeline checks and review perspectives
|
|
57
|
+
that help interrogate a plan or diff before it ships.
|
|
58
|
+
- **Keep updates safe.** `pharn update` uses per-file hashes to avoid overwriting local edits unless you
|
|
59
|
+
explicitly choose `--force`.
|
|
60
|
+
- **Stay tool-shaped, not service-shaped.** The CLI fetches open content, copies files into your project,
|
|
61
|
+
and leaves the state in version-controlled markdown and JSON.
|
|
84
62
|
|
|
85
|
-
|
|
86
|
-
npx @pharn-dev/pharn@latest init
|
|
87
|
-
```
|
|
63
|
+
## Quick start
|
|
88
64
|
|
|
89
|
-
For a new app,
|
|
65
|
+
Run PHARN inside an existing git project. For a new app, make sure it is a git repository first
|
|
66
|
+
(`create-next-app` already runs `git init` and commits, unless git is missing or you pass `--disable-git`):
|
|
90
67
|
|
|
91
68
|
```bash
|
|
92
|
-
npx create-next-app@latest my-app
|
|
93
|
-
|
|
94
|
-
git init
|
|
95
|
-
git add -A
|
|
96
|
-
git commit -m "init"
|
|
69
|
+
npx create-next-app@latest my-app && cd my-app
|
|
70
|
+
[ -d .git ] || { git init && git add -A && git commit -m "init"; }
|
|
97
71
|
npx @pharn-dev/pharn@latest init
|
|
98
72
|
```
|
|
99
73
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
/pharn-spec
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Or run the whole chain in one command:
|
|
107
|
-
|
|
108
|
-
```text
|
|
109
|
-
/pharn-loop implement password reset with a one-time token
|
|
110
|
-
```
|
|
74
|
+
Then open Claude Code and start with `/pharn-spec`, or run the whole chain with
|
|
75
|
+
`/pharn-loop implement password reset with a one-time token`. Either way the run begins at the spec:
|
|
76
|
+
`/pharn-plan` halts unless an **Approved**, un-drifted `SPEC.md` exists ([walkthrough](docs/getting-started.md)).
|
|
111
77
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
**Your project needs a test runner with per-test results.** The `test` stage
|
|
119
|
-
writes each acceptance criterion's test before any code exists and requires it
|
|
120
|
-
to fail, so it needs a `test` script (plus `test:e2e` or `e2e` for end-to-end
|
|
121
|
-
criteria) whose reporter writes per-test JSON, named under `testResults` in
|
|
122
|
-
`pharn.config.json`. Without one, `/pharn-test` stops and asks, and
|
|
123
|
-
`/pharn-loop` ends with `blocked: no-test-runner`. A fresh app like the
|
|
124
|
-
`create-next-app` one above has no `test` script, so set the runner up first,
|
|
125
|
-
as its own increment (a SPEC with `spec_kind: test-infra`). Setup is in
|
|
126
|
-
upstream's
|
|
78
|
+
**Your project needs a test runner with per-test results.** The `test` stage writes each acceptance
|
|
79
|
+
criterion's test before any code exists and requires it to fail, so it needs a `test` script (plus
|
|
80
|
+
`test:e2e` or `e2e` for end-to-end criteria) whose reporter writes per-test JSON, named under
|
|
81
|
+
`testResults` in `pharn.config.json`. Without one, `/pharn-test` stops and asks, and `/pharn-loop` ends
|
|
82
|
+
with `blocked: no-test-runner`. A fresh `create-next-app` has no `test` script, so set the runner up
|
|
83
|
+
first, as its own increment (a SPEC with `spec_kind: test-infra`); see upstream's
|
|
127
84
|
[Per-test results](https://github.com/pharn-dev/pharn-oss#per-test-results).
|
|
128
85
|
|
|
129
86
|
## How it works
|
|
130
87
|
|
|
131
|
-
`pharn init` is archetype-driven. There is no stack questionnaire and no module
|
|
132
|
-
catalog.
|
|
88
|
+
`pharn init` is archetype-driven. There is no stack questionnaire and no module catalog.
|
|
133
89
|
|
|
134
|
-
| Step | What happens
|
|
135
|
-
| ------- |
|
|
136
|
-
| Detect | Reads `package.json` dependency names and
|
|
137
|
-
| Fetch |
|
|
138
|
-
| Resolve | Selects capabilities whose `applies` value is `universal` or intersects your
|
|
139
|
-
| Install | Copies the selected capabilities plus fixed PHARN product surfaces into
|
|
140
|
-
| Record | Writes `pharn.config.json` and `pharn.records.json` so future updates can tell PHARN-owned files from local edits.
|
|
141
|
-
|
|
142
|
-
The current upstream install layout places most runtime surfaces under `pharn/`
|
|
143
|
-
and Claude Code integration under `.claude/`. Older flat-layout installs are
|
|
144
|
-
still understood through the recorded `layout` field; that layout is deprecated
|
|
145
|
-
in v0.20.0 and removed in v0.22.0 (`pharn status` and `pharn update` say so), and
|
|
146
|
-
a plain `pharn update` moves you off it.
|
|
90
|
+
| Step | What happens |
|
|
91
|
+
| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
92
|
+
| Detect | Reads `package.json` dependency names and a bounded, symlink-safe file-tree scan to classify the project as `ssr`, `backend`, `spa`, `lib`, or a combination ([rules](docs/commands/init.md#3-detect-archetypes)). |
|
|
93
|
+
| Fetch | Downloads the newest **verified release** of `pharn-dev/pharn-oss` (a tag created only after its post-merge CI passed). With none resolvable it exits 1 and names `--ref main`, never falling back to the tip ([details](docs/troubleshooting.md#no-verified-release-could-be-resolved)). |
|
|
94
|
+
| Resolve | Selects capabilities whose `applies` value is `universal` or intersects your archetypes. Skipped capabilities are named with the reason. |
|
|
95
|
+
| Install | Copies the selected capabilities plus the fixed PHARN product surfaces into `.claude/` and `pharn/`. |
|
|
96
|
+
| Record | Writes `pharn.config.json` and `pharn.records.json` so future updates can tell PHARN-owned files from local edits. |
|
|
147
97
|
|
|
148
98
|
## What gets installed
|
|
149
99
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
| `pharn.records.json` | Per-file hashes for drift-safe updates. Commit this with the config. |
|
|
163
|
-
|
|
164
|
-
An existing `.claude/settings.json` is preserved. PHARN may create it when
|
|
165
|
-
absent, but it never overwrites your Claude Code settings.
|
|
166
|
-
|
|
167
|
-
As you run the workflow, PHARN writes one directory per increment —
|
|
168
|
-
`pharn/features/<name>/` — holding that increment's `SPEC.md`, `PLAN.md`,
|
|
169
|
-
`AC-TESTS.md`, `GRILL.md`, `BUILD.md`, `REGRESSION.md`, `VERIFY.md`, then
|
|
170
|
-
`SHIP.md` + `BRIEFING.md` (`/pharn-ship`) or `LOOP.md` (`/pharn-loop`), a
|
|
171
|
-
`RUN-REPORT.md`, and the machine-readable records beside them
|
|
172
|
-
(`AC-TESTS.lock.json`, `cost.json`, the `*-report.json` files). Those are the
|
|
173
|
-
durable record; commit them. `pharn/.run/` (runtime scratch; `.pharn/` before
|
|
174
|
-
pharn-oss 7.0.0) and `pharn/.backup/` (see [Safety model](#safety-model)) are not:
|
|
175
|
-
`pharn init` and `pharn update` append them to your `.gitignore` (creating it if
|
|
176
|
-
needed) unless it already covers them — in any common spelling, such as
|
|
177
|
-
`/pharn/.run`, `pharn/.run/**` or a negation `!pharn/.run/` you wrote on purpose.
|
|
178
|
-
They only ever append: your lines are never reordered or rewritten, CRLF stays
|
|
179
|
-
CRLF, and a second run changes nothing. A symlinked `.gitignore` is never written
|
|
180
|
-
through (you get a warning naming the lines). Lines added to `.gitignore` do not
|
|
181
|
-
untrack files you already committed (`git rm -r --cached pharn/.run` does).
|
|
182
|
-
`pharn/.lock*` is a transient file — add it yourself if you like. When your
|
|
183
|
-
`.gitignore` still names the old `.pharn/`, `pharn update` prints the
|
|
184
|
-
replacement line; it never rewrites yours.
|
|
185
|
-
|
|
186
|
-
Everything PHARN keeps in your project lives under `.claude/` and `pharn/`, plus
|
|
187
|
-
the two JSON files at the root. An install made from a pharn-oss older than 7.0.0
|
|
188
|
-
also has `THREAT-MODEL.md` and `LIMITS.md` at the root, and may have
|
|
189
|
-
`memory-bank/` and `pharn.spec-template.md` there: the first `pharn update` to
|
|
190
|
-
7.0.0 or later deletes the two docs if you never edited them. It never moves the
|
|
191
|
-
other two (nothing proves they are PHARN's); it prints the `git mv` command, or
|
|
192
|
-
says to merge by hand when the `pharn/` copy already exists — see
|
|
193
|
-
[update](docs/commands/update.md#the-root-footprint-migration).
|
|
194
|
-
|
|
195
|
-
**Two version numbers, on purpose.** The npm package `@pharn-dev/pharn` carries
|
|
196
|
-
the installer's version. The content it installs carries its own,
|
|
197
|
-
recorded as `skillsVersion` in `pharn.config.json` and taken from upstream's
|
|
198
|
-
`SKILLS_VERSION`. They move independently, and `pharn status` / `pharn update`
|
|
199
|
-
are keyed to the latter.
|
|
100
|
+
Everything PHARN keeps in your project lives under `.claude/` (commands, hooks, agents) and `pharn/`
|
|
101
|
+
(capabilities, contracts, core, floor checkers, the trusted docs, a `LICENSE` copy and the features README),
|
|
102
|
+
plus `pharn.config.json` and `pharn.records.json` at the root: commit both. The full table is in
|
|
103
|
+
[Getting started: What you get](docs/getting-started.md#what-you-get). An existing `.claude/settings.json`
|
|
104
|
+
is never overwritten. As you run the workflow, PHARN writes one directory per increment,
|
|
105
|
+
`pharn/features/<name>/`, which is the durable record; commit it. `pharn init` and `pharn update` add
|
|
106
|
+
`pharn/.run/` and `pharn/.backup/` to your `.gitignore` ([how](docs/commands/init.md#gitignore)).
|
|
107
|
+
|
|
108
|
+
**Two version numbers, on purpose.** The npm package `@pharn-dev/pharn` carries the installer's version.
|
|
109
|
+
The content it installs carries its own, recorded as `skillsVersion` in `pharn.config.json` and taken from
|
|
110
|
+
upstream's `SKILLS_VERSION`. They move independently, and `pharn status` / `pharn update` are keyed to the
|
|
111
|
+
latter.
|
|
200
112
|
|
|
201
113
|
## After install
|
|
202
114
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
`skillsVersion`), you can edit ordinary application source **outside** an open
|
|
216
|
-
PHARN run. The narrow fail-closed posture — Claude Code's
|
|
217
|
-
Write/Edit/MultiEdit/NotebookEdit tools restricted to `pharn/features/**` and
|
|
218
|
-
`.pharn/**` — applies **only while** `/pharn-ship`, `/pharn-loop`, or
|
|
219
|
-
`/pharn-review` has an open marker (`.pharn/<command>/<name>/active.json`; ship
|
|
220
|
-
and review via `pharn/floor/run-marker.mjs`, loop via
|
|
221
|
-
`require-loop-record.cjs`). Outside those runs the guard **denies** PHARN's
|
|
222
|
-
installed surface (`pharn/**` except `pharn/features/**`, `.claude/**`,
|
|
223
|
-
`pharn.config.json`, and `.pharn/writes-scope.json`) and **allows** the rest of
|
|
224
|
-
your project, including app source. While a stage is running it still sets
|
|
225
|
-
explicit scope from the concrete paths your `PLAN.md` declared.
|
|
226
|
-
|
|
227
|
-
In PHARN's own dev repo or an unsignalled tree, the pre-6.24.0 posture
|
|
228
|
-
remains: fail-closed everywhere with no active scope. Clearing the scope
|
|
229
|
-
(`set-writes-scope.cjs --clear`, or deleting `.pharn/writes-scope.json`)
|
|
230
|
-
returns to whichever default your tree and open-run state compute; it does not
|
|
231
|
-
by itself re-open source in those postures, or during an open install run.
|
|
232
|
-
|
|
233
|
-
Writes issued through Bash bypass both write guards entirely.
|
|
234
|
-
|
|
235
|
-
**`/pharn-loop` has a `Stop` guard too.** `require-loop-record.cjs` is not a
|
|
236
|
-
write guard: while an unattended `/pharn-loop` run has written no `LOOP.md`, it
|
|
237
|
-
refuses to let the turn end, a bounded number of times, and it fails open. It
|
|
238
|
-
also does nothing until registered — under `Stop`, with no matcher. The
|
|
239
|
-
`settings.json` upstream ships has registered it since pharn-oss 6.12.0, but a
|
|
240
|
-
file PHARN preserved, or one created by an earlier install, lacks the entry:
|
|
241
|
-
copy it across by hand. `pharn update` never edits `.claude/settings.json`;
|
|
242
|
-
`pharn init`, `pharn status` and `pharn update` name the missing entry in a
|
|
243
|
-
`HOOKS` note.
|
|
244
|
-
|
|
245
|
-
The full set of bounds lives in upstream's
|
|
246
|
-
[`LIMITS.md`](https://github.com/pharn-dev/pharn-oss/blob/main/LIMITS.md) and
|
|
247
|
-
[README](https://github.com/pharn-dev/pharn-oss#readme).
|
|
115
|
+
- **Hooks enforce only once they are registered in `.claude/settings.json`.** If your project already had
|
|
116
|
+
that file, PHARN kept it and printed a `HOOKS` note listing each hook it does not wire, as paste-ready
|
|
117
|
+
JSON. Until you copy them across, the guarantees that depend on a `PreToolUse` hook are inactive, and
|
|
118
|
+
`pharn status --strict` fails.
|
|
119
|
+
- **`/pharn-loop` has a `Stop` guard** (`require-loop-record.cjs`) that also does nothing until it is
|
|
120
|
+
registered under `Stop`. `pharn init`, `pharn status` and `pharn update` name a missing entry.
|
|
121
|
+
- **`pharn update` never edits `.claude/settings.json`**, so copy new hook entries across by hand. Writes
|
|
122
|
+
issued through Bash bypass the write guards entirely.
|
|
123
|
+
|
|
124
|
+
What the write guards allow and deny, and the full set of bounds, are in upstream's
|
|
125
|
+
[README](https://github.com/pharn-dev/pharn-oss#what-gets-installed) and
|
|
126
|
+
[`LIMITS.md`](https://github.com/pharn-dev/pharn-oss/blob/main/LIMITS.md).
|
|
248
127
|
|
|
249
128
|
## Day-to-day workflow
|
|
250
129
|
|
|
251
|
-
Once PHARN is installed, use the slash commands from Claude Code. The pipeline
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
| Test | `/pharn-test` | Write each acceptance criterion's test before the build, run it, and require it to fail. `/pharn-build` refuses to start without that evidence. |
|
|
260
|
-
| Build | `/pharn-build` | Implement an approved increment. |
|
|
261
|
-
| Regress | `/pharn-regress` | Look for regressions outside the just-built feature. |
|
|
262
|
-
| Verify | `/pharn-verify` | Verify behavior and PHARN floor requirements, including that every acceptance criterion's test now passes. |
|
|
263
|
-
| Ship | `/pharn-ship` | Run stages 1-7 in order, then stop at the merge/fix/abandon gate. |
|
|
264
|
-
|
|
265
|
-
`/pharn-ship` is itself the eighth stage: it orchestrates the seven before it in
|
|
266
|
-
one pass, so you rarely run them by hand, and it keeps both human gates —
|
|
267
|
-
approve the spec before code is written, decide merge/fix/abandon after
|
|
268
|
-
verification. `/pharn-loop` runs that same chain unattended: the model approves
|
|
269
|
-
the spec, iterates build -> regress -> verify until green, an iteration cap, or
|
|
270
|
-
a terminal failure, commits a green result to a new local branch (never pushed
|
|
271
|
-
or merged), and leaves the merge/fix/abandon decision to you after the run.
|
|
272
|
-
From pharn-oss 7.7.0, a full `/pharn-loop` (not `--quick`) also runs
|
|
273
|
-
`/pharn-triage` after the grill: it gives every grill finding one disposition.
|
|
274
|
-
Since 7.8.0 a `replan` verdict sends the run back to `/pharn-plan` for at most
|
|
275
|
-
two re-plan rounds, and since 7.9.0 a verdict that still escalates goes to
|
|
276
|
-
`/pharn-supervise`, a fresh agent that decides `stop` or `proceed-at-risk` (the
|
|
277
|
-
escalated findings are then named as known risk in the green commit and the run
|
|
278
|
-
report); since 7.10.0 it may instead amend the SPEC once per run (`amend-spec`).
|
|
279
|
-
That decision is one model's judgment, not a check. You can run `/pharn-triage`
|
|
280
|
-
yourself after a full `/pharn-grill`.
|
|
281
|
-
|
|
282
|
-
`/pharn-spec` fills PHARN's default SPEC template, or your own if you put one at
|
|
283
|
-
`pharn.spec-template.md` in the project root. The write guard denies Claude
|
|
284
|
-
Code's edit tools on that path, so edit it yourself; see upstream's
|
|
285
|
-
[Your own SPEC template](https://github.com/pharn-dev/pharn-oss#your-own-spec-template).
|
|
286
|
-
|
|
287
|
-
Two commands sit outside the pipeline:
|
|
288
|
-
|
|
289
|
-
| Command | Purpose |
|
|
290
|
-
| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
291
|
-
| `/pharn-review` | Run the review lenses in parallel over any code and merge their findings deterministically. Standalone — no pipeline stage invokes it. |
|
|
292
|
-
| `/pharn-memory-promote` | Promote one lesson into `memory-bank/` through a gated provenance check. |
|
|
130
|
+
Once PHARN is installed, use the slash commands from Claude Code. The pipeline is eight typed stages, each
|
|
131
|
+
reading what the previous one produced ([what each does](docs/getting-started.md#after-init)).
|
|
132
|
+
`/pharn-ship` runs the first seven in one pass and keeps both human gates: approve the spec before code is
|
|
133
|
+
written, decide merge/fix/abandon after verification. `/pharn-loop` runs the same chain unattended and
|
|
134
|
+
commits a green result to a new local branch (never pushed or merged), leaving the merge decision to you. Outside the pipeline,
|
|
135
|
+
`/pharn-review` runs the review lenses over any code, and `/pharn-memory-promote` promotes one lesson into
|
|
136
|
+
`pharn/memory-bank/`. `/pharn-spec` uses your own SPEC template if you put one at `pharn/spec-template.md`
|
|
137
|
+
(see upstream's [Your own SPEC template](https://github.com/pharn-dev/pharn-oss#your-own-spec-template)).
|
|
293
138
|
|
|
294
139
|
## CLI commands
|
|
295
140
|
|
|
@@ -301,162 +146,79 @@ Two commands sit outside the pipeline:
|
|
|
301
146
|
| `pharn update` | Re-fetch and apply the latest PHARN content using drift-safe per-file decisions. `--force` overwrites files you changed; `--yes`/`-y` skips the confirmation prompt; `--dry-run` prints what it would do and writes nothing (add `--json` for the plan as one machine-readable object, and `--compact` to leave the unchanged files out of it). |
|
|
302
147
|
| `pharn list` | Show installed archetypes and capabilities. Use `--json` for machine-readable output. |
|
|
303
148
|
| `pharn status` | Read-only version and drift report. Use `--strict` to make drift fail CI, `--no-drift` to skip byte comparison, or `--json` for one machine-readable report. |
|
|
304
|
-
| `pharn uninstall` | Remove PHARN: deletes only the files `pharn` recorded and you did not change, then `pharn.records.json` and `pharn.config.json` (backed up first). Never touches `.claude/settings.json`
|
|
149
|
+
| `pharn uninstall` | Remove PHARN: deletes only the files `pharn` recorded and you did not change, then `pharn.records.json` and `pharn.config.json` (backed up first). Never touches `pharn/.backup/` or a `.claude/settings.json` it did not create. `--yes`/`-y` skips the confirmation prompt. |
|
|
305
150
|
| `pharn --help` | Show every command, option and environment variable. `pharn <command> --help` shows one command and only the options it takes. |
|
|
306
151
|
| `pharn --version` | Show the installed CLI version. |
|
|
307
152
|
|
|
308
|
-
`init` also takes `--archetype <list>` (for example `--archetype backend`
|
|
309
|
-
|
|
310
|
-
detected ones — the in-product correction for a misdetected project. The value
|
|
311
|
-
must be a comma-separated list of `ssr`, `backend` and `spa`, or `lib` alone,
|
|
312
|
-
each at most once; anything else exits 1. The choice is recorded, so `update`
|
|
313
|
-
keeps it. The install summary shows what triggered each detected archetype
|
|
314
|
-
(`backend ← src/app/api/`), or that they came from the flag.
|
|
315
|
-
|
|
316
|
-
Three behaviours matter if you script the CLI:
|
|
317
|
-
|
|
318
|
-
- **Options are per-command.** Passing one a command does not take prints
|
|
319
|
-
``Unsupported option for `status`: "--force"`` to stderr with ``Run `pharn --help` for usage.``
|
|
320
|
-
and exits **1**; an extra positional is refused the same way. Both previously
|
|
321
|
-
parsed, were silently dropped, and exited 0.
|
|
322
|
-
- **`init` and `update` prompt.** Off a TTY a plain run exits 1 rather than
|
|
323
|
-
prompting into a dead stream. `update --yes` is the way through in CI. For
|
|
324
|
-
`init`, `--yes` skips the summary confirm but never the overwrite one: it
|
|
325
|
-
installs only into a project where none of its files exists yet, and
|
|
326
|
-
otherwise exits 1 — so a re-install always refuses it (use `update`). Both
|
|
327
|
-
commands' `--dry-run` needs no terminal and writes nothing. `uninstall`
|
|
328
|
-
likewise exits 1 off a TTY unless it is given `--yes`.
|
|
329
|
-
- **One writer at a time.** `init`, `add`, `remove`, `update` and `uninstall`
|
|
330
|
-
take an advisory lock at `pharn/.lock`; a second run refuses rather than
|
|
331
|
-
queueing. `add`, `remove`, `update` and `uninstall` also re-read
|
|
332
|
-
`pharn.config.json` once they hold the lock, and refuse — writing nothing —
|
|
333
|
-
if another run changed it after they read it (for example while a confirm
|
|
334
|
-
prompt was open).
|
|
335
|
-
`list` and `status` never take it and are never blocked by one, so
|
|
336
|
-
`pharn status --strict` stays runnable in CI while an update is in flight.
|
|
153
|
+
`init` also takes `--archetype <list>` (for example `--archetype ssr,backend`) to install for those
|
|
154
|
+
archetypes instead of the detected ones; the choice is recorded, so `update` keeps it.
|
|
337
155
|
|
|
338
|
-
|
|
156
|
+
If you script the CLI: an option a command does not take, or an extra positional, exits **1**
|
|
157
|
+
(``Unsupported option for `status`: "--force"``); off a TTY a plain `init`, `update` or `uninstall` exits 1
|
|
158
|
+
(`update --yes` is the CI line; `init --yes` never confirms an overwrite; `--dry-run` needs no terminal);
|
|
159
|
+
and one writer at a time holds `pharn/.lock`, while `list` and `status` never take it, so
|
|
160
|
+
`pharn status --strict` stays runnable in CI. A config changed while a prompt was open refuses the write.
|
|
339
161
|
|
|
340
|
-
|
|
341
|
-
[`pharn-dev/skills`](https://github.com/pharn-dev/skills) repository ships a
|
|
342
|
-
`pharn-cli` skill that operates this CLI for you. Ask your agent "Is PHARN up to
|
|
343
|
-
date in this project?" or "What would an update change?" and it runs the
|
|
344
|
-
read-only checks and a `--dry-run` preview first, applies the update without
|
|
345
|
-
overwriting your edits, and adds or removes grillers and lenses. The same
|
|
346
|
-
repository also carries `phargus` skills for setting up and diagnosing Node.js
|
|
347
|
-
applications with [Phargus](https://github.com/pharn-dev/phargus).
|
|
348
|
-
|
|
349
|
-
In Claude Code:
|
|
350
|
-
|
|
351
|
-
```text
|
|
352
|
-
/plugin marketplace add pharn-dev/skills
|
|
353
|
-
/plugin install pharn@pharn-dev
|
|
354
|
-
```
|
|
162
|
+
## Agent skills
|
|
355
163
|
|
|
356
|
-
|
|
357
|
-
|
|
164
|
+
The [`pharn-dev/skills`](https://github.com/pharn-dev/skills) repository ships a `pharn-cli` skill that
|
|
165
|
+
operates this CLI for you: ask "Is PHARN up to date in this project?" or "What would an update change?" and
|
|
166
|
+
it runs the read-only checks and a `--dry-run` first, applies updates without overwriting your edits, and
|
|
167
|
+
adds or removes grillers and lenses. It also carries `phargus` skills for
|
|
168
|
+
[Phargus](https://github.com/pharn-dev/phargus). In Claude Code, run `/plugin marketplace add pharn-dev/skills`
|
|
169
|
+
then `/plugin install pharn@pharn-dev`, or use `npx skills add pharn-dev/skills --skill pharn-cli`. The skills
|
|
170
|
+
are optional.
|
|
358
171
|
|
|
359
172
|
## Safety model
|
|
360
173
|
|
|
361
174
|
PHARN is intentionally conservative about writes:
|
|
362
175
|
|
|
363
|
-
- `init` checks for existing install targets and asks before overwriting them,
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
same,
|
|
372
|
-
|
|
373
|
-
before writing. `add` does the same for any destination file that differs from
|
|
374
|
-
upstream, and refuses the whole install — writing nothing — when a destination
|
|
375
|
-
path crosses a symlinked directory.
|
|
176
|
+
- `init` checks for existing install targets and asks before overwriting them, and refuses the whole
|
|
177
|
+
install (writing nothing) when a destination path crosses a symlinked directory.
|
|
178
|
+
- `update` uses `pharn.records.json` to skip files it cannot prove are untouched. In your project it deletes
|
|
179
|
+
only the directory of a capability it drops from `pharn.config.json` (PHARN runs whatever capability
|
|
180
|
+
directories are on disk), after backing up any file in it that `pharn` cannot prove it wrote; it never
|
|
181
|
+
touches `.claude/settings.json`. A re-run `init` does the same, after listing those directories in its
|
|
182
|
+
prompt. Every delete, and what is never deleted: [What PHARN deletes](docs/reference/deletes.md).
|
|
183
|
+
- `update --force` backs up overwritten files under `pharn/.backup/<timestamp>/` before writing. `add` does
|
|
184
|
+
the same for any destination file that differs from upstream, and refuses the whole install (writing
|
|
185
|
+
nothing) when a destination path crosses a symlinked directory.
|
|
376
186
|
- `status` and `list` are read-only.
|
|
377
|
-
- `remove` deletes only the selected capability directory and prunes its records,
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
version newer than yours, `init`/`add`/`update` stop with a named error before
|
|
391
|
-
writing anything.
|
|
392
|
-
|
|
393
|
-
Remote content is treated as untrusted input. Capability names, copyable file
|
|
394
|
-
names, versions, commit SHAs, and paths are validated against strict allowlists;
|
|
395
|
-
path traversal and symlink escapes are rejected; copied file contents are not
|
|
187
|
+
- `remove` deletes only the selected capability directory and prunes its records, after backing up to
|
|
188
|
+
`pharn/.backup/<timestamp>/` any file in it that `pharn` cannot prove it wrote unchanged; it never touches
|
|
189
|
+
`CONSTITUTION.md`, `pharn/memory-bank/`, or your detected archetypes, and refuses when that directory's
|
|
190
|
+
path crosses a symlink.
|
|
191
|
+
- `uninstall` deletes only files recorded in `pharn.records.json` that still match their recorded hash,
|
|
192
|
+
inside `pharn`'s install paths; it keeps every file you changed or added and lists the ones it kept, backs
|
|
193
|
+
up `pharn.config.json` before deleting it, never writes `.claude/settings.json` (it prints the hooks you
|
|
194
|
+
need to unwire instead), and refuses (deleting nothing) without a usable record store.
|
|
195
|
+
|
|
196
|
+
PHARN can also refuse to install at all: if upstream declares a minimum CLI version newer than yours,
|
|
197
|
+
`init`/`add`/`update` stop with a named error before writing anything. Remote content is treated as
|
|
198
|
+
untrusted input. Capability names, copyable file names, versions, commit SHAs, and paths are validated
|
|
199
|
+
against strict allowlists; path traversal and symlink escapes are rejected; copied file contents are not
|
|
396
200
|
executed by the CLI.
|
|
397
201
|
|
|
398
202
|
## Current scope
|
|
399
203
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
CI runs on Node 24, and a smoke job starts the packed CLI on exactly 24.2.0.
|
|
412
|
-
- **Archetype detection is JS/TS-shaped.** The signals are `package.json`
|
|
413
|
-
dependency names, `.tsx`/`.jsx` files, and — in a Next.js app only —
|
|
414
|
-
`next.config.*`, `app/` route handlers and `app/api`/`pages/api`. A root
|
|
415
|
-
`api/`, a `migrations/` directory and `.sql` files in a database directory
|
|
416
|
-
count only when the project has a root `package.json`. A Python, Go, Rust,
|
|
417
|
-
Ruby or PHP repo without one produces no signal, resolves to `lib`, and
|
|
418
|
-
receives the universal capabilities only — a correct outcome, not a failure.
|
|
419
|
-
One that also has a root `package.json` (a Vite frontend, or tooling only)
|
|
420
|
-
can resolve `backend` from its migrations; `pharn init --archetype` corrects
|
|
421
|
-
either way.
|
|
422
|
-
- **Server and database packages count only as runtime dependencies.** A
|
|
423
|
-
runtime database driver dependency (`pg`, `mongodb`, an ORM) means `backend`,
|
|
424
|
-
like a server framework; the same package only in `devDependencies` (a mock
|
|
425
|
-
server, a test database) does not. A backend bundled so that its framework is
|
|
426
|
-
only a devDependency needs `pharn init --archetype backend`. SSR and UI
|
|
427
|
-
frameworks count from `devDependencies` too.
|
|
428
|
-
- **Detection is bounded.** The file-tree scan examines at most 50,000 entries,
|
|
429
|
-
24 directories deep (skipped directories such as `node_modules` do not
|
|
430
|
-
count). When it stops at a bound before its result is settled, the install
|
|
431
|
-
summary says `detection stopped early` and `init --dry-run --json` reports
|
|
432
|
-
`"detectionTruncated": true`; check the archetypes and pass `--archetype` if
|
|
433
|
-
they are wrong.
|
|
434
|
-
- It does not scaffold your application or install framework packages.
|
|
435
|
-
- It does not replace tests, human review, or release judgment. It gives those
|
|
436
|
-
activities a structured record and repeatable workflow.
|
|
437
|
-
- `status` reports modified, missing, and unreadable PHARN-owned paths, and
|
|
438
|
-
the files upstream stopped shipping that are still in your project
|
|
439
|
-
(orphans). Nothing deletes an orphan; that is yours to do by hand.
|
|
440
|
-
- **Supported installs: the current minor and the previous one.** v0.20.x
|
|
441
|
-
works with installs made by 0.19.x or 0.20.x; re-run `pharn init` on an older
|
|
442
|
-
install, and it keeps the capabilities you added.
|
|
443
|
-
`--json` reports stay additive within `schemaVersion: 1`. Compatibility code
|
|
444
|
-
for older installs is removed on a named version: see the
|
|
445
|
-
[support policy](docs/support-policy.md).
|
|
446
|
-
|
|
447
|
-
See the [roadmap](docs/roadmap.md) for shipped versus planned work.
|
|
204
|
+
- It targets **Claude Code today**. Codex and Cursor support are planned, not shipped.
|
|
205
|
+
- It requires a git-initialized project and **Node >= 24.2.0**, for the CLI and for the installed floor
|
|
206
|
+
checkers (`pharn/floor/*.mjs`), which refuse to run on an older Node. `pharn init` and `pharn update`
|
|
207
|
+
refuse up front on an older Node, with nothing written.
|
|
208
|
+
- **Archetype detection is JS/TS-shaped and bounded.** A Python, Go, Rust, Ruby or PHP repo without a root
|
|
209
|
+
`package.json` resolves to `lib` and gets the universal capabilities, a correct outcome; `pharn init
|
|
210
|
+
--archetype` corrects any misdetection. The rules: [Detect archetypes](docs/commands/init.md#3-detect-archetypes).
|
|
211
|
+
- It does not scaffold your app, install framework packages, or replace tests, review or release judgment.
|
|
212
|
+
- **Supported installs: the current minor and the previous one.** Re-run `pharn init` on an older install;
|
|
213
|
+
it keeps the capabilities you added. `--json` reports stay additive within `schemaVersion: 1`. See the
|
|
214
|
+
[support policy](docs/support-policy.md) and the [roadmap](docs/roadmap.md).
|
|
448
215
|
|
|
449
216
|
## Documentation
|
|
450
217
|
|
|
451
|
-
Start here: [docs/](docs/README.md)
|
|
452
|
-
|
|
453
|
-
- [
|
|
454
|
-
|
|
455
|
-
- [pharn.config.json](docs/reference/pharn-config.md)
|
|
456
|
-
- [pharn.records.json](docs/reference/pharn-records.md)
|
|
457
|
-
- [Support policy](docs/support-policy.md)
|
|
458
|
-
- [Troubleshooting](docs/troubleshooting.md)
|
|
459
|
-
- [Roadmap](docs/roadmap.md)
|
|
218
|
+
Start here: [docs/](docs/README.md). [Getting started](docs/getting-started.md) ·
|
|
219
|
+
[Commands](docs/README.md#commands) · [pharn.config.json](docs/reference/pharn-config.md) ·
|
|
220
|
+
[pharn.records.json](docs/reference/pharn-records.md) · [Support policy](docs/support-policy.md) ·
|
|
221
|
+
[Troubleshooting](docs/troubleshooting.md) · [Roadmap](docs/roadmap.md)
|
|
460
222
|
|
|
461
223
|
## Development
|
|
462
224
|
|
|
@@ -464,34 +226,21 @@ Start here: [docs/](docs/README.md)
|
|
|
464
226
|
npm install
|
|
465
227
|
npm run dev -- init
|
|
466
228
|
npm run build
|
|
467
|
-
npm run test
|
|
468
|
-
npm run check
|
|
229
|
+
npm run check # format:check, lint, lint:md, typecheck, test
|
|
469
230
|
```
|
|
470
231
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
| ----------------------------- | ----------------------------------------------------- |
|
|
475
|
-
| `npm run typecheck` | Type-check source and tests. |
|
|
476
|
-
| `npm run lint` | Run ESLint with zero warnings. |
|
|
477
|
-
| `npm run lint:md` | Run markdownlint over docs and root markdown. |
|
|
478
|
-
| `npm run test:coverage` | Run the Vitest coverage gate used by CI. |
|
|
479
|
-
| `npm run build:install-local` | Build and install the local CLI into local test apps. |
|
|
480
|
-
|
|
481
|
-
Set `PHARN_DEBUG=1` for verbose fetch and install errors; `NO_COLOR` / `FORCE_COLOR`
|
|
482
|
-
control colour (see [Colour](docs/troubleshooting.md#colour)). See
|
|
232
|
+
Other scripts: `npm run test:coverage` (the coverage gate CI runs) and `npm run build:install-local` (build
|
|
233
|
+
and install the local CLI into local test apps). Set `PHARN_DEBUG=1` for verbose fetch and install errors;
|
|
234
|
+
`NO_COLOR` / `FORCE_COLOR` control colour (see [Colour](docs/troubleshooting.md#colour)). See
|
|
483
235
|
[CONTRIBUTING.md](CONTRIBUTING.md) for contributor notes and release discipline.
|
|
484
236
|
|
|
485
237
|
## Security
|
|
486
238
|
|
|
487
|
-
The CLI has a small trust boundary: it downloads PHARN content from GitHub,
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
Please report vulnerabilities through [SECURITY.md](SECURITY.md), not public
|
|
493
|
-
issues. The detailed model is in [THREAT-MODEL.md](THREAT-MODEL.md) and
|
|
494
|
-
[LIMITS.md](LIMITS.md).
|
|
239
|
+
The CLI has a small trust boundary: it downloads PHARN content from GitHub, validates and extracts it, then
|
|
240
|
+
copies selected files into your project. The security-sensitive path validation, tar extraction, symlink
|
|
241
|
+
handling, and update decision tables are covered by tests. Please report vulnerabilities through
|
|
242
|
+
[SECURITY.md](SECURITY.md), not public issues. The detailed model is in [THREAT-MODEL.md](THREAT-MODEL.md)
|
|
243
|
+
and [LIMITS.md](LIMITS.md).
|
|
495
244
|
|
|
496
245
|
## License
|
|
497
246
|
|