@sourcegraph/amp 0.0.1749326478-g6cda64 → 0.0.1749355713-g05a6d7

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/amp.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./console-Dvb4mlt2.js";
3
- import "./main-Dj2IQaGB.js";
2
+ import "./console-T6r_4D-k.js";
3
+ import "./main-CMXyYqec.js";
4
4
  import "node:crypto";
5
5
  import "node:fs/promises";
6
6
  import "node:path";
7
7
  import "node:process";
8
- import "./client-D-IY-U_F.js";
8
+ import "./client-CVbnd4Z8.js";
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { f as i, E as o, aS as c, s as p, p as u } from "./console-Dvb4mlt2.js";
2
+ import { f as i, E as o, aS as c, s as p, p as u } from "./console-T6r_4D-k.js";
3
3
  const m = !0;
4
4
  function f() {
5
5
  return new Proxy(
@@ -1045,7 +1045,7 @@ COMPLEMENTARY USE WITH CODEBASE_SEARCH:
1045
1045
  },
1046
1046
  source: "builtin"
1047
1047
  },
1048
- fn: import("./node-Q6Y8w80U.js").then(({ nodeGrepTool: n }) => n)
1048
+ fn: import("./node-CK7K6o1e.js").then(({ nodeGrepTool: n }) => n)
1049
1049
  };
1050
1050
  var Zc = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
1051
1051
  function Li(n) {
@@ -1952,7 +1952,7 @@ It's VERY IMPORTANT to use specific tools when searching for files, instead of i
1952
1952
  },
1953
1953
  source: "builtin"
1954
1954
  },
1955
- fn: import("./node-BQqcfLba.js").then(({ nodeBashTool: n }) => n),
1955
+ fn: import("./node-CPEdykgq.js").then(({ nodeBashTool: n }) => n),
1956
1956
  preprocessArgs: (n) => {
1957
1957
  if (!n.cwd)
1958
1958
  try {
@@ -2011,7 +2011,7 @@ Prefer this tool over \`edit_file\` when you want to ovewrite the entire content
2011
2011
  content: n.content + `
2012
2012
  `
2013
2013
  },
2014
- fn: import("./create_file.node-CRyFgm0F.js").then(
2014
+ fn: import("./create_file.node-D4mEfKZo.js").then(
2015
2015
  ({ nodeCreateFileTool: n }) => n
2016
2016
  )
2017
2017
  };
@@ -4843,7 +4843,7 @@ Returns the contents of the file with each line prefixed by its line number. For
4843
4843
  switch ("node") {
4844
4844
  case "node":
4845
4845
  case "vscode":
4846
- return import("./read_file.node-BULEexSm.js").then(({ nodeReadFileTool: n }) => n);
4846
+ return import("./read_file.node-Dsmm49fA.js").then(({ nodeReadFileTool: n }) => n);
4847
4847
  }
4848
4848
  })()
4849
4849
  }, cB = U8({
@@ -4872,7 +4872,7 @@ If you need to replace the entire contents of a file, use \`${$u}\` instead, sin
4872
4872
  inputSchema: t8(cB),
4873
4873
  source: "builtin"
4874
4874
  },
4875
- fn: import("./edit_file.node-4wiIt_1p.js").then(({ nodeEditFileTool: n }) => n)
4875
+ fn: import("./edit_file.node-BlH8LaLm.js").then(({ nodeEditFileTool: n }) => n)
4876
4876
  };
4877
4877
  function ZS(n) {
4878
4878
  return n.replace(/\\\\n/g, "\\n").replace(/\\\\t/g, "\\t").replace(/\\\\/g, "\\").replace(/\\"/g, '"').replace(/\\'/g, "'").replace(/\\n/g, `
@@ -5053,7 +5053,7 @@ Note: Results are sorted by modification time with the most recently modified fi
5053
5053
  },
5054
5054
  source: "builtin"
5055
5055
  },
