diff --git a/bun.lock b/bun.lock index fc96627961..6dea120fa8 100644 --- a/bun.lock +++ b/bun.lock @@ -354,6 +354,7 @@ "@lydell/node-pty": "catalog:", "@modelcontextprotocol/sdk": "1.27.1", "@npmcli/arborist": "9.4.0", + "@npmcli/config": "10.8.1", "@octokit/graphql": "9.0.2", "@octokit/rest": "catalog:", "@openauthjs/openauth": "catalog:", @@ -660,6 +661,7 @@ "patchedDependencies": { "solid-js@1.9.10": "patches/solid-js@1.9.10.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", + "@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch", }, "overrides": { "@types/bun": "catalog:", @@ -1468,6 +1470,8 @@ "@npmcli/arborist": ["@npmcli/arborist@9.4.0", "", { "dependencies": { "@isaacs/string-locale-compare": "^1.1.0", "@npmcli/fs": "^5.0.0", "@npmcli/installed-package-contents": "^4.0.0", "@npmcli/map-workspaces": "^5.0.0", "@npmcli/metavuln-calculator": "^9.0.2", "@npmcli/name-from-folder": "^4.0.0", "@npmcli/node-gyp": "^5.0.0", "@npmcli/package-json": "^7.0.0", "@npmcli/query": "^5.0.0", "@npmcli/redact": "^4.0.0", "@npmcli/run-script": "^10.0.0", "bin-links": "^6.0.0", "cacache": "^20.0.1", "common-ancestor-path": "^2.0.0", "hosted-git-info": "^9.0.0", "json-stringify-nice": "^1.1.4", "lru-cache": "^11.2.1", "minimatch": "^10.0.3", "nopt": "^9.0.0", "npm-install-checks": "^8.0.0", "npm-package-arg": "^13.0.0", "npm-pick-manifest": "^11.0.1", "npm-registry-fetch": "^19.0.0", "pacote": "^21.0.2", "parse-conflict-json": "^5.0.1", "proc-log": "^6.0.0", "proggy": "^4.0.0", "promise-all-reject-late": "^1.0.0", "promise-call-limit": "^3.0.1", "semver": "^7.3.7", "ssri": "^13.0.0", "treeverse": "^3.0.0", "walk-up-path": "^4.0.0" }, "bin": { "arborist": "bin/index.js" } }, "sha512-4Bm8hNixJG/sii1PMnag0V9i/sGOX9VRzFrUiZMSBJpGlLR38f+Btl85d07G9GL56xO0l0OZjvrGNYsDYp0xKA=="], + "@npmcli/config": ["@npmcli/config@10.8.1", "", { "dependencies": { "@npmcli/map-workspaces": "^5.0.0", "@npmcli/package-json": "^7.0.0", "ci-info": "^4.0.0", "ini": "^6.0.0", "nopt": "^9.0.0", "proc-log": "^6.0.0", "semver": "^7.3.5", "walk-up-path": "^4.0.0" } }, "sha512-MAYk9IlIGiyC0c9fnjdBSQfIFPZT0g1MfeSiD1UXTq2zJOLX55jS9/sETJHqw/7LN18JjITrhYfgCfapbmZHiQ=="], + "@npmcli/fs": ["@npmcli/fs@5.0.0", "", { "dependencies": { "semver": "^7.3.5" } }, "sha512-7OsC1gNORBEawOa5+j2pXN9vsicaIOH5cPXxoR6fJOmH6/EXpJB2CajXOu1fPRFun2m1lktEFX11+P89hqO/og=="], "@npmcli/git": ["@npmcli/git@7.0.2", "", { "dependencies": { "@gar/promise-retry": "^1.0.0", "@npmcli/promise-spawn": "^9.0.0", "ini": "^6.0.0", "lru-cache": "^11.2.1", "npm-pick-manifest": "^11.0.1", "proc-log": "^6.0.0", "semver": "^7.3.5", "which": "^6.0.0" } }, "sha512-oeolHDjExNAJAnlYP2qzNjMX/Xi9bmu78C9dIGr4xjobrSKbuMYCph8lTzn4vnW3NjIqVmw/f8BCfouqyJXlRg=="], diff --git a/package.json b/package.json index 063226ad0c..06bf9c91ae 100644 --- a/package.json +++ b/package.json @@ -127,6 +127,7 @@ "@types/node": "catalog:" }, "patchedDependencies": { + "@npmcli/agent@4.0.0": "patches/@npmcli%2Fagent@4.0.0.patch", "@standard-community/standard-openapi@0.2.9": "patches/@standard-community%2Fstandard-openapi@0.2.9.patch", "solid-js@1.9.10": "patches/solid-js@1.9.10.patch" } diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 42f30b45ef..4644922fc3 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -110,6 +110,7 @@ "@lydell/node-pty": "catalog:", "@modelcontextprotocol/sdk": "1.27.1", "@npmcli/arborist": "9.4.0", + "@npmcli/config": "10.8.1", "@octokit/graphql": "9.0.2", "@octokit/rest": "catalog:", "@openauthjs/openauth": "catalog:", diff --git a/packages/opencode/src/npm/config.ts b/packages/opencode/src/npm/config.ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/packages/opencode/src/npmcli-config.d.ts b/packages/opencode/src/npmcli-config.d.ts new file mode 100644 index 0000000000..c9b20517ad --- /dev/null +++ b/packages/opencode/src/npmcli-config.d.ts @@ -0,0 +1,43 @@ +declare module "@npmcli/config" { + type Data = Record + type Where = "default" | "builtin" | "global" | "user" | "project" | "env" | "cli" + + namespace Config { + interface Options { + definitions: Data + shorthands: Record + npmPath: string + flatten?: (input: Data, flat?: Data) => Data + nerfDarts?: string[] + argv?: string[] + cwd?: string + env?: NodeJS.ProcessEnv + execPath?: string + platform?: NodeJS.Platform + warn?: boolean + } + } + + class Config { + constructor(input: Config.Options) + + readonly data: Map + readonly flat: Data + + load(): Promise + } + + export = Config +} + +declare module "@npmcli/config/lib/definitions" { + export const definitions: Record + export const shorthands: Record + export const flatten: (input: Record, flat?: Record) => Record + export const nerfDarts: string[] + export const proxyEnv: string[] +} + +declare module "@npmcli/config/lib/definitions/index.js" { + export * from "@npmcli/config/lib/definitions" +} diff --git a/packages/shared/src/types.d.ts b/packages/shared/src/types.d.ts index b5d667f1d9..60e1639adb 100644 --- a/packages/shared/src/types.d.ts +++ b/packages/shared/src/types.d.ts @@ -5,6 +5,7 @@ declare module "@npmcli/arborist" { progress?: boolean savePrefix?: string ignoreScripts?: boolean + [key: string]: unknown } export interface ArboristNode { @@ -24,6 +25,7 @@ declare module "@npmcli/arborist" { add?: string[] save?: boolean saveType?: "prod" | "dev" | "optional" | "peer" + [key: string]: unknown } export class Arborist { diff --git a/patches/@npmcli%2Fagent@4.0.0.patch b/patches/@npmcli%2Fagent@4.0.0.patch new file mode 100644 index 0000000000..a3506a90e3 --- /dev/null +++ b/patches/@npmcli%2Fagent@4.0.0.patch @@ -0,0 +1,13 @@ +diff --git a/lib/agents.js b/lib/agents.js +index 45ec59c4c13757379095131c4f0a5ea6f7284f45..0763b031e355a755ec6a26f98461aa3f63b8339b 100644 +--- a/lib/agents.js ++++ b/lib/agents.js +@@ -32,7 +32,7 @@ module.exports = class Agent extends AgentBase { + } + + get proxy () { +- return this.#proxy ? { url: this.#proxy } : {} ++ return this.#proxy ? { url: this.#proxy.toString() } : {} + } + + #getProxy (options) {