This repository was archived by the owner on Apr 11, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
flowctl/crates/flowctl-cli/src/commands/workflow Expand file tree Collapse file tree Original file line number Diff line number Diff 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.
2934pub ( 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}
You can’t perform that action at this time.
0 commit comments