@cortexkit/aft-opencode 0.28.2 → 0.29.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/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -12
- package/dist/shared/bash-hints.d.ts +24 -0
- package/dist/shared/bash-hints.d.ts.map +1 -0
- package/dist/tui.js +8 -8
- package/package.json +8 -8
- package/src/shared/bash-hints.ts +45 -0
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAqKlD;;;;;;;;;;;;;;;;;;GAkBG;AAQH,QAAA,MAAM,MAAM,EAAE,MAA6D,CAAC;AAozB5E,eAAe,MAAM,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -49958,6 +49958,28 @@ async function cleanupWarnings(opts) {
|
|
|
49958
49958
|
}
|
|
49959
49959
|
}
|
|
49960
49960
|
|
|
49961
|
+
// src/shared/bash-hints.ts
|
|
49962
|
+
var CONFLICT_HINT = `
|
|
49963
|
+
|
|
49964
|
+
[Hint] Use aft_conflicts to see all conflict regions across files in a single call.`;
|
|
49965
|
+
var GREP_HINT = `
|
|
49966
|
+
|
|
49967
|
+
[Hint] Use the grep tool instead of bash for faster indexed search.`;
|
|
49968
|
+
function maybeAppendConflictsHint(output) {
|
|
49969
|
+
if (!output.includes("Automatic merge failed; fix conflicts"))
|
|
49970
|
+
return output;
|
|
49971
|
+
if (!/^CONFLICT \(|^error: could not apply /m.test(output))
|
|
49972
|
+
return output;
|
|
49973
|
+
return output + CONFLICT_HINT;
|
|
49974
|
+
}
|
|
49975
|
+
function maybeAppendGrepHint(output) {
|
|
49976
|
+
const firstLine = output.slice(0, 300).split(`
|
|
49977
|
+
`)[0] ?? "";
|
|
49978
|
+
if (!/\b(rg|grep)\s/.test(firstLine))
|
|
49979
|
+
return output;
|
|
49980
|
+
return output + GREP_HINT;
|
|
49981
|
+
}
|
|
49982
|
+
|
|
49961
49983
|
// src/shared/rpc-server.ts
|
|
49962
49984
|
import { randomBytes as randomBytes2 } from "node:crypto";
|
|
49963
49985
|
import { mkdirSync as mkdirSync11, renameSync as renameSync7, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "node:fs";
|
|
@@ -54254,19 +54276,9 @@ Install: ${getManualInstallHint()}`).catch(() => {});
|
|
|
54254
54276
|
if (stored.metadata)
|
|
54255
54277
|
output.metadata = { ...output.metadata, ...stored.metadata };
|
|
54256
54278
|
}
|
|
54257
|
-
if (toolInput.tool === "bash" && output.output?.includes("Automatic merge failed; fix conflicts")) {
|
|
54258
|
-
output.output += `
|
|
54259
|
-
|
|
54260
|
-
[Hint] Use aft_conflicts to see all conflict regions across files in a single call.`;
|
|
54261
|
-
}
|
|
54262
54279
|
if (toolInput.tool === "bash" && output.output) {
|
|
54263
|
-
|
|
54264
|
-
|
|
54265
|
-
if (/\b(rg|grep)\s/.test(firstLine)) {
|
|
54266
|
-
output.output += `
|
|
54267
|
-
|
|
54268
|
-
[Hint] Use the grep tool instead of bash for faster indexed search.`;
|
|
54269
|
-
}
|
|
54280
|
+
output.output = maybeAppendConflictsHint(output.output);
|
|
54281
|
+
output.output = maybeAppendGrepHint(output.output);
|
|
54270
54282
|
}
|
|
54271
54283
|
const sessionDir = getSessionDirectoryCached(toolInput.sessionID) ?? input.directory;
|
|
54272
54284
|
await appendInTurnBgCompletions({ ctx, directory: sessionDir, sessionID: toolInput.sessionID }, output);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Append the `aft_conflicts` hint when the output indicates a real git merge
|
|
3
|
+
* or rebase produced conflicts.
|
|
4
|
+
*
|
|
5
|
+
* Gated on BOTH:
|
|
6
|
+
* - the "Automatic merge failed; fix conflicts" marker, AND
|
|
7
|
+
* - a git-conflict signal (`CONFLICT (...)` line or `error: could not apply`)
|
|
8
|
+
*
|
|
9
|
+
* Both conditions are required because `aft_conflicts` calls `git ls-files -u`,
|
|
10
|
+
* which fails with "not a git repository" outside a git working tree. The
|
|
11
|
+
* marker string can legitimately appear in docs, READMEs, test fixtures, and
|
|
12
|
+
* grep output, so we cannot key off it alone — a false-positive hint sends
|
|
13
|
+
* agents into a confusing error.
|
|
14
|
+
*/
|
|
15
|
+
export declare function maybeAppendConflictsHint(output: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Append the grep-tool hint when the bash command was a grep/rg invocation.
|
|
18
|
+
*
|
|
19
|
+
* Detected by examining the FIRST LINE of output (which is the echoed command
|
|
20
|
+
* line on most shells in foreground mode). We cap the slice at 300 chars so
|
|
21
|
+
* a single huge first line doesn't slow this hook.
|
|
22
|
+
*/
|
|
23
|
+
export declare function maybeAppendGrepHint(output: string): string;
|
|
24
|
+
//# sourceMappingURL=bash-hints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bash-hints.d.ts","sourceRoot":"","sources":["../../src/shared/bash-hints.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAM/D;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAI1D"}
|
package/dist/tui.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createMemo as createMemo2, createSignal as createSignal2, onCleanup as
|
|
|
3
3
|
// package.json
|
|
4
4
|
var package_default = {
|
|
5
5
|
name: "@cortexkit/aft-opencode",
|
|
6
|
-
version: "0.
|
|
6
|
+
version: "0.29.0",
|
|
7
7
|
type: "module",
|
|
8
8
|
description: "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
9
9
|
main: "dist/index.js",
|
|
@@ -32,7 +32,7 @@ var package_default = {
|
|
|
32
32
|
},
|
|
33
33
|
dependencies: {
|
|
34
34
|
"@clack/prompts": "^1.2.0",
|
|
35
|
-
"@cortexkit/aft-bridge": "0.
|
|
35
|
+
"@cortexkit/aft-bridge": "0.29.0",
|
|
36
36
|
"@opencode-ai/plugin": "^1.15.5",
|
|
37
37
|
"@opencode-ai/sdk": "^1.15.5",
|
|
38
38
|
"comment-json": "^4.6.2",
|
|
@@ -40,12 +40,12 @@ var package_default = {
|
|
|
40
40
|
zod: "^4.1.8"
|
|
41
41
|
},
|
|
42
42
|
optionalDependencies: {
|
|
43
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
44
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
45
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
46
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
47
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
48
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
43
|
+
"@cortexkit/aft-darwin-arm64": "0.29.0",
|
|
44
|
+
"@cortexkit/aft-darwin-x64": "0.29.0",
|
|
45
|
+
"@cortexkit/aft-linux-arm64": "0.29.0",
|
|
46
|
+
"@cortexkit/aft-linux-x64": "0.29.0",
|
|
47
|
+
"@cortexkit/aft-win32-arm64": "0.29.0",
|
|
48
|
+
"@cortexkit/aft-win32-x64": "0.29.0"
|
|
49
49
|
},
|
|
50
50
|
devDependencies: {
|
|
51
51
|
"@types/node": "^22.0.0",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@clack/prompts": "^1.2.0",
|
|
32
|
-
"@cortexkit/aft-bridge": "0.
|
|
32
|
+
"@cortexkit/aft-bridge": "0.29.0",
|
|
33
33
|
"@opencode-ai/plugin": "^1.15.5",
|
|
34
34
|
"@opencode-ai/sdk": "^1.15.5",
|
|
35
35
|
"comment-json": "^4.6.2",
|
|
@@ -37,12 +37,12 @@
|
|
|
37
37
|
"zod": "^4.1.8"
|
|
38
38
|
},
|
|
39
39
|
"optionalDependencies": {
|
|
40
|
-
"@cortexkit/aft-darwin-arm64": "0.
|
|
41
|
-
"@cortexkit/aft-darwin-x64": "0.
|
|
42
|
-
"@cortexkit/aft-linux-arm64": "0.
|
|
43
|
-
"@cortexkit/aft-linux-x64": "0.
|
|
44
|
-
"@cortexkit/aft-win32-arm64": "0.
|
|
45
|
-
"@cortexkit/aft-win32-x64": "0.
|
|
40
|
+
"@cortexkit/aft-darwin-arm64": "0.29.0",
|
|
41
|
+
"@cortexkit/aft-darwin-x64": "0.29.0",
|
|
42
|
+
"@cortexkit/aft-linux-arm64": "0.29.0",
|
|
43
|
+
"@cortexkit/aft-linux-x64": "0.29.0",
|
|
44
|
+
"@cortexkit/aft-win32-arm64": "0.29.0",
|
|
45
|
+
"@cortexkit/aft-win32-x64": "0.29.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
48
|
"@types/node": "^22.0.0",
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Pure helpers for the bash-output hint nudges fired from `tool.execute.after`.
|
|
2
|
+
//
|
|
3
|
+
// These run on every bash result and append agent-visible "[Hint] ..." lines
|
|
4
|
+
// that steer toward AFT tools. The functions return the new output string
|
|
5
|
+
// (or the original string when no hint should fire) so the hook can compose
|
|
6
|
+
// them without managing state.
|
|
7
|
+
|
|
8
|
+
const CONFLICT_HINT =
|
|
9
|
+
"\n\n[Hint] Use aft_conflicts to see all conflict regions across files in a single call.";
|
|
10
|
+
const GREP_HINT = "\n\n[Hint] Use the grep tool instead of bash for faster indexed search.";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Append the `aft_conflicts` hint when the output indicates a real git merge
|
|
14
|
+
* or rebase produced conflicts.
|
|
15
|
+
*
|
|
16
|
+
* Gated on BOTH:
|
|
17
|
+
* - the "Automatic merge failed; fix conflicts" marker, AND
|
|
18
|
+
* - a git-conflict signal (`CONFLICT (...)` line or `error: could not apply`)
|
|
19
|
+
*
|
|
20
|
+
* Both conditions are required because `aft_conflicts` calls `git ls-files -u`,
|
|
21
|
+
* which fails with "not a git repository" outside a git working tree. The
|
|
22
|
+
* marker string can legitimately appear in docs, READMEs, test fixtures, and
|
|
23
|
+
* grep output, so we cannot key off it alone — a false-positive hint sends
|
|
24
|
+
* agents into a confusing error.
|
|
25
|
+
*/
|
|
26
|
+
export function maybeAppendConflictsHint(output: string): string {
|
|
27
|
+
if (!output.includes("Automatic merge failed; fix conflicts")) return output;
|
|
28
|
+
// git merge prints "CONFLICT (content|file|...): ..." per file.
|
|
29
|
+
// git rebase / git am print "error: could not apply <sha>" per failed pick.
|
|
30
|
+
if (!/^CONFLICT \(|^error: could not apply /m.test(output)) return output;
|
|
31
|
+
return output + CONFLICT_HINT;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Append the grep-tool hint when the bash command was a grep/rg invocation.
|
|
36
|
+
*
|
|
37
|
+
* Detected by examining the FIRST LINE of output (which is the echoed command
|
|
38
|
+
* line on most shells in foreground mode). We cap the slice at 300 chars so
|
|
39
|
+
* a single huge first line doesn't slow this hook.
|
|
40
|
+
*/
|
|
41
|
+
export function maybeAppendGrepHint(output: string): string {
|
|
42
|
+
const firstLine = output.slice(0, 300).split("\n")[0] ?? "";
|
|
43
|
+
if (!/\b(rg|grep)\s/.test(firstLine)) return output;
|
|
44
|
+
return output + GREP_HINT;
|
|
45
|
+
}
|