Lines 1-40javascript
2 * Environment checks for Kraki tentacle setup.
4 * Validates that required CLI tools are installed and authenticated.
5 * Provides a retry mechanism for interactive setup flows.
7import { execSync } from 'node:child_process';
8import { constants as fsConstants, promises as fsp, appendFileSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
HighChild Process
Package source references child process execution.
dist/checks.jsView on unpkg · L6 9import { homedir, platform } from 'node:os';
10import { join } from 'node:path';
11import { input } from '@inquirer/prompts';
12import chalk from 'chalk';
14 * On Windows, ensure essential system directories are present in
15 * `process.env.PATH`. Returns the list of directories that were
16 * prepended (empty if nothing was missing).
18 * Why: the daemon may be launched from a context with a minimal PATH
19 * (Startup folder shortcut, Task Scheduler, double-clicked SEA binary),
20 * where even `%SystemRoot%\System32` is absent. Tools that spawn
21 * `powershell.exe` / `pwsh.exe` / `where` / `cmd` by short name then
22 * fail with ENOENT — notably the GitHub Copilot SDK, whose PowerShell
23 * tool looks up `pwsh.exe` and `powershell.exe` via PATH and surfaces
24 * "PowerShell is not available" inside agent sessions.
26 * This helper is idempotent and merges (rather than wholesale-replaces)
27 * existing PATH entries so it can run alongside other PATH manipulation
28 * (e.g. the `node_modules/.bin` prepend in resolveDaemonLaunch).
30 * No-op on non-Windows platforms.
32export function ensureWindowsSystemPath() {
33 if (platform() !== 'win32')
35 const sysRoot = process.env.SystemRoot || process.env.windir || 'C:\\Windows';
37 `${sysRoot}\\System32`,
38 `${sysRoot}\\System32\\WindowsPowerShell\\v1.0`,
39 `${sysRoot}\\System32\\Wbem`,