Fix scaffold audit gaps (install, names, writer, doc links)#10
Fix scaffold audit gaps (install, names, writer, doc links)#10eternalwaitt wants to merge 2 commits into
Conversation
Implement post-scaffold git init and package install, centralize project name sanitization, harden template writes with path checks and batching, and stop doc link checker from scanning fenced code blocks. Co-authored-by: Cursor <cursoragent@cursor.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughCentralizes project-name sanitization/validation, extracts post-scaffold git/env/install helpers and tests, loads CLI version from package.json, hardens template writer against path traversal with bounded concurrency, and strips fenced code blocks during markdown link checks. ChangesProject Name Validation and Centralization
Post-Scaffold Operations and CLI Enhancements
Template Writer Security Hardening
Documentation Link Validation
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/cli/src/post-scaffold.ts`:
- Around line 55-78: The installDependencies function currently always runs
installs even though callers (e.g., the call site in create.ts) gate it by
config.install; add an explicit guard at the top of installDependencies that
returns immediately when config.install is false so direct callers (like unit
tests) honor the flag, and update the function docstring to state that
installDependencies will no-op if config.install is false; reference the
installDependencies function and the config.install flag when making the change.
In `@packages/template-generator/src/writer.ts`:
- Around line 25-41: The current batching logic creates all batches then starts
every batch in parallel, so WRITE_CONCURRENCY is not enforced; change the outer
Promise.all over batches to a sequential loop that awaits each batch's
Promise.all before proceeding. Locate the code that builds batches (batches:
[string, string][][]) and the batches.map(...) call and replace it with a
for..of over batches where for each batch you run await
Promise.all(batch.map(async ([path, content]) => { const abs = resolve(root,
path); assertPathInsideRoot(root, abs); await mkdir(dirname(abs), { recursive:
true }); await writeFile(abs, content, "utf8"); }))). This ensures entries are
written in groups of size WRITE_CONCURRENCY rather than all at once.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3d8ed905-eee1-487f-8c97-6c447e95e492
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
apps/cli/src/create.tsapps/cli/src/index.tsapps/cli/src/post-scaffold.test.tsapps/cli/src/post-scaffold.tsapps/web/lib/build-command.test.tsapps/web/lib/build-command.tspackages/template-generator/src/writer.test.tspackages/template-generator/src/writer.tspackages/types/package.jsonpackages/types/src/index.tspackages/types/src/project-name.test.tspackages/types/src/project-name.tsscripts/check-doc-links.mjs
Honor config.install inside installDependencies, use execFileSync for git/install commands, and write template files in bounded batches without unbounded parallel Promise.all. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
git initand optional dependency install (bun/npm/pnpm) without failing the scaffold on install errors.@veloz-stack/types; align CLI and web stack builder on the same rules.writeTreewith path containment checks and batched concurrent writes.package.jsoninstead of a hardcoded string.docs:linksso markdown examples do not false-positive.Test plan
pnpm lintpnpm --filter @veloz-stack/types testpnpm --filter create-veloz-stack testpnpm --filter @veloz-stack/template-generator test(afterpnpm gen)pnpm docs:linksMade with Cursor
Summary by CodeRabbit
New Features
Bug Fixes
Tests