Skip to content

Align CLI dotenv parsing with the runtime - #158

Open
salluexez wants to merge 1 commit into
yc-software:mainfrom
salluexez:align-cli-dotenv-parsing
Open

Align CLI dotenv parsing with the runtime#158
salluexez wants to merge 1 commit into
yc-software:mainfrom
salluexez:align-cli-dotenv-parsing

Conversation

@salluexez

@salluexez salluexez commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Align readEnvFile in cli/src/util.ts with Node.js --env-file runtime parsing rules by supporting optional export line prefixes and stripping matching outer double or single quotes around values. Includes unit test updates in cli/test/util.test.ts.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Copilot AI review requested due to automatic review settings August 3, 2026 15:41

Copilot AI left a comment

Copy link
Copy Markdown

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 updates the CLI’s .env parsing to more closely match Node’s --env-file behavior by recognizing export -prefixed assignments and stripping matching outer quotes from values, and adjusts unit tests accordingly.

Changes:

  • Extend readEnvFile to accept export KEY=... lines.
  • Strip matching outer single/double quotes from parsed values.
  • Update cli/test/util.test.ts to cover export prefix and quoted values.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
cli/src/util.ts Enhances readEnvFile parsing (export-prefix support, quote stripping).
cli/test/util.test.ts Updates/expands env parsing test coverage for the new parsing rules.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread cli/src/util.ts
Comment on lines +220 to 223
let line = raw.trim();
if (!line || line.startsWith("#")) continue;
if (line.startsWith("export ")) line = line.slice(7).trimStart();
const eq = line.indexOf("=");
Comment thread cli/src/util.ts
Comment on lines +227 to +231
let val = line.slice(eq + 1).trim();
if ((val.startsWith('"') && val.endsWith('"')) || (val.startsWith("'") && val.endsWith("'"))) {
val = val.slice(1, -1);
}
out.set(key, val);
@16francej 16francej added code-pr Code submitted instead of an ADR bug Something isn't working labels Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working code-pr Code submitted instead of an ADR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants