Overview
Currently, daf investigate requires project/repository selection either via --path flag, --projects flag with workspace, or interactive workspace selection. For generic investigations not tied to a specific project, this workflow is cumbersome.
Current Behavior
The daf investigate command handles project selection in this order:
- Multi-project mode (via
--projects + --workspace): Specify multiple repos explicitly
- Direct path (via
--path): Bypass workspace selection entirely
- Interactive workspace selection: Calls
prompt_repository_selection_with_multiproject()
- If workspace selected: prompts for repo(s) from that workspace
- If no workspace: falls back to current directory automatically
Issue: Step 3's automatic fallback to current directory doesn't give users control over WHERE they want to work.
Requested Enhancement
Make project/repo selection truly optional with an interactive prompt when no path is specified:
Prompt options when no --path or --projects specified:
- ✅ Work in current directory - Use
os.getcwd() as-is
- ✅ Clone to temp directory - If current dir is a git repo, offer temp clone (uses existing
prompt_and_clone_to_temp() logic)
- ✅ Specify a different path - Allow entering arbitrary path
- ✅ Select from workspace - Existing workspace selection flow
- ❌ Cancel - Exit without creating session
Use Cases
Generic research not tied to a repo:
daf investigate --goal "Research Redis caching patterns"
# Prompt: Where do you want to work?
# 1. Current directory (/Users/dev/notes)
# 2. Specify a different path
# 3. Select from workspace
# 4. Cancel
Investigation in current repo with clean state:
cd /workspace/my-project
daf investigate --goal "Analyze authentication flow"
# Prompt: Where do you want to work?
# 1. Current directory (/workspace/my-project)
# 2. Clone to temp directory (clean main branch)
# 3. Specify a different path
# 4. Select from workspace
# 5. Cancel
Quick investigation without workspace setup:
daf investigate --goal "Explore API patterns" --path ~/Documents/notes
# No prompt - directly uses specified path
Implementation Notes
Files to modify:
devflow/cli/commands/investigate_command.py:
- Lines 186-200: Replace
prompt_repository_selection_with_multiproject() call with new prompting logic
- Add
_prompt_for_investigation_location() helper function
Key changes:
def _prompt_for_investigation_location(config) -> tuple[Optional[str], bool]:
"""Prompt user where they want to conduct investigation.
Returns:
Tuple of (project_path, is_temp_clone)
Returns (None, False) if user cancels
"""
from rich.prompt import Prompt
current_dir = Path.cwd()
is_git_repo = GitUtils.is_git_repository(current_dir)
options = [
f"1. Work in current directory ({current_dir})",
]
if is_git_repo:
options.append("2. Clone to temp directory (clean main branch)")
options.append("3. Specify a different path")
options.append("4. Select from workspace")
options.append("5. Cancel")
choice_map = {
"1": ("current", False),
"2": ("temp", True),
"3": ("specify", False),
"4": ("workspace", False),
"5": ("cancel", False)
}
else:
options.append("2. Specify a different path")
options.append("3. Select from workspace")
options.append("4. Cancel")
choice_map = {
"1": ("current", False),
"2": ("specify", False),
"3": ("workspace", False),
"4": ("cancel", False)
}
console.print("\n[cyan]Where do you want to work?[/cyan]")
for option in options:
console.print(f" {option}")
choice = Prompt.ask("Select option", default="1")
action, is_temp = choice_map.get(choice, ("cancel", False))
if action == "cancel":
return None, False
elif action == "current":
return str(current_dir), False
elif action == "temp":
# Use existing temp clone logic
from devflow.utils.temp_directory import prompt_and_clone_to_temp
result = prompt_and_clone_to_temp(current_dir)
if result:
temp_dir, original_path = result
return temp_dir, True
return str(current_dir), False # Fallback if clone fails
elif action == "specify":
custom_path = Prompt.ask("Enter path")
path = Path(custom_path).expanduser().absolute()
if not path.exists():
console.print(f"[red]✗[/red] Path does not exist: {path}")
return None, False
return str(path), False
elif action == "workspace":
# Use existing workspace selection
project_paths, workspace_name = prompt_repository_selection_with_multiproject(
config, allow_multiple=False
)
if project_paths:
return project_paths[0], False
return None, False
Integration point in create_investigation_session():
# Around line 186-200, replace:
else:
# Prompt for repository selection from workspace...
from devflow.cli.utils import prompt_repository_selection_with_multiproject
project_paths, selected_workspace_name = prompt_repository_selection_with_multiproject(...)
# With:
else:
# Prompt user where they want to work
project_path, needs_temp_clone = _prompt_for_investigation_location(config)
if not project_path:
# User cancelled
if is_json_mode():
output_json(success=False, error={"message": "Investigation cancelled", "code": "CANCELLED"})
sys.exit(0)
# Note: temp_clone logic already exists below, will be triggered by needs_temp_clone flag
Acceptance Criteria
Testing Checklist
# Test 1: No flags, current dir (git repo)
cd /workspace/my-repo
daf investigate --goal "Test"
# Should prompt with 5 options including temp clone
# Test 2: No flags, current dir (non-git)
cd ~/Documents
daf investigate --goal "Test"
# Should prompt with 4 options (no temp clone option)
# Test 3: With --path flag
daf investigate --goal "Test" --path /tmp
# Should skip all prompts, use /tmp directly
# Test 4: With --projects + --workspace
daf investigate --goal "Test" --projects "repo1,repo2" --workspace default
# Should skip prompts, use multi-project mode
# Test 5: JSON mode
DAF_MOCK_MODE=1 daf investigate --goal "Test" --json
# Should skip prompts, use default (current directory)
# Test 6: Cancel flow
daf investigate --goal "Test"
# Choose option 5 (Cancel)
# Should exit without creating session
Related Code
devflow/cli/commands/investigate_command.py: Main command implementation
devflow/cli/utils.py: prompt_repository_selection_with_multiproject()
devflow/utils/temp_directory.py: prompt_and_clone_to_temp(), should_clone_to_temp()
devflow/git/utils.py: GitUtils.is_git_repository()
Benefits
- Flexibility: Generic investigations don't require workspace setup
- User control: Explicit choice of working directory
- Better UX: Clear options instead of automatic fallback
- Backward compatible: Existing
--path and --projects workflows unchanged
- Consistent: Aligns with DevAIFlow's philosophy of explicit, user-controlled workflows
Overview
Currently,
daf investigaterequires project/repository selection either via--pathflag,--projectsflag with workspace, or interactive workspace selection. For generic investigations not tied to a specific project, this workflow is cumbersome.Current Behavior
The
daf investigatecommand handles project selection in this order:--projects+--workspace): Specify multiple repos explicitly--path): Bypass workspace selection entirelyprompt_repository_selection_with_multiproject()Issue: Step 3's automatic fallback to current directory doesn't give users control over WHERE they want to work.
Requested Enhancement
Make project/repo selection truly optional with an interactive prompt when no path is specified:
Prompt options when no
--pathor--projectsspecified:os.getcwd()as-isprompt_and_clone_to_temp()logic)Use Cases
Generic research not tied to a repo:
Investigation in current repo with clean state:
Quick investigation without workspace setup:
Implementation Notes
Files to modify:
devflow/cli/commands/investigate_command.py:prompt_repository_selection_with_multiproject()call with new prompting logic_prompt_for_investigation_location()helper functionKey changes:
Integration point in
create_investigation_session():Acceptance Criteria
daf investigateis run without--pathor--projects, user is prompted with location options--pathflag still bypasses all prompts (backward compatibility)--projects+--workspacestill works for multi-project mode--temp-clone/--no-temp-cloneflags override prompt behavior--json) skips interactive prompts and uses sensible defaultsTesting Checklist
Related Code
devflow/cli/commands/investigate_command.py: Main command implementationdevflow/cli/utils.py:prompt_repository_selection_with_multiproject()devflow/utils/temp_directory.py:prompt_and_clone_to_temp(),should_clone_to_temp()devflow/git/utils.py:GitUtils.is_git_repository()Benefits
--pathand--projectsworkflows unchanged