mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-22 16:51:28 +02:00
fix(dev-runner): tighten worktree env bootstrap
This commit is contained in:
1 parent
b6115424b1
commit
a5aed931ab
3 files changed
+13
-5
No files matched your search
@@ -17,6 +17,10 @@ function parseEnvFile(contents: string): Record<string, string> {
|
||||
entries[key] = "";
|
||||
continue;
|
||||
}
|
||||
if (value.startsWith("#")) {
|
||||
entries[key] = "";
|
||||
continue;
|
||||
}
|
||||
|
||||
if (
|
||||
(value.startsWith("\"") && value.endsWith("\"")) ||
|
||||
@@ -32,6 +36,11 @@ function parseEnvFile(contents: string): Record<string, string> {
|
||||
return entries;
|
||||
}
|
||||
|
||||
type WorktreeEnvBootstrapResult =
|
||||
| { envPath: null; missingEnv: false }
|
||||
| { envPath: string; missingEnv: true }
|
||||
| { envPath: string; missingEnv: false };
|
||||
|
||||
export function isLinkedGitWorktreeCheckout(rootDir: string): boolean {
|
||||
const gitMetadataPath = path.join(rootDir, ".git");
|
||||
if (!existsSync(gitMetadataPath)) return false;
|
||||
@@ -49,10 +58,7 @@ export function resolveWorktreeEnvFilePath(rootDir: string): string {
|
||||
export function bootstrapDevRunnerWorktreeEnv(
|
||||
rootDir: string,
|
||||
env: NodeJS.ProcessEnv = process.env,
|
||||
): {
|
||||
envPath: string | null;
|
||||
missingEnv: boolean;
|
||||
} {
|
||||
): WorktreeEnvBootstrapResult {
|
||||
if (!isLinkedGitWorktreeCheckout(rootDir)) {
|
||||
return {
|
||||
envPath: null,
|
||||
|
||||
Reference in new issue
Block a user