@misterhuydo/sentinel 1.0.22 → 1.0.24

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-21T19:19:54.642Z",
3
- "checkpoint_at": "2026-03-21T19:19:54.643Z",
2
+ "message": "Auto-checkpoint at 2026-03-21T19:37:13.807Z",
3
+ "checkpoint_at": "2026-03-21T19:37:13.808Z",
4
4
  "active_files": [],
5
5
  "notes": [],
6
6
  "mtime_snapshot": {}
package/lib/init.js CHANGED
@@ -96,6 +96,9 @@ module.exports = async function init() {
96
96
  ], { onCancel: () => process.exit(0) });
97
97
 
98
98
  const { workspace, authMode, anthropicKey, example, systemd, smtpUser, smtpPassword, smtpHost, setupSlack, slackBotToken, slackAppToken } = answers;
99
+ const effectiveSmtpPassword = smtpPassword || existing.SMTP_PASSWORD || '';
100
+ const effectiveSlackBotToken = slackBotToken || existing.SLACK_BOT_TOKEN || '';
101
+ const effectiveSlackAppToken = slackAppToken || existing.SLACK_APP_TOKEN || '';
99
102
  const codeDir = path.join(workspace, 'code');
100
103
 
101
104
  // ── Python ──────────────────────────────────────────────────────────────────
@@ -172,10 +175,6 @@ module.exports = async function init() {
172
175
 
173
176
  // ── Workspace start/stop scripts ─────────────────────────────────────────────
174
177
  step('Generating scripts…');
175
- // If user left password blank (pressed Enter to keep), fall back to existing
176
- const effectiveSmtpPassword = smtpPassword || existing.SMTP_PASSWORD || '';
177
- const effectiveSlackBotToken = slackBotToken || existing.SLACK_BOT_TOKEN || '';
178
- const effectiveSlackAppToken = slackAppToken || existing.SLACK_APP_TOKEN || '';
179
178
  generateWorkspaceScripts(workspace, { host: smtpHost, user: smtpUser, password: effectiveSmtpPassword }, { botToken: effectiveSlackBotToken, appToken: effectiveSlackAppToken });
180
179
  ok(`${workspace}/startAll.sh`);
181
180
  ok(`${workspace}/stopAll.sh`);
@@ -219,9 +218,26 @@ module.exports = async function init() {
219
218
  // ── Helpers ──────────────────────────────────────────────────────────────────
220
219
 
221
220
  function readExistingConfig(workspace) {
222
- const propsPath = path.join(workspace, 'sentinel.properties');
223
- if (!fs.existsSync(propsPath)) return {};
224
221
  const result = {};
222
+ _parsePropsInto(path.join(workspace, 'sentinel.properties'), result);
223
+ // Migrate: if Slack tokens not in workspace config, scan project configs as fallback
224
+ if (!result.SLACK_BOT_TOKEN || !result.SLACK_APP_TOKEN) {
225
+ try {
226
+ for (const entry of fs.readdirSync(workspace)) {
227
+ const p = path.join(workspace, entry, 'config', 'sentinel.properties');
228
+ const proj = {};
229
+ _parsePropsInto(p, proj);
230
+ if (!result.SLACK_BOT_TOKEN && proj.SLACK_BOT_TOKEN) result.SLACK_BOT_TOKEN = proj.SLACK_BOT_TOKEN;
231
+ if (!result.SLACK_APP_TOKEN && proj.SLACK_APP_TOKEN) result.SLACK_APP_TOKEN = proj.SLACK_APP_TOKEN;
232
+ if (result.SLACK_BOT_TOKEN && result.SLACK_APP_TOKEN) break;
233
+ }
234
+ } catch (_) {}
235
+ }
236
+ return result;
237
+ }
238
+
239
+ function _parsePropsInto(propsPath, result) {
240
+ if (!fs.existsSync(propsPath)) return;
225
241
  try {
226
242
  const lines = fs.readFileSync(propsPath, 'utf8').split(/\r?\n/);
227
243
  for (const raw of lines) {
@@ -232,7 +248,6 @@ function readExistingConfig(workspace) {
232
248
  result[line.slice(0, idx).trim()] = line.slice(idx + 1).trim();
233
249
  }
234
250
  } catch (_) {}
235
- return result;
236
251
  }
237
252
 
238
253
  function findPython() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@misterhuydo/sentinel",
3
- "version": "1.0.22",
3
+ "version": "1.0.24",
4
4
  "description": "Sentinel — Autonomous DevOps Agent installer and manager",
5
5
  "bin": {
6
6
  "sentinel": "./bin/sentinel.js"