5056
- fn: import("./glob.node-DiaL_K-Y.js").then(({ nodeGlobTool: n }) => n)
5056
+ fn: import("./glob.node-Y5D1xRsV.js").then(({ nodeGlobTool: n }) => n)
5057
5057
  }, Qu = "list_directory", IE = {
5058
5058
  spec: {
5059
5059
  name: Qu,
@@ -5074,7 +5074,7 @@ Note: Results are sorted by modification time with the most recently modified fi
5074
5074
  switch ("node") {
5075
5075
  case "node":
5076
5076
  case "vscode":
5077
- return import("./list_directory.node-CydlY2iC.js").then(
5077
+ return import("./list_directory.node-BZFZmoyB.js").then(
5078
5078
  ({ nodeListDirectoryTool: n }) => n
5079
5079
  );
5080
5080
  }
@@ -5161,7 +5161,7 @@ This tool converts web content to markdown format for better readability.`,
5161
5161
  requiresNetwork: !0
5162
5162
  }
5163
5163
  },
5164
- fn: import("./node-Cj2ZZWHz.js").then(({ nodeReadWebPageTool: n }) => n)
5164
+ fn: import("./node-CZ03pEwv.js").then(({ nodeReadWebPageTool: n }) => n)
5165
5165
  }, gB = "web_search", hB = `Search the web for information.
5166
5166
 
5167
5167
  Returns search result titles, associated URLs, and a small summary of the
@@ -5209,7 +5209,7 @@ the \`${x1}\` with the url.
5209
5209
  requiresNetwork: !0
5210
5210
  }
5211
5211
  },
5212
- fn: import("./node-j5JkFzVn.js").then(({ nodeWebSearchTool: n }) => n)
5212
+ fn: import("./node-Jui3WGeI.js").then(({ nodeWebSearchTool: n }) => n)
5213
5213
  };
5214
5214
  function KN({ onlyFirst: n = !1 } = {}) {
5215
5215
  const t = [
@@ -5500,7 +5500,7 @@ function jS(n, e) {
5500
5500
  const t = () => {
5501
5501
  n.removeEventListener("abort", t), e();
5502
5502
  };
5503
- n.addEventListener("abort", t);
5503
+ return n.addEventListener("abort", t), () => n.removeEventListener("abort", t);
5504
5504
  }
5505
5505
  }
5506
5506
  const jN = {
@@ -29492,7 +29492,7 @@ async function gW(n, e) {
29492
29492
  }
29493
29493
  }
29494
29494
  async function hW(n, e) {
29495
- return (await import("./list_directory.node-CydlY2iC.js")).resolveArgumentDirectoryNode(n, e);
29495
+ return (await import("./list_directory.node-BZFZmoyB.js")).resolveArgumentDirectoryNode(n, e);
29496
29496
  }
29497
29497
  class EW extends Nd {
29498
29498
  #e = new AbortController();
@@ -31484,7 +31484,7 @@ async function UW({
31484
31484
  fileMentions: void 0,
31485
31485
  userState: void 0
31486
31486
  };
31487
- const i = (await import("./files-URI9_POf.js").then(
31487
+ const i = (await import("./files-UP3i3eRo.js").then(
31488
31488
  ({ getFileMentions: o }) => o(
31489
31489
  JN(t.content),
31490
31490
  a,
@@ -32677,7 +32677,7 @@ Returns a git-style diff showing the changes that were undone as formatted markd
32677
32677
  switch ("node") {
32678
32678
  case "node":
32679
32679
  case "vscode":
32680
- return import("./undo_edit.node-CR56HIq6.js").then(({ nodeUndoEditTool: n }) => n);
32680
+ return import("./undo_edit.node-5FkOPN1O.js").then(({ nodeUndoEditTool: n }) => n);
32681
32681
  }
32682
32682
  })()
32683
32683
  }, iy = globalThis.window?.document !== void 0;
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import u from "node:path";
3
- import { p as d, aC as f, aD as l } from "./console-Dvb4mlt2.js";
3
+ import { p as d, aC as f, aD as l } from "./console-T6r_4D-k.js";
4
4
  const w = ({ args: t }, { dir: a, dirs: n, trackFileChange: c, filesystem: o }) => d(async (e) => {
5
5
  if (f(a), typeof t.content != "string")
6
6
  throw new Error("create_file: content must be specified");
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { p, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-Dvb4mlt2.js";
3
- import { recordEdit as x } from "./undo_edit.node-CR56HIq6.js";
2
+ import { p, aC as m, aD as F, aE as v, aF as _, aG as b } from "./console-T6r_4D-k.js";
3
+ import { recordEdit as x } from "./undo_edit.node-5FkOPN1O.js";
4
4
  class E {
5
5
  #e = !1;
6
6
  #t = [];
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { existsSync as o } from "node:fs";
3
3
  import { createRequire as t } from "node:module";
4
- import { C as i } from "./console-Dvb4mlt2.js";
4
+ import { C as i } from "./console-T6r_4D-k.js";
5
5
  function u() {
6
6
  {
7
7
  if (process.env.AMP_RIPGREP_PATH)
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import T from "node:path";
3
- import { b8 as B, b9 as I, C as v, ba as z, bb as C } from "./console-Dvb4mlt2.js";
3
+ import { b8 as B, b9 as I, C as v, ba as z, bb as C } from "./console-T6r_4D-k.js";
4
4
  async function A(r, h, a) {
5
5
  const x = await a.listFiles(h), i = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map(), m = [], M = /\b([\w/_-]+(?:\\.|[\w/_-])*(?:\.[\w-]+)+)\b/g, F = /(\/(?:[\w-]+\/|[\w-]+\\[.\s\S])+[\w.-]+(?:\\.|[\w.-])*(?:\.[\w-]+)+)\b/g, y = /\b([A-Za-z]:[\\\\][^\s"'<>|]*(?:\.[\w-]+)+)\b/g;
6
6
  await l(M, !1), await l(F, !0), await l(y, !0);
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn as w } from "node:child_process";
3
- import { p as I } from "./index-obyovEcz.js";
4
- import { O as v, g as N, m as E, aC as P, C as R } from "./console-Dvb4mlt2.js";
5
- import { r as D } from "./executable-BnwRQX_M.js";
3
+ import { p as I } from "./index-C2Ke9iUN.js";
4
+ import { O as v, g as N, m as E, C as P, aC as R } from "./console-T6r_4D-k.js";
5
+ import { r as D } from "./executable-BiJzVjpG.js";
6
6
  const S = ({ args: i }, { dirs: r }) => {
7
7
  if (r.length === 0)
8
8
  return new v((s) => {
@@ -39,7 +39,7 @@ function O(i, r, n) {
39
39
  );
40
40
  }
41
41
  function b(i, r, n) {
42
- return P(i), new v((s) => {
42
+ return R(i), new v((s) => {
43
43
  s.next({
44
44
  status: "in-progress",
45
45
  progress: []
@@ -98,7 +98,7 @@ function F(i, r, n) {
98
98
  g--;
99
99
  return;
100
100
  }
101
- c.push(a), c.length >= f && (R.warn("Glob limit reached. Returning partial results.", {
101
+ c.push(a), c.length >= f && (P.warn("Glob limit reached. Returning partial results.", {
102
102
  glob: r?.pattern,
103
103
  limit: f,
104
104
  dir: i
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { z as xt } from "./console-Dvb4mlt2.js";
2
+ import { z as xt } from "./console-T6r_4D-k.js";
3
3
  var pt = {}, ft, Et;
4
4
  function ct() {
5
5
  if (Et) return ft;
@@ -2,7 +2,7 @@
2
2
  import c from "node:fs/promises";
3
3
  import u from "node:os";
4
4
  import s from "node:path";
5
- import { O as f, aH as i, aI as l, m, aJ as p } from "./console-Dvb4mlt2.js";
5
+ import { O as f, aH as i, aI as l, m, aJ as p } from "./console-T6r_4D-k.js";
6
6
  const D = ({ args: r }, { dirs: t }) => {
7
7
  if (t.length === 0)
8
8
  return new f((e) => {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import n from "node:os";
3
- import { O as r } from "./console-Dvb4mlt2.js";
3
+ import { O as r } from "./console-T6r_4D-k.js";
4
4
  const e = process.env;
5
5
  function i(t, o = "always") {
6
6
  return o === "never" ? r.of(e) : r.of(e);
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { O as je, s as Dr, c as dh, a as _r, b as Zn, f as We, d as kt, p as Dt, m as Ee, e as Bn, g as br, h as $t, i as sp, j as ph, o as ue, l as be, k as oe, n as re, q as ye, r as Ge, t as Ke, u as He, v as Xn, w as it, x as mh, y as lp, z as ei, A as up, M as Je, B as gh, C as J, N as Fn, D as ri, E as Jr, F as Ss, G as cp, H as fp, I as Es, J as hp, K as vh, L as dp, P as al, Q as Mt, R as pp, S as mp, T as gp, U as vp, V as yp, W as bp, X as wp, Y as _p, Z as Sp, _ as Ep, $ as Pp, a0 as Cp, a1 as Rp, a2 as xp, a3 as Tp, a4 as Op, a5 as Ap, a6 as Lp, a7 as Ip, a8 as Dp, a9 as at, aa as $p, ab as Mp, ac as yh, ad as Et, ae as ts, af as ns, ag as jn, ah as kp, ai as Fp, aj as jp, ak as qp, al as Ps, am as ol, an as Cs, ao as qr, ap as is, aq as Np, ar as Hp, as as sl, at as Up, au as Bp, av as as, aw as bh, ax as wh, ay as zp, az as Vp } from "./console-Dvb4mlt2.js";
2
+ import { O as je, s as Dr, c as dh, a as _r, b as Zn, f as We, d as kt, p as Dt, m as Ee, e as Bn, g as br, h as $t, i as sp, j as ph, o as ue, l as be, k as oe, n as re, q as ye, r as Ge, t as Ke, u as He, v as Xn, w as it, x as mh, y as lp, z as ei, A as up, M as Je, B as gh, C as J, N as Fn, D as ri, E as Jr, F as Ss, G as cp, H as fp, I as Es, J as hp, K as vh, L as dp, P as al, Q as Mt, R as pp, S as mp, T as gp, U as vp, V as yp, W as bp, X as wp, Y as _p, Z as Sp, _ as Ep, $ as Pp, a0 as Cp, a1 as Rp, a2 as xp, a3 as Tp, a4 as Op, a5 as Ap, a6 as Lp, a7 as Ip, a8 as Dp, a9 as at, aa as $p, ab as Mp, ac as yh, ad as Et, ae as ts, af as ns, ag as jn, ah as kp, ai as Fp, aj as jp, ak as qp, al as Ps, am as ol, an as Cs, ao as qr, ap as is, aq as Np, ar as Hp, as as sl, at as Up, au as Bp, av as as, aw as bh, ax as wh, ay as zp, az as Vp } from "./console-T6r_4D-k.js";
3
3
  import * as Wp from "node:fs/promises";
4
4
  import tt, { readdir as _h, stat as Sh, readFile as Or, mkdir as zn, writeFile as Tt, unlink as Gp, readlink as Kp, open as Jp } from "node:fs/promises";
5
5
  import * as Yp from "node:path";
6
6
  import me, { join as ze, dirname as ll } from "node:path";
7
- import { i as ul, F as yi, f as wr, a as Qp } from "./client-D-IY-U_F.js";
7
+ import { i as ul, F as yi, f as wr, a as Qp } from "./client-CVbnd4Z8.js";
8
8
  import Rs from "node:events";
9
9
  import * as Zp from "node:child_process";
10
10
  import Xp, { execFile as Eh, spawn as ti, exec as Nr } from "node:child_process";
@@ -18,7 +18,7 @@ import fm, { createGzip as hm } from "node:zlib";
18
18
  import dm from "node:string_decoder";
19
19
  import pm, { createServer as Ph } from "node:http";
20
20
  import mm from "node:https";
21
- import { r as gm } from "./executable-BnwRQX_M.js";
21
+ import { r as gm } from "./executable-BiJzVjpG.js";
22
22
  import { pipeline as vm } from "node:stream/promises";
23
23
  import { lookup as ym } from "node:dns";
24
24
  const Ir = Symbol.for("@@pendingOperation");
@@ -4991,10 +4991,10 @@ async function Nv(t, e, n) {
4991
4991
  if ("url" in t)
4992
4992
  i = new jv(new URL(t.url));
4993
4993
  else {
4994
- const { loadProfileEnvironmentVariables: r } = await import("./load-profile-DfwAD194.js"), a = n.loadProfile === "never" || !n.workingDirectory ? process.env : await We(
4994
+ const { loadProfileEnvironmentVariables: r } = await import("./load-profile-BjFcSiC-.js"), a = n.loadProfile === "never" || !n.workingDirectory ? process.env : await We(
4995
4995
  r(n.workingDirectory, n.loadProfile)
4996
4996
  );
4997
- i = await import("./stdio-D-4HT2L3.js").then(
4997
+ i = await import("./stdio-cwPY7onl.js").then(
4998
4998
  ({ StdioClientTransport: s }) => new s({
4999
4999
  ...t,
5000
5000
  stderr: "pipe",
@@ -5755,7 +5755,7 @@ IMPORTANT: The result of this tool (if any) should be displayed directly to the
5755
5755
  },
5756
5756
  source: "builtin"
5757
5757
  },
5758
- fn: import("./node-BBULH5vm.js").then(({ runRoutine: t }) => t)
5758
+ fn: import("./node-B0iEambK.js").then(({ runRoutine: t }) => t)
5759
5759
  };
5760
5760
  let hu = !1;
5761
5761
  async function ed(t, e = !1) {
@@ -17638,7 +17638,7 @@ async function Ur(t, e, { stdin: n, stdout: i } = { stdin: process.stdin, stdout
17638
17638
  n.on("data", u), n.once("error", o);
17639
17639
  });
17640
17640
  }
17641
- const Bd = import("./node-CeVAo09v.js").then(
17641
+ const Bd = import("./node-BEt-eFnM.js").then(
17642
17642
  ({ nodeFileSystem: t }) => t
17643
17643
  ), Qo = Ft(Zp.exec);
17644
17644
  async function cw(t) {
@@ -18792,7 +18792,7 @@ async function Rw({
18792
18792
  }
18793
18793
  async function xw(t) {
18794
18794
  try {
18795
- const e = await _w("0.0.1749326478-g6cda64");
18795
+ const e = await _w("0.0.1749355713-g05a6d7");
18796
18796
  e.hasUpdate && e.latestVersion ? (t.next({ type: "update-start-updating" }), setTimeout(async () => {
18797
18797
  try {
18798
18798
  await Cw(e.latestVersion), t.next({
@@ -20550,7 +20550,7 @@ async function Un(t, e) {
20550
20550
  Yn({
20551
20551
  logLevel: e.logLevel || process.env.AMP_LOG_LEVEL,
20552
20552
  logFile: e.logFile || process.env.AMP_LOG_FILE
20553
- }), Vp("0.0.1749326478-g6cda64");
20553
+ }), Vp("0.0.1749355713-g05a6d7");
20554
20554
  const n = e.settingsFile ?? process.env.AMP_SETTINGS_FILE;
20555
20555
  J.info("Using settings file", { settingsFile: n });
20556
20556
  const i = Hn(), r = ad({ settingsFile: n }), a = process.env.AMP_API_KEY;
@@ -20658,7 +20658,7 @@ function Zw(t) {
20658
20658
  const e = new wu().name("amp").description("AI-powered coding assistant").option("--thread-id [THREAD_ID]", "ID of the thread to continue running", void 0);
20659
20659
  e.option("-V, --version", "output the version number", () => {
20660
20660
  if (t.isTTY) {
20661
- const a = "0.0.1749326478-g6cda64".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20661
+ const a = "0.0.1749355713-g05a6d7".match(/^(\d+\.\d+)\.(\d+)-(.+)$/);
20662
20662
  if (a) {
20663
20663
  const [, , s] = a;
20664
20664
  try {
@@ -20669,21 +20669,21 @@ function Zw(t) {
20669
20669
  day: "numeric"
20670
20670
  });
20671
20671
  Ie.write(
20672
- `0.0.1749326478-g6cda64 ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20672
+ `0.0.1749355713-g05a6d7 ${t.printer.print(`(released ${o})`, { foreground: "gray" })}
20673
20673
  `
20674
20674
  );
20675
20675
  } else
20676
- Ie.write(`0.0.1749326478-g6cda64
20676
+ Ie.write(`0.0.1749355713-g05a6d7
20677
20677
  `);
20678
20678
  } catch {
20679
- Ie.write(`0.0.1749326478-g6cda64
20679
+ Ie.write(`0.0.1749355713-g05a6d7
20680
20680
  `);
20681
20681
  }
20682
20682
  } else
