Skip to content

Commit 024e179

Browse files
committed
perf(claude): optimize file suggestion script by removing jq and sort
- replace jq with sed for json parsing to reduce subprocess overhead - remove unnecessary sort -u since fzf --filter doesn't duplicate results - maintains identical functionality with lower resource usage
1 parent 38cee80 commit 024e179

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ai-stuff/claude/scripts/file-suggestion.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# Custom file suggestion script for Claude Code
33
# Uses rg + fzf for fuzzy matching and symlink support
44

5-
# Parse JSON input to get query
6-
QUERY=$(jq -r '.query // ""')
5+
# Parse JSON input to get query (avoid jq overhead)
6+
read -r INPUT
7+
QUERY=$(printf '%s' "$INPUT" | sed -n 's/.*"query" *: *"\([^"]*\)".*/\1/p')
78

89
# Use project dir from env, fallback to pwd
910
PROJECT_DIR="${CLAUDE_PROJECT_DIR:-.}"
@@ -17,4 +18,4 @@ cd "$PROJECT_DIR" || exit 1
1718

1819
# Additional paths - include even if gitignored (uncomment and customize)
1920
# [ -e .notes ] && rg --files --follow --hidden --no-ignore-vcs .notes 2>/dev/null
20-
} | sort -u | fzf --filter "$QUERY" | head -15
21+
} | fzf --filter "$QUERY" | head -15

0 commit comments

Comments
 (0)