theslopmachine 0.3.6 → 0.3.7
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/RELEASE.md +3 -3
- package/package.json +1 -1
- package/src/cli.js +2 -1
- package/src/constants.js +1 -1
- package/src/install.js +89 -7
package/RELEASE.md
CHANGED
|
@@ -41,13 +41,13 @@ npm pack
|
|
|
41
41
|
This should produce a tarball such as:
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
theslopmachine-0.3.
|
|
44
|
+
theslopmachine-0.3.7.tgz
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
## Inspect package contents
|
|
48
48
|
|
|
49
49
|
```bash
|
|
50
|
-
tar -tzf theslopmachine-0.3.
|
|
50
|
+
tar -tzf theslopmachine-0.3.7.tgz
|
|
51
51
|
```
|
|
52
52
|
|
|
53
53
|
Check that the tarball includes:
|
|
@@ -78,4 +78,4 @@ npm publish --dry-run
|
|
|
78
78
|
|
|
79
79
|
- bump `package.json` version before each release
|
|
80
80
|
- keep the CLI command as `slopmachine`
|
|
81
|
-
- keep the npm package name as `
|
|
81
|
+
- keep the npm package name as `theslopmachine`
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { PACKAGE_VERSION } from './constants.js'
|
|
1
2
|
import { runInit } from './init.js'
|
|
2
3
|
import { runInstall } from './install.js'
|
|
3
4
|
|
|
4
5
|
function printHelp() {
|
|
5
|
-
console.log(`theslopmachine
|
|
6
|
+
console.log(`theslopmachine ${PACKAGE_VERSION}
|
|
6
7
|
|
|
7
8
|
Commands:
|
|
8
9
|
setup Configure theslopmachine in the local user environment
|
package/src/constants.js
CHANGED
|
@@ -2,7 +2,7 @@ import os from 'node:os'
|
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { fileURLToPath } from 'node:url'
|
|
4
4
|
|
|
5
|
-
export const PACKAGE_VERSION = '0.3.
|
|
5
|
+
export const PACKAGE_VERSION = '0.3.7'
|
|
6
6
|
export const OPCODE_VERSION = '1.3.5'
|
|
7
7
|
export const BEADS_VERSION = '0.52.0'
|
|
8
8
|
export const PACKAGE_ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..')
|
package/src/install.js
CHANGED
|
@@ -44,6 +44,7 @@ function getUnixBeadsBinDirs() {
|
|
|
44
44
|
const home = getHomeDir()
|
|
45
45
|
return [
|
|
46
46
|
path.join(home, '.local', 'bin'),
|
|
47
|
+
path.join(home, 'go', 'bin'),
|
|
47
48
|
path.join(home, '.linuxbrew', 'bin'),
|
|
48
49
|
'/opt/homebrew/bin',
|
|
49
50
|
'/usr/local/bin',
|
|
@@ -51,6 +52,10 @@ function getUnixBeadsBinDirs() {
|
|
|
51
52
|
]
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
function getLinuxBeadsBinDir() {
|
|
56
|
+
return path.join(getHomeDir(), '.local', 'bin')
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
function getWindowsBeadsBinDirs() {
|
|
55
60
|
if (process.platform !== 'win32') {
|
|
56
61
|
return []
|
|
@@ -170,6 +175,47 @@ async function ensureUnixBeadsPath() {
|
|
|
170
175
|
}
|
|
171
176
|
}
|
|
172
177
|
|
|
178
|
+
async function installLinuxBeadsPrerequisites() {
|
|
179
|
+
const managers = await detectPackageManagers()
|
|
180
|
+
|
|
181
|
+
if (managers.apt) {
|
|
182
|
+
log('Installing Linux Beads build dependencies via apt')
|
|
183
|
+
const updateResult = await runCommand('sudo', ['apt-get', 'update'], { stdio: 'inherit' })
|
|
184
|
+
if (updateResult.code !== 0) {
|
|
185
|
+
return updateResult
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return runCommand('sudo', [
|
|
189
|
+
'apt-get',
|
|
190
|
+
'install',
|
|
191
|
+
'-y',
|
|
192
|
+
'build-essential',
|
|
193
|
+
'pkg-config',
|
|
194
|
+
'libicu-dev',
|
|
195
|
+
'libzstd-dev',
|
|
196
|
+
'golang-go',
|
|
197
|
+
], { stdio: 'inherit' })
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
if (managers.dnf) {
|
|
201
|
+
log('Installing Linux Beads build dependencies via dnf')
|
|
202
|
+
return runCommand('sudo', [
|
|
203
|
+
'dnf',
|
|
204
|
+
'install',
|
|
205
|
+
'-y',
|
|
206
|
+
'gcc',
|
|
207
|
+
'gcc-c++',
|
|
208
|
+
'make',
|
|
209
|
+
'pkgconf-pkg-config',
|
|
210
|
+
'libicu-devel',
|
|
211
|
+
'libzstd-devel',
|
|
212
|
+
'golang',
|
|
213
|
+
], { stdio: 'inherit' })
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
return { code: 0, stdout: '', stderr: '' }
|
|
217
|
+
}
|
|
218
|
+
|
|
173
219
|
async function installBeadsOnWindows() {
|
|
174
220
|
const shell = await resolveCommand('pwsh') || await resolveCommand('powershell')
|
|
175
221
|
if (!shell) {
|
|
@@ -190,6 +236,33 @@ async function installBeadsOnWindows() {
|
|
|
190
236
|
}
|
|
191
237
|
|
|
192
238
|
async function installBeadsOnUnix() {
|
|
239
|
+
if (process.platform === 'linux') {
|
|
240
|
+
const depsResult = await installLinuxBeadsPrerequisites()
|
|
241
|
+
if (depsResult.code !== 0) {
|
|
242
|
+
return depsResult
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (!(await commandExists('go'))) {
|
|
246
|
+
return { code: 1, stdout: '', stderr: 'Go is required to build a CGO-enabled Beads binary on Linux' }
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
const binDir = getLinuxBeadsBinDir()
|
|
250
|
+
await ensureDir(binDir)
|
|
251
|
+
|
|
252
|
+
log(`Installing Beads ${BEADS_VERSION} on Linux with CGO_ENABLED=1`)
|
|
253
|
+
const result = await runCommand('go', ['install', `github.com/steveyegge/beads/cmd/bd@v${BEADS_VERSION}`], {
|
|
254
|
+
stdio: 'inherit',
|
|
255
|
+
env: {
|
|
256
|
+
...process.env,
|
|
257
|
+
CGO_ENABLED: '1',
|
|
258
|
+
GOBIN: binDir,
|
|
259
|
+
},
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
await ensureUnixBeadsPath()
|
|
263
|
+
return result
|
|
264
|
+
}
|
|
265
|
+
|
|
193
266
|
const managers = await detectPackageManagers()
|
|
194
267
|
if (managers.brew) {
|
|
195
268
|
log('Installing Beads via Homebrew')
|
|
@@ -315,6 +388,8 @@ async function tryInstallCoreDependency(name) {
|
|
|
315
388
|
}
|
|
316
389
|
|
|
317
390
|
async function ensureDependency({ name, checkCommand, requiredVersion, installable }) {
|
|
391
|
+
let needsReinstall = false
|
|
392
|
+
|
|
318
393
|
if (name === 'python3') {
|
|
319
394
|
const python = await getPythonVersion()
|
|
320
395
|
if (python) {
|
|
@@ -350,6 +425,7 @@ async function ensureDependency({ name, checkCommand, requiredVersion, installab
|
|
|
350
425
|
const probe = await probeBeadsRuntime(beads.command)
|
|
351
426
|
if (!probe.ok) {
|
|
352
427
|
warn(`${name} was found at ${beads.command}, but it failed a runtime probe.${probe.output ? ` ${probe.output}` : ''}`)
|
|
428
|
+
needsReinstall = true
|
|
353
429
|
} else {
|
|
354
430
|
log(`${name} detected via ${beads.command}: ${beads.version}`)
|
|
355
431
|
if (requiredVersion && !beads.version.includes(requiredVersion)) {
|
|
@@ -360,16 +436,22 @@ async function ensureDependency({ name, checkCommand, requiredVersion, installab
|
|
|
360
436
|
}
|
|
361
437
|
}
|
|
362
438
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
439
|
+
if (!needsReinstall) {
|
|
440
|
+
const version = await getCommandVersion(checkCommand)
|
|
441
|
+
if (version) {
|
|
442
|
+
log(`${name} detected: ${version}`)
|
|
443
|
+
if (requiredVersion && !version.includes(requiredVersion)) {
|
|
444
|
+
warn(`${name} version differs from tested reference ${requiredVersion}`)
|
|
445
|
+
}
|
|
446
|
+
return
|
|
368
447
|
}
|
|
369
|
-
return
|
|
370
448
|
}
|
|
371
449
|
|
|
372
|
-
|
|
450
|
+
if (needsReinstall) {
|
|
451
|
+
warn(`${name} needs to be reinstalled with a working runtime.`)
|
|
452
|
+
} else {
|
|
453
|
+
warn(`${name} is not installed or not available in PATH`)
|
|
454
|
+
}
|
|
373
455
|
|
|
374
456
|
if (!installable) {
|
|
375
457
|
return
|