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.
This commit is contained in:
70
packages/ion/src/engine/__tests__/command-validation.test.ts
Normal file
70
packages/ion/src/engine/__tests__/command-validation.test.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { isValidCommandName } from '../command-validation.js';
|
||||
|
||||
describe('isValidCommandName', () => {
|
||||
describe('valid command names', () => {
|
||||
it('accepts simple lowercase names', () => {
|
||||
expect(isValidCommandName('assist')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts kebab-case names', () => {
|
||||
expect(isValidCommandName('code-review')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts names with numbers', () => {
|
||||
expect(isValidCommandName('deploy-v2')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts single character names', () => {
|
||||
expect(isValidCommandName('a')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts names with only numbers', () => {
|
||||
expect(isValidCommandName('123')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts names with mixed alphanumeric and hyphens', () => {
|
||||
expect(isValidCommandName('a1-b2-c3')).toBe(true);
|
||||
});
|
||||
|
||||
it('accepts names starting with numbers', () => {
|
||||
expect(isValidCommandName('2fa-verify')).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe('invalid command names', () => {
|
||||
it('rejects uppercase letters', () => {
|
||||
expect(isValidCommandName('Assist')).toBe(false);
|
||||
expect(isValidCommandName('CODE-REVIEW')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects leading hyphens', () => {
|
||||
expect(isValidCommandName('-assist')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects trailing hyphens', () => {
|
||||
expect(isValidCommandName('assist-')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects double hyphens', () => {
|
||||
expect(isValidCommandName('code--review')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects empty strings', () => {
|
||||
expect(isValidCommandName('')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects underscores', () => {
|
||||
expect(isValidCommandName('code_review')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects spaces', () => {
|
||||
expect(isValidCommandName('code review')).toBe(false);
|
||||
});
|
||||
|
||||
it('rejects special characters', () => {
|
||||
expect(isValidCommandName('code.review')).toBe(false);
|
||||
expect(isValidCommandName('code@review')).toBe(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user