Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/Aquaticat/Monochromatic. TypeScript and Rust monorepo: Claude Code and Pi coding-agent plugins, a m
Something went wrong. Try again.
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697import { describe, expect, it,} from '@monochromatic-dev/module-test/ts';
import { CliInvocationError, parseCliArguments,} from '../dist/final/node/index.mjs';
await describe({ name: parseCliArguments.name, children: [ it({ name: 'parses explicit interactive and applied modes', fn: async () => { expect(parseCliArguments({ arguments: [ '--interactive', '--repo', 'https://github.com/Aquaticat/issues-api', 'review.json', ], },),).toStrictEqual({ kind: 'run', mode: 'interactive', input: { kind: 'file', path: 'review.json', }, repositoryUrl: 'https://github.com/Aquaticat/issues-api', },); expect(parseCliArguments({ arguments: [ '--non-interactive', '--apply', '--non-security-only', 'review.json', ], },),).toStrictEqual({ kind: 'run', mode: 'non-interactive', input: { kind: 'file', path: 'review.json', }, applyAuthority: 'non-security-only', },); expect(parseCliArguments({ arguments: [ '--interactive', '{"status":"complete","comments":[]}', ], },),).toStrictEqual({ kind: 'run', mode: 'interactive', input: { kind: 'inline-json', text: '{"status":"complete","comments":[]}', }, },); }, },), it({ name: 'rejects missing or contradictory modes and stdin path', fn: async () => { /** Invalid invocation argument vectors. */ const cases = [ ['review.json',], ['--interactive', '--non-interactive', 'review.json',], ['--non-interactive', '-',], ['--non-interactive', '{}',], ['--non-interactive',], ['--interactive',], ['--interactive', '--apply', 'review.json',], ]; for (const arguments_ of cases) { /** Captured invocation misuse. */ let caught: unknown; try { parseCliArguments({ arguments: arguments_, },); } catch (error: unknown) { caught = error; } expect(caught,).toBeInstanceOf(CliInvocationError,); } }, },), ],},);