feat: ingestion primitives — clone, discover, frontmatter, bundle (tasks 4.1-4.4)#4
Conversation
Add src/server/ingestion/ module with: - clone.ts: shallow git clone via simple-git, throws CLONE_FAILED on error - discover.ts: walks 6 spec-mandated discovery paths for SKILL.md files - frontmatter.ts: js-yaml YAML frontmatter parser with name/description validation - bundle.ts: SHA256 + skill-md or tar.gz archive bundling - index.ts: re-exports all public types and functions Co-authored-by: Cursor <cursoragent@cursor.com>
PR Summary by QodoAdd ingestion primitives: clone, discover, frontmatter, bundle Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo
1.
|
- discover: skip subdirs containing their own SKILL.md (separate skill roots) when collecting supportingFiles; defensively filter SKILL.md from walkAllFiles results - clone: validate URL scheme (https/ssh/git@) before invoking git clone - bundle: sort supportingFiles lexicographically inside getAllRelativeFiles to guarantee deterministic archive byte stream and SHA-256 digest Co-authored-by: Cursor <cursoragent@cursor.com>
Covers discoverSkills, parseFrontmatter, bundleSkill, and clone URL validation. Includes explicit regression tests for the three Qodo bugs: - nested SKILL.md excluded from supportingFiles (bug 1) - invalid URL scheme rejected before git clone (bug 2) - archive digest is deterministic regardless of supportingFiles order (bug 3) Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
Implements the four foundational ingestion primitives in
src/server/ingestion/:clone.ts— shallow--depth 1git clone viasimple-git; throwsCLONE_FAILED: <message>on errordiscover.ts— walks the 6 spec-mandated discovery paths (skills/,.claude/skills/,.cursor/skills/,.github/copilot/skills/,.windsurf/skills/,.gemini/skills/); case-insensitiveSKILL.mdmatch; returns slug, skillMdPath, skillDir, discoveryPath, supportingFilesfrontmatter.ts— parses----delimited YAML frontmatter; returns{ ok: false, reason }(never throws) for missing delimiters, malformed YAML, or missingname/descriptionbundle.ts— classifies single-file skills asskill-md, multi-file asarchive(in-memory tar.gz); computes SHA256 hex digest on the artifactNotes
Test plan
npm run build:server— zero TypeScript errorsnpm test— 16/16 passing (no regressions to existing DB tests)Related
rhess-enterprise-skills-serverMade with Cursor