@claude-flow/cli 3.52.0 → 3.52.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.
|
@@ -1 +1 @@
|
|
|
1
|
-
3.
|
|
1
|
+
3.42.0
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"manifest": {
|
|
3
|
-
"version": "3.52.
|
|
3
|
+
"version": "3.52.1",
|
|
4
4
|
"files": {
|
|
5
5
|
"auto-memory-hook.mjs": "c8d218526a3c34034c2a69de23f507f0eb0f70d59c16426a8edc849e6ac22529",
|
|
6
|
-
"hook-handler.cjs": "
|
|
6
|
+
"hook-handler.cjs": "1f28ed0883b1fd4d6aeb4761cf29df4d979eea1a3c3cadfd7c3ee72f53a5dd0a",
|
|
7
7
|
"intelligence.cjs": "30e42ed7ec4ca5a94ac54fdb1330d2d47ac5f3fdeeef207753574723a9e77b5c",
|
|
8
8
|
"statusline.cjs": "4a48353b4f1566fa4379b00fd0321b6676a22b6cc91fbbd8380ac5183d619468",
|
|
9
9
|
"router.cjs": "16648b3c0d73b6681ac2d8d13def6a68286c57f5a11004de5b19a0fa088c833d"
|
|
10
10
|
}
|
|
11
11
|
},
|
|
12
|
-
"signature": "
|
|
12
|
+
"signature": "5BksSAGpBjP0HfohuvxbiDG52OY99W2cxj5eXlGwuEPVHUSJvfxgoEwlDrPOV3UGjiibULl4XbvfUHiB+iflDw==",
|
|
13
13
|
"algorithm": "ed25519"
|
|
14
14
|
}
|
|
@@ -388,13 +388,14 @@ const handlers = {
|
|
|
388
388
|
if (router && router.routeTask) {
|
|
389
389
|
const result = router.routeTask(prompt);
|
|
390
390
|
// Format output for Claude Code hook consumption — real data only
|
|
391
|
+
const row = (text) => `| ${text.substring(0, 60).padEnd(60)} |`;
|
|
391
392
|
const output = [
|
|
392
393
|
`[INFO] Routing task: ${prompt.substring(0, 80) || '(no prompt)'}`,
|
|
393
394
|
'',
|
|
394
395
|
'+------------------- Primary Recommendation -------------------+',
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
396
|
+
row(`Agent: ${result.agent}`),
|
|
397
|
+
row(`Confidence: ${(result.confidence * 100).toFixed(1)}%`),
|
|
398
|
+
row(`Reason: ${result.reason || ''}`),
|
|
398
399
|
'+--------------------------------------------------------------+',
|
|
399
400
|
];
|
|
400
401
|
console.log(output.join('\n'));
|
|
@@ -462,8 +463,77 @@ const handlers = {
|
|
|
462
463
|
// (silently exiting 0 and letting the dangerous command through).
|
|
463
464
|
const cmd = String(hookInput.command || toolInput.command || prompt || '').toLowerCase();
|
|
464
465
|
const dangerous = ['rm -rf /', 'format c:', 'del /s /q c:\\', ':(){:|:&};:'];
|
|
466
|
+
// Join literal quote fragments and normalize root paths without shell evaluation.
|
|
467
|
+
function hasRootDelete(command, depth = 0) {
|
|
468
|
+
let word = '', quote = '', started = false, redirect = false
|
|
469
|
+
let inRm = false, optionsEnded = false, recursive = false, force = false, root = false
|
|
470
|
+
const isRoot = (operand) => {
|
|
471
|
+
if (!operand.startsWith('/')) return false
|
|
472
|
+
const parts = []
|
|
473
|
+
for (const part of operand.split('/')) {
|
|
474
|
+
if (!part || part === '.') continue
|
|
475
|
+
if (part === '..') parts.pop()
|
|
476
|
+
else parts.push(part)
|
|
477
|
+
}
|
|
478
|
+
return parts.length === 0 || /[*?\[]/.test(parts[0])
|
|
479
|
+
}
|
|
480
|
+
const finishWord = () => {
|
|
481
|
+
if (!started) return false
|
|
482
|
+
// Literal shell strings (e.g. sh -c 'rm -rf /') also carried the old guard.
|
|
483
|
+
// Bound rescanning to four levels; beyond that retain its conservative check.
|
|
484
|
+
if (word.includes('rm') && /[\s;&|()]/.test(word)) {
|
|
485
|
+
if (depth < 4 ? hasRootDelete(word, depth + 1) : word.includes('rm -rf /')) return true
|
|
486
|
+
}
|
|
487
|
+
if (!inRm) inRm = word === 'rm' || word.endsWith('/rm')
|
|
488
|
+
else if (!optionsEnded && word === '--') optionsEnded = true
|
|
489
|
+
else if (!optionsEnded && word.startsWith('-')) {
|
|
490
|
+
recursive = recursive || word === '--recursive' || /^-[a-z]*r[a-z]*$/.test(word)
|
|
491
|
+
force = force || word === '--force' || /^-[a-z]*f[a-z]*$/.test(word)
|
|
492
|
+
} else root = root || isRoot(word)
|
|
493
|
+
word = ''; started = false
|
|
494
|
+
return inRm && recursive && force && root
|
|
495
|
+
}
|
|
496
|
+
const finishCommand = () => {
|
|
497
|
+
const denied = inRm && recursive && force && root
|
|
498
|
+
inRm = optionsEnded = recursive = force = root = false
|
|
499
|
+
return denied
|
|
500
|
+
}
|
|
501
|
+
for (let i = 0; i < command.length; i++) {
|
|
502
|
+
const char = command[i]
|
|
503
|
+
const redirectionAmpersand = char === '&' && (redirect || command[i + 1] === '>')
|
|
504
|
+
redirect = false
|
|
505
|
+
if (quote) {
|
|
506
|
+
if (char === quote) quote = ''
|
|
507
|
+
else if (quote === '"' && char === '\\' && i + 1 < command.length &&
|
|
508
|
+
(command[i + 1] === '"' || command[i + 1] === '\\' || command[i + 1] === '$' ||
|
|
509
|
+
command.charCodeAt(i + 1) === 96 || command[i + 1] === '\n')) {
|
|
510
|
+
const next = command[++i]
|
|
511
|
+
if (next !== '\n') word += next
|
|
512
|
+
} else word += char
|
|
513
|
+
continue
|
|
514
|
+
}
|
|
515
|
+
if (char === '\\' && i + 1 < command.length) {
|
|
516
|
+
const next = command[++i]
|
|
517
|
+
if (next !== '\n') { word += next; started = true }
|
|
518
|
+
} else if (char === '"' || char === "'") {
|
|
519
|
+
quote = char; started = true
|
|
520
|
+
} else if (char === '#' && !started) {
|
|
521
|
+
while (i < command.length && command[i] !== '\n') i++
|
|
522
|
+
if (finishCommand()) return true
|
|
523
|
+
} else if (char === ' ' || char === '\t' || char === '\r' || char === '\n' ||
|
|
524
|
+
';|&()<>'.includes(char)) {
|
|
525
|
+
if (finishWord()) return true
|
|
526
|
+
// Redirections separate words, but later operands still belong to rm.
|
|
527
|
+
redirect = char === '<' || char === '>'
|
|
528
|
+
if (!redirectionAmpersand && (char === '\n' || ';|&()'.includes(char)) && finishCommand()) return true
|
|
529
|
+
} else {
|
|
530
|
+
word += char; started = true
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
return finishWord() || finishCommand()
|
|
534
|
+
}
|
|
465
535
|
for (const d of dangerous) {
|
|
466
|
-
if (cmd.includes(d)) {
|
|
536
|
+
if (d === 'rm -rf /' ? hasRootDelete(cmd) : cmd.includes(d)) {
|
|
467
537
|
console.error(`[BLOCKED] Dangerous command detected: ${d}`);
|
|
468
538
|
// Claude Code PreToolUse: exit 2 blocks execution; exit 1 is non-blocking.
|
|
469
539
|
process.exit(2);
|
|
File without changes
|
package/catalog-manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claude-flow/cli",
|
|
3
|
-
"version": "3.52.
|
|
3
|
+
"version": "3.52.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Ruflo CLI - Enterprise AI agent orchestration with 60+ specialized agents, swarm coordination, MCP server, self-learning hooks, and vector memory for Claude Code",
|
|
6
6
|
"main": "dist/src/index.js",
|