@serviceme/devtools-core 0.3.3 → 0.3.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/dist/{index-BmxS1A9G.d.ts → index-CR1hbAnO.d.ts} +19 -1
- package/dist/{index-GAigCT0j.d.mts → index-CXvNx2fp.d.mts} +19 -1
- package/dist/index.d.mts +10 -2
- package/dist/index.d.ts +10 -2
- package/dist/index.js +57 -20
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +55 -20
- package/dist/index.mjs.map +1 -1
- package/dist/submit.d.mts +1 -1
- package/dist/submit.d.ts +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2545,10 +2545,33 @@ var POSIX_LOGIN_SHELL_FALLBACK_TOOLS = /* @__PURE__ */ new Set([
|
|
|
2545
2545
|
]);
|
|
2546
2546
|
var ERROR_CODE_NOT_FOUND = 127;
|
|
2547
2547
|
var ERROR_CODE_TIMEOUT = "ETIMEDOUT";
|
|
2548
|
+
var NVM_FALLBACK_DIRS = [
|
|
2549
|
+
"/opt/homebrew/opt/nvm",
|
|
2550
|
+
"/usr/local/opt/nvm",
|
|
2551
|
+
"$HOME/.nvm"
|
|
2552
|
+
];
|
|
2553
|
+
function resolveUserLoginShell(platform3, envShell) {
|
|
2554
|
+
const shell = envShell?.trim();
|
|
2555
|
+
if (shell && shell.length > 0) {
|
|
2556
|
+
return shell;
|
|
2557
|
+
}
|
|
2558
|
+
return platform3 === "darwin" ? "/bin/zsh" : "/bin/bash";
|
|
2559
|
+
}
|
|
2560
|
+
function buildNvmSourcingSnippet() {
|
|
2561
|
+
const fallbackList = NVM_FALLBACK_DIRS.map((dir) => `"${dir}"`).join(" ");
|
|
2562
|
+
return `for d in $NVM_DIR ${fallbackList}; do [ -n "$d" ] && [ -s "$d/nvm.sh" ] && export NVM_DIR="$d" && . "$d/nvm.sh" && break; done`;
|
|
2563
|
+
}
|
|
2564
|
+
function posixLoginShellArgs(platform3, envShell, command) {
|
|
2565
|
+
return {
|
|
2566
|
+
command: resolveUserLoginShell(platform3, envShell),
|
|
2567
|
+
args: ["-lc", `${buildNvmSourcingSnippet()}; ${command}`]
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2548
2570
|
var EnvironmentInspector = class {
|
|
2549
2571
|
constructor(options = {}) {
|
|
2550
2572
|
this.runCommandFn = options.runCommand ?? runCommand;
|
|
2551
2573
|
this.platform = options.platform ?? process.platform;
|
|
2574
|
+
this.shell = options.shell ?? process.env.SHELL;
|
|
2552
2575
|
}
|
|
2553
2576
|
async checkEnvironment() {
|
|
2554
2577
|
const results = await Promise.all(
|
|
@@ -2595,11 +2618,9 @@ var EnvironmentInspector = class {
|
|
|
2595
2618
|
}
|
|
2596
2619
|
async getToolPathFromLoginShell(toolName) {
|
|
2597
2620
|
try {
|
|
2598
|
-
const
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
'export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; command -v ' + toolName
|
|
2602
|
-
],
|
|
2621
|
+
const spawnArgs = posixLoginShellArgs(this.platform, this.shell, `command -v ${toolName}`);
|
|
2622
|
+
const result = await this.runCommandFn(spawnArgs.command, {
|
|
2623
|
+
args: spawnArgs.args,
|
|
2603
2624
|
timeoutMs: this.getToolTimeout(toolName)
|
|
2604
2625
|
});
|
|
2605
2626
|
return result.stdout.split(/\r?\n/).map((line) => line.trim()).find((line) => line.length > 0);
|
|
@@ -2638,11 +2659,9 @@ var EnvironmentInspector = class {
|
|
|
2638
2659
|
if (!this.shouldUsePosixLoginShellFallback(toolName)) {
|
|
2639
2660
|
throw error;
|
|
2640
2661
|
}
|
|
2641
|
-
const
|
|
2642
|
-
|
|
2643
|
-
|
|
2644
|
-
`export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; ${toolName} --version`
|
|
2645
|
-
],
|
|
2662
|
+
const fallbackArgs = posixLoginShellArgs(this.platform, this.shell, `${toolName} --version`);
|
|
2663
|
+
const fallbackResult = await this.runCommandFn(fallbackArgs.command, {
|
|
2664
|
+
args: fallbackArgs.args,
|
|
2646
2665
|
timeoutMs: this.getToolTimeout(toolName)
|
|
2647
2666
|
});
|
|
2648
2667
|
const fallbackOutput = (fallbackResult.stdout || fallbackResult.stderr).trim();
|
|
@@ -2675,11 +2694,9 @@ var EnvironmentInspector = class {
|
|
|
2675
2694
|
}
|
|
2676
2695
|
}
|
|
2677
2696
|
try {
|
|
2678
|
-
const
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
'export NVM_DIR="$HOME/.nvm"; [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh"; nvm --version'
|
|
2682
|
-
],
|
|
2697
|
+
const nvmArgs = posixLoginShellArgs(this.platform, this.shell, "nvm --version");
|
|
2698
|
+
const result = await this.runCommandFn(nvmArgs.command, {
|
|
2699
|
+
args: nvmArgs.args,
|
|
2683
2700
|
timeoutMs: this.getToolTimeout("nvm")
|
|
2684
2701
|
});
|
|
2685
2702
|
return {
|
|
@@ -2866,7 +2883,9 @@ var GitClient = class {
|
|
|
2866
2883
|
}
|
|
2867
2884
|
const targetUrl = useProxy ? remoteUrl : originalUrl ?? remoteUrl;
|
|
2868
2885
|
const proxyUrl = this.rewriteRemoteUrl(repoId, targetUrl, useProxy);
|
|
2869
|
-
await this.runOrThrow(["remote", "set-url", "origin", proxyUrl], {
|
|
2886
|
+
await this.runOrThrow(["remote", "set-url", "origin", proxyUrl], {
|
|
2887
|
+
cwd: localPath
|
|
2888
|
+
});
|
|
2870
2889
|
const before = await this.safeRevParse(localPath);
|
|
2871
2890
|
await this.runOrThrow(["fetch", "origin"], { cwd: localPath });
|
|
2872
2891
|
const after = await this.safeRevParse(localPath);
|
|
@@ -2902,7 +2921,9 @@ var GitClient = class {
|
|
|
2902
2921
|
throw new Error(`no 'origin' remote configured at ${localPath}`);
|
|
2903
2922
|
}
|
|
2904
2923
|
const proxyUrl = this.rewriteRemoteUrl(repoId, remoteUrl, useProxy);
|
|
2905
|
-
await this.runOrThrow(["remote", "set-url", "origin", proxyUrl], {
|
|
2924
|
+
await this.runOrThrow(["remote", "set-url", "origin", proxyUrl], {
|
|
2925
|
+
cwd: localPath
|
|
2926
|
+
});
|
|
2906
2927
|
const result = await this.spawner.spawn(
|
|
2907
2928
|
["push", "origin", `refs/heads/${branch}:refs/heads/${branch}`],
|
|
2908
2929
|
{ cwd: localPath }
|
|
@@ -2956,7 +2977,9 @@ var GitClient = class {
|
|
|
2956
2977
|
return { commitSha: sha };
|
|
2957
2978
|
}
|
|
2958
2979
|
async runOrThrow(args, opts) {
|
|
2959
|
-
const result = await this.spawner.spawn(args, {
|
|
2980
|
+
const result = await this.spawner.spawn(args, {
|
|
2981
|
+
cwd: opts.cwd ?? process.cwd()
|
|
2982
|
+
});
|
|
2960
2983
|
if (result.code !== 0) {
|
|
2961
2984
|
throw new GitError(args, result);
|
|
2962
2985
|
}
|
|
@@ -2971,7 +2994,9 @@ var GitClient = class {
|
|
|
2971
2994
|
return url.length > 0 ? url : void 0;
|
|
2972
2995
|
}
|
|
2973
2996
|
async safeRevParse(localPath) {
|
|
2974
|
-
const result = await this.spawner.spawn(["rev-parse", "HEAD"], {
|
|
2997
|
+
const result = await this.spawner.spawn(["rev-parse", "HEAD"], {
|
|
2998
|
+
cwd: localPath
|
|
2999
|
+
});
|
|
2975
3000
|
if (result.code !== 0) return "";
|
|
2976
3001
|
return result.stdout.trim();
|
|
2977
3002
|
}
|
|
@@ -3018,7 +3043,11 @@ var StubGitSpawner = class {
|
|
|
3018
3043
|
this.calls.push({ args, cwd: opts.cwd });
|
|
3019
3044
|
const next = this.script.shift();
|
|
3020
3045
|
if (!next) {
|
|
3021
|
-
return {
|
|
3046
|
+
return {
|
|
3047
|
+
stdout: "",
|
|
3048
|
+
stderr: `stub: no scripted response for ${args.join(" ")}`,
|
|
3049
|
+
code: 1
|
|
3050
|
+
};
|
|
3022
3051
|
}
|
|
3023
3052
|
return next;
|
|
3024
3053
|
}
|
|
@@ -3030,6 +3059,10 @@ function toFileUrl(absolutePath) {
|
|
|
3030
3059
|
}
|
|
3031
3060
|
return `file://${normalized}`;
|
|
3032
3061
|
}
|
|
3062
|
+
var GIT_PROXY_PATH_SUFFIX = "/git-proxy";
|
|
3063
|
+
function buildGitProxyBase(serverBaseUrl) {
|
|
3064
|
+
return `${serverBaseUrl.replace(/\/+$/, "")}${GIT_PROXY_PATH_SUFFIX}`;
|
|
3065
|
+
}
|
|
3033
3066
|
|
|
3034
3067
|
// src/image/imageTools.ts
|
|
3035
3068
|
import * as fs5 from "fs/promises";
|
|
@@ -7222,6 +7255,7 @@ export {
|
|
|
7222
7255
|
EnvironmentInspector,
|
|
7223
7256
|
FsIdentityFileBackend,
|
|
7224
7257
|
FsToolboxFileBackend,
|
|
7258
|
+
GIT_PROXY_PATH_SUFFIX,
|
|
7225
7259
|
GitClient,
|
|
7226
7260
|
GitError,
|
|
7227
7261
|
GitHubAuthProvider,
|
|
@@ -7288,6 +7322,7 @@ export {
|
|
|
7288
7322
|
bootstrapPhase5Placeholders,
|
|
7289
7323
|
buildDefaultReposFile,
|
|
7290
7324
|
buildGitHubLocalEmail,
|
|
7325
|
+
buildGitProxyBase,
|
|
7291
7326
|
buildSignedHeaders,
|
|
7292
7327
|
copilotDoctor,
|
|
7293
7328
|
copilotPrompt,
|