(workspaceKey: string, tail: number)
| 254 | } |
| 255 | |
| 256 | async function handleLogs(workspaceKey: string, tail: number): Promise<void> { |
| 257 | const entry = readDaemonRegistryEntry(workspaceKey); |
| 258 | const logPath = entry?.logPath; |
| 259 | |
| 260 | if (!logPath) { |
| 261 | writeLine('No daemon log path available for this workspace.'); |
| 262 | return; |
| 263 | } |
| 264 | |
| 265 | let content = ''; |
| 266 | try { |
| 267 | content = readFileSync(logPath, 'utf8'); |
| 268 | } catch (err) { |
| 269 | console.error('Error:', err instanceof Error ? err.message : String(err)); |
| 270 | process.exitCode = 1; |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | const lines = content.split(/\r?\n/); |
| 275 | const limited = lines.slice(Math.max(0, lines.length - Math.max(1, tail))); |
| 276 | writeLine(limited.join('\n')); |
| 277 | } |
| 278 | |
| 279 | async function handleList(jsonOutput: boolean, includeStale: boolean): Promise<void> { |
| 280 | const registryEntries = listDaemonRegistryEntries(); |
no test coverage detected