nogrep 1.0.7 → 1.0.8

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/hooks/hooks.json CHANGED
@@ -9,6 +9,24 @@
9
9
  "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use.sh"
10
10
  }
11
11
  ]
12
+ },
13
+ {
14
+ "matcher": "Grep",
15
+ "hooks": [
16
+ {
17
+ "type": "command",
18
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use-grep.sh"
19
+ }
20
+ ]
21
+ },
22
+ {
23
+ "matcher": "Glob",
24
+ "hooks": [
25
+ {
26
+ "type": "command",
27
+ "command": "${CLAUDE_PLUGIN_ROOT}/hooks/pre-tool-use-glob.sh"
28
+ }
29
+ ]
12
30
  }
13
31
  ],
14
32
  "SessionStart": [
@@ -0,0 +1,40 @@
1
+ #!/bin/bash
2
+ INPUT=$(cat)
3
+
4
+ # Check nogrep is enabled
5
+ ENABLED=$(cat .claude/settings.json 2>/dev/null | jq -r '.nogrep.enabled // false')
6
+ LOCAL_ENABLED=$(cat .claude/settings.local.json 2>/dev/null | jq -r '.nogrep.enabled // empty')
7
+ [ -n "$LOCAL_ENABLED" ] && ENABLED="$LOCAL_ENABLED"
8
+ [ "$ENABLED" != "true" ] && exit 0
9
+
10
+ # Check index exists
11
+ [ ! -f ".nogrep/_index.json" ] && exit 0
12
+
13
+ # Extract the glob pattern from Glob tool input
14
+ PATTERN=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty')
15
+ [ -z "$PATTERN" ] && exit 0
16
+
17
+ # Extract meaningful keywords from glob pattern
18
+ # e.g. "**/*auth*.ts" -> "auth", "src/**/guard*" -> "guard"
19
+ KEYWORDS=$(echo "$PATTERN" \
20
+ | sed -E 's/\*\*//g' \
21
+ | sed -E 's/\*//g' \
22
+ | sed -E 's/[{}(),]/ /g' \
23
+ | sed -E 's#/+# #g' \
24
+ | sed -E 's/\.[a-z]+$//g' \
25
+ | tr -s ' ' \
26
+ | xargs)
27
+
28
+ [ -z "$KEYWORDS" ] && exit 0
29
+
30
+ # Query nogrep
31
+ SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT}/dist"
32
+ RESULT=$(node "$SCRIPT_DIR/query.js" --keywords "$KEYWORDS" --format summary --limit 3 2>/dev/null)
33
+
34
+ if [ -n "$RESULT" ]; then
35
+ jq -n \
36
+ --arg ctx "nogrep — these context files may help narrow your search:\n\n$RESULT\n\nCheck these files for relevant paths before globbing broadly." \
37
+ '{ additionalContext: $ctx }'
38
+ fi
39
+
40
+ exit 0
@@ -0,0 +1,35 @@
1
+ #!/bin/bash
2
+ INPUT=$(cat)
3
+
4
+ # Check nogrep is enabled
5
+ ENABLED=$(cat .claude/settings.json 2>/dev/null | jq -r '.nogrep.enabled // false')
6
+ LOCAL_ENABLED=$(cat .claude/settings.local.json 2>/dev/null | jq -r '.nogrep.enabled // empty')
7
+ [ -n "$LOCAL_ENABLED" ] && ENABLED="$LOCAL_ENABLED"
8
+ [ "$ENABLED" != "true" ] && exit 0
9
+
10
+ # Check index exists
11
+ [ ! -f ".nogrep/_index.json" ] && exit 0
12
+
13
+ # Extract the search pattern from Grep tool input
14
+ PATTERN=$(echo "$INPUT" | jq -r '.tool_input.pattern // empty')
15
+ [ -z "$PATTERN" ] && exit 0
16
+
17
+ # Strip regex syntax to get searchable keywords
18
+ KEYWORDS=$(echo "$PATTERN" \
19
+ | sed -E 's/[\\^$.*+?{}()\[\]|]/ /g' \
20
+ | tr -s ' ' \
21
+ | xargs)
22
+
23
+ [ -z "$KEYWORDS" ] && exit 0
24
+
25
+ # Query nogrep
26
+ SCRIPT_DIR="${CLAUDE_PLUGIN_ROOT}/dist"
27
+ RESULT=$(node "$SCRIPT_DIR/query.js" --keywords "$KEYWORDS" --format summary --limit 3 2>/dev/null)
28
+
29
+ if [ -n "$RESULT" ]; then
30
+ jq -n \
31
+ --arg ctx "nogrep — read these context files before searching:\n\n$RESULT\n\nThese files tell you exactly where to look. Only proceed with the grep if they don't answer your question." \
32
+ '{ additionalContext: $ctx }'
33
+ fi
34
+
35
+ exit 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nogrep",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "Navigable codebase index for Claude Code — stop grepping, start navigating",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  <!-- nogrep -->
2
2
  ## Code Navigation
3
3
 
4
- This project uses [nogrep](https://github.com/techtulp/nogrep).
4
+ This project uses [nogrep](https://github.com/alirezanasseh/nogrep).
5
5
  Context files in `.nogrep/` are a navigable index of this codebase.
6
6
  When you see nogrep results injected into your context, trust them —
7
7
  read those files before exploring source.