mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-20 12:23:29 +00:00
* 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
107 lines
2.6 KiB
TypeScript
107 lines
2.6 KiB
TypeScript
import chalk from 'chalk';
|
|
import { Command, Option } from 'clipanion';
|
|
import { setSkillEnabled, findSkill } from '@skillkit/core';
|
|
import { getSearchDirs } from '../helpers.js';
|
|
|
|
export class EnableCommand extends Command {
|
|
static override paths = [['enable']];
|
|
|
|
static override usage = Command.Usage({
|
|
description: 'Enable one or more skills',
|
|
examples: [
|
|
['Enable a skill', '$0 enable pdf'],
|
|
['Enable multiple skills', '$0 enable pdf xlsx docx'],
|
|
],
|
|
});
|
|
|
|
skills = Option.Rest({ required: 1 });
|
|
|
|
async execute(): Promise<number> {
|
|
const searchDirs = getSearchDirs();
|
|
let success = 0;
|
|
let failed = 0;
|
|
|
|
for (const skillName of this.skills) {
|
|
const skill = findSkill(skillName, searchDirs);
|
|
|
|
if (!skill) {
|
|
console.log(chalk.red(`Skill not found: ${skillName}`));
|
|
failed++;
|
|
continue;
|
|
}
|
|
|
|
if (skill.enabled) {
|
|
console.log(chalk.dim(`Already enabled: ${skillName}`));
|
|
continue;
|
|
}
|
|
|
|
const result = setSkillEnabled(skill.path, true);
|
|
|
|
if (result) {
|
|
console.log(chalk.green(`Enabled: ${skillName}`));
|
|
success++;
|
|
} else {
|
|
console.log(chalk.red(`Failed to enable: ${skillName}`));
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
if (success > 0) {
|
|
console.log(chalk.dim('\nRun `skillkit sync` to update your agent config'));
|
|
}
|
|
|
|
return failed > 0 ? 1 : 0;
|
|
}
|
|
}
|
|
|
|
export class DisableCommand extends Command {
|
|
static override paths = [['disable']];
|
|
|
|
static override usage = Command.Usage({
|
|
description: 'Disable one or more skills',
|
|
examples: [
|
|
['Disable a skill', '$0 disable pdf'],
|
|
['Disable multiple skills', '$0 disable pdf xlsx docx'],
|
|
],
|
|
});
|
|
|
|
skills = Option.Rest({ required: 1 });
|
|
|
|
async execute(): Promise<number> {
|
|
const searchDirs = getSearchDirs();
|
|
let success = 0;
|
|
let failed = 0;
|
|
|
|
for (const skillName of this.skills) {
|
|
const skill = findSkill(skillName, searchDirs);
|
|
|
|
if (!skill) {
|
|
console.log(chalk.red(`Skill not found: ${skillName}`));
|
|
failed++;
|
|
continue;
|
|
}
|
|
|
|
if (!skill.enabled) {
|
|
console.log(chalk.dim(`Already disabled: ${skillName}`));
|
|
continue;
|
|
}
|
|
|
|
const result = setSkillEnabled(skill.path, false);
|
|
|
|
if (result) {
|
|
console.log(chalk.yellow(`Disabled: ${skillName}`));
|
|
success++;
|
|
} else {
|
|
console.log(chalk.red(`Failed to disable: ${skillName}`));
|
|
failed++;
|
|
}
|
|
}
|
|
|
|
if (success > 0) {
|
|
console.log(chalk.dim('\nRun `skillkit sync` to update your agent config'));
|
|
}
|
|
|
|
return failed > 0 ? 1 : 0;
|
|
}
|
|
}
|