claude-flow-novice 2.18.22 → 2.18.23

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,103 +1,103 @@
1
- #!/bin/bash
2
-
3
- # Test script for Phase 4 Query API
4
- # This script tests the new query functionality
5
-
6
- set -euo pipefail
7
-
8
- echo "=== Testing Phase 4 Query API Implementation ==="
9
- echo
10
-
11
- # Check if the binary was built
12
- BINARY_PATH="./target/debug/local-ruvector"
13
- if [ ! -f "$BINARY_PATH" ]; then
14
- echo "❌ Binary not found at $BINARY_PATH"
15
- echo "Please build the project first with: cargo build"
16
- exit 1
17
- fi
18
-
19
- echo "✅ Binary found at $BINARY_PATH"
20
- echo
21
-
22
- # Test 1: Check help for new subcommands
23
- echo "1. Testing help for 'find' subcommand:"
24
- $BINARY_PATH find --help | head -10
25
- echo
26
-
27
- echo "2. Testing help for 'refs' subcommand:"
28
- $BINARY_PATH refs --help | head -10
29
- echo
30
-
31
- # Test 2: Create a simple test case
32
- echo "3. Creating test data..."
33
- mkdir -p test_code
34
- cat > test_code/sample.rs << 'EOF'
35
- use std::collections::HashMap;
36
-
37
- pub struct Album {
38
- pub id: u32,
39
- pub title: String,
40
- }
41
-
42
- pub fn create_album(id: u32, title: &str) -> Album {
43
- Album { id, title: title.to_string() }
44
- }
45
-
46
- pub fn print_album(album: &Album) {
47
- println!("Album {}: {}", album.id, album.title);
48
- }
49
-
50
- fn main() {
51
- let album = create_album(1, "Test Album");
52
- print_album(&album);
53
- }
54
- EOF
55
-
56
- echo "✅ Created test_code/sample.rs"
57
- echo
58
-
59
- # Test 3: Initialize and index
60
- echo "4. Initializing ruvector..."
61
- $BINARY_PATH init --force
62
- echo
63
-
64
- echo "5. Indexing test files..."
65
- $BINARY_PATH index --path test_code --types rs
66
- echo
67
-
68
- # Test 4: Test find commands
69
- echo "6. Testing find commands..."
70
-
71
- echo "6a. Find functions using type 'Album':"
72
- $BINARY_PATH find --uses-type Album --limit 10
73
- echo
74
-
75
- echo "6b. Find callers of function 'create_album':"
76
- $BINARY_PATH find --called-by create_album
77
- echo
78
-
79
- echo "6c. Find types from test_code/sample.rs used elsewhere:"
80
- $BINARY_PATH find --types-from test_code/sample.rs
81
- echo
82
-
83
- echo "6d. Find public API of test_code module:"
84
- $BINARY_PATH find --public-api test_code --format detailed
85
- echo
86
-
87
- # Test 5: Test refs command
88
- echo "7. Testing refs command for 'Album':"
89
- $BINARY_PATH refs Album --format simple
90
- echo
91
-
92
- echo "8. Testing refs command with JSON output:"
93
- $BINARY_PATH refs create_album --format json | jq . 2>/dev/null || echo "(jq not available for pretty printing)"
94
- echo
95
-
96
- # Cleanup
97
- echo "9. Cleaning up test data..."
98
- rm -rf test_code
99
- $BINARY_PATH reset --confirm 2>/dev/null || true
100
- echo "✅ Cleanup complete"
101
- echo
102
-
1
+ #!/bin/bash
2
+
3
+ # Test script for Phase 4 Query API
4
+ # This script tests the new query functionality
5
+
6
+ set -euo pipefail
7
+
8
+ echo "=== Testing Phase 4 Query API Implementation ==="
9
+ echo
10
+
11
+ # Check if the binary was built
12
+ BINARY_PATH="./target/debug/local-ruvector"
13
+ if [ ! -f "$BINARY_PATH" ]; then
14
+ echo "❌ Binary not found at $BINARY_PATH"
15
+ echo "Please build the project first with: cargo build"
16
+ exit 1
17
+ fi
18
+
19
+ echo "✅ Binary found at $BINARY_PATH"
20
+ echo
21
+
22
+ # Test 1: Check help for new subcommands
23
+ echo "1. Testing help for 'find' subcommand:"
24
+ $BINARY_PATH find --help | head -10
25
+ echo
26
+
27
+ echo "2. Testing help for 'refs' subcommand:"
28
+ $BINARY_PATH refs --help | head -10
29
+ echo
30
+
31
+ # Test 2: Create a simple test case
32
+ echo "3. Creating test data..."
33
+ mkdir -p test_code
34
+ cat > test_code/sample.rs << 'EOF'
35
+ use std::collections::HashMap;
36
+
37
+ pub struct Album {
38
+ pub id: u32,
39
+ pub title: String,
40
+ }
41
+
42
+ pub fn create_album(id: u32, title: &str) -> Album {
43
+ Album { id, title: title.to_string() }
44
+ }
45
+
46
+ pub fn print_album(album: &Album) {
47
+ println!("Album {}: {}", album.id, album.title);
48
+ }
49
+
50
+ fn main() {
51
+ let album = create_album(1, "Test Album");
52
+ print_album(&album);
53
+ }
54
+ EOF
55
+
56
+ echo "✅ Created test_code/sample.rs"
57
+ echo
58
+
59
+ # Test 3: Initialize and index
60
+ echo "4. Initializing ruvector..."
61
+ $BINARY_PATH init --force
62
+ echo
63
+
64
+ echo "5. Indexing test files..."
65
+ $BINARY_PATH index --path test_code --types rs
66
+ echo
67
+
68
+ # Test 4: Test find commands
69
+ echo "6. Testing find commands..."
70
+
71
+ echo "6a. Find functions using type 'Album':"
72
+ $BINARY_PATH find --uses-type Album --limit 10
73
+ echo
74
+
75
+ echo "6b. Find callers of function 'create_album':"
76
+ $BINARY_PATH find --called-by create_album
77
+ echo
78
+
79
+ echo "6c. Find types from test_code/sample.rs used elsewhere:"
80
+ $BINARY_PATH find --types-from test_code/sample.rs
81
+ echo
82
+
83
+ echo "6d. Find public API of test_code module:"
84
+ $BINARY_PATH find --public-api test_code --format detailed
85
+ echo
86
+
87
+ # Test 5: Test refs command
88
+ echo "7. Testing refs command for 'Album':"
89
+ $BINARY_PATH refs Album --format simple
90
+ echo
91
+
92
+ echo "8. Testing refs command with JSON output:"
93
+ $BINARY_PATH refs create_album --format json | jq . 2>/dev/null || echo "(jq not available for pretty printing)"
94
+ echo
95
+
96
+ # Cleanup
97
+ echo "9. Cleaning up test data..."
98
+ rm -rf test_code
99
+ $BINARY_PATH reset --confirm 2>/dev/null || true
100
+ echo "✅ Cleanup complete"
101
+ echo
102
+
103
103
  echo "=== Phase 4 Query API Tests Complete ==="
