fix(vscode,docs): gitignore .env in scaffolded projects; finish the docs.rocketride.org rename - #1737
Conversation
…rg#1201) Connecting to a self-hosted engine writes a real ROCKETRIDE_APIKEY into the workspace .env (Connection.syncEnvFile), but ensureGitignore only ever added `.rocketride/`. A fresh project was one `git add .` away from committing a live key. - ensureGitignore now reconciles a list of entries (`.rocketride/`, `.env`) and appends only the missing ones, so it never duplicates a line. - The pure reconciliation moves to shared/util/gitignoreEntries.ts, which is vscode-free and therefore unit-testable -- the same seam envFile.ts already uses. Matching is on exact trimmed lines: a user who wrote `*.env` keeps their own rule and gets a redundant line at worst, which beats us second-guessing their config. - Agent checklist: adds an explicit "make sure .env is gitignored" step, renames `env.example` -> `.env.example` (also in COMPONENT_REFERENCE), and replaces "open .env as a visible tab" with verifying the variable names the pipeline actually expects. Note `.env` does not match `.env.example`, so the example file stays committable -- covered by a test. Verified: 8/8 node:test pass; tsc --noEmit clean; prettier clean.
…g#1534) The issue names .github/ISSUE_TEMPLATE/config.yml, but two more remained: .github/SUPPORT.md and the rocketride package docstring in packages/client-python/src/rocketride/__init__.py -- the last of which ships to PyPI and is the most user-visible of the three. `grep -rn docs.rocketride.ai` is now empty.
🤖 Internal: Discord sync markerAuto-managed by the Discord notification workflow. Stores the linked Discord message ID and forum thread ID. Do not edit or delete. |
|
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 (2)
📝 WalkthroughWalkthroughThe PR adds reusable ChangesGitignore protection and documentation updates
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant AgentManager
participant GitignoreUtility
participant Workspace
AgentManager->>Workspace: Read .gitignore
AgentManager->>GitignoreUtility: Reconcile .rocketride/ and .env
GitignoreUtility-->>AgentManager: Updated content or null
AgentManager->>Workspace: Write only when content changed
Possibly related issues
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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
apps/vscode/src/shared/util/gitignoreEntries.tsOops! Something went wrong! :( ESLint: 9.39.5 TypeError: expand is not a function apps/vscode/src/test/gitignoreEntries.test.tsOops! Something went wrong! :( ESLint: 9.39.5 TypeError: expand is not a function 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 |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
apps/vscode/src/agents/agent-manager.ts (1)
318-339: 📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick winDocument this extension-surface change under
apps/vscode/docs/.
ensureGitignorenow modifies workspace files and protects.env, which is user-visible VS Code extension behavior. The supplied documentation changes are underdocs/agents/, but the repository rules require VS Code extension-surface changes to be documented inapps/vscode/docs/.As per coding guidelines, VS Code extension-surface changes must be documented in
apps/vscode/docs/. As per path instructions, this requirement applies to changes underapps/vscode/src/**/*.{ts,tsx}.🤖 Prompt for 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. In `@apps/vscode/src/agents/agent-manager.ts` around lines 318 - 339, Document the user-visible behavior of ensureGitignore in apps/vscode/docs/, including that it creates or updates the workspace .gitignore and protects .env entries. Do not rely on documentation under docs/agents/; add or update the appropriate VS Code extension documentation to cover this extension-surface change.Sources: Coding guidelines, Path instructions
🤖 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/vscode/src/shared/util/gitignoreEntries.ts`:
- Around line 48-54: Update appendGitignoreEntries to preserve the original
content, including trailing whitespace and blank lines, instead of calling
trimEnd. Add a newline separator only when content does not already end with
"\n", while ensuring whitespace-only content does not receive an unintended
leading newline.
---
Outside diff comments:
In `@apps/vscode/src/agents/agent-manager.ts`:
- Around line 318-339: Document the user-visible behavior of ensureGitignore in
apps/vscode/docs/, including that it creates or updates the workspace .gitignore
and protects .env entries. Do not rely on documentation under docs/agents/; add
or update the appropriate VS Code extension documentation to cover this
extension-surface change.
🪄 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: 56d4a031-3d00-4372-b435-e144070cba2f
📒 Files selected for processing (8)
.github/ISSUE_TEMPLATE/config.yml.github/SUPPORT.mdapps/vscode/src/agents/agent-manager.tsapps/vscode/src/shared/util/gitignoreEntries.tsapps/vscode/src/test/gitignoreEntries.test.tsdocs/agents/ROCKETRIDE_COMPONENT_REFERENCE.mddocs/agents/ROCKETRIDE_README.mdpackages/client-python/src/rocketride/__init__.py
…ketride-org#1737 review) appendGitignoreEntries trimmed the content before appending, which dropped any blank lines the user left at the end of their .gitignore. It also emitted a leading newline for whitespace-only content, because the separator was decided from the untrimmed string while the prefix used the trimmed one. Now the existing text is preserved byte-for-byte and a separator is added only when it does not already end in a newline. A hand-edited .gitignore is the user's file; reformatting it while adding one line is how a tool loses trust. Two regression tests added for the whitespace-only and trailing-blank-line cases. 10/10 node:test pass.
Closes #1201. Closes #1534.
#1201 —
.envholds a real key and wasn't gitignoredConnecting to a self-hosted engine writes a live
ROCKETRIDE_APIKEYinto the workspace.env(Connection.syncEnvFile,apps/vscode/src/connection/connection.ts:280), butensureGitignoreonly ever added.rocketride/. A fresh scaffolded project was onegit add .from committing that key.ensureGitignorenow reconciles a list of entries (.rocketride/,.env) and appends only what's missing, so re-running never duplicates a line.apps/vscode/src/shared/util/gitignoreEntries.ts. That directory isvscode-free, so it's unit-testable — the same seamenvFile.tsalready uses for exactly this reason.agent-manager.tsimportsvscodeat module scope and can't be loaded undernode:test.*.envkeeps their own rule and gets one redundant line at worst; silently trusting a pattern we didn't write seemed worse than that. Both cases are tested..envdoes not match.env.example, so the example file stays committable. Also tested, since that's the property the whole "commit only the example" instruction rests on.Docs, per the issue's follow-ups:
.envis gitignored, commit only the exampleenv.example→.env.example(ROCKETRIDE_README.md, andROCKETRIDE_COMPONENT_REFERENCE.md:441).envas a visible tab" with confirming the variable names the pipeline actually expectsThe issue mentions the
packages/agents-corecopy from #1034/#1110 and adocs-sync.ts— neither exists ondevelopyet, so there's nothing to mirror. Whoever lands those will want to carryGITIGNORE_ENTRIESacross.#1534 — three
.aireferences, not oneThe issue names
.github/ISSUE_TEMPLATE/config.yml. Two others were still live:.github/SUPPORT.md:7packages/client-python/src/rocketride/__init__.py:54— therocketridepackage docstring, which ships to PyPI and is the most user-visible of the threegrep -rn "docs.rocketride.ai"is now empty.On #1200 — I think it's already fixed, please close
Not touched here, because the behaviour it reports as removed is back. #1200 says #803 deleted the extension's
.envhandling, so the checklist line is false. Ondevelop:Connection.syncEnvFile(connection.ts:280) writesROCKETRIDE_URI/ROCKETRIDE_APIKEYinto the workspace.envresolveConnectionEnv(shared/util/envFile.ts:163) gates it:developmentgroup only, self-hosted modes only, cloud skipped because an OAuth token isn't a usable SDK keyThe current checklist line — "On connect to a self-hosted engine (local/docker/service/onprem), the extension auto-populates
.env… for cloud, setROCKETRIDE_APIKEYmanually" — matches that exactly. Rewriting it per #1200 to say the agent must create.envitself would make the doc wrong.One nuance the line leaves out, if you want it tightened: only the
developmentconnection group writes.env— thedeploymentgroup deliberately never touches it. Happy to add that in a follow-up.Verification
npx tsx --test src/test/gitignoreEntries.test.ts→ 8 passednpx tsc --noEmit -p apps/vscode/tsconfig.json→ 0 errorsnpx prettier --checkon all changed TS → cleangrep -rn "docs.rocketride.ai"→ no matchesI don't have the engine build locally, so
buildertargets haven't been run.Summary by CodeRabbit
Documentation
docs.rocketride.orgsite..envand.env.examplerequirements.Bug Fixes
.rocketride/and.envfrom version control..gitignoreupdates to preserve existing content, formatting, and avoid unnecessary rewrites.