amp-acp 0.6.0 → 0.6.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/dist/index.js +28 -6
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -9276,7 +9276,28 @@ function findAmpCommand() {
|
|
|
9276
9276
|
if (error instanceof Error && error.message.includes("Local @sourcegraph/amp")) {
|
|
9277
9277
|
throw error;
|
|
9278
9278
|
}
|
|
9279
|
-
|
|
9279
|
+
// Fallback: look for amp CLI in well-known locations and PATH
|
|
9280
|
+
const { execFileSync } = require("node:child_process");
|
|
9281
|
+
const os = require("node:os");
|
|
9282
|
+
const candidates = [];
|
|
9283
|
+
const homeDir = os.homedir();
|
|
9284
|
+
candidates.push(path.join(homeDir, ".amp", "bin", "amp"));
|
|
9285
|
+
if (process.platform === "win32") {
|
|
9286
|
+
candidates.push(path.join(homeDir, ".amp", "bin", "amp.exe"));
|
|
9287
|
+
}
|
|
9288
|
+
for (const candidate of candidates) {
|
|
9289
|
+
if (fs.existsSync(candidate)) {
|
|
9290
|
+
return { command: candidate, args: [] };
|
|
9291
|
+
}
|
|
9292
|
+
}
|
|
9293
|
+
try {
|
|
9294
|
+
const whichCmd = process.platform === "win32" ? "where" : "which";
|
|
9295
|
+
const result = execFileSync(whichCmd, ["amp"], { encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] }).trim();
|
|
9296
|
+
if (result) {
|
|
9297
|
+
return { command: result, args: [] };
|
|
9298
|
+
}
|
|
9299
|
+
} catch {}
|
|
9300
|
+
throw new Error("Could not find amp CLI. Install it from https://ampcode.com or ensure @sourcegraph/amp is available.");
|
|
9280
9301
|
}
|
|
9281
9302
|
}
|
|
9282
9303
|
function buildCliArgs(options) {
|
|
@@ -9535,7 +9556,7 @@ function safeJson(x) {
|
|
|
9535
9556
|
// package.json
|
|
9536
9557
|
var package_default = {
|
|
9537
9558
|
name: "amp-acp",
|
|
9538
|
-
version: "0.6.
|
|
9559
|
+
version: "0.6.1",
|
|
9539
9560
|
private: false,
|
|
9540
9561
|
type: "module",
|
|
9541
9562
|
main: "dist/index.js",
|
|
@@ -9552,12 +9573,12 @@ var package_default = {
|
|
|
9552
9573
|
url: "https://github.com/tao12345666333/amp-acp"
|
|
9553
9574
|
},
|
|
9554
9575
|
scripts: {
|
|
9555
|
-
build: "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js",
|
|
9556
|
-
"build:binary": "bun build src/index.ts --compile --outfile dist/amp-acp",
|
|
9576
|
+
build: "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts",
|
|
9577
|
+
"build:binary": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts && bun build dist/index.js --compile --outfile dist/amp-acp",
|
|
9557
9578
|
start: "bun dist/index.js",
|
|
9558
9579
|
lint: "tsc --noEmit",
|
|
9559
9580
|
test: "bun test src/",
|
|
9560
|
-
"test:binary": "bun build src/index.ts --compile --outfile dist/amp-acp-test && bun test test/binary.test.ts",
|
|
9581
|
+
"test:binary": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts && bun build dist/index.js --compile --outfile dist/amp-acp-test && bun test test/binary.test.ts",
|
|
9561
9582
|
"test:all": "bun run test && bun run test:binary"
|
|
9562
9583
|
},
|
|
9563
9584
|
dependencies: {
|
|
@@ -9683,7 +9704,8 @@ ${chunk.resource.text}
|
|
|
9683
9704
|
}
|
|
9684
9705
|
}
|
|
9685
9706
|
const options = {
|
|
9686
|
-
cwd: s.cwd
|
|
9707
|
+
cwd: s.cwd,
|
|
9708
|
+
env: { TERM: "dumb" }
|
|
9687
9709
|
};
|
|
9688
9710
|
if (s.mode === "bypass") {
|
|
9689
9711
|
options.dangerouslyAllowAll = true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "amp-acp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"url": "https://github.com/tao12345666333/amp-acp"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js",
|
|
21
|
-
"build:binary": "bun build src/index.ts --compile --outfile dist/amp-acp",
|
|
20
|
+
"build": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts",
|
|
21
|
+
"build:binary": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts && bun build dist/index.js --compile --outfile dist/amp-acp",
|
|
22
22
|
"start": "bun dist/index.js",
|
|
23
23
|
"lint": "tsc --noEmit",
|
|
24
24
|
"test": "bun test src/",
|
|
25
|
-
"test:binary": "bun build src/index.ts --compile --outfile dist/amp-acp-test && bun test test/binary.test.ts",
|
|
25
|
+
"test:binary": "bun build src/index.ts --target=node --outdir=dist --entry-naming=[dir]/[name].js && bun scripts/patch-find-amp.ts && bun build dist/index.js --compile --outfile dist/amp-acp-test && bun test test/binary.test.ts",
|
|
26
26
|
"test:all": "bun run test && bun run test:binary"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|