Files
skillkit/packages/cli/src/commands/remove.ts
T
Rohit Ghumare 160d2b1534 feat: add TUI enhancements and monorepo structure (#2)
* feat: add TUI enhancements and monorepo structure

- Add Translate screen for cross-agent skill translation
- Add Context screen for project context management
- Add Recommend screen with smart skill recommendations
- Fix TUI screen duplication by using fixed height container
- Clean up unnecessary comments following code-simplifier principles
- Refactor to monorepo structure with @skillkit/core, @skillkit/cli,
  @skillkit/tui, and @skillkit/agents packages
- Add comprehensive tests for translator, context, and recommend features
- Update license to Apache-2.0
- Add CONTRIBUTING.md with contribution guidelines

* ci: switch from npm to pnpm for monorepo support

* ci: use pnpm version from package.json

* fix: remove unused import in TUI helpers
2026-01-23 09:41:15 +00:00

61 lines
1.7 KiB
TypeScript

import { existsSync, rmSync } from 'node:fs';
import chalk from 'chalk';
import { Command, Option } from 'clipanion';
import { findSkill } from '@skillkit/core';
import { getSearchDirs } from '../helpers.js';
export class RemoveCommand extends Command {
static override paths = [['remove'], ['rm'], ['uninstall']];
static override usage = Command.Usage({
description: 'Remove installed skills',
examples: [
['Remove a skill', '$0 remove pdf'],
['Remove multiple skills', '$0 remove pdf xlsx docx'],
['Force removal without confirmation', '$0 remove pdf --force'],
],
});
skills = Option.Rest({ required: 1 });
force = Option.Boolean('--force,-f', false, {
description: 'Skip confirmation',
});
async execute(): Promise<number> {
const searchDirs = getSearchDirs();
let removed = 0;
let failed = 0;
for (const skillName of this.skills) {
const skill = findSkill(skillName, searchDirs);
if (!skill) {
console.log(chalk.yellow(`Skill not found: ${skillName}`));
continue;
}
if (!existsSync(skill.path)) {
console.log(chalk.yellow(`Path not found: ${skill.path}`));
continue;
}
try {
rmSync(skill.path, { recursive: true, force: true });
console.log(chalk.green(`Removed: ${skillName}`));
removed++;
} catch (error) {
console.log(chalk.red(`Failed to remove: ${skillName}`));
console.error(chalk.dim(error instanceof Error ? error.message : String(error)));
failed++;
}
}
if (removed > 0) {
console.log(chalk.dim('\nRun `skillkit sync` to update your agent config'));
}
return failed > 0 ? 1 : 0;
}
}