Skip to content
This repository was archived by the owner on Apr 11, 2026. It is now read-only.

Commit d8cabda

Browse files
committed
Merge branch 'fn-68-worktree-flow-autofix' into main
2 parents 0bb64f9 + a326015 commit d8cabda

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

  • flowctl/crates/flowctl-cli/src/commands/workflow

flowctl/crates/flowctl-cli/src/commands/workflow/mod.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,27 @@ use flowctl_core::types::{
2121
Epic, Task,
2222
};
2323

24-
use super::helpers::{get_flow_dir, resolve_actor};
24+
use super::helpers::{ensure_flow_symlink, get_flow_dir, resolve_actor};
2525

2626
// ── Helpers ─────────────────────────────────────────────────────────
2727

28-
/// Ensure .flow/ exists, error_exit if not.
28+
/// Ensure .flow/ exists, auto-creating the symlink if needed.
29+
///
30+
/// In worktree environments (e.g., Claude Code `isolation: "worktree"`),
31+
/// `.flow/` may not exist because the worktree was created outside the
32+
/// flow-code worktree kit. Auto-create the symlink so workers are
33+
/// self-healing.
2934
pub(crate) fn ensure_flow_exists() -> PathBuf {
3035
let flow_dir = get_flow_dir();
3136
if !flow_dir.exists() {
32-
error_exit(".flow/ does not exist. Run 'flowctl init' first.");
37+
// Try to create the .flow/ symlink (idempotent).
38+
let cwd = env::current_dir().unwrap_or_else(|_| PathBuf::from("."));
39+
if let Err(e) = ensure_flow_symlink(&cwd) {
40+
error_exit(&format!(".flow/ does not exist and auto-create failed: {e}. Run 'flowctl init' first."));
41+
}
42+
if !flow_dir.exists() {
43+
error_exit(".flow/ does not exist. Run 'flowctl init' first.");
44+
}
3345
}
3446
flow_dir
3547
}

0 commit comments

Comments
 (0)