suemo 0.1.2 → 0.1.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/README.md +7 -5
- package/package.json +1 -1
- package/skills/suemo/SKILL.md +2 -0
- package/src/cli/commands/init.ts +12 -12
- package/src/skill/catalog.ts +5 -9
package/README.md
CHANGED
|
@@ -42,6 +42,8 @@ SURREAL_DATASTORE_VERSIONED=true SURREAL_DATASTORE_RETENTION=90d surreal start \
|
|
|
42
42
|
-- surrealkv:///path/to/data
|
|
43
43
|
```
|
|
44
44
|
|
|
45
|
+
Note: It is advised to create database-level admin specifically for suemo.
|
|
46
|
+
|
|
45
47
|
For suemo, the critical capability is allowing custom functions:
|
|
46
48
|
|
|
47
49
|
- `fn::*`
|
|
@@ -110,7 +112,7 @@ If `suemo` is not on root PATH, use `sudo bunx suemo ...`.
|
|
|
110
112
|
|
|
111
113
|
Drop `--dry-run` to apply changes.
|
|
112
114
|
|
|
113
|
-
`suemo init surreal` also creates `/opt/suemo/
|
|
115
|
+
`suemo init surreal` also creates `/opt/suemo/surreal/local.env` with commented overrides and does not overwrite it if it already exists. If defined in `local.env`, these values override `common.env`:
|
|
114
116
|
|
|
115
117
|
- `SURREAL_USER`
|
|
116
118
|
- `SURREAL_PASS`
|
|
@@ -123,10 +125,10 @@ What these commands do:
|
|
|
123
125
|
|
|
124
126
|
- `suemo init surreal <2gb|6gb>`
|
|
125
127
|
- checks `surrealdb` package via `pacman -Q`
|
|
126
|
-
- creates `/opt/suemo/
|
|
127
|
-
- creates `/opt/suemo/
|
|
128
|
-
- writes `/etc/systemd/system/suemo-
|
|
129
|
-
- enables + starts `suemo-
|
|
128
|
+
- creates `/opt/suemo/surreal/common.env` + profile env (`2gb.env` or `6gb.env`)
|
|
129
|
+
- creates `/opt/suemo/surreal/local.env` once (user override file; not overwritten)
|
|
130
|
+
- writes `/etc/systemd/system/suemo-surreal@.service`
|
|
131
|
+
- enables + starts `suemo-surreal@<profile>.service`
|
|
130
132
|
- includes `VERSIONED` + retention config and strict capability allowlist:
|
|
131
133
|
- `SURREAL_DATASTORE_VERSIONED=true`
|
|
132
134
|
- `SURREAL_DATASTORE_RETENTION=90d`
|
package/package.json
CHANGED
package/skills/suemo/SKILL.md
CHANGED
package/src/cli/commands/init.ts
CHANGED
|
@@ -29,9 +29,9 @@ const log = getLogger(['suemo', 'cli', 'init'])
|
|
|
29
29
|
const init = app.sub('init')
|
|
30
30
|
.meta({ description: 'Initialize suemo config and/or database schema' })
|
|
31
31
|
|
|
32
|
-
const SURREAL_PROFILES_DIR = '/opt/suemo/
|
|
33
|
-
const SURREAL_LOCAL_ENV_PATH = '/opt/suemo/
|
|
34
|
-
const SURREAL_SYSTEMD_UNIT_PATH = '/etc/systemd/system/suemo-
|
|
32
|
+
const SURREAL_PROFILES_DIR = '/opt/suemo/surreal'
|
|
33
|
+
const SURREAL_LOCAL_ENV_PATH = '/opt/suemo/surreal/local.env'
|
|
34
|
+
const SURREAL_SYSTEMD_UNIT_PATH = '/etc/systemd/system/suemo-surreal@.service'
|
|
35
35
|
const SURREAL_DATA_DIR = '/var/lib/surrealdb'
|
|
36
36
|
const FASTEMBED_INSTALL_DIR = '/opt/suemo'
|
|
37
37
|
const FASTEMBED_LOCAL_ENV_DIR = '/opt/fastembed'
|
|
@@ -52,9 +52,9 @@ Type=simple
|
|
|
52
52
|
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
53
53
|
User=surrealdb
|
|
54
54
|
Group=surrealdb
|
|
55
|
-
EnvironmentFile=/opt/suemo/
|
|
56
|
-
EnvironmentFile=/opt/suemo/
|
|
57
|
-
EnvironmentFile=-/opt/suemo/
|
|
55
|
+
EnvironmentFile=/opt/suemo/surreal/common.env
|
|
56
|
+
EnvironmentFile=/opt/suemo/surreal/%i.env
|
|
57
|
+
EnvironmentFile=-/opt/suemo/surreal/local.env
|
|
58
58
|
ExecStart=/usr/bin/surreal start
|
|
59
59
|
ExecStop=/bin/kill -s SIGTERM $MAINPID
|
|
60
60
|
Restart=on-failure
|
|
@@ -77,7 +77,7 @@ StateDirectoryMode=0750
|
|
|
77
77
|
WorkingDirectory=/var/lib/surrealdb
|
|
78
78
|
StandardOutput=journal
|
|
79
79
|
StandardError=journal
|
|
80
|
-
SyslogIdentifier=suemo-
|
|
80
|
+
SyslogIdentifier=suemo-surreal-%i
|
|
81
81
|
|
|
82
82
|
[Install]
|
|
83
83
|
WantedBy=multi-user.target
|
|
@@ -484,7 +484,7 @@ function buildSurrealActions(
|
|
|
484
484
|
{
|
|
485
485
|
kind: 'run',
|
|
486
486
|
command: 'systemctl',
|
|
487
|
-
args: ['enable', '--now', `suemo-
|
|
487
|
+
args: ['enable', '--now', `suemo-surreal@${profile}.service`],
|
|
488
488
|
requireRoot: true,
|
|
489
489
|
},
|
|
490
490
|
)
|
|
@@ -542,9 +542,9 @@ function printInitSystemSummary(kind: 'surreal' | 'fastembed', dryRun: boolean,
|
|
|
542
542
|
console.log('✓ SurrealDB setup complete.')
|
|
543
543
|
}
|
|
544
544
|
if (profile) {
|
|
545
|
-
console.log(`Service: suemo-
|
|
546
|
-
console.log(`Status: systemctl status suemo-
|
|
547
|
-
console.log(`Logs: journalctl -u suemo-
|
|
545
|
+
console.log(`Service: suemo-surreal@${profile}.service`)
|
|
546
|
+
console.log(`Status: systemctl status suemo-surreal@${profile}.service`)
|
|
547
|
+
console.log(`Logs: journalctl -u suemo-surreal@${profile}.service -f`)
|
|
548
548
|
}
|
|
549
549
|
return
|
|
550
550
|
}
|
|
@@ -849,7 +849,7 @@ const initSurrealCmd = init.sub('surreal')
|
|
|
849
849
|
ok: true,
|
|
850
850
|
dryRun: false,
|
|
851
851
|
profile,
|
|
852
|
-
service: `suemo-
|
|
852
|
+
service: `suemo-surreal@${profile}.service`,
|
|
853
853
|
credentialStatus: result.credentialStatus,
|
|
854
854
|
}, flags)
|
|
855
855
|
return
|
package/src/skill/catalog.ts
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
import { readdirSync, readFileSync } from 'node:fs'
|
|
2
|
-
import { basename,
|
|
3
|
-
import { fileURLToPath } from 'node:url'
|
|
2
|
+
import { basename, join } from 'node:path'
|
|
4
3
|
|
|
5
|
-
const PROJECT_ROOT =
|
|
6
|
-
|
|
7
|
-
)
|
|
8
|
-
|
|
9
|
-
const SKILL_FILE_PATH = `${PROJECT_ROOT}/skills/suemo/SKILL.md`
|
|
10
|
-
const SKILL_REFERENCES_DIR = `${PROJECT_ROOT}/skills/suemo/references/`
|
|
4
|
+
const PROJECT_ROOT = new URL('.', import.meta.resolve('@/package.json')).pathname
|
|
5
|
+
const SKILL_FILE_PATH = join(PROJECT_ROOT, 'skills/suemo/SKILL.md')
|
|
6
|
+
const SKILL_REFERENCES_DIR = join(PROJECT_ROOT, 'skills/suemo/references/')
|
|
11
7
|
|
|
12
8
|
export function skillFilePath(): string {
|
|
13
9
|
return SKILL_FILE_PATH
|
|
@@ -29,7 +25,7 @@ export function skillReferencePath(reference: string): string | null {
|
|
|
29
25
|
if (!cleaned) return null
|
|
30
26
|
const available = new Set(listSkillReferences())
|
|
31
27
|
if (!available.has(cleaned)) return null
|
|
32
|
-
return
|
|
28
|
+
return join(PROJECT_ROOT, `/skills/suemo/references/${cleaned}.md`)
|
|
33
29
|
}
|
|
34
30
|
|
|
35
31
|
export function readSkillReference(reference: string): { name: string; path: string; content: string } | null {
|