@misterhuydo/sentinel 1.4.72 → 1.4.73
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/.cairn/session.json +2 -2
- package/lib/add.js +37 -15
- package/package.json +1 -1
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-
|
|
3
|
-
"checkpoint_at": "2026-03-
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-26T19:12:24.024Z",
|
|
3
|
+
"checkpoint_at": "2026-03-26T19:12:24.038Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/add.js
CHANGED
|
@@ -289,24 +289,46 @@ async function addFromGit(gitUrl, workspace) {
|
|
|
289
289
|
if (existingAccess.ok) {
|
|
290
290
|
ok(`${repoSlug}: reachable via existing SSH key — skipping deploy key generation`);
|
|
291
291
|
} else {
|
|
292
|
+
const keyAlreadyExisted = fs.existsSync(path.join(os.homedir(), '.ssh', `${repoSlug}.key`));
|
|
292
293
|
const { keyFile: generatedKey } = generateDeployKey(repoSlug);
|
|
293
294
|
keyFile = generatedKey;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
295
|
+
|
|
296
|
+
// If key already existed, try it immediately — skip prompt if it works
|
|
297
|
+
if (keyAlreadyExisted) {
|
|
298
|
+
const primary = validateAccess(gitUrl, keyFile);
|
|
299
|
+
if (primary.ok) {
|
|
300
|
+
ok(`${repoSlug}: reachable (reusing existing deploy key)`);
|
|
301
|
+
} else {
|
|
302
|
+
// Key exists but doesn't work (e.g. not yet added to GitHub) — show instructions
|
|
303
|
+
printDeployKeyInstructions(orgRepo, keyFile);
|
|
304
|
+
await prompts({
|
|
305
|
+
type: 'text', name: '_', format: () => '',
|
|
306
|
+
message: chalk.bold(`Press Enter once you've added the deploy key to GitHub…`),
|
|
307
|
+
}, { onCancel: () => process.exit(0) });
|
|
308
|
+
const retry = validateAccess(gitUrl, keyFile);
|
|
309
|
+
if (!retry.ok) {
|
|
310
|
+
console.error(chalk.red(' ✖ Cannot reach ' + gitUrl));
|
|
311
|
+
if (retry.stderr) console.error(chalk.red(' ' + retry.stderr));
|
|
312
|
+
console.error(chalk.yellow(' Check the deploy key has write access, then re-run.'));
|
|
313
|
+
process.exit(1);
|
|
314
|
+
}
|
|
315
|
+
ok(`${repoSlug}: reachable`);
|
|
316
|
+
}
|
|
317
|
+
} else {
|
|
318
|
+
printDeployKeyInstructions(orgRepo, keyFile);
|
|
319
|
+
await prompts({
|
|
320
|
+
type: 'text', name: '_', format: () => '',
|
|
321
|
+
message: chalk.bold(`Press Enter once you've added the deploy key to GitHub…`),
|
|
322
|
+
}, { onCancel: () => process.exit(0) });
|
|
323
|
+
const primary = validateAccess(gitUrl, keyFile);
|
|
324
|
+
if (!primary.ok) {
|
|
325
|
+
console.error(chalk.red(' ✖ Cannot reach ' + gitUrl));
|
|
326
|
+
if (primary.stderr) console.error(chalk.red(' ' + primary.stderr));
|
|
327
|
+
console.error(chalk.yellow(' Check the deploy key has write access, then re-run.'));
|
|
328
|
+
process.exit(1);
|
|
329
|
+
}
|
|
330
|
+
ok(`${repoSlug}: reachable`);
|
|
308
331
|
}
|
|
309
|
-
ok(`${repoSlug}: reachable`);
|
|
310
332
|
}
|
|
311
333
|
|
|
312
334
|
// ── 2. Clone primary repo and discover additional repos ────────────────────
|