mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
feat: DX improvements - new CLI commands, simplified onboarding, and website updates (#19)
* feat(cli): add check, find, manifest commands and simplified onboarding New commands: - skillkit check - Check for available skill updates (dry-run) - skillkit find - Quick CLI marketplace search with interactive mode - skillkit manifest - Manage .skills manifest file for declarative skills Manifest subcommands: - manifest init - Create new .skills file - manifest add - Add skill source to manifest - manifest remove - Remove skill source from manifest - manifest install - Install all skills from manifest - manifest generate - Generate manifest from installed skills Onboarding improvements: - Add quickAgentSelect() for simplified agent selection - Same as last time (Recommended) option for returning users - All detected agents quick option - Select specific agents for manual selection - Streamlined install flow with fewer prompts Other changes: - Add bullet, arrowUp, arrowDown symbols to theme - Update version to 1.7.6 * feat(website): showcase full CLI power with Commands section - Add Commands.tsx with tabbed command showcase (Core, Discovery, Team, Advanced) - Update Hero terminal demo with new commands (find, ui, check, manifest) - Update Features section with TUI, Plugins, Manifest, CI/CD, Slash Commands - Update stats to show 17 agents, 30+ commands, 15K skills - Update comparison table with .skills manifest and CI/CD - Bump version display to v1.7.5 * fix: address CodeRabbit review suggestions - Security: Use execFileSync instead of execSync to prevent command injection in manifest install - Fix: Remove false positive hasUpdate for remote skills in check command - Fix: Add missing repoName filter in interactive find search - Fix: Remove incorrect sourceType→agents mapping in manifest generate - Perf: Eliminate duplicate findSkill calls in check command * docs: add demo video and update README - Add skillkit-demo.mp4 video to README - Update website badge to agenstskills.com - Remove old GIF reference
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
[](https://www.npmjs.com/package/skillkit)
|
||||
[](https://github.com/rohitg00/skillkit/pkgs/npm/skillkit)
|
||||
[](https://github.com/rohitg00/skillkit/actions/workflows/ci.yml)
|
||||
[](https://rohitg00.github.io/skillkit/)
|
||||
[](https://agenstskills.com)
|
||||
[](https://opensource.org/licenses/Apache-2.0)
|
||||
|
||||
## Supercharge Every AI Coding Agent
|
||||
@@ -32,6 +32,10 @@ npm install -g skillkit
|
||||
|
||||
## See It In Action
|
||||
|
||||
<video src="https://raw.githubusercontent.com/rohitg00/skillkit/main/docs/skillkit/public/skillkit-demo.mp4" controls width="100%"></video>
|
||||
|
||||
> **Note:** If the video doesn't play above, [watch it here](https://raw.githubusercontent.com/rohitg00/skillkit/main/docs/skillkit/public/skillkit-demo.mp4)
|
||||
|
||||
```bash
|
||||
# Install a skill for ALL your agents at once
|
||||
skillkit install anthropics/skills --agent claude-code,cursor,windsurf
|
||||
@@ -46,8 +50,6 @@ skillkit recommend
|
||||
# > 85% match: nextjs-app-router
|
||||
```
|
||||
|
||||

|
||||
|
||||
## Beautiful CLI Experience
|
||||
|
||||
SkillKit features a polished, interactive CLI with visual feedback:
|
||||
|
||||
@@ -47,6 +47,15 @@ import {
|
||||
AgentTranslateCommand,
|
||||
AgentSyncCommand,
|
||||
AgentValidateCommand,
|
||||
// New commands (Phase 21)
|
||||
CheckCommand,
|
||||
FindCommand,
|
||||
ManifestCommand,
|
||||
ManifestInitCommand,
|
||||
ManifestAddCommand,
|
||||
ManifestRemoveCommand,
|
||||
ManifestInstallCommand,
|
||||
ManifestGenerateCommand,
|
||||
} from '@skillkit/cli';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
@@ -108,4 +117,13 @@ cli.register(AgentTranslateCommand);
|
||||
cli.register(AgentSyncCommand);
|
||||
cli.register(AgentValidateCommand);
|
||||
|
||||
cli.register(CheckCommand);
|
||||
cli.register(FindCommand);
|
||||
cli.register(ManifestCommand);
|
||||
cli.register(ManifestInitCommand);
|
||||
cli.register(ManifestAddCommand);
|
||||
cli.register(ManifestRemoveCommand);
|
||||
cli.register(ManifestInstallCommand);
|
||||
cli.register(ManifestGenerateCommand);
|
||||
|
||||
cli.runExit(process.argv.slice(2));
|
||||
|
||||
@@ -5,6 +5,7 @@ import { Agents } from './components/Agents';
|
||||
import { Footer } from './components/Footer';
|
||||
import { SkillGenerator } from './components/SkillGenerator';
|
||||
import { SkillSubmitForm } from './components/SkillSubmitForm';
|
||||
import { Commands } from './components/Commands';
|
||||
|
||||
const GITHUB_ICON = (
|
||||
<svg className="w-5 h-5" fill="currentColor" viewBox="0 0 24 24">
|
||||
@@ -61,6 +62,7 @@ export default function App(): React.ReactElement {
|
||||
<Hero />
|
||||
<Agents />
|
||||
<Features />
|
||||
<Commands />
|
||||
|
||||
<section id="skills" className="py-12 border-b border-zinc-800">
|
||||
<SkillGenerator />
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
import React, { useState } from 'react';
|
||||
|
||||
interface CommandGroup {
|
||||
name: string;
|
||||
commands: Array<{ cmd: string; desc: string }>;
|
||||
}
|
||||
|
||||
const COMMAND_GROUPS: CommandGroup[] = [
|
||||
{
|
||||
name: 'Core',
|
||||
commands: [
|
||||
{ cmd: 'install', desc: 'Install from GitHub/GitLab/local' },
|
||||
{ cmd: 'sync', desc: 'Sync skills across agents' },
|
||||
{ cmd: 'translate', desc: 'Convert between agent formats' },
|
||||
{ cmd: 'update', desc: 'Update installed skills' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Discovery',
|
||||
commands: [
|
||||
{ cmd: 'find', desc: 'Search marketplace (15K+ skills)' },
|
||||
{ cmd: 'recommend', desc: 'AI-powered suggestions' },
|
||||
{ cmd: 'check', desc: 'Dry-run update check' },
|
||||
{ cmd: 'list', desc: 'View installed skills' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Team',
|
||||
commands: [
|
||||
{ cmd: 'manifest init', desc: 'Create .skills file' },
|
||||
{ cmd: 'manifest install', desc: 'Install from manifest' },
|
||||
{ cmd: 'team share', desc: 'Share skills via Git' },
|
||||
{ cmd: 'publish', desc: 'Submit to marketplace' },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'Advanced',
|
||||
commands: [
|
||||
{ cmd: 'ui', desc: 'Launch terminal UI' },
|
||||
{ cmd: 'workflow run', desc: 'Execute skill pipelines' },
|
||||
{ cmd: 'command generate', desc: 'Create /slash commands' },
|
||||
{ cmd: 'cicd init', desc: 'Generate CI templates' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export function Commands(): React.ReactElement {
|
||||
const [activeGroup, setActiveGroup] = useState(0);
|
||||
const group = COMMAND_GROUPS[activeGroup];
|
||||
|
||||
return (
|
||||
<section className="py-12 border-b border-zinc-800">
|
||||
<div className="mx-auto max-w-5xl px-4 sm:px-6 lg:px-8">
|
||||
<div className="text-center mb-8">
|
||||
<h2 className="text-xl font-bold text-white mb-2 font-mono">30+ Commands</h2>
|
||||
<p className="text-zinc-500 font-mono text-sm">
|
||||
Everything you need from the terminal.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex justify-center gap-2 mb-6">
|
||||
{COMMAND_GROUPS.map((g, i) => {
|
||||
const isActive = i === activeGroup;
|
||||
const buttonClass = isActive
|
||||
? 'border-white text-white bg-zinc-900'
|
||||
: 'border-zinc-800 text-zinc-500 hover:border-zinc-600 hover:text-zinc-300';
|
||||
return (
|
||||
<button
|
||||
key={g.name}
|
||||
onClick={() => setActiveGroup(i)}
|
||||
className={`px-3 py-1.5 text-xs font-mono border transition-colors ${buttonClass}`}
|
||||
>
|
||||
{g.name}
|
||||
</button>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
|
||||
<div className="border border-zinc-800 bg-black/50 p-4 font-mono text-xs">
|
||||
<div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
|
||||
{group.commands.map((c) => (
|
||||
<div
|
||||
key={c.cmd}
|
||||
className="flex items-center gap-3 p-2 hover:bg-zinc-900/50 transition-colors rounded"
|
||||
>
|
||||
<span className="text-zinc-600">$</span>
|
||||
<span className="text-white">skillkit {c.cmd}</span>
|
||||
<span className="text-zinc-600 hidden sm:inline">→</span>
|
||||
<span className="text-zinc-500 hidden sm:inline truncate">{c.desc}</span>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 text-center">
|
||||
<span className="text-zinc-600 text-xs font-mono">
|
||||
Run <span className="text-zinc-400">skillkit --help</span> for all commands
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -9,7 +9,7 @@ interface Feature {
|
||||
const FEATURES: Feature[] = [
|
||||
{
|
||||
title: 'Multi-Agent',
|
||||
description: 'Write once, deploy to 17+ AI coding agents automatically.',
|
||||
description: 'Deploy to 17 AI coding agents with one command.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10" />
|
||||
@@ -17,57 +17,58 @@ const FEATURES: Feature[] = [
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Smart Discovery',
|
||||
description: 'AI analyzes your stack and recommends skills.',
|
||||
title: 'Terminal UI',
|
||||
description: 'Beautiful interactive TUI for browsing & installing.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M8 9l3 3-3 3m5 0h3M5 20h14a2 2 0 002-2V6a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Persistent Memory',
|
||||
description: 'Save learnings as reusable skills.',
|
||||
title: 'Plugins',
|
||||
description: 'Extend with custom plugins & hooks.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 3v2m6-2v2M9 19v2m6-2v2M5 9H3m2 6H3m18-6h-2m2 6h-2M7 19h10a2 2 0 002-2V7a2 2 0 00-2-2H7a2 2 0 00-2 2v10a2 2 0 002 2zM9 9h6v6H9V9z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 14v6m-3-3h6M6 10h2a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2zm10 0h2a2 2 0 002-2V6a2 2 0 00-2-2h-2a2 2 0 00-2 2v2a2 2 0 002 2zM6 20h2a2 2 0 002-2v-2a2 2 0 00-2-2H6a2 2 0 00-2 2v2a2 2 0 002 2z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Team Sync',
|
||||
description: 'Share skills via Git across your team.',
|
||||
title: 'Manifest',
|
||||
description: '.skills file for team-wide consistency.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Testing',
|
||||
description: 'Built-in framework for skill validation.',
|
||||
title: 'CI/CD',
|
||||
description: 'GitHub, GitLab, CircleCI templates included.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
|
||||
</svg>
|
||||
)
|
||||
},
|
||||
{
|
||||
title: 'Workflows',
|
||||
description: 'Compose multi-step automated pipelines.',
|
||||
title: 'Slash Commands',
|
||||
description: 'Generate /commands for Claude, Cursor & more.',
|
||||
icon: (
|
||||
<svg className="w-5 h-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M13 10V3L4 14h7v7l9-11h-7z" />
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={1.5} d="M7 20l4-16m2 16l4-16M6 9h14M4 15h14" />
|
||||
</svg>
|
||||
)
|
||||
}
|
||||
];
|
||||
|
||||
const COMPARISONS = [
|
||||
['Agents', '1', '17+'],
|
||||
['Agents', '1', '17'],
|
||||
['Translation', 'Manual', 'Auto'],
|
||||
['Sharing', 'Copy/paste', 'Git sync'],
|
||||
['Discovery', 'Forums', 'AI-powered'],
|
||||
['Sharing', 'Copy/paste', '.skills manifest'],
|
||||
['Discovery', 'Forums', 'CLI + AI'],
|
||||
['CI/CD', 'Custom', 'Templates'],
|
||||
] as const;
|
||||
|
||||
export function Features(): React.ReactElement {
|
||||
@@ -82,15 +83,15 @@ export function Features(): React.ReactElement {
|
||||
</p>
|
||||
<div className="flex gap-6 sm:gap-8">
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">17+</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">17</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Agents</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">1</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Command</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">30+</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Commands</div>
|
||||
</div>
|
||||
<div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">∞</div>
|
||||
<div className="text-2xl sm:text-3xl font-bold text-white font-mono">15K</div>
|
||||
<div className="text-zinc-600 text-[10px] sm:text-xs font-mono">Skills</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,16 +14,17 @@ interface TerminalLine {
|
||||
}
|
||||
|
||||
const TERMINAL_LINES: TerminalLine[] = [
|
||||
{ type: 'cmd', text: 'skillkit init' },
|
||||
{ type: 'out', text: '→ Next.js + TypeScript detected' },
|
||||
{ type: 'cmd', text: 'skillkit find react' },
|
||||
{ type: 'out', text: ' ■ react-patterns ★★★★★' },
|
||||
{ type: 'out', text: ' ■ react-testing ★★★★☆' },
|
||||
{ type: 'cmd', text: 'skillkit install anthropics/skills' },
|
||||
{ type: 'out', text: '→ Installed 3 skills' },
|
||||
{ type: 'cmd', text: 'skillkit sync --all' },
|
||||
{ type: 'out', text: ' .claude/skills/' },
|
||||
{ type: 'out', text: ' .cursor/skills/' },
|
||||
{ type: 'out', text: ' .windsurf/skills/' },
|
||||
{ type: 'cmd', text: 'skillkit translate --to codex,copilot' },
|
||||
{ type: 'out', text: '→ 2 formats generated' },
|
||||
{ type: 'out', text: '→ 3 skills → 5 agents' },
|
||||
{ type: 'cmd', text: 'skillkit ui' },
|
||||
{ type: 'out', text: '→ Launching TUI...' },
|
||||
{ type: 'cmd', text: 'skillkit check' },
|
||||
{ type: 'out', text: ' ✓ All skills up to date' },
|
||||
{ type: 'cmd', text: 'skillkit manifest install' },
|
||||
{ type: 'out', text: '→ 12 skills from .skills' },
|
||||
];
|
||||
|
||||
const FADE_ANIMATION_STYLES = `
|
||||
@@ -123,7 +124,7 @@ export function Hero(): React.ReactElement {
|
||||
<div className="animate-fade-in">
|
||||
<div className="inline-flex items-center space-x-2 border border-zinc-800 bg-zinc-900/50 px-2 py-0.5 mb-3 backdrop-blur-sm">
|
||||
<span className="flex h-1.5 w-1.5 bg-white rounded-full"></span>
|
||||
<span className="text-xs font-mono text-zinc-400">v1.7.1</span>
|
||||
<span className="text-xs font-mono text-zinc-400">v1.7.5</span>
|
||||
</div>
|
||||
|
||||
<h1 className="text-2xl sm:text-3xl lg:text-4xl font-bold tracking-tight text-white mb-3 font-mono">
|
||||
@@ -132,8 +133,8 @@ export function Hero(): React.ReactElement {
|
||||
</h1>
|
||||
|
||||
<p className="text-sm text-zinc-400 mb-5 max-w-lg font-mono leading-relaxed">
|
||||
Portable, reusable skills that work across Claude Code, Cursor, Codex,
|
||||
Windsurf, GitHub Copilot, and 12 more agents.
|
||||
One CLI to install, sync, and manage skills across Claude Code, Cursor,
|
||||
Windsurf, Copilot, and 13 more agents. 15,000+ skills ready to use.
|
||||
</p>
|
||||
|
||||
<div className="flex flex-wrap items-center gap-3 mb-4">
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,211 @@
|
||||
import { existsSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { findAllSkills, findSkill, detectProvider, isLocalPath } from '@skillkit/core';
|
||||
import { getSearchDirs, loadSkillMetadata } from '../helpers.js';
|
||||
import {
|
||||
colors,
|
||||
symbols,
|
||||
spinner,
|
||||
step,
|
||||
success,
|
||||
warn,
|
||||
header,
|
||||
} from '../onboarding/index.js';
|
||||
|
||||
interface UpdateInfo {
|
||||
name: string;
|
||||
currentVersion?: string;
|
||||
hasUpdate: boolean;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export class CheckCommand extends Command {
|
||||
static override paths = [['check']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Check for available skill updates (dry-run)',
|
||||
details: `
|
||||
Checks if installed skills have updates available from their sources.
|
||||
Does not modify any files - just reports what would be updated.
|
||||
`,
|
||||
examples: [
|
||||
['Check all skills for updates', '$0 check'],
|
||||
['Check specific skills', '$0 check pdf xlsx'],
|
||||
['Show detailed output', '$0 check --verbose'],
|
||||
],
|
||||
});
|
||||
|
||||
skills = Option.Rest();
|
||||
|
||||
verbose = Option.Boolean('--verbose,-v', false, {
|
||||
description: 'Show detailed information',
|
||||
});
|
||||
|
||||
quiet = Option.Boolean('--quiet,-q', false, {
|
||||
description: 'Minimal output',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const searchDirs = getSearchDirs();
|
||||
const s = spinner();
|
||||
|
||||
if (!this.quiet) {
|
||||
header('Check Updates');
|
||||
}
|
||||
|
||||
let skillsToCheck;
|
||||
|
||||
if (this.skills.length > 0) {
|
||||
const foundSkills = this.skills.map(name => ({
|
||||
name,
|
||||
skill: findSkill(name, searchDirs),
|
||||
}));
|
||||
|
||||
skillsToCheck = foundSkills
|
||||
.filter((s): s is { name: string; skill: NonNullable<typeof s.skill> } => s.skill !== null)
|
||||
.map(s => s.skill);
|
||||
|
||||
const notFound = foundSkills.filter(s => s.skill === null).map(s => s.name);
|
||||
if (notFound.length > 0) {
|
||||
warn(`Skills not found: ${notFound.join(', ')}`);
|
||||
}
|
||||
} else {
|
||||
skillsToCheck = findAllSkills(searchDirs);
|
||||
}
|
||||
|
||||
if (skillsToCheck.length === 0) {
|
||||
warn('No skills to check');
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!this.quiet) {
|
||||
step(`Checking ${skillsToCheck.length} skill(s) for updates...`);
|
||||
console.log('');
|
||||
}
|
||||
|
||||
const results: UpdateInfo[] = [];
|
||||
let updatesAvailable = 0;
|
||||
|
||||
for (const skill of skillsToCheck) {
|
||||
const metadata = loadSkillMetadata(skill.path);
|
||||
|
||||
if (!metadata) {
|
||||
results.push({
|
||||
name: skill.name,
|
||||
hasUpdate: false,
|
||||
error: 'No metadata (reinstall needed)',
|
||||
});
|
||||
continue;
|
||||
}
|
||||
|
||||
if (this.verbose) {
|
||||
s.start(`Checking ${skill.name}...`);
|
||||
}
|
||||
|
||||
try {
|
||||
if (isLocalPath(metadata.source)) {
|
||||
const localPath = metadata.subpath
|
||||
? join(metadata.source, metadata.subpath)
|
||||
: metadata.source;
|
||||
|
||||
if (!existsSync(localPath)) {
|
||||
results.push({
|
||||
name: skill.name,
|
||||
hasUpdate: false,
|
||||
error: 'Local source missing',
|
||||
});
|
||||
if (this.verbose) s.stop(`${skill.name}: source missing`);
|
||||
continue;
|
||||
}
|
||||
|
||||
const sourceSkillMd = join(localPath, 'SKILL.md');
|
||||
const installedSkillMd = join(skill.path, 'SKILL.md');
|
||||
|
||||
if (existsSync(sourceSkillMd) && existsSync(installedSkillMd)) {
|
||||
const { statSync } = await import('node:fs');
|
||||
const sourceTime = statSync(sourceSkillMd).mtime;
|
||||
const installedTime = statSync(installedSkillMd).mtime;
|
||||
|
||||
if (sourceTime > installedTime) {
|
||||
results.push({ name: skill.name, hasUpdate: true });
|
||||
updatesAvailable++;
|
||||
if (this.verbose) s.stop(`${skill.name}: update available`);
|
||||
} else {
|
||||
results.push({ name: skill.name, hasUpdate: false });
|
||||
if (this.verbose) s.stop(`${skill.name}: up to date`);
|
||||
}
|
||||
} else {
|
||||
results.push({ name: skill.name, hasUpdate: false });
|
||||
if (this.verbose) s.stop(`${skill.name}: up to date`);
|
||||
}
|
||||
} else {
|
||||
const provider = detectProvider(metadata.source);
|
||||
|
||||
if (!provider) {
|
||||
results.push({
|
||||
name: skill.name,
|
||||
hasUpdate: false,
|
||||
error: 'Unknown provider',
|
||||
});
|
||||
if (this.verbose) s.stop(`${skill.name}: unknown provider`);
|
||||
continue;
|
||||
}
|
||||
|
||||
results.push({
|
||||
name: skill.name,
|
||||
hasUpdate: false,
|
||||
currentVersion: metadata.updatedAt || metadata.installedAt,
|
||||
});
|
||||
if (this.verbose) s.stop(`${skill.name}: remote source (run update to sync)`);
|
||||
}
|
||||
} catch (err) {
|
||||
results.push({
|
||||
name: skill.name,
|
||||
hasUpdate: false,
|
||||
error: err instanceof Error ? err.message : 'Check failed',
|
||||
});
|
||||
if (this.verbose) s.stop(`${skill.name}: error`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
const withUpdates = results.filter(r => r.hasUpdate);
|
||||
const upToDate = results.filter(r => !r.hasUpdate && !r.error);
|
||||
const withErrors = results.filter(r => r.error);
|
||||
|
||||
if (withUpdates.length > 0) {
|
||||
console.log(colors.primary('Updates available:'));
|
||||
for (const r of withUpdates) {
|
||||
console.log(` ${colors.success(symbols.arrowUp)} ${colors.primary(r.name)}`);
|
||||
}
|
||||
console.log('');
|
||||
}
|
||||
|
||||
if (upToDate.length > 0 && this.verbose) {
|
||||
console.log(colors.muted('Up to date:'));
|
||||
for (const r of upToDate) {
|
||||
console.log(` ${colors.muted(symbols.success)} ${colors.muted(r.name)}`);
|
||||
}
|
||||
console.log('');
|
||||
}
|
||||
|
||||
if (withErrors.length > 0) {
|
||||
console.log(colors.warning('Could not check:'));
|
||||
for (const r of withErrors) {
|
||||
console.log(` ${colors.warning(symbols.warning)} ${r.name}: ${colors.muted(r.error || 'unknown')}`);
|
||||
}
|
||||
console.log('');
|
||||
}
|
||||
|
||||
if (updatesAvailable > 0) {
|
||||
success(`${updatesAvailable} update(s) available`);
|
||||
console.log(colors.muted('Run `skillkit update` to install updates'));
|
||||
} else {
|
||||
success('All skills are up to date');
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import {
|
||||
colors,
|
||||
symbols,
|
||||
spinner,
|
||||
step,
|
||||
isCancel,
|
||||
select,
|
||||
header,
|
||||
} from '../onboarding/index.js';
|
||||
|
||||
interface SkillResult {
|
||||
name: string;
|
||||
description?: string;
|
||||
source: string;
|
||||
repoName: string;
|
||||
}
|
||||
|
||||
import skillsData from '../../../../marketplace/skills.json' with { type: 'json' };
|
||||
import sourcesData from '../../../../marketplace/sources.json' with { type: 'json' };
|
||||
|
||||
export class FindCommand extends Command {
|
||||
static override paths = [['find'], ['search']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Search for skills in the marketplace',
|
||||
details: `
|
||||
Quickly find and install skills from the marketplace.
|
||||
Interactive mode lets you browse and install in one step.
|
||||
`,
|
||||
examples: [
|
||||
['Interactive search', '$0 find'],
|
||||
['Search for specific skill', '$0 find pdf'],
|
||||
['Search with keyword', '$0 find "nextjs"'],
|
||||
['List top skills', '$0 find --top'],
|
||||
],
|
||||
});
|
||||
|
||||
query = Option.String({ required: false });
|
||||
|
||||
top = Option.Boolean('--top,-t', false, {
|
||||
description: 'Show top/featured skills',
|
||||
});
|
||||
|
||||
limit = Option.String('--limit,-l', '10', {
|
||||
description: 'Maximum results to show',
|
||||
});
|
||||
|
||||
install = Option.Boolean('--install,-i', false, {
|
||||
description: 'Prompt to install after finding',
|
||||
});
|
||||
|
||||
quiet = Option.Boolean('--quiet,-q', false, {
|
||||
description: 'Minimal output (just list skills)',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const s = spinner();
|
||||
const limit = parseInt(this.limit, 10) || 10;
|
||||
|
||||
if (!this.quiet) {
|
||||
header('Find Skills');
|
||||
}
|
||||
|
||||
const allSkills: SkillResult[] = (skillsData.skills || []).map((skill: { name: string; description?: string; source?: string; repo?: string }) => ({
|
||||
name: skill.name,
|
||||
description: skill.description,
|
||||
source: skill.source || '',
|
||||
repoName: skill.repo || skill.source?.split('/').pop() || '',
|
||||
}));
|
||||
|
||||
let results: SkillResult[];
|
||||
|
||||
if (this.top) {
|
||||
const featured = sourcesData.sources
|
||||
.filter((s: { official?: boolean }) => s.official)
|
||||
.slice(0, 5);
|
||||
|
||||
results = allSkills
|
||||
.filter(skill => featured.some((f: { source: string }) => skill.source.includes(f.source)))
|
||||
.slice(0, limit);
|
||||
|
||||
if (!this.quiet) {
|
||||
step('Showing featured skills');
|
||||
}
|
||||
} else if (this.query) {
|
||||
const query = this.query.toLowerCase();
|
||||
|
||||
s.start('Searching...');
|
||||
|
||||
results = allSkills.filter(skill =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query)
|
||||
).slice(0, limit);
|
||||
|
||||
s.stop(`Found ${results.length} skill(s)`);
|
||||
} else {
|
||||
if (!this.quiet) {
|
||||
step('Enter a search term or browse featured skills');
|
||||
}
|
||||
|
||||
const { text } = await import('../onboarding/prompts.js');
|
||||
|
||||
const searchResult = await text({
|
||||
message: 'Search skills',
|
||||
placeholder: 'e.g., pdf, nextjs, testing',
|
||||
});
|
||||
|
||||
if (isCancel(searchResult)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const query = (searchResult as string).toLowerCase();
|
||||
|
||||
if (query) {
|
||||
s.start('Searching...');
|
||||
results = allSkills.filter(skill =>
|
||||
skill.name.toLowerCase().includes(query) ||
|
||||
skill.description?.toLowerCase().includes(query) ||
|
||||
skill.source.toLowerCase().includes(query) ||
|
||||
skill.repoName.toLowerCase().includes(query)
|
||||
).slice(0, limit);
|
||||
s.stop(`Found ${results.length} skill(s)`);
|
||||
} else {
|
||||
results = allSkills.slice(0, limit);
|
||||
}
|
||||
}
|
||||
|
||||
if (results.length === 0) {
|
||||
console.log(colors.muted('No skills found matching your search'));
|
||||
console.log('');
|
||||
console.log(colors.muted('Try:'));
|
||||
console.log(colors.muted(' skillkit find --top # Show featured skills'));
|
||||
console.log(colors.muted(' skillkit ui # Browse in TUI'));
|
||||
return 0;
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
for (const skill of results) {
|
||||
const desc = skill.description
|
||||
? colors.muted(` - ${skill.description.slice(0, 50)}${skill.description.length > 50 ? '...' : ''}`)
|
||||
: '';
|
||||
console.log(` ${colors.success(symbols.bullet)} ${colors.primary(skill.name)}${desc}`);
|
||||
if (!this.quiet && skill.source) {
|
||||
console.log(` ${colors.muted(skill.source)}`);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log(colors.muted(`Showing ${results.length} of ${allSkills.length} skills`));
|
||||
console.log('');
|
||||
|
||||
if (this.install || (!this.query && !this.top && process.stdin.isTTY)) {
|
||||
const installResult = await select({
|
||||
message: 'Install a skill?',
|
||||
options: [
|
||||
{ value: 'none', label: 'No, just browsing' },
|
||||
...results.slice(0, 5).map(skill => ({
|
||||
value: skill.source,
|
||||
label: skill.name,
|
||||
hint: skill.repoName,
|
||||
})),
|
||||
],
|
||||
initialValue: 'none',
|
||||
});
|
||||
|
||||
if (!isCancel(installResult) && installResult !== 'none') {
|
||||
console.log('');
|
||||
console.log(colors.cyan('To install, run:'));
|
||||
console.log(` ${colors.bold(`skillkit install ${installResult}`)}`);
|
||||
}
|
||||
} else {
|
||||
console.log(colors.muted('To install: skillkit install <source>'));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -41,3 +41,14 @@ export {
|
||||
AgentSyncCommand,
|
||||
AgentValidateCommand,
|
||||
} from './agent.js';
|
||||
|
||||
export { CheckCommand } from './check.js';
|
||||
export { FindCommand } from './find.js';
|
||||
export {
|
||||
ManifestCommand,
|
||||
ManifestInitCommand,
|
||||
ManifestAddCommand,
|
||||
ManifestRemoveCommand,
|
||||
ManifestInstallCommand,
|
||||
ManifestGenerateCommand,
|
||||
} from './manifest.js';
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
getAgentIcon,
|
||||
isCancel,
|
||||
spinner,
|
||||
agentMultiselect,
|
||||
quickAgentSelect,
|
||||
skillMultiselect,
|
||||
selectInstallMethod,
|
||||
confirm,
|
||||
@@ -197,20 +197,15 @@ export class InstallCommand extends Command {
|
||||
// Explicitly specified agents
|
||||
targetAgents = this.agent as AgentType[];
|
||||
} else if (isInteractive) {
|
||||
// Interactive agent selection
|
||||
const allAgentTypes = getAllAdapters().map(a => a.type);
|
||||
const detectedAgent = await detectAgent();
|
||||
|
||||
// Get last selected agents or use detected
|
||||
const lastAgents = getLastAgents();
|
||||
const initialAgents = lastAgents.length > 0
|
||||
? lastAgents.filter(a => allAgentTypes.includes(a as AgentType))
|
||||
: [detectedAgent];
|
||||
|
||||
const agentResult = await agentMultiselect({
|
||||
message: 'Install to which agents?',
|
||||
step(`Detected ${allAgentTypes.length} agents`);
|
||||
|
||||
const agentResult = await quickAgentSelect({
|
||||
message: 'Install to',
|
||||
agents: allAgentTypes,
|
||||
initialValues: initialAgents,
|
||||
lastSelected: lastAgents,
|
||||
});
|
||||
|
||||
if (isCancel(agentResult)) {
|
||||
@@ -218,7 +213,7 @@ export class InstallCommand extends Command {
|
||||
return 0;
|
||||
}
|
||||
|
||||
targetAgents = agentResult as AgentType[];
|
||||
targetAgents = (agentResult as { agents: string[] }).agents as AgentType[];
|
||||
|
||||
// Save selection for next time
|
||||
saveLastAgents(targetAgents);
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import {
|
||||
loadManifest,
|
||||
saveManifest,
|
||||
initManifest,
|
||||
addToManifest,
|
||||
removeFromManifest,
|
||||
findManifestPath,
|
||||
generateManifestFromInstalled,
|
||||
findAllSkills,
|
||||
} from '@skillkit/core';
|
||||
import { getSearchDirs, loadSkillMetadata } from '../helpers.js';
|
||||
import {
|
||||
colors,
|
||||
symbols,
|
||||
spinner,
|
||||
step,
|
||||
success,
|
||||
warn,
|
||||
error,
|
||||
header,
|
||||
confirm,
|
||||
isCancel,
|
||||
} from '../onboarding/index.js';
|
||||
|
||||
export class ManifestCommand extends Command {
|
||||
static override paths = [['manifest']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Manage .skills manifest file',
|
||||
details: `
|
||||
The .skills manifest file allows declarative skill management.
|
||||
Commit this file to version control to share skill configurations.
|
||||
`,
|
||||
examples: [
|
||||
['Show current manifest', '$0 manifest'],
|
||||
['Initialize manifest', '$0 manifest init'],
|
||||
['Add skill to manifest', '$0 manifest add owner/repo'],
|
||||
['Remove skill from manifest', '$0 manifest remove owner/repo'],
|
||||
['Install from manifest', '$0 manifest install'],
|
||||
['Generate from installed', '$0 manifest generate'],
|
||||
],
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const manifestPath = findManifestPath();
|
||||
|
||||
if (!manifestPath) {
|
||||
warn('No .skills manifest found');
|
||||
console.log('');
|
||||
console.log(colors.muted('Create one with:'));
|
||||
console.log(` ${colors.cyan('skillkit manifest init')}`);
|
||||
console.log('');
|
||||
console.log(colors.muted('Or generate from installed skills:'));
|
||||
console.log(` ${colors.cyan('skillkit manifest generate')}`);
|
||||
return 0;
|
||||
}
|
||||
|
||||
const manifest = loadManifest(manifestPath);
|
||||
|
||||
if (!manifest) {
|
||||
error('Failed to load manifest');
|
||||
return 1;
|
||||
}
|
||||
|
||||
header('.skills Manifest');
|
||||
console.log(colors.muted(`Path: ${manifestPath}`));
|
||||
console.log('');
|
||||
|
||||
if (manifest.skills.length === 0) {
|
||||
console.log(colors.muted('No skills defined'));
|
||||
} else {
|
||||
console.log(colors.primary('Skills:'));
|
||||
for (const skill of manifest.skills) {
|
||||
const status = skill.enabled === false ? colors.muted('(disabled)') : '';
|
||||
console.log(` ${colors.success(symbols.bullet)} ${skill.source} ${status}`);
|
||||
if (skill.skills) {
|
||||
console.log(` ${colors.muted(`Skills: ${skill.skills.join(', ')}`)}`);
|
||||
}
|
||||
if (skill.agents) {
|
||||
console.log(` ${colors.muted(`Agents: ${skill.agents.join(', ')}`)}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
console.log('');
|
||||
|
||||
if (manifest.agents) {
|
||||
console.log(`${colors.muted('Default agents:')} ${manifest.agents.join(', ')}`);
|
||||
}
|
||||
|
||||
if (manifest.installMethod) {
|
||||
console.log(`${colors.muted('Install method:')} ${manifest.installMethod}`);
|
||||
}
|
||||
|
||||
if (manifest.updatedAt) {
|
||||
console.log(`${colors.muted('Updated:')} ${manifest.updatedAt}`);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log(colors.muted('Commands: init, add, remove, install, generate'));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManifestInitCommand extends Command {
|
||||
static override paths = [['manifest', 'init']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Initialize a new .skills manifest',
|
||||
});
|
||||
|
||||
force = Option.Boolean('--force,-f', false, {
|
||||
description: 'Overwrite existing manifest',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const existingPath = findManifestPath();
|
||||
|
||||
if (existingPath && !this.force) {
|
||||
warn(`Manifest already exists: ${existingPath}`);
|
||||
console.log(colors.muted('Use --force to overwrite'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
initManifest();
|
||||
success('Created .skills manifest');
|
||||
console.log('');
|
||||
console.log(colors.muted('Add skills with:'));
|
||||
console.log(` ${colors.cyan('skillkit manifest add owner/repo')}`);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManifestAddCommand extends Command {
|
||||
static override paths = [['manifest', 'add']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Add a skill source to the manifest',
|
||||
});
|
||||
|
||||
source = Option.String({ required: true });
|
||||
|
||||
skills = Option.String('--skills,-s', {
|
||||
description: 'Specific skills to include (comma-separated)',
|
||||
});
|
||||
|
||||
agents = Option.String('--agents,-a', {
|
||||
description: 'Target agents (comma-separated)',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const options: { skills?: string[]; agents?: string[] } = {};
|
||||
|
||||
if (this.skills) {
|
||||
options.skills = this.skills.split(',').map(s => s.trim());
|
||||
}
|
||||
|
||||
if (this.agents) {
|
||||
options.agents = this.agents.split(',').map(s => s.trim());
|
||||
}
|
||||
|
||||
addToManifest(this.source, options);
|
||||
success(`Added ${this.source} to manifest`);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManifestRemoveCommand extends Command {
|
||||
static override paths = [['manifest', 'remove']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Remove a skill source from the manifest',
|
||||
});
|
||||
|
||||
source = Option.String({ required: true });
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const result = removeFromManifest(this.source);
|
||||
|
||||
if (!result) {
|
||||
error('No manifest found');
|
||||
return 1;
|
||||
}
|
||||
|
||||
success(`Removed ${this.source} from manifest`);
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManifestInstallCommand extends Command {
|
||||
static override paths = [['manifest', 'install']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Install all skills defined in the manifest',
|
||||
});
|
||||
|
||||
yes = Option.Boolean('--yes,-y', false, {
|
||||
description: 'Skip confirmation',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const manifest = loadManifest();
|
||||
|
||||
if (!manifest) {
|
||||
error('No .skills manifest found');
|
||||
console.log(colors.muted('Create one with: skillkit manifest init'));
|
||||
return 1;
|
||||
}
|
||||
|
||||
const enabledSkills = manifest.skills.filter(s => s.enabled !== false);
|
||||
|
||||
if (enabledSkills.length === 0) {
|
||||
warn('No skills to install');
|
||||
return 0;
|
||||
}
|
||||
|
||||
header('Install from Manifest');
|
||||
|
||||
console.log(`Installing ${enabledSkills.length} source(s):`);
|
||||
for (const skill of enabledSkills) {
|
||||
console.log(` ${colors.success(symbols.bullet)} ${skill.source}`);
|
||||
}
|
||||
console.log('');
|
||||
|
||||
if (!this.yes && process.stdin.isTTY) {
|
||||
const confirmResult = await confirm({
|
||||
message: 'Proceed with installation?',
|
||||
initialValue: true,
|
||||
});
|
||||
|
||||
if (isCancel(confirmResult) || !confirmResult) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const s = spinner();
|
||||
|
||||
for (const skill of enabledSkills) {
|
||||
s.start(`Installing ${skill.source}...`);
|
||||
|
||||
try {
|
||||
const args = ['install', skill.source];
|
||||
|
||||
if (skill.skills) {
|
||||
args.push('--skills', skill.skills.join(','));
|
||||
}
|
||||
|
||||
if (skill.agents || manifest.agents) {
|
||||
const agents = skill.agents || manifest.agents || [];
|
||||
for (const agent of agents) {
|
||||
args.push('--agent', agent);
|
||||
}
|
||||
}
|
||||
|
||||
args.push('--yes');
|
||||
|
||||
const { execFileSync } = await import('node:child_process');
|
||||
execFileSync('skillkit', args, {
|
||||
stdio: 'pipe',
|
||||
encoding: 'utf-8',
|
||||
});
|
||||
|
||||
s.stop(`Installed ${skill.source}`);
|
||||
} catch (err) {
|
||||
s.stop(colors.error(`Failed: ${skill.source}`));
|
||||
if (err instanceof Error) {
|
||||
console.log(colors.muted(err.message));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
success('Manifest installation complete');
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
export class ManifestGenerateCommand extends Command {
|
||||
static override paths = [['manifest', 'generate']];
|
||||
|
||||
static override usage = Command.Usage({
|
||||
description: 'Generate manifest from currently installed skills',
|
||||
});
|
||||
|
||||
output = Option.String('--output,-o', {
|
||||
description: 'Output file path (default: .skills)',
|
||||
});
|
||||
|
||||
async execute(): Promise<number> {
|
||||
const searchDirs = getSearchDirs();
|
||||
const installedSkills = findAllSkills(searchDirs);
|
||||
|
||||
if (installedSkills.length === 0) {
|
||||
warn('No installed skills found');
|
||||
return 0;
|
||||
}
|
||||
|
||||
step(`Found ${installedSkills.length} installed skill(s)`);
|
||||
|
||||
const skillsWithMeta = installedSkills.map(skill => {
|
||||
const metadata = loadSkillMetadata(skill.path);
|
||||
return {
|
||||
name: skill.name,
|
||||
source: metadata?.source || '',
|
||||
};
|
||||
}).filter(s => s.source);
|
||||
|
||||
const manifest = generateManifestFromInstalled(skillsWithMeta);
|
||||
|
||||
const outputPath = this.output || '.skills';
|
||||
saveManifest(manifest, outputPath);
|
||||
|
||||
success(`Generated ${outputPath} with ${manifest.skills.length} source(s)`);
|
||||
|
||||
console.log('');
|
||||
console.log(colors.muted('Commit this file to share skill configuration with your team.'));
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@ export {
|
||||
confirm,
|
||||
select,
|
||||
agentMultiselect,
|
||||
quickAgentSelect,
|
||||
skillMultiselect,
|
||||
groupMultiselect,
|
||||
stepTrail,
|
||||
@@ -83,7 +84,7 @@ import {
|
||||
getLastAgents,
|
||||
} from './preferences.js';
|
||||
|
||||
let VERSION = '1.7.5';
|
||||
let VERSION = '1.7.6';
|
||||
let AGENT_COUNT = 17;
|
||||
|
||||
export function setVersion(version: string): void {
|
||||
|
||||
@@ -113,6 +113,72 @@ export async function agentMultiselect(options: {
|
||||
});
|
||||
}
|
||||
|
||||
export async function quickAgentSelect(options: {
|
||||
message?: string;
|
||||
agents: string[];
|
||||
lastSelected?: string[];
|
||||
}): Promise<{ agents: string[]; method: 'last' | 'all' | 'select' } | symbol> {
|
||||
const { agents, lastSelected = [] } = options;
|
||||
const hasLast = lastSelected.length > 0 && lastSelected.some(a => agents.includes(a));
|
||||
|
||||
const selectOptions: Array<{ value: string; label: string; hint?: string }> = [];
|
||||
|
||||
if (hasLast) {
|
||||
const validLast = lastSelected.filter(a => agents.includes(a));
|
||||
const agentList = validLast.slice(0, 3).map(formatAgent).join(', ');
|
||||
const more = validLast.length > 3 ? ` +${validLast.length - 3}` : '';
|
||||
|
||||
selectOptions.push({
|
||||
value: 'last',
|
||||
label: `Same as last time (Recommended)`,
|
||||
hint: `${agentList}${more}`,
|
||||
});
|
||||
}
|
||||
|
||||
selectOptions.push({
|
||||
value: 'all',
|
||||
label: 'All detected agents',
|
||||
hint: `${agents.length} agent${agents.length !== 1 ? 's' : ''}`,
|
||||
});
|
||||
|
||||
selectOptions.push({
|
||||
value: 'select',
|
||||
label: 'Select specific agents',
|
||||
hint: 'Choose manually',
|
||||
});
|
||||
|
||||
const result = await clack.select({
|
||||
message: options.message || 'Install to',
|
||||
options: selectOptions,
|
||||
});
|
||||
|
||||
if (clack.isCancel(result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
const method = result as 'last' | 'all' | 'select';
|
||||
|
||||
if (method === 'last') {
|
||||
return { agents: lastSelected.filter(a => agents.includes(a)), method };
|
||||
}
|
||||
|
||||
if (method === 'all') {
|
||||
return { agents, method };
|
||||
}
|
||||
|
||||
const selected = await agentMultiselect({
|
||||
message: 'Select agents',
|
||||
agents,
|
||||
initialValues: lastSelected.length > 0 ? lastSelected : agents,
|
||||
});
|
||||
|
||||
if (clack.isCancel(selected)) {
|
||||
return selected;
|
||||
}
|
||||
|
||||
return { agents: selected as string[], method };
|
||||
}
|
||||
|
||||
export interface SkillOption {
|
||||
name: string;
|
||||
description?: string;
|
||||
|
||||
@@ -48,6 +48,7 @@ export const symbols = {
|
||||
selected: '\u25cf',
|
||||
unselected: '\u25cb',
|
||||
pointer: '\u25b8',
|
||||
bullet: '\u25cf',
|
||||
progressFull: '\u2588',
|
||||
progressEmpty: '\u2591',
|
||||
success: '\u2713',
|
||||
@@ -56,6 +57,8 @@ export const symbols = {
|
||||
info: '\u2139',
|
||||
arrowRight: '\u2192',
|
||||
arrowLeft: '\u2190',
|
||||
arrowUp: '\u2191',
|
||||
arrowDown: '\u2193',
|
||||
diamondOpen: '\u25c7',
|
||||
diamondFilled: '\u25c6',
|
||||
horizontalLine: '\u2500',
|
||||
|
||||
@@ -73,5 +73,5 @@ export * from './audit/index.js';
|
||||
// Custom Agents Support (Phase 19)
|
||||
export * from './agents/index.js';
|
||||
|
||||
// Skill Translator (Phase 20 - Cross-Agent Skill Translation)
|
||||
export * from './skill-translator.js';
|
||||
export * from './manifest/index.js';
|
||||
|
||||
@@ -0,0 +1,206 @@
|
||||
import { readFileSync, writeFileSync, existsSync } from 'node:fs';
|
||||
import { join, dirname } from 'node:path';
|
||||
import { parse as parseYaml, stringify as stringifyYaml } from 'yaml';
|
||||
|
||||
export interface SkillEntry {
|
||||
source: string;
|
||||
skills?: string[];
|
||||
agents?: string[];
|
||||
enabled?: boolean;
|
||||
}
|
||||
|
||||
export interface SkillsManifest {
|
||||
version: number;
|
||||
skills: SkillEntry[];
|
||||
agents?: string[];
|
||||
installMethod?: 'symlink' | 'copy';
|
||||
updatedAt?: string;
|
||||
}
|
||||
|
||||
const MANIFEST_FILENAMES = ['.skills', '.skills.yaml', '.skills.yml', 'skills.yaml'];
|
||||
|
||||
export function findManifestPath(startDir: string = process.cwd()): string | null {
|
||||
let dir = startDir;
|
||||
|
||||
while (dir !== dirname(dir)) {
|
||||
for (const filename of MANIFEST_FILENAMES) {
|
||||
const manifestPath = join(dir, filename);
|
||||
if (existsSync(manifestPath)) {
|
||||
return manifestPath;
|
||||
}
|
||||
}
|
||||
dir = dirname(dir);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function loadManifest(manifestPath?: string): SkillsManifest | null {
|
||||
const path = manifestPath || findManifestPath();
|
||||
|
||||
if (!path || !existsSync(path)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
try {
|
||||
const content = readFileSync(path, 'utf-8');
|
||||
const parsed = parseYaml(content) as SkillsManifest;
|
||||
|
||||
if (!parsed || typeof parsed !== 'object') {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
version: parsed.version || 1,
|
||||
skills: normalizeSkills(parsed.skills || []),
|
||||
agents: parsed.agents,
|
||||
installMethod: parsed.installMethod,
|
||||
updatedAt: parsed.updatedAt,
|
||||
};
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeSkills(skills: unknown[]): SkillEntry[] {
|
||||
return skills.map(skill => {
|
||||
if (typeof skill === 'string') {
|
||||
const parts = skill.split('/');
|
||||
if (parts.length >= 3) {
|
||||
return {
|
||||
source: `${parts[0]}/${parts[1]}`,
|
||||
skills: [parts.slice(2).join('/')],
|
||||
enabled: true,
|
||||
};
|
||||
}
|
||||
return { source: skill, enabled: true };
|
||||
}
|
||||
|
||||
if (typeof skill === 'object' && skill !== null) {
|
||||
const entry = skill as Record<string, unknown>;
|
||||
return {
|
||||
source: String(entry.source || ''),
|
||||
skills: entry.skills as string[] | undefined,
|
||||
agents: entry.agents as string[] | undefined,
|
||||
enabled: entry.enabled !== false,
|
||||
};
|
||||
}
|
||||
|
||||
return { source: '', enabled: false };
|
||||
}).filter(s => s.source);
|
||||
}
|
||||
|
||||
export function saveManifest(manifest: SkillsManifest, manifestPath?: string): void {
|
||||
const path = manifestPath || join(process.cwd(), '.skills');
|
||||
|
||||
const content = stringifyYaml({
|
||||
version: manifest.version || 1,
|
||||
skills: manifest.skills.map(s => {
|
||||
if (!s.skills && !s.agents && s.enabled !== false) {
|
||||
return s.source;
|
||||
}
|
||||
return s;
|
||||
}),
|
||||
...(manifest.agents && { agents: manifest.agents }),
|
||||
...(manifest.installMethod && { installMethod: manifest.installMethod }),
|
||||
updatedAt: new Date().toISOString(),
|
||||
});
|
||||
|
||||
writeFileSync(path, content, 'utf-8');
|
||||
}
|
||||
|
||||
export function addToManifest(
|
||||
source: string,
|
||||
options?: { skills?: string[]; agents?: string[] },
|
||||
manifestPath?: string
|
||||
): SkillsManifest {
|
||||
const existing = loadManifest(manifestPath) || {
|
||||
version: 1,
|
||||
skills: [],
|
||||
};
|
||||
|
||||
const existingIndex = existing.skills.findIndex(s => s.source === source);
|
||||
|
||||
if (existingIndex >= 0) {
|
||||
existing.skills[existingIndex] = {
|
||||
...existing.skills[existingIndex],
|
||||
...options,
|
||||
enabled: true,
|
||||
};
|
||||
} else {
|
||||
existing.skills.push({
|
||||
source,
|
||||
...options,
|
||||
enabled: true,
|
||||
});
|
||||
}
|
||||
|
||||
saveManifest(existing, manifestPath);
|
||||
return existing;
|
||||
}
|
||||
|
||||
export function removeFromManifest(source: string, manifestPath?: string): SkillsManifest | null {
|
||||
const existing = loadManifest(manifestPath);
|
||||
|
||||
if (!existing) {
|
||||
return null;
|
||||
}
|
||||
|
||||
existing.skills = existing.skills.filter(s => s.source !== source);
|
||||
saveManifest(existing, manifestPath);
|
||||
return existing;
|
||||
}
|
||||
|
||||
export function initManifest(options?: {
|
||||
agents?: string[];
|
||||
installMethod?: 'symlink' | 'copy';
|
||||
}, manifestPath?: string): SkillsManifest {
|
||||
const manifest: SkillsManifest = {
|
||||
version: 1,
|
||||
skills: [],
|
||||
...options,
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
|
||||
saveManifest(manifest, manifestPath);
|
||||
return manifest;
|
||||
}
|
||||
|
||||
export function generateManifestFromInstalled(
|
||||
installedSkills: Array<{ name: string; source: string; agents?: string[] }>
|
||||
): SkillsManifest {
|
||||
const skillsBySource = new Map<string, { skills: string[]; agents: Set<string> }>();
|
||||
|
||||
for (const skill of installedSkills) {
|
||||
if (!skill.source) continue;
|
||||
|
||||
const existing = skillsBySource.get(skill.source);
|
||||
if (existing) {
|
||||
existing.skills.push(skill.name);
|
||||
if (skill.agents) {
|
||||
skill.agents.forEach(a => existing.agents.add(a));
|
||||
}
|
||||
} else {
|
||||
skillsBySource.set(skill.source, {
|
||||
skills: [skill.name],
|
||||
agents: new Set(skill.agents || []),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const skills: SkillEntry[] = [];
|
||||
for (const [source, data] of skillsBySource) {
|
||||
skills.push({
|
||||
source,
|
||||
skills: data.skills.length > 0 ? data.skills : undefined,
|
||||
agents: data.agents.size > 0 ? Array.from(data.agents) : undefined,
|
||||
enabled: true,
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
version: 1,
|
||||
skills,
|
||||
updatedAt: new Date().toISOString(),
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user