package/CLAUDE.md CHANGED
@@ -22,11 +22,13 @@ Purpose: concise reference for CFN agents. Focus on persona, mandatory rules, ed
22
22
  - Batch operations: one message per batch (spawns, edits, shell, todos, memory).
23
23
  - Never mix implementers and validators in one message.
24
24
  - Do not run tests inside agents; run once via coordinator/main chat, agents read results.
25
+ - **ANTI-024: Never run test commands with `run_in_background: true`** - orphaned test processes cause memory leaks. Always run tests synchronously. If tests hang, investigate; don't background them.
25
26
  - Never save to project root; use appropriate subdirectories.
26
27
  - Never hardcode secrets; always redact as `[REDACTED]`.
27
28
  - Use RuVector SQL for indexed projects (400x faster than grep); use grep only for non-indexed projects or non-code strings.
28
29
  - When monitoring, sleep-check-sleep loops.
29
30
  - All agent communication must use coordination protocols; no ad-hoc file coordination.
31
+ - Run `./.claude/cfn-scripts/check-memory.sh` periodically to detect orphaned test processes; use `--kill` to clean them up.
30
32
 
31
33
  ## 3) Cerebras MCP & Context Discovery Protocols
32
34
 
@@ -384,12 +386,38 @@ Anti-patterns: pausing to ask what next, manual Task() for CLI workflows, skippi
384
386
  - Record any skipped tests with justification and follow-up owner.
385
387
 
386
388
  ## 29) Incident Response Notes
387
- - Capture exact command, commit hash, environment variables, and logs.
388
- - Use `[REDACTED]` when logging sensitive fields.
389
- - Prefer rollback via backup scripts rather than git reset.
390
- - If orchestration deadlocks, restart orchestrator and clear stale Redis keys scoped to the task.
389
+ - Capture exact command, commit hash, environment variables, and logs.
390
+ - Use `[REDACTED]` when logging sensitive fields.
391
+ - Prefer rollback via backup scripts rather than git reset.
392
+ - If orchestration deadlocks, restart orchestrator and clear stale Redis keys scoped to the task.
391
393
  - File incidents or backlog items using `.claude/skills/cfn-backlog-management/add-backlog-item.sh` with cause and remediation.
