@cortexkit/aft-pi 0.37.2 → 0.38.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.js CHANGED
@@ -14327,37 +14327,67 @@ var GREP_GUARD_FLAGS = new Set([
14327
14327
  function maybeStripCompressorPipe(command, compressionEnabled) {
14328
14328
  if (!compressionEnabled)
14329
14329
  return { command, stripped: false };
14330
- if (containsUnsplittableConstruct(command))
14331
- return { command, stripped: false };
14332
- const chain = splitTopLevelAndChain(command);
14330
+ const chain = splitTopLevelCommandChain(command);
14333
14331
  if (chain === null)
14334
14332
  return { command, stripped: false };
14335
- const prefix = chain.slice(0, -1).map((segment) => segment.trim()).filter(Boolean);
14336
- const pipeline3 = chain[chain.length - 1] ?? "";
14337
- const stages = splitTopLevelPipeline(pipeline3);
14338
- if (stages.length < 2)
14333
+ let stripped = false;
14334
+ const droppedFilterChains = [];
14335
+ const rebuilt = chain.map(({ segment, separator }) => {
14336
+ const result = stripSinglePipelineSegment(segment);
14337
+ if (result.stripped) {
14338
+ stripped = true;
14339
+ droppedFilterChains.push(result.filters);
14340
+ }
14341
+ return `${result.segment}${separator}`;
14342
+ }).join("");
14343
+ if (!stripped)
14339
14344
  return { command, stripped: false };
14345
+ return {
14346
+ command: rebuilt,
14347
+ stripped: true,
14348
+ note: formatStripNote(droppedFilterChains)
14349
+ };
14350
+ }
14351
+ function stripSinglePipelineSegment(segment) {
14352
+ const leading = /^\s*/.exec(segment)?.[0] ?? "";
14353
+ const trailing = /\s*$/.exec(segment)?.[0] ?? "";
14354
+ const coreStart = leading.length;
14355
+ const coreEnd = segment.length - trailing.length;
14356
+ if (coreEnd <= coreStart)
14357
+ return { segment, stripped: false };
14358
+ const core = segment.slice(coreStart, coreEnd);
14359
+ if (containsUnsplittableConstruct(core))
14360
+ return { segment, stripped: false };
14361
+ if (hasUnquotedBackground(core))
14362
+ return { segment, stripped: false };
14363
+ const stages = splitTopLevelPipeline(core);
14364
+ if (stages.length < 2)
14365
+ return { segment, stripped: false };
14340
14366
  const firstStage = stages[0]?.trim() ?? "";
14341
14367
  if (!isCompressorHandledRunner(firstStage))
14342
- return { command, stripped: false };
14368
+ return { segment, stripped: false };
14343
14369
  const filterStages = stages.slice(1).map((stage) => stage.trim());
14344
14370
  for (const stage of filterStages) {
14345
14371
  if (!filterStageIsSafeToDrop(stage))
14346
- return { command, stripped: false };
14372
+ return { segment, stripped: false };
14347
14373
  }
14348
- const filters = filterStages.join(" | ");
14349
- const rebuilt = [...prefix, firstStage].join(" && ");
14350
14374
  return {
14351
- command: rebuilt,
14375
+ segment: `${leading}${firstStage}${trailing}`,
14352
14376
  stripped: true,
14353
- note: `[AFT dropped \`| ${filters}\` (compressed:false to keep)]`
14377
+ filters: filterStages.join(" | ")
14354
14378
  };
14355
14379
  }
14356
- function splitTopLevelAndChain(command) {
14380
+ function formatStripNote(droppedFilterChains) {
14381
+ const filters = droppedFilterChains.map((filter) => `\`| ${filter}\``).join(", ");
14382
+ return `[AFT dropped ${filters} (compressed:false to keep)]`;
14383
+ }
14384
+ function splitTopLevelCommandChain(command) {
14357
14385
  const segments = [];
14358
14386
  let start = 0;
14359
14387
  let quote = null;
14360
14388
  let escaped = false;
14389
+ let inBacktick = false;
14390
+ let parenDepth = 0;
14361
14391
  for (let index = 0;index < command.length; index++) {
14362
14392
  const char = command[index];
14363
14393
  const next = command[index + 1];
@@ -14365,6 +14395,13 @@ function splitTopLevelAndChain(command) {
14365
14395
  escaped = false;
14366
14396
  continue;
14367
14397
  }
14398
+ if (inBacktick) {
14399
+ if (char === "\\")
14400
+ escaped = true;
14401
+ else if (char === "`")
14402
+ inBacktick = false;
14403
+ continue;
14404
+ }
14368
14405
  if (char === "\\" && quote !== "'") {
14369
14406
  escaped = true;
14370
14407
  continue;
@@ -14378,26 +14415,47 @@ function splitTopLevelAndChain(command) {
14378
14415
  quote = char;
14379
14416
  continue;
14380
14417
  }
14381
- if (char === "&" && next === "&") {
14382
- segments.push(command.slice(start, index));
14383
- start = index + 2;
14384
- index++;
14418
+ if (char === "`") {
14419
+ inBacktick = true;
14385
14420
  continue;
14386
14421
  }
14387
- if (char === "|" && next === "|")
14388
- return null;
14389
- if (char === ";")
14390
- return null;
14422
+ if (char === "(") {
14423
+ parenDepth++;
14424
+ continue;
14425
+ }
14426
+ if (char === ")") {
14427
+ if (parenDepth === 0)
14428
+ return null;
14429
+ parenDepth--;
14430
+ continue;
14431
+ }
14432
+ if (parenDepth > 0)
14433
+ continue;
14391
14434
  if (char === `
14392
14435
  ` || char === "\r")
14393
14436
  return null;
14394
- if (char === "&") {
14395
- const prev = command[index - 1];
14396
- if (prev !== ">" && next !== ">")
14397
- return null;
14437
+ if (char === "#" && (index === 0 || command[index - 1] === " " || command[index - 1] === "\t"))
14438
+ return null;
14439
+ if (char === "&" && next === "&") {
14440
+ segments.push({ segment: command.slice(start, index), separator: "&&" });
14441
+ start = index + 2;
14442
+ index++;
14443
+ continue;
14444
+ }
14445
+ if (char === "|" && next === "|") {
14446
+ segments.push({ segment: command.slice(start, index), separator: "||" });
14447
+ start = index + 2;
14448
+ index++;
14449
+ continue;
14450
+ }
14451
+ if (char === ";") {
14452
+ segments.push({ segment: command.slice(start, index), separator: ";" });
14453
+ start = index + 1;
14398
14454
  }
14399
14455
  }
14400
- segments.push(command.slice(start));
14456
+ if (escaped || quote || inBacktick || parenDepth !== 0)
14457
+ return null;
14458
+ segments.push({ segment: command.slice(start), separator: "" });
14401
14459
  return segments;
14402
14460
  }
14403
14461
  function splitTopLevelPipeline(command) {
@@ -14460,13 +14518,13 @@ function isCompressorHandledRunner(stage) {
14460
14518
  args = args.slice(1);
14461
14519
  const sub = args[0];
14462
14520
  const subNext = args[1];
14463
- return sub === "test" || sub === "run" && startsWithTest(subNext);
14521
+ return sub === "test" || sub === "run" && isJsVerificationScript(subNext);
14464
14522
  }
14465
14523
  if (first === "npm" || first === "pnpm") {
14466
- return second === "test" || second === "run" && startsWithTest(third);
14524
+ return second === "test" || second === "run" && isJsVerificationScript(third);
14467
14525
  }
14468
14526
  if (first === "yarn") {
14469
- return startsWithTest(second) || second === "run" && startsWithTest(third);
14527
+ return isJsVerificationScript(second) || second === "run" && isJsVerificationScript(third);
14470
14528
  }
14471
14529
  if (first === "deno")
14472
14530
  return ["test", "lint", "check", "bench"].includes(second ?? "");
@@ -14544,8 +14602,10 @@ function hasBuildTask(args, tasks) {
14544
14602
  }
14545
14603
  return sawAllowed;
14546
14604
  }
14547
- function startsWithTest(token) {
14548
- return token?.startsWith("test") === true;
14605
+ function isJsVerificationScript(token) {
14606
+ if (!token)
14607
+ return false;
14608
+ return token.startsWith("test") || token === "typecheck" || token.startsWith("typecheck:");
14549
14609
  }
14550
14610
  var XCODEBUILD_VALUE_FLAGS = new Set([
14551
14611
  "-scheme",
@@ -15700,7 +15760,7 @@ import {
15700
15760
  // package.json
15701
15761
  var package_default = {
15702
15762
  name: "@cortexkit/aft-pi",
15703
- version: "0.37.2",
15763
+ version: "0.38.0",
15704
15764
  type: "module",
15705
15765
  description: "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
15706
15766
  main: "dist/index.js",
@@ -15723,7 +15783,7 @@ var package_default = {
15723
15783
  "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
15724
15784
  },
15725
15785
  dependencies: {
15726
- "@cortexkit/aft-bridge": "0.37.2",
15786
+ "@cortexkit/aft-bridge": "0.38.0",
15727
15787
  "@xterm/headless": "^5.5.0",
15728
15788
  "comment-json": "^5.0.0",
15729
15789
  diff: "^8.0.4",
@@ -15731,12 +15791,12 @@ var package_default = {
15731
15791
  zod: "^4.1.8"
15732
15792
  },
15733
15793
  optionalDependencies: {
15734
- "@cortexkit/aft-darwin-arm64": "0.37.2",
15735
- "@cortexkit/aft-darwin-x64": "0.37.2",
15736
- "@cortexkit/aft-linux-arm64": "0.37.2",
15737
- "@cortexkit/aft-linux-x64": "0.37.2",
15738
- "@cortexkit/aft-win32-arm64": "0.37.2",
15739
- "@cortexkit/aft-win32-x64": "0.37.2"
15794
+ "@cortexkit/aft-darwin-arm64": "0.38.0",
15795
+ "@cortexkit/aft-darwin-x64": "0.38.0",
15796
+ "@cortexkit/aft-linux-arm64": "0.38.0",
15797
+ "@cortexkit/aft-linux-x64": "0.38.0",
15798
+ "@cortexkit/aft-win32-arm64": "0.38.0",
15799
+ "@cortexkit/aft-win32-x64": "0.38.0"
15740
15800
  },
15741
15801
  devDependencies: {
15742
15802
  "@earendil-works/pi-coding-agent": "*",
@@ -15945,7 +16005,7 @@ function formatStatusDialogMessage(status) {
15945
16005
  lines.push("", "Disk usage", `- trigram index: ${formatBytes(status.disk.trigram_disk_bytes)}`, `- semantic index: ${formatBytes(status.disk.semantic_disk_bytes)}`, "", "Runtime", `- LSP servers: ${formatCount(status.lsp_servers)}`, `- symbol cache: ${formatCount(status.symbol_cache.local_entries)} local / ${formatCount(status.symbol_cache.warm_entries)} warm`);
15946
16006
  if (status.status_bar) {
15947
16007
  const sb = status.status_bar;
15948
- lines.push("", `Code Health${sb.tier2_stale ? " (~ stale)" : ""}`, `- errors: ${formatCount(sb.errors)}`, `- warnings: ${formatCount(sb.warnings)}`, `- duplicates: ${formatCount(sb.duplicates)}`, `- todos: ${formatCount(sb.todos)}`);
16008
+ lines.push("", `Code Health${sb.tier2_stale ? " (~ stale)" : ""}`, `- errors: ${formatCount(sb.errors)}`, `- warnings: ${formatCount(sb.warnings)}`, `- dead code: ${formatCount(sb.dead_code)}`, `- unused exports: ${formatCount(sb.unused_exports)}`, `- duplicates: ${formatCount(sb.duplicates)}`, `- todos: ${formatCount(sb.todos)}`);
15949
16009
  }
15950
16010
  if (status.storage_dir ?? status.disk.storage_dir) {
15951
16011
  lines.push(`- storage dir: ${status.storage_dir ?? status.disk.storage_dir}`);
@@ -15972,7 +16032,7 @@ var optionalInt = (_min, _max) => Type.Optional(Type.Any({ description: "(intege
15972
16032
  function coerceOptionalInt(v, paramName, min, max) {
15973
16033
  if (v === undefined || v === null || v === "")
15974
16034
  return;
15975
- if (typeof v === "number" && (v === 0 || !Number.isFinite(v)))
16035
+ if (typeof v === "number" && (!Number.isFinite(v) || v === 0 && min > 0))
15976
16036
  return;
15977
16037
  const n = typeof v === "string" ? Number(v) : v;
15978
16038
  if (typeof n !== "number" || !Number.isInteger(n)) {
@@ -16042,7 +16102,15 @@ ${candidates.map((candidate) => ` - ${candidate}`).join(`
16042
16102
  `);
16043
16103
  }
16044
16104
  function collectStructuredExtras(response) {
16045
- const reserved = new Set(["id", "success", "code", "message", "data"]);
16105
+ const reserved = new Set([
16106
+ "id",
16107
+ "success",
16108
+ "code",
16109
+ "message",
16110
+ "data",
16111
+ "status_bar",
16112
+ "bg_completions"
16113
+ ]);
16046
16114
  const extras = {};
16047
16115
  for (const [key, value] of Object.entries(response)) {
16048
16116
  if (reserved.has(key))
@@ -32490,6 +32558,12 @@ async function runCleanups(reason) {
32490
32558
  }
32491
32559
  }));
32492
32560
  }
32561
+ var SIGNAL_EXIT_CODES = { SIGINT: 130, SIGTERM: 143, SIGHUP: 129 };
32562
+ var SIGNAL_CLEANUP_TIMEOUT_MS = 5000;
32563
+ function shouldForceExit(otherListenerCount) {
32564
+ return otherListenerCount === 0;
32565
+ }
32566
+ var signalShutdownStarted = false;
32493
32567
  function installProcessHandlers() {
32494
32568
  const state = getState();
32495
32569
  if (state.installed)
@@ -32497,9 +32571,27 @@ function installProcessHandlers() {
32497
32571
  state.installed = true;
32498
32572
  const signals = ["SIGTERM", "SIGINT", "SIGHUP"];
32499
32573
  for (const sig of signals) {
32500
- process.on(sig, () => {
32501
- runCleanups(sig);
32502
- });
32574
+ const handler = () => {
32575
+ const others = process.listenerCount(sig) - 1;
32576
+ if (!shouldForceExit(others)) {
32577
+ const names = process.listeners(sig).filter((fn) => fn !== handler).map((fn) => fn.name || fn.toString().slice(0, 80).replace(/\s+/g, " ")).join(" | ");
32578
+ log2(`${sig}: deferring termination to ${others} other listener(s); cleanup only. Others: ${names}`);
32579
+ runCleanups(sig);
32580
+ return;
32581
+ }
32582
+ if (signalShutdownStarted) {
32583
+ process.exit(SIGNAL_EXIT_CODES[sig]);
32584
+ }
32585
+ signalShutdownStarted = true;
32586
+ process.exitCode = SIGNAL_EXIT_CODES[sig];
32587
+ const timeout = new Promise((resolve3) => {
32588
+ setTimeout(resolve3, SIGNAL_CLEANUP_TIMEOUT_MS);
32589
+ });
32590
+ Promise.race([runCleanups(sig), timeout]).finally(() => {
32591
+ process.exit(SIGNAL_EXIT_CODES[sig]);
32592
+ });
32593
+ };
32594
+ process.on(sig, handler);
32503
32595
  }
32504
32596
  process.on("beforeExit", () => {
32505
32597
  runCleanups("beforeExit");
@@ -33257,7 +33349,7 @@ function renderUnifiedDiff(unifiedDiff) {
33257
33349
  }
33258
33350
 
33259
33351
  // src/tools/ast.ts
33260
- var AstLang = StringEnum(["typescript", "tsx", "javascript", "python", "rust", "go"], {
33352
+ var AstLang = StringEnum(["typescript", "tsx", "javascript", "python", "rust", "go", "pascal"], {
33261
33353
  description: "Target language"
33262
33354
  });
33263
33355
  var SearchParams = Type3.Object({
@@ -36108,12 +36200,12 @@ var PLUGIN_VERSION = (() => {
36108
36200
  return "0.0.0";
36109
36201
  }
36110
36202
  })();
36111
- var ANNOUNCEMENT_VERSION = "0.37.0";
36203
+ var ANNOUNCEMENT_VERSION = "0.38.0";
36112
36204
  var ANNOUNCEMENT_FEATURES = [
36113
- "Much lower background CPU: idle bridges shut down after 30 minutes, deleted project roots stop the watcher instead of spinning it, and background scans reuse warm caches on a bounded thread pool.",
36114
- "`aft_transform` removed: usage data showed agents never called it `edit` covers everything it did, and every request now carries a smaller tool surface.",
36115
- "Leaner tools: `bash`, `write`, `edit`, `apply_patch`, `aft_search`, and `aft_refactor` descriptions trimmed and config-aware; system-prompt guidance rewritten around what to do instead of what to avoid.",
36116
- "Background bash reminders are right-sized: failures keep head + tail context, successes show a short tail, and compressors never print a success summary for a non-zero exit."
36205
+ "Code Health you can trust: dead code and unused exports are back in the status displays, rebuilt on a real TS/JS module-graph engine (oxc) barrel re-exports, entry points, and dynamic imports resolve correctly now.",
36206
+ "Tools stay responsive during builds: filesystem events are processed off the request thread, so a cargo/webpack compile no longer queues your tool calls behind an event flood.",
36207
+ "Pascal support in outline, zoom, and the AST tools.",
36208
+ "Transient environment errors (schema fetch timeouts) no longer count as code errors in the status bar."
36117
36209
  ];
36118
36210
  var ANNOUNCEMENT_FOOTER = "Join us on Discord: https://discord.gg/DSa65w8wuf";
36119
36211
  var ALL_ONLY_TOOLS = new Set(["aft_callgraph", "aft_delete", "aft_move", "aft_refactor"]);
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/shared/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,0BAA0B,CAAC;IACpC,OAAO,EAAE,0BAA0B,CAAC;CACrC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QACR,cAAc,EAAE,OAAO,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC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ACtB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iEAAiE;IACjE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAC;QACX,aAAa,EAAE,MAAM,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,wEAAwE;IACxE,WAAW,CAAC,EAAE,iBAAiB,CAAC;IAChC;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAsED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAKvF;AAED,wBAAgB,wBAAwB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAI/E;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAajD;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,iBAAiB,CAiEpF;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAiF3E;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM,CAmFtE"}
@@ -12,6 +12,20 @@
12
12
  * once per Node process, even if the Pi extension loads multiple times.
13
13
  */
14
14
  type Cleanup = () => Promise<void> | void;
15
+ /** Conventional exit codes for fatal signals (128 + signal number). */
16
+ export declare const SIGNAL_EXIT_CODES: {
17
+ readonly SIGINT: 130;
18
+ readonly SIGTERM: 143;
19
+ readonly SIGHUP: 129;
20
+ };
21
+ /**
22
+ * Registering ANY listener for SIGINT/SIGTERM/SIGHUP disables Node/Bun's
23
+ * default terminate-on-signal behavior. If AFT's listener is the only one,
24
+ * the default was suppressed solely by us, so we must exit or the host hangs
25
+ * forever. If the host or another extension also listens, terminating is
26
+ * their call. Mirror of the OpenCode plugin's shutdown-hooks contract.
27
+ */
28
+ export declare function shouldForceExit(otherListenerCount: number): boolean;
15
29
  /** Register a shutdown cleanup. Returns an unregister function. */
16
30
  export declare function registerShutdownCleanup(fn: Cleanup): () => void;
17
31
  export declare function __shutdownCleanupCountForTests(): number;
@@ -1 +1 @@
1
- {"version":3,"file":"shutdown-hooks.d.ts","sourceRoot":"","sources":["../src/shutdown-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,KAAK,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAuD1C,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,IAAI,CAO/D;AAED,wBAAgB,8BAA8B,IAAI,MAAM,CAEvD;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD"}
1
+ {"version":3,"file":"shutdown-hooks.d.ts","sourceRoot":"","sources":["../src/shutdown-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAIH,KAAK,OAAO,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AAuC1C,uEAAuE;AACvE,eAAO,MAAM,iBAAiB;;;;CAAsD,CAAC;AAKrF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAEnE;AAmDD,mEAAmE;AACnE,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,OAAO,GAAG,MAAM,IAAI,CAO/D;AAED,wBAAgB,8BAA8B,IAAI,MAAM,CAEvD;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAGtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/tools/_shared.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OA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OAAO,CAAC,EAAE,QAAQ,GACjB,eAAe,CAAC,QAAQ,CAAC,CAE3B;AAED,8DAA8D;AAC9D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAGvF"}
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * ast_grep_search + ast_grep_replace — AST-aware pattern search/rewrite.
3
- * 6 languages: typescript, tsx, javascript, python, rust, go.
3
+ * 7 languages: typescript, tsx, javascript, python, rust, go, pascal.
4
4
  */
5
5
  import type { AgentToolResult, ExtensionAPI, Theme } from "@earendil-works/pi-coding-agent";
6
6
  import { type Static, Type } from "typebox";
@@ -8,7 +8,7 @@ import type { PluginContext } from "../types.js";
8
8
  import { type RenderContextLike } from "./render-helpers.js";
9
9
  declare const SearchParams: Type.TObject<{
10
10
  pattern: Type.TString;
11
- lang: Type.TUnsafe<"go" | "python" | "typescript" | "tsx" | "javascript" | "rust">;
11
+ lang: Type.TUnsafe<"go" | "python" | "typescript" | "tsx" | "javascript" | "rust" | "pascal">;
12
12
  paths: Type.TOptional<Type.TArray<Type.TString>>;
13
13
  globs: Type.TOptional<Type.TArray<Type.TString>>;
14
14
  contextLines: Type.TOptional<Type.TNumber>;
@@ -16,7 +16,7 @@ declare const SearchParams: Type.TObject<{
16
16
  declare const ReplaceParams: Type.TObject<{
17
17
  pattern: Type.TString;
18
18
  rewrite: Type.TString;
19
- lang: Type.TUnsafe<"go" | "python" | "typescript" | "tsx" | "javascript" | "rust">;
19
+ lang: Type.TUnsafe<"go" | "python" | "typescript" | "tsx" | "javascript" | "rust" | "pascal">;
20
20
  paths: Type.TOptional<Type.TArray<Type.TString>>;
21
21
  globs: Type.TOptional<Type.TArray<Type.TString>>;
22
22
  dryRun: Type.TOptional<Type.TBoolean>;
@@ -1 +1 @@
1
- {"version":3,"file":"ast.d.ts","sourceRoot":"","sources":["../../src/tools/ast.ts"],"names":[],"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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft-pi",
3
- "version": "0.37.2",
3
+ "version": "0.38.0",
4
4
  "type": "module",
5
5
  "description": "Pi coding agent extension for Agent File Tools (AFT) — tree-sitter and LSP-powered code analysis",
6
6
  "main": "dist/index.js",
@@ -23,7 +23,7 @@
23
23
  "test:unit": "bun test src/__tests__ --path-ignore-patterns 'src/__tests__/e2e/**'"
24
24
  },
25
25
  "dependencies": {
26
- "@cortexkit/aft-bridge": "0.37.2",
26
+ "@cortexkit/aft-bridge": "0.38.0",
27
27
  "@xterm/headless": "^5.5.0",
28
28
  "comment-json": "^5.0.0",
29
29
  "diff": "^8.0.4",
@@ -31,12 +31,12 @@
31
31
  "zod": "^4.1.8"
32
32
  },
33
33
  "optionalDependencies": {
34
- "@cortexkit/aft-darwin-arm64": "0.37.2",
35
- "@cortexkit/aft-darwin-x64": "0.37.2",
36
- "@cortexkit/aft-linux-arm64": "0.37.2",
37
- "@cortexkit/aft-linux-x64": "0.37.2",
38
- "@cortexkit/aft-win32-arm64": "0.37.2",
39
- "@cortexkit/aft-win32-x64": "0.37.2"
34
+ "@cortexkit/aft-darwin-arm64": "0.38.0",
35
+ "@cortexkit/aft-darwin-x64": "0.38.0",
36
+ "@cortexkit/aft-linux-arm64": "0.38.0",
37
+ "@cortexkit/aft-linux-x64": "0.38.0",
38
+ "@cortexkit/aft-win32-arm64": "0.38.0",
39
+ "@cortexkit/aft-win32-x64": "0.38.0"
40
40
  },
41
41
  "devDependencies": {
42
42
  "@earendil-works/pi-coding-agent": "*",