@claude-flow/cli 3.1.0-alpha.32 → 3.1.0-alpha.34

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.
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AAq0I1E,eAAO,MAAM,YAAY,EAAE,OAyG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/commands/hooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAiC,MAAM,aAAa,CAAC;AAizI1E,eAAO,MAAM,YAAY,EAAE,OAyG1B,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -53,12 +53,9 @@ const preEditCommand = {
53
53
  { command: 'claude-flow hooks pre-edit -f src/api.ts -o refactor', description: 'Pre-edit with operation type' }
54
54
  ],
55
55
  action: async (ctx) => {
56
- const filePath = ctx.args[0] || ctx.flags.file;
56
+ // Default file to 'unknown' for backward compatibility (env var may be empty)
57
+ const filePath = ctx.args[0] || ctx.flags.file || 'unknown';
57
58
  const operation = ctx.flags.operation || 'update';
58
- if (!filePath) {
59
- output.printError('File path is required. Use --file or -f flag.');
60
- return { success: false, exitCode: 1 };
61
- }
62
59
  output.printInfo(`Analyzing context for: ${output.highlight(filePath)}`);
63
60
  try {
64
61
  // Call MCP tool for pre-edit hook
@@ -161,16 +158,10 @@ const postEditCommand = {
161
158
  { command: 'claude-flow hooks post-edit -f src/api.ts --success false -o "Type error"', description: 'Record failed edit' }
162
159
  ],
163
160
  action: async (ctx) => {
164
- const filePath = ctx.args[0] || ctx.flags.file;
165
- const success = ctx.flags.success;
166
- if (!filePath) {
167
- output.printError('File path is required. Use --file or -f flag.');
168
- return { success: false, exitCode: 1 };
169
- }
170
- if (success === undefined) {
171
- output.printError('Success flag is required. Use --success true/false.');
172
- return { success: false, exitCode: 1 };
173
- }
161
+ // Default file to 'unknown' for backward compatibility (env var may be empty)
162
+ const filePath = ctx.args[0] || ctx.flags.file || 'unknown';
163
+ // Default success to true for backward compatibility (PostToolUse = success, PostToolUseFailure = failure)
164
+ const success = ctx.flags.success !== undefined ? ctx.flags.success : true;
174
165
  output.printInfo(`Recording outcome for: ${output.highlight(filePath)}`);
175
166
  try {
176
167
  // Parse metrics if provided
@@ -361,15 +352,12 @@ const postCommandCommand = {
361
352
  ],
362
353
  action: async (ctx) => {
363
354
  const command = ctx.args[0] || ctx.flags.command;
364
- const success = ctx.flags.success;
355
+ // Default success to true for backward compatibility
356
+ const success = ctx.flags.success !== undefined ? ctx.flags.success : true;
365
357
  if (!command) {
366
358
  output.printError('Command is required. Use --command or -c flag.');
367
359
  return { success: false, exitCode: 1 };
368
360
  }
369
- if (success === undefined) {
370
- output.printError('Success flag is required. Use --success true/false.');
371
- return { success: false, exitCode: 1 };
372
- }
373
361
  output.printInfo(`Recording command outcome: ${output.highlight(command)}`);
374
362
  try {
375
363
  // Call MCP tool for post-command hook
@@ -1327,11 +1315,8 @@ const postTaskCommand = {
1327
1315
  action: async (ctx) => {
1328
1316
  // Auto-generate task ID if not provided
1329
1317
  const taskId = ctx.flags.taskId || `task_${Date.now()}_${Math.random().toString(36).slice(2, 8)}`;
1330
- const success = ctx.flags.success;
1331
- if (success === undefined) {
1332
- output.printError('Success flag is required. Use --success true/false.');
1333
- return { success: false, exitCode: 1 };
1334
- }
1318
+ // Default success to true for backward compatibility
1319
+ const success = ctx.flags.success !== undefined ? ctx.flags.success : true;
1335
1320
  output.printInfo(`Recording outcome for task: ${output.highlight(taskId)}`);
1336
1321
  try {
1337
1322
  const result = await callMCPTool('hooks_post-task', {