Files
stack/packages/cli/src/tui/commands/parse.ts
Jason Woltje f0741e045f
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
feat(cli): TUI slash command parsing + local commands (P8-009) (#176)
Co-authored-by: Jason Woltje <jason@diversecanvas.com>
Co-committed-by: Jason Woltje <jason@diversecanvas.com>
2026-03-16 01:58:56 +00:00

12 lines
312 B
TypeScript

import type { ParsedCommand } from '@mosaic/types';
export function parseSlashCommand(input: string): ParsedCommand | null {
const match = input.match(/^\/([a-z][a-z0-9:_-]*)\s*(.*)?$/i);
if (!match) return null;
return {
command: match[1]!,
args: match[2]?.trim() || null,
raw: input,
};
}