@misterhuydo/sentinel 1.4.72 → 1.4.74
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/python/sentinel/main.py +4 -3
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 ────────────────────
|
package/package.json
CHANGED
package/python/sentinel/main.py
CHANGED
|
@@ -632,13 +632,14 @@ async def _send_startup_email_delayed(cfg, results: dict, delay: int = 300):
|
|
|
632
632
|
|
|
633
633
|
# ── Config repo polling ──────────────────────────────────────────────────────────────────────────
|
|
634
634
|
|
|
635
|
-
def _config_repo_git_env() -> dict:
|
|
635
|
+
def _config_repo_git_env(project_dir: Path | None = None) -> dict:
|
|
636
636
|
"""Return env with GIT_SSH_COMMAND pointing to ~/.ssh/<slug>.key if it exists."""
|
|
637
637
|
env = os.environ.copy()
|
|
638
638
|
try:
|
|
639
|
+
cwd = str((project_dir or Path(".")).resolve())
|
|
639
640
|
r = subprocess.run(
|
|
640
641
|
["git", "remote", "get-url", "origin"],
|
|
641
|
-
capture_output=True, text=True, timeout=5,
|
|
642
|
+
cwd=cwd, capture_output=True, text=True, timeout=5,
|
|
642
643
|
)
|
|
643
644
|
remote = r.stdout.strip()
|
|
644
645
|
# Extract slug: git@github.com:org/repo.git or https://github.com/org/repo.git
|
|
@@ -662,7 +663,7 @@ def _poll_config_repo(cfg_loader: ConfigLoader) -> bool:
|
|
|
662
663
|
["git", "pull", "--rebase", "--autostash"],
|
|
663
664
|
cwd=str(project_dir),
|
|
664
665
|
capture_output=True, text=True, timeout=30,
|
|
665
|
-
env=_config_repo_git_env(),
|
|
666
|
+
env=_config_repo_git_env(project_dir),
|
|
666
667
|
)
|
|
667
668
|
if result.returncode != 0:
|
|
668
669
|
logger.warning("Config repo git pull failed: %s", result.stderr.strip())
|