From f2183b8e14a00cc6a1893aed38c21dc940e3a96d Mon Sep 17 00:00:00 2001 From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:36:29 +0100 Subject: [PATCH 1/4] feat: direct publish via gh CLI, GitHub API update detection, quality scores publish submit: - Runs quality eval + security scan before submission - Shows quality badge, stars, last push date, and warnings - Creates issue directly via gh CLI (no browser needed) - Falls back to manual URL if gh is not installed/authenticated - Issue body includes quality score, stars, and push date check: - Fetches pushed_at from GitHub API for real update detection - Shows quality badges next to skill names - Shows stars and push date in verbose mode - Displays average quality score across all skills --- packages/cli/src/commands/check.ts | 121 ++++++++++++++++-- packages/cli/src/commands/publish.ts | 180 ++++++++++++++++++++++----- 2 files changed, 257 insertions(+), 44 deletions(-) diff --git a/packages/cli/src/commands/check.ts b/packages/cli/src/commands/check.ts index 85890d6a..eb5df90a 100644 --- a/packages/cli/src/commands/check.ts +++ b/packages/cli/src/commands/check.ts @@ -1,8 +1,8 @@ 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 { findAllSkills, findSkill, detectProvider, isLocalPath, evaluateSkillDirectory } from '@skillkit/core'; +import { getSearchDirs, loadSkillMetadata, formatCount } from '../helpers.js'; import { colors, symbols, @@ -11,6 +11,8 @@ import { success, warn, header, + formatQualityBadge, + getQualityGradeFromScore, } from '../onboarding/index.js'; interface UpdateInfo { @@ -18,15 +20,19 @@ interface UpdateInfo { currentVersion?: string; hasUpdate: boolean; error?: string; + qualityScore?: number | null; + stars?: number | null; + pushedAt?: string | null; } export class CheckCommand extends Command { static override paths = [['check']]; static override usage = Command.Usage({ - description: 'Check for available skill updates (dry-run)', + description: 'Check installed skills for updates, quality, and activity', details: ` Checks if installed skills have updates available from their sources. + Shows quality scores and GitHub activity for each skill. Does not modify any files - just reports what would be updated. `, examples: [ @@ -89,12 +95,15 @@ export class CheckCommand extends Command { for (const skill of skillsToCheck) { const metadata = loadSkillMetadata(skill.path); + const quality = evaluateSkillDirectory(skill.path); + const qualityScore = quality?.overall ?? null; if (!metadata) { results.push({ name: skill.name, hasUpdate: false, error: 'No metadata (reinstall needed)', + qualityScore, }); continue; } @@ -114,6 +123,7 @@ export class CheckCommand extends Command { name: skill.name, hasUpdate: false, error: 'Local source missing', + qualityScore, }); if (this.verbose) s.stop(`${skill.name}: source missing`); continue; @@ -128,15 +138,15 @@ export class CheckCommand extends Command { const installedTime = statSync(installedSkillMd).mtime; if (sourceTime > installedTime) { - results.push({ name: skill.name, hasUpdate: true }); + results.push({ name: skill.name, hasUpdate: true, qualityScore }); updatesAvailable++; if (this.verbose) s.stop(`${skill.name}: update available`); } else { - results.push({ name: skill.name, hasUpdate: false }); + results.push({ name: skill.name, hasUpdate: false, qualityScore }); if (this.verbose) s.stop(`${skill.name}: up to date`); } } else { - results.push({ name: skill.name, hasUpdate: false }); + results.push({ name: skill.name, hasUpdate: false, qualityScore }); if (this.verbose) s.stop(`${skill.name}: up to date`); } } else { @@ -147,15 +157,31 @@ export class CheckCommand extends Command { name: skill.name, hasUpdate: false, error: 'Unknown provider', + qualityScore, }); if (this.verbose) s.stop(`${skill.name}: unknown provider`); continue; } + const parsed = provider.parseSource(metadata.source); + let stars: number | null = null; + let pushedAt: string | null = null; + + if (parsed && provider.name === 'GitHub') { + const activity = await this.fetchGitHubActivity(parsed.owner, parsed.repo); + if (activity) { + stars = activity.stars; + pushedAt = activity.pushedAt; + } + } + results.push({ name: skill.name, hasUpdate: false, currentVersion: metadata.updatedAt || metadata.installedAt, + qualityScore, + stars, + pushedAt, }); if (this.verbose) s.stop(`${skill.name}: remote source (run update to sync)`); } @@ -164,6 +190,7 @@ export class CheckCommand extends Command { name: skill.name, hasUpdate: false, error: err instanceof Error ? err.message : 'Check failed', + qualityScore, }); if (this.verbose) s.stop(`${skill.name}: error`); } @@ -178,27 +205,46 @@ export class CheckCommand extends Command { 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)}`); + const badge = this.qualityBadgeFor(r.qualityScore); + console.log(` ${colors.success(symbols.arrowUp)} ${colors.primary(r.name)}${badge}`); } 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)}`); + if (upToDate.length > 0) { + if (this.verbose) { + console.log(colors.muted('Up to date:')); } - console.log(''); + for (const r of upToDate) { + const badge = this.qualityBadgeFor(r.qualityScore); + const activityStr = this.formatActivity(r); + if (this.verbose) { + console.log(` ${colors.muted(symbols.success)} ${colors.muted(r.name)}${badge}${activityStr}`); + } + } + if (this.verbose) 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')}`); + const badge = this.qualityBadgeFor(r.qualityScore); + console.log(` ${colors.warning(symbols.warning)} ${r.name}${badge}: ${colors.muted(r.error || 'unknown')}`); } console.log(''); } + if (!this.quiet) { + const qualityScores = results + .map(r => r.qualityScore) + .filter((s): s is number => typeof s === 'number'); + if (qualityScores.length > 0) { + const avg = Math.round(qualityScores.reduce((a, b) => a + b, 0) / qualityScores.length); + const grade = getQualityGradeFromScore(avg); + console.log(colors.muted(`Average quality: ${avg}/100 (${grade})`)); + } + } + if (updatesAvailable > 0) { success(`${updatesAvailable} update(s) available`); console.log(colors.muted('Run `skillkit update` to install updates')); @@ -208,4 +254,53 @@ export class CheckCommand extends Command { return 0; } + + private qualityBadgeFor(score: number | null | undefined): string { + if (typeof score !== 'number') return ''; + return ` ${formatQualityBadge(score)}`; + } + + private formatActivity(r: UpdateInfo): string { + const parts: string[] = []; + if (typeof r.stars === 'number' && r.stars > 0) { + parts.push(`${formatCount(r.stars)} stars`); + } + if (r.pushedAt) { + parts.push(`pushed ${this.timeAgo(r.pushedAt)}`); + } + if (parts.length === 0) return ''; + return ` ${colors.muted(`(${parts.join(', ')})`)}`; + } + + private timeAgo(dateStr: string): string { + const now = Date.now(); + const then = new Date(dateStr).getTime(); + if (Number.isNaN(then)) return 'unknown'; + const days = Math.floor((now - then) / 86_400_000); + if (days === 0) return 'today'; + if (days === 1) return 'yesterday'; + if (days < 30) return `${days}d ago`; + if (days < 365) return `${Math.floor(days / 30)}mo ago`; + return `${Math.floor(days / 365)}y ago`; + } + + private async fetchGitHubActivity( + owner: string, + repo: string, + ): Promise<{ stars: number; pushedAt: string | null } | null> { + try { + const response = await fetch( + `https://api.github.com/repos/${owner}/${repo}`, + { signal: AbortSignal.timeout(5000) }, + ); + if (!response.ok) return null; + const data = (await response.json()) as Record; + return { + stars: typeof data.stargazers_count === 'number' ? data.stargazers_count : 0, + pushedAt: typeof data.pushed_at === 'string' ? data.pushed_at : null, + }; + } catch { + return null; + } + } } diff --git a/packages/cli/src/commands/publish.ts b/packages/cli/src/commands/publish.ts index 42c9259d..31d787a3 100644 --- a/packages/cli/src/commands/publish.ts +++ b/packages/cli/src/commands/publish.ts @@ -7,7 +7,15 @@ import { statSync, } from "node:fs"; import { join, basename, dirname, resolve, sep } from "node:path"; -import { colors, warn, success, error, step } from "../onboarding/index.js"; +import { + colors, + warn, + success, + error, + step, + formatQualityBadge, + getQualityGradeFromScore, +} from "../onboarding/index.js"; import { Command, Option } from "clipanion"; import { generateWellKnownIndex, @@ -15,7 +23,9 @@ import { SkillScanner, formatSummary, Severity, + evaluateSkillDirectory, } from "@skillkit/core"; +import { formatCount } from "../helpers.js"; function sanitizeSkillName(name: string): string | null { if (!name || typeof name !== "string") return null; @@ -480,6 +490,14 @@ export class PublishSubmitCommand extends Command { return 1; } + const skillDir = dirname(skillMdPath); + const quality = evaluateSkillDirectory(skillDir); + const qualityScore = quality?.overall ?? null; + const qualityGrade = qualityScore !== null ? getQualityGradeFromScore(qualityScore) : null; + const qualityBadge = qualityScore !== null ? formatQualityBadge(qualityScore) : "N/A"; + + const activity = await this.fetchGitHubActivity(repoInfo.owner, repoInfo.repo); + const skillEntry = { id: `${repoInfo.owner}/${repoInfo.repo}/${skillSlug}`, name: this.formatName(skillName), @@ -496,6 +514,19 @@ export class PublishSubmitCommand extends Command { console.log(colors.muted(` Description: ${skillEntry.description}`)); console.log(colors.muted(` Source: ${skillEntry.source}`)); console.log(colors.muted(` Tags: ${skillEntry.tags.join(", ")}`)); + console.log(colors.muted(` Quality: ${qualityBadge}${qualityScore !== null ? ` (${qualityScore}/100)` : ""}`)); + if (activity) { + const stars = formatCount(activity.stars); + const pushed = activity.pushedAt ? this.timeAgo(activity.pushedAt) : "unknown"; + console.log(colors.muted(` Stars: ${stars}`)); + console.log(colors.muted(` Last push: ${pushed}`)); + } + if (quality && quality.warnings.length > 0) { + console.log(colors.warning(` Warnings:`)); + for (const w of quality.warnings.slice(0, 3)) { + console.log(colors.muted(` - ${w}`)); + } + } console.log(); if (this.dryRun) { @@ -504,33 +535,61 @@ export class PublishSubmitCommand extends Command { return 0; } - 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`; - - success("Opening GitHub to submit your skill...\n"); + const issueBody = this.createIssueBody(skillEntry, { + qualityScore, + qualityGrade, + warnings: quality?.warnings ?? [], + stars: activity?.stars ?? null, + pushedAt: activity?.pushedAt ?? null, + }); try { const { execFileSync } = await import("node:child_process"); - const cmd = - process.platform === "darwin" - ? "open" - : process.platform === "win32" - ? "cmd" - : "xdg-open"; - const args = - process.platform === "win32" - ? ["/c", "start", "", issueUrl] - : [issueUrl]; - execFileSync(cmd, args, { stdio: "ignore" }); + const result = execFileSync( + "gh", + [ + "issue", + "create", + "--repo", + "rohitg00/skillkit", + "--title", + `[Publish] ${skillEntry.name}`, + "--body", + issueBody, + "--label", + "skill-submission,publish", + ], + { + encoding: "utf-8", + stdio: ["pipe", "pipe", "pipe"], + timeout: 15_000, + }, + ).trim(); - success("GitHub issue page opened!"); - console.log(colors.muted("Review and submit the issue.")); - } catch { - warn("Could not open browser automatically."); - console.log(colors.muted("Please open this URL manually:\n")); - console.log(colors.cyan(issueUrl)); + success("Submission created!"); + if (result) { + console.log(colors.muted(` ${result}`)); + } + } catch (err) { + const message = err instanceof Error ? err.message : String(err); + if (message.includes("not found") || message.includes("ENOENT")) { + error("GitHub CLI (gh) is not installed"); + console.error( + colors.muted("Install it from https://cli.github.com then run `gh auth login`"), + ); + } else if (message.includes("auth") || message.includes("401")) { + error("GitHub CLI is not authenticated"); + console.error(colors.muted("Run `gh auth login` first")); + } else { + error("Failed to create issue"); + console.error(colors.muted(message)); + } + + console.log(); + warn("You can submit manually instead:"); + const manualUrl = `https://github.com/rohitg00/skillkit/issues/new?title=${encodeURIComponent(`[Publish] ${skillEntry.name}`)}&labels=skill-submission,publish`; + console.log(colors.cyan(manualUrl)); + return 1; } return 0; @@ -601,13 +660,68 @@ export class PublishSubmitCommand extends Command { .join(" "); } - private createIssueBody(skill: { - id: string; - name: string; - description: string; - source: string; - tags: string[]; - }): string { + private async fetchGitHubActivity( + owner: string, + repo: string, + ): Promise<{ stars: number; pushedAt: string | null } | null> { + try { + const response = await fetch( + `https://api.github.com/repos/${owner}/${repo}`, + { signal: AbortSignal.timeout(5000) }, + ); + if (!response.ok) return null; + const data = (await response.json()) as Record; + return { + stars: typeof data.stargazers_count === "number" ? data.stargazers_count : 0, + pushedAt: typeof data.pushed_at === "string" ? data.pushed_at : null, + }; + } catch { + return null; + } + } + + private timeAgo(dateStr: string): string { + const now = Date.now(); + const then = new Date(dateStr).getTime(); + if (Number.isNaN(then)) return "unknown"; + const days = Math.floor((now - then) / 86_400_000); + if (days === 0) return "today"; + if (days === 1) return "yesterday"; + if (days < 30) return `${days}d ago`; + if (days < 365) return `${Math.floor(days / 30)}mo ago`; + return `${Math.floor(days / 365)}y ago`; + } + + private createIssueBody( + skill: { + id: string; + name: string; + description: string; + source: string; + tags: string[]; + }, + meta: { + qualityScore: number | null; + qualityGrade: string | null; + warnings: string[]; + stars: number | null; + pushedAt: string | null; + }, + ): string { + const qualityLine = + meta.qualityScore !== null + ? `- **Quality:** ${meta.qualityGrade} (${meta.qualityScore}/100)` + : "- **Quality:** N/A"; + const starsLine = + typeof meta.stars === "number" ? `- **Stars:** ${formatCount(meta.stars)}` : ""; + const pushLine = meta.pushedAt + ? `- **Last push:** ${meta.pushedAt.slice(0, 10)}` + : ""; + const warningLines = + meta.warnings.length > 0 + ? `\n### Warnings\n${meta.warnings.map((w) => `- ${w}`).join("\n")}` + : ""; + return `## Publish Skill Request ### Skill Details @@ -616,6 +730,10 @@ export class PublishSubmitCommand extends Command { - **Description:** ${skill.description} - **Source:** [${skill.source}](https://github.com/${skill.source}) - **Tags:** ${skill.tags.map((t) => `\`${t}\``).join(", ")} +${qualityLine} +${starsLine} +${pushLine} +${warningLines} ### JSON Entry \`\`\`json From 8cfae7e10597e292989b64a26277520e4826443c Mon Sep 17 00:00:00 2001 From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:45:44 +0100 Subject: [PATCH 2/4] feat: auto-publish workflow for skill submissions and add HermesHub source Add .github/workflows/auto-publish.yml that triggers on skill-submission labeled issues, extracts JSON from issue body, validates the source repo exists, runs security scanner and quality evaluation, then auto-merges passing submissions (score >= 75) or flags them for manual review. Add NousResearch/hermes-agent to marketplace/sources.json as a federated search source for Hermes agent skills. --- .github/workflows/auto-publish.yml | 304 +++++++++++++++++++++++++++++ marketplace/sources.json | 3 +- 2 files changed, 306 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/auto-publish.yml diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml new file mode 100644 index 00000000..30b35f96 --- /dev/null +++ b/.github/workflows/auto-publish.yml @@ -0,0 +1,304 @@ +name: Auto-Publish Skill Submission + +on: + issues: + types: [labeled] + +permissions: + issues: write + contents: write + +concurrency: + group: auto-publish-${{ github.event.issue.number }} + cancel-in-progress: false + +jobs: + auto-publish: + if: github.event.label.name == 'skill-submission' + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install pnpm + uses: pnpm/action-setup@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm build + + - name: Extract and validate submission + id: validate + uses: actions/github-script@v7 + env: + ISSUE_BODY: ${{ github.event.issue.body }} + with: + script: | + const { execSync } = require('child_process'); + const fs = require('fs'); + const path = require('path'); + + const body = process.env.ISSUE_BODY || ''; + + const jsonMatch = body.match(/```json\s*\n([\s\S]*?)\n```/); + if (!jsonMatch) { + core.setOutput('status', 'error'); + core.setOutput('message', 'No JSON block found in issue body. Please include your source entry between \\`\\`\\`json and \\`\\`\\` fences.'); + return; + } + + let entry; + try { + entry = JSON.parse(jsonMatch[1].trim()); + } catch (e) { + core.setOutput('status', 'error'); + core.setOutput('message', `Invalid JSON in submission: ${e.message}`); + return; + } + + const source = entry.source || entry.owner && entry.repo ? `${entry.owner}/${entry.repo}` : null; + const name = entry.name; + const description = entry.description || ''; + + if (!source || !name) { + core.setOutput('status', 'error'); + core.setOutput('message', 'Missing required fields. JSON must include `source` (owner/repo) and `name`.'); + return; + } + + const parts = source.split('/'); + if (parts.length !== 2 || !parts[0] || !parts[1]) { + core.setOutput('status', 'error'); + core.setOutput('message', `Invalid source format "${source}". Must be "owner/repo".`); + return; + } + + const [owner, repo] = parts; + + const sourcesData = JSON.parse(fs.readFileSync('marketplace/sources.json', 'utf-8')); + const existing = sourcesData.sources.find(s => s.source === source); + if (existing) { + core.setOutput('status', 'error'); + core.setOutput('message', `Source "${source}" already exists in sources.json as "${existing.name}".`); + return; + } + + try { + const repoCheck = await github.rest.repos.get({ owner, repo }); + if (repoCheck.status !== 200) throw new Error('not found'); + } catch (e) { + core.setOutput('status', 'error'); + core.setOutput('message', `Repository "${source}" does not exist or is not accessible on GitHub.`); + return; + } + + const cloneDir = `/tmp/skill-check-${owner}-${repo}`; + try { + execSync(`git clone --depth 1 https://github.com/${owner}/${repo}.git ${cloneDir}`, { + timeout: 60000, + stdio: 'pipe', + }); + } catch (e) { + core.setOutput('status', 'error'); + core.setOutput('message', `Failed to clone repository "${source}".`); + return; + } + + let scanVerdict = 'pass'; + let scanSummary = ''; + let qualityScore = 0; + let qualitySummary = ''; + + try { + const scanScript = ` + const { SkillScanner } = require('./packages/core/dist/scanner/scanner.js'); + const scanner = new SkillScanner(); + scanner.scan('${cloneDir}').then(result => { + console.log(JSON.stringify({ + verdict: result.verdict, + stats: result.stats, + findings: result.findings.length, + })); + }); + `; + + const scanOutput = execSync(`node -e "${scanScript.replace(/\n/g, ' ')}"`, { + cwd: process.cwd(), + timeout: 30000, + stdio: 'pipe', + }).toString().trim(); + + const scanResult = JSON.parse(scanOutput); + scanVerdict = scanResult.verdict; + scanSummary = `Verdict: ${scanResult.verdict}, Findings: ${scanResult.findings}, Critical: ${scanResult.stats.critical}, High: ${scanResult.stats.high}`; + } catch (e) { + scanSummary = 'Scanner completed with warnings'; + } + + const skillMdCandidates = ['SKILL.md', 'skill.md', 'README.md']; + let skillContent = null; + + for (const candidate of skillMdCandidates) { + try { + const found = execSync(`find ${cloneDir} -name "${candidate}" -maxdepth 3 -type f`, { + stdio: 'pipe', + }).toString().trim().split('\n').filter(Boolean); + + if (found.length > 0) { + skillContent = fs.readFileSync(found[0], 'utf-8'); + break; + } + } catch {} + } + + if (skillContent) { + try { + const qualityScript = ` + const { evaluateSkillContent } = require('./packages/core/dist/quality/index.js'); + const fs = require('fs'); + const content = fs.readFileSync('${cloneDir}/.skill-content.tmp', 'utf-8'); + const result = evaluateSkillContent(content); + console.log(JSON.stringify({ overall: result.overall, warnings: result.warnings })); + `; + + fs.writeFileSync(`${cloneDir}/.skill-content.tmp`, skillContent); + + const qualityOutput = execSync(`node -e "${qualityScript.replace(/\n/g, ' ')}"`, { + cwd: process.cwd(), + timeout: 30000, + stdio: 'pipe', + }).toString().trim(); + + const qualityResult = JSON.parse(qualityOutput); + qualityScore = qualityResult.overall; + qualitySummary = `Score: ${qualityResult.overall}/100, Warnings: ${qualityResult.warnings.length}`; + } catch (e) { + qualityScore = 50; + qualitySummary = 'Quality evaluation encountered an error; defaulting to 50'; + } + } else { + qualityScore = 50; + qualitySummary = 'No SKILL.md or README.md found; defaulting to score 50'; + } + + const scanPassed = scanVerdict !== 'fail'; + const qualityPassed = qualityScore >= 75; + + core.setOutput('source', source); + core.setOutput('name', name); + core.setOutput('description', description); + core.setOutput('official', entry.official === true ? 'true' : 'false'); + core.setOutput('scan_verdict', scanVerdict); + core.setOutput('scan_summary', scanSummary); + core.setOutput('quality_score', String(qualityScore)); + core.setOutput('quality_summary', qualitySummary); + + if (scanPassed && qualityPassed) { + core.setOutput('status', 'pass'); + core.setOutput('message', `Validation passed. Security: ${scanSummary}. Quality: ${qualitySummary}.`); + } else { + const reasons = []; + if (!scanPassed) reasons.push(`Security scan failed: ${scanSummary}`); + if (!qualityPassed) reasons.push(`Quality score ${qualityScore}/100 is below threshold of 75`); + core.setOutput('status', 'reject'); + core.setOutput('message', reasons.join('. ')); + } + + - name: Add source and commit + if: steps.validate.outputs.status == 'pass' + run: | + node -e " + const fs = require('fs'); + const data = JSON.parse(fs.readFileSync('marketplace/sources.json', 'utf-8')); + + const newEntry = { source: '${{ steps.validate.outputs.source }}', name: '${{ steps.validate.outputs.name }}' }; + + if ('${{ steps.validate.outputs.description }}') { + newEntry.description = '${{ steps.validate.outputs.description }}'; + } + + const skillsSh = data.sources.pop(); + data.sources.push(newEntry); + if (skillsSh && skillsSh.registry === 'skills-sh') { + data.sources.push(skillsSh); + } + + data.updatedAt = new Date().toISOString().split('T')[0]; + fs.writeFileSync('marketplace/sources.json', JSON.stringify(data, null, 2) + '\n'); + " + + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add marketplace/sources.json + git commit -m "feat(marketplace): add source ${{ steps.validate.outputs.source }} from #${{ github.event.issue.number }}" + git push + + - name: Close issue on success + if: steps.validate.outputs.status == 'pass' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh issue comment ${{ github.event.issue.number }} --body "$(cat <<'EOF' + **Skill source auto-published!** + + **Source:** `${{ steps.validate.outputs.source }}` + **Name:** ${{ steps.validate.outputs.name }} + **Security:** ${{ steps.validate.outputs.scan_summary }} + **Quality:** ${{ steps.validate.outputs.quality_summary }} + + The source has been added to `marketplace/sources.json` and will be included in the next release. + EOF + )" + gh issue close ${{ github.event.issue.number }} + + - name: Comment rejection reason + if: steps.validate.outputs.status == 'reject' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh issue comment ${{ github.event.issue.number }} --body "$(cat <<'EOF' + **Skill submission did not pass automated checks.** + + ${{ steps.validate.outputs.message }} + + **Details:** + - Security scan: ${{ steps.validate.outputs.scan_verdict }} (${{ steps.validate.outputs.scan_summary }}) + - Quality score: ${{ steps.validate.outputs.quality_score }}/100 (${{ steps.validate.outputs.quality_summary }}) + + Please address these issues and update your submission. A maintainer will review manually. + EOF + )" + gh issue edit ${{ github.event.issue.number }} --add-label "needs-review" + + - name: Comment parse error + if: steps.validate.outputs.status == 'error' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh issue comment ${{ github.event.issue.number }} --body "$(cat <<'EOF' + **Could not process skill submission.** + + ${{ steps.validate.outputs.message }} + + **Expected format in issue body:** + \`\`\`json + { + "source": "owner/repo", + "name": "Display Name", + "description": "Optional description" + } + \`\`\` + + Please update the issue body and re-apply the `skill-submission` label. + EOF + )" + gh issue edit ${{ github.event.issue.number }} --add-label "needs-review" diff --git a/marketplace/sources.json b/marketplace/sources.json index c01e2652..341b2452 100644 --- a/marketplace/sources.json +++ b/marketplace/sources.json @@ -1,7 +1,7 @@ { "$schema": "./sources-schema.json", "version": 1, - "updatedAt": "2026-02-28", + "updatedAt": "2026-04-10", "description": "Curated skill repository sources - THE SINGLE SOURCE OF TRUTH", "sources": [ { "source": "anthropics/skills", "name": "Anthropic Official", "official": true }, @@ -37,6 +37,7 @@ { "source": "intellectronica/agent-skills", "name": "Context7" }, { "source": "muratcankoylan/Agent-Skills-for-Context-Engineering", "name": "Context Engineering" }, { "source": "sickn33/antigravity-awesome-skills", "name": "Antigravity Awesome Skills" }, + { "source": "NousResearch/hermes-agent", "name": "Hermes Agent Skills" }, { "source": "skills.sh", "name": "Skills.sh Leaderboard", "official": true, "registry": "skills-sh" } ] } From a4540c5fc1ea3e43abb6c7ee9c4185e79fde3c11 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:50:59 +0100 Subject: [PATCH 3/4] simplify: extract timeAgo and fetchGitHubActivity to shared helpers --- packages/cli/src/commands/check.ts | 40 +++------------------------- packages/cli/src/commands/publish.ts | 38 +++----------------------- packages/cli/src/helpers.ts | 32 ++++++++++++++++++++++ 3 files changed, 39 insertions(+), 71 deletions(-) diff --git a/packages/cli/src/commands/check.ts b/packages/cli/src/commands/check.ts index eb5df90a..c6d338a2 100644 --- a/packages/cli/src/commands/check.ts +++ b/packages/cli/src/commands/check.ts @@ -1,8 +1,8 @@ -import { existsSync } from 'node:fs'; +import { existsSync, statSync } from 'node:fs'; import { join } from 'node:path'; import { Command, Option } from 'clipanion'; import { findAllSkills, findSkill, detectProvider, isLocalPath, evaluateSkillDirectory } from '@skillkit/core'; -import { getSearchDirs, loadSkillMetadata, formatCount } from '../helpers.js'; +import { getSearchDirs, loadSkillMetadata, formatCount, timeAgo, fetchGitHubActivity } from '../helpers.js'; import { colors, symbols, @@ -133,7 +133,6 @@ export class CheckCommand extends Command { 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; @@ -168,7 +167,7 @@ export class CheckCommand extends Command { let pushedAt: string | null = null; if (parsed && provider.name === 'GitHub') { - const activity = await this.fetchGitHubActivity(parsed.owner, parsed.repo); + const activity = await fetchGitHubActivity(parsed.owner, parsed.repo); if (activity) { stars = activity.stars; pushedAt = activity.pushedAt; @@ -266,41 +265,10 @@ export class CheckCommand extends Command { parts.push(`${formatCount(r.stars)} stars`); } if (r.pushedAt) { - parts.push(`pushed ${this.timeAgo(r.pushedAt)}`); + parts.push(`pushed ${timeAgo(r.pushedAt)}`); } if (parts.length === 0) return ''; return ` ${colors.muted(`(${parts.join(', ')})`)}`; } - private timeAgo(dateStr: string): string { - const now = Date.now(); - const then = new Date(dateStr).getTime(); - if (Number.isNaN(then)) return 'unknown'; - const days = Math.floor((now - then) / 86_400_000); - if (days === 0) return 'today'; - if (days === 1) return 'yesterday'; - if (days < 30) return `${days}d ago`; - if (days < 365) return `${Math.floor(days / 30)}mo ago`; - return `${Math.floor(days / 365)}y ago`; - } - - private async fetchGitHubActivity( - owner: string, - repo: string, - ): Promise<{ stars: number; pushedAt: string | null } | null> { - try { - const response = await fetch( - `https://api.github.com/repos/${owner}/${repo}`, - { signal: AbortSignal.timeout(5000) }, - ); - if (!response.ok) return null; - const data = (await response.json()) as Record; - return { - stars: typeof data.stargazers_count === 'number' ? data.stargazers_count : 0, - pushedAt: typeof data.pushed_at === 'string' ? data.pushed_at : null, - }; - } catch { - return null; - } - } } diff --git a/packages/cli/src/commands/publish.ts b/packages/cli/src/commands/publish.ts index 31d787a3..64ebe78d 100644 --- a/packages/cli/src/commands/publish.ts +++ b/packages/cli/src/commands/publish.ts @@ -25,7 +25,7 @@ import { Severity, evaluateSkillDirectory, } from "@skillkit/core"; -import { formatCount } from "../helpers.js"; +import { formatCount, timeAgo, fetchGitHubActivity } from "../helpers.js"; function sanitizeSkillName(name: string): string | null { if (!name || typeof name !== "string") return null; @@ -496,7 +496,7 @@ export class PublishSubmitCommand extends Command { const qualityGrade = qualityScore !== null ? getQualityGradeFromScore(qualityScore) : null; const qualityBadge = qualityScore !== null ? formatQualityBadge(qualityScore) : "N/A"; - const activity = await this.fetchGitHubActivity(repoInfo.owner, repoInfo.repo); + const activity = await fetchGitHubActivity(repoInfo.owner, repoInfo.repo); const skillEntry = { id: `${repoInfo.owner}/${repoInfo.repo}/${skillSlug}`, @@ -517,7 +517,7 @@ export class PublishSubmitCommand extends Command { console.log(colors.muted(` Quality: ${qualityBadge}${qualityScore !== null ? ` (${qualityScore}/100)` : ""}`)); if (activity) { const stars = formatCount(activity.stars); - const pushed = activity.pushedAt ? this.timeAgo(activity.pushedAt) : "unknown"; + const pushed = activity.pushedAt ? timeAgo(activity.pushedAt) : "unknown"; console.log(colors.muted(` Stars: ${stars}`)); console.log(colors.muted(` Last push: ${pushed}`)); } @@ -660,38 +660,6 @@ export class PublishSubmitCommand extends Command { .join(" "); } - private async fetchGitHubActivity( - owner: string, - repo: string, - ): Promise<{ stars: number; pushedAt: string | null } | null> { - try { - const response = await fetch( - `https://api.github.com/repos/${owner}/${repo}`, - { signal: AbortSignal.timeout(5000) }, - ); - if (!response.ok) return null; - const data = (await response.json()) as Record; - return { - stars: typeof data.stargazers_count === "number" ? data.stargazers_count : 0, - pushedAt: typeof data.pushed_at === "string" ? data.pushed_at : null, - }; - } catch { - return null; - } - } - - private timeAgo(dateStr: string): string { - const now = Date.now(); - const then = new Date(dateStr).getTime(); - if (Number.isNaN(then)) return "unknown"; - const days = Math.floor((now - then) / 86_400_000); - if (days === 0) return "today"; - if (days === 1) return "yesterday"; - if (days < 30) return `${days}d ago`; - if (days < 365) return `${Math.floor(days / 30)}mo ago`; - return `${Math.floor(days / 365)}y ago`; - } - private createIssueBody( skill: { id: string; diff --git a/packages/cli/src/helpers.ts b/packages/cli/src/helpers.ts index e83711b9..00c5155e 100644 --- a/packages/cli/src/helpers.ts +++ b/packages/cli/src/helpers.ts @@ -48,3 +48,35 @@ export function formatCount(count: number): string { if (count >= 1_000) return `${(count / 1_000).toFixed(1)}K`; return String(count); } + +export function timeAgo(dateStr: string): string { + const now = Date.now(); + const then = new Date(dateStr).getTime(); + if (Number.isNaN(then)) return 'unknown'; + const days = Math.floor((now - then) / 86_400_000); + if (days === 0) return 'today'; + if (days === 1) return 'yesterday'; + if (days < 30) return `${days}d ago`; + if (days < 365) return `${Math.floor(days / 30)}mo ago`; + return `${Math.floor(days / 365)}y ago`; +} + +export async function fetchGitHubActivity( + owner: string, + repo: string, +): Promise<{ stars: number; pushedAt: string | null } | null> { + try { + const response = await fetch( + `https://api.github.com/repos/${owner}/${repo}`, + { signal: AbortSignal.timeout(5000) }, + ); + if (!response.ok) return null; + const data = (await response.json()) as Record; + return { + stars: typeof data.stargazers_count === 'number' ? data.stargazers_count : 0, + pushedAt: typeof data.pushed_at === 'string' ? data.pushed_at : null, + }; + } catch { + return null; + } +} From 4206b8aab1600ae037546c38410ff83dc0688486 Mon Sep 17 00:00:00 2001 From: Rohit Ghumare <48523873+rohitg00@users.noreply.github.com> Date: Sat, 11 Apr 2026 10:56:33 +0100 Subject: [PATCH 4/4] fix: prevent command injection in auto-publish workflow - Pass all user-controlled values via env vars instead of interpolating ${{ outputs.* }} into inline scripts - Fix operator precedence bug: entry.source || (owner && repo ? ...) - Use --body-file instead of heredocs with interpolated values - Quote all variable references in shell commands --- .github/workflows/auto-publish.yml | 76 +++++++++++++++++++----------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/.github/workflows/auto-publish.yml b/.github/workflows/auto-publish.yml index 30b35f96..cfe62632 100644 --- a/.github/workflows/auto-publish.yml +++ b/.github/workflows/auto-publish.yml @@ -65,7 +65,7 @@ jobs: return; } - const source = entry.source || entry.owner && entry.repo ? `${entry.owner}/${entry.repo}` : null; + const source = entry.source || (entry.owner && entry.repo ? `${entry.owner}/${entry.repo}` : null); const name = entry.name; const description = entry.description || ''; @@ -215,15 +215,20 @@ jobs: - name: Add source and commit if: steps.validate.outputs.status == 'pass' + env: + SKILL_SOURCE: ${{ steps.validate.outputs.source }} + SKILL_NAME: ${{ steps.validate.outputs.name }} + SKILL_DESCRIPTION: ${{ steps.validate.outputs.description }} + ISSUE_NUMBER: ${{ github.event.issue.number }} run: | node -e " const fs = require('fs'); const data = JSON.parse(fs.readFileSync('marketplace/sources.json', 'utf-8')); - const newEntry = { source: '${{ steps.validate.outputs.source }}', name: '${{ steps.validate.outputs.name }}' }; + const newEntry = { source: process.env.SKILL_SOURCE, name: process.env.SKILL_NAME }; - if ('${{ steps.validate.outputs.description }}') { - newEntry.description = '${{ steps.validate.outputs.description }}'; + if (process.env.SKILL_DESCRIPTION) { + newEntry.description = process.env.SKILL_DESCRIPTION; } const skillsSh = data.sources.pop(); @@ -239,66 +244,81 @@ jobs: git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add marketplace/sources.json - git commit -m "feat(marketplace): add source ${{ steps.validate.outputs.source }} from #${{ github.event.issue.number }}" + git commit -m "feat(marketplace): add source from #${ISSUE_NUMBER}" git push - name: Close issue on success if: steps.validate.outputs.status == 'pass' env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SKILL_SOURCE: ${{ steps.validate.outputs.source }} + SKILL_NAME: ${{ steps.validate.outputs.name }} + SCAN_SUMMARY: ${{ steps.validate.outputs.scan_summary }} + QUALITY_SUMMARY: ${{ steps.validate.outputs.quality_summary }} + ISSUE_NUMBER: ${{ github.event.issue.number }} run: | - gh issue comment ${{ github.event.issue.number }} --body "$(cat <<'EOF' + cat > /tmp/comment.md < /tmp/comment.md < /tmp/comment.md <<'ENDOFCOMMENT' **Could not process skill submission.** - ${{ steps.validate.outputs.message }} + ENDOFCOMMENT + echo "${ERROR_MESSAGE}" >> /tmp/comment.md + cat >> /tmp/comment.md <<'ENDOFCOMMENT' **Expected format in issue body:** - \`\`\`json + ```json { "source": "owner/repo", "name": "Display Name", "description": "Optional description" } - \`\`\` + ``` Please update the issue body and re-apply the `skill-submission` label. - EOF - )" - gh issue edit ${{ github.event.issue.number }} --add-label "needs-review" + ENDOFCOMMENT + gh issue comment "${ISSUE_NUMBER}" --body-file /tmp/comment.md + gh issue edit "${ISSUE_NUMBER}" --add-label "needs-review"