UNPKG

gaunt-sloth-assistant

Version:

> ⚠️ **`gaunt-sloth-assistant` has been renamed to [`gaunt-sloth`](https://www.npmjs.com/package/gaunt-sloth).** > The `1.5.x` series is the final release under the old name — active development continues under > the new package. To switch: > > ```bash >

45 lines 2.11 kB
import { initConfig } from '@gaunt-sloth/core/config.js'; import { getCommandProviderInput, getCommandSystemPrompt, } from '#src/commands/commandIntrospection.js'; import { display, displayError } from '@gaunt-sloth/core/utils/consoleUtils.js'; import { setExitCode } from '@gaunt-sloth/core/utils/systemUtils.js'; const PROMPT_COMMANDS = ['ask', 'review', 'pr', 'pr-discovery', 'chat', 'code']; const PROVIDER_COMMANDS = ['review', 'pr']; const INPUT_TYPES = ['content', 'requirements']; export function getCommand(program, commandLineConfigOverrides) { program .command('get') .description('Print the effective prompt or provider-backed command input') .argument('<command>', 'Command to introspect') .argument('<subject>', 'Either prompt, content, or requirements') .argument('[id]', 'Provider-backed content identifier') .action(async (command, subject, id) => { try { const config = await initConfig(commandLineConfigOverrides); if (subject === 'prompt') { if (id) { throw new Error('Prompt subject does not accept an ID.'); } if (!PROMPT_COMMANDS.includes(command)) { throw new Error(`Unsupported prompt command: ${command}.`); } display(getCommandSystemPrompt(command, config)); return; } if (!INPUT_TYPES.includes(subject)) { throw new Error(`Unsupported subject: ${subject}.`); } if (!PROVIDER_COMMANDS.includes(command)) { throw new Error(`Unsupported provider-backed command: ${command}.`); } if (!id) { throw new Error(`Subject "${subject}" requires an ID.`); } display(await getCommandProviderInput(command, subject, id, config)); } catch (error) { displayError(error instanceof Error ? error.message : String(error)); setExitCode(1); } }); } //# sourceMappingURL=getCommand.js.map