@misterhuydo/sentinel 1.0.76 → 1.0.82

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/lib/upgrade.js CHANGED
@@ -1,3 +1,41 @@
1
+
2
+ function ensureClaudePermissions() {
3
+ const settingsPath = require('path').join(require('os').homedir(), '.claude', 'settings.json');
4
+ const required = ['Read(**)', 'Write(**)', 'Edit(**)', 'Bash(**)'];
5
+ let settings = {};
6
+ try {
7
+ if (fs.existsSync(settingsPath)) {
8
+ settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
9
+ }
10
+ } catch (e) {
11
+ warn('Could not read ' + settingsPath + ': ' + e.message);
12
+ return;
13
+ }
14
+ if (!settings.permissions) settings.permissions = {};
15
+ if (!Array.isArray(settings.permissions.allow)) settings.permissions.allow = [];
16
+ const existing = new Set(settings.permissions.allow);
17
+ const added = [];
18
+ for (const perm of required) {
19
+ if (!existing.has(perm)) {
20
+ settings.permissions.allow.push(perm);
21
+ added.push(perm);
22
+ }
23
+ }
24
+ if (added.length === 0) {
25
+ ok('Claude Code permissions already configured');
26
+ return;
27
+ }
28
+ try {
29
+ const path = require('path');
30
+ fs.ensureDirSync(path.dirname(settingsPath));
31
+ fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2) + '
32
+ ');
33
+ ok('Claude Code permissions patched: ' + added.join(', '));
34
+ } catch (e) {
35
+ warn('Could not write ' + settingsPath + ': ' + e.message);
36
+ }
37
+ }
38
+
1
39
  'use strict';
2
40
 
3
41
  const fs = require('fs-extra');
@@ -67,6 +105,8 @@ module.exports = async function upgrade() {
67
105
  if (shFiles.length) spawnSync('chmod', ['+x', ...shFiles], { stdio: 'inherit' });
68
106
  }
69
107
  ok('Python source updated');
108
+ info('Patching Claude Code permissions…');
109
+ ensureClaudePermissions();
70
110
 
71
111
  // Print new version
72
112
  const { version: latest } = require(path.join(pkgDir, 'package.json'));
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
- {
2
- "name": "@misterhuydo/sentinel",
3
- "version": "1.0.76",
4
- "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
- "bin": {
6
- "sentinel": "./bin/sentinel.js"
7
- },
8
- "scripts": {
9
- "prepublishOnly": "node scripts/bundle.js"
10
- },
11
- "dependencies": {
12
- "chalk": "^4.1.2",
13
- "fs-extra": "^11.2.0",
14
- "prompts": "^2.4.2"
15
- },
16
- "engines": {
17
- "node": ">=16"
18
- },
19
- "author": "misterhuydo",
20
- "license": "MIT"
21
- }
1
+ {
2
+ "name": "@misterhuydo/sentinel",
3
+ "version": "1.0.82",
4
+ "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
+ "bin": {
6
+ "sentinel": "./bin/sentinel.js"
7
+ },
8
+ "scripts": {
9
+ "prepublishOnly": "node scripts/bundle.js"
10
+ },
11
+ "dependencies": {
12
+ "chalk": "^4.1.2",
13
+ "fs-extra": "^11.2.0",
14
+ "prompts": "^2.4.2"
15
+ },
16
+ "engines": {
17
+ "node": ">=16"
18
+ },
19
+ "author": "misterhuydo",
20
+ "license": "MIT"
21
+ }
@@ -124,7 +124,9 @@ def generate_fix(
124
124
  env["ANTHROPIC_API_KEY"] = cfg.anthropic_api_key
125
125
  try:
126
126
  result = subprocess.run(
127
- [cfg.claude_code_bin, "--permission-mode", "bypassPermissions", "--print", prompt],
127
+ ([cfg.claude_code_bin, "--dangerously-skip-permissions", "--print", prompt]
128
+ if os.getuid() != 0 else
129
+ [cfg.claude_code_bin, "--print", prompt]),
128
130
  capture_output=True, text=True, timeout=SUBPROCESS_TIMEOUT, env=env,
129
131
  )
130
132
  except subprocess.TimeoutExpired: