Skip to content

Asking one question

When there is no conversation to have, there is no reason to manage one. ask opens a command, sends, collects the assistant’s text until the turn ends, and closes.

import { Claude } from 'activecli';
const answer = await Claude.ask('What does this repository do?', { workingDir: '/proj' });
answer.text; // everything the assistant said, tool calls left out
answer.isOk(); // whether the turn finished normally
answer.result; // the CLI's own result entry — cost, duration, anything else it reported

isOk() is separate from the promise resolving

Section titled “isOk() is separate from the promise resolving”

An interrupted turn also produces a result, so “there is a result” is not the same as “it went well” — which is why isOk() exists separately from the promise resolving.