feat(new-setup): probe host-deps and skip bootstrap when already installed
Probe now emits HOST_DEPS (ok|missing) based on whether node_modules/better-sqlite3/build/Release/better_sqlite3.node exists — the canonical proof that `pnpm install` ran and the native build step succeeded. Step 1 (Node bootstrap) skips when HOST_DEPS=ok instead of always re-running setup.sh. Probe now genuinely routes step 1 the same way it routes every other step. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -268,6 +268,22 @@ function probeInferredDisplayName() {
|
||||
return 'User';
|
||||
}
|
||||
|
||||
function probeHostDeps() {
|
||||
const nodeModules = path.resolve(process.cwd(), 'node_modules');
|
||||
if (!fs.existsSync(nodeModules)) return 'missing';
|
||||
// better-sqlite3's compiled native binding is the canonical proof that
|
||||
// `pnpm install` ran AND the native build step succeeded. Cheaper than
|
||||
// actually loading the module, and unambiguous on success.
|
||||
const nativeBinding = path.join(
|
||||
nodeModules,
|
||||
'better-sqlite3',
|
||||
'build',
|
||||
'Release',
|
||||
'better_sqlite3.node',
|
||||
);
|
||||
return fs.existsSync(nativeBinding) ? 'ok' : 'missing';
|
||||
}
|
||||
|
||||
function probeTimezone() {
|
||||
const envTz = readEnvVar('TZ');
|
||||
const systemTz = Intl.DateTimeFormat().resolvedOptions().timeZone || '';
|
||||
@@ -309,6 +325,7 @@ export async function run() {
|
||||
const serviceStatus = probeServiceStatus();
|
||||
const displayName = probeInferredDisplayName();
|
||||
const tz = probeTimezone();
|
||||
const hostDeps = probeHostDeps();
|
||||
|
||||
const [onecliStatus, cliAgentWired] = await Promise.all([
|
||||
probeOnecliStatus(oneCliUrl),
|
||||
@@ -323,6 +340,7 @@ export async function run() {
|
||||
emitStatus('PROBE', {
|
||||
OS: osLabel,
|
||||
SHELL: shell,
|
||||
HOST_DEPS: hostDeps,
|
||||
DOCKER: docker.status,
|
||||
IMAGE_PRESENT: docker.imagePresent,
|
||||
ONECLI_STATUS: onecliStatus,
|
||||
|
||||
Reference in New Issue
Block a user