Files
boocode/packages/ion/src/engine/command-validation.ts
indifferentketchup 02063072ab chore: add ion package, codesight wiki, work plans, ascli config
New @boocode/ion package (v0.0.1) for inference optimization network.
.codesight/ wiki artifacts for codebase documentation.
.omo/ work plans for openspec cleanup and enhanced file panel.
2026-06-07 22:16:45 +00:00

27 lines
757 B
TypeScript

/**
* Command name validation for the Ion workflow engine.
*
* Command names must be lowercase kebab-case: lowercase alphanumeric
* segments separated by single hyphens.
*/
/** Pattern for valid command names: lowercase kebab-case. */
const COMMAND_NAME_PATTERN = /^[a-z0-9]+(-[a-z0-9]+)*$/;
/**
* Validate a command name.
*
* Valid names match the pattern: `^[a-z0-9]+(-[a-z0-9]+)*$`
* - Lowercase alphanumeric segments
* - Segments separated by single hyphens
* - No leading or trailing hyphens
* - No consecutive hyphens
*
* @returns `true` if the name is valid, `false` otherwise.
*/
export function isValidCommandName(name: string): boolean {
if (name.length === 0) {
return false;
}
return COMMAND_NAME_PATTERN.test(name);
}