create-pathfinder 1.4.1 → 1.5.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.
Files changed (40) hide show
  1. package/AGENTS.md +4 -0
  2. package/CLAUDE.md +7 -1
  3. package/README.md +97 -9
  4. package/bin/create-pathfinder.mjs +32 -4
  5. package/context/coding-standards.md +19 -0
  6. package/context/project-overview.md +14 -2
  7. package/copy-list.json +0 -1
  8. package/package.json +2 -2
  9. package/skills/complete-feature/SKILL.md +2 -2
  10. package/src/cli.mjs +765 -34
  11. package/src/clipboard.mjs +134 -0
  12. package/src/detect.mjs +183 -0
  13. package/src/editor.mjs +136 -0
  14. package/src/git.mjs +58 -0
  15. package/src/harnesses/adapter.mjs +288 -0
  16. package/src/harnesses/index.mjs +122 -0
  17. package/src/install.mjs +209 -1
  18. package/src/kickstart-prompt.mjs +81 -0
  19. package/src/prompt.mjs +307 -0
  20. package/templates/project-overview.template.md +14 -2
  21. package/prompts/01-kickstart-project.md +0 -1
  22. package/prompts/01-teach-current-feature.md +0 -9
  23. package/prompts/02-debate-me.md +0 -1
  24. package/prompts/02-quiz-current-feature.md +0 -7
  25. package/prompts/03-challenge-current-feature.md +0 -7
  26. package/prompts/03-prototype.md +0 -1
  27. package/prompts/04-teach-current-architecture.md +0 -7
  28. package/prompts/04-to-specs.md +0 -1
  29. package/prompts/05-learning-review.md +0 -5
  30. package/prompts/05-load-feature.md +0 -1
  31. package/prompts/06-start-feature.md +0 -1
  32. package/prompts/07-review-feature.md +0 -1
  33. package/prompts/08-complete-feature.md +0 -1
  34. package/prompts/09-learn-feature.md +0 -1
  35. package/prompts/10-learn-codebase.md +0 -1
  36. package/prompts/11-handoff.md +0 -1
  37. package/prompts/12-skillsmith.md +0 -1
  38. package/prompts/13-reverse-engineer.md +0 -18
  39. package/prompts/14-reflect.md +0 -13
  40. package/prompts/15-debug-issue.md +0 -15
package/AGENTS.md CHANGED
@@ -5,3 +5,7 @@ Read `CLAUDE.md` first.
5
5
  Project truth lives in `context/`. Follow the technology and delivery choices documented in `context/project-overview.md`; do not assume a framework, package manager, branch model, or release process.
6
6
 
7
7
  Use the smallest relevant context for the active task. Keep each delivery chunk stable, reviewable, and verifiable.
8
+
9
+ Canonical skills live under `skills/` and are the only behavior contract; anything under `.claude/skills/` or `.agents/skills/` is a generated pointer to one, so edit the canonical file and regenerate the adapter.
10
+
11
+ If this tool has no native skill discovery, invoke a skill by reading its canonical file directly: `Use skills/<name>/SKILL.md and follow it exactly.` That is the whole fallback — there is no launcher file, and no second copy of a skill to find.
package/CLAUDE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Project Agent Guide
2
2
 
3
- This repository uses an AI-assisted, human-in-the-loop workflow. Project truth lives in `context/`, reusable behaviors live in `skills/`, and manual launchers live in `prompts/`.
3
+ This repository uses an AI-assisted, human-in-the-loop workflow. Project truth lives in `context/`, and reusable behaviors live in `skills/`.
4
4
 
5
5
  ## Read only what is needed
6
6
 
@@ -48,6 +48,12 @@ Ask before actions identified in `context/ai-interaction.md`, especially depende
48
48
  - Prefer concrete verification over confident narration.
49
49
  - Report conflicts between specs, repository reality, and durable context.
50
50
 
51
+ ## Canonical skills and harness adapters
52
+
53
+ Canonical Pathfinder skills are tool-neutral and live under `skills/`. Harness-specific representations — `.claude/skills/`, `.agents/skills/` — are generated integration artifacts and must not become independent behavior contracts. Edit the canonical file; regenerate the adapter.
54
+
55
+ An adapter carries the canonical skill's frontmatter and a pointer to it, and nothing else. If an adapter and its canonical skill disagree, the canonical skill is correct.
56
+
51
57
  ## Available skills
52
58
 
53
59
  - `kickstart-pathfinder` — discover and initialize project context
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  **An AI-assisted, human-in-the-loop workflow for building software — without giving up the decisions.**
4
4
 
5
- This package installs [Pathfinder](https://github.com/rikilamadrid/pathfinder) into a Git repository you already have.
5
+ This package installs [Pathfinder](https://github.com/rikilamadrid/pathfinder) into a Git repository — one you already have, or one it offers to create for you.
6
6
 
7
7
  ```bash
8
8
  npx create-pathfinder
@@ -17,16 +17,21 @@ Do not install packages or write product code yet.
17
17
 
18
18
  ## What it installs
19
19
 
20
- Pathfinder is a kit of context files and skills — not a framework. There is no runtime, no dependency, and nothing to build. The installer copies six things into your repository and nothing else:
20
+ Pathfinder is a kit of context files and skills — not a framework. There is no runtime, no dependency, and nothing to build. The installer copies five things into your repository and nothing else:
21
21
 
22
22
  | Path | What it is |
23
23
  | --- | --- |
24
24
  | `AGENTS.md`, `CLAUDE.md` | Entry files that tell an agent how to work in the project |
25
25
  | `context/` | Project truth — overview, standards, interaction rules, current feature |
26
26
  | `skills/` | Twenty skills covering discovery, specs, delivery, debugging, review, and learning |
27
- | `prompts/` | Manual launchers for tools that do not discover local skills |
28
27
  | `templates/` | Starting points the project copies when it needs them |
29
28
 
29
+ On request it also writes one thing it does not copy:
30
+
31
+ | Path | What it is |
32
+ | --- | --- |
33
+ | `.claude/skills/`, `.agents/skills/` | **Generated** — a small adapter per skill, derived from `skills/` at install time, so your coding tool discovers them natively. Not part of the five above; see [Native skills for your coding tool](#native-skills-for-your-coding-tool) |
34
+
30
35
  It never copies Pathfinder's own `README.md`, `CHANGELOG.md`, CI configuration, or brand assets. Your repository gets the workflow, not the project that maintains it.
31
36
 
32
37
  ## What it will not do to your repository
@@ -34,22 +39,105 @@ It never copies Pathfinder's own `README.md`, `CHANGELOG.md`, CI configuration,
34
39
  This runs once, in real code, so it is deliberately timid:
35
40
 
36
41
  - **It never overwrites.** Files that already exist are left exactly as they are and listed by name in the summary. Pass `--force` if you actually want them replaced.
37
- - **It refuses to run outside a Git repository**, so whatever it writes is reviewable and undoable.
38
- - **`--dry-run` reports the same plan the real install would carry out**, without writing anything.
42
+ - **It will not install outside a Git repository**, so whatever it writes is reviewable and undoable. In an empty directory it offers to run `git init` for you — and that is the only Git command it will ever run. No `add`, no `commit`, no config, no branch. If you say no, nothing is written.
43
+ - **It never touches an existing history.** A directory that is already a repository, or inside one, is never asked about and never initialized.
44
+ - **`--dry-run` reports the same plan the real install would carry out**, including any `git init`, without writing anything.
45
+ - **It owns a generated adapter, and nothing else in your tool's directory.** A file at `.claude/skills/<name>/SKILL.md` or `.agents/skills/<name>/SKILL.md` belongs to the installer only if that name is a Pathfinder skill *and* the file carries the `pathfinder:adapter` marker it wrote. Your `settings.json`, `settings.local.json`, agents, commands, hooks, and any skill of your own are never read and never written, a file you wrote at an adapter path is left alone and named in the summary, and nothing is ever deleted.
46
+
47
+ **Re-running `npx create-pathfinder` in a project that already has Pathfinder is safe, requires no flags, and is idempotent.** Canonical files you have edited are skipped and listed; files new in this version are written; adapters are regenerated, byte-identical if nothing changed; anything you own is untouched. That is how a project installed before v1.5.0 gains adapters — one ordinary run, no migration command.
48
+
49
+ ## Native skills for your coding tool
50
+
51
+ Pathfinder's skills are tool-neutral files at `skills/<name>/SKILL.md`. Some coding tools discover skills natively from their own directory, and the installer can generate small adapters there so you get `/reflect` instead of pasting a path.
52
+
53
+ ```bash
54
+ npx create-pathfinder --agents claude-code,codex
55
+ ```
56
+
57
+ | Id | Writes to | Invoked as |
58
+ | --- | --- | --- |
59
+ | `claude-code` | `.claude/skills/<name>/SKILL.md` | `/reflect` |
60
+ | `codex` | `.agents/skills/<name>/SKILL.md` | `/skills`, or `$reflect` |
61
+
62
+ Each adapter is a few lines long: it carries the skill's name and description, and tells the tool to read the canonical file. Both harnesses get the same bytes at a different path — the behavior lives in one place, and the adapter never restates it.
63
+
64
+ Pick one, both, or neither. Choosing one never generates, removes, or claims anything under the other's directory, and Pathfinder never writes to a personal skills directory such as `$HOME/.agents/skills`.
65
+
66
+ In a terminal you are asked instead of passing the flag — a numbered list, comma-separated, `Enter` for the tools found on your machine, `0` for none. Each option shows the directory it writes to before you choose it.
67
+
68
+ The list has a third entry, **Something else…**, and it generates nothing. Name your tool and the summary says so plainly, because a `.mdc` file Cursor half-reads or a `SKILL.md` in a directory nothing scans would be a file your tool ignores under a summary claiming success. Two things do work for any tool: the kit installs `AGENTS.md` at the repository root, which Codex, Cursor, and several others read, and any agent can be given the line the adapters delegate to anyway — `Use skills/<name>/SKILL.md and follow it exactly.`
69
+
70
+ Nothing is configured unless you choose it. Detection only sets the default, a piped or scripted run configures nothing at all unless `--agents` says so, and `--agents` accepts only the ids in the table above — an unknown one exits 2 rather than quietly installing nothing.
71
+
72
+ **What the installer owns, and what it will not touch:**
73
+
74
+ - **It owns a file at `<tool>/skills/<name>/SKILL.md` only if that name is a Pathfinder skill *and* the file carries the `pathfinder:adapter` marker it wrote.** Those it regenerates freely, with no flag — that is how an older install gains adapters by re-running.
75
+ - **A file you wrote at one of those paths is left alone** and listed by name in the summary. `--force` replaces it; nothing else does.
76
+ - **Everything else under that directory is never read and never written** — your `settings.json`, `settings.local.json`, agents, commands, hooks, and any skill of your own.
77
+ - **Nothing is ever deleted.** An adapter for a skill a newer version no longer ships is reported and left in place.
78
+
79
+ Re-running is idempotent: the second run writes the same bytes and reports the adapters as already up to date.
39
80
 
40
- Re-running it is safe, and fills in only what is missing.
81
+ ## The Kickstart prompt, and your clipboard
82
+
83
+ Every install ends by printing the one prompt that starts a session, and the prompt follows the tool you chose:
84
+
85
+ | Configured | Prompt |
86
+ | --- | --- |
87
+ | `claude-code` | `/kickstart-pathfinder` |
88
+ | `codex` | `$kickstart-pathfinder` |
89
+ | both, or neither | `Use skills/kickstart-pathfinder/SKILL.md. Help me initialize this project. Do not install packages or write product code yet.` |
90
+
91
+ Two harnesses fall back to the neutral form because one clipboard cannot hold two syntaxes, and picking a favorite would quietly decide which of your tools is the real one.
92
+
93
+ In a terminal you are then asked whether to copy it. The question says what it replaces, because your clipboard is yours:
94
+
95
+ ```text
96
+ ? Copy that prompt to your clipboard? This replaces what is on it now. [Y/n]
97
+ ```
98
+
99
+ - **Nothing is copied without an explicit yes.** Declining, an unanswered question, `--no-clipboard`, `--yes`, `--dry-run`, and any run without a terminal on both ends all leave your clipboard exactly as it was.
100
+ - **The prompt is printed either way.** Copying is a convenience, never the only way to get it, which is what lets every failure be a non-event.
101
+ - **No dependency, and no clipboard is ever read.** The copy uses whatever your system already has — `pbcopy`, `clip.exe` including under WSL, or `wl-copy`, `xclip`, or `xsel` — chosen by what is actually installed rather than by your platform's name. If none of them is there, or one of them fails, the installer says so in one line and still exits 0.
102
+
103
+ ## Opening the project
104
+
105
+ The last question is whether to open the project, and it is only ever about an editor you already have. The installer looks for `code` (VS Code) and `cursor` (Cursor) on your `PATH`:
106
+
107
+ - **One found** — a yes/no naming it: `? Open this project in VS Code? [Y/n]`
108
+ - **Several found** — a numbered list, alphabetical, ending in `Don't open`
109
+ - **None found** — no question at all
110
+
111
+ Neither editor is a Pathfinder requirement, and the alphabetical order is not a recommendation. Nothing else can be launched: there is no way to name an editor or pass a path, because an editor the installer did not find is one it cannot honestly offer.
112
+
113
+ The launch is detached — the installer hands over the project directory and exits immediately, so it never waits for your editor and never prints your editor's output as its own.
114
+
115
+ - **Nothing is launched without an explicit yes.** Declining, an unanswered question, `Don't open`, `--no-open`, `--yes`, `--dry-run`, and any run without a terminal on both ends all leave your screen alone.
116
+ - **A failed launch is not a failed install.** If the binary is there but cannot be run, the installer says so in one line, tells you the directory to open yourself, and still exits 0. The install already succeeded; opening it was a convenience.
41
117
 
42
118
  ## Options
43
119
 
44
120
  | Option | Effect |
45
121
  | --- | --- |
46
- | `--dry-run` | Report what would be written; change nothing |
47
- | `--force` | Overwrite files that already exist |
122
+ | `--agents <ids>` | Generate skill adapters for these tools, comma-separated. Valid ids: `claude-code`, `codex`. Alias: `--agent` |
123
+ | `--dry-run` | Report what would be written, and any `git init` that would run first; change nothing |
124
+ | `--force` | Overwrite files that already exist, and replace a file you wrote at a path an adapter would occupy |
125
+ | `--git-init` | Run `git init` here if this is not a repository yet |
126
+ | `--no-git-init` | Never run `git init`; refuse instead |
127
+ | `--no-clipboard` | Never offer to copy the Kickstart prompt. The prompt is printed either way |
128
+ | `--no-open` | Never offer to open the project in an editor |
129
+ | `--yes`, `--no-input` | Take the defaults and ask nothing. It does not authorize `git init`, configure any tool, touch your clipboard, or open an editor — pass `--git-init` and `--agents` for the first two |
48
130
  | `-h`, `--help` | Show usage |
49
131
 
132
+ Questions are asked only when stdin and stdout are both terminals. Piped, redirected, or in CI, nothing is asked and nothing is prompted for — so a directory that is not a repository needs `--git-init`, or the install is refused, no tool is configured without `--agents`, the clipboard is never touched at all, and no editor is ever launched.
133
+
50
134
  ## Requirements
51
135
 
52
- Node 18 or newer, and a Git repository. No dependencies this package installs nothing into your project's `node_modules`, and has none of its own.
136
+ Node 18 or newer, and a Git repository — though the installer will offer to create one for you.
137
+
138
+ The `git` binary is only needed to *create* that repository. Inside one that already exists, the installer finds it by walking the filesystem for `.git` and never runs Git at all, so it works on a machine where `git` is not on your `PATH`.
139
+
140
+ No dependencies — this package installs nothing into your project's `node_modules`, and has none of its own.
53
141
 
54
142
  ## Links
55
143
 
@@ -1,8 +1,36 @@
1
1
  #!/usr/bin/env node
2
2
  import { run } from "../src/cli.mjs";
3
+ import { createPrompter } from "../src/prompt.mjs";
3
4
 
4
- process.exitCode = run(process.argv.slice(2), {
5
- cwd: process.cwd(),
6
- out: (text) => process.stdout.write(text),
7
- err: (text) => process.stderr.write(text),
5
+ // Everything the CLI learns about the outside world arrives through this call.
6
+ // `run` reads no globals of its own, so a test can hand it a synthesized
7
+ // environment a Windows PATH, an absent $HOME, a terminal that is not one —
8
+ // without touching the process it runs in.
9
+ //
10
+ // The TTY guard is decided here, once, and both ends must be terminals: a
11
+ // question needs somewhere to be printed *and* someone able to answer it.
12
+ // `create-pathfinder < /dev/null` in a terminal is not interactive, and neither
13
+ // is a run whose stdout is a pipe.
14
+ const interactive = Boolean(process.stdin.isTTY) && Boolean(process.stdout.isTTY);
15
+
16
+ const prompter = createPrompter({
17
+ input: process.stdin,
18
+ output: process.stdout,
19
+ interactive,
8
20
  });
21
+
22
+ try {
23
+ process.exitCode = await run(process.argv.slice(2), {
24
+ cwd: process.cwd(),
25
+ out: (text) => process.stdout.write(text),
26
+ err: (text) => process.stderr.write(text),
27
+ env: process.env,
28
+ platform: process.platform,
29
+ stdoutIsTTY: Boolean(process.stdout.isTTY),
30
+ prompter,
31
+ });
32
+ } finally {
33
+ // An open reader holds stdin open, and a process with an open stdin does not
34
+ // exit. Closed on every path, including the ones that refused.
35
+ prompter.close();
36
+ }
@@ -53,6 +53,25 @@ Choose tests by behavior and risk:
53
53
 
54
54
  Avoid tests that only reproduce implementation detail.
55
55
 
56
+ ## Verification Evidence
57
+
58
+ These apply to any claim that something works — a test, a manual check, or a
59
+ verification step in a feature's acceptance criteria.
60
+
61
+ - **Exercise the artifact a user receives, the way a user exercises it.** A
62
+ hand-written sample of generated output, a local imitation of an external
63
+ system, or the working tree in place of the built and published thing is
64
+ evidence about the stand-in, not about the artifact. Prefer one check against
65
+ the real artifact over several against convenient substitutes.
66
+ - **When a mechanism can fail by doing nothing, observe that the right thing
67
+ happened.** A clean exit says the command ran. It does not say the effect
68
+ occurred, and a step that silently does nothing usually reports success.
69
+ - **Beware a check whose every input it supplied itself.** If the test chose the
70
+ fixtures, the environment, and the trigger, it has confirmed its own
71
+ assumptions. Name which inputs came from the real system.
72
+ - State what was verified and what was only reasoned about. An unobserved
73
+ criterion is recorded as unobserved, not as passed.
74
+
56
75
  ## Dependencies
57
76
 
58
77
  Before adding one, assess necessity, maintenance, security, runtime cost, licensing, portability, and simpler alternatives. Follow the approval policy in `context/ai-interaction.md`.
@@ -12,11 +12,23 @@
12
12
 
13
13
  ## Decision States
14
14
 
15
+ These four words describe a decision:
16
+
15
17
  - `TBD` — human decision required
16
18
  - `None` — intentionally excluded
17
19
  - `N/A` — not applicable
18
20
  - `Deferred` — intentionally postponed
19
21
 
22
+ ## Record Status
23
+
24
+ A `Status` column describes the record, not the decision:
25
+
26
+ - `proposed` — written down, not yet approved by the human
27
+ - `accepted` — approved by the human
28
+ - `superseded` — replaced by a later decision, kept for history
29
+
30
+ The two answer different questions. `TBD` says nobody has decided yet. `proposed` says something was recorded for the human to approve. A recorded proposal is not an approved decision.
31
+
20
32
  ## Product Vision
21
33
 
22
34
  - Problem:
@@ -56,9 +68,9 @@ starting state -> action/process -> useful result -> reason to return or continu
56
68
 
57
69
  ## Recommended and Approved Technology
58
70
 
59
- Recommendations may be proposed by `debate-me`; approved choices belong here.
71
+ Recommended and approved choices both live here. `debate-me` and `kickstart-pathfinder` may record a choice before the human approves it; that row is marked `proposed` in `Status` and stays that way until it is `accepted`. Leave `Status` empty while the choice is still `TBD`.
60
72
 
61
- | Layer | Approved choice | Reason | Status |
73
+ | Layer | Choice | Reason | Status |
62
74
  | --- | --- | --- | --- |
63
75
  | Platform/runtime | `TBD` | | |
64
76
  | Language(s) | `TBD` | | |
package/copy-list.json CHANGED
@@ -4,7 +4,6 @@
4
4
  "AGENTS.md",
5
5
  "CLAUDE.md",
6
6
  "context",
7
- "prompts",
8
7
  "skills",
9
8
  "templates"
10
9
  ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pathfinder",
3
- "version": "1.4.1",
3
+ "version": "1.5.1",
4
4
  "description": "Install the Pathfinder AI-assisted, human-in-the-loop workflow kit into a Git repository.",
5
5
  "keywords": [
6
6
  "pathfinder",
@@ -34,11 +34,11 @@
34
34
  "AGENTS.md",
35
35
  "CLAUDE.md",
36
36
  "context",
37
- "prompts",
38
37
  "skills",
39
38
  "templates"
40
39
  ],
41
40
  "scripts": {
41
+ "test": "node --test",
42
42
  "stage": "node scripts/stage-kit.mjs",
43
43
  "unstage": "node scripts/stage-kit.mjs --clean",
44
44
  "prepack": "node scripts/stage-kit.mjs",
@@ -8,8 +8,8 @@ description: Close an accepted feature through final verification, records, deli
8
8
  1. Confirm review findings are resolved or explicitly accepted.
9
9
  2. Run final project-appropriate verification.
10
10
  3. Confirm each acceptance criterion with evidence.
11
- 4. Follow the approved commit, PR, merge, changelog, versioning, release, and deployment policy—requesting approval where required.
12
- 5. Append the durable outcome to `context/history.md`.
11
+ 4. Follow the approved commit, PR, merge, changelog, versioning, release, and deployment policy—requesting approval where required. After the merge, verify the merged mainline and clean up the merged branch as that policy requires.
12
+ 5. Append the durable outcome to `context/history.md` while completing the feature, not afterwards. If the feature was merged without this skill running, still write the entry and record that it was written after the fact.
13
13
  6. Mark/reset `context/current-feature.md` and identify the next action.
14
14
  7. Offer or invoke `learn-feature` when learning is enabled.
15
15
  8. Produce a compact completion summary.