Skip to content

feat: skill references & scripts support#9

Open
mrgoonie wants to merge 5 commits intomainfrom
feat/skill-references-scripts
Open

feat: skill references & scripts support#9
mrgoonie wants to merge 5 commits intomainfrom
feat/skill-references-scripts

Conversation

@mrgoonie
Copy link
Contributor

@mrgoonie mrgoonie commented Mar 5, 2026

Summary

  • Add skill_references table and scripts/fts_content columns to skills
  • GitHub fetcher script discovers refs/scripts via Trees API with resumable progress
  • Seed pipeline upserts references with SSRF-safe URL validation + Vectorize indexing
  • API returns references metadata + parsed scripts in skill detail endpoint
  • UI: SkillReferencesSection and SkillScriptsSection components on skill detail page
  • CLI: --include-refs and --include-scripts flags with ANSI escape sanitization
  • CLI: extracted display logic into use-display.ts for 200 LOC compliance

Key decisions

  • References: full content in DB, metadata-only on page load, title+first-paragraph in Vectorize
  • Scripts: JSON column (metadata-only — name, command, URL), no execution sandbox
  • FTS5: separate fts_content column (content + ref titles), doesn't mutate stored SKILL.md
  • Staged rollout: --top-n=50 flag for progressive GitHub fetching

Test plan

  • All 38 existing tests pass
  • CLI TypeScript compiles clean
  • Manual: seed with references, verify skill detail page renders refs/scripts
  • Manual: skillx use author/skill --include-refs --include-scripts
  • Deploy migration 0008 to D1 remote

mrgoonie added 5 commits March 5, 2026 18:16
- Add skill_references table (id, skill_id, title, filename, url, type, content)
- Add scripts JSON column and fts_content computed column to skills table
- Migration 0008: schema changes for references & scripts
- Seed endpoint: upsert references with URL validation, Vectorize indexing
- GitHub fetcher script: discover refs/scripts via Trees API, resumable
- API: return references metadata + parsed scripts in skill detail
- UI: SkillReferencesSection and SkillScriptsSection components
- CLI: --include-refs and --include-scripts flags, ANSI escape sanitization
- CLI: split display logic into use-display.ts for maintainability
- Vectorize: index reference titles + first paragraph only (~200K vectors)
- Fix: double .where() in api.skill-detail.ts favorites query
…ripts

- Add skill_references table to schema docs
- Document scripts JSON + fts_content columns
- Add references & scripts data flow to system architecture
- Update CLI docs with --include-refs/--include-scripts flags
- Update CLAUDE.md with new routes and patterns
- C1: sanitize reference content before DB insert (content-scanner)
- C1: change onConflictDoNothing to onConflictDoUpdate for refs re-seed
- H1: human mode shows refs/scripts by default (raw mode still opt-in)
- H2: DRY — use shared fetchSkillReferences in api.skill-detail.ts
- H3: add console.warn on scripts JSON parse failure
- H4: pass includeRefs/includeScripts through searchAndUse fallback
Complete reference for all 6 commands (search, use, find, publish,
report, config) with options, examples, API endpoints, and error handling.
Add KV-backed checkpoint/resume system for batch recomputing composite scores
across all skills. Includes:
- recompute-all-skills.ts: batch processing with N+1 avoidance
- recompute-state.ts: KV checkpoint management (24h TTL auto-cleanup)
- api.admin.recompute.ts: GET /progress, POST /run-batch, POST /run-all
- Support for resume, custom offsets, batch sizes, max-iterations guard

Prevents Worker timeout via 50-batch limit per request. Admin secret auth via
X-Admin-Secret header only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant