@misterhuydo/sentinel 1.0.14 → 1.0.15
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/generate.js +8 -2
- package/lib/init.js +29 -2
- package/package.json +1 -1
package/.cairn/session.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"message": "Auto-checkpoint at 2026-03-21T17:
|
|
3
|
-
"checkpoint_at": "2026-03-21T17:
|
|
2
|
+
"message": "Auto-checkpoint at 2026-03-21T17:41:53.418Z",
|
|
3
|
+
"checkpoint_at": "2026-03-21T17:41:53.419Z",
|
|
4
4
|
"active_files": [],
|
|
5
5
|
"notes": [],
|
|
6
6
|
"mtime_snapshot": {}
|
package/lib/generate.js
CHANGED
|
@@ -5,18 +5,24 @@ const path = require('path');
|
|
|
5
5
|
|
|
6
6
|
// ── Per-project files ─────────────────────────────────────────────────────────
|
|
7
7
|
|
|
8
|
-
function writeExampleProject(projectDir, codeDir, pythonBin, anthropicKey = '') {
|
|
8
|
+
function writeExampleProject(projectDir, codeDir, pythonBin, anthropicKey = '', slackTokens = {}) {
|
|
9
9
|
const configDir = path.join(projectDir, 'config', 'log-configs');
|
|
10
10
|
const repoDir = path.join(projectDir, 'config', 'repo-configs');
|
|
11
11
|
fs.ensureDirSync(configDir);
|
|
12
12
|
fs.ensureDirSync(repoDir);
|
|
13
13
|
|
|
14
14
|
const tplDir = path.join(__dirname, '..', 'templates');
|
|
15
|
-
// Per-project sentinel.properties: MAILS, GITHUB_TOKEN, optional API key
|
|
15
|
+
// Per-project sentinel.properties: MAILS, GITHUB_TOKEN, optional API key, optional Slack
|
|
16
16
|
let sentinelProps = fs.readFileSync(path.join(tplDir, 'sentinel.properties'), 'utf8');
|
|
17
17
|
if (anthropicKey) {
|
|
18
18
|
sentinelProps = sentinelProps.replace(/^# ANTHROPIC_API_KEY=.*/m, `ANTHROPIC_API_KEY=${anthropicKey}`);
|
|
19
19
|
}
|
|
20
|
+
if (slackTokens.botToken) {
|
|
21
|
+
sentinelProps = sentinelProps.replace(/^# SLACK_BOT_TOKEN=.*/m, `SLACK_BOT_TOKEN=${slackTokens.botToken}`);
|
|
22
|
+
}
|
|
23
|
+
if (slackTokens.appToken) {
|
|
24
|
+
sentinelProps = sentinelProps.replace(/^# SLACK_APP_TOKEN=.*/m, `SLACK_APP_TOKEN=${slackTokens.appToken}`);
|
|
25
|
+
}
|
|
20
26
|
fs.writeFileSync(path.join(projectDir, 'config', 'sentinel.properties'), sentinelProps);
|
|
21
27
|
fs.copySync(path.join(tplDir, 'log-configs', '_example.properties'), path.join(configDir, '_example.properties'));
|
|
22
28
|
fs.copySync(path.join(tplDir, 'repo-configs', '_example.properties'), path.join(repoDir, '_example.properties'));
|
package/lib/init.js
CHANGED
|
@@ -68,9 +68,27 @@ module.exports = async function init() {
|
|
|
68
68
|
message: 'SMTP host',
|
|
69
69
|
initial: 'smtp.gmail.com',
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
type: 'confirm',
|
|
73
|
+
name: 'setupSlack',
|
|
74
|
+
message: 'Set up Slack Bot (Sentinel Boss — conversational AI interface)?',
|
|
75
|
+
initial: false,
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
type: prev => prev ? 'password' : null,
|
|
79
|
+
name: 'slackBotToken',
|
|
80
|
+
message: 'Slack Bot Token (xoxb-...)',
|
|
81
|
+
validate: v => v.startsWith('xoxb-') ? true : 'Should start with xoxb-',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
type: (_, { slackBotToken }) => slackBotToken ? 'password' : null,
|
|
85
|
+
name: 'slackAppToken',
|
|
86
|
+
message: 'Slack App-Level Token (xapp-...)',
|
|
87
|
+
validate: v => v.startsWith('xapp-') ? true : 'Should start with xapp-',
|
|
88
|
+
},
|
|
71
89
|
], { onCancel: () => process.exit(0) });
|
|
72
90
|
|
|
73
|
-
const { workspace, authMode, anthropicKey, example, systemd, smtpUser, smtpPassword, smtpHost } = answers;
|
|
91
|
+
const { workspace, authMode, anthropicKey, example, systemd, smtpUser, smtpPassword, smtpHost, setupSlack, slackBotToken, slackAppToken } = answers;
|
|
74
92
|
const codeDir = path.join(workspace, 'code');
|
|
75
93
|
|
|
76
94
|
// ── Python ──────────────────────────────────────────────────────────────────
|
|
@@ -123,6 +141,15 @@ module.exports = async function init() {
|
|
|
123
141
|
info('Skipping auth — start.sh will prompt for login if needed');
|
|
124
142
|
}
|
|
125
143
|
|
|
144
|
+
// ── Slack Bot ────────────────────────────────────────────────────────────────
|
|
145
|
+
if (slackBotToken && slackAppToken) {
|
|
146
|
+
step('Slack Bot (Sentinel Boss)…');
|
|
147
|
+
ok('Tokens will be written to the project sentinel.properties');
|
|
148
|
+
info('Sentinel Boss starts automatically when the project starts');
|
|
149
|
+
} else if (setupSlack) {
|
|
150
|
+
warn('Slack tokens not provided — add them to config/sentinel.properties later');
|
|
151
|
+
}
|
|
152
|
+
|
|
126
153
|
// ── Workspace structure ─────────────────────────────────────────────────────
|
|
127
154
|
step('Creating workspace…');
|
|
128
155
|
fs.ensureDirSync(workspace);
|
|
@@ -132,7 +159,7 @@ module.exports = async function init() {
|
|
|
132
159
|
if (example) {
|
|
133
160
|
step('Creating example project…');
|
|
134
161
|
const exampleDir = path.join(workspace, 'my-project');
|
|
135
|
-
writeExampleProject(exampleDir, codeDir, pythonBin, anthropicKey || '');
|
|
162
|
+
writeExampleProject(exampleDir, codeDir, pythonBin, anthropicKey || '', { botToken: slackBotToken || '', appToken: slackAppToken || '' });
|
|
136
163
|
ok(`Example project: ${exampleDir}`);
|
|
137
164
|
}
|
|
138
165
|
|