ui-ux-pro-max-skill/cli/tests/e2e/template-script-paths.spec.ts
Jul11us 56ea9cf174
feat(copilot): install as an Agent Skill in .github/skills (#533)
uipro init --ai copilot wrote .github/prompts/ui-ux-pro-max.prompt.md,
a prompt file that Copilot does not discover as a skill. It now installs
.github/skills/ui-ux-pro-max/SKILL.md with name/description frontmatter,
the data and scripts in the same folder and the sub-skills next to it,
which is where Copilot loads project skills. --global installs to
~/.copilot/skills/, Copilot's personal skills folder, through a new
optional folderStructure.globalRoot.

init and update remove the .github/prompts/ install they replace: the
prompt file, its data folder and the bundled sub-skills there. Other
files in .github/prompts/ are kept. uninstall removes both layouts.

Copilot is now detected from Copilot files (copilot-instructions.md,
instructions/, prompts/, agents/, skills/ or hooks/ under .github, or
~/.copilot/skills) instead of from any .github folder.

Closes #454

Co-authored-by: Jul11us <233702296+Jul11us@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 09:04:34 +07:00

48 lines
2.2 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loadPlatformConfig, renderSkillFile } from '../../src/utils/template.js';
const cases = [
['claude', '.claude/skills/ui-ux-pro-max/scripts/search.py'],
['codex', '.agents/skills/ui-ux-pro-max/scripts/search.py'],
['kiro', '.kiro/steering/ui-ux-pro-max/scripts/search.py'],
['droid', '.factory/skills/ui-ux-pro-max/scripts/search.py'],
['zcode', '.zcode/skills/ui-ux-pro-max/scripts/search.py'],
['amazonq', '.amazonq/skills/ui-ux-pro-max/scripts/search.py'],
['openclaw', '.agents/skills/ui-ux-pro-max/scripts/search.py'],
] as const;
const SEARCH_COMMAND_COUNT = 17;
function extractSearchScriptPaths(content: string): string[] {
return [...content.matchAll(/^python3\s+(\S*search\.py)\b/gm)].map(match => match[1]);
}
for (const [platform, localPath] of cases) {
test(`${platform} renders project-root and global script paths`, async () => {
const config = await loadPlatformConfig(platform);
const localContent = await renderSkillFile(config);
const localPaths = extractSearchScriptPaths(localContent);
expect(localPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(localPaths)).toEqual(new Set([localPath]));
expect(localContent).not.toContain('{{SCRIPT_PATH}}');
const globalContent = await renderSkillFile(config, true);
const globalPaths = extractSearchScriptPaths(globalContent);
expect(globalPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(globalPaths)).toEqual(new Set([`~/${localPath}`]));
expect(globalContent).not.toContain('{{SCRIPT_PATH}}');
});
}
test('copilot renders .github/skills paths locally and ~/.copilot/skills globally', async () => {
const config = await loadPlatformConfig('copilot');
const localPaths = extractSearchScriptPaths(await renderSkillFile(config));
expect(localPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(localPaths)).toEqual(new Set(['.github/skills/ui-ux-pro-max/scripts/search.py']));
const globalPaths = extractSearchScriptPaths(await renderSkillFile(config, true));
expect(globalPaths).toHaveLength(SEARCH_COMMAND_COUNT);
expect(new Set(globalPaths)).toEqual(new Set(['~/.copilot/skills/ui-ux-pro-max/scripts/search.py']));
});