@misterhuydo/sentinel 1.0.84 → 1.0.85

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,8 @@
1
1
  {
2
- "J:\\Projects\\Sentinel\\cli\\bin\\sentinel.js": {
3
- "tempPath": "J:\\Projects\\Sentinel\\cli\\.cairn\\views\\a348d8_sentinel.js",
2
+ "J:\\Projects\\Sentinel\\cli\\lib\\upgrade.js": {
3
+ "tempPath": "J:\\Projects\\Sentinel\\cli\\.cairn\\views\\fb78ac_upgrade.js",
4
4
  "state": "compressed",
5
- "minifiedAt": 1774128147034.2527,
5
+ "minifiedAt": 1774243530779.686,
6
6
  "readCount": 1
7
7
  }
8
8
  }
@@ -1,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-23T05:23:48.069Z",
3
- "checkpoint_at": "2026-03-23T05:23:48.071Z",
2
+ "message": "Auto-checkpoint at 2026-03-23T05:25:59.517Z",
3
+ "checkpoint_at": "2026-03-23T05:25:59.518Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
@@ -1,3 +1,38 @@
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
+ }
1
36
  'use strict';
2
37
  const fs = require('fs-extra');
3
38
  const path = require('path');
@@ -23,6 +58,12 @@ module.exports = async function upgrade() {
23
58
  console.error(chalk.red(' ✖ npm install failed'));
24
59
  process.exit(1);
25
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');
26
67
  const npmRoot = execSync('npm root -g', { encoding: 'utf8' }).trim();
27
68
  const pkgDir = path.join(npmRoot, '@misterhuydo', 'sentinel');
28
69
  const src = path.join(pkgDir, 'python');
@@ -32,6 +73,8 @@ module.exports = async function upgrade() {
32
73
  }
33
74
  info('Deploying Python source...');
34
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 (_) {}
35
78
  const scriptsDir = path.join(codeDir, 'scripts');
36
79
  if (fs.existsSync(scriptsDir)) {
37
80
  const shFiles = fs.readdirSync(scriptsDir)
@@ -40,6 +83,8 @@ module.exports = async function upgrade() {
40
83
  if (shFiles.length) spawnSync('chmod', ['+x', ...shFiles], { stdio: 'inherit' });
41
84
  }
42
85
  ok('Python source updated');
86
+ info('Patching Claude Code permissions…');
87
+ ensureClaudePermissions();
43
88
  const { version: latest } = require(path.join(pkgDir, 'package.json'));
44
89
  ok(`Upgraded: ${current} → ${latest}`);
45
90
  const startAll = path.join(defaultWorkspace, 'startAll.sh');
package/bin/sentinel.js CHANGED
@@ -35,9 +35,27 @@ 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')();
38
+ case 'upgrade': {
39
+ let upgradeCmd;
40
+ try {
41
+ upgradeCmd = require('../lib/upgrade');
42
+ } catch (loadErr) {
43
+ // upgrade.js itself is broken — self-heal with a bare npm install
44
+ console.log(chalk.yellow(' ⚠'), 'upgrade module failed to load (' + loadErr.message + ')');
45
+ console.log(chalk.cyan(' →'), 'Running bare npm install to self-heal...');
46
+ const { spawnSync } = require('child_process');
47
+ const r = spawnSync('npm', ['install', '-g', '@misterhuydo/sentinel@latest'],
48
+ { stdio: 'inherit' });
49
+ if (r.status === 0) {
50
+ console.log(chalk.green(' ✔'), 'Self-healed — run `sentinel upgrade` again to finish');
51
+ } else {
52
+ console.error(chalk.red(' ✖'), 'npm install failed — try: npm install -g @misterhuydo/sentinel');
53
+ }
54
+ process.exit(r.status || 0);
55
+ }
56
+ await upgradeCmd();
40
57
  break;
58
+ }
41
59
  case 'help':
42
60
  default:
43
61
  printUsage();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.0.84",
3
+ "version": "1.0.85",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"