claude-flow-novice 2.18.22 → 2.18.24
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/.claude/CLAUDE.md +17 -0
- package/.claude/cfn-scripts/check-memory.sh +150 -0
- package/.claude/cfn-scripts/run-with-memory-limit.sh +91 -0
- package/.claude/commands/cfn-loop/cfn-loop-cli.md +9 -0
- package/.claude/commands/cfn-loop-task.md +11 -0
- package/.claude/commands/cfn-ruvector/cfn-codebase-reindex.md +23 -4
- package/.claude/commands/cfn-ruvector/cfn-codebase-search.md +10 -2
- package/.claude/commands/cfn-ruvector/cfn-detect-stale-docs.md +22 -4
- package/.claude/hooks/README.md +148 -148
- package/.claude/hooks/cfn-bash-search-hook.sh +87 -0
- package/.claude/hooks/cfn-smart-search-hook.sh +127 -0
- package/.claude/hooks/deprecated/cfn-SessionStart-cfn-load-openai-key.sh +48 -0
- package/.claude/hooks/post-commit-codebase-index +79 -45
- package/.claude/settings.json +20 -11
- package/.claude/skills/CLAUDE.md +70 -0
- package/.claude/skills/cfn-edit-safety/lib/hooks/security-scanner.sh +1 -0
- package/.claude/skills/cfn-local-ruvector-accelerator/SKILL.md +37 -21
- package/.claude/skills/cfn-local-ruvector-accelerator/cfn-integration.sh +47 -6
- package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/index.rs +2 -1
- package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/init.rs +3 -3
- package/.claude/skills/cfn-local-ruvector-accelerator/src/cli/query.rs +1 -1
- package/.claude/skills/cfn-local-ruvector-accelerator/src/lib.rs +1 -0
- package/.claude/skills/cfn-local-ruvector-accelerator/src/paths.rs +4 -2
- package/.claude/skills/cfn-local-ruvector-accelerator/src/search_engine.rs +11 -0
- package/.claude/skills/cfn-local-ruvector-accelerator/test_query_api.sh +102 -102
- package/CLAUDE.md +63 -373
- package/docs/CFN_LOOP_CLI_MODE.md +134 -0
- package/package.json +9 -5
- package/scripts/cfn-init.js +8 -2
- package/scripts/organize-root-files.sh +340 -340
- package/scripts/postinstall.js +120 -3
- package/test-epic-creator-security.sh +202 -202
- package/.claude/hooks/SessionStart:cfn-build-ruvector.sh +0 -28
- package/.claude/hooks/SessionStart:cfn-load-openai-key.sh +0 -35
- /package/.claude/hooks/{SessionStart-cfn-build-ruvector.sh → cfn-SessionStart-cfn-build-ruvector.sh} +0 -0
- /package/.claude/hooks/{cfn-load-cerebras-env.sh → deprecated/cfn-load-cerebras-env.sh} +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# CFN Coordination and Namespace Guide
|
|
2
|
+
|
|
3
|
+
## Coordination Patterns and Namespace Isolation
|
|
4
|
+
|
|
5
|
+
- Coordination patterns: see `.claude/skills/cfn-coordination/SKILL.md` (chain, broadcast, mesh, consensus collection).
|
|
6
|
+
- Namespace structure: agents `.claude/agents/cfn-dev-team/`; skills `.claude/skills/cfn-*/`; hooks `.claude/hooks/cfn-*`; commands `.claude/commands/cfn/`.
|
|
7
|
+
- Enhanced orchestrator v3.0: `./.claude/skills/cfn-loop-orchestration/orchestrate.sh`
|
|
8
|
+
- Orchestration flow: Loop 3 executes and tests -> gate check -> Loop 2 validators -> Product Owner decision (PROCEED/ITERATE/ABORT) -> iterate or finish.
|
|
9
|
+
- Task mode agents: return output directly; no Redis signaling.
|
|
10
|
+
|
|
11
|
+
### Coordination Anti-Patterns (avoid)
|
|
12
|
+
|
|
13
|
+
- Skipping gate check before spawning Loop 2.
|
|
14
|
+
- Validators reviewing without tests/logs.
|
|
15
|
+
- Product Owner decision without deliverable paths.
|
|
16
|
+
- Mixing service and container names inside Docker networks.
|
|
17
|
+
- Manual cleanup instead of orchestrator controls.
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Memory Leak Prevention Script (ANTI-024)
|
|
3
|
+
# Detects and kills orphaned test processes (jest, vitest, node test runners)
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# ./scripts/check-memory.sh # Report only
|
|
7
|
+
# ./scripts/check-memory.sh --kill # Kill orphans
|
|
8
|
+
# ./scripts/check-memory.sh --kill 500 # Kill if total MB > 500
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
KILL_MODE=false
|
|
13
|
+
THRESHOLD_MB=0
|
|
14
|
+
|
|
15
|
+
# Parse arguments
|
|
16
|
+
while [[ $# -gt 0 ]]; do
|
|
17
|
+
case "$1" in
|
|
18
|
+
--kill)
|
|
19
|
+
KILL_MODE=true
|
|
20
|
+
shift
|
|
21
|
+
if [[ "${1:-}" =~ ^[0-9]+$ ]]; then
|
|
22
|
+
THRESHOLD_MB="$1"
|
|
23
|
+
shift
|
|
24
|
+
fi
|
|
25
|
+
;;
|
|
26
|
+
--help|-h)
|
|
27
|
+
echo "Usage: $0 [--kill [threshold_mb]]"
|
|
28
|
+
echo " --kill Kill orphaned test processes"
|
|
29
|
+
echo " --kill 500 Only kill if total memory > 500MB"
|
|
30
|
+
exit 0
|
|
31
|
+
;;
|
|
32
|
+
*)
|
|
33
|
+
shift
|
|
34
|
+
;;
|
|
35
|
+
esac
|
|
36
|
+
done
|
|
37
|
+
|
|
38
|
+
# Find test-related processes
|
|
39
|
+
find_test_processes() {
|
|
40
|
+
# Jest, Vitest, and generic node test runners
|
|
41
|
+
pgrep -af "(jest|vitest|node.*test)" 2>/dev/null || true
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
# Calculate memory usage of test processes (in MB)
|
|
45
|
+
get_test_memory_mb() {
|
|
46
|
+
ps aux 2>/dev/null | grep -E "(jest|vitest|node.*test)" | grep -v grep | \
|
|
47
|
+
awk '{sum+=$6} END {print int(sum/1024)}' || echo "0"
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
# Find orphaned processes (parent PID = 1 or parent dead)
|
|
51
|
+
find_orphans() {
|
|
52
|
+
local orphans=()
|
|
53
|
+
|
|
54
|
+
while IFS= read -r line; do
|
|
55
|
+
local pid=$(echo "$line" | awk '{print $1}')
|
|
56
|
+
if [[ -z "$pid" ]]; then continue; fi
|
|
57
|
+
|
|
58
|
+
local ppid=$(ps -o ppid= -p "$pid" 2>/dev/null | tr -d ' ' || echo "")
|
|
59
|
+
if [[ -z "$ppid" ]]; then continue; fi
|
|
60
|
+
|
|
61
|
+
# Check if parent is init (1) or parent process doesn't exist
|
|
62
|
+
if [[ "$ppid" == "1" ]] || ! ps -p "$ppid" > /dev/null 2>&1; then
|
|
63
|
+
orphans+=("$pid")
|
|
64
|
+
fi
|
|
65
|
+
done < <(find_test_processes)
|
|
66
|
+
|
|
67
|
+
echo "${orphans[@]:-}"
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
# Kill processes gracefully
|
|
71
|
+
kill_processes() {
|
|
72
|
+
local pids=("$@")
|
|
73
|
+
|
|
74
|
+
for pid in "${pids[@]}"; do
|
|
75
|
+
if [[ -z "$pid" ]]; then continue; fi
|
|
76
|
+
|
|
77
|
+
echo "Killing orphaned process: $pid"
|
|
78
|
+
|
|
79
|
+
# Try SIGTERM first
|
|
80
|
+
kill -TERM "$pid" 2>/dev/null || continue
|
|
81
|
+
|
|
82
|
+
# Wait up to 5 seconds for graceful shutdown
|
|
83
|
+
local count=0
|
|
84
|
+
while ps -p "$pid" > /dev/null 2>&1 && [[ $count -lt 5 ]]; do
|
|
85
|
+
sleep 1
|
|
86
|
+
((count++))
|
|
87
|
+
done
|
|
88
|
+
|
|
89
|
+
# Force kill if still running
|
|
90
|
+
if ps -p "$pid" > /dev/null 2>&1; then
|
|
91
|
+
echo "Force killing: $pid"
|
|
92
|
+
kill -KILL "$pid" 2>/dev/null || true
|
|
93
|
+
fi
|
|
94
|
+
done
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Main
|
|
98
|
+
main() {
|
|
99
|
+
local total_mb=$(get_test_memory_mb)
|
|
100
|
+
local orphans=($(find_orphans))
|
|
101
|
+
local orphan_count=${#orphans[@]}
|
|
102
|
+
|
|
103
|
+
echo "=== Memory Check (ANTI-024) ==="
|
|
104
|
+
echo "Test process memory: ${total_mb}MB"
|
|
105
|
+
echo "Orphaned processes: ${orphan_count}"
|
|
106
|
+
|
|
107
|
+
if [[ $orphan_count -gt 0 ]]; then
|
|
108
|
+
echo ""
|
|
109
|
+
echo "Orphan PIDs: ${orphans[*]}"
|
|
110
|
+
|
|
111
|
+
if $KILL_MODE; then
|
|
112
|
+
if [[ $THRESHOLD_MB -gt 0 ]] && [[ $total_mb -lt $THRESHOLD_MB ]]; then
|
|
113
|
+
echo "Memory ($total_mb MB) below threshold ($THRESHOLD_MB MB), skipping kill"
|
|
114
|
+
exit 0
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
echo ""
|
|
118
|
+
echo "Killing orphaned processes..."
|
|
119
|
+
kill_processes "${orphans[@]}"
|
|
120
|
+
|
|
121
|
+
# Verify cleanup
|
|
122
|
+
sleep 1
|
|
123
|
+
local remaining=$(find_orphans | wc -w)
|
|
124
|
+
echo "Remaining orphans: $remaining"
|
|
125
|
+
|
|
126
|
+
if [[ $remaining -gt 0 ]]; then
|
|
127
|
+
echo "WARNING: Some processes could not be killed"
|
|
128
|
+
exit 1
|
|
129
|
+
fi
|
|
130
|
+
else
|
|
131
|
+
echo ""
|
|
132
|
+
echo "Run with --kill to terminate orphaned processes"
|
|
133
|
+
fi
|
|
134
|
+
else
|
|
135
|
+
echo "No orphaned test processes found"
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
# Report current test processes
|
|
139
|
+
local running=$(find_test_processes | wc -l)
|
|
140
|
+
if [[ $running -gt 0 ]]; then
|
|
141
|
+
echo ""
|
|
142
|
+
echo "Running test processes: $running"
|
|
143
|
+
find_test_processes | head -5
|
|
144
|
+
if [[ $running -gt 5 ]]; then
|
|
145
|
+
echo "... and $((running - 5)) more"
|
|
146
|
+
fi
|
|
147
|
+
fi
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
main "$@"
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Run command with memory limit enforcement (ANTI-024)
|
|
3
|
+
# Uses systemd-run when available, falls back to ulimit
|
|
4
|
+
#
|
|
5
|
+
# Usage:
|
|
6
|
+
# ./scripts/run-with-memory-limit.sh <memory_limit> <command...>
|
|
7
|
+
# ./scripts/run-with-memory-limit.sh 6G npm test
|
|
8
|
+
# ./scripts/run-with-memory-limit.sh 2G npm run test:unit
|
|
9
|
+
|
|
10
|
+
set -euo pipefail
|
|
11
|
+
|
|
12
|
+
MEMORY_LIMIT="${1:-6G}"
|
|
13
|
+
shift
|
|
14
|
+
|
|
15
|
+
if [[ $# -eq 0 ]]; then
|
|
16
|
+
echo "Usage: $0 <memory_limit> <command...>"
|
|
17
|
+
echo "Example: $0 6G npm test"
|
|
18
|
+
exit 1
|
|
19
|
+
fi
|
|
20
|
+
|
|
21
|
+
# Parse memory limit to bytes for ulimit fallback
|
|
22
|
+
parse_memory_to_kb() {
|
|
23
|
+
local mem="$1"
|
|
24
|
+
local num="${mem%[GgMmKk]*}"
|
|
25
|
+
local unit="${mem: -1}"
|
|
26
|
+
|
|
27
|
+
case "$unit" in
|
|
28
|
+
G|g) echo $((num * 1024 * 1024)) ;;
|
|
29
|
+
M|m) echo $((num * 1024)) ;;
|
|
30
|
+
K|k) echo "$num" ;;
|
|
31
|
+
*) echo "$mem" ;; # Assume KB if no unit
|
|
32
|
+
esac
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
# Check systemd availability
|
|
36
|
+
use_systemd() {
|
|
37
|
+
# Check if systemd-run exists and user session is available
|
|
38
|
+
command -v systemd-run >/dev/null 2>&1 && \
|
|
39
|
+
systemctl --user is-system-running >/dev/null 2>&1
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Check if running in WSL (systemd support varies)
|
|
43
|
+
is_wsl() {
|
|
44
|
+
grep -qi microsoft /proc/version 2>/dev/null
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
echo "=== Memory-Limited Execution (ANTI-024) ==="
|
|
48
|
+
echo "Limit: $MEMORY_LIMIT"
|
|
49
|
+
echo "Command: $*"
|
|
50
|
+
echo ""
|
|
51
|
+
|
|
52
|
+
if use_systemd; then
|
|
53
|
+
echo "Using: systemd-run (cgroups v2)"
|
|
54
|
+
echo ""
|
|
55
|
+
|
|
56
|
+
# Run with systemd memory limit
|
|
57
|
+
# --user: run as current user
|
|
58
|
+
# --scope: transient scope (not a service)
|
|
59
|
+
# -p MemoryMax: hard memory limit
|
|
60
|
+
# -p MemorySwapMax=0: disable swap so OOM killer triggers at limit
|
|
61
|
+
exec systemd-run --user --scope \
|
|
62
|
+
-p MemoryMax="$MEMORY_LIMIT" \
|
|
63
|
+
-p MemorySwapMax=0 \
|
|
64
|
+
--description="CFN test run with memory limit" \
|
|
65
|
+
"$@"
|
|
66
|
+
|
|
67
|
+
elif is_wsl; then
|
|
68
|
+
# WSL may not have full systemd support
|
|
69
|
+
echo "Using: ulimit (WSL detected, systemd unavailable)"
|
|
70
|
+
echo ""
|
|
71
|
+
|
|
72
|
+
MEM_KB=$(parse_memory_to_kb "$MEMORY_LIMIT")
|
|
73
|
+
|
|
74
|
+
# Set virtual memory limit (soft enforcement)
|
|
75
|
+
ulimit -v "$MEM_KB" 2>/dev/null || true
|
|
76
|
+
|
|
77
|
+
# Also set resident set size limit
|
|
78
|
+
ulimit -m "$MEM_KB" 2>/dev/null || true
|
|
79
|
+
|
|
80
|
+
exec "$@"
|
|
81
|
+
|
|
82
|
+
else
|
|
83
|
+
echo "Using: ulimit (systemd unavailable)"
|
|
84
|
+
echo ""
|
|
85
|
+
|
|
86
|
+
MEM_KB=$(parse_memory_to_kb "$MEMORY_LIMIT")
|
|
87
|
+
ulimit -v "$MEM_KB" 2>/dev/null || true
|
|
88
|
+
ulimit -m "$MEM_KB" 2>/dev/null || true
|
|
89
|
+
|
|
90
|
+
exec "$@"
|
|
91
|
+
fi
|
|
@@ -265,6 +265,15 @@ The orchestrator returns structured results:
|
|
|
265
265
|
}
|
|
266
266
|
```
|
|
267
267
|
|
|
268
|
+
## Validation Flow Summary
|
|
269
|
+
|
|
270
|
+
1. **Loop 3 Gate:** Test pass rate must meet mode threshold before validators start
|
|
271
|
+
2. **Loop 2 Validators:** Need access to Loop 3 outputs, tests, and logs
|
|
272
|
+
3. **Product Owner Decision:** Parsed via `.claude/skills/product-owner-decision/execute-decision.sh`
|
|
273
|
+
4. **Gate Failure:** Iterate Loop 3 only
|
|
274
|
+
5. **Gate Pass:** Proceed to validators
|
|
275
|
+
6. **Decision Outcomes:** PROCEED (done), ITERATE (repeat), ABORT (stop with error)
|
|
276
|
+
|
|
268
277
|
This simplified architecture provides:
|
|
269
278
|
- ✅ **Zero external dependencies** - runs anywhere Node.js is available
|
|
270
279
|
- ✅ **Fast execution** - parallel decomposition and implementation
|
|
@@ -249,6 +249,17 @@ fi
|
|
|
249
249
|
|
|
250
250
|
---
|
|
251
251
|
|
|
252
|
+
## Validation Flow Summary
|
|
253
|
+
|
|
254
|
+
1. **Loop 3 Gate:** Test pass rate must meet mode threshold before validators start
|
|
255
|
+
2. **Loop 2 Validators:** Need access to Loop 3 outputs, tests, and logs
|
|
256
|
+
3. **Product Owner Decision:** Parsed via `.claude/skills/product-owner-decision/execute-decision.sh`
|
|
257
|
+
4. **Gate Failure:** Iterate Loop 3 only
|
|
258
|
+
5. **Gate Pass:** Proceed to validators
|
|
259
|
+
6. **Decision Outcomes:** PROCEED (done), ITERATE (repeat), ABORT (stop with error)
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
252
263
|
## Related Documentation
|
|
253
264
|
|
|
254
265
|
- **Full Task Mode Guide**: `.claude/commands/cfn-loop/cfn-loop-task.md`
|
|
@@ -17,20 +17,39 @@ Add `--force` flag for complete reindex:
|
|
|
17
17
|
- Major restructuring
|
|
18
18
|
- Index issues
|
|
19
19
|
|
|
20
|
-
**
|
|
21
|
-
- OPENAI_API_KEY must be set: `export OPENAI_API_KEY="sk-..."`
|
|
20
|
+
**Log file:** `/tmp/ruvector-index.log` - tail this for progress monitoring.
|
|
22
21
|
|
|
23
22
|
---
|
|
24
23
|
|
|
25
24
|
Execute reindex:
|
|
26
25
|
|
|
27
26
|
```bash
|
|
27
|
+
# --- FAIL-FAST: Validate OpenAI API Key ---
|
|
28
|
+
# Always load from .env if current key is invalid (placeholder or missing)
|
|
29
|
+
if [[ ! "$OPENAI_API_KEY" =~ ^sk- ]] && [[ -f ".env" ]]; then
|
|
30
|
+
export OPENAI_API_KEY=$(grep "^OPENAI_API_KEY=" .env | cut -d'=' -f2- | tr -d '"' | tr -d "'")
|
|
31
|
+
fi
|
|
32
|
+
|
|
33
|
+
# Final validation
|
|
34
|
+
if [[ ! "$OPENAI_API_KEY" =~ ^sk- ]]; then
|
|
35
|
+
echo "❌ FATAL: Valid OPENAI_API_KEY not found." >&2
|
|
36
|
+
echo " Add to .env: OPENAI_API_KEY=sk-..." >&2
|
|
37
|
+
exit 1
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
echo "✅ OpenAI key: ${OPENAI_API_KEY:0:12}..."
|
|
41
|
+
|
|
42
|
+
# --- Setup ---
|
|
28
43
|
RUVECTOR_BIN="${HOME}/.local/bin/local-ruvector"
|
|
29
44
|
[ ! -f "$RUVECTOR_BIN" ] && RUVECTOR_BIN="./.claude/skills/cfn-local-ruvector-accelerator/target/release/local-ruvector"
|
|
45
|
+
LOG_FILE="/tmp/ruvector-index.log"
|
|
46
|
+
|
|
47
|
+
echo "📝 Logging to: $LOG_FILE"
|
|
48
|
+
echo " Monitor with: tail -f $LOG_FILE"
|
|
30
49
|
|
|
31
50
|
# Incremental (default - only changed files)
|
|
32
|
-
"$RUVECTOR_BIN" index --path . --types rs,ts,js,py,sh,md
|
|
51
|
+
"$RUVECTOR_BIN" index --path . --types rs,ts,js,py,sh,md 2>&1 | tee "$LOG_FILE"
|
|
33
52
|
|
|
34
53
|
# Full rebuild (when needed)
|
|
35
|
-
# "$RUVECTOR_BIN" index --path . --types rs,ts,js,py,sh,md --force
|
|
54
|
+
# "$RUVECTOR_BIN" index --path . --types rs,ts,js,py,sh,md --force 2>&1 | tee "$LOG_FILE"
|
|
36
55
|
```
|
|
@@ -19,7 +19,7 @@ Search your indexed codebase using RuVector. Uses SQLite index for fast lookups.
|
|
|
19
19
|
- `/cfn-ruvector:cfn-codebase-search database migration`
|
|
20
20
|
|
|
21
21
|
**Prerequisites:**
|
|
22
|
-
- Codebase must be indexed:
|
|
22
|
+
- Codebase must be indexed: `/cfn-codebase-reindex`
|
|
23
23
|
- OPENAI_API_KEY must be set for indexing
|
|
24
24
|
|
|
25
25
|
---
|
|
@@ -27,7 +27,15 @@ Search your indexed codebase using RuVector. Uses SQLite index for fast lookups.
|
|
|
27
27
|
Execute the search:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
+
# Load from .env if current key is invalid
|
|
31
|
+
if [[ ! "$OPENAI_API_KEY" =~ ^sk- ]] && [[ -f ".env" ]]; then
|
|
32
|
+
export OPENAI_API_KEY=$(grep "^OPENAI_API_KEY=" .env | cut -d'=' -f2- | tr -d '"' | tr -d "'")
|
|
33
|
+
fi
|
|
34
|
+
[[ ! "$OPENAI_API_KEY" =~ ^sk- ]] && { echo "❌ OPENAI_API_KEY invalid. Add to .env" >&2; exit 1; }
|
|
35
|
+
|
|
30
36
|
RUVECTOR_BIN="${HOME}/.local/bin/local-ruvector"
|
|
31
37
|
[ ! -f "$RUVECTOR_BIN" ] && RUVECTOR_BIN="./.claude/skills/cfn-local-ruvector-accelerator/target/release/local-ruvector"
|
|
32
|
-
|
|
38
|
+
|
|
39
|
+
# Use threshold 0.1 for better results (default 0.3 is too strict)
|
|
40
|
+
"$RUVECTOR_BIN" query "{{query}}" --max-results {{#if top}}{{top}}{{else}}10{{/if}} --threshold 0.1
|
|
33
41
|
```
|
|
@@ -29,13 +29,31 @@ Analyzes all `.md` files in the codebase to detect legacy/outdated documentation
|
|
|
29
29
|
- Score 2-4: **POSSIBLY STALE** (minor issues)
|
|
30
30
|
|
|
31
31
|
**Prerequisites:**
|
|
32
|
-
- Codebase must be indexed first (`/codebase-reindex`)
|
|
33
|
-
-
|
|
32
|
+
- Codebase must be indexed first (`/cfn-codebase-reindex`)
|
|
33
|
+
- OPENAI_API_KEY must be set (for semantic search)
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
**Note:** This is a planned feature. Currently use these manual queries:
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
|
|
40
|
+
# Find docs older than 90 days with no recent code references
|
|
41
|
+
sqlite3 ~/.local/share/ruvector/index_v2.db "
|
|
42
|
+
SELECT e.file_path, e.name,
|
|
43
|
+
datetime(e.created_at, 'unixepoch') as indexed_at
|
|
44
|
+
FROM entities e
|
|
45
|
+
WHERE e.file_path LIKE '%.md'
|
|
46
|
+
AND e.project_root LIKE '%$(pwd)%'
|
|
47
|
+
AND (e.name LIKE '%legacy%' OR e.name LIKE '%deprecated%' OR e.name LIKE '%old%')
|
|
48
|
+
LIMIT 20;"
|
|
49
|
+
|
|
50
|
+
# Find orphan docs (no references)
|
|
51
|
+
sqlite3 ~/.local/share/ruvector/index_v2.db "
|
|
52
|
+
SELECT DISTINCT e.file_path
|
|
53
|
+
FROM entities e
|
|
54
|
+
LEFT JOIN refs r ON e.id = r.source_entity_id OR e.id = r.target_entity_id
|
|
55
|
+
WHERE e.file_path LIKE '%.md'
|
|
56
|
+
AND e.project_root LIKE '%$(pwd)%'
|
|
57
|
+
AND r.id IS NULL
|
|
58
|
+
LIMIT 20;"
|
|
41
59
|
```
|