episoda 0.2.37 → 0.2.39

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.
@@ -1870,6 +1870,11 @@ var require_git_executor = __commonJS({
1870
1870
  { timeout: options?.timeout || 12e4 }
1871
1871
  // 2 minutes for clone
1872
1872
  );
1873
+ try {
1874
+ await execAsync2(`git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"`, { cwd: command.path, timeout: 5e3 });
1875
+ } catch (configError) {
1876
+ console.error("[git-executor] EP1014: Failed to configure fetch refspec:", configError);
1877
+ }
1873
1878
  return {
1874
1879
  success: true,
1875
1880
  output: `Cloned bare repository to ${command.path}`,
@@ -2721,7 +2726,7 @@ var require_package = __commonJS({
2721
2726
  "package.json"(exports2, module2) {
2722
2727
  module2.exports = {
2723
2728
  name: "episoda",
2724
- version: "0.2.36",
2729
+ version: "0.2.39",
2725
2730
  description: "CLI tool for Episoda local development workflow orchestration",
2726
2731
  main: "dist/index.js",
2727
2732
  types: "dist/index.d.ts",
@@ -5452,6 +5457,11 @@ async function startDevServer(projectPath, port = 3e3, moduleUid = "default", op
5452
5457
  });
5453
5458
  injectedEnvVars = result.envVars;
5454
5459
  console.log(`[DevServer] EP998: Loaded ${Object.keys(injectedEnvVars).length} env vars (from ${result.fromCache ? "cache" : "server"})`);
5460
+ const envFilePath = path12.join(projectPath, ".env");
5461
+ if (!fs11.existsSync(envFilePath) && Object.keys(injectedEnvVars).length > 0) {
5462
+ console.log(`[DevServer] EP1004: .env file missing, writing ${Object.keys(injectedEnvVars).length} vars to ${envFilePath}`);
5463
+ writeEnvFile(projectPath, injectedEnvVars);
5464
+ }
5455
5465
  } else {
5456
5466
  console.log(`[DevServer] EP998: No auth config, skipping env var injection`);
5457
5467
  }
@@ -5674,11 +5684,43 @@ var WorktreeManager = class _WorktreeManager {
5674
5684
  }
5675
5685
  try {
5676
5686
  const config = this.readConfig();
5677
- return config !== null;
5687
+ if (config === null) {
5688
+ return false;
5689
+ }
5690
+ await this.ensureFetchRefspecConfigured();
5691
+ return true;
5678
5692
  } catch {
5679
5693
  return false;
5680
5694
  }
5681
5695
  }
5696
+ /**
5697
+ * EP1014: Ensure fetch refspec is configured in bare repo
5698
+ * Older bare repos may be missing this configuration, causing stale worktrees
5699
+ */
5700
+ async ensureFetchRefspecConfigured() {
5701
+ try {
5702
+ const { execSync: execSync7 } = require("child_process");
5703
+ let fetchRefspec = null;
5704
+ try {
5705
+ fetchRefspec = execSync7("git config --get remote.origin.fetch", {
5706
+ cwd: this.bareRepoPath,
5707
+ encoding: "utf-8",
5708
+ timeout: 5e3
5709
+ }).trim();
5710
+ } catch {
5711
+ }
5712
+ if (!fetchRefspec) {
5713
+ console.log("[WorktreeManager] EP1014: Configuring missing fetch refspec for bare repo");
5714
+ execSync7('git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"', {
5715
+ cwd: this.bareRepoPath,
5716
+ timeout: 5e3
5717
+ });
5718
+ console.log("[WorktreeManager] EP1014: Fetch refspec configured successfully");
5719
+ }
5720
+ } catch (error) {
5721
+ console.warn("[WorktreeManager] EP1014: Failed to configure fetch refspec:", error);
5722
+ }
5723
+ }
5682
5724
  /**
5683
5725
  * Create a new worktree project from scratch
5684
5726
  */
@@ -5735,7 +5777,8 @@ var WorktreeManager = class _WorktreeManager {
5735
5777
  }
5736
5778
  const fetchResult = await this.gitExecutor.execute({
5737
5779
  action: "fetch",
5738
- remote: "origin"
5780
+ remote: "origin",
5781
+ branch: "+refs/heads/main:refs/remotes/origin/main"
5739
5782
  }, { cwd: this.bareRepoPath });
5740
5783
  if (!fetchResult.success && createBranch) {
5741
5784
  console.error("[worktree-manager] Failed to fetch from origin:", fetchResult.output);