@pimzino/sgrep 1.3.31 → 1.3.32
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/build/index.js +0 -0
- package/build/install/droid.d.ts.map +1 -1
- package/build/install/droid.js +13 -58
- package/build/install/droid.js.map +1 -1
- package/build/install/opencode.js +178 -178
- package/build/plugins/sgrep/.claude-plugin/plugin.json +1 -1
- package/build/plugins/sgrep/hooks/hooks.json +70 -70
- package/build/plugins/sgrep/hooks/sgrep_context.js +107 -91
- package/build/plugins/sgrep/hooks/sgrep_enhance.js +188 -183
- package/build/plugins/sgrep/hooks/sgrep_project_summary.js +1 -1
- package/build/plugins/sgrep/hooks/sgrep_watch.js +227 -227
- package/build/plugins/sgrep/skills/sgrep/SKILL.md +50 -49
- package/build/utils/prompt-parser.js +23 -23
- package/package.json +1 -1
package/build/index.js
CHANGED
|
File without changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droid.d.ts","sourceRoot":"","sources":["../../src/install/droid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"droid.d.ts","sourceRoot":"","sources":["../../src/install/droid.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqSpC,eAAO,MAAM,YAAY,SAIrB,CAAC;AAEL,eAAO,MAAM,cAAc,SAIvB,CAAC"}
|
package/build/install/droid.js
CHANGED
|
@@ -61,42 +61,23 @@ function isHooksConfig(value) {
|
|
|
61
61
|
}
|
|
62
62
|
return Object.values(value).every((entry) => Array.isArray(entry));
|
|
63
63
|
}
|
|
64
|
-
/**
|
|
65
|
-
* Check if a hook command is an sgrep hook
|
|
66
|
-
*/
|
|
67
|
-
function isSgrepHook(command) {
|
|
68
|
-
if (!command)
|
|
69
|
-
return false;
|
|
70
|
-
return (command.includes("sgrep_watch") ||
|
|
71
|
-
command.includes("sgrep_enhance") ||
|
|
72
|
-
command.includes("sgrep_context") ||
|
|
73
|
-
command.includes("sgrep_project_summary"));
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Merge hooks by first removing all existing sgrep hooks, then adding new ones.
|
|
77
|
-
* This ensures clean replacement on reinstall rather than accumulating duplicates.
|
|
78
|
-
*/
|
|
79
64
|
function mergeHooks(existingHooks, newHooks) {
|
|
80
65
|
const merged = existingHooks
|
|
81
66
|
? JSON.parse(JSON.stringify(existingHooks))
|
|
82
67
|
: {};
|
|
83
|
-
// First, remove all existing sgrep hooks from all events
|
|
84
|
-
for (const event of Object.keys(merged)) {
|
|
85
|
-
if (Array.isArray(merged[event])) {
|
|
86
|
-
merged[event] = merged[event].filter((entry) => !isSgrepHook(entry?.hooks?.[0]?.command));
|
|
87
|
-
// Clean up empty arrays
|
|
88
|
-
if (merged[event].length === 0) {
|
|
89
|
-
delete merged[event];
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
// Then add the new sgrep hooks
|
|
94
68
|
for (const [event, entries] of Object.entries(newHooks)) {
|
|
95
69
|
const current = Array.isArray(merged[event])
|
|
96
70
|
? merged[event]
|
|
97
71
|
: [];
|
|
98
72
|
for (const entry of entries) {
|
|
99
|
-
|
|
73
|
+
const command = entry?.hooks?.[0]?.command;
|
|
74
|
+
const matcher = entry?.matcher ?? null;
|
|
75
|
+
const duplicate = current.some((item) => (item?.matcher ?? null) === matcher &&
|
|
76
|
+
item?.hooks?.[0]?.command === command &&
|
|
77
|
+
item?.hooks?.[0]?.type === entry?.hooks?.[0]?.type);
|
|
78
|
+
if (!duplicate) {
|
|
79
|
+
current.push(entry);
|
|
80
|
+
}
|
|
100
81
|
}
|
|
101
82
|
merged[event] = current;
|
|
102
83
|
}
|
|
@@ -114,18 +95,15 @@ async function installPlugin() {
|
|
|
114
95
|
const killHook = readPluginAsset(path.join(PLUGIN_HOOKS_DIR, "sgrep_watch_kill.js"));
|
|
115
96
|
const enhanceHook = readPluginAsset(path.join(PLUGIN_HOOKS_DIR, "sgrep_enhance.js"));
|
|
116
97
|
const contextHook = readPluginAsset(path.join(PLUGIN_HOOKS_DIR, "sgrep_context.js"));
|
|
117
|
-
const projectSummaryHook = readPluginAsset(path.join(PLUGIN_HOOKS_DIR, "sgrep_project_summary.js"));
|
|
118
98
|
const skillContent = readPluginAsset(PLUGIN_SKILL_PATH);
|
|
119
99
|
const watchJs = path.join(hooksDir, "sgrep_watch.js");
|
|
120
100
|
const killJs = path.join(hooksDir, "sgrep_watch_kill.js");
|
|
121
101
|
const enhanceJs = path.join(hooksDir, "sgrep_enhance.js");
|
|
122
102
|
const contextJs = path.join(hooksDir, "sgrep_context.js");
|
|
123
|
-
const projectSummaryJs = path.join(hooksDir, "sgrep_project_summary.js");
|
|
124
103
|
writeFileIfChanged(watchJs, watchHook);
|
|
125
104
|
writeFileIfChanged(killJs, killHook);
|
|
126
105
|
writeFileIfChanged(enhanceJs, enhanceHook);
|
|
127
106
|
writeFileIfChanged(contextJs, contextHook);
|
|
128
|
-
writeFileIfChanged(projectSummaryJs, projectSummaryHook);
|
|
129
107
|
const hookConfig = {
|
|
130
108
|
UserPromptSubmit: [
|
|
131
109
|
{
|
|
@@ -140,42 +118,19 @@ async function installPlugin() {
|
|
|
140
118
|
],
|
|
141
119
|
SessionStart: [
|
|
142
120
|
{
|
|
143
|
-
// Watch process
|
|
144
|
-
matcher: "startup
|
|
121
|
+
// Watch process only needs to start on true session startup
|
|
122
|
+
matcher: "startup",
|
|
145
123
|
hooks: [
|
|
146
124
|
{
|
|
147
125
|
type: "command",
|
|
148
126
|
command: `node "${watchJs}"`,
|
|
149
|
-
timeout:
|
|
150
|
-
},
|
|
151
|
-
],
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
// Project summary on startup and compact (context resets)
|
|
155
|
-
matcher: "startup|compact",
|
|
156
|
-
hooks: [
|
|
157
|
-
{
|
|
158
|
-
type: "command",
|
|
159
|
-
command: `node "${projectSummaryJs}"`,
|
|
160
|
-
timeout: 90,
|
|
161
|
-
},
|
|
162
|
-
],
|
|
163
|
-
},
|
|
164
|
-
{
|
|
165
|
-
// Simple context instruction on resume and clear
|
|
166
|
-
matcher: "resume|clear",
|
|
167
|
-
hooks: [
|
|
168
|
-
{
|
|
169
|
-
type: "command",
|
|
170
|
-
command: `node "${contextJs}"`,
|
|
171
|
-
timeout: 5,
|
|
127
|
+
timeout: 10,
|
|
172
128
|
},
|
|
173
129
|
],
|
|
174
130
|
},
|
|
175
|
-
],
|
|
176
|
-
SubagentStart: [
|
|
177
131
|
{
|
|
178
|
-
//
|
|
132
|
+
// Context injection runs on all session events to ensure Claude is always aware
|
|
133
|
+
matcher: "startup|resume|clear|compact",
|
|
179
134
|
hooks: [
|
|
180
135
|
{
|
|
181
136
|
type: "command",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"droid.js","sourceRoot":"","sources":["../../src/install/droid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,WAAW,GACf,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,kBAAkB,CAAC,CAAC;AAC9C,MAAM,gBAAgB,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;AACzD,MAAM,iBAAiB,GAAG,IA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AE;IACjB,MAAM,aAAa,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,iBAAiB,CAAC;KACzD,WAAW,CAAC,wDAAwD,CAAC;KACrE,MAAM,CAAC,KAAK,IAAI,EAAE;IACjB,MAAM,eAAe,EAAE,CAAC;AAC1B,CAAC,CAAC,CAAC"}
|
|
@@ -10,184 +10,184 @@ const PLUGIN_PATH = path.join(os.homedir(), ".config", "opencode", "plugins", "s
|
|
|
10
10
|
const LEGACY_TOOL_PATH = path.join(os.homedir(), ".config", "opencode", "tool", "sgrep.ts");
|
|
11
11
|
const LEGACY_PLUGIN_PATH = path.join(os.homedir(), ".config", "opencode", "plugin", "sgrep.ts");
|
|
12
12
|
// Combined plugin with tool definition and session hooks
|
|
13
|
-
const PLUGIN_DEFINITION = `
|
|
14
|
-
import { type Plugin, tool } from "@opencode-ai/plugin"
|
|
15
|
-
import { spawn, execSync } from "child_process"
|
|
16
|
-
import fs from "fs"
|
|
17
|
-
import path from "path"
|
|
18
|
-
import os from "os"
|
|
19
|
-
|
|
20
|
-
// Session state tracking for background processes
|
|
21
|
-
const sessionPids = new Map<string, number>()
|
|
22
|
-
|
|
23
|
-
function debugLog(message: string) {
|
|
24
|
-
if (process.env.SGREP_DEBUG !== "1" && process.env.SGREP_DEBUG !== "true") return
|
|
25
|
-
const logFile = process.env.SGREP_OPENCODE_LOG || path.join(os.tmpdir(), "sgrep-opencode.log")
|
|
26
|
-
try {
|
|
27
|
-
fs.appendFileSync(logFile, \`[\${new Date().toISOString()}] \${message}\\n\`)
|
|
28
|
-
} catch {}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function findSgrep(): string {
|
|
32
|
-
const isWindows = process.platform === "win32"
|
|
33
|
-
try {
|
|
34
|
-
const cmd = isWindows ? "where sgrep.cmd" : "which sgrep"
|
|
35
|
-
const result = execSync(cmd, { encoding: "utf8", timeout: 5000 }).trim().split(/\\r?\\n/)[0]
|
|
36
|
-
return result
|
|
37
|
-
} catch {
|
|
38
|
-
try {
|
|
39
|
-
const cmd = isWindows ? "where sgrep" : "which sgrep"
|
|
40
|
-
const result = execSync(cmd, { encoding: "utf8", timeout: 5000 }).trim().split(/\\r?\\n/)[0]
|
|
41
|
-
if (isWindows && !result.toLowerCase().endsWith(".cmd") && !result.toLowerCase().endsWith(".exe")) {
|
|
42
|
-
return result + ".cmd"
|
|
43
|
-
}
|
|
44
|
-
return result
|
|
45
|
-
} catch {
|
|
46
|
-
return "sgrep"
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function startWatch(sessionId: string): void {
|
|
52
|
-
const pidFile = path.join(os.tmpdir(), \`sgrep-watch-pid-\${sessionId}.txt\`)
|
|
53
|
-
const logFile = path.join(os.tmpdir(), \`sgrep-watch-opencode-\${sessionId}.log\`)
|
|
54
|
-
|
|
55
|
-
// Check if already running
|
|
56
|
-
if (fs.existsSync(pidFile)) {
|
|
57
|
-
const existingPid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
58
|
-
if (existingPid > 0) {
|
|
59
|
-
try {
|
|
60
|
-
process.kill(existingPid, 0)
|
|
61
|
-
debugLog(\`sgrep watch already running for session \${sessionId} with PID \${existingPid}\`)
|
|
62
|
-
sessionPids.set(sessionId, existingPid)
|
|
63
|
-
return
|
|
64
|
-
} catch {
|
|
65
|
-
fs.unlinkSync(pidFile)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
const sgrepPath = findSgrep()
|
|
71
|
-
debugLog(\`Starting sgrep watch for session \${sessionId} using \${sgrepPath}\`)
|
|
72
|
-
|
|
73
|
-
try {
|
|
74
|
-
const out = fs.openSync(logFile, "w")
|
|
75
|
-
const args = ["watch", "--pid-file", pidFile]
|
|
76
|
-
const isWindows = process.platform === "win32"
|
|
77
|
-
const isCmdScript = sgrepPath.toLowerCase().endsWith(".cmd") || sgrepPath.toLowerCase().endsWith(".bat")
|
|
78
|
-
|
|
79
|
-
let child
|
|
80
|
-
if (isWindows && isCmdScript) {
|
|
81
|
-
child = spawn("cmd.exe", ["/c", sgrepPath, ...args], {
|
|
82
|
-
detached: true,
|
|
83
|
-
stdio: ["ignore", out, out],
|
|
84
|
-
windowsHide: true,
|
|
85
|
-
})
|
|
86
|
-
} else {
|
|
87
|
-
child = spawn(sgrepPath, args, {
|
|
88
|
-
detached: true,
|
|
89
|
-
stdio: ["ignore", out, out],
|
|
90
|
-
...(isWindows ? { windowsHide: true } : {}),
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
child.unref()
|
|
95
|
-
debugLog(\`Spawned sgrep watch with wrapper PID \${child.pid}\`)
|
|
96
|
-
|
|
97
|
-
// Wait for PID file to be written
|
|
98
|
-
setTimeout(() => {
|
|
99
|
-
if (fs.existsSync(pidFile)) {
|
|
100
|
-
const pid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
101
|
-
if (pid > 0) {
|
|
102
|
-
sessionPids.set(sessionId, pid)
|
|
103
|
-
debugLog(\`sgrep watch started with PID \${pid}\`)
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}, 500)
|
|
107
|
-
} catch (e) {
|
|
108
|
-
debugLog(\`Failed to start sgrep watch: \${e}\`)
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function stopWatch(sessionId: string): void {
|
|
113
|
-
const pidFile = path.join(os.tmpdir(), \`sgrep-watch-pid-\${sessionId}.txt\`)
|
|
114
|
-
|
|
115
|
-
// Try from our cache first
|
|
116
|
-
const cachedPid = sessionPids.get(sessionId)
|
|
117
|
-
if (cachedPid) {
|
|
118
|
-
try {
|
|
119
|
-
process.kill(cachedPid, "SIGTERM")
|
|
120
|
-
debugLog(\`Stopped sgrep watch PID \${cachedPid} from cache\`)
|
|
121
|
-
} catch {}
|
|
122
|
-
sessionPids.delete(sessionId)
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Also check PID file
|
|
126
|
-
if (fs.existsSync(pidFile)) {
|
|
127
|
-
try {
|
|
128
|
-
const pid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
129
|
-
if (pid > 0) {
|
|
130
|
-
try {
|
|
131
|
-
process.kill(pid, "SIGTERM")
|
|
132
|
-
debugLog(\`Stopped sgrep watch PID \${pid} from file\`)
|
|
133
|
-
} catch {}
|
|
134
|
-
}
|
|
135
|
-
fs.unlinkSync(pidFile)
|
|
136
|
-
} catch {}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const SKILL_DESCRIPTION = \`Semantic grep - search codebases by meaning using AI.
|
|
141
|
-
|
|
142
|
-
Use sgrep to search your local files semantically. Describe what you're looking for in natural language.
|
|
143
|
-
|
|
144
|
-
Examples:
|
|
145
|
-
sgrep "authentication middleware" # search in current directory
|
|
146
|
-
sgrep "database connection setup" ./src # search in specific directory
|
|
147
|
-
sgrep ask "how does the auth flow work?" # ask questions about code
|
|
148
|
-
sgrep enhance "fix the bug" # enhance vague prompts with context
|
|
149
|
-
|
|
150
|
-
Avoid overly vague queries like "function" - be specific about functionality.\`
|
|
151
|
-
|
|
152
|
-
export const SgrepPlugin: Plugin = async ({ $ }) => {
|
|
153
|
-
debugLog("sgrep plugin loaded")
|
|
154
|
-
|
|
155
|
-
return {
|
|
156
|
-
// Session lifecycle hooks
|
|
157
|
-
event: async ({ event }) => {
|
|
158
|
-
const sessionId = (event as any).properties?.sessionId ||
|
|
159
|
-
(event as any).session_id ||
|
|
160
|
-
"default"
|
|
161
|
-
|
|
162
|
-
if (event.type === "session.created") {
|
|
163
|
-
debugLog(\`Session created: \${sessionId}\`)
|
|
164
|
-
startWatch(sessionId)
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
if (event.type === "session.deleted") {
|
|
168
|
-
debugLog(\`Session deleted: \${sessionId}\`)
|
|
169
|
-
stopWatch(sessionId)
|
|
170
|
-
}
|
|
171
|
-
},
|
|
172
|
-
|
|
173
|
-
// Custom tool for semantic search
|
|
174
|
-
tool: {
|
|
175
|
-
sgrep: tool({
|
|
176
|
-
description: SKILL_DESCRIPTION,
|
|
177
|
-
args: {
|
|
178
|
-
query: tool.schema.string().describe("The semantic search query describing what you're looking for."),
|
|
179
|
-
maxResults: tool.schema.number().default(10).describe("Maximum number of results to return."),
|
|
180
|
-
askMode: tool.schema.boolean().default(false).describe("If true, get explanations instead of code snippets."),
|
|
181
|
-
},
|
|
182
|
-
async execute(args) {
|
|
183
|
-
const cmd = args.askMode ? "ask" : "search"
|
|
184
|
-
const result = await $\`sgrep \${cmd} -m \${args.maxResults} \${args.query}\`.text()
|
|
185
|
-
return result.trim()
|
|
186
|
-
},
|
|
187
|
-
}),
|
|
188
|
-
},
|
|
189
|
-
}
|
|
190
|
-
}
|
|
13
|
+
const PLUGIN_DEFINITION = `
|
|
14
|
+
import { type Plugin, tool } from "@opencode-ai/plugin"
|
|
15
|
+
import { spawn, execSync } from "child_process"
|
|
16
|
+
import fs from "fs"
|
|
17
|
+
import path from "path"
|
|
18
|
+
import os from "os"
|
|
19
|
+
|
|
20
|
+
// Session state tracking for background processes
|
|
21
|
+
const sessionPids = new Map<string, number>()
|
|
22
|
+
|
|
23
|
+
function debugLog(message: string) {
|
|
24
|
+
if (process.env.SGREP_DEBUG !== "1" && process.env.SGREP_DEBUG !== "true") return
|
|
25
|
+
const logFile = process.env.SGREP_OPENCODE_LOG || path.join(os.tmpdir(), "sgrep-opencode.log")
|
|
26
|
+
try {
|
|
27
|
+
fs.appendFileSync(logFile, \`[\${new Date().toISOString()}] \${message}\\n\`)
|
|
28
|
+
} catch {}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function findSgrep(): string {
|
|
32
|
+
const isWindows = process.platform === "win32"
|
|
33
|
+
try {
|
|
34
|
+
const cmd = isWindows ? "where sgrep.cmd" : "which sgrep"
|
|
35
|
+
const result = execSync(cmd, { encoding: "utf8", timeout: 5000 }).trim().split(/\\r?\\n/)[0]
|
|
36
|
+
return result
|
|
37
|
+
} catch {
|
|
38
|
+
try {
|
|
39
|
+
const cmd = isWindows ? "where sgrep" : "which sgrep"
|
|
40
|
+
const result = execSync(cmd, { encoding: "utf8", timeout: 5000 }).trim().split(/\\r?\\n/)[0]
|
|
41
|
+
if (isWindows && !result.toLowerCase().endsWith(".cmd") && !result.toLowerCase().endsWith(".exe")) {
|
|
42
|
+
return result + ".cmd"
|
|
43
|
+
}
|
|
44
|
+
return result
|
|
45
|
+
} catch {
|
|
46
|
+
return "sgrep"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function startWatch(sessionId: string): void {
|
|
52
|
+
const pidFile = path.join(os.tmpdir(), \`sgrep-watch-pid-\${sessionId}.txt\`)
|
|
53
|
+
const logFile = path.join(os.tmpdir(), \`sgrep-watch-opencode-\${sessionId}.log\`)
|
|
54
|
+
|
|
55
|
+
// Check if already running
|
|
56
|
+
if (fs.existsSync(pidFile)) {
|
|
57
|
+
const existingPid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
58
|
+
if (existingPid > 0) {
|
|
59
|
+
try {
|
|
60
|
+
process.kill(existingPid, 0)
|
|
61
|
+
debugLog(\`sgrep watch already running for session \${sessionId} with PID \${existingPid}\`)
|
|
62
|
+
sessionPids.set(sessionId, existingPid)
|
|
63
|
+
return
|
|
64
|
+
} catch {
|
|
65
|
+
fs.unlinkSync(pidFile)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const sgrepPath = findSgrep()
|
|
71
|
+
debugLog(\`Starting sgrep watch for session \${sessionId} using \${sgrepPath}\`)
|
|
72
|
+
|
|
73
|
+
try {
|
|
74
|
+
const out = fs.openSync(logFile, "w")
|
|
75
|
+
const args = ["watch", "--pid-file", pidFile]
|
|
76
|
+
const isWindows = process.platform === "win32"
|
|
77
|
+
const isCmdScript = sgrepPath.toLowerCase().endsWith(".cmd") || sgrepPath.toLowerCase().endsWith(".bat")
|
|
78
|
+
|
|
79
|
+
let child
|
|
80
|
+
if (isWindows && isCmdScript) {
|
|
81
|
+
child = spawn("cmd.exe", ["/c", sgrepPath, ...args], {
|
|
82
|
+
detached: true,
|
|
83
|
+
stdio: ["ignore", out, out],
|
|
84
|
+
windowsHide: true,
|
|
85
|
+
})
|
|
86
|
+
} else {
|
|
87
|
+
child = spawn(sgrepPath, args, {
|
|
88
|
+
detached: true,
|
|
89
|
+
stdio: ["ignore", out, out],
|
|
90
|
+
...(isWindows ? { windowsHide: true } : {}),
|
|
91
|
+
})
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
child.unref()
|
|
95
|
+
debugLog(\`Spawned sgrep watch with wrapper PID \${child.pid}\`)
|
|
96
|
+
|
|
97
|
+
// Wait for PID file to be written
|
|
98
|
+
setTimeout(() => {
|
|
99
|
+
if (fs.existsSync(pidFile)) {
|
|
100
|
+
const pid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
101
|
+
if (pid > 0) {
|
|
102
|
+
sessionPids.set(sessionId, pid)
|
|
103
|
+
debugLog(\`sgrep watch started with PID \${pid}\`)
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}, 500)
|
|
107
|
+
} catch (e) {
|
|
108
|
+
debugLog(\`Failed to start sgrep watch: \${e}\`)
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function stopWatch(sessionId: string): void {
|
|
113
|
+
const pidFile = path.join(os.tmpdir(), \`sgrep-watch-pid-\${sessionId}.txt\`)
|
|
114
|
+
|
|
115
|
+
// Try from our cache first
|
|
116
|
+
const cachedPid = sessionPids.get(sessionId)
|
|
117
|
+
if (cachedPid) {
|
|
118
|
+
try {
|
|
119
|
+
process.kill(cachedPid, "SIGTERM")
|
|
120
|
+
debugLog(\`Stopped sgrep watch PID \${cachedPid} from cache\`)
|
|
121
|
+
} catch {}
|
|
122
|
+
sessionPids.delete(sessionId)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
// Also check PID file
|
|
126
|
+
if (fs.existsSync(pidFile)) {
|
|
127
|
+
try {
|
|
128
|
+
const pid = parseInt(fs.readFileSync(pidFile, "utf8").trim(), 10)
|
|
129
|
+
if (pid > 0) {
|
|
130
|
+
try {
|
|
131
|
+
process.kill(pid, "SIGTERM")
|
|
132
|
+
debugLog(\`Stopped sgrep watch PID \${pid} from file\`)
|
|
133
|
+
} catch {}
|
|
134
|
+
}
|
|
135
|
+
fs.unlinkSync(pidFile)
|
|
136
|
+
} catch {}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
const SKILL_DESCRIPTION = \`Semantic grep - search codebases by meaning using AI.
|
|
141
|
+
|
|
142
|
+
Use sgrep to search your local files semantically. Describe what you're looking for in natural language.
|
|
143
|
+
|
|
144
|
+
Examples:
|
|
145
|
+
sgrep "authentication middleware" # search in current directory
|
|
146
|
+
sgrep "database connection setup" ./src # search in specific directory
|
|
147
|
+
sgrep ask "how does the auth flow work?" # ask questions about code
|
|
148
|
+
sgrep enhance "fix the bug" # enhance vague prompts with context
|
|
149
|
+
|
|
150
|
+
Avoid overly vague queries like "function" - be specific about functionality.\`
|
|
151
|
+
|
|
152
|
+
export const SgrepPlugin: Plugin = async ({ $ }) => {
|
|
153
|
+
debugLog("sgrep plugin loaded")
|
|
154
|
+
|
|
155
|
+
return {
|
|
156
|
+
// Session lifecycle hooks
|
|
157
|
+
event: async ({ event }) => {
|
|
158
|
+
const sessionId = (event as any).properties?.sessionId ||
|
|
159
|
+
(event as any).session_id ||
|
|
160
|
+
"default"
|
|
161
|
+
|
|
162
|
+
if (event.type === "session.created") {
|
|
163
|
+
debugLog(\`Session created: \${sessionId}\`)
|
|
164
|
+
startWatch(sessionId)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (event.type === "session.deleted") {
|
|
168
|
+
debugLog(\`Session deleted: \${sessionId}\`)
|
|
169
|
+
stopWatch(sessionId)
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
|
|
173
|
+
// Custom tool for semantic search
|
|
174
|
+
tool: {
|
|
175
|
+
sgrep: tool({
|
|
176
|
+
description: SKILL_DESCRIPTION,
|
|
177
|
+
args: {
|
|
178
|
+
query: tool.schema.string().describe("The semantic search query describing what you're looking for."),
|
|
179
|
+
maxResults: tool.schema.number().default(10).describe("Maximum number of results to return."),
|
|
180
|
+
askMode: tool.schema.boolean().default(false).describe("If true, get explanations instead of code snippets."),
|
|
181
|
+
},
|
|
182
|
+
async execute(args) {
|
|
183
|
+
const cmd = args.askMode ? "ask" : "search"
|
|
184
|
+
const result = await $\`sgrep \${cmd} -m \${args.maxResults} \${args.query}\`.text()
|
|
185
|
+
return result.trim()
|
|
186
|
+
},
|
|
187
|
+
}),
|
|
188
|
+
},
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
191
|
`;
|
|
192
192
|
async function installPlugin() {
|
|
193
193
|
console.log(chalk.cyan("Installing sgrep plugin for OpenCode..."));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sgrep",
|
|
3
3
|
"description": "Semantic grep - ask questions about codebases using AI. Use sgrep \"question\" to understand code (default) or sgrep search for raw code snippets.",
|
|
4
|
-
"version": "1.3.
|
|
4
|
+
"version": "1.3.32",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "pimzino"
|
|
7
7
|
},
|