@cortexkit/aft-opencode 0.28.1 → 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/config.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare const AftConfigSchema: z.ZodObject<{
19
19
  }>>;
20
20
  formatter: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodEnum<{
21
21
  biome: "biome";
22
+ oxfmt: "oxfmt";
22
23
  prettier: "prettier";
23
24
  deno: "deno";
24
25
  ruff: "ruff";
@@ -33,6 +34,7 @@ export declare const AftConfigSchema: z.ZodObject<{
33
34
  ruff: "ruff";
34
35
  none: "none";
35
36
  tsc: "tsc";
37
+ tsgo: "tsgo";
36
38
  pyright: "pyright";
37
39
  cargo: "cargo";
38
40
  go: "go";
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmExB,eAAO,MAAM,eAAe;;;;;;;;;iBAE1B,CAAC;AAuEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAqFjB,CAAC;AAEZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAA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AA;CAAE,CAwD1C;AAsWD;;;;;;;;;GASG;AACH,wBAAgB,aAAa,CAAC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAiDjE"}
@@ -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;AAoKlD;;;;;;;;;;;;;;;;;;GAkBG;AAQH,QAAA,MAAM,MAAM,EAAE,MAA6D,CAAC;AAg0B5E,eAAe,MAAM,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
@@ -46720,6 +46720,7 @@ config(en_default());
46720
46720
  // src/config.ts
46721
46721
  var FormatterEnum = exports_external.enum([
46722
46722
  "biome",
46723
+ "oxfmt",
46723
46724
  "prettier",
46724
46725
  "deno",
46725
46726
  "ruff",
@@ -46731,6 +46732,7 @@ var FormatterEnum = exports_external.enum([
46731
46732
  ]);
46732
46733
  var CheckerEnum = exports_external.enum([
46733
46734
  "tsc",
46735
+ "tsgo",
46734
46736
  "biome",
46735
46737
  "pyright",
46736
46738
  "ruff",
@@ -48536,7 +48538,8 @@ function runInstall(spec, version2, cwd, signal) {
48536
48538
  resolve3(false);
48537
48539
  return;
48538
48540
  }
48539
- const child = spawn3("npm", ["install", "--no-save", "--ignore-scripts", "--silent", target], {
48541
+ const npmBin = process.platform === "win32" ? "npm.cmd" : "npm";
48542
+ const child = spawn3(npmBin, ["install", "--no-save", "--ignore-scripts", "--silent", target], {
48540
48543
  stdio: ["ignore", "pipe", "pipe"],
48541
48544
  cwd
48542
48545
  });
@@ -49955,6 +49958,28 @@ async function cleanupWarnings(opts) {
49955
49958
  }
49956
49959
  }
49957
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
+
49958
49983
  // src/shared/rpc-server.ts
49959
49984
  import { randomBytes as randomBytes2 } from "node:crypto";
49960
49985
  import { mkdirSync as mkdirSync11, renameSync as renameSync7, unlinkSync as unlinkSync7, writeFileSync as writeFileSync10 } from "node:fs";
@@ -54251,19 +54276,9 @@ Install: ${getManualInstallHint()}`).catch(() => {});
54251
54276
  if (stored.metadata)
54252
54277
  output.metadata = { ...output.metadata, ...stored.metadata };
54253
54278
  }
54254
- if (toolInput.tool === "bash" && output.output?.includes("Automatic merge failed; fix conflicts")) {
54255
- output.output += `
54256
-
54257
- [Hint] Use aft_conflicts to see all conflict regions across files in a single call.`;
54258
- }
54259
54279
  if (toolInput.tool === "bash" && output.output) {
54260
- const firstLine = output.output.slice(0, 300).split(`
54261
- `)[0] ?? "";
54262
- if (/\b(rg|grep)\s/.test(firstLine)) {
54263
- output.output += `
54264
-
54265
- [Hint] Use the grep tool instead of bash for faster indexed search.`;
54266
- }
54280
+ output.output = maybeAppendConflictsHint(output.output);
54281
+ output.output = maybeAppendGrepHint(output.output);
54267
54282
  }
54268
54283
  const sessionDir = getSessionDirectoryCached(toolInput.sessionID) ?? input.directory;
54269
54284
  await appendInTurnBgCompletions({ ctx, directory: sessionDir, sessionID: toolInput.sessionID }, output);
@@ -1 +1 @@
1
- {"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4BH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AA8DD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AAqXD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
1
+ {"version":3,"file":"lsp-auto-install.d.ts","sourceRoot":"","sources":["../src/lsp-auto-install.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AA4BH,+DAA+D;AAC/D,MAAM,WAAW,iBAAiB;IAChC,oCAAoC;IACpC,WAAW,EAAE,OAAO,CAAC;IACrB,6CAA6C;IAC7C,SAAS,EAAE,MAAM,CAAC;IAClB,8EAA8E;IAC9E,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,kGAAkG;IAClG,QAAQ,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC/B;AAED,qCAAqC;AACrC,MAAM,WAAW,iBAAiB;IAChC,mFAAmF;IACnF,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,gDAAgD;IAChD,eAAe,EAAE,MAAM,CAAC;IACxB,yEAAyE;IACzE,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B;;;;;;;OAOG;IACH,OAAO,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/C;;;;;;;;;OASG;IACH,gBAAgB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AA8DD,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAM/D;AA4XD;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,iBAAiB,EACzB,SAAS,GAAE,OAAO,KAAa,GAC9B,iBAAiB,CAwEnB"}
@@ -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.28.1",
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.28.1",
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.28.1",
44
- "@cortexkit/aft-darwin-x64": "0.28.1",
45
- "@cortexkit/aft-linux-arm64": "0.28.1",
46
- "@cortexkit/aft-linux-x64": "0.28.1",
47
- "@cortexkit/aft-win32-arm64": "0.28.1",
48
- "@cortexkit/aft-win32-x64": "0.28.1"
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.28.1",
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.28.1",
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.28.1",
41
- "@cortexkit/aft-darwin-x64": "0.28.1",
42
- "@cortexkit/aft-linux-arm64": "0.28.1",
43
- "@cortexkit/aft-linux-x64": "0.28.1",
44
- "@cortexkit/aft-win32-arm64": "0.28.1",
45
- "@cortexkit/aft-win32-x64": "0.28.1"
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
+ }