episoda 0.2.62 → 0.2.63

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.
@@ -2726,7 +2726,7 @@ var require_package = __commonJS({
2726
2726
  "package.json"(exports2, module2) {
2727
2727
  module2.exports = {
2728
2728
  name: "episoda",
2729
- version: "0.2.62",
2729
+ version: "0.2.63",
2730
2730
  description: "CLI tool for Episoda local development workflow orchestration",
2731
2731
  main: "dist/index.js",
2732
2732
  types: "dist/index.d.ts",
@@ -7091,23 +7091,40 @@ var WorktreeManager = class _WorktreeManager {
7091
7091
  /**
7092
7092
  * Initialize worktree manager from existing project root
7093
7093
  * EP971: All projects use worktree architecture
7094
+ * EP1093: Added debug logging for cloud container diagnostics
7094
7095
  * @returns true if valid project, false otherwise
7095
7096
  */
7096
7097
  async initialize() {
7098
+ const debug = process.env.EPISODA_DEBUG === "1" || process.env.GIT_CREDENTIAL_EPISODA_DEBUG === "1";
7097
7099
  if (!fs15.existsSync(this.bareRepoPath)) {
7100
+ if (debug) {
7101
+ console.log(`[WorktreeManager] initialize: .bare not found at ${this.bareRepoPath}`);
7102
+ }
7098
7103
  return false;
7099
7104
  }
7100
7105
  if (!fs15.existsSync(this.configPath)) {
7106
+ if (debug) {
7107
+ console.log(`[WorktreeManager] initialize: config not found at ${this.configPath}`);
7108
+ }
7101
7109
  return false;
7102
7110
  }
7103
7111
  try {
7104
7112
  const config = this.readConfig();
7105
7113
  if (config === null) {
7114
+ if (debug) {
7115
+ console.log(`[WorktreeManager] initialize: readConfig returned null`);
7116
+ }
7106
7117
  return false;
7107
7118
  }
7119
+ if (debug) {
7120
+ console.log(`[WorktreeManager] initialize: config loaded, projectId=${config.projectId}`);
7121
+ }
7108
7122
  await this.ensureFetchRefspecConfigured();
7109
7123
  return true;
7110
- } catch {
7124
+ } catch (error) {
7125
+ if (debug) {
7126
+ console.log(`[WorktreeManager] initialize: exception - ${error.message}`);
7127
+ }
7111
7128
  return false;
7112
7129
  }
7113
7130
  }
@@ -7719,20 +7736,43 @@ function getEpisodaRoot() {
7719
7736
  return process.env.EPISODA_ROOT || path16.join(require("os").homedir(), "episoda");
7720
7737
  }
7721
7738
  async function isWorktreeProject(projectRoot) {
7739
+ const debug = process.env.EPISODA_DEBUG === "1" || process.env.GIT_CREDENTIAL_EPISODA_DEBUG === "1";
7740
+ if (debug) {
7741
+ console.log(`[WorktreeManager] isWorktreeProject: checking ${projectRoot}`);
7742
+ }
7722
7743
  const manager = new WorktreeManager(projectRoot);
7723
- return manager.initialize();
7744
+ const result = await manager.initialize();
7745
+ if (debug) {
7746
+ console.log(`[WorktreeManager] isWorktreeProject: ${projectRoot} -> ${result}`);
7747
+ }
7748
+ return result;
7724
7749
  }
7725
7750
  async function findProjectRoot(startPath) {
7726
7751
  let current = path16.resolve(startPath);
7727
7752
  const episodaRoot = getEpisodaRoot();
7753
+ const debug = process.env.EPISODA_DEBUG === "1" || process.env.GIT_CREDENTIAL_EPISODA_DEBUG === "1";
7754
+ if (debug) {
7755
+ console.log(`[WorktreeManager] findProjectRoot: start=${startPath}, episodaRoot=${episodaRoot}`);
7756
+ }
7728
7757
  if (!current.startsWith(episodaRoot)) {
7758
+ if (debug) {
7759
+ console.log(`[WorktreeManager] findProjectRoot: ${current} is not under ${episodaRoot}`);
7760
+ }
7729
7761
  return null;
7730
7762
  }
7731
7763
  for (let i = 0; i < 10; i++) {
7732
7764
  const bareDir = path16.join(current, ".bare");
7733
7765
  const episodaDir = path16.join(current, ".episoda");
7766
+ if (debug) {
7767
+ const bareExists = fs15.existsSync(bareDir);
7768
+ const episodaExists = fs15.existsSync(episodaDir);
7769
+ console.log(`[WorktreeManager] findProjectRoot: checking ${current} (.bare=${bareExists}, .episoda=${episodaExists})`);
7770
+ }
7734
7771
  if (fs15.existsSync(bareDir) && fs15.existsSync(episodaDir)) {
7735
7772
  if (await isWorktreeProject(current)) {
7773
+ if (debug) {
7774
+ console.log(`[WorktreeManager] findProjectRoot: found valid project at ${current}`);
7775
+ }
7736
7776
  return current;
7737
7777
  }
7738
7778
  }
@@ -7742,6 +7782,9 @@ async function findProjectRoot(startPath) {
7742
7782
  }
7743
7783
  current = parent;
7744
7784
  }
7785
+ if (debug) {
7786
+ console.log(`[WorktreeManager] findProjectRoot: no project found`);
7787
+ }
7745
7788
  return null;
7746
7789
  }
7747
7790