Files
skillkit/packages/cli/src/commands/check.ts
T
Rohit Ghumare b559a2acbf 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
2026-01-28 10:47:02 +00:00

212 lines
6.1 KiB
TypeScript

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;
}
}