theslopmachine 0.3.1 → 0.3.2
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 +1 -1
- package/src/cli.js +3 -3
- package/src/init.js +8 -3
- package/src/install.js +34 -2
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -2,10 +2,10 @@ import { runInit } from './init.js'
|
|
|
2
2
|
import { runInstall } from './install.js'
|
|
3
3
|
|
|
4
4
|
function printHelp() {
|
|
5
|
-
console.log(`
|
|
5
|
+
console.log(`theslopmachine 0.3
|
|
6
6
|
|
|
7
7
|
Commands:
|
|
8
|
-
|
|
8
|
+
setup Configure theslopmachine in the local user environment
|
|
9
9
|
init Run the packaged init script in the current directory (-o opens OpenCode in repo/)
|
|
10
10
|
help Show this help text`)
|
|
11
11
|
}
|
|
@@ -18,7 +18,7 @@ export async function runCli(args) {
|
|
|
18
18
|
return
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
if (command === 'install') {
|
|
21
|
+
if (command === 'setup' || command === 'install') {
|
|
22
22
|
await runInstall()
|
|
23
23
|
return
|
|
24
24
|
}
|
package/src/init.js
CHANGED
|
@@ -2,7 +2,7 @@ import fs from 'node:fs/promises'
|
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
|
|
4
4
|
import { buildPaths } from './constants.js'
|
|
5
|
-
import { ensureDir, log, pathExists, runCommand } from './utils.js'
|
|
5
|
+
import { commandExists, ensureDir, log, pathExists, runCommand, warn } from './utils.js'
|
|
6
6
|
|
|
7
7
|
const GITIGNORE_ENTRIES = [
|
|
8
8
|
'.DS_Store',
|
|
@@ -46,11 +46,11 @@ async function assertRequiredFiles(paths) {
|
|
|
46
46
|
const agentsTemplate = path.join(paths.slopmachineDir, 'templates', 'AGENTS.md')
|
|
47
47
|
|
|
48
48
|
if (!(await pathExists(beadsScript))) {
|
|
49
|
-
throw new Error(`Missing packaged Beads init script at ${beadsScript}. Run slopmachine
|
|
49
|
+
throw new Error(`Missing packaged Beads init script at ${beadsScript}. Run slopmachine setup first.`)
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
if (!(await pathExists(agentsTemplate))) {
|
|
53
|
-
throw new Error(`Missing packaged AGENTS template at ${agentsTemplate}. Run slopmachine
|
|
53
|
+
throw new Error(`Missing packaged AGENTS template at ${agentsTemplate}. Run slopmachine setup first.`)
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
return { beadsScript, agentsTemplate }
|
|
@@ -145,6 +145,11 @@ async function maybeOpenOpencode(targetPath, openAfterInit) {
|
|
|
145
145
|
return
|
|
146
146
|
}
|
|
147
147
|
|
|
148
|
+
if (!(await commandExists('opencode'))) {
|
|
149
|
+
warn('OpenCode is not available in PATH, so the project was initialized but could not be opened automatically. Launch OpenCode manually inside repo/.')
|
|
150
|
+
return
|
|
151
|
+
}
|
|
152
|
+
|
|
148
153
|
log('Opening OpenCode in repo/')
|
|
149
154
|
const result = await runCommand('opencode', [], {
|
|
150
155
|
stdio: 'inherit',
|
package/src/install.js
CHANGED
|
@@ -39,6 +39,27 @@ async function getCommandVersion(command, args = ['--version']) {
|
|
|
39
39
|
return (result.stdout || result.stderr).trim()
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
async function getPythonVersion() {
|
|
43
|
+
const python3Version = await getCommandVersion('python3')
|
|
44
|
+
if (python3Version) {
|
|
45
|
+
return { command: 'python3', version: python3Version }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const pythonVersion = await getCommandVersion('python')
|
|
49
|
+
if (pythonVersion) {
|
|
50
|
+
return { command: 'python', version: pythonVersion }
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (process.platform === 'win32' && await commandExists('py')) {
|
|
54
|
+
const result = await runCommand('py', ['-3', '--version'])
|
|
55
|
+
if (result.code === 0) {
|
|
56
|
+
return { command: 'py -3', version: (result.stdout || result.stderr).trim() }
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return null
|
|
61
|
+
}
|
|
62
|
+
|
|
42
63
|
async function detectPackageManagers() {
|
|
43
64
|
return {
|
|
44
65
|
brew: await commandExists('brew'),
|
|
@@ -102,6 +123,17 @@ async function tryInstallCoreDependency(name) {
|
|
|
102
123
|
}
|
|
103
124
|
|
|
104
125
|
async function ensureDependency({ name, checkCommand, requiredVersion, installable }) {
|
|
126
|
+
if (name === 'python3') {
|
|
127
|
+
const python = await getPythonVersion()
|
|
128
|
+
if (python) {
|
|
129
|
+
log(`${name} detected via ${python.command}: ${python.version}`)
|
|
130
|
+
if (requiredVersion && !python.version.includes(requiredVersion)) {
|
|
131
|
+
warn(`${name} version differs from tested reference ${requiredVersion}`)
|
|
132
|
+
}
|
|
133
|
+
return
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
105
137
|
const version = await getCommandVersion(checkCommand)
|
|
106
138
|
if (version) {
|
|
107
139
|
log(`${name} detected: ${version}`)
|
|
@@ -133,7 +165,7 @@ async function checkDocker() {
|
|
|
133
165
|
const dockerVersion = await getCommandVersion('docker')
|
|
134
166
|
const composeVersion = await getCommandVersion('docker', ['compose', 'version'])
|
|
135
167
|
if (!dockerVersion || !composeVersion) {
|
|
136
|
-
warn('Docker and Docker Compose are required for
|
|
168
|
+
warn('Docker and Docker Compose are required for theslopmachine workflows. Please install Docker Desktop or the Docker Engine + Compose plugin and start Docker.')
|
|
137
169
|
return
|
|
138
170
|
}
|
|
139
171
|
log(`docker detected: ${dockerVersion}`)
|
|
@@ -141,7 +173,7 @@ async function checkDocker() {
|
|
|
141
173
|
|
|
142
174
|
const info = await runCommand('docker', ['info'])
|
|
143
175
|
if (info.code !== 0) {
|
|
144
|
-
warn('Docker is installed but does not appear to be running. Start Docker before using
|
|
176
|
+
warn('Docker is installed but does not appear to be running. Start Docker before using theslopmachine.')
|
|
145
177
|
}
|
|
146
178
|
}
|
|
147
179
|
|