mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-20 12:23:29 +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:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user