jevgrep 0.2.0

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/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "jevgrep",
3
+ "version": "0.2.0",
4
+ "description": "Semantic grep: describe the code you want in English, get file:line hits. Powered by TypeSafe Jev. No index, no embeddings, no dependencies.",
5
+ "keywords": ["grep", "semantic-search", "code-search", "jev", "typesafe", "lint", "cli"],
6
+ "license": "MIT",
7
+ "repository": { "type": "git", "url": "https://github.com/kyu1204/jgrep.git" },
8
+ "homepage": "https://github.com/kyu1204/jgrep",
9
+ "type": "module",
10
+ "bin": {
11
+ "jgrep": "dist/jgrep.js"
12
+ },
13
+ "files": ["dist", "skill", "README.md", "LICENSE"],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "scripts": {
18
+ "build": "bun build src/cli.ts --target=node --outfile=dist/jgrep.js && chmod +x dist/jgrep.js",
19
+ "test": "bun test src/",
20
+ "prepublishOnly": "bun run test && bun run build"
21
+ },
22
+ "devDependencies": {
23
+ "@clack/prompts": "^1.8.1"
24
+ }
25
+ }
package/skill/SKILL.md ADDED
@@ -0,0 +1,78 @@
1
+ ---
2
+ name: jgrep
3
+ description: >-
4
+ Semantic grep for code. Use `jgrep` when you need to locate code by what it
5
+ DOES rather than by an identifier you already know ("where do we retry
6
+ failed requests", "code that swallows errors", "anything that shells out"),
7
+ before opening many files to look for something, and as a cheap self-check
8
+ of your own diff before committing. Returns file:line ranges with a
9
+ probability, in about 2 seconds for a whole src/ tree. Keep using plain
10
+ grep/rg for exact names and strings.
11
+ ---
12
+
13
+ # jgrep
14
+
15
+ `jgrep "<description in English>" [paths]` asks a fast decision model (TypeSafe
16
+ Jev) one yes/no question per 5-60 line chunk and prints the chunks that match.
17
+ It never reads files into your context: you get a short list, then you Read
18
+ only the ranges you need.
19
+
20
+ ## When to use it instead of grep or reading files
21
+
22
+ - You know the behavior, not the name: "validates the webhook signature",
23
+ "builds the SQL string by concatenation", "catches and ignores errors".
24
+ - You would otherwise open 5+ files hunting for something.
25
+ - You want a second opinion on your own change: run it on the diff.
26
+
27
+ Do not use it for exact identifiers, strings, or paths. `rg` is free and instant.
28
+
29
+ ## Commands
30
+
31
+ ```
32
+ jgrep "description" src/ # hits with p >= 0.7, file order
33
+ jgrep -t 0.85 "description" src/ # fewer, higher-precision hits
34
+ jgrep -C "description" src/ # print the matching chunk bodies
35
+ jgrep --json "description" src/ # [{file,start,end,p,text}]
36
+ jgrep -a -t 0 "description" src/ | head # everything, best first (when 0 hits)
37
+ jgrep --diff --staged "rule" # lint your staged change
38
+ jgrep --diff origin/main "rule" # lint the branch against main
39
+ ```
40
+
41
+ Exit status: 0 hits found, 1 none, 2 error. Every run prints a summary line
42
+ on stderr: `N hits / M chunks · tokens · $cost · seconds`.
43
+
44
+ ## Reading results
45
+
46
+ ```
47
+ src/loop/state.ts:108-115 p=0.96 export function readRun(...)
48
+ ```
49
+
50
+ `p` is the probability the chunk matches. Treat >= 0.9 as reliable, 0.7-0.9
51
+ as worth a look, below 0.5 as no. After a run, Read only the listed ranges
52
+ (`offset`/`limit`), not whole files.
53
+
54
+ ## Writing the description
55
+
56
+ - English, one concrete behavior per query. Split compound questions.
57
+ - Describe the code, not the feature name: "decides whether to send an
58
+ alert based on OCR confidence" beats "alert feature".
59
+ - Chunks are 5-60 lines seen in isolation, so cross-file flow ("does this
60
+ eventually write to the DB") will not match; ask about the local code.
61
+
62
+ ## Self-review before committing
63
+
64
+ Run 2-4 rules on the staged diff; each rule is one sentence about a mistake
65
+ you might have made. Exit 0 means a hit, so investigate those chunks.
66
+
67
+ ```
68
+ jgrep --diff --staged "leaves debug output such as console.log or print"
69
+ jgrep --diff --staged "changes behavior without a corresponding test change"
70
+ jgrep --diff --staged "adds an endpoint or handler with no input validation"
71
+ ```
72
+
73
+ ## Requirements
74
+
75
+ Installed globally as `jgrep`; the key lives in `~/.config/jgrep/env`. If it
76
+ reports "No TypeSafe API key", tell the user rather than working around it.
77
+ Run it inside a project directory or pass the project path: it refuses to
78
+ walk a non-git directory with more than 5000 files.