GeezerVison is showing github.com — fix: ensure newline separator when appending to files by Ktsierra · Pull Request #396 · TanStack/cli
Conversation
Ktsierra
commented
Feb 25, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Appending to a file without a final newline can join ignore patterns or environment sections. This adds the missing separator in both Node and edge template generation, preserves existing spacing and keeps raw file appends unchanged.
AI review notes:
The missing-newline regression failed in disk, Node memory and edge memory environments before the fix. All 27 cases now pass, covering missing and empty targets, existing separators, empty appends and CRLF.
The normal pre-commit build, unit and blocking e2e gates passed. A real Sentry/PostHog app was also generated outside the monorepo without installation or provider calls, and its environment sections are separate.
The original trailing-newline fixes and contributor history are retained.
Summary by CodeRabbit
- Bug Fixes
- Generated add-on files now append on a separate line when the existing file has content but no final newline. Existing newlines and intentional blank lines are preserved, and empty appends do not add extra separators. This behavior is consistent across disk-based, Node-memory, and edge-generation workflows.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
appendFile concatenated content without checking for a trailing
newline, causing malformed output when multiple add-ons append to the
same file (e.g. .env.local with sentry + posthog).
Add newline guard in both fs and memfs appendFile implementations.
Fix 4 .append files missing trailing newlines (sentry, strapi, mcp).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a content concatenation issue where multiple add-ons appending to the same file (e.g., .env.local) would have their content directly concatenated without proper separation. The fix ensures proper formatting by automatically inserting blank line separators between appended sections.
Changes:
- Modified
appendFile implementations in both real fs and memfs to automatically add a blank line separator when appending to existing files
- Added missing trailing newlines to 4
.append template files (Sentry, Strapi for React and Solid, MCP gitignore)
- Updated test assertions to reflect the new blank-line separator behavior
Reviewed changes
Copilot reviewed 4 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File |
Description |
| packages/create/src/environment.ts |
Added logic to automatically insert blank line separators (1 or 2 newlines depending on existing content) when appending to files in both real fs and memfs implementations |
| packages/create/src/frameworks/react/add-ons/sentry/assets/_dot_env.local.append |
Added missing trailing newline to Sentry environment config |
| packages/create/src/frameworks/react/add-ons/strapi/assets/_dot_env.local.append |
Added missing trailing newline to Strapi environment config for React |
| packages/create/src/frameworks/solid/add-ons/strapi/assets/_dot_env.local.append |
Added missing trailing newline to Strapi environment config for Solid |
| packages/create/src/frameworks/react/add-ons/mcp/assets/_dot_gitignore.append |
Added missing trailing newline to MCP gitignore |
| packages/create/tests/template-file.test.ts |
Updated test assertion to expect blank line separator between appended content |
| packages/create/tests/filename-processing.test.ts |
Updated test assertion to account for the blank line separator behavior |
| packages/create/tests/environment.test.ts |
Updated test assertion to verify blank line separator in appendFile operations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Heads up: #501 removes memfs from the published runtime and routes the Node memory environment through edge-environment.ts. If #501 lands first, the append separator change here should move to packages/create/src/edge-environment.ts; environment.ts will only adapt Node path resolution.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Nov 1, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|

No actionable comments were generated in the recent review.
Recent review info
-
Run configuration
-
- Source mode: Auto
- Repository: Unavailable
- Branch: Unavailable
- File: No configuration file from this repository applied
- Commit: Unavailable
- Layers: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
06bd1795-2c4b-4bd8-8a3c-2e52dec9b935
Commits
-
Reviewing files that changed from the base of the PR and between cff01c6 and 978cc04.
Files selected for processing: 8
-
.changeset/append-separators.md
packages/create/src/edge-template-file.ts
packages/create/src/frameworks/react/add-ons/mcp/assets/_dot_gitignore.append
packages/create/src/frameworks/react/add-ons/sentry/assets/_dot_env.local.append
packages/create/src/frameworks/react/add-ons/strapi/assets/_dot_env.local.append
packages/create/src/frameworks/solid/add-ons/strapi/assets/_dot_env.local.append
packages/create/src/template-file.ts
packages/create/tests/append-separators.test.ts
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Walkthrough
-
The Node and edge template append paths now insert a newline when existing nonempty file content lacks a final newline and appended content does not begin with one. Parameterized tests cover disk and memory environments, and a patch changeset records the update.
Changes: Append separator handling
| Layer / File(s) |
Summary |
Append paths and validation packages/create/src/template-file.ts, packages/create/src/edge-template-file.ts, packages/create/tests/append-separators.test.ts, .changeset/append-separators.md, packages/create/src/frameworks/{react,solid}/add-ons/*/assets/*.append |
Both append paths conditionally prepend a newline before appending. Tests cover missing or empty targets, newline combinations, blank lines, empty appends, and CRLF. The changeset describes the update. The listed add-on asset entries are unchanged. |
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Bug fix
Merge Risk: Minimal · up to 978cc
-
Template appends preserve existing separators and keep sections separate. No merge-blocking risk was found.
Pre-merge checks: 4 · 1
-
Failed checks: 1 warning
| Check name |
Status |
Explanation |
Resolution |
| Docstring Coverage |
 |
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… |
Write docstrings for the functions missing them to satisfy the coverage threshold. |
Passed checks: 4 passed
-
| Check name |
Status |
Explanation |
| Description Check |
 |
Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title check |
 |
The title clearly and concisely describes the main change: adding a newline separator when appending content to files. |
| Linked Issues check |
 |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
 |
Check skipped because no linked issues were found for this pull request. |
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files. (5 skipped: 5 unsupported.)
Resolution
Write docstrings for the functions missing them to satisfy the coverage threshold.
Finishing Touches
-
Generate unit tests (beta)
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Warning Some tools did not complete. Review the errors below.
ESLint
-
If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.
packages/create/tests/append-separators.test.ts
-
Parsing error: "parserOptions.project" has been provided for @typescript-eslint/parser.
The file was not found in any of the provided project(s): packages/create/tests/append-separators.test.ts
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.
Share
-
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Nov 3, 2026
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|