@rhizogrip/spore-cli 1.57.1 → 1.58.1
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/bin/spore.js +2 -1
- package/package.json +2 -2
- package/src/dispatch.js +2 -1
- package/src/doctor.js +2 -1
- package/src/mo.js +34 -0
- package/src/setup.js +6 -3
- package/tui/index.js +3 -1
package/bin/spore.js
CHANGED
|
@@ -14,6 +14,7 @@ import { basename, resolve } from 'node:path'
|
|
|
14
14
|
|
|
15
15
|
import minimist from 'minimist'
|
|
16
16
|
|
|
17
|
+
import { withMoHint } from '../src/mo.js'
|
|
17
18
|
import { host } from '../src/vm.js'
|
|
18
19
|
|
|
19
20
|
await host(process.argv.slice(2))
|
|
@@ -320,7 +321,7 @@ async function events (ws, after) {
|
|
|
320
321
|
}
|
|
321
322
|
|
|
322
323
|
function fail (problem) {
|
|
323
|
-
console.error(`spore: ${problem}`)
|
|
324
|
+
console.error(`spore: ${withMoHint(problem)}`)
|
|
324
325
|
process.exit(2)
|
|
325
326
|
}
|
|
326
327
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.1",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Christophe Le Bars",
|
|
6
6
|
"email": "clb@toort.net"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"minimist": "^1.2.8"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@rhizogrip/spore": "1.
|
|
57
|
+
"@rhizogrip/spore": "1.58.1"
|
|
58
58
|
},
|
|
59
59
|
"license": "Apache-2.0"
|
|
60
60
|
}
|
package/src/dispatch.js
CHANGED
|
@@ -16,6 +16,7 @@ import { basename, join, resolve } from 'node:path'
|
|
|
16
16
|
import { addTo, allowPlugin, annotate, billingFor, bytesText, changeText, define, defaultModel, disallowPlugin, durationText, edit, extend, flush, getKey, jobs, list, listApprovals, listPlugins, log, pause, remake, remove, removeFrom, removeSchedule, requestApproval, runningLines, schedules, setDefaultModel, setKey, setSchedule, settings, show, showPlugin, sql, stateWord, stopJob, switchModel, tick, tickReport, unmetered, unpause, upgrade, usage, wrap, CONFIG_FILE, DEFAULT_SPORANGIUM, errorText } from '@rhizogrip/spore'
|
|
17
17
|
import { diagnose, hostReport, renderDoctor, renderReport } from './doctor.js'
|
|
18
18
|
import { hook } from './hooks.js'
|
|
19
|
+
import { withMoHint } from './mo.js'
|
|
19
20
|
import { createServices } from './services.js'
|
|
20
21
|
import { saidBy, saidText } from '../tui/conversation.js'
|
|
21
22
|
|
|
@@ -787,7 +788,7 @@ export async function manage (verb, argv) {
|
|
|
787
788
|
if (verb === 'ls') return emit(list({ where: argv._[1], disk: true }), renderList, listExit)
|
|
788
789
|
if (verb === 'show') return emit(show({ ws: argv._[1] }), renderShow)
|
|
789
790
|
} catch (err) {
|
|
790
|
-
console.error(`spore: ${errorText(err)}`)
|
|
791
|
+
console.error(`spore: ${withMoHint(errorText(err))}`)
|
|
791
792
|
return 2
|
|
792
793
|
}
|
|
793
794
|
}
|
package/src/doctor.js
CHANGED
|
@@ -4,6 +4,7 @@ import { getSystemErrorName } from 'node:util'
|
|
|
4
4
|
|
|
5
5
|
import { boundary, describeHost, doctor, loadMohdelEnvironment, modelFindings } from '@rhizogrip/spore'
|
|
6
6
|
|
|
7
|
+
import { withMoHint } from './mo.js'
|
|
7
8
|
import { createServices } from './services.js'
|
|
8
9
|
|
|
9
10
|
const AREAS = ['operator', 'spores', 'models', 'plugins', 'services', 'machine']
|
|
@@ -116,7 +117,7 @@ export function renderDoctor ({ findings, boundary }) {
|
|
|
116
117
|
console.log(area)
|
|
117
118
|
for (const found of here) {
|
|
118
119
|
console.log(` ${found.severity === 'note' ? 'note: ' : ''}${found.subject} — ${found.problem}`)
|
|
119
|
-
if (found.fix) console.log(found.fix.split('\n').map(line => ` ${line}`).join('\n'))
|
|
120
|
+
if (found.fix) console.log(withMoHint(found.fix).split('\n').map(line => ` ${line}`).join('\n'))
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
123
|
if (boundary.length) {
|
package/src/mo.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `mo` comes inside spore for spore's own use, and npm does not put it on PATH. A message naming a
|
|
3
|
+
* `mo` command says how to install it where it is missing, at the mohdel spore pins, since the two
|
|
4
|
+
* share one catalog.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { accessSync, constants, statSync } from 'node:fs'
|
|
8
|
+
import { createRequire } from 'node:module'
|
|
9
|
+
import { delimiter, join } from 'node:path'
|
|
10
|
+
|
|
11
|
+
const MO_COMMAND = /(?:^|[\s"'`(])mo (?:chatgpt|curate|ls|model|onboard|providers)\b/
|
|
12
|
+
|
|
13
|
+
function runnable (path) {
|
|
14
|
+
try {
|
|
15
|
+
accessSync(path, constants.X_OK)
|
|
16
|
+
return statSync(path).isFile()
|
|
17
|
+
} catch {
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const moOnPath = () => (process.env.PATH ?? '').split(delimiter).some(dir => runnable(join(dir, 'mo')))
|
|
23
|
+
|
|
24
|
+
/** What to install, when `text` names a `mo` command and `mo` is not on PATH; null otherwise. */
|
|
25
|
+
export function moHint (text) {
|
|
26
|
+
if (!MO_COMMAND.test(text) || moOnPath()) return null
|
|
27
|
+
const { mohdel } = createRequire(import.meta.url)('@rhizogrip/spore/package.json').dependencies
|
|
28
|
+
return `mo is a separate install: npm install -g mohdel@${mohdel}`
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function withMoHint (text) {
|
|
32
|
+
const hint = moHint(text)
|
|
33
|
+
return hint ? `${text} — ${hint}` : text
|
|
34
|
+
}
|
package/src/setup.js
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
|
|
17
17
|
import { createServices } from './services.js'
|
|
18
18
|
import { diagnose, renderDoctor } from './doctor.js'
|
|
19
|
+
import { moHint, withMoHint } from './mo.js'
|
|
19
20
|
|
|
20
21
|
const EXPERT = 'expert'
|
|
21
22
|
const ANOTHER_MODEL = 'another model'
|
|
@@ -29,7 +30,7 @@ const providerOf = (model) => model.split('/')[0]
|
|
|
29
30
|
|
|
30
31
|
const SHOWN = 20
|
|
31
32
|
|
|
32
|
-
const line = (label, text) => log.step(`${label.padEnd(10)}${text}`)
|
|
33
|
+
const line = (label, text) => log.step(`${label.padEnd(10)}${withMoHint(text)}`)
|
|
33
34
|
|
|
34
35
|
/** A pick from a list that words narrow, each matched in the label or the description; null when left. */
|
|
35
36
|
export async function pickFromList ({ title, header = [], items }) {
|
|
@@ -171,11 +172,13 @@ export async function setup () {
|
|
|
171
172
|
|
|
172
173
|
/** Where another model comes from, and how a spore is given it: said, never done, by setup. */
|
|
173
174
|
function otherModels (provider) {
|
|
174
|
-
|
|
175
|
+
const lines = [
|
|
175
176
|
'another model: spore setup model offers the recommended ones, from any provider —',
|
|
176
177
|
`or /curate in spore tui, or mo curate ${provider}, adds any other ${provider} model,`,
|
|
177
178
|
'then spore config set model <provider>/<name> for new spores, or spore edit <spore> and add it to models:'
|
|
178
|
-
]
|
|
179
|
+
]
|
|
180
|
+
const hint = moHint(lines.join('\n'))
|
|
181
|
+
log.message(hint ? [...lines, hint] : lines)
|
|
179
182
|
}
|
|
180
183
|
|
|
181
184
|
/** One line when the model set is not among those mohdex recommends. Nothing here stops setup. */
|
package/tui/index.js
CHANGED
|
@@ -8,6 +8,7 @@ import { applyEvent, changeText, createLive, curate, durationText, errorText, ex
|
|
|
8
8
|
import chalk from 'chalk'
|
|
9
9
|
|
|
10
10
|
import { runningJob, scheduleLine } from '../src/dispatch.js'
|
|
11
|
+
import { withMoHint } from '../src/mo.js'
|
|
11
12
|
import { COMMANDS, parseCommand } from './commands.js'
|
|
12
13
|
import { history, markOf } from './conversation.js'
|
|
13
14
|
import { changeOf, counts, hunks } from './diff.js'
|
|
@@ -319,7 +320,8 @@ export async function runTui ({ ws, commands = [], renderTool = null, greeting =
|
|
|
319
320
|
const state = { ws: null, grant: null, limits: null, shown: null, attention: new Map(), lastSeq: 0, overlay: null, pressed: {} }
|
|
320
321
|
let finish
|
|
321
322
|
|
|
322
|
-
const notice = (
|
|
323
|
+
const notice = (message) => {
|
|
324
|
+
const text = withMoHint(message)
|
|
323
325
|
status.notice = text
|
|
324
326
|
clearTimeout(state.noticeTimer)
|
|
325
327
|
state.noticeTimer = setTimeout(() => { status.notice = ''; tui.requestRender() }, Math.max(NOTICE_MS, text.length * 60))
|