@misterhuydo/sentinel 1.0.22 → 1.0.23
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/.cairn/session.json +2 -2
- package/lib/init.js +19 -3
- package/package.json +1 -1
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-21T19:
|
|
3
|
-
"checkpoint_at": "2026-03-21T19:
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-21T19:29:35.017Z",
|
|
3
|
+
"checkpoint_at": "2026-03-21T19:29:35.026Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/init.js
CHANGED
|
@@ -219,9 +219,26 @@ module.exports = async function init() {
|
|
|
219
219
|
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
220
220
|
|
|
221
221
|
function readExistingConfig(workspace) {
|
|
222
|
-
const propsPath = path.join(workspace, 'sentinel.properties');
|
|
223
|
-
if (!fs.existsSync(propsPath)) return {};
|
|
224
222
|
const result = {};
|
|
223
|
+
_parsePropsInto(path.join(workspace, 'sentinel.properties'), result);
|
|
224
|
+
// Migrate: if Slack tokens not in workspace config, scan project configs as fallback
|
|
225
|
+
if (!result.SLACK_BOT_TOKEN || !result.SLACK_APP_TOKEN) {
|
|
226
|
+
try {
|
|
227
|
+
for (const entry of fs.readdirSync(workspace)) {
|
|
228
|
+
const p = path.join(workspace, entry, 'config', 'sentinel.properties');
|
|
229
|
+
const proj = {};
|
|
230
|
+
_parsePropsInto(p, proj);
|
|
231
|
+
if (!result.SLACK_BOT_TOKEN && proj.SLACK_BOT_TOKEN) result.SLACK_BOT_TOKEN = proj.SLACK_BOT_TOKEN;
|
|
232
|
+
if (!result.SLACK_APP_TOKEN && proj.SLACK_APP_TOKEN) result.SLACK_APP_TOKEN = proj.SLACK_APP_TOKEN;
|
|
233
|
+
if (result.SLACK_BOT_TOKEN && result.SLACK_APP_TOKEN) break;
|
|
234
|
+
}
|
|
235
|
+
} catch (_) {}
|
|
236
|
+
}
|
|
237
|
+
return result;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function _parsePropsInto(propsPath, result) {
|
|
241
|
+
if (!fs.existsSync(propsPath)) return;
|
|
225
242
|
try {
|
|
226
243
|
const lines = fs.readFileSync(propsPath, 'utf8').split(/\r?\n/);
|
|
227
244
|
for (const raw of lines) {
|
|
@@ -232,7 +249,6 @@ function readExistingConfig(workspace) {
|
|
|
232
249
|
result[line.slice(0, idx).trim()] = line.slice(idx + 1).trim();
|
|
233
250
|
}
|
|
234
251
|
} catch (_) {}
|
|
235
|
-
return result;
|
|
236
252
|
}
|
|
237
253
|
|
|
238
254
|
function findPython() {
|