import type { ContentBlockParam } from '@sandcode/sdk/resources/messages.js'
import type { Command } from '../../commands.js'
import { generateFlowPrompt } from './flowPrompt.js'

const flow: Command = {
  type: 'prompt',
  name: 'flow',
  description:
    'Start a self-improving autonomous development loop. Describe what you want and SANDCODE builds it with verification.',
  isEnabled: () => true,
  argumentHint: '<intent>',
  progressMessage: 'running autonomous flow',
  contentLength: 2000,
  source: 'builtin' as const,
  async getPromptForCommand(args, _context): Promise<ContentBlockParam[]> {
    const prompt = await generateFlowPrompt(args)
    return [{ type: 'text', text: prompt }]
  },
}

export default flow