20683
- Ie.write(`0.0.1749326478-g6cda64
20683
+ Ie.write(`0.0.1749355713-g05a6d7
20684
20684
  `);
20685
20685
  } else
20686
- Ie.write(`0.0.1749326478-g6cda64
20686
+ Ie.write(`0.0.1749355713-g05a6d7
20687
20687
  `);
20688
20688
  process.exit(0);
20689
20689
  }), e.addHelpText(
@@ -21129,5 +21129,6 @@ function r_(t, e, n = {}) {
21129
21129
  }
21130
21130
  export {
21131
21131
  Am as J,
21132
+ di as U,
21132
21133
  ey as r
21133
21134
  };
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { q as x, o as A, n as g, y as B, r as j, l as h, x as I, u as J, w as V, A as k, aY as z, aZ as W, a_ as Z, a$ as C, b0 as L, b1 as _, b2 as D, ax as M, f as q, b3 as G, b4 as H, b5 as F, b6 as K, O as Q, b7 as N, _ as X, av as ee, C as te } from "./console-Dvb4mlt2.js";
3
- import { r as se } from "./main-Dj2IQaGB.js";
2
+ import { q as x, o as A, n as g, y as B, r as j, l as h, x as I, u as J, w as V, A as k, aY as z, aZ as W, a_ as Z, a$ as C, b0 as L, b1 as _, b2 as D, ax as M, f as q, b3 as G, b4 as H, b5 as F, b6 as K, O as Q, b7 as N, _ as X, av as ee, C as te } from "./console-T6r_4D-k.js";
3
+ import { r as se } from "./main-CMXyYqec.js";
4
4
  const v = A({
5
5
  context: V(["continue", "none"]).optional().default("continue"),
6
6
  tools: J([h("all"), x(g())]).optional(),
@@ -0,0 +1,132 @@
1
+ #!/usr/bin/env node
2
+ import { execFile as m } from "node:child_process";
3
+ import * as i from "node:fs";
4
+ import * as o from "node:path";
5
+ import { join as p } from "node:path";
6
+ import { promisify as w } from "node:util";
7
+ import { U as h } from "./main-CMXyYqec.js";
8
+ import { N as y, C as n, aJ as c } from "./console-T6r_4D-k.js";
9
+ import { ripgrepFiles as d } from "./glob.node-Y5D1xRsV.js";
10
+ import { homedir as F } from "node:os";
11
+ const g = p(F(), ".amp", "file-changes"), u = w(m);
12
+ function B(a) {
13
+ const s = o.join(g, a);
14
+ return {
15
+ relativePath: (r, e) => o.relative(r, e),
16
+ joinPath: (...r) => o.join(...r),
17
+ readFile: async (r, e) => {
18
+ try {
19
+ return await i.promises.readFile(r, { encoding: "utf8", signal: e });
20
+ } catch (t) {
21
+ throw l(t) ? new c(r) : t;
22
+ }
23
+ },
24
+ readBinaryFile: async (r, e) => {
25
+ try {
26
+ return await i.promises.readFile(r, { signal: e });
27
+ } catch (t) {
28
+ throw l(t) ? new c(r) : t;
29
+ }
30
+ },
31
+ getMtime: async (r, e) => {
32
+ try {
33
+ return (await i.promises.stat(r)).mtimeMs;
34
+ } catch (t) {
35
+ throw l(t) ? new c(r) : t;
36
+ }
37
+ },
38
+ stat: async (r) => {
39
+ try {
40
+ return {
41
+ size: (await i.promises.stat(r)).size
42
+ };
43
+ } catch (e) {
44
+ throw l(e) ? new c(r) : e;
45
+ }
46
+ },
47
+ writeFile: async (r, e, t) => {
48
+ await i.promises.writeFile(r, e, { encoding: "utf-8", signal: t });
49
+ },
50
+ deleteFile: async (r, e) => {
51
+ try {
52
+ await i.promises.unlink(r);
53
+ } catch (t) {
54
+ throw l(t) ? new c(r) : t;
55
+ }
56
+ },
57
+ mkdirp: async (r) => {
58
+ await i.promises.mkdir(r, { recursive: !0 });
59
+ },
60
+ storeFileChange: async (r, e) => {
61
+ const t = o.join(s, r);
62
+ await i.promises.writeFile(t, JSON.stringify(e, null, 2), "utf8");
63
+ },
64
+ listBackupFiles: async () => {
65
+ try {
66
+ return await i.promises.stat(s).then((r) => r.isDirectory()).catch(() => !1) ? await i.promises.readdir(s) : (await i.promises.mkdir(s, { recursive: !0 }), []);
67
+ } catch (r) {
68
+ return n.error("Error listing backup files:", r), [];
69
+ }
70
+ },
71
+ loadFileChange: async (r) => {
72
+ try {
73
+ const e = o.join(s, r), t = await i.promises.readFile(e, "utf8");
74
+ return JSON.parse(t);
75
+ } catch (e) {
76
+ return n.error(`Error loading backup file ${r}:`, e), null;
77
+ }
78
+ },
79
+ cleanupBackupFiles: async () => {
80
+ try {
81
+ await i.promises.stat(s).then((r) => r.isDirectory()).catch(() => !1) && (await i.promises.rm(s, { recursive: !0, force: !0 }), n.debug(`Cleaned up backup directory: ${s}`));
82
+ } catch (r) {
83
+ n.error(`Error cleaning up backup files in ${s}:`, r);
84
+ }
85
+ },
86
+ listFiles: async (r) => E(r),
87
+ findFiles: async (r, e) => {
88
+ try {
89
+ return (await d(
90
+ r.base.fsPath,
91
+ { pattern: r.pattern, caseInsensitive: !0 },
92
+ {
93
+ limit: e?.maxResults,
94
+ signal: e?.signal
95
+ }
96
+ )).files.map((f) => h.file(o.join(r.base.fsPath, f)));
97
+ } catch (t) {
98
+ return n.error(
99
+ `Error finding files with pattern ${r.pattern}:`,
100
+ t instanceof Error ? t : new Error(String(t))
101
+ ), [];
102
+ }
103
+ },
104
+ watch: () => y,
105
+ exclusiveWriter: !1
106
+ };
107
+ }
108
+ function l(a) {
109
+ return a !== null && typeof a == "object" && "code" in a && a.code === "ENOENT";
110
+ }
111
+ async function E(a) {
112
+ try {
113
+ const { stdout: s } = await u("git", ["ls-files"], {
114
+ cwd: a
115
+ }), { stdout: r } = await u(
116
+ "git",
117
+ ["ls-files", "--others", "--exclude-standard"],
118
+ {
119
+ cwd: a
120
+ }
121
+ );
122
+ return [...s.split(`
123
+ `), ...r.split(`
124
+ `)].filter(Boolean);
125
+ } catch {
126
+ return [];
127
+ }
128
+ }
129
+ export {
130
+ E as listFilesGit,
131
+ B as nodeFileSystem
132
+ };
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
- import { p as f } from "./index-obyovEcz.js";
3
- import { aC as m, g, m as c, aN as h, aO as d, aP as b, aQ as E, c as S, O as _ } from "./console-Dvb4mlt2.js";
4
- import { r as v } from "./executable-BnwRQX_M.js";
2
+ import { p as f } from "./index-C2Ke9iUN.js";
3
+ import { aC as m, g, m as c, aN as h, aO as d, aP as b, aQ as E, c as S, O as _ } from "./console-T6r_4D-k.js";
4
+ import { r as v } from "./executable-BiJzVjpG.js";
5
5
  const O = ({ args: a }, { dirs: s }) => {
6
6
  for (const e of s)
7
7
  m(e);
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import * as le from "node:os";
3
3
  import ee, { resolve as fe } from "node:path";
4
- import { aT as de, aU as _e, C as pe, aV as ne, aW as ge, aX as ve, aI as oe, aQ as me, aH as be, aC as Se, O as se } from "./console-Dvb4mlt2.js";
5
- import { loadProfileEnvironmentVariables as Ce } from "./load-profile-DfwAD194.js";
4
+ import { aT as de, aU as _e, C as pe, aV as ne, aW as ge, aX as ve, aI as oe, aQ as me, aH as be, aC as Se, O as se } from "./console-T6r_4D-k.js";
5
+ import { loadProfileEnvironmentVariables as Ce } from "./load-profile-BjFcSiC-.js";
6
6
  const ye = [
7
7
  // Basic read/info operations
8
8
  "ls",
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a9 as Pe, a8 as st, p as lt } from "./console-Dvb4mlt2.js";
2
+ import { a9 as Pe, a8 as st, p as lt } from "./console-T6r_4D-k.js";
3
3
  var pe = {}, Pu = {}, be = {}, Me;
4
4
  function ne() {
5
5
  return Me || (Me = 1, function(u) {
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { i as a, F as c, f as i } from "./client-D-IY-U_F.js";
3
- import { p as m, aR as l } from "./console-Dvb4mlt2.js";
2
+ import { i as a, F as c, f as i } from "./client-CVbnd4Z8.js";
3
+ import { p as m, aR as l } from "./console-T6r_4D-k.js";
4
4
  const h = ({ args: e }, { threadID: o }) => m(async (s) => {
5
5
  try {
6
6
  const r = await a.webSearch(
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { aK as F, p as d } from "./console-Dvb4mlt2.js";
2
+ import { aK as F, p as d } from "./console-T6r_4D-k.js";
3
3
  const s = ({ args: n }, { dir: o, dirs: r, threadID: a, filesystem: e }) => {
4
4
  const t = F({ readFileFn: e.readFile });
5
5
  return d(
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env node
2
- import { a9 as ee, z as re } from "./console-Dvb4mlt2.js";
2
+ import { a9 as ee, z as re } from "./console-T6r_4D-k.js";
3
3
  import ne from "node:child_process";
4
4
  import D from "node:path";
5
5
  import L from "node:fs";
6
6
  import R from "node:process";
7
7
  import { PassThrough as te } from "node:stream";
8
- import { J as se } from "./main-Dj2IQaGB.js";
8
+ import { J as se } from "./main-CMXyYqec.js";
9
9
  var S = { exports: {} }, T, k;
10
10
  function oe() {
11
11
  if (k) return T;
package/dist/storybook.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { av as r, aA as a, an as c, aB as d, at as f, au as x, af as b, as as I } from "./console-Dvb4mlt2.js";
2
+ import { av as r, aA as a, an as c, aB as d, at as f, au as x, af as b, as as I } from "./console-T6r_4D-k.js";
3
3
  import { stdout as s } from "node:process";
4
4
  import { parseArgs as w } from "node:util";
5
5
  function D() {
@@ -3,7 +3,7 @@ import E from "node:crypto";
3
3
  import d, { writeFile as D } from "node:fs/promises";
4
4
  import g from "node:os";
5
5
  import a from "node:path";
6
- import { C as p, p as C, aC as F, aL as b, aM as _ } from "./console-Dvb4mlt2.js";
6
+ import { C as p, p as C, aC as F, aL as b, aM as _ } from "./console-T6r_4D-k.js";
7
7
  class v {
8
8
  MAX_TRACKED_EDITS = 50;
9
9
  editQueue = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sourcegraph/amp",
3
- "version": "0.0.1749326478-g6cda64",
3
+ "version": "0.0.1749355713-g05a6d7",
4
4
  "description": "CLI for Amp, an agentic coding tool in research preview from Sourcegraph.",
5
5
  "homepage": "https://ampcode.com/",
6
6
  "author": {
@@ -1,112 +0,0 @@
1
- #!/usr/bin/env node
2
- import { execFile as m } from "node:child_process";
3
- import * as i from "node:fs";
4
- import * as o from "node:path";
5
- import { join as f } from "node:path";
6
- import { promisify as p } from "node:util";
7
- import { C as l, aJ as n } from "./console-Dvb4mlt2.js";
8
- import { homedir as w } from "node:os";
9
- const d = f(w(), ".amp", "file-changes"), u = p(m);
10
- function b(a) {
11
- const s = o.join(d, a);
12
- return {
13
- relativePath: (r, t) => o.relative(r, t),
14
- joinPath: (...r) => o.join(...r),
15
- readFile: async (r, t) => {
16
- try {
17
- return await i.promises.readFile(r, { encoding: "utf8", signal: t });
18
- } catch (e) {
19
- throw c(e) ? new n(r) : e;
20
- }
21
- },
22
- readBinaryFile: async (r, t) => {
23
- try {
24
- return await i.promises.readFile(r, { signal: t });
25
- } catch (e) {
26
- throw c(e) ? new n(r) : e;
27
- }
28
- },
29
- getMtime: async (r, t) => {
30
- try {
31
- return (await i.promises.stat(r)).mtimeMs;
32
- } catch (e) {
33
- throw c(e) ? new n(r) : e;
34
- }
35
- },
36
- stat: async (r) => {
37
- try {
38
- return {
39
- size: (await i.promises.stat(r)).size
40
- };
41
- } catch (t) {
42
- throw c(t) ? new n(r) : t;
43
- }
44
- },
45
- writeFile: async (r, t, e) => {
46
- await i.promises.writeFile(r, t, { encoding: "utf-8", signal: e });
47
- },
48
- deleteFile: async (r, t) => {
49
- try {
50
- await i.promises.unlink(r);
51
- } catch (e) {
52
- throw c(e) ? new n(r) : e;
53
- }
54
- },
55
- mkdirp: async (r) => {
56
- await i.promises.mkdir(r, { recursive: !0 });
57
- },
58
- storeFileChange: async (r, t) => {
59
- const e = o.join(s, r);
60
- await i.promises.writeFile(e, JSON.stringify(t, null, 2), "utf8");
61
- },
62
- listBackupFiles: async () => {
63
- try {
64
- return await i.promises.stat(s).then((r) => r.isDirectory()).catch(() => !1) ? await i.promises.readdir(s) : (await i.promises.mkdir(s, { recursive: !0 }), []);
65
- } catch (r) {
66
- return l.error("Error listing backup files:", r), [];
67
- }
68
- },
69
- loadFileChange: async (r) => {
70
- try {
71
- const t = o.join(s, r), e = await i.promises.readFile(t, "utf8");
72
- return JSON.parse(e);
73
- } catch (t) {
74
- return l.error(`Error loading backup file ${r}:`, t), null;
75
- }
76
- },
77
- cleanupBackupFiles: async () => {
78
- try {
79
- await i.promises.stat(s).then((r) => r.isDirectory()).catch(() => !1) && (await i.promises.rm(s, { recursive: !0, force: !0 }), l.debug(`Cleaned up backup directory: ${s}`));
80
- } catch (r) {
81
- l.error(`Error cleaning up backup files in ${s}:`, r);
82
- }
83
- },
84
- listFiles: async (r) => y(r),
85
- exclusiveWriter: !1
86
- };
87
- }
88
- function c(a) {
89
- return a !== null && typeof a == "object" && "code" in a && a.code === "ENOENT";
90
- }
91
- async function y(a) {
92
- try {
93
- const { stdout: s } = await u("git", ["ls-files"], {
94
- cwd: a
95
- }), { stdout: r } = await u(
96
- "git",
97
- ["ls-files", "--others", "--exclude-standard"],
98
- {
99
- cwd: a
100
- }
101
- );
102
- return [...s.split(`
103
- `), ...r.split(`
104
- `)].filter(Boolean);
105
- } catch {
106
- return [];
107
- }
108
- }
109
- export {
110
- y as listFilesGit,
111
- b as nodeFileSystem
112
- };