@misterhuydo/sentinel 1.0.1 → 1.0.3
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/generate.js +11 -1
- package/lib/init.js +246 -234
- package/package.json +21 -21
package/lib/generate.js
CHANGED
|
@@ -31,7 +31,17 @@ function generateProjectScripts(projectDir, codeDir, pythonBin) {
|
|
|
31
31
|
|
|
32
32
|
// init.sh
|
|
33
33
|
fs.writeFileSync(path.join(projectDir, 'init.sh'), `#!/usr/bin/env bash
|
|
34
|
-
# First-time setup
|
|
34
|
+
# First-time setup for this Sentinel project instance.
|
|
35
|
+
#
|
|
36
|
+
# What this does:
|
|
37
|
+
# - Clones any repos defined in config/repo-configs/ that don't exist locally yet
|
|
38
|
+
# (skips repos that are already cloned — safe to run multiple times)
|
|
39
|
+
# - Indexes each repo with Cairn MCP for codebase context
|
|
40
|
+
# - Tests SSH connectivity to each configured log source
|
|
41
|
+
# - Sends a test email to verify SMTP settings
|
|
42
|
+
#
|
|
43
|
+
# Note: ongoing repo management (git pull, conflict resolution) is handled
|
|
44
|
+
# automatically by Sentinel on each fix cycle — you don't need to do it manually.
|
|
35
45
|
set -euo pipefail
|
|
36
46
|
cd "$(dirname "$0")"
|
|
37
47
|
PYTHONPATH="${codeDir}" "${pythonBin}" -m sentinel.main --config ./config --init
|
package/lib/init.js
CHANGED
|
@@ -1,234 +1,246 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('fs-extra');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const os = require('os');
|
|
6
|
-
const { execSync, spawnSync } = require('child_process');
|
|
7
|
-
const prompts = require('prompts');
|
|
8
|
-
const chalk = require('chalk');
|
|
9
|
-
const { generateProjectScripts, generateWorkspaceScripts, writeExampleProject } = require('./generate');
|
|
10
|
-
|
|
11
|
-
const ok = msg => console.log(chalk.green(' ✔'), msg);
|
|
12
|
-
const info = msg => console.log(chalk.cyan(' →'), msg);
|
|
13
|
-
const warn = msg => console.log(chalk.yellow(' ⚠'), msg);
|
|
14
|
-
const step = msg => console.log('\n' + chalk.bold.white(msg));
|
|
15
|
-
|
|
16
|
-
module.exports = async function init() {
|
|
17
|
-
// ── Prompts ─────────────────────────────────────────────────────────────────
|
|
18
|
-
const answers = await prompts([
|
|
19
|
-
{
|
|
20
|
-
type: 'text',
|
|
21
|
-
name: 'workspace',
|
|
22
|
-
message: 'Workspace directory (each project lives here as a subdirectory)',
|
|
23
|
-
initial: path.join(os.homedir(), 'sentinel'),
|
|
24
|
-
format: v => v.replace(/^~/, os.homedir()),
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: 'select',
|
|
28
|
-
name: 'authMode',
|
|
29
|
-
message: 'How will Claude Code authenticate?',
|
|
30
|
-
choices: [
|
|
31
|
-
{ title: 'API key (Anthropic API account — recommended for servers)', value: 'apikey' },
|
|
32
|
-
{ title: 'Claude Pro / OAuth (will give you a URL to open in any browser)', value: 'oauth' },
|
|
33
|
-
{ title: 'Skip (I will configure this later)', value: 'skip' },
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
type: prev => prev === 'apikey' ? 'password' : null,
|
|
38
|
-
name: 'anthropicKey',
|
|
39
|
-
message: 'Anthropic API key (sk-ant-...)',
|
|
40
|
-
validate: v => v.startsWith('sk-ant-') ? true : 'Key should start with sk-ant-',
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: 'confirm',
|
|
44
|
-
name: 'example',
|
|
45
|
-
message: 'Create an example project to show how to configure?',
|
|
46
|
-
initial: true,
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
type: 'confirm',
|
|
50
|
-
name: 'systemd',
|
|
51
|
-
message: 'Set up systemd service for auto-start on reboot?',
|
|
52
|
-
initial: process.platform === 'linux',
|
|
53
|
-
},
|
|
54
|
-
], { onCancel: () => process.exit(0) });
|
|
55
|
-
|
|
56
|
-
const { workspace, authMode, anthropicKey, example, systemd } = answers;
|
|
57
|
-
const codeDir = path.join(workspace, 'code');
|
|
58
|
-
|
|
59
|
-
// ── Python ──────────────────────────────────────────────────────────────────
|
|
60
|
-
step('Checking Python…');
|
|
61
|
-
const python = findPython();
|
|
62
|
-
if (!python) {
|
|
63
|
-
console.error(chalk.red(' ✖ python3 not found. Install it first:'));
|
|
64
|
-
console.error(' sudo apt-get install -y python3 python3-pip python3-venv');
|
|
65
|
-
process.exit(1);
|
|
66
|
-
}
|
|
67
|
-
ok(`Python: ${run(python, ['--version']).trim()}`);
|
|
68
|
-
|
|
69
|
-
// ── Copy Sentinel Python source ─────────────────────────────────────────────
|
|
70
|
-
step('Installing Sentinel code…');
|
|
71
|
-
const bundledPython = path.join(__dirname, '..', 'python');
|
|
72
|
-
if (!fs.existsSync(bundledPython)) {
|
|
73
|
-
console.error(chalk.red(' ✖ Bundled Python source not found (run npm publish from the Sentinel repo)'));
|
|
74
|
-
process.exit(1);
|
|
75
|
-
}
|
|
76
|
-
fs.ensureDirSync(codeDir);
|
|
77
|
-
fs.copySync(bundledPython, codeDir, { overwrite: true });
|
|
78
|
-
ok(`Sentinel code → ${codeDir}`);
|
|
79
|
-
|
|
80
|
-
// ── Python venv ─────────────────────────────────────────────────────────────
|
|
81
|
-
step('Setting up Python environment…');
|
|
82
|
-
const venv = path.join(codeDir, '.venv');
|
|
83
|
-
if (!fs.existsSync(venv)) {
|
|
84
|
-
info('Creating virtual environment…');
|
|
85
|
-
runLive(python, ['-m', 'venv', venv]);
|
|
86
|
-
}
|
|
87
|
-
const pip = path.join(venv, 'bin', 'pip3');
|
|
88
|
-
const pythonBin = path.join(venv, 'bin', 'python3');
|
|
89
|
-
info('Installing Python packages…');
|
|
90
|
-
runLive(pip, ['install', '--quiet', '--upgrade', 'pip']);
|
|
91
|
-
runLive(pip, ['install', '--quiet', '-r', path.join(codeDir, 'requirements.txt')]);
|
|
92
|
-
ok('Python packages installed');
|
|
93
|
-
|
|
94
|
-
// ── Node tools ──────────────────────────────────────────────────────────────
|
|
95
|
-
step('Installing Node tools…');
|
|
96
|
-
installNpmGlobal('@misterhuydo/cairn-mcp', 'cairn');
|
|
97
|
-
installNpmGlobal('@anthropic-ai/claude-code', 'claude');
|
|
98
|
-
|
|
99
|
-
// ── Claude Code auth ─────────────────────────────────────────────────────────
|
|
100
|
-
step('Claude Code authentication…');
|
|
101
|
-
if (authMode === 'apikey' && anthropicKey) {
|
|
102
|
-
ok('API key will be written to each project\'s sentinel.properties');
|
|
103
|
-
} else if (authMode === 'oauth') {
|
|
104
|
-
console.log(chalk.yellow(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
${chalk.cyan(`${workspace}/
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
${chalk.cyan(
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
`)
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
${chalk.cyan(
|
|
165
|
-
`);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs-extra');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
const { execSync, spawnSync } = require('child_process');
|
|
7
|
+
const prompts = require('prompts');
|
|
8
|
+
const chalk = require('chalk');
|
|
9
|
+
const { generateProjectScripts, generateWorkspaceScripts, writeExampleProject } = require('./generate');
|
|
10
|
+
|
|
11
|
+
const ok = msg => console.log(chalk.green(' ✔'), msg);
|
|
12
|
+
const info = msg => console.log(chalk.cyan(' →'), msg);
|
|
13
|
+
const warn = msg => console.log(chalk.yellow(' ⚠'), msg);
|
|
14
|
+
const step = msg => console.log('\n' + chalk.bold.white(msg));
|
|
15
|
+
|
|
16
|
+
module.exports = async function init() {
|
|
17
|
+
// ── Prompts ─────────────────────────────────────────────────────────────────
|
|
18
|
+
const answers = await prompts([
|
|
19
|
+
{
|
|
20
|
+
type: 'text',
|
|
21
|
+
name: 'workspace',
|
|
22
|
+
message: 'Workspace directory (each project lives here as a subdirectory)',
|
|
23
|
+
initial: path.join(os.homedir(), 'sentinel'),
|
|
24
|
+
format: v => v.replace(/^~/, os.homedir()),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'select',
|
|
28
|
+
name: 'authMode',
|
|
29
|
+
message: 'How will Claude Code authenticate?',
|
|
30
|
+
choices: [
|
|
31
|
+
{ title: 'API key (Anthropic API account — recommended for servers)', value: 'apikey' },
|
|
32
|
+
{ title: 'Claude Pro / OAuth (will give you a URL to open in any browser)', value: 'oauth' },
|
|
33
|
+
{ title: 'Skip (I will configure this later)', value: 'skip' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
type: prev => prev === 'apikey' ? 'password' : null,
|
|
38
|
+
name: 'anthropicKey',
|
|
39
|
+
message: 'Anthropic API key (sk-ant-...)',
|
|
40
|
+
validate: v => v.startsWith('sk-ant-') ? true : 'Key should start with sk-ant-',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: 'confirm',
|
|
44
|
+
name: 'example',
|
|
45
|
+
message: 'Create an example project to show how to configure?',
|
|
46
|
+
initial: true,
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
type: 'confirm',
|
|
50
|
+
name: 'systemd',
|
|
51
|
+
message: 'Set up systemd service for auto-start on reboot?',
|
|
52
|
+
initial: process.platform === 'linux',
|
|
53
|
+
},
|
|
54
|
+
], { onCancel: () => process.exit(0) });
|
|
55
|
+
|
|
56
|
+
const { workspace, authMode, anthropicKey, example, systemd } = answers;
|
|
57
|
+
const codeDir = path.join(workspace, 'code');
|
|
58
|
+
|
|
59
|
+
// ── Python ──────────────────────────────────────────────────────────────────
|
|
60
|
+
step('Checking Python…');
|
|
61
|
+
const python = findPython();
|
|
62
|
+
if (!python) {
|
|
63
|
+
console.error(chalk.red(' ✖ python3 not found. Install it first:'));
|
|
64
|
+
console.error(' sudo apt-get install -y python3 python3-pip python3-venv');
|
|
65
|
+
process.exit(1);
|
|
66
|
+
}
|
|
67
|
+
ok(`Python: ${run(python, ['--version']).trim()}`);
|
|
68
|
+
|
|
69
|
+
// ── Copy Sentinel Python source ─────────────────────────────────────────────
|
|
70
|
+
step('Installing Sentinel code…');
|
|
71
|
+
const bundledPython = path.join(__dirname, '..', 'python');
|
|
72
|
+
if (!fs.existsSync(bundledPython)) {
|
|
73
|
+
console.error(chalk.red(' ✖ Bundled Python source not found (run npm publish from the Sentinel repo)'));
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
fs.ensureDirSync(codeDir);
|
|
77
|
+
fs.copySync(bundledPython, codeDir, { overwrite: true });
|
|
78
|
+
ok(`Sentinel code → ${codeDir}`);
|
|
79
|
+
|
|
80
|
+
// ── Python venv ─────────────────────────────────────────────────────────────
|
|
81
|
+
step('Setting up Python environment…');
|
|
82
|
+
const venv = path.join(codeDir, '.venv');
|
|
83
|
+
if (!fs.existsSync(venv)) {
|
|
84
|
+
info('Creating virtual environment…');
|
|
85
|
+
runLive(python, ['-m', 'venv', venv]);
|
|
86
|
+
}
|
|
87
|
+
const pip = path.join(venv, 'bin', 'pip3');
|
|
88
|
+
const pythonBin = path.join(venv, 'bin', 'python3');
|
|
89
|
+
info('Installing Python packages…');
|
|
90
|
+
runLive(pip, ['install', '--quiet', '--upgrade', 'pip']);
|
|
91
|
+
runLive(pip, ['install', '--quiet', '-r', path.join(codeDir, 'requirements.txt')]);
|
|
92
|
+
ok('Python packages installed');
|
|
93
|
+
|
|
94
|
+
// ── Node tools ──────────────────────────────────────────────────────────────
|
|
95
|
+
step('Installing Node tools…');
|
|
96
|
+
installNpmGlobal('@misterhuydo/cairn-mcp', 'cairn');
|
|
97
|
+
installNpmGlobal('@anthropic-ai/claude-code', 'claude');
|
|
98
|
+
|
|
99
|
+
// ── Claude Code auth ─────────────────────────────────────────────────────────
|
|
100
|
+
step('Claude Code authentication…');
|
|
101
|
+
if (authMode === 'apikey' && anthropicKey) {
|
|
102
|
+
ok('API key will be written to each project\'s sentinel.properties');
|
|
103
|
+
} else if (authMode === 'oauth') {
|
|
104
|
+
console.log(chalk.yellow(
|
|
105
|
+
'\n Launching Claude Code login — type /login at the prompt to get your auth URL.\n' +
|
|
106
|
+
' Open the URL in any browser, log in with your Claude Pro account,\n' +
|
|
107
|
+
' then type /exit (or Ctrl-C) to return here.\n'
|
|
108
|
+
));
|
|
109
|
+
spawnSync('claude', [], { stdio: 'inherit' });
|
|
110
|
+
// Verify auth succeeded after the user exits claude
|
|
111
|
+
const authCheck = spawnSync('claude', ['--print', 'hi'], { encoding: 'utf8', timeout: 15000 });
|
|
112
|
+
const authOut = (authCheck.stdout || '') + (authCheck.stderr || '');
|
|
113
|
+
if (authOut.toLowerCase().includes('not logged in') || authOut.toLowerCase().includes('/login')) {
|
|
114
|
+
warn('Not authenticated yet — run "claude" and type /login when ready');
|
|
115
|
+
} else {
|
|
116
|
+
ok('Claude Code authenticated via OAuth');
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
warn('Skipping auth — set ANTHROPIC_API_KEY in sentinel.properties or run "claude" to authenticate');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// ── Workspace structure ─────────────────────────────────────────────────────
|
|
123
|
+
step('Creating workspace…');
|
|
124
|
+
fs.ensureDirSync(workspace);
|
|
125
|
+
ok(`Workspace: ${workspace}`);
|
|
126
|
+
|
|
127
|
+
// ── Example project ─────────────────────────────────────────────────────────
|
|
128
|
+
if (example) {
|
|
129
|
+
step('Creating example project…');
|
|
130
|
+
const exampleDir = path.join(workspace, 'my-project');
|
|
131
|
+
writeExampleProject(exampleDir, codeDir, pythonBin, anthropicKey || '');
|
|
132
|
+
ok(`Example project: ${exampleDir}`);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// ── Workspace start/stop scripts ─────────────────────────────────────────────
|
|
136
|
+
step('Generating scripts…');
|
|
137
|
+
generateWorkspaceScripts(workspace);
|
|
138
|
+
ok(`${workspace}/startAll.sh`);
|
|
139
|
+
ok(`${workspace}/stopAll.sh`);
|
|
140
|
+
|
|
141
|
+
// ── systemd ──────────────────────────────────────────────────────────────────
|
|
142
|
+
if (systemd) {
|
|
143
|
+
step('Setting up systemd…');
|
|
144
|
+
setupSystemd(workspace);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// ── Done ─────────────────────────────────────────────────────────────────────
|
|
148
|
+
console.log('\n' + chalk.bold.green('══ Done! ══') + '\n');
|
|
149
|
+
console.log(`${chalk.bold('Next steps:')}`);
|
|
150
|
+
if (example) {
|
|
151
|
+
console.log(`
|
|
152
|
+
1. Configure your first project:
|
|
153
|
+
${chalk.cyan(`${workspace}/my-project/config/sentinel.properties`)}
|
|
154
|
+
${chalk.cyan(`${workspace}/my-project/config/log-configs/`)}
|
|
155
|
+
${chalk.cyan(`${workspace}/my-project/config/repo-configs/`)}
|
|
156
|
+
|
|
157
|
+
2. First-time init (clones repos, tests SSH, sends test email):
|
|
158
|
+
${chalk.cyan(`${workspace}/my-project/init.sh`)}
|
|
159
|
+
|
|
160
|
+
3. Start all projects:
|
|
161
|
+
${chalk.cyan(`${workspace}/startAll.sh`)}
|
|
162
|
+
|
|
163
|
+
4. Stop all projects:
|
|
164
|
+
${chalk.cyan(`${workspace}/stopAll.sh`)}
|
|
165
|
+
`);
|
|
166
|
+
}
|
|
167
|
+
if (systemd) {
|
|
168
|
+
console.log(` Auto-start is enabled. To manage:
|
|
169
|
+
${chalk.cyan('sudo systemctl start sentinel')}
|
|
170
|
+
${chalk.cyan('sudo systemctl status sentinel')}
|
|
171
|
+
${chalk.cyan('journalctl -u sentinel -f')}
|
|
172
|
+
`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log(` Add another project anytime:
|
|
176
|
+
${chalk.cyan('sentinel add <project-name>')}
|
|
177
|
+
`);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
181
|
+
|
|
182
|
+
function findPython() {
|
|
183
|
+
for (const bin of ['python3', 'python']) {
|
|
184
|
+
try {
|
|
185
|
+
execSync(`${bin} --version`, { stdio: 'pipe' });
|
|
186
|
+
return bin;
|
|
187
|
+
} catch (_) {}
|
|
188
|
+
}
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function run(bin, args) {
|
|
193
|
+
const r = spawnSync(bin, args, { encoding: 'utf8' });
|
|
194
|
+
return (r.stdout || '') + (r.stderr || '');
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function runLive(bin, args) {
|
|
198
|
+
const r = spawnSync(bin, args, { stdio: 'inherit' });
|
|
199
|
+
if (r.status !== 0) {
|
|
200
|
+
console.error(chalk.red(` ✖ Command failed: ${bin} ${args.join(' ')}`));
|
|
201
|
+
process.exit(1);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function installNpmGlobal(pkg, checkBin) {
|
|
206
|
+
try {
|
|
207
|
+
execSync(`${checkBin} --version`, { stdio: 'pipe' });
|
|
208
|
+
ok(`${pkg} already installed`);
|
|
209
|
+
} catch (_) {
|
|
210
|
+
info(`Installing ${pkg}…`);
|
|
211
|
+
runLive('npm', ['install', '-g', pkg]);
|
|
212
|
+
ok(`${pkg} installed`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
function setupSystemd(workspace) {
|
|
217
|
+
const user = os.userInfo().username;
|
|
218
|
+
const svc = `/etc/systemd/system/sentinel.service`;
|
|
219
|
+
const content = `[Unit]
|
|
220
|
+
Description=Sentinel — Autonomous DevOps Agent
|
|
221
|
+
After=network-online.target
|
|
222
|
+
Wants=network-online.target
|
|
223
|
+
|
|
224
|
+
[Service]
|
|
225
|
+
Type=forking
|
|
226
|
+
User=${user}
|
|
227
|
+
WorkingDirectory=${workspace}
|
|
228
|
+
ExecStart=${workspace}/startAll.sh
|
|
229
|
+
ExecStop=${workspace}/stopAll.sh
|
|
230
|
+
Restart=on-failure
|
|
231
|
+
RestartSec=10
|
|
232
|
+
|
|
233
|
+
[Install]
|
|
234
|
+
WantedBy=multi-user.target
|
|
235
|
+
`;
|
|
236
|
+
try {
|
|
237
|
+
fs.writeFileSync('/tmp/sentinel.service', content);
|
|
238
|
+
execSync(`sudo mv /tmp/sentinel.service ${svc}`);
|
|
239
|
+
execSync('sudo systemctl daemon-reload');
|
|
240
|
+
execSync('sudo systemctl enable sentinel');
|
|
241
|
+
ok('sentinel.service enabled');
|
|
242
|
+
} catch (e) {
|
|
243
|
+
warn(`Could not write systemd service (need sudo): ${e.message}`);
|
|
244
|
+
warn(`Manually create ${svc} to auto-start on reboot`);
|
|
245
|
+
}
|
|
246
|
+
}
|
package/package.json
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@misterhuydo/sentinel",
|
|
3
|
-
"version": "1.0.
|
|
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.3",
|
|
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
|
+
}
|