chromancer
Version:
A powerful command-line interface for automating Chrome browser using Playwright. Perfect for web scraping, automation, testing, and browser workflows.
23 lines (22 loc) • 728 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.askClaude = askClaude;
const claude_code_1 = require("@anthropic-ai/claude-code");
/**
* Query Claude using the claude-code SDK
*/
async function askClaude(prompt) {
const iter = (0, claude_code_1.query)({ prompt });
let answer = "";
for await (const ev of iter) {
if (ev.type === "assistant" && ev.message) {
// Claude streams an array of content blocks – grab the text ones
for (const block of ev.message.content) {
if (block.type === "text" && block.text) {
answer += block.text;
}
}
}
}
return answer.trim();
}