@episoda/cli 0.2.191 → 0.2.193
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3046,7 +3046,7 @@ var require_package = __commonJS({
|
|
|
3046
3046
|
"package.json"(exports2, module2) {
|
|
3047
3047
|
module2.exports = {
|
|
3048
3048
|
name: "@episoda/cli",
|
|
3049
|
-
version: "0.2.
|
|
3049
|
+
version: "0.2.193",
|
|
3050
3050
|
description: "CLI tool for Episoda local development workflow orchestration",
|
|
3051
3051
|
main: "dist/index.js",
|
|
3052
3052
|
types: "dist/index.d.ts",
|
|
@@ -12495,11 +12495,11 @@ async function handleWorktreeCreate(request2) {
|
|
|
12495
12495
|
}
|
|
12496
12496
|
} else {
|
|
12497
12497
|
const currentOriginUrl = await readOriginUrl(bareRepoPath);
|
|
12498
|
-
const
|
|
12499
|
-
const
|
|
12500
|
-
if (
|
|
12498
|
+
const strippedCurrentOriginUrl = currentOriginUrl ? stripGitCredentials(currentOriginUrl) : null;
|
|
12499
|
+
const shouldRefreshOriginUrl = !!currentOriginUrl && currentOriginUrl !== refreshedRepoUrl && strippedCurrentOriginUrl !== refreshedRepoUrl;
|
|
12500
|
+
if (shouldRefreshOriginUrl) {
|
|
12501
12501
|
try {
|
|
12502
|
-
await execAsync2(`git -C "${bareRepoPath}" remote set-url origin "${
|
|
12502
|
+
await execAsync2(`git -C "${bareRepoPath}" remote set-url origin "${refreshedRepoUrl}"`, { env: gitEnv });
|
|
12503
12503
|
console.log("[Worktree] EP1435: Refreshed bare repo origin URL with a fresh installation token");
|
|
12504
12504
|
} catch (setUrlError) {
|
|
12505
12505
|
console.warn(`[Worktree] EP1435: Failed to refresh origin URL: ${setUrlError.message}`);
|
|
@@ -12526,8 +12526,6 @@ async function handleWorktreeCreate(request2) {
|
|
|
12526
12526
|
const worktreePath = result.worktreePath;
|
|
12527
12527
|
console.log(`[Worktree] EP1373: worktree_add phase=worktree_add durationMs=${Date.now() - worktreeAddStartMs} moduleUid=${moduleUid} correlationId=${correlationId || "none"}`);
|
|
12528
12528
|
console.log(`[Worktree] EP1143: Worktree created at ${worktreePath}`);
|
|
12529
|
-
let finalStatus = "ready";
|
|
12530
|
-
let finalError;
|
|
12531
12529
|
if (envVars && Object.keys(envVars).length > 0) {
|
|
12532
12530
|
const envContent = Object.entries(envVars).map(([key, value]) => `${key}=${value}`).join("\n");
|
|
12533
12531
|
const envPath = path28.join(worktreePath, ".env");
|
|
@@ -12544,38 +12542,49 @@ async function handleWorktreeCreate(request2) {
|
|
|
12544
12542
|
${buildCmd}` : buildCmd;
|
|
12545
12543
|
console.log(`[Worktree] EP1386: Added build:packages bootstrap for ${isCloud ? "cloud" : "local"} setup`);
|
|
12546
12544
|
}
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12545
|
+
setTimeout(() => {
|
|
12546
|
+
void (async () => {
|
|
12547
|
+
if (!effectiveSetupScript) {
|
|
12548
|
+
await manager.updateWorktreeStatus(moduleUid, "ready");
|
|
12549
|
+
return;
|
|
12550
|
+
}
|
|
12551
|
+
const setupStartMs = Date.now();
|
|
12552
|
+
await manager.updateWorktreeStatus(moduleUid, "setup");
|
|
12553
|
+
console.log(`[Worktree] EP1143: Running setup script asynchronously...`);
|
|
12554
|
+
const scriptResult = await manager.runSetupScript(moduleUid, effectiveSetupScript);
|
|
12555
|
+
console.log(`[Worktree] EP1373: setup_script phase=worktree_setup durationMs=${Date.now() - setupStartMs} moduleUid=${moduleUid} correlationId=${correlationId || "none"} success=${scriptResult.success}`);
|
|
12556
|
+
if (!scriptResult.success) {
|
|
12557
|
+
console.error(`[Worktree] EP1143: Setup script failed: ${scriptResult.error}`);
|
|
12558
|
+
await manager.updateWorktreeStatus(moduleUid, "error", scriptResult.error);
|
|
12559
|
+
return;
|
|
12560
|
+
}
|
|
12561
|
+
await manager.updateWorktreeStatus(moduleUid, "ready");
|
|
12562
|
+
})().catch(async (setupError) => {
|
|
12563
|
+
const errorMessage = setupError instanceof Error ? setupError.message : String(setupError);
|
|
12564
|
+
console.error(`[Worktree] EP1458: Async setup failed for ${moduleUid}: ${errorMessage}`);
|
|
12565
|
+
try {
|
|
12566
|
+
await manager.updateWorktreeStatus(moduleUid, "error", errorMessage);
|
|
12567
|
+
} catch (statusError) {
|
|
12568
|
+
console.error(`[Worktree] EP1458: Failed to update async setup error status: ${statusError.message}`);
|
|
12569
|
+
}
|
|
12570
|
+
});
|
|
12571
|
+
}, 0);
|
|
12563
12572
|
let previewUrl;
|
|
12564
12573
|
let port;
|
|
12574
|
+
const finalStatus = effectiveSetupScript ? "setup" : "ready";
|
|
12565
12575
|
if (moduleType === "ops") {
|
|
12566
12576
|
console.log(`[Worktree] EP1363: Skipping preview for ops module ${moduleUid}`);
|
|
12567
|
-
} else
|
|
12577
|
+
} else {
|
|
12568
12578
|
console.log(`[Worktree] EP1386: Skipping preview start during worktree create (deferred until module is doing)`);
|
|
12569
12579
|
}
|
|
12570
12580
|
console.log(`[Worktree] EP1373: worktree_create_total phase=worktree_create_total durationMs=${Date.now() - worktreeStartMs} moduleUid=${moduleUid} correlationId=${correlationId || "none"} status=${finalStatus}`);
|
|
12571
|
-
console.log(`[Worktree] EP1143: Worktree
|
|
12581
|
+
console.log(`[Worktree] EP1143: Worktree created for ${moduleUid} with status=${finalStatus}`);
|
|
12572
12582
|
return {
|
|
12573
12583
|
success: true,
|
|
12574
12584
|
worktreePath,
|
|
12575
12585
|
previewUrl,
|
|
12576
12586
|
port,
|
|
12577
|
-
status: finalStatus
|
|
12578
|
-
error: finalError
|
|
12587
|
+
status: finalStatus
|
|
12579
12588
|
};
|
|
12580
12589
|
} catch (error) {
|
|
12581
12590
|
console.error(`[Worktree] EP1143: Create failed: ${error.message}`);
|
|
@@ -13019,6 +13028,8 @@ function createCredentialBootstrap(payload, agentRunId) {
|
|
|
13019
13028
|
fs30.mkdirSync(codexHome, { recursive: true });
|
|
13020
13029
|
const authPath = path30.join(codexHome, "auth.json");
|
|
13021
13030
|
const authPayload = {
|
|
13031
|
+
auth_mode: "chatgpt",
|
|
13032
|
+
OPENAI_API_KEY: null,
|
|
13022
13033
|
tokens: {
|
|
13023
13034
|
access_token: bootstrap.oauth.access_token,
|
|
13024
13035
|
refresh_token: bootstrap.oauth.refresh_token,
|