@entelligentsia/forgecli 0.7.10 → 0.8.4
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/CHANGELOG.md +74 -0
- package/dist/CHANGELOG-forge-plugin.md +70 -0
- package/dist/CHANGELOG-pi.md +63 -0
- package/dist/bin/argv.d.ts +2 -2
- package/dist/bin/argv.js +10 -0
- package/dist/bin/argv.js.map +1 -1
- package/dist/bin/env-defaults.d.ts +1 -0
- package/dist/bin/env-defaults.js +13 -0
- package/dist/bin/env-defaults.js.map +1 -0
- package/dist/bin/forge.js +9 -0
- package/dist/bin/forge.js.map +1 -1
- package/dist/bin/update-cli.d.ts +9 -0
- package/dist/bin/update-cli.js +120 -0
- package/dist/bin/update-cli.js.map +1 -0
- package/dist/extensions/forgecli/index.js +3 -3
- package/dist/extensions/forgecli/index.js.map +1 -1
- package/dist/extensions/forgecli/update-check.js +1 -1
- package/dist/extensions/forgecli/update-check.js.map +1 -1
- package/dist/extensions/forgecli/whats-new-widget.d.ts +5 -5
- package/dist/extensions/forgecli/whats-new-widget.js +11 -11
- package/dist/extensions/forgecli/whats-new-widget.js.map +1 -1
- package/dist/extensions/forgecli/whats-new.js +6 -5
- package/dist/extensions/forgecli/whats-new.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +27 -98
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +62 -132
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +25 -15
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +17 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +8 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +17 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +8 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +63 -0
- package/node_modules/@earendil-works/pi-coding-agent/README.md +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/config-selector.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js +6 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +12 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +30 -15
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.d.ts +3 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +23 -13
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js +58 -38
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.js +0 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/slash-commands.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +3 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js +7 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +6 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js +3 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/package-manager-cli.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/changelog.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts +7 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js +60 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/child-process.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/packages.md +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +1 -3
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
- package/node_modules/@earendil-works/pi-tui/package.json +2 -2
- package/node_modules/@protobufjs/fetch/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/fetch/index.d.ts +7 -7
- package/node_modules/@protobufjs/fetch/index.js +4 -7
- package/node_modules/@protobufjs/fetch/package.json +7 -5
- package/node_modules/@protobufjs/fetch/tests/data/file.txt +1 -0
- package/node_modules/@protobufjs/fetch/tests/index.js +150 -8
- package/node_modules/@protobufjs/fetch/util/fs.js +11 -0
- package/node_modules/@protobufjs/inquire/CHANGELOG.md +8 -0
- package/node_modules/@protobufjs/inquire/index.d.ts +1 -0
- package/node_modules/@protobufjs/inquire/index.js +1 -0
- package/node_modules/@protobufjs/inquire/package.json +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.js +187 -153
- package/node_modules/protobufjs/dist/light/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/light/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/light/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.js +14 -5
- package/node_modules/protobufjs/dist/minimal/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/minimal/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.js +207 -173
- package/node_modules/protobufjs/dist/protobuf.js.map +1 -1
- package/node_modules/protobufjs/dist/protobuf.min.js +3 -3
- package/node_modules/protobufjs/dist/protobuf.min.js.map +1 -1
- package/node_modules/protobufjs/package.json +6 -3
- package/node_modules/protobufjs/src/util/fs.js +11 -0
- package/node_modules/protobufjs/src/util/minimal.js +10 -2
- package/node_modules/protobufjs/src/util.js +1 -1
- package/node_modules/undici/README.md +14 -5
- package/node_modules/undici/docs/docs/api/Client.md +4 -2
- package/node_modules/undici/docs/docs/api/Dispatcher.md +62 -27
- package/node_modules/undici/docs/docs/api/GlobalInstallation.md +7 -5
- package/node_modules/undici/docs/docs/api/H2CClient.md +1 -1
- package/node_modules/undici/docs/docs/api/RedirectHandler.md +14 -9
- package/node_modules/undici/docs/docs/api/RetryAgent.md +0 -1
- package/node_modules/undici/docs/docs/api/RetryHandler.md +12 -14
- package/node_modules/undici/docs/docs/api/SnapshotAgent.md +23 -0
- package/node_modules/undici/docs/docs/best-practices/migrating-from-v7-to-v8.md +231 -0
- package/node_modules/undici/index.js +4 -2
- package/node_modules/undici/lib/api/api-connect.js +13 -11
- package/node_modules/undici/lib/api/api-pipeline.js +26 -13
- package/node_modules/undici/lib/api/api-request.js +45 -21
- package/node_modules/undici/lib/api/api-stream.js +81 -20
- package/node_modules/undici/lib/api/api-upgrade.js +21 -11
- package/node_modules/undici/lib/api/readable.js +3 -2
- package/node_modules/undici/lib/cache/memory-cache-store.js +1 -1
- package/node_modules/undici/lib/cache/sqlite-cache-store.js +6 -4
- package/node_modules/undici/lib/core/connect.js +17 -1
- package/node_modules/undici/lib/core/constants.js +1 -24
- package/node_modules/undici/lib/core/errors.js +2 -2
- package/node_modules/undici/lib/core/request.js +115 -18
- package/node_modules/undici/lib/core/socks5-client.js +24 -9
- package/node_modules/undici/lib/core/socks5-utils.js +32 -23
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/core/util.js +70 -43
- package/node_modules/undici/lib/dispatcher/agent.js +47 -33
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +21 -26
- package/node_modules/undici/lib/dispatcher/client-h1.js +98 -39
- package/node_modules/undici/lib/dispatcher/client-h2.js +603 -272
- package/node_modules/undici/lib/dispatcher/client.js +12 -5
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +24 -5
- package/node_modules/undici/lib/dispatcher/dispatcher.js +0 -4
- package/node_modules/undici/lib/dispatcher/dispatcher1-wrapper.js +107 -0
- package/node_modules/undici/lib/dispatcher/h2c-client.js +5 -5
- package/node_modules/undici/lib/dispatcher/pool-base.js +28 -10
- package/node_modules/undici/lib/dispatcher/pool.js +31 -6
- package/node_modules/undici/lib/dispatcher/proxy-agent.js +38 -13
- package/node_modules/undici/lib/dispatcher/round-robin-pool.js +31 -9
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +95 -80
- package/node_modules/undici/lib/global.js +13 -1
- package/node_modules/undici/lib/handler/cache-handler.js +16 -8
- package/node_modules/undici/lib/handler/decorator-handler.js +1 -2
- package/node_modules/undici/lib/handler/redirect-handler.js +5 -51
- package/node_modules/undici/lib/handler/retry-handler.js +15 -2
- package/node_modules/undici/lib/interceptor/cache.js +30 -17
- package/node_modules/undici/lib/interceptor/decompress.js +28 -2
- package/node_modules/undici/lib/interceptor/dns.js +1 -1
- package/node_modules/undici/lib/interceptor/redirect.js +3 -3
- package/node_modules/undici/lib/llhttp/llhttp-wasm.js +1 -1
- package/node_modules/undici/lib/llhttp/llhttp_simd-wasm.js +1 -1
- package/node_modules/undici/lib/mock/mock-agent.js +8 -8
- package/node_modules/undici/lib/mock/mock-call-history.js +15 -15
- package/node_modules/undici/lib/mock/mock-utils.js +37 -22
- package/node_modules/undici/lib/mock/snapshot-agent.js +16 -6
- package/node_modules/undici/lib/mock/snapshot-recorder.js +38 -3
- package/node_modules/undici/lib/util/cache.js +8 -7
- package/node_modules/undici/lib/util/runtime-features.js +3 -34
- package/node_modules/undici/lib/web/cache/cache.js +6 -8
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +245 -150
- package/node_modules/undici/lib/web/fetch/body.js +3 -9
- package/node_modules/undici/lib/web/fetch/formdata-parser.js +17 -6
- package/node_modules/undici/lib/web/fetch/formdata.js +21 -2
- package/node_modules/undici/lib/web/fetch/index.js +214 -221
- package/node_modules/undici/lib/web/webidl/index.js +7 -9
- package/node_modules/undici/lib/web/websocket/frame.js +1 -7
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +13 -31
- package/node_modules/undici/lib/web/websocket/receiver.js +62 -22
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +11 -17
- package/node_modules/undici/lib/web/websocket/websocket.js +6 -1
- package/node_modules/undici/package.json +9 -9
- package/node_modules/undici/types/agent.d.ts +0 -2
- package/node_modules/undici/types/client.d.ts +25 -19
- package/node_modules/undici/types/dispatcher.d.ts +7 -27
- package/node_modules/undici/types/dispatcher1-wrapper.d.ts +7 -0
- package/node_modules/undici/types/formdata.d.ts +0 -6
- package/node_modules/undici/types/h2c-client.d.ts +6 -6
- package/node_modules/undici/types/header.d.ts +5 -0
- package/node_modules/undici/types/index.d.ts +3 -1
- package/node_modules/undici/types/interceptors.d.ts +1 -1
- package/node_modules/undici/types/pool.d.ts +0 -2
- package/node_modules/undici/types/proxy-agent.d.ts +2 -2
- package/node_modules/undici/types/round-robin-pool.d.ts +0 -2
- package/node_modules/undici/types/snapshot-agent.d.ts +4 -0
- package/node_modules/undici/types/socks5-proxy-agent.d.ts +2 -2
- package/node_modules/undici/types/webidl.d.ts +0 -1
- package/package.json +7 -8
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package-lock.json +0 -24
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package-lock.json +0 -92
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package-lock.json +0 -31
- package/node_modules/undici/lib/handler/unwrap-handler.js +0 -100
- package/node_modules/undici/lib/handler/wrap-handler.js +0 -105
- package/node_modules/undici/lib/llhttp/.gitkeep +0 -0
- package/node_modules/undici/lib/util/promise.js +0 -28
- package/skills/refresh-kb-links/SKILL.md +0 -217
- package/skills/store-custodian/SKILL.md +0 -163
- package/skills/store-query-grammar/SKILL.md +0 -145
- package/skills/store-query-nlp/SKILL.md +0 -110
|
@@ -26,7 +26,7 @@ import { globSync } from "glob";
|
|
|
26
26
|
import ignore from "ignore";
|
|
27
27
|
import { minimatch } from "minimatch";
|
|
28
28
|
import { CONFIG_DIR_NAME } from "../config.js";
|
|
29
|
-
import {
|
|
29
|
+
import { resolveSpawnCommand } from "../utils/child-process.js";
|
|
30
30
|
import { parseGitUrl } from "../utils/git.js";
|
|
31
31
|
import { canonicalizePath, isLocalPath } from "../utils/paths.js";
|
|
32
32
|
import { isStdoutTakenOver } from "./output-guard.js";
|
|
@@ -845,7 +845,7 @@ export class DefaultPackageManager {
|
|
|
845
845
|
await Promise.all(tasks);
|
|
846
846
|
}
|
|
847
847
|
async shouldUpdateNpmSource(source, scope) {
|
|
848
|
-
const installedPath = this.
|
|
848
|
+
const installedPath = this.getManagedNpmInstallPath(source, scope);
|
|
849
849
|
const installedVersion = existsSync(installedPath) ? this.getInstalledNpmVersion(installedPath) : undefined;
|
|
850
850
|
if (!installedVersion) {
|
|
851
851
|
return true;
|
|
@@ -871,13 +871,9 @@ export class DefaultPackageManager {
|
|
|
871
871
|
});
|
|
872
872
|
}
|
|
873
873
|
async installNpmBatch(specs, scope) {
|
|
874
|
-
if (scope === "user") {
|
|
875
|
-
await this.runNpmCommand(["install", "-g", ...specs]);
|
|
876
|
-
return;
|
|
877
|
-
}
|
|
878
874
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
879
875
|
this.ensureNpmProject(installRoot);
|
|
880
|
-
await this.runNpmCommand(
|
|
876
|
+
await this.runNpmCommand(this.getNpmInstallArgs(specs, installRoot));
|
|
881
877
|
}
|
|
882
878
|
async checkForAvailableUpdates() {
|
|
883
879
|
if (isOfflineModeEnabled()) {
|
|
@@ -1364,6 +1360,13 @@ export class DefaultPackageManager {
|
|
|
1364
1360
|
}
|
|
1365
1361
|
return { command, args };
|
|
1366
1362
|
}
|
|
1363
|
+
getPackageManagerName() {
|
|
1364
|
+
const npmCommand = this.getNpmCommand();
|
|
1365
|
+
const commandParts = [npmCommand.command, ...npmCommand.args];
|
|
1366
|
+
const separatorIndex = commandParts.lastIndexOf("--");
|
|
1367
|
+
const packageManagerCommand = separatorIndex >= 0 ? commandParts[separatorIndex + 1] : npmCommand.command;
|
|
1368
|
+
return packageManagerCommand ? basename(packageManagerCommand).replace(/\.(cmd|exe)$/i, "") : "";
|
|
1369
|
+
}
|
|
1367
1370
|
async runNpmCommand(args, options) {
|
|
1368
1371
|
const npmCommand = this.getNpmCommand();
|
|
1369
1372
|
await this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);
|
|
@@ -1379,24 +1382,30 @@ export class DefaultPackageManager {
|
|
|
1379
1382
|
const npmCommand = this.getNpmCommand();
|
|
1380
1383
|
return this.runCommandSync(npmCommand.command, [...npmCommand.args, ...args]);
|
|
1381
1384
|
}
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
return;
|
|
1385
|
+
getNpmInstallArgs(specs, installRoot) {
|
|
1386
|
+
const packageManagerName = this.getPackageManagerName();
|
|
1387
|
+
if (packageManagerName === "bun") {
|
|
1388
|
+
return ["install", ...specs, "--cwd", installRoot];
|
|
1386
1389
|
}
|
|
1390
|
+
if (packageManagerName === "pnpm") {
|
|
1391
|
+
return ["install", ...specs, "--prefix", installRoot, "--config.strict-dep-builds=false"];
|
|
1392
|
+
}
|
|
1393
|
+
return ["install", ...specs, "--prefix", installRoot];
|
|
1394
|
+
}
|
|
1395
|
+
async installNpm(source, scope, temporary) {
|
|
1387
1396
|
const installRoot = this.getNpmInstallRoot(scope, temporary);
|
|
1388
1397
|
this.ensureNpmProject(installRoot);
|
|
1389
|
-
await this.runNpmCommand([
|
|
1398
|
+
await this.runNpmCommand(this.getNpmInstallArgs([source.spec], installRoot));
|
|
1390
1399
|
}
|
|
1391
1400
|
async uninstallNpm(source, scope) {
|
|
1392
|
-
if (scope === "user") {
|
|
1393
|
-
await this.runNpmCommand(["uninstall", "-g", source.name]);
|
|
1394
|
-
return;
|
|
1395
|
-
}
|
|
1396
1401
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
1397
1402
|
if (!existsSync(installRoot)) {
|
|
1398
1403
|
return;
|
|
1399
1404
|
}
|
|
1405
|
+
if (this.getPackageManagerName() === "bun") {
|
|
1406
|
+
await this.runNpmCommand(["uninstall", source.name, "--cwd", installRoot]);
|
|
1407
|
+
return;
|
|
1408
|
+
}
|
|
1400
1409
|
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
|
|
1401
1410
|
}
|
|
1402
1411
|
async installGit(source, scope) {
|
|
@@ -1516,7 +1525,7 @@ export class DefaultPackageManager {
|
|
|
1516
1525
|
if (scope === "project") {
|
|
1517
1526
|
return join(this.cwd, CONFIG_DIR_NAME, "npm");
|
|
1518
1527
|
}
|
|
1519
|
-
return join(this.
|
|
1528
|
+
return join(this.agentDir, "npm");
|
|
1520
1529
|
}
|
|
1521
1530
|
getGlobalNpmRoot() {
|
|
1522
1531
|
const npmCommand = this.getNpmCommand();
|
|
@@ -1524,8 +1533,7 @@ export class DefaultPackageManager {
|
|
|
1524
1533
|
if (this.globalNpmRoot && this.globalNpmRootCommandKey === commandKey) {
|
|
1525
1534
|
return this.globalNpmRoot;
|
|
1526
1535
|
}
|
|
1527
|
-
|
|
1528
|
-
if (isBunPackageManager) {
|
|
1536
|
+
if (this.getPackageManagerName() === "bun") {
|
|
1529
1537
|
const binDir = this.runNpmCommandSync(["pm", "bin", "-g"]).trim();
|
|
1530
1538
|
this.globalNpmRoot = join(dirname(binDir), "install", "global", "node_modules");
|
|
1531
1539
|
}
|
|
@@ -1536,14 +1544,7 @@ export class DefaultPackageManager {
|
|
|
1536
1544
|
return this.globalNpmRoot;
|
|
1537
1545
|
}
|
|
1538
1546
|
getPnpmGlobalPackagePath(packageName) {
|
|
1539
|
-
|
|
1540
|
-
const commandParts = [npmCommand.command, ...npmCommand.args];
|
|
1541
|
-
const separatorIndex = commandParts.lastIndexOf("--");
|
|
1542
|
-
const packageManagerCommand = separatorIndex >= 0 ? commandParts[separatorIndex + 1] : npmCommand.command;
|
|
1543
|
-
const packageManagerName = packageManagerCommand
|
|
1544
|
-
? basename(packageManagerCommand).replace(/\.(cmd|exe)$/i, "")
|
|
1545
|
-
: "";
|
|
1546
|
-
if (packageManagerName !== "pnpm") {
|
|
1547
|
+
if (this.getPackageManagerName() !== "pnpm") {
|
|
1547
1548
|
return undefined;
|
|
1548
1549
|
}
|
|
1549
1550
|
const output = this.runNpmCommandSync(["list", "-g", "--depth", "0", "--json"]);
|
|
@@ -1555,14 +1556,30 @@ export class DefaultPackageManager {
|
|
|
1555
1556
|
}
|
|
1556
1557
|
return undefined;
|
|
1557
1558
|
}
|
|
1558
|
-
|
|
1559
|
+
getManagedNpmInstallPath(source, scope) {
|
|
1559
1560
|
if (scope === "temporary") {
|
|
1560
1561
|
return join(this.getTemporaryDir("npm"), "node_modules", source.name);
|
|
1561
1562
|
}
|
|
1562
1563
|
if (scope === "project") {
|
|
1563
1564
|
return join(this.cwd, CONFIG_DIR_NAME, "npm", "node_modules", source.name);
|
|
1564
1565
|
}
|
|
1565
|
-
return
|
|
1566
|
+
return join(this.agentDir, "npm", "node_modules", source.name);
|
|
1567
|
+
}
|
|
1568
|
+
getLegacyGlobalNpmInstallPath(source) {
|
|
1569
|
+
try {
|
|
1570
|
+
return this.getPnpmGlobalPackagePath(source.name) ?? join(this.getGlobalNpmRoot(), source.name);
|
|
1571
|
+
}
|
|
1572
|
+
catch {
|
|
1573
|
+
return undefined;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
getNpmInstallPath(source, scope) {
|
|
1577
|
+
const managedPath = this.getManagedNpmInstallPath(source, scope);
|
|
1578
|
+
if (scope !== "user" || existsSync(managedPath)) {
|
|
1579
|
+
return managedPath;
|
|
1580
|
+
}
|
|
1581
|
+
const legacyPath = this.getLegacyGlobalNpmInstallPath(source);
|
|
1582
|
+
return legacyPath && existsSync(legacyPath) ? legacyPath : managedPath;
|
|
1566
1583
|
}
|
|
1567
1584
|
getGitInstallPath(source, scope) {
|
|
1568
1585
|
if (scope === "temporary") {
|
|
@@ -1911,20 +1928,22 @@ export class DefaultPackageManager {
|
|
|
1911
1928
|
};
|
|
1912
1929
|
}
|
|
1913
1930
|
spawnCommand(command, args, options) {
|
|
1914
|
-
|
|
1931
|
+
const env = getEnv();
|
|
1932
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
1933
|
+
return spawn(resolved.command, resolved.args, {
|
|
1915
1934
|
cwd: options?.cwd,
|
|
1916
1935
|
stdio: isStdoutTakenOver() ? ["ignore", 2, 2] : "inherit",
|
|
1917
|
-
|
|
1918
|
-
env: getEnv(),
|
|
1936
|
+
env,
|
|
1919
1937
|
});
|
|
1920
1938
|
}
|
|
1921
1939
|
spawnCaptureCommand(command, args, options) {
|
|
1922
1940
|
const baseEnv = getEnv();
|
|
1923
|
-
|
|
1941
|
+
const env = options?.env ? { ...baseEnv, ...options.env } : baseEnv;
|
|
1942
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
1943
|
+
return spawn(resolved.command, resolved.args, {
|
|
1924
1944
|
cwd: options?.cwd,
|
|
1925
1945
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1926
|
-
|
|
1927
|
-
env: options?.env ? { ...baseEnv, ...options.env } : baseEnv,
|
|
1946
|
+
env,
|
|
1928
1947
|
});
|
|
1929
1948
|
}
|
|
1930
1949
|
runCommandCapture(command, args, options) {
|
|
@@ -1981,11 +2000,12 @@ export class DefaultPackageManager {
|
|
|
1981
2000
|
});
|
|
1982
2001
|
}
|
|
1983
2002
|
runCommandSync(command, args) {
|
|
1984
|
-
const
|
|
2003
|
+
const env = getEnv();
|
|
2004
|
+
const resolved = resolveSpawnCommand(command, args, { env });
|
|
2005
|
+
const result = spawnSync(resolved.command, resolved.args, {
|
|
1985
2006
|
stdio: ["ignore", "pipe", "pipe"],
|
|
1986
2007
|
encoding: "utf-8",
|
|
1987
|
-
|
|
1988
|
-
env: getEnv(),
|
|
2008
|
+
env,
|
|
1989
2009
|
});
|
|
1990
2010
|
if (result.error || result.status !== 0) {
|
|
1991
2011
|
throw new Error(`Failed to run ${command} ${args.join(" ")}: ${result.error?.message || result.stderr || result.stdout}`);
|