@misterhuydo/sentinel 1.0.89 → 1.0.91

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,6 +1,6 @@
1
1
  {
2
- "message": "Auto-checkpoint at 2026-03-23T06:04:44.021Z",
3
- "checkpoint_at": "2026-03-23T06:04:44.022Z",
2
+ "message": "Auto-checkpoint at 2026-03-23T06:18:02.115Z",
3
+ "checkpoint_at": "2026-03-23T06:18:02.116Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/lib/generate.js CHANGED
@@ -112,13 +112,17 @@ function generateWorkspaceScripts(workspace, smtpConfig = {}, slackConfig = {},
112
112
  if (authConfig.apiKey || authConfig.claudeProForTasks !== undefined) {
113
113
  let props = fs.readFileSync(workspaceProps, 'utf8');
114
114
  if (authConfig.apiKey) {
115
- const replaced = props.replace(/^#?\s*ANTHROPIC_API_KEY=.*/m, 'ANTHROPIC_API_KEY=' + authConfig.apiKey);
116
- props = replaced !== props ? replaced : props.trimEnd() + '\nANTHROPIC_API_KEY=' + authConfig.apiKey + '\n';
115
+ if (/^#?\s*ANTHROPIC_API_KEY=/m.test(props))
116
+ props = props.replace(/^#?\s*ANTHROPIC_API_KEY=.*/mg, 'ANTHROPIC_API_KEY=' + authConfig.apiKey);
117
+ else
118
+ props = props.trimEnd() + '\nANTHROPIC_API_KEY=' + authConfig.apiKey + '\n';
117
119
  }
118
120
  if (authConfig.claudeProForTasks !== undefined) {
119
121
  const val = authConfig.claudeProForTasks ? 'true' : 'false';
120
- const replaced = props.replace(/^CLAUDE_PRO_FOR_TASKS=.*/m, 'CLAUDE_PRO_FOR_TASKS=' + val);
121
- props = replaced !== props ? replaced : props.trimEnd() + '\nCLAUDE_PRO_FOR_TASKS=' + val + '\n';
122
+ if (/^#?\s*CLAUDE_PRO_FOR_TASKS=/m.test(props))
123
+ props = props.replace(/^#?\s*CLAUDE_PRO_FOR_TASKS=.*/mg, 'CLAUDE_PRO_FOR_TASKS=' + val);
124
+ else
125
+ props = props.trimEnd() + '\nCLAUDE_PRO_FOR_TASKS=' + val + '\n';
122
126
  }
123
127
  fs.writeFileSync(workspaceProps, props);
124
128
  }
@@ -126,12 +130,16 @@ function generateWorkspaceScripts(workspace, smtpConfig = {}, slackConfig = {},
126
130
  if (slackConfig.botToken || slackConfig.appToken) {
127
131
  let props = fs.readFileSync(workspaceProps, 'utf8');
128
132
  if (slackConfig.botToken) {
129
- const replaced = props.replace(/^#?\s*SLACK_BOT_TOKEN=.*/m, 'SLACK_BOT_TOKEN=' + slackConfig.botToken);
130
- props = replaced !== props ? replaced : props.trimEnd() + '\nSLACK_BOT_TOKEN=' + slackConfig.botToken + '\n';
133
+ if (/^#?\s*SLACK_BOT_TOKEN=/m.test(props))
134
+ props = props.replace(/^#?\s*SLACK_BOT_TOKEN=.*/mg, 'SLACK_BOT_TOKEN=' + slackConfig.botToken);
135
+ else
136
+ props = props.trimEnd() + '\nSLACK_BOT_TOKEN=' + slackConfig.botToken + '\n';
131
137
  }
132
138
  if (slackConfig.appToken) {
133
- const replaced = props.replace(/^#?\s*SLACK_APP_TOKEN=.*/m, 'SLACK_APP_TOKEN=' + slackConfig.appToken);
134
- props = replaced !== props ? replaced : props.trimEnd() + '\nSLACK_APP_TOKEN=' + slackConfig.appToken + '\n';
139
+ if (/^#?\s*SLACK_APP_TOKEN=/m.test(props))
140
+ props = props.replace(/^#?\s*SLACK_APP_TOKEN=.*/mg, 'SLACK_APP_TOKEN=' + slackConfig.appToken);
141
+ else
142
+ props = props.trimEnd() + '\nSLACK_APP_TOKEN=' + slackConfig.appToken + '\n';
135
143
  }
136
144
  fs.writeFileSync(workspaceProps, props);
137
145
  }
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.0.89",
3
+ "version": "1.0.91",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"