claude-plan-review 0.1.0 → 0.1.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 +12 -0
- package/package.json +1 -1
- package/src/cli.js +17 -5
package/README.md
CHANGED
|
@@ -61,6 +61,18 @@ bun src/cli.js init /path/to/your/project # …or…
|
|
|
61
61
|
node src/cli.js init /path/to/your/project # writes an absolute-path hook command
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
+
### All projects at once (global)
|
|
65
|
+
|
|
66
|
+
Install once, enable everywhere — the hook goes in your user-level `~/.claude/settings.json`:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
npm install -g claude-plan-review # or: bun add -g claude-plan-review
|
|
70
|
+
claude-plan-review init --global
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
This fires the review for plans in **every** project, with no per-project setup. Don't also
|
|
74
|
+
run a per-project `init` in the same project, or the hook will fire twice.
|
|
75
|
+
|
|
64
76
|
### Either way
|
|
65
77
|
|
|
66
78
|
**Reopen the `/hooks` menu once (or restart Claude Code)** in that project so the
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-plan-review",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Review, comment on, and approve/reject Claude Code plans in a local GitHub-style web UI — with persistent comments, version history, and diffs.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
package/src/cli.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { spawnSync } from "node:child_process";
|
|
3
3
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
|
|
4
|
+
import { homedir } from "node:os";
|
|
4
5
|
import { dirname, join, resolve } from "node:path";
|
|
5
6
|
import { fileURLToPath } from "node:url";
|
|
6
7
|
import { DEFAULT_PORT, SERVER_FILE } from "./paths.js";
|
|
@@ -34,6 +35,14 @@ function chooseRuntime(args) {
|
|
|
34
35
|
|
|
35
36
|
function hookCommand(args) {
|
|
36
37
|
const runtime = chooseRuntime(args);
|
|
38
|
+
// global install → use the bare `claude-plan-review` command (resolved via PATH at hook time).
|
|
39
|
+
// We intentionally do NOT hardcode an absolute path: version managers like fnm/nvm expose
|
|
40
|
+
// bins via per-shell paths that don't persist across sessions.
|
|
41
|
+
if (args.includes("--global")) {
|
|
42
|
+
if (canRun("claude-plan-review")) return "claude-plan-review hook";
|
|
43
|
+
// not on PATH → fall back to the package runner
|
|
44
|
+
return runtime === "node" ? "npx claude-plan-review hook" : "bunx claude-plan-review hook";
|
|
45
|
+
}
|
|
37
46
|
if (args.includes("--published") || args.includes("--bunx")) {
|
|
38
47
|
// portable command using the runtime's package runner
|
|
39
48
|
return runtime === "node" ? "npx claude-plan-review hook" : "bunx claude-plan-review hook";
|
|
@@ -50,10 +59,12 @@ function readJSON(path, fallback) {
|
|
|
50
59
|
}
|
|
51
60
|
|
|
52
61
|
function cmdInit(args) {
|
|
62
|
+
const global = args.includes("--global");
|
|
53
63
|
const local = args.includes("--local");
|
|
54
64
|
const dirArg = args.find((a) => !a.startsWith("--") && a !== chooseRuntime(args));
|
|
55
|
-
const
|
|
56
|
-
|
|
65
|
+
const settingsFile = global
|
|
66
|
+
? join(homedir(), ".claude", "settings.json")
|
|
67
|
+
: join(resolve(dirArg || process.cwd()), ".claude", local ? "settings.local.json" : "settings.json");
|
|
57
68
|
mkdirSync(dirname(settingsFile), { recursive: true });
|
|
58
69
|
|
|
59
70
|
const settings = readJSON(settingsFile, {});
|
|
@@ -79,7 +90,7 @@ function cmdInit(args) {
|
|
|
79
90
|
}
|
|
80
91
|
console.log(`\nRuntime: ${chooseRuntime(args)}\nCommand: ${command}`);
|
|
81
92
|
console.log(
|
|
82
|
-
`\nReopen the /hooks menu once (or restart Claude Code) in this project so the new hook is picked up.\n` +
|
|
93
|
+
`\nReopen the /hooks menu once (or restart Claude Code) ${global ? "in any project" : "in this project"} so the new hook is picked up.\n` +
|
|
83
94
|
`Then finish a plan in plan mode — your browser will open the review.`,
|
|
84
95
|
);
|
|
85
96
|
}
|
|
@@ -110,9 +121,10 @@ function usage() {
|
|
|
110
121
|
console.log(`claude-plan-review — review Claude Code plans in your browser (runs on Bun or Node ≥18)
|
|
111
122
|
|
|
112
123
|
Usage:
|
|
113
|
-
claude-plan-review init [dir] [--local] [--published] [--runtime bun|node]
|
|
114
|
-
Wire the ExitPlanMode hook into a project.
|
|
124
|
+
claude-plan-review init [dir] [--global] [--local] [--published] [--runtime bun|node]
|
|
125
|
+
Wire the ExitPlanMode hook into a project (or all projects).
|
|
115
126
|
Runtime auto-detects (Bun if installed, else Node).
|
|
127
|
+
--global → ~/.claude/settings.json (applies to ALL projects)
|
|
116
128
|
--local → .claude/settings.local.json
|
|
117
129
|
--published → portable bunx/npx command (after npm publish)
|
|
118
130
|
--runtime → force a runtime
|