@misterhuydo/sentinel 1.3.3 → 1.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/.cairn/session.json +2 -2
- package/lib/add.js +22 -4
- package/package.json +1 -1
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-23T18:
|
|
3
|
-
"checkpoint_at": "2026-03-23T18:
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-23T18:21:42.702Z",
|
|
3
|
+
"checkpoint_at": "2026-03-23T18:21:42.703Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/add.js
CHANGED
|
@@ -179,11 +179,29 @@ function printDeployKeyInstructions(orgRepo, keyFile) {
|
|
|
179
179
|
function gitEnv(extra = {}) {
|
|
180
180
|
const PATH = [
|
|
181
181
|
process.env.PATH || '',
|
|
182
|
-
'/usr/bin', '/usr/local/bin', '/bin', '/usr/sbin',
|
|
182
|
+
'/usr/bin', '/usr/local/bin', '/bin', '/usr/sbin', '/usr/local/sbin',
|
|
183
183
|
].filter(Boolean).join(':');
|
|
184
184
|
return { ...process.env, PATH, GIT_TERMINAL_PROMPT: '0', ...extra };
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
function findBin(name) {
|
|
188
|
+
const candidates = [
|
|
189
|
+
`/usr/bin/${name}`, `/usr/local/bin/${name}`, `/bin/${name}`,
|
|
190
|
+
];
|
|
191
|
+
for (const p of candidates) {
|
|
192
|
+
if (fs.existsSync(p)) return p;
|
|
193
|
+
}
|
|
194
|
+
// fall back to letting the shell resolve it
|
|
195
|
+
const r = spawnSync('which', [name], { encoding: 'utf8', env: gitEnv() });
|
|
196
|
+
return (r.stdout || '').trim() || name;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
let _gitBin;
|
|
200
|
+
function gitBin() {
|
|
201
|
+
if (!_gitBin) _gitBin = findBin('git');
|
|
202
|
+
return _gitBin;
|
|
203
|
+
}
|
|
204
|
+
|
|
187
205
|
// ── repo discovery helpers ────────────────────────────────────────────────────
|
|
188
206
|
|
|
189
207
|
function gitUrlToOrgRepo(gitUrl) {
|
|
@@ -198,7 +216,7 @@ function toHttpsUrl(gitUrl) {
|
|
|
198
216
|
}
|
|
199
217
|
|
|
200
218
|
function isPublicRepo(gitUrl) {
|
|
201
|
-
const r = spawnSync(
|
|
219
|
+
const r = spawnSync(gitBin(), ['ls-remote', '--heads', toHttpsUrl(gitUrl)], {
|
|
202
220
|
encoding: 'utf8', timeout: 10000, stdio: ['pipe', 'pipe', 'pipe'],
|
|
203
221
|
env: gitEnv(),
|
|
204
222
|
});
|
|
@@ -209,7 +227,7 @@ function validateAccess(repoUrl, keyFile) {
|
|
|
209
227
|
const extra = keyFile
|
|
210
228
|
? { GIT_SSH_COMMAND: `ssh -i ${keyFile} -o StrictHostKeyChecking=no -o BatchMode=yes` }
|
|
211
229
|
: {};
|
|
212
|
-
const r = spawnSync(
|
|
230
|
+
const r = spawnSync(gitBin(), ['ls-remote', '--heads', repoUrl], {
|
|
213
231
|
encoding: 'utf8', timeout: 15000, stdio: ['pipe', 'pipe', 'pipe'],
|
|
214
232
|
env: gitEnv(extra),
|
|
215
233
|
});
|
|
@@ -269,7 +287,7 @@ async function addFromGit(gitUrl, workspace) {
|
|
|
269
287
|
step(`[2/3] Scanning repo-configs in ${repoSlug}…`);
|
|
270
288
|
|
|
271
289
|
if (!fs.existsSync(localPath)) {
|
|
272
|
-
spawnSync(
|
|
290
|
+
spawnSync(gitBin(), ['clone', '--depth', '1', gitUrl, localPath], {
|
|
273
291
|
stdio: 'inherit',
|
|
274
292
|
env: gitEnv({ GIT_SSH_COMMAND: `ssh -i ${keyFile} -o StrictHostKeyChecking=no -o BatchMode=yes` }),
|
|
275
293
|
});
|