mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-13 18:52:18 +03:00
Drains the HARD failures reported by Release-Green run 31693210948 on issue #9985 (ESLint errors: 2) plus the merge-integrity red every open PR is inheriting. - ESLint error 1: @omniroute/opencode-plugin/src/index.ts had a stray extra '});' (introduced by #9316) that broke parsing with 'unexpected file in NFT list' on the build path. - ESLint error 2: cli-env-inline-comment-10100.test.ts used new Function to extract parseEnvValue from the bin entrypoint (no-new-func, Hard Rule #3). Extracted the helper to bin/cli/utils/parseEnvValue.mjs and import it from both the entrypoint and the test (same behavior, no eval). - open-sse-typecheck (Fast Quality Gates): open-sse/utils/stream.ts imported sseCommentsEnabled twice (#9378) causing TS2300 Duplicate identifier; removed the duplicate import. - Merge integrity (changelog + generated skills): skills/omni-settings/SKILL.md was edited manually by #10169 without updating the generator source, so check:agent-skills-sync failed on every PR (Generated: 1). Moved the curated thinking-budget content into a <!-- skill:custom-start --> block (the documented preservation mechanism), which the generator now keeps in sync. Refs #9985
22 lines
803 B
JavaScript
22 lines
803 B
JavaScript
/**
|
|
* Parse a `.env` value with dotenv-compatible comment handling.
|
|
*
|
|
* Without this, `KEY=value # note` stored the comment text as part of the
|
|
* value. The shipped .env ships exactly such a line for QUOTA_STORE_DRIVER, and
|
|
* consumers compare it with `===`, so annotating a variable inline silently
|
|
* disabled it (#10100).
|
|
*
|
|
* Quoted values are returned verbatim — a `#` inside quotes is data. For
|
|
* unquoted values a `#` *preceded by whitespace* starts a comment, so
|
|
* `pass#word` is preserved.
|
|
*/
|
|
export function parseEnvValue(raw) {
|
|
const value = String(raw).trim();
|
|
|
|
const quoted = value.match(/^(['"])([\s\S]*)\1\s*(?:#.*)?$/);
|
|
if (quoted) return quoted[2];
|
|
|
|
const commentIdx = value.search(/\s#/);
|
|
return (commentIdx === -1 ? value : value.slice(0, commentIdx)).trim();
|
|
}
|