@rhizogrip/spore-cli 1.9.0 → 1.10.0
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/package.json +2 -2
- package/src/dispatch.js +1 -0
- package/src/services.js +12 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Christophe Le Bars",
|
|
6
6
|
"email": "clb@toort.net"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"tui": "node bin/spore.js tui"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@rhizogrip/spore": "1.
|
|
53
|
+
"@rhizogrip/spore": "1.10.0",
|
|
54
54
|
"chalk": "^6.0.1",
|
|
55
55
|
"minimist": "^1.2.8"
|
|
56
56
|
},
|
package/src/dispatch.js
CHANGED
|
@@ -451,6 +451,7 @@ function renderPlugin (result) {
|
|
|
451
451
|
}
|
|
452
452
|
for (const [i, [name, path]] of Object.entries(result.programs).entries()) line(i ? '' : 'programs', `${name} → ${path}`)
|
|
453
453
|
for (const [i, [name, value]] of Object.entries(result.env).entries()) line(i ? '' : 'env', `${name}=${value}`)
|
|
454
|
+
if (result.contain) line('contain', `${result.contain.keep}, and nothing else of ${result.contain.hide}`)
|
|
454
455
|
if (result.modules.length) line('modules', `${result.modules.join(', ')} → node_modules/, for the agent's programs`)
|
|
455
456
|
if (result.sources.length) line('sources', `${result.sources.join(', ')} — granted with the plugin, held by the runner`)
|
|
456
457
|
if (result.reference) line('reference', `${result.reference} → plugins/${result.name}.md`)
|
package/src/services.js
CHANGED
|
@@ -46,20 +46,18 @@ const sshKeysCheck = (keys) => [
|
|
|
46
46
|
].join('\n')
|
|
47
47
|
|
|
48
48
|
/**
|
|
49
|
-
* The sluice broker spores reach:
|
|
50
|
-
*
|
|
49
|
+
* The sluice broker spores reach: one socket per spore, each serving `<spore>.rules` from this
|
|
50
|
+
* folder beside `config.json`; the binary is the one on PATH, or where `cargo install` puts it.
|
|
51
51
|
*/
|
|
52
|
-
const
|
|
53
|
-
const SLUICE_RULES = join(SLUICE_DIR, 'spore.rules')
|
|
54
|
-
const SLUICE_LIST = join(SLUICE_DIR, 'spore.md')
|
|
52
|
+
export const SLUICE_RULES_DIR = join(CONFIG_DIR, 'sluice')
|
|
55
53
|
const sluiceBinary = () => (process.env.PATH ?? '').split(':').filter(Boolean).map(dir => join(dir, 'sluice')).find(path => existsSync(path)) ??
|
|
56
54
|
join(homedir(), '.cargo', 'bin', 'sluice')
|
|
57
55
|
|
|
58
|
-
const sluiceCheck = (binary) => [
|
|
56
|
+
const sluiceCheck = (binary, rules) => [
|
|
59
57
|
`[ -x ${quoted(binary)} ] || { echo "no sluice at ${binary} — cargo install sluicify" >&2; exit 1; }`,
|
|
60
|
-
|
|
61
|
-
`[ -
|
|
62
|
-
`${quoted(binary)} check ${quoted(
|
|
58
|
+
`${quoted(binary)} serve --help | grep -q -- --rules-dir || { echo "${binary} serves one rules file only — cargo install sluicify for 0.4 or later" >&2; exit 1; }`,
|
|
59
|
+
`[ -d ${quoted(rules)} ] || { echo "no ${rules} — mkdir -m 700 -p ${rules}, then one <spore>.rules per spore; the plugin's examples/spore.rules is a start" >&2; exit 1; }`,
|
|
60
|
+
`${quoted(binary)} check --rules-dir ${quoted(rules)}`
|
|
63
61
|
].join('\n')
|
|
64
62
|
|
|
65
63
|
/**
|
|
@@ -147,21 +145,19 @@ export const SERVICES = Object.freeze({
|
|
|
147
145
|
})
|
|
148
146
|
},
|
|
149
147
|
sluice: {
|
|
150
|
-
what: 'runs the host commands
|
|
148
|
+
what: 'runs the host commands each spore may ask for, as ~/.config/spore/sluice/<spore>.rules allows',
|
|
151
149
|
primary: 'spore-sluice.service',
|
|
152
150
|
runs: 'spore-sluice.service',
|
|
153
|
-
check: () => ['/bin/sh', ['-c', sluiceCheck(sluiceBinary())]],
|
|
154
|
-
next: ({ uid }) => `spore plugin allow sluice
|
|
151
|
+
check: () => ['/bin/sh', ['-c', sluiceCheck(sluiceBinary(), SLUICE_RULES_DIR)]],
|
|
152
|
+
next: ({ uid }) => `spore plugin allow sluice dir=/run/user/${uid}/sluice`,
|
|
155
153
|
units: () => ({
|
|
156
154
|
'spore-sluice.service': [
|
|
157
155
|
'[Unit]',
|
|
158
|
-
'Description=spore sluice: the host commands
|
|
156
|
+
'Description=spore sluice: the host commands each spore may ask for',
|
|
159
157
|
`${MARKER}=sluice`,
|
|
160
158
|
'',
|
|
161
159
|
'[Service]',
|
|
162
|
-
|
|
163
|
-
`ExecStartPre=/bin/cp ${quoted(SLUICE_LIST)} %t/sluice/spore.md`,
|
|
164
|
-
`ExecStart=${quoted(sluiceBinary())} serve --rules ${quoted(SLUICE_RULES)} --socket %t/sluice/spore.sock`,
|
|
160
|
+
`ExecStart=${quoted(sluiceBinary())} serve --rules-dir ${quoted(SLUICE_RULES_DIR)} --socket-dir %t/sluice/spores`,
|
|
165
161
|
'Restart=on-failure',
|
|
166
162
|
'',
|
|
167
163
|
'[Install]',
|