refactor(core): dedupe embedding imports and env parsing

This commit is contained in:
Peter Steinberger
2026-03-02 15:14:28 +00:00
parent dcf8308c8f
commit e9dd6121f2
6 changed files with 53 additions and 48 deletions

View File

@@ -20,7 +20,7 @@ import {
import { listKnownSecretEnvVarNames } from "./provider-env-vars.js";
import { resolveSecretRefValue } from "./resolve.js";
import { prepareSecretsRuntimeSnapshot } from "./runtime.js";
import { isNonEmptyString, isRecord, writeTextFileAtomic } from "./shared.js";
import { isNonEmptyString, isRecord, parseEnvValue, writeTextFileAtomic } from "./shared.js";
type FileSnapshot = {
existed: boolean;
@@ -118,17 +118,6 @@ function resolveTargetPathSegments(target: SecretsPlanTarget): string[] {
return resolved;
}
function parseEnvValue(raw: string): string {
const trimmed = raw.trim();
if (
(trimmed.startsWith('"') && trimmed.endsWith('"')) ||
(trimmed.startsWith("'") && trimmed.endsWith("'"))
) {
return trimmed.slice(1, -1);
}
return trimmed;
}
function scrubEnvRaw(
raw: string,
migratedValues: Set<string>,