feat: add uxpro-cli for easy skill installation (#4)
* feat: add uxpro-cli for easy skill installation - Add CLI tool (uxpro-cli) with commands: init, versions, update - Support multiple AI assistants: claude, cursor, windsurf, antigravity, all - Update README with CLI installation guide and usage examples - Add CC BY-NC 4.0 license - Update feature counts to accurate numbers 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * refactor: rename CLI from uxpro to uipro - Package: uxpro-cli -> uipro-cli - Command: uxpro -> uipro 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
59
cli/src/utils/github.ts
Normal file
59
cli/src/utils/github.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
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 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',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch releases: ${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',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to fetch latest release: ${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',
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`Failed to download: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const buffer = await response.arrayBuffer();
|
||||
await Bun.write(dest, buffer);
|
||||
}
|
||||
|
||||
export function getAssetUrl(release: Release): string | null {
|
||||
const asset = release.assets.find(a => a.name.endsWith('.zip'));
|
||||
return asset?.browser_download_url ?? null;
|
||||
}
|
||||
Reference in New Issue
Block a user