import assert from "node:assert/strict"; import { readFileSync } from "node:fs"; import { dirname, resolve } from "node:path"; import { fileURLToPath } from "node:url"; const desktopRoot = process.env.FAMILIAROS_DESKTOP_ROOT ?? resolve(dirname(fileURLToPath(import.meta.url)), ".."); const agentSetupSource = readFileSync(resolve(desktopRoot, "src/agent-setup.ts"), "utf8"); const agentSetupClaudeStatusSource = readFileSync(resolve(desktopRoot, "src/agent-setup-claude-status.ts"), "utf8"); const agentSetupActionsSource = readFileSync(resolve(desktopRoot, "src/agent-setup-actions.ts"), "utf8"); const agentSetupActionsToolingSource = readFileSync(resolve(desktopRoot, "src/agent-setup-actions-tooling.ts"), "utf8"); const agentSetupCommandContextSource = readFileSync(resolve(desktopRoot, "src/agent-setup-command-context.ts"), "utf8"); assert.match(agentSetupSource, /from "\.\/agent-setup-command-context\.js"/, "Agent setup must import the extracted command context helper module."); assert.match(agentSetupSource, /updateStoredAgentSetupCommandPaths/, "Agent setup must delegate command path persistence through the extracted command context helper."); assert.match(agentSetupClaudeStatusSource, /getPreferredNodeCommand/, "Agent setup Claude status seam must resolve preferred Node.js command paths through the extracted command context helper."); assert.match(agentSetupActionsSource, /from "\.\/agent-setup-actions-tooling(?:\.js)?"/, "Agent setup action shell must compose the extracted tooling seam."); assert.match(agentSetupActionsToolingSource, /getCliPackageVersion/, "Agent setup tooling seam must resolve package version metadata through the extracted command context helper."); assert.match(agentSetupActionsToolingSource, /getAgentSetupCliEntryPath/, "Agent setup tooling seam must resolve packaged CLI entry metadata through the extracted command context helper."); assert.match(agentSetupActionsToolingSource, /getPreferredOpenCodeCommand/, "Agent setup tooling seam must resolve preferred OpenCode command paths through the extracted command context helper."); assert.match(agentSetupCommandContextSource, /export function getStoredAgentSetupCommandPaths/, "Agent setup command context helper must own stored command path reads."); assert.match(agentSetupCommandContextSource, /export function updateStoredAgentSetupCommandPaths/, "Agent setup command context helper must own command path validation and writes."); assert.match(agentSetupCommandContextSource, /export function getAgentSetupCliEntryPath/, "Agent setup command context helper must own packaged CLI entry resolution."); assert.match(agentSetupCommandContextSource, /export function getCliPackageVersion/, "Agent setup command context helper must own workspace package version lookup."); console.error("Agent setup command context seam validation passed.");