가장 먼저 볼 곳
console.error(command.session?.diagnostics);// 예: "No conversation found with session ID: abc"그리고 실제로 무엇이 실행될 예정이었는지가 궁금할 때는 inspect()입니다.
console.log(command.inspect());// provider, 전체 argv, stdin 페이로드, model, permissions, 세션 생존 여부이 둘을 먼저 보는 이유
섹션 제목: “이 둘을 먼저 보는 이유”diagnostics와 inspect()는 거의 모든 실패의 두 측면에 답합니다.
| 질문 | 읽을 것 |
|---|---|
| CLI가 왜 거부했거나 죽었는가? | command.session?.diagnostics — stderr 전체 |
| 애초에 무엇이 실행될 예정이었는가? | command.inspect() — provider, argv, stdin 페이로드, model, permissions, 세션 상태 |
inspect()는 아무것도 실행되기 전에도 유용합니다. send() 전까지는 아무것도 CLI에 닿지 않기 때문입니다. 조립만 되고 전송되지 않은 커맨드도 자신을 온전히 서술하며, 끝에 (not started)가 붙습니다.
const command = Command.open(Claude, { workingDir: '/proj' });command.setModel('opus').setPermissions('plan').setMessage('Plan the migration');
console.log(command.inspect());// provider: claude// command: claude -p --output-format stream-json …// stdin: {"type":"user","message":{"role":"user","content":"Plan the migration"}}// model: opus// permissions: plan// attachments: 0// workingDir: /proj// session: 3f2a… (not started)toString()은 inspect()에 위임하므로, 로그에 남기거나 문자열에 보간한 커맨드는 [object Object]가 아니라 자신의 전체 상태로 읽힙니다.
그다음은 증상 색인
섹션 제목: “그다음은 증상 색인”무엇이 실행됐고 CLI가 그에 대해 무엇을 말했는지 알았다면, 증상 색인이 지금 보고 있는 현상을 가장 유력한 원인으로 연결해 줍니다.