392
394
 
395
+ ## 30) Memory Leak Prevention (ANTI-024)
396
+ Background test processes can become orphaned and accumulate memory. Use these tools to prevent and recover:
397
+
398
+ **CLI Commands (available after npm install):**
399
+ - `npx cfn-check-memory` - Report orphaned test processes
400
+ - `npx cfn-check-memory --kill` - Kill orphaned processes
401
+ - `npx cfn-check-memory --kill 500` - Kill only if total MB > 500
402
+ - `npx cfn-run-limited 6G <command>` - Run command with 6GB memory limit (systemd cgroups)
403
+
404
+ **NPM Scripts:**
405
+ - `npm run test:safe` - Full test suite with 6GB limit
406
+ - `npm run test:unit:safe` - Unit tests with 2GB limit
407
+ - `npm run check:memory` - Report orphans
408
+ - `npm run check:memory:kill` - Kill orphans
409
+
410
+ **Prevention Rules:**
411
+ - Never use `run_in_background: true` for test commands
412
+ - Jest config enforces: `maxWorkers: 4`, `forceExit: true`, `workerIdleMemoryLimit: 512MB`
413
+ - If tests hang, investigate root cause; don't background them
414
+
415
+ **Recovery:**
416
+ ```bash
417
+ npx cfn-check-memory --kill # Kill all orphaned test processes
418
+ ps aux | grep -E "(jest|vitest|node.*test)" | grep -v grep # Manual check
419
+ ```
420
+
393
421
  ---
394
422
 
395
423
  Use this trimmed guide as the default reference. For CFN-specific deep dives, defer to specialized docs or agents noted above. Keep this file lean; avoid reintroducing duplication.
package/package.json CHANGED
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "2.18.22",
3
+ "version": "2.18.23",
4
4
  "description": "Claude Flow Novice - Advanced orchestration platform for multi-agent AI workflows with CFN Loop architecture\n\nIncludes Local RuVector Accelerator and all CFN skills for complete functionality.",
5
5
  "main": "index.js",
6
6
  "type": "module",
7
7
  "bin": {
8
- "cfn-init": "./scripts/cfn-init.js"
8
+ "cfn-init": "./scripts/cfn-init.js",
9
+ "cfn-check-memory": "./.claude/cfn-scripts/check-memory.sh",
10
+ "cfn-run-limited": "./.claude/cfn-scripts/run-with-memory-limit.sh"
9
11
  },
10
12
  "scripts": {
11
13
  "test": "npm run test:unit && npm run test:integration && npm run test:e2e",
12
- "test:unit": "jest --testPathPattern=tests/unit --coverage --coverageDirectory=coverage/unit",
13
- "test:integration": "jest --testPathPattern=tests/integration --coverage --coverageDirectory=coverage/integration",
14
- "test:e2e": "jest --testPathPattern=tests/e2e --coverage --coverageDirectory=coverage/e2e",
14
+ "test:unit": "./.claude/cfn-scripts/run-with-memory-limit.sh 2G jest --testPathPattern=tests/unit --coverage --coverageDirectory=coverage/unit",
15
+ "test:integration": "./.claude/cfn-scripts/run-with-memory-limit.sh 4G jest --testPathPattern=tests/integration --coverage --coverageDirectory=coverage/integration",
16
+ "test:e2e": "./.claude/cfn-scripts/run-with-memory-limit.sh 6G jest --testPathPattern=tests/e2e --coverage --coverageDirectory=coverage/e2e",
15
17
  "test:docker": "./tests/docker-mode/run-all-implementations.sh",
16
18
  "test:cli": "./tests/cli-mode/run-all-tests.sh",
17
19
  "test:cfn-v3": "./tests/cfn-v3/test-e2e-cfn-loop.sh",
@@ -61,6 +63,8 @@
61
63
  "ruvector:local:query": "./.claude/skills/cfn-local-ruvector-accelerator/cfn-integration.sh query",
62
64
  "ruvector:local:stats": "./.claude/skills/cfn-local-ruvector-accelerator/cfn-integration.sh stats",
63
65
  "ruvector:local:build": "cd .claude/skills/cfn-local-ruvector-accelerator && cargo build --release",
66
+ "check:memory": "./.claude/cfn-scripts/check-memory.sh",
67
+ "check:memory:kill": "./.claude/cfn-scripts/check-memory.sh --kill",
64
68
  "ci:pre-commit": "npm run lint && npm run test:unit && npm run security:audit",
65
69
  "ci:full": "npm run test && npm run lint:fix && npm run security:audit && npm run performance:benchmark",
66
70
  "dev:watch": "concurrently \"npm run build:watch\" \"nodemon dist/index.js\"",