30 lines
936 B
TypeScript
30 lines
936 B
TypeScript
import assert from 'node:assert/strict'
|
|
import { planFromExitInput, questionsFromInput } from '../src/main/agent/claude/claude-tool-input'
|
|
|
|
const questions = questionsFromInput({
|
|
questions: [{
|
|
question: 'Which library?',
|
|
header: 'Library',
|
|
multiSelect: false,
|
|
options: [
|
|
{ label: 'First', description: 'First option' },
|
|
{ label: 'Second', description: 'Second option' }
|
|
]
|
|
}]
|
|
})
|
|
assert.equal(questions.length, 1)
|
|
assert.equal(questions[0].id, 'question-0')
|
|
assert.deepEqual(questions[0].options[0], {
|
|
id: 'First',
|
|
label: 'First',
|
|
question: 'First',
|
|
option: 'First',
|
|
description: 'First option'
|
|
})
|
|
|
|
const plan = planFromExitInput({}, 'Plan:\n1. Inspect files\n2. Implement change')
|
|
assert.deepEqual(plan.steps.map((step) => step.text), ['Plan:', 'Inspect files', 'Implement change'])
|
|
assert.equal(plan.steps[0].status, 'pending')
|
|
|
|
console.log('{"result":"PASS","questions":1,"planSteps":3}')
|