mirror of
https://github.com/rohitg00/skillkit.git
synced 2026-11-18 18:04:26 +00:00
feat: add loading spinners to translate, sync, eval, publish, and scan commands (#88)
This commit is contained in:
@@ -12,6 +12,7 @@ import {
|
||||
CommunitySignalsEvaluator,
|
||||
} from '@skillkit/core';
|
||||
import type { EvalTier, EvalOptions } from '@skillkit/core';
|
||||
import { spinner } from '../onboarding/index.js';
|
||||
|
||||
export class EvalCommand extends Command {
|
||||
static override paths = [['eval']];
|
||||
@@ -132,7 +133,10 @@ export class EvalCommand extends Command {
|
||||
engine.registerEvaluator(new DynamicBenchmarkEvaluator());
|
||||
engine.registerEvaluator(new CommunitySignalsEvaluator());
|
||||
|
||||
const s = spinner();
|
||||
s.start('Evaluating skill...');
|
||||
const result = await engine.evaluate(targetPath, options);
|
||||
s.stop(`Evaluation complete (score: ${result.overallScore})`);
|
||||
|
||||
this.context.stdout.write(formatEvalResult(result, this.format) + '\n');
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
success,
|
||||
error,
|
||||
step,
|
||||
spinner,
|
||||
formatQualityBadge,
|
||||
getQualityGradeFromScore,
|
||||
} from "../onboarding/index.js";
|
||||
@@ -146,10 +147,13 @@ export class PublishCommand extends Command {
|
||||
const basePath = this.skillPath || process.cwd();
|
||||
const outputDir = this.output || basePath;
|
||||
|
||||
step("Generating well-known skills structure...\n");
|
||||
const s = spinner();
|
||||
s.start("Generating well-known skills structure...");
|
||||
|
||||
const discoveredSkills = this.discoverSkills(basePath);
|
||||
|
||||
s.stop(`Discovered ${discoveredSkills.length} skill(s)`);
|
||||
|
||||
if (discoveredSkills.length === 0) {
|
||||
error("No skills found");
|
||||
console.error(
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Command, Option } from 'clipanion';
|
||||
import { resolve } from 'node:path';
|
||||
import { existsSync } from 'node:fs';
|
||||
import { SkillScanner, formatResult, Severity } from '@skillkit/core';
|
||||
import { error } from '../onboarding/index.js';
|
||||
import { error, spinner } from '../onboarding/index.js';
|
||||
|
||||
const SEVERITY_MAP: Record<string, Severity> = {
|
||||
critical: Severity.CRITICAL,
|
||||
@@ -81,7 +81,10 @@ export class ScanCommand extends Command {
|
||||
skipRules,
|
||||
});
|
||||
|
||||
const s = spinner();
|
||||
if (!this.json) s.start('Scanning for vulnerabilities...');
|
||||
const result = await scanner.scan(targetPath);
|
||||
if (!this.json) s.stop(`Scan complete (${result.findings.length} finding(s))`);
|
||||
|
||||
if (this.json) {
|
||||
this.context.stdout.write(formatResult(result, 'json') + '\n');
|
||||
|
||||
@@ -91,8 +91,9 @@ export class SyncCommand extends Command {
|
||||
|
||||
agentType = agentResult as AgentType;
|
||||
} else {
|
||||
// Non-interactive: always detect, don't rely on default config
|
||||
s.start('Detecting agent...');
|
||||
agentType = await detectAgent();
|
||||
s.stop(`Detected: ${formatAgent(agentType)}`);
|
||||
}
|
||||
|
||||
const adapter = getAdapter(agentType);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { Command, Option } from 'clipanion';
|
||||
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
||||
import { join, basename, dirname } from 'node:path';
|
||||
import { colors, warn, success, error } from '../onboarding/index.js';
|
||||
import { colors, warn, success, error, spinner } from '../onboarding/index.js';
|
||||
import {
|
||||
type AgentType,
|
||||
translateSkill,
|
||||
@@ -226,6 +226,7 @@ export class TranslateCommand extends Command {
|
||||
|
||||
let successCount = 0;
|
||||
let failed = 0;
|
||||
const s = spinner();
|
||||
|
||||
for (const skill of skills) {
|
||||
const skillMdPath = join(skill.path, 'SKILL.md');
|
||||
@@ -235,10 +236,14 @@ export class TranslateCommand extends Command {
|
||||
continue;
|
||||
}
|
||||
|
||||
s.start(`Translating ${skill.name}...`);
|
||||
|
||||
const result = translateSkillFile(skillMdPath, targetAgent, {
|
||||
addMetadata: this.metadata,
|
||||
});
|
||||
|
||||
s.stop(`Translated ${skill.name}`);
|
||||
|
||||
if (result.success) {
|
||||
if (this.dryRun) {
|
||||
success(` ✓ ${skill.name} → ${result.filename} (dry run)`);
|
||||
@@ -332,12 +337,17 @@ export class TranslateCommand extends Command {
|
||||
}
|
||||
|
||||
// Read and translate
|
||||
const s = spinner();
|
||||
s.start(`Translating to ${targetAgent}...`);
|
||||
|
||||
const content = readFileSync(sourcePath!, 'utf-8');
|
||||
const result = translateSkill(content, targetAgent, {
|
||||
addMetadata: this.metadata,
|
||||
sourceFilename: basename(sourcePath!),
|
||||
});
|
||||
|
||||
s.stop(`Translation complete`);
|
||||
|
||||
if (!result.success) {
|
||||
error('Translation failed:');
|
||||
for (const item of result.incompatible) {
|
||||
|
||||
Reference in New Issue
Block a user