feat(cli): skillforge tree <dir> — pre-pack file preview - #16
Conversation
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 51 minutes and 39 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than trial, open-source, and free plans. In all cases, review capacity refills continuously over time. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What
skillforge tree <dir>— preview the file inventory apackwould produce, without actually building the archive. Tenth piece of the authoring workflow afterinit,validate,lint,pack,install,update,format,inspect, anddiff. Wherepackbuilds andinspectreads a single skill end-to-end,treeis a one-shot pre-flight: walk the directory using the same exclusion logicpackuses, return a tidy file listing with sizes.Why
When authoring a skill, users often want a sanity-check of "what would
packinclude?" without actually building the archive. Today they have to either runpackand unzip the result, or eyeballls -Rand hope the exclusion rules don't bite them.treeis a one-shot preview: same walk, same exclusions, with byte sizes and a totals line — no archive churn.Result shape
Semantics
shouldExcludeEntryexported frompack.ts—.git,node_modules,.DS_Store, hidden files,*.log. Zero duplicated logic, no chance of drift betweentreeandpack.srcDir, POSIX separators (/), never backslashes — same convention asinspect.attachedFiles.path(default)sizetotalFiles/totalBytespathsort where directories appear in the listing.pack.treenever writes.CLI output taste
├──/└──, 2-space indent per level,│continuation lines) for unambiguous hierarchy./so the eye can distinguish "this is a folder" at a glance.N files · X.Y KB, dim — matches theinspectsummary aesthetic.--jsonemits the fullTreeResultfor CI / scripted reviewers.Surface
src/tree.ts—treeSkill()plus internal walker. ~120 LOC. No new runtime deps; the walker is the same shape asinspect.ts's, just collecting size + isDir instead of path-only.src/tree.test.ts— 8 tests: happy path with exclusions matching pack (.git,node_modules,.DS_Store,debug.logall excluded), empty-ish dir → 1 entry, both sort modes verified, total-bytes accuracy, path-not-found and non-directory error paths, entry-shape contract (POSIX paths, correctisDir). macOS/tmptrap handled withrealpathSync(await mkdtemp(...))inbeforeEach.src/cli.ts— newtreesubcommand with--jsonand--sort <path|size>flags, plus theprintTreeReport()formatter.src/index.ts— re-exports the new public types.README.md— newtreesection; status line updated.CHANGELOG.md—Unreleasedentry.pack.ts.shouldExcludeEntrywas already exported (PR feat(cli): skillforge inspect <path> — one-shot validation + lint + summary #14 added the export forinspect);treereuses it as-is.Gates
pnpm installtsc --noEmitbiome check src(--fix --unsafe)vitest runtsupbuild./dist/cli.js tree …--sort size --jsonOn
treevspack/inspectpackbuilds the archive.inspectreads a single skill (validation + lint + body + file list).treepreviews whatpackwould do, with byte sizes. The three compose:treeto spot heavy fixtures,inspectto read the skill,packto ship it. Each does one thing.Don't refactor
No changes to
pack.ts/inspect.ts/format.ts/lint.ts. No new runtime deps.shouldExcludeEntryreused as-is.Declaration of AI-Tools / LLMs usage