bacluc-opencode-completion-check-command 0.9.15 → 0.10.1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bacluc-opencode-completion-check-command",
|
|
3
|
-
"version": "v0.
|
|
3
|
+
"version": "v0.10.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"opencode",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"format:check": "prettier --check ."
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@opencode-ai/plugin": "1.18.
|
|
39
|
+
"@opencode-ai/plugin": "1.18.25"
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"@types/bun": "1.4.0",
|
|
@@ -16,6 +16,7 @@ export function parseCodeBlock(input: string): string | null {
|
|
|
16
16
|
|
|
17
17
|
interface SessionEntry {
|
|
18
18
|
command: string
|
|
19
|
+
directory: string
|
|
19
20
|
retries: number
|
|
20
21
|
}
|
|
21
22
|
|
|
@@ -27,14 +28,18 @@ export class CompletionCheckStore {
|
|
|
27
28
|
this.maxRetries = maxRetries
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
set(sessionID: string, command: string): void {
|
|
31
|
-
this.entries.set(sessionID, { command, retries: 0 })
|
|
31
|
+
set(sessionID: string, command: string, directory: string = ''): void {
|
|
32
|
+
this.entries.set(sessionID, { command, directory, retries: 0 })
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
get(sessionID: string): string | undefined {
|
|
35
36
|
return this.entries.get(sessionID)?.command
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
getDirectory(sessionID: string): string | undefined {
|
|
40
|
+
return this.entries.get(sessionID)?.directory
|
|
41
|
+
}
|
|
42
|
+
|
|
38
43
|
getEntry(sessionID: string): SessionEntry | undefined {
|
|
39
44
|
return this.entries.get(sessionID)
|
|
40
45
|
}
|
|
@@ -277,7 +282,7 @@ export const CompletionCheckCommandPlugin: Plugin = async (input, options) => {
|
|
|
277
282
|
return
|
|
278
283
|
}
|
|
279
284
|
|
|
280
|
-
store.set(input.sessionID, command)
|
|
285
|
+
store.set(input.sessionID, command, store.getDirectory(input.sessionID))
|
|
281
286
|
|
|
282
287
|
try {
|
|
283
288
|
await client.tui.showToast({
|
|
@@ -294,13 +299,19 @@ export const CompletionCheckCommandPlugin: Plugin = async (input, options) => {
|
|
|
294
299
|
},
|
|
295
300
|
|
|
296
301
|
event: async ({ event }) => {
|
|
302
|
+
// Note: the SDK exposes `parentID?: string` on `Session` (types.gen.d.ts:469),
|
|
303
|
+
// but we deliberately do NOT inherit the parent's completion-check command.
|
|
304
|
+
// Each session resolves its own command from its own directory via
|
|
305
|
+
// readDefaultCommand(directory). This ensures a child repository checked out
|
|
306
|
+
// by a subagent uses the AGENTS.md/dotfile command from its own working
|
|
307
|
+
// directory, not the parent's.
|
|
297
308
|
if (event.type === 'session.created') {
|
|
298
309
|
const sessionID = (event as Extract<Event, { type: 'session.created' }>).properties.info.id
|
|
299
310
|
const directory = (event as Extract<Event, { type: 'session.created' }>).properties.info.directory
|
|
300
311
|
const { command: defaultCommand, source } = await readDefaultCommand(directory)
|
|
301
312
|
|
|
302
313
|
if (defaultCommand && source) {
|
|
303
|
-
store.set(sessionID, defaultCommand)
|
|
314
|
+
store.set(sessionID, defaultCommand, directory)
|
|
304
315
|
|
|
305
316
|
try {
|
|
306
317
|
await client.tui.showToast({
|
|
@@ -355,7 +366,8 @@ export const CompletionCheckCommandPlugin: Plugin = async (input, options) => {
|
|
|
355
366
|
return
|
|
356
367
|
}
|
|
357
368
|
|
|
358
|
-
const
|
|
369
|
+
const sessionDirectory = store.getDirectory(sessionID) || input.directory
|
|
370
|
+
const result = await executeCommand(command, sessionDirectory)
|
|
359
371
|
|
|
360
372
|
if (result.exitCode === 0) {
|
|
361
373
|
store.delete(sessionID)
|