theslopmachine 0.4.8 → 0.4.9
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 +9 -1
- package/RELEASE.md +8 -0
- package/package.json +1 -1
- package/src/cli.js +7 -1
- package/src/install.js +60 -29
package/README.md
CHANGED
|
@@ -48,7 +48,7 @@ slopmachine setup
|
|
|
48
48
|
|
|
49
49
|
`setup` does the following:
|
|
50
50
|
|
|
51
|
-
- installs
|
|
51
|
+
- installs `opencode-ai@latest` when missing and refreshes it to `@latest` when already present
|
|
52
52
|
- installs or verifies `br` (`beads_rust`)
|
|
53
53
|
- installs or refreshes packaged agents
|
|
54
54
|
- installs or refreshes packaged skills
|
|
@@ -56,6 +56,14 @@ slopmachine setup
|
|
|
56
56
|
- updates `~/.config/opencode/opencode.json`
|
|
57
57
|
- prompts for missing MCP API keys when needed
|
|
58
58
|
|
|
59
|
+
To refresh an existing machine install to the latest published package in one step:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
slopmachine upgrade
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`slopmachine upgrade` installs `theslopmachine@latest` globally and then runs `slopmachine setup` automatically.
|
|
66
|
+
|
|
59
67
|
If `opencode` was newly installed, open a fresh terminal before running OpenCode commands.
|
|
60
68
|
|
|
61
69
|
MCP API keys:
|
package/RELEASE.md
CHANGED
|
@@ -14,6 +14,14 @@ node ./bin/slopmachine.js --help
|
|
|
14
14
|
SLOPMACHINE_HOME="$(pwd)/.tmp-home" SLOPMACHINE_NONINTERACTIVE=1 SLOPMACHINE_PLUGIN_BOOTSTRAP=0 node ./bin/slopmachine.js setup
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
That setup path should install `opencode-ai@latest` when OpenCode is missing and refresh it to `@latest` when it already exists.
|
|
18
|
+
|
|
19
|
+
Users can later refresh to the newest published package with:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
slopmachine upgrade
|
|
23
|
+
```
|
|
24
|
+
|
|
17
25
|
3. Test init into an isolated temp project:
|
|
18
26
|
|
|
19
27
|
```bash
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { PACKAGE_VERSION } from './constants.js'
|
|
2
2
|
import { runInit } from './init.js'
|
|
3
|
-
import { runInstall } from './install.js'
|
|
3
|
+
import { runInstall, runUpgrade } from './install.js'
|
|
4
4
|
|
|
5
5
|
function printHelp() {
|
|
6
6
|
console.log(`theslopmachine ${PACKAGE_VERSION}
|
|
7
7
|
|
|
8
8
|
Commands:
|
|
9
9
|
setup Configure theslopmachine in the local user environment
|
|
10
|
+
upgrade Install theslopmachine@latest globally and rerun setup
|
|
10
11
|
init Run the packaged init script in the current directory (-o opens OpenCode in repo/)
|
|
11
12
|
help Show this help text`)
|
|
12
13
|
}
|
|
@@ -24,6 +25,11 @@ export async function runCli(args) {
|
|
|
24
25
|
return
|
|
25
26
|
}
|
|
26
27
|
|
|
28
|
+
if (command === 'upgrade') {
|
|
29
|
+
await runUpgrade()
|
|
30
|
+
return
|
|
31
|
+
}
|
|
32
|
+
|
|
27
33
|
if (command === 'init') {
|
|
28
34
|
await runInit(args.slice(1))
|
|
29
35
|
return
|
package/src/install.js
CHANGED
|
@@ -393,6 +393,43 @@ async function tryInstallCoreDependency(name) {
|
|
|
393
393
|
return runCommand(entry[0], entry[1], { stdio: 'inherit' })
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
+
async function ensureLatestOpencode(requiredVersion) {
|
|
397
|
+
const npmVersion = await getGlobalNpmPackageVersion('opencode-ai')
|
|
398
|
+
const commandPath = await resolveCommand('opencode')
|
|
399
|
+
|
|
400
|
+
if (npmVersion) {
|
|
401
|
+
log(`opencode detected via global npm package: opencode-ai@${npmVersion}`)
|
|
402
|
+
if (requiredVersion && !npmVersion.includes(requiredVersion)) {
|
|
403
|
+
warn(`opencode version differs from tested reference ${requiredVersion}`)
|
|
404
|
+
}
|
|
405
|
+
log('Refreshing opencode-ai to latest via npm')
|
|
406
|
+
} else if (commandPath) {
|
|
407
|
+
log(`opencode command detected at ${commandPath}`)
|
|
408
|
+
log('Installing opencode-ai@latest globally via npm so theslopmachine can manage the current opencode install')
|
|
409
|
+
} else {
|
|
410
|
+
warn('opencode is not installed or not available in PATH')
|
|
411
|
+
log('Installing opencode-ai@latest globally via npm')
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
const result = await tryInstallCoreDependency('opencode')
|
|
415
|
+
if (result.code !== 0) {
|
|
416
|
+
warn('Automatic installation for opencode failed. Please install it manually.')
|
|
417
|
+
return
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
const installedVersion = await getGlobalNpmPackageVersion('opencode-ai')
|
|
421
|
+
if (installedVersion) {
|
|
422
|
+
log(`Using opencode-ai@${installedVersion}`)
|
|
423
|
+
const refreshedCommandPath = await resolveCommand('opencode')
|
|
424
|
+
if (!refreshedCommandPath) {
|
|
425
|
+
warn('opencode-ai was installed, but the `opencode` command is not visible in this shell PATH yet. Open a new terminal before using `slopmachine init -o`.')
|
|
426
|
+
}
|
|
427
|
+
return
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
warn('opencode-ai install completed, but the package could not be verified. Open a new terminal and run `opencode --version` before using `slopmachine init -o`.')
|
|
431
|
+
}
|
|
432
|
+
|
|
396
433
|
async function ensureDependency({ name, checkCommand, requiredVersion, installable }) {
|
|
397
434
|
let needsReinstall = false
|
|
398
435
|
|
|
@@ -408,21 +445,8 @@ async function ensureDependency({ name, checkCommand, requiredVersion, installab
|
|
|
408
445
|
}
|
|
409
446
|
|
|
410
447
|
if (name === 'opencode') {
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
log(`opencode detected via global npm package: opencode-ai@${npmVersion}`)
|
|
414
|
-
if (requiredVersion && !npmVersion.includes(requiredVersion)) {
|
|
415
|
-
warn(`${name} version differs from tested reference ${requiredVersion}`)
|
|
416
|
-
}
|
|
417
|
-
return
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const commandPath = await resolveCommand('opencode')
|
|
421
|
-
if (commandPath) {
|
|
422
|
-
log(`opencode command detected at ${commandPath}`)
|
|
423
|
-
warn(`Unable to verify ${name} version without executing the binary during setup.`)
|
|
424
|
-
return
|
|
425
|
-
}
|
|
448
|
+
await ensureLatestOpencode(requiredVersion)
|
|
449
|
+
return
|
|
426
450
|
}
|
|
427
451
|
|
|
428
452
|
if (checkCommand === 'br') {
|
|
@@ -475,20 +499,6 @@ async function ensureDependency({ name, checkCommand, requiredVersion, installab
|
|
|
475
499
|
return
|
|
476
500
|
}
|
|
477
501
|
|
|
478
|
-
if (name === 'opencode') {
|
|
479
|
-
const installedVersion = await getGlobalNpmPackageVersion('opencode-ai')
|
|
480
|
-
if (installedVersion) {
|
|
481
|
-
log(`Installed opencode-ai@${installedVersion}`)
|
|
482
|
-
const commandPath = await resolveCommand('opencode')
|
|
483
|
-
if (!commandPath) {
|
|
484
|
-
warn('opencode-ai was installed, but the `opencode` command is not visible in this shell PATH yet. Open a new terminal before using `slopmachine init -o`.')
|
|
485
|
-
}
|
|
486
|
-
return
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
warn('opencode-ai install completed, but the package could not be verified. Open a new terminal and run `opencode --version` before using `slopmachine init -o`.')
|
|
490
|
-
}
|
|
491
|
-
|
|
492
502
|
if (checkCommand === 'br') {
|
|
493
503
|
const beads = await getBeadsVersion()
|
|
494
504
|
if (beads) {
|
|
@@ -848,3 +858,24 @@ export async function runInstall() {
|
|
|
848
858
|
console.log('- If Docker was reported as stopped, start Docker before using theslopmachine on a real project.')
|
|
849
859
|
console.log('- Run `slopmachine init` inside a project directory to bootstrap a new theslopmachine workspace.')
|
|
850
860
|
}
|
|
861
|
+
|
|
862
|
+
export async function runUpgrade() {
|
|
863
|
+
section('Upgrade')
|
|
864
|
+
log('Installing theslopmachine@latest globally via npm')
|
|
865
|
+
|
|
866
|
+
const installResult = await runCommand('npm', ['install', '-g', 'theslopmachine@latest'], { stdio: 'inherit' })
|
|
867
|
+
if (installResult.code !== 0) {
|
|
868
|
+
throw new Error('Global theslopmachine upgrade failed')
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
const slopmachineCommand = await resolveCommand('slopmachine')
|
|
872
|
+
if (!slopmachineCommand) {
|
|
873
|
+
throw new Error('Upgrade completed, but the refreshed slopmachine command could not be found on PATH')
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
log('Running slopmachine setup from the refreshed install')
|
|
877
|
+
const setupResult = await runCommand(slopmachineCommand, ['setup'], { stdio: 'inherit' })
|
|
878
|
+
if (setupResult.code !== 0) {
|
|
879
|
+
throw new Error('Refreshed slopmachine setup failed after upgrade')
|
|
880
|
+
}
|
|
881
|
+
}
|