@jmanuelcorral/bond-app 0.2.0 → 0.2.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/bond-app.js +3 -2
- package/package.json +1 -1
- package/runner/versions.env +3 -1
- package/src/core/doctor.ts +10 -1
- package/src/core/setup-install.ts +47 -26
package/bin/bond-app.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// Silence
|
|
2
|
+
// Silence the ExperimentalWarnings of stripTypeScriptTypes (Node >= 22.15) and node:sqlite
|
|
3
|
+
// (Node 22): both are what bond-app is built on, and the warning only confuses whoever installs it.
|
|
3
4
|
const origEmit = process.emit;
|
|
4
5
|
process.emit = function (name, data, ...args) {
|
|
5
6
|
if (
|
|
6
7
|
name === 'warning' &&
|
|
7
8
|
typeof data === 'object' &&
|
|
8
9
|
data &&
|
|
9
|
-
String(data.message)
|
|
10
|
+
/stripTypeScriptTypes|SQLite is an experimental feature/.test(String(data.message))
|
|
10
11
|
) {
|
|
11
12
|
return false;
|
|
12
13
|
}
|
package/package.json
CHANGED
package/runner/versions.env
CHANGED
|
@@ -22,7 +22,9 @@ SUPI_VERSION=11.0.1
|
|
|
22
22
|
# bond (el harness que lanza el agente, D-G): instalado por setup.sh con --with-bond
|
|
23
23
|
# (D-H: versión fijada; package npm con scope @jmanuelcorral/bond). El pin mínimo es
|
|
24
24
|
# 1.16.4: antes de esa versión bond no tiene comando `tui` (spike runner/SPIKE-BOND.md).
|
|
25
|
-
|
|
25
|
+
# `bond-app setup` exige al menos esta versión en la máquina: hasta 1.16.8 bond traía su propio
|
|
26
|
+
# bin `bond-app` (con una bond-app 0.1.x dentro) y npm no deja instalar bond-app encima.
|
|
27
|
+
BOND_VERSION=1.16.9
|
|
26
28
|
|
|
27
29
|
# gh y azure-cli salen de los repos apt oficiales (GitHub y Microsoft); se dejan
|
|
28
30
|
# en «latest» del repo. AZURE_CLI_VERSION admite el pin «2.xx.y» (sufijo ~bookworm
|
package/src/core/doctor.ts
CHANGED
|
@@ -329,18 +329,27 @@ export async function runDoctor(options: DoctorOptions = {}): Promise<DoctorRepo
|
|
|
329
329
|
const herdrAppRes = await runCommand('herdr-app', ['--version']);
|
|
330
330
|
const herdrAppVer = herdrAppRes.ok ? extractSemver(herdrAppRes.stdout) : null;
|
|
331
331
|
const herdrAppOk = Boolean(herdrAppVer && compareVersions(herdrAppVer, MIN_HERDR_APP_VERSION) >= 0);
|
|
332
|
+
// Installed but unable to start: a system library is missing (usually the graphical stack on a
|
|
333
|
+
// server or a minimal install, e.g. libxcb.so.1).
|
|
334
|
+
const missingLib = herdrAppRes.ok
|
|
335
|
+
? null
|
|
336
|
+
: /error while loading shared libraries: ([^\s:]+)/.exec(`${herdrAppRes.stderr}\n${herdrAppRes.error ?? ''}`)?.[1] ?? null;
|
|
332
337
|
checks.push({
|
|
333
338
|
id: 'herdr-app',
|
|
334
339
|
name: 'herdr-app',
|
|
335
340
|
status: herdrAppOk ? 'ok' : 'fail',
|
|
336
341
|
essential: true,
|
|
337
|
-
detail:
|
|
342
|
+
detail: missingLib
|
|
343
|
+
? `installed but cannot start: missing system library ${missingLib}`
|
|
344
|
+
: !herdrAppRes.ok
|
|
338
345
|
? `not found (min ${MIN_HERDR_APP_VERSION})`
|
|
339
346
|
: herdrAppOk
|
|
340
347
|
? `${herdrAppVer} (>= ${MIN_HERDR_APP_VERSION})`
|
|
341
348
|
: `${herdrAppVer ?? 'unknown'} < ${MIN_HERDR_APP_VERSION}`,
|
|
342
349
|
fix: herdrAppOk
|
|
343
350
|
? undefined
|
|
351
|
+
: missingLib
|
|
352
|
+
? `Install the package that provides ${missingLib} (herdr-app is a desktop app; on Debian/Ubuntu: sudo apt install libxcb1 libxkbcommon0, on Arch: sudo pacman -S libxcb libxkbcommon)`
|
|
344
353
|
: fixByPlatform(platform, {
|
|
345
354
|
linux: `Download herdr-app >= ${MIN_HERDR_APP_VERSION} from https://releases.herdr.dev/app/latest.json (linux-x86_64 or linux-aarch64), verify sha256, and place binary in ~/.local/bin/herdr-app`,
|
|
346
355
|
macos: `Download herdr-app >= ${MIN_HERDR_APP_VERSION} from https://releases.herdr.dev/app/latest.json (macos-aarch64), verify sha256, and place binary in ~/.local/bin/herdr-app`,
|
|
@@ -174,6 +174,26 @@ function extractSemver(text: string): string | null {
|
|
|
174
174
|
return m ? m[1] : null;
|
|
175
175
|
}
|
|
176
176
|
|
|
177
|
+
/**
|
|
178
|
+
* The version of a package in npm's global install, or null when it is not there. Asking
|
|
179
|
+
* `bond-app --version` is not enough: under `npx` the PATH holds npx's own copy, and bond up to
|
|
180
|
+
* 1.16.8 shipped a `bond-app` shim that ran its own, older dependency.
|
|
181
|
+
*/
|
|
182
|
+
export async function globalNpmVersion(
|
|
183
|
+
runCommand: (cmd: string, args: string[], timeoutMs?: number) => Promise<CommandOutput>,
|
|
184
|
+
name: string
|
|
185
|
+
): Promise<string | null> {
|
|
186
|
+
// `npm ls` exits 1 when the package is missing but still prints its JSON.
|
|
187
|
+
const res = await runCommand('npm', ['ls', '-g', '--depth=0', '--json', name], 30_000);
|
|
188
|
+
try {
|
|
189
|
+
const tree = JSON.parse(res.stdout || '{}') as { dependencies?: Record<string, { version?: unknown }> };
|
|
190
|
+
const version = tree.dependencies?.[name]?.version;
|
|
191
|
+
return typeof version === 'string' ? version : null;
|
|
192
|
+
} catch {
|
|
193
|
+
return null;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
177
197
|
export function resolveTargetKey(platform: NodeJS.Platform, arch: string): string | null {
|
|
178
198
|
if (platform === 'linux' && arch === 'x64') return 'linux-x86_64';
|
|
179
199
|
if (platform === 'linux' && arch === 'arm64') return 'linux-aarch64';
|
|
@@ -755,10 +775,11 @@ export async function runSetup(options: SetupOptions = {}): Promise<SetupResult>
|
|
|
755
775
|
steps.push({ id: 'bond', ok: true, detail });
|
|
756
776
|
}
|
|
757
777
|
|
|
758
|
-
|
|
759
|
-
|
|
778
|
+
// bond-app must be in npm's global install (what `bond-app service` and `update` use), not
|
|
779
|
+
// just on the PATH: under `npx` the PATH has npx's temporary copy.
|
|
780
|
+
const installedBondAppVer = await globalNpmVersion(runCommand, '@jmanuelcorral/bond-app');
|
|
760
781
|
const bondAppNeedsInstall =
|
|
761
|
-
|
|
782
|
+
installedBondAppVer === null || compareVersions(installedBondAppVer, bondAppVersion) < 0;
|
|
762
783
|
|
|
763
784
|
if (!bondAppNeedsInstall) {
|
|
764
785
|
const detail = `${installedBondAppVer ?? bondAppVersion} (>= ${bondAppVersion})`;
|
|
@@ -1078,52 +1099,52 @@ export async function runUpdate(options: UpdateOptions = {}): Promise<UpdateResu
|
|
|
1078
1099
|
|
|
1079
1100
|
log(`bond-app update (${normPlatform}${dryRun ? ', dry-run' : ''})`);
|
|
1080
1101
|
|
|
1081
|
-
// 1. Update @jmanuelcorral/bond
|
|
1102
|
+
// 1. Update @jmanuelcorral/bond via npm (public registry). bond goes first: up to 1.16.8 it
|
|
1103
|
+
// shipped its own `bond-app` bin, and npm would refuse to install bond-app over it (EEXIST).
|
|
1082
1104
|
if (dryRun) {
|
|
1083
|
-
const detail = `would run: npm install -g @jmanuelcorral/bond
|
|
1084
|
-
logStep('✓', 'bond
|
|
1085
|
-
steps.push({ id: 'bond
|
|
1105
|
+
const detail = `would run: npm install -g @jmanuelcorral/bond@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1106
|
+
logStep('✓', 'bond CLI', detail);
|
|
1107
|
+
steps.push({ id: 'bond', ok: true, skipped: true, detail });
|
|
1086
1108
|
} else {
|
|
1087
1109
|
const npmRes = await runCommand(
|
|
1088
1110
|
'npm',
|
|
1089
|
-
['install', '-g', '@jmanuelcorral/bond
|
|
1111
|
+
['install', '-g', '@jmanuelcorral/bond@latest', NPM_PUBLIC_REGISTRY_ARG],
|
|
1090
1112
|
180_000
|
|
1091
1113
|
);
|
|
1092
1114
|
if (!npmRes.ok) {
|
|
1093
|
-
const fix = `npm install -g @jmanuelcorral/bond
|
|
1094
|
-
logStep('✗', 'bond
|
|
1095
|
-
steps.push({ id: 'bond
|
|
1115
|
+
const fix = `npm install -g @jmanuelcorral/bond@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1116
|
+
logStep('✗', 'bond CLI', npmRes.stderr.trim() || npmRes.error || 'npm install failed', fix);
|
|
1117
|
+
steps.push({ id: 'bond', ok: false, detail: 'npm install failed' });
|
|
1096
1118
|
return { ok: false, dryRun, steps, imageOutdated: false };
|
|
1097
1119
|
}
|
|
1098
|
-
const verRes = await runCommand('bond
|
|
1120
|
+
const verRes = await runCommand('bond', ['--version'], 10_000);
|
|
1099
1121
|
const ver = verRes.ok ? extractSemver(verRes.stdout) : null;
|
|
1100
1122
|
const detail = ver ? `updated to ${ver}` : 'updated';
|
|
1101
|
-
logStep('✓', 'bond
|
|
1102
|
-
steps.push({ id: 'bond
|
|
1123
|
+
logStep('✓', 'bond CLI', detail);
|
|
1124
|
+
steps.push({ id: 'bond', ok: true, detail });
|
|
1103
1125
|
}
|
|
1104
1126
|
|
|
1105
|
-
// 2. Update @jmanuelcorral/bond via npm (public registry)
|
|
1127
|
+
// 2. Update @jmanuelcorral/bond-app via npm (public registry)
|
|
1106
1128
|
if (dryRun) {
|
|
1107
|
-
const detail = `would run: npm install -g @jmanuelcorral/bond@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1108
|
-
logStep('✓', 'bond
|
|
1109
|
-
steps.push({ id: 'bond', ok: true, skipped: true, detail });
|
|
1129
|
+
const detail = `would run: npm install -g @jmanuelcorral/bond-app@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1130
|
+
logStep('✓', 'bond-app', detail);
|
|
1131
|
+
steps.push({ id: 'bond-app', ok: true, skipped: true, detail });
|
|
1110
1132
|
} else {
|
|
1111
1133
|
const npmRes = await runCommand(
|
|
1112
1134
|
'npm',
|
|
1113
|
-
['install', '-g', '@jmanuelcorral/bond@latest', NPM_PUBLIC_REGISTRY_ARG],
|
|
1135
|
+
['install', '-g', '@jmanuelcorral/bond-app@latest', NPM_PUBLIC_REGISTRY_ARG],
|
|
1114
1136
|
180_000
|
|
1115
1137
|
);
|
|
1116
1138
|
if (!npmRes.ok) {
|
|
1117
|
-
const fix = `npm install -g @jmanuelcorral/bond@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1118
|
-
logStep('✗', 'bond
|
|
1119
|
-
steps.push({ id: 'bond', ok: false, detail: 'npm install failed' });
|
|
1139
|
+
const fix = `npm install -g @jmanuelcorral/bond-app@latest ${NPM_PUBLIC_REGISTRY_ARG}`;
|
|
1140
|
+
logStep('✗', 'bond-app', npmRes.stderr.trim() || npmRes.error || 'npm install failed', fix);
|
|
1141
|
+
steps.push({ id: 'bond-app', ok: false, detail: 'npm install failed' });
|
|
1120
1142
|
return { ok: false, dryRun, steps, imageOutdated: false };
|
|
1121
1143
|
}
|
|
1122
|
-
const
|
|
1123
|
-
const ver = verRes.ok ? extractSemver(verRes.stdout) : null;
|
|
1144
|
+
const ver = await globalNpmVersion(runCommand, '@jmanuelcorral/bond-app');
|
|
1124
1145
|
const detail = ver ? `updated to ${ver}` : 'updated';
|
|
1125
|
-
logStep('✓', 'bond
|
|
1126
|
-
steps.push({ id: 'bond', ok: true, detail });
|
|
1146
|
+
logStep('✓', 'bond-app', detail);
|
|
1147
|
+
steps.push({ id: 'bond-app', ok: true, detail });
|
|
1127
1148
|
}
|
|
1128
1149
|
|
|
1129
1150
|
// 3. Reinstall layout, mods and themes into herdr-app
|