claude-prism 0.5.1 → 0.5.3
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/lib/installer.mjs +31 -17
- package/package.json +1 -1
package/lib/installer.mjs
CHANGED
|
@@ -41,16 +41,10 @@ export async function init(projectDir, options = {}) {
|
|
|
41
41
|
if (hooks) {
|
|
42
42
|
mkdirSync(hooksDir, { recursive: true });
|
|
43
43
|
|
|
44
|
-
// Copy runner scripts (executable wrappers Claude Code calls)
|
|
45
|
-
const runnersDir = join(TEMPLATES_DIR, 'runners');
|
|
46
|
-
copyFileSync(join(runnersDir, 'commit-guard.mjs'), join(hooksDir, 'commit-guard.mjs'));
|
|
47
|
-
copyFileSync(join(runnersDir, 'debug-loop.mjs'), join(hooksDir, 'debug-loop.mjs'));
|
|
48
|
-
copyFileSync(join(runnersDir, 'test-tracker.mjs'), join(hooksDir, 'test-tracker.mjs'));
|
|
49
|
-
copyFileSync(join(runnersDir, 'scope-guard.mjs'), join(hooksDir, 'scope-guard.mjs'));
|
|
50
|
-
|
|
51
44
|
// Copy unified pipeline runners
|
|
52
|
-
|
|
45
|
+
const runnersDir = join(TEMPLATES_DIR, 'runners');
|
|
53
46
|
copyFileSync(join(runnersDir, 'pre-tool.mjs'), join(hooksDir, 'pre-tool.mjs'));
|
|
47
|
+
copyFileSync(join(runnersDir, 'post-tool.mjs'), join(hooksDir, 'post-tool.mjs'));
|
|
54
48
|
copyFileSync(join(runnersDir, 'user-prompt.mjs'), join(hooksDir, 'user-prompt.mjs'));
|
|
55
49
|
|
|
56
50
|
// Copy rule logic files
|
|
@@ -117,10 +111,8 @@ export function check(projectDir) {
|
|
|
117
111
|
const rules = existsSync(claudeMdPath)
|
|
118
112
|
&& readFileSync(claudeMdPath, 'utf8').includes('<!-- PRISM:START -->');
|
|
119
113
|
|
|
120
|
-
const hooks = existsSync(join(claudeDir, 'hooks', '
|
|
121
|
-
&& existsSync(join(claudeDir, 'hooks', '
|
|
122
|
-
&& existsSync(join(claudeDir, 'hooks', 'test-tracker.mjs'))
|
|
123
|
-
&& existsSync(join(claudeDir, 'hooks', 'scope-guard.mjs'));
|
|
114
|
+
const hooks = existsSync(join(claudeDir, 'hooks', 'pre-tool.mjs'))
|
|
115
|
+
&& existsSync(join(claudeDir, 'hooks', 'post-tool.mjs'));
|
|
124
116
|
|
|
125
117
|
const config = existsSync(join(projectDir, '.claude-prism.json'));
|
|
126
118
|
|
|
@@ -164,7 +156,7 @@ export function uninstall(projectDir) {
|
|
|
164
156
|
}
|
|
165
157
|
|
|
166
158
|
// 3. Remove prism hooks
|
|
167
|
-
for (const hook of ['commit-guard.mjs', 'debug-loop.mjs', 'test-tracker.mjs', 'scope-guard.mjs', 'user-prompt.mjs']) {
|
|
159
|
+
for (const hook of ['commit-guard.mjs', 'debug-loop.mjs', 'test-tracker.mjs', 'scope-guard.mjs', 'pre-tool.mjs', 'post-tool.mjs', 'user-prompt.mjs']) {
|
|
168
160
|
const p = join(claudeDir, 'hooks', hook);
|
|
169
161
|
if (existsSync(p)) rmSync(p);
|
|
170
162
|
}
|
|
@@ -182,7 +174,7 @@ export function uninstall(projectDir) {
|
|
|
182
174
|
if (settings.hooks) {
|
|
183
175
|
for (const [event, hookList] of Object.entries(settings.hooks)) {
|
|
184
176
|
settings.hooks[event] = hookList.filter(
|
|
185
|
-
h => !h.hooks?.some(hh => hh.command?.includes('commit-guard') || hh.command?.includes('debug-loop') || hh.command?.includes('test-tracker') || hh.command?.includes('scope-guard') || hh.command?.includes('user-prompt'))
|
|
177
|
+
h => !h.hooks?.some(hh => hh.command?.includes('commit-guard') || hh.command?.includes('debug-loop') || hh.command?.includes('test-tracker') || hh.command?.includes('scope-guard') || hh.command?.includes('pre-tool') || hh.command?.includes('post-tool') || hh.command?.includes('user-prompt'))
|
|
186
178
|
);
|
|
187
179
|
if (settings.hooks[event].length === 0) delete settings.hooks[event];
|
|
188
180
|
}
|
|
@@ -234,6 +226,28 @@ export async function update(projectDir) {
|
|
|
234
226
|
if (existsSync(p)) rmSync(p);
|
|
235
227
|
}
|
|
236
228
|
|
|
229
|
+
// Migration: remove legacy individual runners (now using unified pipeline runners)
|
|
230
|
+
for (const runner of ['commit-guard.mjs', 'debug-loop.mjs', 'test-tracker.mjs', 'scope-guard.mjs']) {
|
|
231
|
+
const p = join(claudeDir, 'hooks', runner);
|
|
232
|
+
if (existsSync(p)) rmSync(p);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Migration: remove legacy individual hook entries from settings.json
|
|
236
|
+
const settingsPath = join(claudeDir, 'settings.json');
|
|
237
|
+
if (existsSync(settingsPath)) {
|
|
238
|
+
const settings = JSON.parse(readFileSync(settingsPath, 'utf8'));
|
|
239
|
+
if (settings.hooks) {
|
|
240
|
+
const legacyCommands = ['commit-guard', 'debug-loop', 'test-tracker', 'scope-guard'];
|
|
241
|
+
for (const [event, hookList] of Object.entries(settings.hooks)) {
|
|
242
|
+
settings.hooks[event] = hookList.filter(
|
|
243
|
+
h => !h.hooks?.some(hh => legacyCommands.some(lc => hh.command?.includes(lc)))
|
|
244
|
+
);
|
|
245
|
+
if (settings.hooks[event].length === 0) delete settings.hooks[event];
|
|
246
|
+
}
|
|
247
|
+
writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
237
251
|
// Remove old config so init creates a fresh one
|
|
238
252
|
if (existsSync(configPath)) rmSync(configPath);
|
|
239
253
|
|
|
@@ -271,7 +285,7 @@ export function doctor(projectDir, options = {}) {
|
|
|
271
285
|
}
|
|
272
286
|
|
|
273
287
|
// Check hooks
|
|
274
|
-
for (const hook of ['
|
|
288
|
+
for (const hook of ['pre-tool.mjs', 'post-tool.mjs']) {
|
|
275
289
|
if (!existsSync(join(claudeDir, 'hooks', hook))) {
|
|
276
290
|
issues.push(`Missing hook: ${hook}`);
|
|
277
291
|
fixes.push('Run `prism update` to restore missing files');
|
|
@@ -474,7 +488,7 @@ export function dryRun(projectDir, options = {}) {
|
|
|
474
488
|
|
|
475
489
|
// Hooks
|
|
476
490
|
if (hooks) {
|
|
477
|
-
const hookFiles = ['
|
|
491
|
+
const hookFiles = ['pre-tool.mjs', 'post-tool.mjs', 'user-prompt.mjs'];
|
|
478
492
|
for (const hook of hookFiles) {
|
|
479
493
|
const target = join(claudeDir, 'hooks', hook);
|
|
480
494
|
actions.push({
|
|
@@ -484,7 +498,7 @@ export function dryRun(projectDir, options = {}) {
|
|
|
484
498
|
});
|
|
485
499
|
}
|
|
486
500
|
|
|
487
|
-
const ruleFiles = ['commit-guard.mjs', 'debug-loop.mjs', 'test-tracker.mjs', 'scope-guard.mjs', 'turn-reporter.mjs'];
|
|
501
|
+
const ruleFiles = ['commit-guard.mjs', 'debug-loop.mjs', 'test-tracker.mjs', 'scope-guard.mjs', 'turn-reporter.mjs', 'alignment.mjs'];
|
|
488
502
|
for (const rule of ruleFiles) {
|
|
489
503
|
const target = join(claudeDir, 'rules', rule);
|
|
490
504
|
actions.push({
|