ui-ux-pro-max-skill/cli/tests/e2e/dry-run.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

95 lines
3.4 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { mkdtemp, readdir } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import {
planAllPlatformInstallActions,
planPlatformInstallActions,
} from '../../src/utils/template.js';
test('dry-run plan lists the install actions for one platform', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-'));
const actions = await planPlatformInstallActions(scratch, 'claude');
const joined = actions.join('\n');
expect(joined).toContain(
join(scratch, '.claude', 'skills', 'ui-ux-pro-max', 'SKILL.md')
);
expect(joined).toContain('Would copy data + scripts:');
expect(joined).toContain('Would copy 6 sub-skills (');
});
test('dry-run plan writes nothing to the target directory', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-write-'));
const before = await readdir(scratch);
await planPlatformInstallActions(scratch, 'claude');
await planAllPlatformInstallActions(scratch);
expect(await readdir(scratch)).toEqual(before);
});
test('dry-run plan supports the zcode platform layout', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-zcode-'));
const actions = await planPlatformInstallActions(scratch, 'zcode');
const joined = actions.join('\n');
expect(joined).toContain(
join(scratch, '.zcode', 'skills', 'ui-ux-pro-max', 'SKILL.md')
);
expect(joined).toContain('Would copy data + scripts:');
expect(joined).toContain('Would copy 6 sub-skills (');
});
test('dry-run plan supports the kimi platform layout', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-kimi-'));
const actions = await planPlatformInstallActions(scratch, 'kimi');
const joined = actions.join('\n');
expect(joined).toContain(
join(scratch, '.kimi-code', 'skills', 'ui-ux-pro-max', 'SKILL.md')
);
expect(joined).toContain('Would copy data + scripts:');
expect(joined).toContain('Would copy 6 sub-skills (');
});
test('dry-run plan keeps amazonq data and sub-skills out of the rules folder', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-amazonq-'));
const actions = await planPlatformInstallActions(scratch, 'amazonq');
expect(actions[0]).toBe(
`Would write: ${join(scratch, '.amazonq', 'rules', 'ui-ux-pro-max.md')}`
);
expect(actions[1]).toBe(
`Would copy data + scripts: ${join(scratch, '.amazonq', 'skills', 'ui-ux-pro-max')}`
);
expect(actions[2]).toMatch(/^Would copy 6 sub-skills \(/);
expect(actions[2].endsWith(`: ${join(scratch, '.amazonq', 'skills')}`)).toBe(true);
});
test('dry-run plan supports the openclaw platform layout', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-openclaw-'));
const actions = await planPlatformInstallActions(scratch, 'openclaw');
const joined = actions.join('\n');
expect(joined).toContain(
join(scratch, '.agents', 'skills', 'ui-ux-pro-max', 'SKILL.md')
);
expect(joined).toContain('Would copy data + scripts:');
expect(joined).toContain('Would copy 6 sub-skills (');
});
test('dry-run plan for all platforms covers every unique layout', async () => {
const scratch = await mkdtemp(join(tmpdir(), 'uipro-dry-run-all-'));
const planned = await planAllPlatformInstallActions(scratch);
expect(planned.size).toBeGreaterThan(1);
expect(planned.get('claude')!.length).toBeGreaterThan(0);
});