@misterhuydo/sentinel 1.0.34 → 1.0.35
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/.hint-lock +1 -1
- package/.cairn/session.json +2 -2
- package/bin/sentinel.js +4 -0
- package/lib/upgrade.js +64 -0
- package/package.json +1 -1
package/.cairn/.hint-lock
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2026-03-
|
|
1
|
+
2026-03-21T21:21:51.189Z
|
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-21T21:
|
|
3
|
-
"checkpoint_at": "2026-03-21T21:
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-21T21:19:42.497Z",
|
|
3
|
+
"checkpoint_at": "2026-03-21T21:19:42.498Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/bin/sentinel.js
CHANGED
|
@@ -35,6 +35,9 @@ async function main() {
|
|
|
35
35
|
case 'add':
|
|
36
36
|
await require('../lib/add')(args[0]);
|
|
37
37
|
break;
|
|
38
|
+
case 'upgrade':
|
|
39
|
+
await require('../lib/upgrade')();
|
|
40
|
+
break;
|
|
38
41
|
case 'help':
|
|
39
42
|
default:
|
|
40
43
|
printUsage();
|
|
@@ -51,6 +54,7 @@ ${chalk.bold('Usage:')}
|
|
|
51
54
|
sentinel add <git-url> Add a project pre-configured for a GitHub repo
|
|
52
55
|
sentinel add <project.json> Add a project from a local JSON config file
|
|
53
56
|
sentinel add <https://host/cfg.json> Add a project from a remote JSON config URL
|
|
57
|
+
sentinel upgrade Pull latest version and hot-deploy Python source
|
|
54
58
|
|
|
55
59
|
${chalk.bold('Options:')}
|
|
56
60
|
--version, -v Print version
|
package/lib/upgrade.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const { execSync, spawnSync } = require('child_process');
|
|
7
|
+
const chalk = require('chalk');
|
|
8
|
+
|
|
9
|
+
const ok = msg => console.log(chalk.green(' ✔'), msg);
|
|
10
|
+
const info = msg => console.log(chalk.cyan(' →'), msg);
|
|
11
|
+
const warn = msg => console.log(chalk.yellow(' ⚠'), msg);
|
|
12
|
+
|
|
13
|
+
module.exports = async function upgrade() {
|
|
14
|
+
const { version: current } = require('../package.json');
|
|
15
|
+
|
|
16
|
+
// Find the workspace code dir
|
|
17
|
+
const defaultWorkspace = path.join(os.homedir(), 'sentinel');
|
|
18
|
+
const codeDir = path.join(defaultWorkspace, 'code');
|
|
19
|
+
if (!fs.existsSync(codeDir)) {
|
|
20
|
+
console.error(chalk.red(' ✖ Sentinel code directory not found at ' + codeDir));
|
|
21
|
+
console.error(' Run: sentinel init');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Install latest from npm
|
|
26
|
+
info(`Current version: ${current}`);
|
|
27
|
+
info('Installing latest @misterhuydo/sentinel...');
|
|
28
|
+
const install = spawnSync('npm', ['install', '-g', '@misterhuydo/sentinel@latest'], { stdio: 'inherit' });
|
|
29
|
+
if (install.status !== 0) {
|
|
30
|
+
console.error(chalk.red(' ✖ npm install failed'));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Find where npm installed it
|
|
35
|
+
const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
|
|
36
|
+
const pkgDir = path.join(npmRoot, '@misterhuydo', 'sentinel');
|
|
37
|
+
const src = path.join(pkgDir, 'python');
|
|
38
|
+
|
|
39
|
+
if (!fs.existsSync(src)) {
|
|
40
|
+
console.error(chalk.red(' ✖ Bundled Python source not found in installed package'));
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Hot-deploy: copy Python source to code dir
|
|
45
|
+
info('Deploying Python source...');
|
|
46
|
+
fs.copySync(src, codeDir, { overwrite: true });
|
|
47
|
+
ok('Python source updated');
|
|
48
|
+
|
|
49
|
+
// Print new version
|
|
50
|
+
const { version: latest } = require(path.join(pkgDir, 'package.json'));
|
|
51
|
+
ok(`Upgraded: ${current} → ${latest}`);
|
|
52
|
+
|
|
53
|
+
// Restart running projects
|
|
54
|
+
const startAll = path.join(defaultWorkspace, 'startAll.sh');
|
|
55
|
+
const stopAll = path.join(defaultWorkspace, 'stopAll.sh');
|
|
56
|
+
if (fs.existsSync(stopAll) && fs.existsSync(startAll)) {
|
|
57
|
+
info('Restarting Sentinel...');
|
|
58
|
+
spawnSync('bash', [stopAll], { stdio: 'inherit' });
|
|
59
|
+
spawnSync('bash', [startAll], { stdio: 'inherit' });
|
|
60
|
+
ok('Sentinel restarted');
|
|
61
|
+
} else {
|
|
62
|
+
warn('No startAll.sh found — restart manually');
|
|
63
|
+
}
|
|
64
|
+
};
|