📦 deps(thirdparty): update snapshots

This commit is contained in:
ci[bot]
2026-04-01 05:49:26 +00:00
parent 835121a975
commit a4e4866895
326 changed files with 45705 additions and 0 deletions
+120
View File
@@ -0,0 +1,120 @@
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import type { AIType } from '../types/index.js';
interface DetectionResult {
detected: AIType[];
suggested: AIType | null;
}
export function detectAIType(cwd: string = process.cwd()): DetectionResult {
const detected: AIType[] = [];
if (existsSync(join(cwd, '.claude'))) {
detected.push('claude');
}
if (existsSync(join(cwd, '.cursor'))) {
detected.push('cursor');
}
if (existsSync(join(cwd, '.windsurf'))) {
detected.push('windsurf');
}
if (existsSync(join(cwd, '.agents')) || existsSync(join(cwd, '.agent'))) {
detected.push('antigravity');
}
if (existsSync(join(cwd, '.github'))) {
detected.push('copilot');
}
if (existsSync(join(cwd, '.kiro'))) {
detected.push('kiro');
}
if (existsSync(join(cwd, '.codex'))) {
detected.push('codex');
}
if (existsSync(join(cwd, '.roo'))) {
detected.push('roocode');
}
if (existsSync(join(cwd, '.qoder'))) {
detected.push('qoder');
}
if (existsSync(join(cwd, '.gemini'))) {
detected.push('gemini');
}
if (existsSync(join(cwd, '.trae'))) {
detected.push('trae');
}
if (existsSync(join(cwd, '.opencode'))) {
detected.push('opencode');
}
if (existsSync(join(cwd, '.continue'))) {
detected.push('continue');
}
if (existsSync(join(cwd, '.codebuddy'))) {
detected.push('codebuddy');
}
if (existsSync(join(cwd, '.factory'))) {
detected.push('droid');
}
if (existsSync(join(cwd, '.kilocode'))) {
detected.push('kilocode');
}
if (existsSync(join(cwd, '.warp'))) {
detected.push('warp');
}
if (existsSync(join(cwd, '.augment'))) {
detected.push('augment');
}
// Suggest based on what's detected
let suggested: AIType | null = null;
if (detected.length === 1) {
suggested = detected[0];
} else if (detected.length > 1) {
suggested = 'all';
}
return { detected, suggested };
}
export function getAITypeDescription(aiType: AIType): string {
switch (aiType) {
case 'claude':
return 'Claude Code (.claude/skills/)';
case 'cursor':
return 'Cursor (.cursor/skills/)';
case 'windsurf':
return 'Windsurf (.windsurf/skills/)';
case 'antigravity':
return 'Antigravity (.agents/skills/)';
case 'copilot':
return 'GitHub Copilot (.github/prompts/)';
case 'kiro':
return 'Kiro (.kiro/steering/)';
case 'codex':
return 'Codex (.codex/skills/)';
case 'roocode':
return 'RooCode (.roo/skills/)';
case 'qoder':
return 'Qoder (.qoder/skills/)';
case 'gemini':
return 'Gemini CLI (.gemini/skills/)';
case 'trae':
return 'Trae (.trae/skills/)';
case 'opencode':
return 'OpenCode (.opencode/skills/)';
case 'continue':
return 'Continue (.continue/skills/)';
case 'codebuddy':
return 'CodeBuddy (.codebuddy/skills/)';
case 'droid':
return 'Droid (Factory) (.factory/skills/)';
case 'kilocode':
return 'KiloCode (.kilocode/skills/)';
case 'warp':
return 'Warp (.warp/skills/)';
case 'augment':
return 'Augment (.augment/skills/)';
case 'all':
return 'All AI assistants';
}
}
+149
View File
@@ -0,0 +1,149 @@
import { mkdir, rm, access, cp, mkdtemp, readdir } from 'node:fs/promises';
import { join, basename } from 'node:path';
import { exec } from 'node:child_process';
import { promisify } from 'node:util';
import { tmpdir } from 'node:os';
import type { AIType } from '../types/index.js';
import { AI_FOLDERS } from '../types/index.js';
const execAsync = promisify(exec);
const EXCLUDED_FILES = ['settings.local.json'];
export async function extractZip(zipPath: string, destDir: string): Promise<void> {
try {
const isWindows = process.platform === 'win32';
if (isWindows) {
await execAsync(`powershell -Command "Expand-Archive -Path '${zipPath}' -DestinationPath '${destDir}' -Force"`);
} else {
await execAsync(`unzip -o "${zipPath}" -d "${destDir}"`);
}
} catch (error) {
throw new Error(`Failed to extract zip: ${error}`);
}
}
async function exists(path: string): Promise<boolean> {
try {
await access(path);
return true;
} catch {
return false;
}
}
export async function copyFolders(
sourceDir: string,
targetDir: string,
aiType: AIType
): Promise<string[]> {
const copiedFolders: string[] = [];
const foldersToCopy = aiType === 'all'
? Object.values(AI_FOLDERS).flat()
: AI_FOLDERS[aiType];
// Deduplicate folders (e.g., .shared might be listed multiple times)
const uniqueFolders = [...new Set(foldersToCopy)];
for (const folder of uniqueFolders) {
const sourcePath = join(sourceDir, folder);
const targetPath = join(targetDir, folder);
// Check if source folder exists
const sourceExists = await exists(sourcePath);
if (!sourceExists) {
continue;
}
// Create target directory if needed
await mkdir(targetPath, { recursive: true });
// Filter function to exclude certain files
const filterFn = (src: string): boolean => {
const fileName = basename(src);
return !EXCLUDED_FILES.includes(fileName);
};
// Copy recursively
try {
await cp(sourcePath, targetPath, { recursive: true, filter: filterFn });
copiedFolders.push(folder);
} catch {
// Try shell fallback for older Node versions
try {
if (process.platform === 'win32') {
await execAsync(`xcopy "${sourcePath}" "${targetPath}" /E /I /Y`);
} else {
await execAsync(`cp -r "${sourcePath}/." "${targetPath}"`);
}
copiedFolders.push(folder);
} catch {
// Skip if copy fails
}
}
}
return copiedFolders;
}
export async function cleanup(tempDir: string): Promise<void> {
try {
await rm(tempDir, { recursive: true, force: true });
} catch {
// Ignore cleanup errors
}
}
/**
* Create a temporary directory for extracting ZIP files
*/
export async function createTempDir(): Promise<string> {
return mkdtemp(join(tmpdir(), 'uipro-'));
}
/**
* Find the extracted folder inside temp directory
* GitHub release ZIPs often contain a single root folder
*/
async function findExtractedRoot(tempDir: string): Promise<string> {
const entries = await readdir(tempDir, { withFileTypes: true });
const dirs = entries.filter(e => e.isDirectory());
// If there's exactly one directory, it's likely the extracted root
if (dirs.length === 1) {
return join(tempDir, dirs[0].name);
}
// Otherwise, assume tempDir itself is the root
return tempDir;
}
/**
* Install from a downloaded and extracted ZIP file
*/
export async function installFromZip(
zipPath: string,
targetDir: string,
aiType: AIType
): Promise<{ copiedFolders: string[]; tempDir: string }> {
// Create temp directory
const tempDir = await createTempDir();
try {
// Extract ZIP to temp directory
await extractZip(zipPath, tempDir);
// Find the actual root of the extracted content
const extractedRoot = await findExtractedRoot(tempDir);
// Copy folders from extracted content to target
const copiedFolders = await copyFolders(extractedRoot, targetDir, aiType);
return { copiedFolders, tempDir };
} catch (error) {
// Cleanup on error
await cleanup(tempDir);
throw error;
}
}
+104
View File
@@ -0,0 +1,104 @@
import { writeFile } from 'node:fs/promises';
import type { Release } from '../types/index.js';
const REPO_OWNER = 'nextlevelbuilder';
const REPO_NAME = 'ui-ux-pro-max-skill';
const API_BASE = 'https://api.github.com';
export class GitHubRateLimitError extends Error {
constructor(message: string) {
super(message);
this.name = 'GitHubRateLimitError';
}
}
export class GitHubDownloadError extends Error {
constructor(message: string) {
super(message);
this.name = 'GitHubDownloadError';
}
}
function checkRateLimit(response: Response): void {
const remaining = response.headers.get('x-ratelimit-remaining');
if (response.status === 403 && remaining === '0') {
const resetTime = response.headers.get('x-ratelimit-reset');
const resetDate = resetTime ? new Date(parseInt(resetTime) * 1000).toLocaleTimeString() : 'unknown';
throw new GitHubRateLimitError(`GitHub API rate limit exceeded. Resets at ${resetDate}`);
}
if (response.status === 429) {
throw new GitHubRateLimitError('GitHub API rate limit exceeded (429 Too Many Requests)');
}
}
export async function fetchReleases(): Promise<Release[]> {
const url = `${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/releases`;
const response = await fetch(url, {
headers: {
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'uipro-cli',
},
});
checkRateLimit(response);
if (!response.ok) {
throw new GitHubDownloadError(`Failed to fetch releases: ${response.status} ${response.statusText}`);
}
return response.json();
}
export async function getLatestRelease(): Promise<Release> {
const url = `${API_BASE}/repos/${REPO_OWNER}/${REPO_NAME}/releases/latest`;
const response = await fetch(url, {
headers: {
'Accept': 'application/vnd.github.v3+json',
'User-Agent': 'uipro-cli',
},
});
checkRateLimit(response);
if (!response.ok) {
throw new GitHubDownloadError(`Failed to fetch latest release: ${response.status} ${response.statusText}`);
}
return response.json();
}
export async function downloadRelease(url: string, dest: string): Promise<void> {
const response = await fetch(url, {
headers: {
'User-Agent': 'uipro-cli',
'Accept': 'application/octet-stream',
},
});
checkRateLimit(response);
if (!response.ok) {
throw new GitHubDownloadError(`Failed to download: ${response.status} ${response.statusText}`);
}
const buffer = await response.arrayBuffer();
await writeFile(dest, Buffer.from(buffer));
}
export function getAssetUrl(release: Release): string | null {
// First try to find an uploaded ZIP asset
const asset = release.assets.find(a => a.name.endsWith('.zip'));
if (asset?.browser_download_url) {
return asset.browser_download_url;
}
// Fall back to GitHub's auto-generated archive
// Format: https://github.com/{owner}/{repo}/archive/refs/tags/{tag}.zip
if (release.tag_name) {
return `https://github.com/${REPO_OWNER}/${REPO_NAME}/archive/refs/tags/${release.tag_name}.zip`;
}
return null;
}
+11
View File
@@ -0,0 +1,11 @@
import chalk from 'chalk';
export const logger = {
info: (msg: string) => console.log(chalk.blue('info'), msg),
success: (msg: string) => console.log(chalk.green('success'), msg),
warn: (msg: string) => console.log(chalk.yellow('warn'), msg),
error: (msg: string) => console.log(chalk.red('error'), msg),
title: (msg: string) => console.log(chalk.bold.cyan(`\n${msg}\n`)),
dim: (msg: string) => console.log(chalk.dim(msg)),
};
+243
View File
@@ -0,0 +1,243 @@
import { readFile, mkdir, writeFile, cp, access, readdir } from 'node:fs/promises';
import { join, dirname } from 'node:path';
import { homedir } from 'node:os';
import { fileURLToPath } from 'node:url';
const __dirname = dirname(fileURLToPath(import.meta.url));
// After bun build: dist/index.js -> ../assets = cli/assets ✓
const ASSETS_DIR = join(__dirname, '..', 'assets');
export interface PlatformConfig {
platform: string;
displayName: string;
installType: 'full' | 'reference';
folderStructure: {
root: string;
skillPath: string;
filename: string;
};
scriptPath: string;
frontmatter: Record<string, string> | null;
sections: {
quickReference: boolean;
};
title: string;
description: string;
skillOrWorkflow: string;
}
// Map AIType to platform config file name
const AI_TO_PLATFORM: Record<string, string> = {
claude: 'claude',
cursor: 'cursor',
windsurf: 'windsurf',
antigravity: 'agent',
copilot: 'copilot',
kiro: 'kiro',
opencode: 'opencode',
roocode: 'roocode',
codex: 'codex',
qoder: 'qoder',
gemini: 'gemini',
trae: 'trae',
continue: 'continue',
codebuddy: 'codebuddy',
droid: 'droid',
kilocode: 'kilocode',
warp: 'warp',
augment: 'augment',
};
async function exists(path: string): Promise<boolean> {
try {
await access(path);
return true;
} catch {
return false;
}
}
/**
* Load platform configuration from JSON file
*/
export async function loadPlatformConfig(aiType: string): Promise<PlatformConfig> {
const platformName = AI_TO_PLATFORM[aiType];
if (!platformName) {
throw new Error(`Unknown AI type: ${aiType}`);
}
const configPath = join(ASSETS_DIR, 'templates', 'platforms', `${platformName}.json`);
const content = await readFile(configPath, 'utf-8');
return JSON.parse(content) as PlatformConfig;
}
/**
* Load all available platform configs
*/
export async function loadAllPlatformConfigs(): Promise<Map<string, PlatformConfig>> {
const configs = new Map<string, PlatformConfig>();
for (const [aiType, platformName] of Object.entries(AI_TO_PLATFORM)) {
try {
const config = await loadPlatformConfig(aiType);
configs.set(aiType, config);
} catch {
// Skip if config doesn't exist
}
}
return configs;
}
/**
* Load a template file
*/
async function loadTemplate(templateName: string): Promise<string> {
const templatePath = join(ASSETS_DIR, 'templates', templateName);
return readFile(templatePath, 'utf-8');
}
/**
* Render frontmatter section
*/
function renderFrontmatter(frontmatter: Record<string, string> | null): string {
if (!frontmatter) return '';
const lines = ['---'];
for (const [key, value] of Object.entries(frontmatter)) {
// Quote values that contain special characters
if (value.includes(':') || value.includes('"') || value.includes('\n')) {
lines.push(`${key}: "${value.replace(/"/g, '\\"')}"`);
} else {
lines.push(`${key}: ${value}`);
}
}
lines.push('---', '');
return lines.join('\n');
}
/**
* Render skill file content from template
* When isGlobal=true, rewrites script paths to use ~/{root}/ prefix
*/
export async function renderSkillFile(config: PlatformConfig, isGlobal = false): Promise<string> {
// Load base template
let content = await loadTemplate('base/skill-content.md');
// Load quick reference if needed
let quickReferenceContent = '';
if (config.sections.quickReference) {
quickReferenceContent = await loadTemplate('base/quick-reference.md');
}
// Build the final content
const frontmatter = renderFrontmatter(config.frontmatter);
// Replace placeholders
// Add newline before quick reference content if it exists
const quickRefWithNewline = quickReferenceContent ? '\n' + quickReferenceContent : '';
content = content
.replace(/\{\{TITLE\}\}/g, config.title)
.replace(/\{\{DESCRIPTION\}\}/g, config.description)
.replace(/\{\{SCRIPT_PATH\}\}/g, config.scriptPath)
.replace(/\{\{SKILL_OR_WORKFLOW\}\}/g, config.skillOrWorkflow)
.replace(/\{\{QUICK_REFERENCE\}\}/g, quickRefWithNewline);
// For global install, rewrite relative script paths to absolute ~/root/ paths
if (isGlobal) {
const globalPrefix = `~/${config.folderStructure.root}/`;
content = content.replace(
/python3 skills\//g,
`python3 ${globalPrefix}skills/`
);
}
return frontmatter + content;
}
/**
* Copy data and scripts to target directory
*/
async function copyDataAndScripts(targetSkillDir: string): Promise<void> {
const dataSource = join(ASSETS_DIR, 'data');
const scriptsSource = join(ASSETS_DIR, 'scripts');
const dataTarget = join(targetSkillDir, 'data');
const scriptsTarget = join(targetSkillDir, 'scripts');
// Copy data
if (await exists(dataSource)) {
await mkdir(dataTarget, { recursive: true });
await cp(dataSource, dataTarget, { recursive: true });
}
// Copy scripts
if (await exists(scriptsSource)) {
await mkdir(scriptsTarget, { recursive: true });
await cp(scriptsSource, scriptsTarget, { recursive: true });
}
}
/**
* Generate platform files for a specific AI type
* All platforms use self-contained installation with data and scripts
* When isGlobal=true, installs to ~/home directory with absolute script paths
*/
export async function generatePlatformFiles(
targetDir: string,
aiType: string,
isGlobal = false
): Promise<string[]> {
const config = await loadPlatformConfig(aiType);
const createdFolders: string[] = [];
// For global install, target the user's home directory
const effectiveDir = isGlobal ? homedir() : targetDir;
// Determine full skill directory path
const skillDir = join(
effectiveDir,
config.folderStructure.root,
config.folderStructure.skillPath
);
// Create directory structure
await mkdir(skillDir, { recursive: true });
// Render and write skill file (pass isGlobal to adjust paths)
const skillContent = await renderSkillFile(config, isGlobal);
const skillFilePath = join(skillDir, config.folderStructure.filename);
await writeFile(skillFilePath, skillContent, 'utf-8');
createdFolders.push(config.folderStructure.root);
// Copy data and scripts into the skill directory (self-contained)
await copyDataAndScripts(skillDir);
return createdFolders;
}
/**
* Generate files for all AI types
*/
export async function generateAllPlatformFiles(targetDir: string, isGlobal = false): Promise<string[]> {
const allFolders = new Set<string>();
for (const aiType of Object.keys(AI_TO_PLATFORM)) {
try {
const folders = await generatePlatformFiles(targetDir, aiType, isGlobal);
folders.forEach(f => allFolders.add(f));
} catch {
// Skip if generation fails for a platform
}
}
return Array.from(allFolders);
}
/**
* Get list of supported AI types
*/
export function getSupportedAITypes(): string[] {
return Object.keys(AI_TO_PLATFORM);
}