@misterhuydo/sentinel 1.0.90 → 1.0.92

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.
@@ -1,8 +1 @@
1
- {
2
- "J:\\Projects\\Sentinel\\cli\\lib\\upgrade.js": {
3
- "tempPath": "J:\\Projects\\Sentinel\\cli\\.cairn\\views\\fb78ac_upgrade.js",
4
- "state": "compressed",
5
- "minifiedAt": 1774243530779.686,
6
- "readCount": 1
7
- }
8
- }
1
+ {}
@@ -1,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-23T06:09:59.037Z",
3
- "checkpoint_at": "2026-03-23T06:09:59.038Z",
2
+ "message": "Auto-checkpoint at 2026-03-23T06:24:16.501Z",
3
+ "checkpoint_at": "2026-03-23T06:24:16.503Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/lib/init.js CHANGED
@@ -54,8 +54,10 @@ module.exports = async function init() {
54
54
  {
55
55
  type: prev => (prev === 'apikey' || prev === 'both') ? 'password' : null,
56
56
  name: 'anthropicKey',
57
- message: 'Anthropic API key (sk-ant-...)',
58
- validate: v => v.startsWith('sk-ant-') ? true : 'Key should start with sk-ant-',
57
+ message: existing.ANTHROPIC_API_KEY
58
+ ? 'Anthropic API key (press Enter to keep current)'
59
+ : 'Anthropic API key (sk-ant-...)',
60
+ validate: v => !v || v.startsWith('sk-ant-') ? true : 'Key should start with sk-ant-',
59
61
  },
60
62
  {
61
63
  type: 'confirm',
@@ -107,9 +109,10 @@ module.exports = async function init() {
107
109
  ], { onCancel: () => process.exit(0) });
108
110
 
109
111
  const { workspace, authMode, anthropicKey, example, systemd, smtpUser, smtpPassword, smtpHost, setupSlack, slackBotToken, slackAppToken } = answers;
110
- const effectiveSmtpPassword = smtpPassword || existing.SMTP_PASSWORD || '';
111
- const effectiveSlackBotToken = slackBotToken || existing.SLACK_BOT_TOKEN || '';
112
- const effectiveSlackAppToken = slackAppToken || existing.SLACK_APP_TOKEN || '';
112
+ const effectiveAnthropicKey = anthropicKey || existing.ANTHROPIC_API_KEY || '';
113
+ const effectiveSmtpPassword = smtpPassword || existing.SMTP_PASSWORD || '';
114
+ const effectiveSlackBotToken = slackBotToken || existing.SLACK_BOT_TOKEN || '';
115
+ const effectiveSlackAppToken = slackAppToken || existing.SLACK_APP_TOKEN || '';
113
116
  const codeDir = path.join(workspace, 'code');
114
117
 
115
118
  // ── Python ──────────────────────────────────────────────────────────────────
@@ -158,12 +161,12 @@ module.exports = async function init() {
158
161
 
159
162
  // ── Claude Code auth ─────────────────────────────────────────────────────────
160
163
  step('Claude Code authentication…');
161
- if (authMode === 'both' && anthropicKey) {
164
+ if (authMode === 'both' && effectiveAnthropicKey) {
162
165
  ok('API key → Sentinel Boss (full tools, structured responses)');
163
166
  ok('Claude Pro → Fix Engine + Ask Codebase (heavy coding, Pro subscription)');
164
167
  info('Run `claude login` on this server now (or before starting projects)');
165
168
  info('CLAUDE_PRO_FOR_TASKS=true written to workspace sentinel.properties');
166
- } else if (authMode === 'apikey' && anthropicKey) {
169
+ } else if (authMode === 'apikey' && effectiveAnthropicKey) {
167
170
  ok('API key → all Claude usage (Boss + Fix Engine billed to your API quota)');
168
171
  info('CLAUDE_PRO_FOR_TASKS=false written — Fix Engine will use API key');
169
172
  warn('Heavy fix tasks will consume API tokens. Claude Pro is cheaper for those.');
@@ -194,14 +197,14 @@ module.exports = async function init() {
194
197
  if (example) {
195
198
  step('Creating example project…');
196
199
  const exampleDir = path.join(workspace, 'my-project');
197
- writeExampleProject(exampleDir, codeDir, pythonBin, anthropicKey || '', { botToken: effectiveSlackBotToken, appToken: effectiveSlackAppToken });
200
+ writeExampleProject(exampleDir, codeDir, pythonBin, effectiveAnthropicKey, { botToken: effectiveSlackBotToken, appToken: effectiveSlackAppToken });
198
201
  ok(`Example project: ${exampleDir}`);
199
202
  }
200
203
 
201
204
  // ── Workspace start/stop scripts ─────────────────────────────────────────────
202
205
  step('Generating scripts…');
203
206
  const authConfig = {};
204
- if (anthropicKey) authConfig.apiKey = anthropicKey;
207
+ if (effectiveAnthropicKey) authConfig.apiKey = effectiveAnthropicKey;
205
208
  if (authMode === 'both' || authMode === 'oauth') authConfig.claudeProForTasks = true;
206
209
  if (authMode === 'apikey') authConfig.claudeProForTasks = false;
207
210
  generateWorkspaceScripts(workspace, { host: smtpHost, user: smtpUser, password: effectiveSmtpPassword }, { botToken: effectiveSlackBotToken, appToken: effectiveSlackAppToken }, authConfig);
package/lib/upgrade.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  function ensureClaudePermissions() {
3
2
  const settingsPath = require('path').join(require('os').homedir(), '.claude', 'settings.json');
4
3
  const required = ['Read(**)', 'Write(**)', 'Edit(**)', 'Bash(**)'];
@@ -36,21 +35,17 @@ function ensureClaudePermissions() {
36
35
  }
37
36
 
38
37
  'use strict';
39
-
40
38
  const fs = require('fs-extra');
41
39
  const path = require('path');
42
40
  const os = require('os');
43
41
  const { execSync, spawnSync } = require('child_process');
44
42
  const chalk = require('chalk');
45
-
46
43
  const ok = msg => console.log(chalk.green(' ✔'), msg);
47
44
  const info = msg => console.log(chalk.cyan(' →'), msg);
48
45
  const warn = msg => console.log(chalk.yellow(' ⚠'), msg);
49
46
 
50
47
  module.exports = async function upgrade() {
51
48
  const { version: current } = require('../package.json');
52
-
53
- // Find the workspace code dir
54
49
  const defaultWorkspace = path.join(os.homedir(), 'sentinel');
55
50
  const codeDir = path.join(defaultWorkspace, 'code');
56
51
  if (!fs.existsSync(codeDir)) {
@@ -59,43 +54,34 @@ module.exports = async function upgrade() {
59
54
  process.exit(1);
60
55
  }
61
56
 
62
- // Install latest from npm
63
57
  info(`Current version: ${current}`);
64
58
  info('Installing latest @misterhuydo/sentinel...');
65
- const install = spawnSync('npm', ['install', '-g', '@misterhuydo/sentinel@latest'], { stdio: 'inherit' });
59
+ const install = spawnSync('npm', ['install', '-g', '@misterhuydo/sentinel@latest', '--prefer-online'], { stdio: 'inherit' });
66
60
  if (install.status !== 0) {
67
61
  console.error(chalk.red(' ✖ npm install failed'));
68
62
  process.exit(1);
69
63
  }
70
64
 
71
- // Upgrade dependencies
72
65
  info('Upgrading @misterhuydo/cairn-mcp...');
73
- spawnSync('npm', ['install', '-g', '@misterhuydo/cairn-mcp@latest'], { stdio: 'inherit' });
66
+ spawnSync('npm', ['install', '-g', '@misterhuydo/cairn-mcp@latest', '--prefer-online'], { stdio: 'inherit' });
74
67
  ok('@misterhuydo/cairn-mcp upgraded');
75
68
 
76
69
  info('Upgrading @anthropic-ai/claude-code...');
77
- spawnSync('npm', ['install', '-g', '@anthropic-ai/claude-code@latest'], { stdio: 'inherit' });
70
+ spawnSync('npm', ['install', '-g', '@anthropic-ai/claude-code@latest', '--prefer-online'], { stdio: 'inherit' });
78
71
  ok('@anthropic-ai/claude-code upgraded');
79
72
 
80
- // Find where npm installed it
81
73
  const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
82
74
  const pkgDir = path.join(npmRoot, '@misterhuydo', 'sentinel');
83
75
  const src = path.join(pkgDir, 'python');
84
-
85
76
  if (!fs.existsSync(src)) {
86
77
  console.error(chalk.red(' ✖ Bundled Python source not found in installed package'));
87
78
  process.exit(1);
88
79
  }
89
80
 
90
- // Hot-deploy: copy Python source to code dir
91
81
  info('Deploying Python source...');
92
82
  fs.copySync(src, codeDir, { overwrite: true });
93
-
94
- // Remove stale .pyc caches so Python recompiles from the new source
95
83
  const { execSync: _exec } = require('child_process');
96
84
  try { _exec(`find "${codeDir}" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true`); } catch (_) {}
97
-
98
- // Restore executable bit on shell scripts (npm strips it)
99
85
  const scriptsDir = path.join(codeDir, 'scripts');
100
86
  if (fs.existsSync(scriptsDir)) {
101
87
  const shFiles = fs.readdirSync(scriptsDir)
@@ -104,14 +90,13 @@ module.exports = async function upgrade() {
104
90
  if (shFiles.length) spawnSync('chmod', ['+x', ...shFiles], { stdio: 'inherit' });
105
91
  }
106
92
  ok('Python source updated');
93
+
107
94
  info('Patching Claude Code permissions…');
108
95
  ensureClaudePermissions();
109
96
 
110
- // Print new version
111
97
  const { version: latest } = require(path.join(pkgDir, 'package.json'));
112
98
  ok(`Upgraded: ${current} → ${latest}`);
113
99
 
114
- // Restart running projects
115
100
  const startAll = path.join(defaultWorkspace, 'startAll.sh');
116
101
  const stopAll = path.join(defaultWorkspace, 'stopAll.sh');
117
102
  if (fs.existsSync(stopAll) && fs.existsSync(startAll)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.0.90",
3
+ "version": "1.0.92",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"
@@ -1,100 +0,0 @@
1
- function ensureClaudePermissions() {
2
- const settingsPath = require('path').join(require('os').homedir(), '.claude', 'settings.json');
3
- const required = ['Read(**)', 'Write(**)', 'Edit(**)', 'Bash(**)'];
4
- let settings = {};
5
- try {
6
- if (fs.existsSync(settingsPath)) {
7
- settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
8
- }
9
- } catch (e) {
10
- warn('Could not read ' + settingsPath + ': ' + e.message);
11
- return;
12
- }
13
- if (!settings.permissions) settings.permissions = {};
14
- if (!Array.isArray(settings.permissions.allow)) settings.permissions.allow = [];
15
- const existing = new Set(settings.permissions.allow);
16
- const added = [];
17
- for (const perm of required) {
18
- if (!existing.has(perm)) {
19
- settings.permissions.allow.push(perm);
20
- added.push(perm);
21
- }
22
- }
23
- if (added.length === 0) {
24
- ok('Claude Code permissions already configured');
25
- return;
26
- }
27
- try {
28
- const path = require('path');
29
- fs.ensureDirSync(path.dirname(settingsPath));
30
- fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '\n');
31
- ok('Claude Code permissions patched: ' + added.join(', '));
32
- } catch (e) {
33
- warn('Could not write ' + settingsPath + ': ' + e.message);
34
- }
35
- }
36
- 'use strict';
37
- const fs = require('fs-extra');
38
- const path = require('path');
39
- const os = require('os');
40
- const { execSync, spawnSync } = require('child_process');
41
- const chalk = require('chalk');
42
- const ok = msg => console.log(chalk.green(' ✔'), msg);
43
- const info = msg => console.log(chalk.cyan(' →'), msg);
44
- const warn = msg => console.log(chalk.yellow(' ⚠'), msg);
45
- module.exports = async function upgrade() {
46
- const { version: current } = require('../package.json');
47
- const defaultWorkspace = path.join(os.homedir(), 'sentinel');
48
- const codeDir = path.join(defaultWorkspace, 'code');
49
- if (!fs.existsSync(codeDir)) {
50
- console.error(chalk.red(' ✖ Sentinel code directory not found at ' + codeDir));
51
- console.error(' Run: sentinel init');
52
- process.exit(1);
53
- }
54
- info(`Current version: ${current}`);
55
- info('Installing latest @misterhuydo/sentinel...');
56
- const install = spawnSync('npm', ['install', '-g', '@misterhuydo/sentinel@latest'], { stdio: 'inherit' });
57
- if (install.status !== 0) {
58
- console.error(chalk.red(' ✖ npm install failed'));
59
- process.exit(1);
60
- }
61
- info('Upgrading @misterhuydo/cairn-mcp...');
62
- spawnSync('npm', ['install', '-g', '@misterhuydo/cairn-mcp@latest'], { stdio: 'inherit' });
63
- ok('@misterhuydo/cairn-mcp upgraded');
64
- info('Upgrading @anthropic-ai/claude-code...');
65
- spawnSync('npm', ['install', '-g', '@anthropic-ai/claude-code@latest'], { stdio: 'inherit' });
66
- ok('@anthropic-ai/claude-code upgraded');
67
- const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
68
- const pkgDir = path.join(npmRoot, '@misterhuydo', 'sentinel');
69
- const src = path.join(pkgDir, 'python');
70
- if (!fs.existsSync(src)) {
71
- console.error(chalk.red(' ✖ Bundled Python source not found in installed package'));
72
- process.exit(1);
73
- }
74
- info('Deploying Python source...');
75
- fs.copySync(src, codeDir, { overwrite: true });
76
- const { execSync: _exec } = require('child_process');
77
- try { _exec(`find "${codeDir}" -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true`); } catch (_) {}
78
- const scriptsDir = path.join(codeDir, 'scripts');
79
- if (fs.existsSync(scriptsDir)) {
80
- const shFiles = fs.readdirSync(scriptsDir)
81
- .filter(f => f.endsWith('.sh'))
82
- .map(f => path.join(scriptsDir, f));
83
- if (shFiles.length) spawnSync('chmod', ['+x', ...shFiles], { stdio: 'inherit' });
84
- }
85
- ok('Python source updated');
86
- info('Patching Claude Code permissions…');
87
- ensureClaudePermissions();
88
- const { version: latest } = require(path.join(pkgDir, 'package.json'));
89
- ok(`Upgraded: ${current} → ${latest}`);
90
- const startAll = path.join(defaultWorkspace, 'startAll.sh');
91
- const stopAll = path.join(defaultWorkspace, 'stopAll.sh');
92
- if (fs.existsSync(stopAll) && fs.existsSync(startAll)) {
93
- info('Restarting Sentinel...');
94
- spawnSync('bash', [stopAll], { stdio: 'inherit' });
95
- spawnSync('bash', [startAll], { stdio: 'inherit' });
96
- ok('Sentinel restarted');
97
- } else {
98
- warn('No startAll.sh found — restart manually');
99
- }
100
- };