ui-ux-pro-max-skill/cli/tests/e2e/kimi-skills.spec.ts
Elvin Novruzov 076a2b3a31
feat(cli): add Kimi Code platform (--ai kimi) (#538)
* feat(cli): add Kimi Code platform (--ai kimi)

Kimi Code discovers skills as SKILL.md folders (name + description frontmatter) in .kimi-code/skills/ (project) and ~/.kimi-code/skills/ (user). Add a kimi platform template, register the type, detect an existing .kimi-code folder, and document it in the README.

Tests: add kimi to the dry-run and script-path e2e specs. check:assets, typecheck and those specs pass; init --ai kimi was run in an empty repo. Kimi Code itself was not run.

Refs #455.

* test(cli): add kimi install and detection specs

Cover the rendered SKILL.md frontmatter, a real install into .kimi-code/skills (skill, data, scripts and sub-skills), and detection of a .kimi-code folder. Refs #455.

* fix(scripts): expect 24 platform configs in validate-agent-guide

Adding the kimi platform template raises the config count from 23 to 24. Keep the check strict and update the expected count. Refs #455.

* test(cli): expect 24 platform configs in agent-query-contract

The kimi platform raises the platform config count from 23 to 24. Refs #455.
2026-10-22 23:08:14 +07:00

55 lines
2.1 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { existsSync } from 'node:fs';
import { mkdir, mkdtemp } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { detectAIType, getAITypeDescription } from '../../src/utils/detect.js';
import {
generatePlatformFiles,
listBundledSubSkills,
loadPlatformConfig,
renderSkillFile,
} from '../../src/utils/template.js';
// Kimi Code loads project skills from .kimi-code/skills/<name>/SKILL.md
// (and .agents/skills/). SKILL.md needs name and description frontmatter:
// https://www.kimi.com/code/docs/en/kimi-code-cli/customization/skills.html
function scratchDir(name: string): Promise<string> {
return mkdtemp(join(tmpdir(), `uipro-kimi-${name}-`));
}
test('kimi SKILL.md has the name and description frontmatter Kimi Code requires', async () => {
const config = await loadPlatformConfig('kimi');
const content = await renderSkillFile(config);
const frontmatter = content.match(/^---\n([\s\S]*?)\n---\n/)?.[1] ?? '';
expect(frontmatter).toMatch(/^name: ui-ux-pro-max$/m);
expect(frontmatter).toMatch(/^description: "UI\/UX design intelligence/m);
});
test('kimi installs the skill, its data and the sub-skills under .kimi-code/skills', async () => {
const scratch = await scratchDir('install');
await generatePlatformFiles(scratch, 'kimi');
const skills = join(scratch, '.kimi-code', 'skills');
expect(existsSync(join(skills, 'ui-ux-pro-max', 'SKILL.md'))).toBe(true);
expect(existsSync(join(skills, 'ui-ux-pro-max', 'scripts', 'search.py'))).toBe(true);
expect(existsSync(join(skills, 'ui-ux-pro-max', 'data'))).toBe(true);
for (const name of await listBundledSubSkills()) {
expect(existsSync(join(skills, name, 'SKILL.md')), name).toBe(true);
}
});
test('a .kimi-code directory is detected as kimi', async () => {
const scratch = await scratchDir('detect');
await mkdir(join(scratch, '.kimi-code'));
const { detected, suggested } = detectAIType(scratch);
expect(detected).toEqual(['kimi']);
expect(suggested).toBe('kimi');
expect(getAITypeDescription('kimi')).toBe('Kimi Code (.kimi-code/skills/)');
});