@joshski/dust 0.1.80 → 0.1.82
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/bucket/repository-git.d.ts +2 -0
- package/dist/bucket/repository.d.ts +1 -0
- package/dist/dust.js +32 -18
- package/package.json +1 -1
|
@@ -11,10 +11,12 @@ import type { CommandDependencies } from '../cli/types';
|
|
|
11
11
|
export declare function getRepoPath(repoName: string, reposDir: string): string;
|
|
12
12
|
/**
|
|
13
13
|
* Clone a repository to a temporary directory.
|
|
14
|
+
* Tries HTTPS first, falls back to SSH if available and HTTPS fails.
|
|
14
15
|
*/
|
|
15
16
|
export declare function cloneRepository(repository: {
|
|
16
17
|
name: string;
|
|
17
18
|
gitUrl: string;
|
|
19
|
+
gitSshUrl?: string;
|
|
18
20
|
}, targetPath: string, spawn: typeof nodeSpawn, context: CommandDependencies['context']): Promise<boolean>;
|
|
19
21
|
/**
|
|
20
22
|
* Remove a repository directory.
|
package/dist/dust.js
CHANGED
|
@@ -318,7 +318,7 @@ async function loadSettings(cwd, fileSystem) {
|
|
|
318
318
|
}
|
|
319
319
|
|
|
320
320
|
// lib/version.ts
|
|
321
|
-
var DUST_VERSION = "0.1.
|
|
321
|
+
var DUST_VERSION = "0.1.82";
|
|
322
322
|
|
|
323
323
|
// lib/session.ts
|
|
324
324
|
var DUST_UNATTENDED = "DUST_UNATTENDED";
|
|
@@ -2481,9 +2481,9 @@ function getRepoPath(repoName, reposDir) {
|
|
|
2481
2481
|
const safeName = repoName.replace(/[^a-zA-Z0-9-_/]/g, "-");
|
|
2482
2482
|
return join7(reposDir, safeName);
|
|
2483
2483
|
}
|
|
2484
|
-
|
|
2484
|
+
function cloneWithUrl(url, targetPath, spawn) {
|
|
2485
2485
|
return new Promise((resolve) => {
|
|
2486
|
-
const proc = spawn("git", ["clone",
|
|
2486
|
+
const proc = spawn("git", ["clone", url, targetPath], {
|
|
2487
2487
|
stdio: ["ignore", "pipe", "pipe"],
|
|
2488
2488
|
env: {
|
|
2489
2489
|
...process.env,
|
|
@@ -2496,19 +2496,30 @@ async function cloneRepository(repository, targetPath, spawn, context) {
|
|
|
2496
2496
|
stderr += data.toString();
|
|
2497
2497
|
});
|
|
2498
2498
|
proc.on("close", (code) => {
|
|
2499
|
-
|
|
2500
|
-
resolve(true);
|
|
2501
|
-
} else {
|
|
2502
|
-
context.stderr(`Failed to clone ${repository.name}: ${stderr.trim()}`);
|
|
2503
|
-
resolve(false);
|
|
2504
|
-
}
|
|
2499
|
+
resolve({ success: code === 0, stderr: stderr.trim() });
|
|
2505
2500
|
});
|
|
2506
2501
|
proc.on("error", (error) => {
|
|
2507
|
-
|
|
2508
|
-
resolve(false);
|
|
2502
|
+
resolve({ success: false, stderr: error.message });
|
|
2509
2503
|
});
|
|
2510
2504
|
});
|
|
2511
2505
|
}
|
|
2506
|
+
async function cloneRepository(repository, targetPath, spawn, context) {
|
|
2507
|
+
const httpsResult = await cloneWithUrl(repository.gitUrl, targetPath, spawn);
|
|
2508
|
+
if (httpsResult.success) {
|
|
2509
|
+
return true;
|
|
2510
|
+
}
|
|
2511
|
+
if (repository.gitSshUrl) {
|
|
2512
|
+
context.stderr(`HTTPS clone failed for ${repository.name}, trying SSH: ${httpsResult.stderr}`);
|
|
2513
|
+
const sshResult = await cloneWithUrl(repository.gitSshUrl, targetPath, spawn);
|
|
2514
|
+
if (sshResult.success) {
|
|
2515
|
+
return true;
|
|
2516
|
+
}
|
|
2517
|
+
context.stderr(`Failed to clone ${repository.name} via SSH: ${sshResult.stderr}`);
|
|
2518
|
+
return false;
|
|
2519
|
+
}
|
|
2520
|
+
context.stderr(`Failed to clone ${repository.name}: ${httpsResult.stderr}`);
|
|
2521
|
+
return false;
|
|
2522
|
+
}
|
|
2512
2523
|
async function removeRepository(path, spawn, context) {
|
|
2513
2524
|
return new Promise((resolve) => {
|
|
2514
2525
|
const proc = spawn("rm", ["-rf", path], {
|
|
@@ -3576,6 +3587,7 @@ function parseRepository(data) {
|
|
|
3576
3587
|
return {
|
|
3577
3588
|
name: repositoryData.name,
|
|
3578
3589
|
gitUrl: repositoryData.gitUrl,
|
|
3590
|
+
gitSshUrl: typeof repositoryData.gitSshUrl === "string" ? repositoryData.gitSshUrl : undefined,
|
|
3579
3591
|
url: repositoryData.url,
|
|
3580
3592
|
id: repositoryData.id
|
|
3581
3593
|
};
|
|
@@ -3693,6 +3705,9 @@ function parseServerMessage(data) {
|
|
|
3693
3705
|
url: repo.url,
|
|
3694
3706
|
hasTask: repo.hasTask
|
|
3695
3707
|
};
|
|
3708
|
+
if (typeof repo.gitSshUrl === "string") {
|
|
3709
|
+
item.gitSshUrl = repo.gitSshUrl;
|
|
3710
|
+
}
|
|
3696
3711
|
if (typeof repo.agentProvider === "string") {
|
|
3697
3712
|
item.agentProvider = repo.agentProvider;
|
|
3698
3713
|
}
|
|
@@ -4440,13 +4455,12 @@ function connectWebSocket(token, state, bucketDependencies, context, fileSystem,
|
|
|
4440
4455
|
logMessage(state, context, useTUI, " (empty)");
|
|
4441
4456
|
} else {
|
|
4442
4457
|
for (const r of repos) {
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
logMessage(state, context, useTUI, ` - ${attrs.join(", ")}`);
|
|
4458
|
+
logMessage(state, context, useTUI, ` - name=${r.name}`);
|
|
4459
|
+
logMessage(state, context, useTUI, ` id=${r.id}`);
|
|
4460
|
+
logMessage(state, context, useTUI, ` gitUrl=${r.gitUrl}`);
|
|
4461
|
+
logMessage(state, context, useTUI, ` gitSshUrl=${r.gitSshUrl ?? "(none)"}`);
|
|
4462
|
+
logMessage(state, context, useTUI, ` url=${r.url}`);
|
|
4463
|
+
logMessage(state, context, useTUI, ` hasTask=${r.hasTask}`);
|
|
4450
4464
|
}
|
|
4451
4465
|
}
|
|
4452
4466
|
syncUIWithRepoList(state, repos);
|