mirror of
https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git
synced 2026-11-18 16:23:38 +00:00
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>
This commit is contained in:
parent
616663179c
commit
56ea9cf174
@ -302,7 +302,7 @@ Jika belum ada, instal sendiri dari [python.org](https://www.python.org/download
|
||||
|
||||
### Mode Skill (Aktif Otomatis)
|
||||
|
||||
**Didukung:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale
|
||||
**Didukung:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale, GitHub Copilot
|
||||
|
||||
Skill akan aktif otomatis saat Anda meminta pekerjaan UI/UX. Cukup gunakan percakapan secara natural:
|
||||
|
||||
@ -314,7 +314,7 @@ Build a landing page for my SaaS product
|
||||
|
||||
### Mode Workflow (Slash Command)
|
||||
|
||||
**Didukung:** Kiro, GitHub Copilot, Roo Code, KiloCode
|
||||
**Didukung:** Kiro, Roo Code, KiloCode
|
||||
|
||||
Gunakan slash command untuk menjalankan skill:
|
||||
|
||||
|
||||
@ -284,7 +284,7 @@ python3 --version
|
||||
|
||||
### 스킬 모드(자동 활성화)
|
||||
|
||||
**지원:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale
|
||||
**지원:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale, GitHub Copilot
|
||||
|
||||
UI/UX 작업을 요청하면 스킬이 자동으로 활성화됩니다. 자연스럽게 요청하세요.
|
||||
|
||||
@ -296,7 +296,7 @@ UI/UX 작업을 요청하면 스킬이 자동으로 활성화됩니다. 자연
|
||||
|
||||
### 워크플로 모드(슬래시 명령어)
|
||||
|
||||
**지원:** Kiro, GitHub Copilot, Roo Code, KiloCode
|
||||
**지원:** Kiro, Roo Code, KiloCode
|
||||
|
||||
슬래시 명령어로 스킬을 실행하세요.
|
||||
|
||||
|
||||
@ -335,7 +335,7 @@ If it is missing, install it yourself from [python.org](https://www.python.org/d
|
||||
|
||||
### Skill Mode (Auto-activate)
|
||||
|
||||
**Supported:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale, ZCode, Amazon Q Developer, OpenClaw
|
||||
**Supported:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale, ZCode, Amazon Q Developer, OpenClaw, GitHub Copilot
|
||||
|
||||
The skill activates automatically when you request UI/UX work. Just chat naturally:
|
||||
|
||||
@ -347,7 +347,7 @@ Build a landing page for my SaaS product
|
||||
|
||||
### Workflow Mode (Slash Command)
|
||||
|
||||
**Supported:** Kiro, GitHub Copilot, Roo Code, KiloCode
|
||||
**Supported:** Kiro, Roo Code, KiloCode
|
||||
|
||||
Use the slash command to invoke the skill:
|
||||
|
||||
|
||||
@ -295,7 +295,7 @@ Nếu chưa có, hãy tự cài đặt từ [python.org](https://www.python.org/
|
||||
|
||||
### Chế độ Kỹ năng (tự động kích hoạt)
|
||||
|
||||
**Được hỗ trợ:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale
|
||||
**Được hỗ trợ:** Claude Code, Cursor, Windsurf, Antigravity, Codex CLI, Continue, Gemini CLI, OpenCode, Qoder, CodeBuddy, Droid (Factory), KiloCode, Warp, Augment, CodeWhale, GitHub Copilot
|
||||
|
||||
Kỹ năng tự động kích hoạt khi bạn yêu cầu công việc UI/UX. Chỉ cần trò chuyện tự nhiên:
|
||||
|
||||
@ -307,7 +307,7 @@ Xây dựng landing page cho sản phẩm SaaS của tôi
|
||||
|
||||
### Chế độ Quy trình (lệnh slash)
|
||||
|
||||
**Được hỗ trợ:** Kiro, GitHub Copilot, Roo Code, KiloCode
|
||||
**Được hỗ trợ:** Kiro, Roo Code, KiloCode
|
||||
|
||||
Dùng lệnh slash để gọi kỹ năng:
|
||||
|
||||
|
||||
@ -296,7 +296,7 @@ python3 --version
|
||||
|
||||
### 技能模式 (自动激活)
|
||||
|
||||
**支持:** Claude Code、Cursor、Windsurf、Antigravity、Codex CLI、Continue、Gemini CLI、OpenCode、Qoder、CodeBuddy、Droid (Factory)、KiloCode、Warp、Augment、CodeWhale
|
||||
**支持:** Claude Code、Cursor、Windsurf、Antigravity、Codex CLI、Continue、Gemini CLI、OpenCode、Qoder、CodeBuddy、Droid (Factory)、KiloCode、Warp、Augment、CodeWhale、GitHub Copilot
|
||||
|
||||
当你请求 UI/UX 工作时,技能会自动激活。只需自然地聊天:
|
||||
|
||||
@ -308,7 +308,7 @@ python3 --version
|
||||
|
||||
### 工作流模式 (斜杠命令)
|
||||
|
||||
**支持:** Kiro、GitHub Copilot、Roo Code、KiloCode
|
||||
**支持:** Kiro、Roo Code、KiloCode
|
||||
|
||||
使用斜杠命令调用技能:
|
||||
|
||||
|
||||
@ -4,19 +4,19 @@
|
||||
"installType": "full",
|
||||
"folderStructure": {
|
||||
"root": ".github",
|
||||
"skillPath": "prompts",
|
||||
"filename": "ui-ux-pro-max.prompt.md",
|
||||
"dataPath": "prompts/ui-ux-pro-max"
|
||||
"globalRoot": ".copilot",
|
||||
"skillPath": "skills/ui-ux-pro-max",
|
||||
"filename": "SKILL.md"
|
||||
},
|
||||
"scriptPath": "prompts/ui-ux-pro-max/scripts/search.py",
|
||||
"scriptPath": "skills/ui-ux-pro-max/scripts/search.py",
|
||||
"frontmatter": {
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.",
|
||||
"mode": "agent"
|
||||
"name": "ui-ux-pro-max",
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks."
|
||||
},
|
||||
"sections": {
|
||||
"quickReference": false
|
||||
},
|
||||
"title": "ui-ux-pro-max",
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.",
|
||||
"skillOrWorkflow": "Workflow"
|
||||
"skillOrWorkflow": "Skill"
|
||||
}
|
||||
|
||||
@ -7,7 +7,12 @@ import prompts from 'prompts';
|
||||
import type { AIType, ConcreteAIType } from '../types/index.js';
|
||||
import { AI_TYPES, AI_FOLDERS } from '../types/index.js';
|
||||
import { detectAIType, getAITypeDescription } from '../utils/detect.js';
|
||||
import { listBundledSubSkills, loadPlatformConfig } from '../utils/template.js';
|
||||
import {
|
||||
listBundledSubSkills,
|
||||
loadPlatformConfig,
|
||||
platformRoot,
|
||||
removeLegacyInstall,
|
||||
} from '../utils/template.js';
|
||||
import { logger } from '../utils/logger.js';
|
||||
|
||||
interface UninstallOptions {
|
||||
@ -18,29 +23,35 @@ interface UninstallOptions {
|
||||
/**
|
||||
* Remove skill directory for a given AI type
|
||||
*/
|
||||
async function removeSkillDir(baseDir: string, aiType: ConcreteAIType): Promise<string[]> {
|
||||
export async function removeSkillDir(
|
||||
baseDir: string,
|
||||
aiType: ConcreteAIType,
|
||||
isGlobal = false
|
||||
): Promise<string[]> {
|
||||
const removed: string[] = [];
|
||||
|
||||
// The orchestrator plus the bundled sibling sub-skills installed by init.
|
||||
const skillNames = ['ui-ux-pro-max', ...(await listBundledSubSkills())];
|
||||
|
||||
// Parent directories to clean. Derive the real install location from the
|
||||
// platform config's skillPath (same source the installer uses), so
|
||||
// non-`skills/` platforms are handled — copilot installs under
|
||||
// `.github/prompts/`, kiro under `.kiro/steering/`. Also clean the legacy
|
||||
// platform config's skillPath and root (same source the installer uses), so
|
||||
// non-`skills/` platforms (kiro's `.kiro/steering/`) and global roots
|
||||
// (copilot's `~/.copilot/`) are handled. Also clean the legacy
|
||||
// `<folder>/skills/` layout (incl. `.shared/`) so older installs are removed.
|
||||
const parents = new Set<string>();
|
||||
// Standalone skill files to remove (platforms with a dataPath keep the
|
||||
// rendered skill file apart from the data directory — e.g. copilot's
|
||||
// `.github/prompts/ui-ux-pro-max.prompt.md`).
|
||||
// rendered skill file apart from the data directory — e.g. amazonq's
|
||||
// `.amazonq/rules/ui-ux-pro-max.md`).
|
||||
const skillFiles = new Set<string>();
|
||||
try {
|
||||
const { folderStructure } = await loadPlatformConfig(aiType);
|
||||
const config = await loadPlatformConfig(aiType);
|
||||
const { folderStructure } = config;
|
||||
const root = platformRoot(config, isGlobal);
|
||||
if (folderStructure.dataPath) {
|
||||
skillFiles.add(join(folderStructure.root, folderStructure.skillPath, folderStructure.filename));
|
||||
parents.add(join(folderStructure.root, dirname(folderStructure.dataPath)));
|
||||
skillFiles.add(join(root, folderStructure.skillPath, folderStructure.filename));
|
||||
parents.add(join(root, dirname(folderStructure.dataPath)));
|
||||
} else {
|
||||
parents.add(join(folderStructure.root, dirname(folderStructure.skillPath)));
|
||||
parents.add(join(root, dirname(folderStructure.skillPath)));
|
||||
}
|
||||
} catch {
|
||||
// No platform config — fall back to the legacy folders below.
|
||||
@ -75,6 +86,9 @@ async function removeSkillDir(baseDir: string, aiType: ConcreteAIType): Promise<
|
||||
}
|
||||
}
|
||||
|
||||
// An install from an earlier layout (copilot's `.github/prompts/`).
|
||||
removed.push(...(await removeLegacyInstall(baseDir, aiType)));
|
||||
|
||||
return removed;
|
||||
}
|
||||
|
||||
@ -143,11 +157,11 @@ export async function uninstallCommand(options: UninstallOptions): Promise<void>
|
||||
if (aiType === 'all') {
|
||||
// Remove for all detected platforms
|
||||
for (const type of initialDetected) {
|
||||
const removed = await removeSkillDir(baseDir, type);
|
||||
const removed = await removeSkillDir(baseDir, type, isGlobal);
|
||||
allRemoved.push(...removed);
|
||||
}
|
||||
} else {
|
||||
const removed = await removeSkillDir(baseDir, aiType);
|
||||
const removed = await removeSkillDir(baseDir, aiType, isGlobal);
|
||||
allRemoved.push(...removed);
|
||||
}
|
||||
|
||||
|
||||
@ -29,6 +29,7 @@ export interface PlatformConfig {
|
||||
installType: InstallType;
|
||||
folderStructure: {
|
||||
root: string;
|
||||
globalRoot?: string;
|
||||
skillPath: string;
|
||||
filename: string;
|
||||
dataPath?: string;
|
||||
|
||||
@ -7,6 +7,19 @@ interface DetectionResult {
|
||||
suggested: AIType | null;
|
||||
}
|
||||
|
||||
// Files and folders only GitHub Copilot reads (see the Copilot customization
|
||||
// cheat sheet), plus its personal skills folder for global installs. Most
|
||||
// repositories have a .github/ folder for workflows, so it alone says nothing.
|
||||
const COPILOT_MARKERS = [
|
||||
join('.github', 'copilot-instructions.md'),
|
||||
join('.github', 'instructions'),
|
||||
join('.github', 'prompts'),
|
||||
join('.github', 'agents'),
|
||||
join('.github', 'skills'),
|
||||
join('.github', 'hooks'),
|
||||
join('.copilot', 'skills'),
|
||||
];
|
||||
|
||||
export function detectAIType(cwd: string = process.cwd()): DetectionResult {
|
||||
const detected: ConcreteAIType[] = [];
|
||||
|
||||
@ -27,7 +40,7 @@ export function detectAIType(cwd: string = process.cwd()): DetectionResult {
|
||||
} else if (existsSync(join(cwd, '.agent'))) {
|
||||
detected.push('antigravity');
|
||||
}
|
||||
if (existsSync(join(cwd, '.github'))) {
|
||||
if (COPILOT_MARKERS.some(marker => existsSync(join(cwd, marker)))) {
|
||||
detected.push('copilot');
|
||||
}
|
||||
if (existsSync(join(cwd, '.kiro'))) {
|
||||
@ -108,7 +121,7 @@ export function getAITypeDescription(aiType: AIType): string {
|
||||
case 'antigravity':
|
||||
return 'Antigravity (.agents/skills/)';
|
||||
case 'copilot':
|
||||
return 'GitHub Copilot (.github/prompts/)';
|
||||
return 'GitHub Copilot (.github/skills/)';
|
||||
case 'kiro':
|
||||
return 'Kiro (.kiro/steering/)';
|
||||
case 'codex':
|
||||
|
||||
@ -19,6 +19,9 @@ export interface PlatformConfig {
|
||||
installType: 'full' | 'reference';
|
||||
folderStructure: {
|
||||
root: string;
|
||||
// Root used instead of `root` for --global installs, when the assistant
|
||||
// reads personal skills from a different home folder (copilot: ~/.copilot).
|
||||
globalRoot?: string;
|
||||
skillPath: string;
|
||||
filename: string;
|
||||
dataPath?: string;
|
||||
@ -33,6 +36,18 @@ export interface PlatformConfig {
|
||||
skillOrWorkflow: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Layouts an earlier CLI version installed and the current layout replaces.
|
||||
* Paths are relative to the install base (project or home directory).
|
||||
*/
|
||||
const LEGACY_LAYOUTS: Record<string, { skillFiles: string[]; skillsParents: string[] }> = {
|
||||
// Copilot used a prompt file in .github/prompts/ before it loaded Agent Skills.
|
||||
copilot: {
|
||||
skillFiles: ['.github/prompts/ui-ux-pro-max.prompt.md'],
|
||||
skillsParents: ['.github/prompts'],
|
||||
},
|
||||
};
|
||||
|
||||
// Map AIType to platform config file name
|
||||
const AI_TO_PLATFORM: Record<string, string> = {
|
||||
claude: 'claude',
|
||||
@ -83,6 +98,14 @@ export async function loadPlatformConfig(aiType: string): Promise<PlatformConfig
|
||||
return JSON.parse(content) as PlatformConfig;
|
||||
}
|
||||
|
||||
/**
|
||||
* The folder a platform installs into, relative to the project (local) or
|
||||
* home directory (global).
|
||||
*/
|
||||
export function platformRoot(config: PlatformConfig, isGlobal: boolean): string {
|
||||
return (isGlobal && config.folderStructure.globalRoot) || config.folderStructure.root;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all available platform configs
|
||||
*/
|
||||
@ -161,7 +184,7 @@ export async function renderSkillFile(config: PlatformConfig, isGlobal = false):
|
||||
// scriptPath is relative to the platform root. Generated commands run from
|
||||
// the user's project root, so local installs need the platform root prefix;
|
||||
// global installs need the same path anchored at the user's home directory.
|
||||
const rootedScriptPath = `${config.folderStructure.root}/${config.scriptPath}`
|
||||
const rootedScriptPath = `${platformRoot(config, isGlobal)}/${config.scriptPath}`
|
||||
.replace(/\/{2,}/g, '/');
|
||||
const commandScriptPath = isGlobal ? `~/${rootedScriptPath}` : rootedScriptPath;
|
||||
|
||||
@ -235,6 +258,42 @@ export async function listBundledSubSkills(): Promise<string[]> {
|
||||
return entries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||
}
|
||||
|
||||
/**
|
||||
* Paths of an earlier layout of aiType that exist under baseDir: the old skill
|
||||
* file, the orchestrator folder and the bundled sub-skills left next to it.
|
||||
* A sub-skill folder only counts when it holds a SKILL.md, so a user's own
|
||||
* folder of the same name (e.g. `.github/prompts/design`) is left alone.
|
||||
*/
|
||||
export async function findLegacyInstallPaths(baseDir: string, aiType: string): Promise<string[]> {
|
||||
const layout = LEGACY_LAYOUTS[aiType];
|
||||
if (!layout) return [];
|
||||
|
||||
const found: string[] = [];
|
||||
for (const skillFile of layout.skillFiles) {
|
||||
if (await exists(join(baseDir, skillFile))) found.push(skillFile);
|
||||
}
|
||||
for (const parent of layout.skillsParents) {
|
||||
const orchestratorDir = `${parent}/ui-ux-pro-max`;
|
||||
if (await exists(join(baseDir, orchestratorDir))) found.push(orchestratorDir);
|
||||
for (const name of await listBundledSubSkills()) {
|
||||
const subSkillDir = `${parent}/${name}`;
|
||||
if (await exists(join(baseDir, subSkillDir, 'SKILL.md'))) found.push(subSkillDir);
|
||||
}
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove an earlier layout of aiType from baseDir. Returns the removed paths.
|
||||
*/
|
||||
export async function removeLegacyInstall(baseDir: string, aiType: string): Promise<string[]> {
|
||||
const found = await findLegacyInstallPaths(baseDir, aiType);
|
||||
for (const path of found) {
|
||||
await rm(join(baseDir, path), { recursive: true, force: true });
|
||||
}
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* Install the bundled sub-skills as siblings of the orchestrator skill, so a
|
||||
* single `uipro init` delivers all 7 skills instead of only ui-ux-pro-max.
|
||||
@ -261,6 +320,7 @@ function resolveInstallPaths(
|
||||
targetDir: string,
|
||||
isGlobal: boolean
|
||||
): {
|
||||
baseDir: string;
|
||||
skillDir: string;
|
||||
skillFilePath: string;
|
||||
dataDir: string;
|
||||
@ -268,33 +328,34 @@ function resolveInstallPaths(
|
||||
} {
|
||||
// For global install, target the user's home directory
|
||||
const effectiveDir = isGlobal ? homedir() : targetDir;
|
||||
const root = platformRoot(config, isGlobal);
|
||||
|
||||
// Determine full skill directory path
|
||||
const skillDir = join(
|
||||
effectiveDir,
|
||||
config.folderStructure.root,
|
||||
root,
|
||||
config.folderStructure.skillPath
|
||||
);
|
||||
const skillFilePath = join(skillDir, config.folderStructure.filename);
|
||||
|
||||
// Copy data and scripts into the data directory (may differ from skill file location)
|
||||
const dataDir = config.folderStructure.dataPath
|
||||
? join(effectiveDir, config.folderStructure.root, config.folderStructure.dataPath)
|
||||
? join(effectiveDir, root, config.folderStructure.dataPath)
|
||||
: skillDir;
|
||||
|
||||
// The skills parent is the orchestrator's parent dir (skills/ for most
|
||||
// platforms, prompts/ for copilot, steering/ for kiro) — derived, not
|
||||
// hardcoded. For platforms with a separate dataPath (copilot), the
|
||||
// orchestrator's data dir is the anchor.
|
||||
// platforms, steering/ for kiro) — derived, not hardcoded. For platforms
|
||||
// with a separate dataPath (amazonq), the orchestrator's data dir is the
|
||||
// anchor.
|
||||
const skillsParentDir = join(
|
||||
effectiveDir,
|
||||
config.folderStructure.root,
|
||||
root,
|
||||
config.folderStructure.dataPath
|
||||
? dirname(config.folderStructure.dataPath)
|
||||
: dirname(config.folderStructure.skillPath)
|
||||
);
|
||||
|
||||
return { skillDir, skillFilePath, dataDir, skillsParentDir };
|
||||
return { baseDir: effectiveDir, skillDir, skillFilePath, dataDir, skillsParentDir };
|
||||
}
|
||||
|
||||
/**
|
||||
@ -310,7 +371,7 @@ export async function generatePlatformFiles(
|
||||
): Promise<string[]> {
|
||||
const config = await loadPlatformConfig(aiType);
|
||||
const createdFolders: string[] = [];
|
||||
const { skillDir, skillFilePath, dataDir, skillsParentDir } = resolveInstallPaths(
|
||||
const { baseDir, skillDir, skillFilePath, dataDir, skillsParentDir } = resolveInstallPaths(
|
||||
config,
|
||||
targetDir,
|
||||
isGlobal
|
||||
@ -329,7 +390,7 @@ export async function generatePlatformFiles(
|
||||
}
|
||||
|
||||
await writeFile(skillFilePath, skillContent, 'utf-8');
|
||||
createdFolders.push(config.folderStructure.root);
|
||||
createdFolders.push(platformRoot(config, isGlobal));
|
||||
|
||||
await mkdir(dataDir, { recursive: true });
|
||||
await copyDataAndScripts(dataDir);
|
||||
@ -338,6 +399,11 @@ export async function generatePlatformFiles(
|
||||
// the orchestrator so all 7 skills are delivered.
|
||||
await copySubSkills(skillsParentDir, force);
|
||||
|
||||
// The new layout replaces an earlier one (copilot's .github/prompts/ install).
|
||||
for (const path of await removeLegacyInstall(baseDir, aiType)) {
|
||||
console.log(` Removed legacy install: ${join(baseDir, path)}`);
|
||||
}
|
||||
|
||||
return createdFolders;
|
||||
}
|
||||
|
||||
@ -352,7 +418,7 @@ export async function planPlatformInstallActions(
|
||||
force = false
|
||||
): Promise<string[]> {
|
||||
const config = await loadPlatformConfig(aiType);
|
||||
const { skillFilePath, dataDir, skillsParentDir } = resolveInstallPaths(config, targetDir, isGlobal);
|
||||
const { baseDir, skillFilePath, dataDir, skillsParentDir } = resolveInstallPaths(config, targetDir, isGlobal);
|
||||
|
||||
const actions: string[] = [];
|
||||
const skillFileExists = await exists(skillFilePath);
|
||||
@ -370,6 +436,12 @@ export async function planPlatformInstallActions(
|
||||
);
|
||||
}
|
||||
|
||||
if (!skillFileExists || force) {
|
||||
for (const path of await findLegacyInstallPaths(baseDir, aiType)) {
|
||||
actions.push(`Would remove legacy install: ${join(baseDir, path)}`);
|
||||
}
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
191
cli/tests/e2e/copilot-skills.spec.ts
Normal file
191
cli/tests/e2e/copilot-skills.spec.ts
Normal file
@ -0,0 +1,191 @@
|
||||
import { expect, test } from '@playwright/test';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { mkdir, mkdtemp, readdir, writeFile } from 'node:fs/promises';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { removeSkillDir } from '../../src/commands/uninstall.js';
|
||||
import { detectAIType } from '../../src/utils/detect.js';
|
||||
import {
|
||||
generatePlatformFiles,
|
||||
listBundledSubSkills,
|
||||
loadPlatformConfig,
|
||||
planPlatformInstallActions,
|
||||
renderSkillFile,
|
||||
} from '../../src/utils/template.js';
|
||||
|
||||
// GitHub Copilot loads project skills from .github/skills/<name>/SKILL.md and
|
||||
// personal skills from ~/.copilot/skills/<name>/SKILL.md:
|
||||
// https://docs.github.com/en/copilot/concepts/agents/about-agent-skills
|
||||
|
||||
function scratchDir(name: string): Promise<string> {
|
||||
return mkdtemp(join(tmpdir(), `uipro-copilot-${name}-`));
|
||||
}
|
||||
|
||||
/** What `uipro init --ai copilot` installed before it targeted Agent Skills. */
|
||||
async function writeLegacyPromptInstall(dir: string): Promise<void> {
|
||||
const prompts = join(dir, '.github', 'prompts');
|
||||
await mkdir(join(prompts, 'ui-ux-pro-max', 'scripts'), { recursive: true });
|
||||
await writeFile(join(prompts, 'ui-ux-pro-max.prompt.md'), '---\nmode: agent\n---\n');
|
||||
await writeFile(join(prompts, 'ui-ux-pro-max', 'scripts', 'search.py'), '');
|
||||
await mkdir(join(prompts, 'design'));
|
||||
await writeFile(join(prompts, 'design', 'SKILL.md'), '---\nname: design\n---\n');
|
||||
}
|
||||
|
||||
test('copilot SKILL.md has the name and description frontmatter Agent Skills require', async () => {
|
||||
const config = await loadPlatformConfig('copilot');
|
||||
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);
|
||||
expect(frontmatter).not.toMatch(/^mode:/m);
|
||||
expect(config.frontmatter!.description.length).toBeLessThanOrEqual(1024);
|
||||
});
|
||||
|
||||
test('copilot dry-run plans the .github/skills layout and writes nothing', async () => {
|
||||
const scratch = await scratchDir('dry-run');
|
||||
|
||||
const actions = await planPlatformInstallActions(scratch, 'copilot');
|
||||
|
||||
const skillDir = join(scratch, '.github', 'skills', 'ui-ux-pro-max');
|
||||
expect(actions[0]).toBe(`Would write: ${join(skillDir, 'SKILL.md')}`);
|
||||
expect(actions[1]).toBe(`Would copy data + scripts: ${skillDir}`);
|
||||
expect(actions[2]).toMatch(/^Would copy 6 sub-skills \(/);
|
||||
expect(actions[2].endsWith(`: ${join(scratch, '.github', 'skills')}`)).toBe(true);
|
||||
expect(actions).toHaveLength(3);
|
||||
expect(await readdir(scratch)).toEqual([]);
|
||||
});
|
||||
|
||||
/** Run fn with os.homedir() pointing at home (HOME on POSIX, USERPROFILE on Windows). */
|
||||
async function withHome<T>(home: string, fn: () => Promise<T>): Promise<T> {
|
||||
const saved = { HOME: process.env.HOME, USERPROFILE: process.env.USERPROFILE };
|
||||
process.env.HOME = home;
|
||||
process.env.USERPROFILE = home;
|
||||
try {
|
||||
return await fn();
|
||||
} finally {
|
||||
for (const [key, value] of Object.entries(saved)) {
|
||||
if (value === undefined) delete process.env[key];
|
||||
else process.env[key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
test('copilot --global plans the personal ~/.copilot/skills folder', async () => {
|
||||
const home = await scratchDir('home');
|
||||
|
||||
const actions = await withHome(home, async () =>
|
||||
planPlatformInstallActions(await scratchDir('project'), 'copilot', true)
|
||||
);
|
||||
|
||||
expect(actions[0]).toBe(
|
||||
`Would write: ${join(home, '.copilot', 'skills', 'ui-ux-pro-max', 'SKILL.md')}`
|
||||
);
|
||||
});
|
||||
|
||||
test('copilot --global installs to and uninstalls from ~/.copilot/skills', async () => {
|
||||
const home = await scratchDir('global');
|
||||
|
||||
await withHome(home, async () => generatePlatformFiles(await scratchDir('project'), 'copilot', true));
|
||||
|
||||
const skillFile = join(home, '.copilot', 'skills', 'ui-ux-pro-max', 'SKILL.md');
|
||||
expect(existsSync(skillFile)).toBe(true);
|
||||
expect(existsSync(join(home, '.github'))).toBe(false);
|
||||
|
||||
const removed = await removeSkillDir(home, 'copilot', true);
|
||||
|
||||
expect(removed).toContain('.copilot/skills/ui-ux-pro-max');
|
||||
expect(await readdir(join(home, '.copilot', 'skills'))).toEqual([]);
|
||||
});
|
||||
|
||||
test('copilot installs the skill, its data and the sub-skills under .github/skills', async () => {
|
||||
const scratch = await scratchDir('install');
|
||||
|
||||
await generatePlatformFiles(scratch, 'copilot');
|
||||
|
||||
const skills = join(scratch, '.github', '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);
|
||||
}
|
||||
expect(existsSync(join(scratch, '.github', 'prompts'))).toBe(false);
|
||||
});
|
||||
|
||||
test('copilot replaces an earlier .github/prompts install and keeps the user\'s prompts', async () => {
|
||||
const scratch = await scratchDir('migrate');
|
||||
await writeLegacyPromptInstall(scratch);
|
||||
const prompts = join(scratch, '.github', 'prompts');
|
||||
await writeFile(join(prompts, 'release-notes.prompt.md'), '# mine\n');
|
||||
// A user's own folder that shares a sub-skill name but holds no SKILL.md.
|
||||
await mkdir(join(prompts, 'slides'));
|
||||
await writeFile(join(prompts, 'slides', 'notes.md'), '# mine\n');
|
||||
|
||||
const plan = await planPlatformInstallActions(scratch, 'copilot');
|
||||
expect(plan.slice(3)).toEqual([
|
||||
`Would remove legacy install: ${join(prompts, 'ui-ux-pro-max.prompt.md')}`,
|
||||
`Would remove legacy install: ${join(prompts, 'ui-ux-pro-max')}`,
|
||||
`Would remove legacy install: ${join(prompts, 'design')}`,
|
||||
]);
|
||||
|
||||
await generatePlatformFiles(scratch, 'copilot');
|
||||
|
||||
expect(existsSync(join(scratch, '.github', 'skills', 'ui-ux-pro-max', 'SKILL.md'))).toBe(true);
|
||||
expect(existsSync(join(prompts, 'ui-ux-pro-max.prompt.md'))).toBe(false);
|
||||
expect(existsSync(join(prompts, 'ui-ux-pro-max'))).toBe(false);
|
||||
expect(existsSync(join(prompts, 'design'))).toBe(false);
|
||||
expect(existsSync(join(prompts, 'release-notes.prompt.md'))).toBe(true);
|
||||
expect(existsSync(join(prompts, 'slides', 'notes.md'))).toBe(true);
|
||||
});
|
||||
|
||||
test('a .github folder without Copilot files does not detect copilot', async () => {
|
||||
const scratch = await scratchDir('detect-workflows');
|
||||
await mkdir(join(scratch, '.github', 'workflows'), { recursive: true });
|
||||
await writeFile(join(scratch, '.github', 'dependabot.yml'), 'version: 2\n');
|
||||
|
||||
expect(detectAIType(scratch).detected).not.toContain('copilot');
|
||||
});
|
||||
|
||||
for (const marker of [
|
||||
'.github/copilot-instructions.md',
|
||||
'.github/instructions',
|
||||
'.github/prompts',
|
||||
'.github/agents',
|
||||
'.github/skills',
|
||||
'.github/hooks',
|
||||
'.copilot/skills',
|
||||
]) {
|
||||
test(`${marker} detects copilot`, async () => {
|
||||
const scratch = await scratchDir('detect');
|
||||
const path = join(scratch, marker);
|
||||
if (marker.endsWith('.md')) {
|
||||
await mkdir(dirname(path), { recursive: true });
|
||||
await writeFile(path, '');
|
||||
} else {
|
||||
await mkdir(path, { recursive: true });
|
||||
}
|
||||
|
||||
expect(detectAIType(scratch)).toEqual({ detected: ['copilot'], suggested: 'copilot' });
|
||||
});
|
||||
}
|
||||
|
||||
test('uninstall removes the .github/skills install and an earlier .github/prompts one', async () => {
|
||||
const scratch = await scratchDir('uninstall');
|
||||
await generatePlatformFiles(scratch, 'copilot');
|
||||
await writeLegacyPromptInstall(scratch);
|
||||
await mkdir(join(scratch, '.github', 'workflows'));
|
||||
|
||||
const removed = await removeSkillDir(scratch, 'copilot');
|
||||
|
||||
expect(removed).toEqual(expect.arrayContaining([
|
||||
'.github/skills/ui-ux-pro-max',
|
||||
'.github/skills/design',
|
||||
'.github/prompts/ui-ux-pro-max.prompt.md',
|
||||
'.github/prompts/ui-ux-pro-max',
|
||||
'.github/prompts/design',
|
||||
]));
|
||||
expect(await readdir(join(scratch, '.github', 'skills'))).toEqual([]);
|
||||
expect(await readdir(join(scratch, '.github', 'prompts'))).toEqual([]);
|
||||
expect(existsSync(join(scratch, '.github', 'workflows'))).toBe(true);
|
||||
});
|
||||
@ -4,7 +4,6 @@ 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'],
|
||||
['copilot', '.github/prompts/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'],
|
||||
@ -34,3 +33,15 @@ for (const [platform, localPath] of cases) {
|
||||
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']));
|
||||
});
|
||||
|
||||
@ -4,19 +4,19 @@
|
||||
"installType": "full",
|
||||
"folderStructure": {
|
||||
"root": ".github",
|
||||
"skillPath": "prompts",
|
||||
"filename": "ui-ux-pro-max.prompt.md",
|
||||
"dataPath": "prompts/ui-ux-pro-max"
|
||||
"globalRoot": ".copilot",
|
||||
"skillPath": "skills/ui-ux-pro-max",
|
||||
"filename": "SKILL.md"
|
||||
},
|
||||
"scriptPath": "prompts/ui-ux-pro-max/scripts/search.py",
|
||||
"scriptPath": "skills/ui-ux-pro-max/scripts/search.py",
|
||||
"frontmatter": {
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.",
|
||||
"mode": "agent"
|
||||
"name": "ui-ux-pro-max",
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks."
|
||||
},
|
||||
"sections": {
|
||||
"quickReference": false
|
||||
},
|
||||
"title": "ui-ux-pro-max",
|
||||
"description": "UI/UX design intelligence for web, mobile, and desktop. This skill should be used when designing, building, reviewing, or fixing interfaces, including pages, components, design systems, accessibility, interaction, responsive layout, typography, color, charts, and stack-specific UI implementation. Searchable local data: 79 searchable styles (50 active), 192 product palettes and reasoning profiles, 74 font pairings, 119 UX guidelines, 105 icons, 17 GSAP presets, 25 chart types, and 22 stacks.",
|
||||
"skillOrWorkflow": "Workflow"
|
||||
"skillOrWorkflow": "Skill"
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user