Skill preflight: agent must detect whether the nodespace CLI is installed and the daemon is healthy#1234
Conversation
…verage (closes #1229) - SKILL.md: adds Preflight Check section with explicit `nodespace --version` + `nodespace diagnostics` instructions before multi-step operations, and a failure→recovery table covering "command not found" and "daemon not running" - installer.ts: adds `isNodespaceBinaryOnPath()` (exported) that probes the binary via `execFileSync('nodespace', ['--version'])` without requiring a daemon; `install()` calls it and writes a loud stderr warning when the binary is absent at install time - installer.test.ts: 4 new tests for `isNodespaceBinaryOnPath` and the stderr warning path `nodespace --version` was already daemon-free (clap handles it before Cli::parse() returns); all subcommands already emit actionable daemon-down messages via the three connect() helpers — no Rust changes needed. Co-Authored-By: Claude <noreply@anthropic.com>
Code Review SummaryThis PR directly addresses all four acceptance criteria from #1229. The implementation is lean and well-targeted: a new One improvement-level gap and two nits are worth addressing before merge. FindingsSuggested Improvements[Improvement]
export { install, uninstall, isNodespaceBinaryOnPath } from './installer.js';[Improvement] First test in
Consider guarding on an env variable that CI sets when the binary IS available, or mock it('returns true when execFileSync exits 0', async () => {
vi.resetModules();
vi.doMock('node:child_process', () => ({
execFileSync: () => Buffer.from('nodespace 0.1.0\n'),
}));
const { isNodespaceBinaryOnPath: check } = await import('../installer.js');
expect(check()).toBe(true);
vi.doUnmock('node:child_process');
vi.resetModules();
});This is the same pattern already used in the "install PATH warning / does not write a warning" test (lines 225–238), so no new technique is required. NitpicksNit: SKILL.md preflight error string is a prefix of the actual CLI output, not the full message
The table cell is a valid substring match for agent pattern recognition, so this is not a correctness bug. But aligning the displayed symptom to the actual first line of the error ( Nit:
Requirements Validation
|
malibio
left a comment
There was a problem hiding this comment.
Two issues to address before merge: (1) isNodespaceBinaryOnPath is exported from installer.ts but missing from src/index.ts — it needs to be part of the public API. (2) The positive-case test for isNodespaceBinaryOnPath only asserts typeof result === 'boolean', which is vacuous — replace it with a deterministic mock-based test matching the pattern already used in the warning tests. Full details in the review comment above.
… execFileSync timeout - Replace typeof-only assertion with a deterministic mock-based test for the happy path (execFileSync exits 0 → returns true) - Export isNodespaceBinaryOnPath from index.ts so programmatic consumers don't need to reach into internal module paths - Add timeout: 3000 to execFileSync call so a hung wrapper binary can't block install() indefinitely Skipped: aligning SKILL.md symptom column to full CLI output — the prefix "Could not connect to nodespaced" is sufficient for agent pattern matching and the full string includes a machine-specific path that would vary per user. Co-Authored-By: Claude <noreply@anthropic.com>
Review Addressed✅ Addressed 3/4 recommendations — 1 skipped with rationale. Changes made
Skipped🟢 Align SKILL.md symptom to full CLI output — The prefix Tests: 17/17 passed (skill), 3924/3924 passed (full suite) |
…lled and the daemon is healthy (#1234) * Skill preflight: PATH check, SKILL.md preflight docs, daemon error coverage (closes #1229) - SKILL.md: adds Preflight Check section with explicit `nodespace --version` + `nodespace diagnostics` instructions before multi-step operations, and a failure→recovery table covering "command not found" and "daemon not running" - installer.ts: adds `isNodespaceBinaryOnPath()` (exported) that probes the binary via `execFileSync('nodespace', ['--version'])` without requiring a daemon; `install()` calls it and writes a loud stderr warning when the binary is absent at install time - installer.test.ts: 4 new tests for `isNodespaceBinaryOnPath` and the stderr warning path `nodespace --version` was already daemon-free (clap handles it before Cli::parse() returns); all subcommands already emit actionable daemon-down messages via the three connect() helpers — no Rust changes needed. Co-Authored-By: Claude <noreply@anthropic.com> * Address review: fix vacuous test, export isNodespaceBinaryOnPath, add execFileSync timeout - Replace typeof-only assertion with a deterministic mock-based test for the happy path (execFileSync exits 0 → returns true) - Export isNodespaceBinaryOnPath from index.ts so programmatic consumers don't need to reach into internal module paths - Add timeout: 3000 to execFileSync call so a hung wrapper binary can't block install() indefinitely Skipped: aligning SKILL.md symptom column to full CLI output — the prefix "Could not connect to nodespaced" is sufficient for agent pattern matching and the full string includes a machine-specific path that would vary per user. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Michael Libio <malibio@Michaels-Mac-mini.local> Co-authored-by: Claude <noreply@anthropic.com>
Ahead of moving the docs/decision record into NodeSpace itself, sweep the Rust/TS/Svelte sources and reword provenance comments that hard-referenced GitHub issue numbers (`#1234`, `Issue #665`, `nodespace-sync#125`, `epic #237`) to describe the behavior or constraint directly. Where a decision is captured by an ADR, the ADR reference is kept and only the ticket number dropped. Comment content only — no code, string literals, test fixtures, attributes, or formatting were changed (verified: the code portion of every touched line is byte-identical). Issue numbers inside string literals, assertion messages, log messages, test titles, fixtures, hex colors, and `#[...]` attributes were deliberately left intact, as were third-party references (e.g. an upstream tauri-apps/tray-icon bug) reduced to prose. Closes #1494 Co-authored-by: Mayank Tomar <mayanktomar@Michaels-Mac-mini.local> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Closes #1229