Revert "feat: single source of truth for skills marketplace"

This reverts commit 0c5eb93891.
This commit is contained in:
Rohit Ghumare
2026-01-26 23:15:14 +00:00
parent 0c5eb93891
commit 6d36a4a3f7
32 changed files with 1625 additions and 125948 deletions
-1
View File
@@ -31,7 +31,6 @@ export { PlanCommand } from './plan.js';
export { CommandCmd } from './command.js';
export { AICommand } from './ai.js';
export { AuditCommand } from './audit.js';
export { PublishCommand } from './publish.js';
export {
AgentCommand,
AgentListCommand,
-46
View File
@@ -1,6 +1,3 @@
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { createInterface } from 'node:readline';
import chalk from 'chalk';
import { Command, Option } from 'clipanion';
import type { AgentType } from '@skillkit/core';
@@ -72,9 +69,6 @@ export class InitCommand extends Command {
console.log(chalk.dim(' 2. Sync config: skillkit sync'));
console.log(chalk.dim(' 3. Use skills: skillkit read <skill-name>'));
// Check if SKILL.md exists and offer to publish
await this.checkAndPromptPublish();
return 0;
} catch (error) {
console.error(chalk.red('Initialization failed'));
@@ -82,44 +76,4 @@ export class InitCommand extends Command {
return 1;
}
}
private async checkAndPromptPublish(): Promise<void> {
const skillMdLocations = [
join(process.cwd(), 'SKILL.md'),
join(process.cwd(), 'skills', 'SKILL.md'),
join(process.cwd(), '.claude', 'skills', 'SKILL.md'),
join(process.cwd(), '.cursor', 'skills', 'SKILL.md'),
];
const foundSkillMd = skillMdLocations.find(loc => existsSync(loc));
if (!foundSkillMd) return;
console.log();
console.log(chalk.yellow('Found SKILL.md in your project!'));
console.log(chalk.dim('Would you like to publish it to the SkillKit marketplace?'));
console.log();
const answer = await this.prompt('Publish skill? [y/N]: ');
if (answer.toLowerCase() === 'y' || answer.toLowerCase() === 'yes') {
console.log();
console.log(chalk.cyan('To publish your skill, run:'));
console.log(chalk.white(` skillkit publish ${foundSkillMd}`));
console.log();
}
}
private prompt(question: string): Promise<string> {
const rl = createInterface({
input: process.stdin,
output: process.stdout,
});
return new Promise(resolve => {
rl.question(question, answer => {
rl.close();
resolve(answer.trim());
});
});
}
}
-261
View File
@@ -1,261 +0,0 @@
import { existsSync, readFileSync } from 'node:fs';
import { join, basename, dirname } from 'node:path';
import { execSync } from 'node:child_process';
import chalk from 'chalk';
import { Command, Option } from 'clipanion';
interface SkillFrontmatter {
name?: string;
description?: string;
tags?: string[];
version?: string;
}
export class PublishCommand extends Command {
static override paths = [['publish']];
static override usage = Command.Usage({
description: 'Publish your skill to the SkillKit marketplace',
examples: [
['Publish skill from current directory', '$0 publish'],
['Publish skill from specific path', '$0 publish ./my-skill'],
['Publish with custom name', '$0 publish --name my-awesome-skill'],
],
});
skillPath = Option.String({ required: false, name: 'path' });
name = Option.String('--name,-n', {
description: 'Custom skill name (default: parsed from SKILL.md)',
});
dryRun = Option.Boolean('--dry-run', false, {
description: 'Show what would be published without actually publishing',
});
async execute(): Promise<number> {
const skillPath = this.skillPath || process.cwd();
const skillMdPath = this.findSkillMd(skillPath);
if (!skillMdPath) {
console.error(chalk.red('No SKILL.md found'));
console.error(chalk.dim('Run this command from a directory containing SKILL.md'));
console.error(chalk.dim('Or specify the path: skillkit publish ./path/to/skill'));
return 1;
}
console.log(chalk.cyan('Publishing skill to SkillKit marketplace...\n'));
// Parse SKILL.md
const content = readFileSync(skillMdPath, 'utf-8');
const frontmatter = this.parseFrontmatter(content);
const skillName = this.name || frontmatter.name || basename(dirname(skillMdPath));
// Get git repo info
const repoInfo = this.getRepoInfo(dirname(skillMdPath));
if (!repoInfo) {
console.error(chalk.red('Not a git repository or no remote configured'));
console.error(chalk.dim('Your skill must be in a git repository with a GitHub remote'));
return 1;
}
// Build skill entry
const skillEntry = {
id: `${repoInfo.owner}/${repoInfo.repo}/${skillName}`,
name: this.formatName(skillName),
description: frontmatter.description || `Best practices and patterns for ${this.formatName(skillName)}`,
source: `${repoInfo.owner}/${repoInfo.repo}`,
tags: frontmatter.tags || this.inferTags(skillName, frontmatter.description || ''),
};
console.log(chalk.white('Skill details:'));
console.log(chalk.dim(` ID: ${skillEntry.id}`));
console.log(chalk.dim(` Name: ${skillEntry.name}`));
console.log(chalk.dim(` Description: ${skillEntry.description}`));
console.log(chalk.dim(` Source: ${skillEntry.source}`));
console.log(chalk.dim(` Tags: ${skillEntry.tags.join(', ')}`));
console.log();
if (this.dryRun) {
console.log(chalk.yellow('Dry run - not publishing'));
console.log(chalk.dim('JSON entry that would be added:'));
console.log(JSON.stringify(skillEntry, null, 2));
return 0;
}
// Create GitHub issue to add skill
const issueBody = this.createIssueBody(skillEntry);
const issueTitle = encodeURIComponent(`[Publish] ${skillEntry.name}`);
const issueBodyEncoded = encodeURIComponent(issueBody);
const issueUrl = `https://github.com/rohitg00/skillkit/issues/new?title=${issueTitle}&body=${issueBodyEncoded}&labels=skill-submission,publish`;
console.log(chalk.green('Opening GitHub to submit your skill...\n'));
try {
// Try to open the URL
const openCmd = process.platform === 'darwin' ? 'open' :
process.platform === 'win32' ? 'start' : 'xdg-open';
execSync(`${openCmd} "${issueUrl}"`, { stdio: 'ignore' });
console.log(chalk.green('GitHub issue page opened!'));
console.log(chalk.dim('Review and submit the issue to publish your skill.'));
} catch {
console.log(chalk.yellow('Could not open browser automatically.'));
console.log(chalk.dim('Please open this URL manually:\n'));
console.log(chalk.cyan(issueUrl.slice(0, 200) + '...'));
}
console.log();
console.log(chalk.cyan('Next steps:'));
console.log(chalk.dim(' 1. Review the skill details in the GitHub issue'));
console.log(chalk.dim(' 2. Submit the issue'));
console.log(chalk.dim(' 3. A maintainer will review and add your skill'));
return 0;
}
private findSkillMd(basePath: string): string | null {
// Check if path is directly to SKILL.md
if (basePath.endsWith('SKILL.md') && existsSync(basePath)) {
return basePath;
}
// Check if SKILL.md exists in the directory
const direct = join(basePath, 'SKILL.md');
if (existsSync(direct)) {
return direct;
}
// Check common skill locations
const locations = [
join(basePath, 'skills', 'SKILL.md'),
join(basePath, '.claude', 'skills', 'SKILL.md'),
join(basePath, '.cursor', 'skills', 'SKILL.md'),
];
for (const loc of locations) {
if (existsSync(loc)) {
return loc;
}
}
return null;
}
private parseFrontmatter(content: string): SkillFrontmatter {
const match = content.match(/^---\n([\s\S]*?)\n---/);
if (!match) return {};
const frontmatter: SkillFrontmatter = {};
const lines = match[1].split('\n');
for (const line of lines) {
const [key, ...valueParts] = line.split(':');
if (!key || valueParts.length === 0) continue;
const value = valueParts.join(':').trim();
switch (key.trim()) {
case 'name':
frontmatter.name = value.replace(/^["']|["']$/g, '');
break;
case 'description':
frontmatter.description = value.replace(/^["']|["']$/g, '');
break;
case 'version':
frontmatter.version = value.replace(/^["']|["']$/g, '');
break;
case 'tags':
// Parse YAML array: [tag1, tag2] or - tag1\n- tag2
if (value.startsWith('[')) {
frontmatter.tags = value
.slice(1, -1)
.split(',')
.map(t => t.trim().replace(/^["']|["']$/g, ''));
}
break;
}
}
return frontmatter;
}
private getRepoInfo(dir: string): { owner: string; repo: string } | null {
try {
const remote = execSync('git remote get-url origin', {
cwd: dir,
encoding: 'utf-8',
stdio: ['pipe', 'pipe', 'ignore'],
}).trim();
// Parse GitHub URL: git@github.com:owner/repo.git or https://github.com/owner/repo.git
const match = remote.match(/github\.com[:/]([^/]+)\/([^/.]+)/);
if (match) {
return { owner: match[1], repo: match[2] };
}
} catch {
// Not a git repo or no remote
}
return null;
}
private formatName(name: string): string {
return name
.split(/[-_]/)
.map(word => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}
private inferTags(name: string, description: string): string[] {
const tags: string[] = [];
const text = `${name} ${description}`.toLowerCase();
const tagMap: Record<string, string[]> = {
react: ['react', 'jsx', 'tsx'],
typescript: ['typescript', 'ts'],
nextjs: ['next', 'nextjs'],
testing: ['test', 'jest', 'vitest'],
mobile: ['mobile', 'react-native', 'expo'],
backend: ['backend', 'api', 'server'],
database: ['database', 'postgres', 'mysql', 'supabase'],
frontend: ['frontend', 'ui', 'design'],
devops: ['devops', 'ci', 'cd', 'docker'],
};
for (const [tag, keywords] of Object.entries(tagMap)) {
if (keywords.some(k => text.includes(k))) {
tags.push(tag);
}
}
return tags.length > 0 ? tags : ['general'];
}
private createIssueBody(
skill: { id: string; name: string; description: string; source: string; tags: string[] }
): string {
return `## Publish Skill Request
### Skill Details
- **ID:** \`${skill.id}\`
- **Name:** ${skill.name}
- **Description:** ${skill.description}
- **Source:** [${skill.source}](https://github.com/${skill.source})
- **Tags:** ${skill.tags.map(t => `\`${t}\``).join(', ')}
### JSON Entry
\`\`\`json
${JSON.stringify(skill, null, 2)}
\`\`\`
### Checklist
- [ ] SKILL.md follows the standard format
- [ ] Skill is publicly accessible on GitHub
- [ ] Description accurately describes the skill
- [ ] Tags are appropriate
---
Submitted via \`skillkit publish\``;
}
}