@walwal-harness/cli 2.0.0 → 2.0.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 (2) hide show
  1. package/bin/init.js +28 -4
  2. package/package.json +1 -1
package/bin/init.js CHANGED
@@ -253,19 +253,43 @@ function installSessionHook() {
253
253
  if (!settings.hooks) settings.hooks = {};
254
254
  if (!settings.hooks.SessionStart) settings.hooks.SessionStart = [];
255
255
 
256
- // Check if our hook is already installed
256
+ // Migrate any legacy flat entries (created by older walwal-harness versions)
257
+ // into the correct matcher + hooks-array shape that Claude Code expects.
257
258
  const hookCmd = 'bash scripts/harness-session-start.sh';
259
+ let migrated = false;
260
+ settings.hooks.SessionStart = settings.hooks.SessionStart
261
+ .map((entry) => {
262
+ if (entry && typeof entry === 'object' && Array.isArray(entry.hooks)) {
263
+ return entry; // already in correct shape
264
+ }
265
+ if (entry && typeof entry === 'object' && entry.type === 'command' && entry.command) {
266
+ migrated = true;
267
+ return { matcher: '', hooks: [{ type: entry.type, command: entry.command }] };
268
+ }
269
+ return entry;
270
+ })
271
+ .filter(Boolean);
272
+
273
+ // Check if our hook is already installed (inside any matcher group)
258
274
  const alreadyInstalled = settings.hooks.SessionStart.some(
259
- h => h.command && h.command.includes('harness-session-start')
275
+ (entry) =>
276
+ entry &&
277
+ Array.isArray(entry.hooks) &&
278
+ entry.hooks.some(
279
+ (h) => h && h.command && h.command.includes('harness-session-start')
280
+ )
260
281
  );
261
282
 
262
283
  if (!alreadyInstalled) {
263
284
  settings.hooks.SessionStart.push({
264
- type: 'command',
265
- command: hookCmd
285
+ matcher: '',
286
+ hooks: [{ type: 'command', command: hookCmd }]
266
287
  });
267
288
  fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
268
289
  log('SessionStart hook installed in .claude/settings.json');
290
+ } else if (migrated) {
291
+ fs.writeFileSync(settingsFile, JSON.stringify(settings, null, 2) + '\n');
292
+ log('SessionStart hook migrated to matcher + hooks-array format');
269
293
  } else {
270
294
  log('SessionStart hook already installed');
271
295
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walwal-harness/cli",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Production harness for AI agent engineering — Planner, Generator(BE/FE), Evaluator(Func/Visual) with Gotcha management",
5
5
  "bin": {
6
6
  "walwal-harness": "bin/init.js"