@phyzess/kitto 0.3.0 → 0.3.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/CHANGELOG.md +4 -0
- package/bin/kitto.mjs +3 -0
- package/integration/plugin.json +1 -1
- package/lib/kitto.mjs +69 -18
- package/lib/scope-setup.mjs +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Kitto
|
|
2
2
|
|
|
3
|
+
## 0.3.1
|
|
4
|
+
|
|
5
|
+
- Hosts: a selected host CLI below the tested baseline no longer blocks `setup` or `update`. The version check reports a warning and continues, and each native integration is gated on a capability probe instead of a version comparison (`codex plugin`, `dsh plugin`), so a stale Codex or DSH CLI skips only its own registration while rules, skills and MCP still deploy — for that host and for every other selected host. An unreadable `--version` warns instead of throwing; a missing binary stays fatal because no integration can run. `--require-baseline` restores the previous strict gate for release verification, and `installMissingHosts` still verifies the version it installed itself. Docs record that the baseline is an advisory label and the `kitto hosts --apply` target, not a write precondition.
|
|
6
|
+
|
|
3
7
|
## 0.3.0
|
|
4
8
|
|
|
5
9
|
- Hosts: add the explicit `kitto hosts [--check|--apply] [--host NAME] [--version VERSION]` command for host-CLI upgrade policy (also exposed as the maintenance runner's `hosts` operation). It lists each selected host's installed `--version`, Kitto's validated baseline (`hosts[name].version`) and the exact native-manager command; `--check` is the default and writes nothing. `--apply` installs only the pinned target through `npm install --global <package>@<version>` — Pi and Codex through their npm packages, the DSH CLI through `@deepseek-ai/dsh@<baseline>` with a prerelease baseline kept exact — never `npx`, dist-tags or "latest", never an unselected host, and never automatically. Hosts already newer than the baseline are not downgraded implicitly; `--version` accepts one exact version for one host and warns in check and apply when it is not the validated baseline. The app-managed `desktop` DSH profile (matched case-insensitively) is reported and skipped, not npm-installed. Missing npm, unreadable host versions, permission failures (with npm-prefix/sudo guidance) and post-install verification mismatches fail with actionable errors before or without writing `state.json`; a multi-host failure reports which hosts changed and which did not. `kitto update` is unchanged: it prints host versions/baselines and never upgrades a host.
|
package/bin/kitto.mjs
CHANGED
|
@@ -16,6 +16,7 @@ const help = `Kitto — portable personal agent configuration
|
|
|
16
16
|
kitto setup --workspace PATH [--agents pi,codex,dsh] [--dsh-service UNIT] [--dry-run]
|
|
17
17
|
kitto setup [--agents pi,codex,dsh] [--source PATH_OR_GIT_URL] [--ref BRANCH_OR_TAG]
|
|
18
18
|
[--dsh-profile PROFILE] [--install-agents] [--dry-run]
|
|
19
|
+
[--require-baseline]
|
|
19
20
|
[--include-private|--no-include-private]
|
|
20
21
|
kitto setup --recover [--dry-run] Restore the last working Kitto code
|
|
21
22
|
kitto update [--check|--apply] [--include-private|--no-include-private]
|
|
@@ -42,6 +43,8 @@ kitto update only previews unless --apply is used (--check is the same preview,
|
|
|
42
43
|
it updates Kitto's code copy and configuration, never a host CLI or the Kitto package itself.
|
|
43
44
|
Host CLIs are upgraded separately and explicitly with kitto hosts --apply, only to Kitto's validated
|
|
44
45
|
baseline (or an explicit --version). Kitto never upgrades a host automatically.
|
|
46
|
+
A host below that baseline only produces a warning: setup skips the steps that CLI cannot support and
|
|
47
|
+
still deploys every other selected host. Pass --require-baseline to make an untested version fatal.
|
|
45
48
|
Kitto needs Node >=22 and Git. Pi sync also needs Bash and Python >=3.10.
|
|
46
49
|
DSH web/headless needs pnpm and uses the web profile by default. The Desktop app owns the desktop
|
|
47
50
|
profile: Kitto deploys only its global AGENTS.md and skills, never checks or installs a dsh CLI, and
|
package/integration/plugin.json
CHANGED
package/lib/kitto.mjs
CHANGED
|
@@ -75,7 +75,7 @@ export function parseOptions(args) {
|
|
|
75
75
|
const options = {};
|
|
76
76
|
for (let i = 0; i < args.length; i++) {
|
|
77
77
|
const arg = args[i];
|
|
78
|
-
if (['--dry-run', '--install-agents', '--recover', '--global', '--include-private', '--no-include-private'].includes(arg)) options[arg.slice(2)] = true;
|
|
78
|
+
if (['--dry-run', '--install-agents', '--recover', '--require-baseline', '--global', '--include-private', '--no-include-private'].includes(arg)) options[arg.slice(2)] = true;
|
|
79
79
|
else if (['--agents', '--source', '--ref', '--dsh-profile', '--workspace', '--workspace-parent', '--dsh-service'].includes(arg) && args[i + 1] && !args[i + 1].startsWith('-')) options[arg.slice(2)] = args[++i];
|
|
80
80
|
else throw new Error(`Unknown option or missing value: ${arg}`);
|
|
81
81
|
}
|
|
@@ -163,29 +163,53 @@ export function meetsBaseline(actual, baseline) {
|
|
|
163
163
|
return true;
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
|
|
166
|
+
// Host CLI versions are observations, not gates. An older CLI is reported and
|
|
167
|
+
// the steps it cannot support are skipped, so one stale host never blocks the
|
|
168
|
+
// others; a missing binary stays fatal because no integration can run.
|
|
169
|
+
function hostCapabilities(name, env) {
|
|
170
|
+
const supports = args => spawnSync(name, args, { stdio: 'ignore', timeout: 8000, env }).status === 0;
|
|
171
|
+
if (name === 'codex') return { plugin: supports(['plugin', 'add', '--help']), mcp: supports(['mcp', '--help']) };
|
|
172
|
+
if (name === 'dsh') return { plugin: supports(['plugin', '--help']) };
|
|
173
|
+
return {};
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function inspectHost(name) {
|
|
167
177
|
// Codex creates helper files under CODEX_HOME even for --version/--help.
|
|
168
178
|
// Probe with a scratch home so checks never write the user's Codex state.
|
|
169
179
|
const probe = name === 'codex' ? mkdtempSync(join(tmpdir(), 'kitto-codex-check-')) : null;
|
|
170
180
|
const env = probe ? { ...process.env, CODEX_HOME: probe } : process.env;
|
|
171
181
|
try {
|
|
172
|
-
const
|
|
173
|
-
const
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
console.log(`${name}: ${actual} (tested baseline ${expected})`);
|
|
182
|
+
const result = spawnSync(name, ['--version'], { encoding: 'utf8', timeout: 8000, env });
|
|
183
|
+
const stdout = (result.stdout ?? '').trim();
|
|
184
|
+
const actual = stdout.match(/\d+\.\d+\.\d+(?:-[\w.-]+)?/)?.[0] ?? null;
|
|
185
|
+
const baseline = hosts[name].version;
|
|
186
|
+
const missing = result.error?.code === 'ENOENT';
|
|
187
|
+
const detail = (stdout.split('\n')[0] || (result.stderr ?? '').trim().split('\n')[0] || `exit ${result.status}`);
|
|
188
|
+
return {
|
|
189
|
+
name, baseline, actual, status: missing ? 'missing' : actual ? 'found' : 'unreadable', detail,
|
|
190
|
+
meetsBaseline: Boolean(actual) && meetsBaseline(actual, baseline),
|
|
191
|
+
capabilities: missing ? {} : hostCapabilities(name, env),
|
|
192
|
+
};
|
|
184
193
|
} finally {
|
|
185
194
|
if (probe) rmSync(probe, { recursive: true, force: true });
|
|
186
195
|
}
|
|
187
196
|
}
|
|
188
197
|
|
|
198
|
+
// A host below the tested baseline is a warning, never a write barrier: every
|
|
199
|
+
// other selected host is still deployed. --require-baseline restores the old
|
|
200
|
+
// fatal behaviour for release verification.
|
|
201
|
+
function reportHost(report, requireBaseline) {
|
|
202
|
+
const { name, baseline } = report;
|
|
203
|
+
if (report.status === 'unreadable') {
|
|
204
|
+
console.warn(`kitto: ${name}: could not read its version (${report.detail}); continuing, but its native integration is unverified.`);
|
|
205
|
+
} else if (report.meetsBaseline) {
|
|
206
|
+
console.log(`${name}: ${report.actual} (tested baseline ${baseline})`);
|
|
207
|
+
} else {
|
|
208
|
+
const detail = `${name}: ${report.actual} is older than the tested baseline ${baseline}`;
|
|
209
|
+
if (requireBaseline) throw new Error(`${detail}. Upgrade it with \`kitto hosts --apply\`, or drop --require-baseline.`);
|
|
210
|
+
console.warn(`kitto: ${detail}; continuing and skipping the steps this CLI cannot support. Run \`kitto hosts --apply\` when you want the tested baseline.`);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
189
213
|
function availableHost(name) {
|
|
190
214
|
if (name !== 'codex') return available(name);
|
|
191
215
|
// Codex creates helper files under CODEX_HOME even for --version.
|
|
@@ -194,7 +218,8 @@ function availableHost(name) {
|
|
|
194
218
|
finally { rmSync(probe, { recursive: true, force: true }); }
|
|
195
219
|
}
|
|
196
220
|
|
|
197
|
-
export function checkSelectedHosts(agents, installAgents) {
|
|
221
|
+
export function checkSelectedHosts(agents, installAgents, options = {}) {
|
|
222
|
+
const reports = [];
|
|
198
223
|
for (const name of agents) {
|
|
199
224
|
if (!availableHost(name)) {
|
|
200
225
|
if (!installAgents) throw new Error(`${name} is missing. Install it natively or add --install-agents (pins ${hosts[name].version}).`);
|
|
@@ -203,14 +228,26 @@ export function checkSelectedHosts(agents, installAgents) {
|
|
|
203
228
|
throw new Error(`Installing ${name} through npm requires Node >=${requiredNode}.`);
|
|
204
229
|
}
|
|
205
230
|
console.log(`Install missing CLI: ${hosts[name].package}@${hosts[name].version}${name === 'dsh' ? ' (prerelease)' : ''}`);
|
|
206
|
-
|
|
231
|
+
continue;
|
|
232
|
+
}
|
|
233
|
+
const report = inspectHost(name);
|
|
234
|
+
reports.push(report);
|
|
235
|
+
reportHost(report, options.requireBaseline === true);
|
|
207
236
|
}
|
|
237
|
+
return reports;
|
|
208
238
|
}
|
|
209
239
|
|
|
210
240
|
export function installMissingHosts(agents) {
|
|
211
241
|
for (const name of agents) if (!availableHost(name)) {
|
|
212
242
|
run('npm', ['install', '--global', `${hosts[name].package}@${hosts[name].version}`]);
|
|
213
|
-
|
|
243
|
+
// Unlike the pre-flight check, a fresh install is verified strictly: Kitto
|
|
244
|
+
// chose the version, so a different one means PATH or the prefix is wrong.
|
|
245
|
+
const report = inspectHost(name);
|
|
246
|
+
if (report.status !== 'found' || report.actual !== hosts[name].version) {
|
|
247
|
+
throw new Error(`${name}: npm installed ${hosts[name].version} but the CLI reports ${report.actual ?? report.status}. `
|
|
248
|
+
+ 'Check PATH and the npm global prefix; Kitto wrote no state.');
|
|
249
|
+
}
|
|
250
|
+
console.log(`${name}: ${report.actual} (installed pinned baseline)`);
|
|
214
251
|
}
|
|
215
252
|
}
|
|
216
253
|
|
|
@@ -351,6 +388,12 @@ async function connect(state) {
|
|
|
351
388
|
for (const name of state.agents) {
|
|
352
389
|
if (name === 'pi') run('pi', ['install', runtime], { env: { ...process.env, PI_CODING_AGENT_DIR: state.piHome } });
|
|
353
390
|
if (name === 'codex') {
|
|
391
|
+
const codex = inspectHost('codex');
|
|
392
|
+
if (!codex.capabilities.plugin) {
|
|
393
|
+
console.warn('kitto: this codex CLI has no plugin subcommand; skipped the Kitto plugin registration. '
|
|
394
|
+
+ 'Rules, skills and MCP were still deployed.');
|
|
395
|
+
continue;
|
|
396
|
+
}
|
|
354
397
|
await mkdir(state.codexHome, { recursive: true });
|
|
355
398
|
const marketplace = join(home, '.agents/plugins/marketplace.json');
|
|
356
399
|
await atomicJson(marketplace, { name: 'phyzess-kitto', plugins: [{ name: 'kitto',
|
|
@@ -365,6 +408,12 @@ async function connect(state) {
|
|
|
365
408
|
console.log('DSH desktop profile: app-managed; skipped Kitto bundle registration (global rules and skills only).');
|
|
366
409
|
continue;
|
|
367
410
|
}
|
|
411
|
+
const dsh = inspectHost('dsh');
|
|
412
|
+
if (!dsh.capabilities.plugin) {
|
|
413
|
+
console.warn(`kitto: this dsh CLI${dsh.actual ? ` (${dsh.actual})` : ''} has no plugin subcommand; `
|
|
414
|
+
+ 'skipped the Kitto bundle registration. Rules and skills were still deployed.');
|
|
415
|
+
continue;
|
|
416
|
+
}
|
|
368
417
|
await mkdir(state.dshHome, { recursive: true });
|
|
369
418
|
run('dsh', ['plugin', '--profile', state.dshProfile || 'web', 'add', runtime], {
|
|
370
419
|
env: { ...process.env, DSH_HOME: state.dshHome, DSH_AGENTS_HOME: state.agentsHome },
|
|
@@ -863,7 +912,9 @@ export async function setup(options = {}) {
|
|
|
863
912
|
console.log(`Global setup: ${agents.join(', ')}; source: ${requested}; Kitto home: ${home}`);
|
|
864
913
|
// The app-managed Desktop profile has no CLI prerequisite Kitto may install or verify.
|
|
865
914
|
const checkedAgents = agents.filter(name => !(name === 'dsh' && isDesktopProfile(dshProfile)));
|
|
866
|
-
|
|
915
|
+
// A stale host is reported and downgraded, never fatal: --require-baseline
|
|
916
|
+
// restores the strict gate for release verification.
|
|
917
|
+
checkSelectedHosts(checkedAgents, options['install-agents'], { requireBaseline: options['require-baseline'] === true });
|
|
867
918
|
const includePrivate = options['include-private'] === true ? true
|
|
868
919
|
: options['no-include-private'] === true ? false : old.includePrivate === true;
|
|
869
920
|
const state = { ...old, schema: 1, ready: false, detached: false, removing: false, removedAgents: [], source, agents, dshProfile,
|
package/lib/scope-setup.mjs
CHANGED
|
@@ -64,7 +64,7 @@ export async function setupScope(options) {
|
|
|
64
64
|
throw new Error('Choose exactly one of --global, --workspace PATH or --workspace-parent PATH.');
|
|
65
65
|
}
|
|
66
66
|
for (const key of Object.keys(options)) {
|
|
67
|
-
if (!['global', 'workspace', 'workspace-parent', 'agents', 'dsh-profile', 'dsh-service', 'dry-run'].includes(key)) {
|
|
67
|
+
if (!['global', 'workspace', 'workspace-parent', 'agents', 'dsh-profile', 'dsh-service', 'dry-run', 'require-baseline'].includes(key)) {
|
|
68
68
|
throw new Error('Scoped setup does not support --' + key);
|
|
69
69
|
}
|
|
70
70
|
}
|