@misterhuydo/sentinel 1.3.4 → 1.3.6
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 +25 -8
- package/lib/generate.js +8 -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:43:04.420Z",
|
|
3
|
+
"checkpoint_at": "2026-03-23T18:43:04.421Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/add.js
CHANGED
|
@@ -484,6 +484,7 @@ async function addFromGit(gitUrl, workspace) {
|
|
|
484
484
|
}
|
|
485
485
|
ok(`Project "${name}" ready at ${localPath}`);
|
|
486
486
|
printNextSteps(localPath, autoPublish);
|
|
487
|
+
await offerToStart(localPath);
|
|
487
488
|
} else {
|
|
488
489
|
// No existing repo-configs — scaffold fresh project
|
|
489
490
|
fs.ensureDirSync(projectDir);
|
|
@@ -503,6 +504,7 @@ async function addFromGit(gitUrl, workspace) {
|
|
|
503
504
|
generateWorkspaceScripts(workspace, {}, {}, {}, effectiveToken);
|
|
504
505
|
ok(`Project "${name}" created at ${projectDir}`);
|
|
505
506
|
printNextSteps(projectDir, autoPublish);
|
|
507
|
+
await offerToStart(projectDir);
|
|
506
508
|
}
|
|
507
509
|
}
|
|
508
510
|
|
|
@@ -650,21 +652,36 @@ async function addFromUrl(url, workspace) {
|
|
|
650
652
|
// ── printNextSteps ────────────────────────────────────────────────────────────
|
|
651
653
|
|
|
652
654
|
function printNextSteps(projectDir, autoPublish) {
|
|
655
|
+
const logFile = path.join(projectDir, 'logs', 'sentinel.log');
|
|
653
656
|
const mode = autoPublish === true
|
|
654
|
-
? chalk.yellow('
|
|
657
|
+
? chalk.yellow('\n ⚠ Fixes push directly to main — ensure CI blocks bad pushes')
|
|
655
658
|
: autoPublish === false
|
|
656
|
-
? chalk.cyan('
|
|
659
|
+
? chalk.cyan('\n → Sentinel opens a GitHub PR for each fix — review and merge at github.com')
|
|
657
660
|
: '';
|
|
658
661
|
console.log(`
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
${chalk.cyan(`${projectDir}/start.sh`)}
|
|
664
|
-
${mode ? ' ' + mode : ''}
|
|
662
|
+
Config: ${chalk.cyan(path.join(projectDir, 'config', ''))}
|
|
663
|
+
Start: ${chalk.cyan(path.join(projectDir, 'start.sh'))}${mode}
|
|
664
|
+
Logs: ${chalk.cyan(logFile)}
|
|
665
|
+
${chalk.gray(`tail -f ${logFile}`)}
|
|
665
666
|
`);
|
|
666
667
|
}
|
|
667
668
|
|
|
669
|
+
async function offerToStart(projectDir) {
|
|
670
|
+
const startSh = path.join(projectDir, 'start.sh');
|
|
671
|
+
if (!fs.existsSync(startSh)) return;
|
|
672
|
+
const { startNow } = await prompts({
|
|
673
|
+
type: 'confirm', name: 'startNow',
|
|
674
|
+
message: 'Start Sentinel now?', initial: true,
|
|
675
|
+
}, { onCancel: () => {} });
|
|
676
|
+
if (!startNow) return;
|
|
677
|
+
const { status } = spawnSync('bash', [startSh], { stdio: 'inherit', env: gitEnv() });
|
|
678
|
+
if (status === 0) {
|
|
679
|
+
const logFile = path.join(projectDir, 'logs', 'sentinel.log');
|
|
680
|
+
ok('Sentinel started');
|
|
681
|
+
info(`Logs: tail -f ${logFile}`);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
668
685
|
// ── entry point ───────────────────────────────────────────────────────────────
|
|
669
686
|
|
|
670
687
|
module.exports = async function add(arg) {
|
package/lib/generate.js
CHANGED
|
@@ -159,9 +159,11 @@ function generateWorkspaceScripts(workspace, smtpConfig = {}, slackConfig = {},
|
|
|
159
159
|
WORKSPACE="$(cd "$(dirname "$0")" && pwd)"
|
|
160
160
|
started=0
|
|
161
161
|
skipped=0
|
|
162
|
-
for project_dir in "$WORKSPACE"/*/; do
|
|
162
|
+
for project_dir in "$WORKSPACE"/*/ "$WORKSPACE"/repos/*/; do
|
|
163
|
+
[[ -d "$project_dir" ]] || continue
|
|
163
164
|
name=$(basename "$project_dir")
|
|
164
|
-
[[ "$name" == "code" ]]
|
|
165
|
+
[[ "$name" == "code" ]] && continue
|
|
166
|
+
[[ "$name" == "repos" ]] && continue
|
|
165
167
|
# Auto-generate start.sh / stop.sh if missing (codeDir = $WORKSPACE/code)
|
|
166
168
|
if [[ ! -f "$project_dir/start.sh" ]]; then
|
|
167
169
|
code_dir="$WORKSPACE/code"
|
|
@@ -264,9 +266,11 @@ echo "[sentinel] $started project(s) started, $skipped skipped"
|
|
|
264
266
|
# Stop all Sentinel project instances
|
|
265
267
|
WORKSPACE="$(cd "$(dirname "$0")" && pwd)"
|
|
266
268
|
stopped=0
|
|
267
|
-
for project_dir in "$WORKSPACE"/*/; do
|
|
269
|
+
for project_dir in "$WORKSPACE"/*/ "$WORKSPACE"/repos/*/; do
|
|
270
|
+
[[ -d "$project_dir" ]] || continue
|
|
268
271
|
name=$(basename "$project_dir")
|
|
269
|
-
[[ "$name" == "code" ]]
|
|
272
|
+
[[ "$name" == "code" ]] && continue
|
|
273
|
+
[[ "$name" == "repos" ]] && continue
|
|
270
274
|
[[ -f "$project_dir/stop.sh" ]] || continue
|
|
271
275
|
bash "$project_dir/stop.sh"
|
|
272
276
|
stopped=$((stopped + 1))
|