Overview
Enhance the daf investigate command to accept an issue key argument, similar to how daf open <issue_key> works. This allows users to create investigation-only sessions directly from existing issue tracker tickets.
Current Behavior
Currently, daf investigate requires an explicit --goal parameter:
daf investigate --goal "Research Redis caching options"
daf investigate --goal "Investigate timeout issue" --parent PROJ-59038
Users working on investigation-focused tickets must:
- Read the ticket manually
- Copy the summary/description
- Create the investigation session with
--goal
Proposed Enhancement
Add support for passing an issue key directly:
# JIRA
daf investigate PROJ-12345
# GitHub/GitLab
daf investigate owner/repo#123
daf investigate #123
The command should:
- Auto-detect the issue tracker backend (JIRA/GitHub/GitLab)
- Fetch the ticket/issue details
- Use the ticket summary as the investigation goal
- Store the issue key for tracking
- Create an investigation-only session
Implementation Approach
Based on codebase analysis:
1. Command Signature Update
In devflow/cli/main.py, modify the investigate command to accept an optional positional argument:
@cli.command(name="investigate")
@click.argument("issue_key", required=False)
@click.option("--goal", help="Goal/description (overrides issue summary if issue_key provided)")
# ... existing options ...
def investigate(ctx, issue_key, goal, ...):
2. Issue Key Detection
Follow the pattern from open_command.py:326-351:
- Detect if argument matches issue key pattern
- Determine backend (JIRA vs GitHub/GitLab)
- Fetch issue/ticket details
- Extract summary and description
3. Backend-Specific Fetching
JIRA:
from devflow.jira.utils import is_issue_key_pattern, validate_jira_ticket
from devflow.jira import JiraClient
if is_issue_key_pattern(issue_key):
jira_client = JiraClient()
ticket = jira_client.get_ticket(issue_key)
goal = ticket.get("summary")
parent = None # Could use epic link if available
GitHub/GitLab:
from devflow.github.utils import parse_github_issue_key
from devflow.github import GitHubClient
owner, repo, number = parse_github_issue_key(issue_key)
github_client = GitHubClient()
issue = github_client.get_issue(owner, repo, number)
goal = issue.get("title")
4. Session Creation
Pass extracted data to existing create_investigation_session():
create_investigation_session(
goal=goal,
parent=issue_key, # Track under the original ticket
name=name or f"investigate-{issue_key}",
# ... other params
)
5. Initial Prompt Enhancement
Update _build_investigation_prompt() to include issue details when created from ticket:
- Link to original issue
- Include issue description/requirements
- Reference acceptance criteria (if available)
Acceptance Criteria
Technical Details
Files to Modify
-
devflow/cli/main.py (~line 1917-1956)
- Add
issue_key argument to investigate command
- Add logic to detect and fetch issue
-
devflow/cli/commands/investigate_command.py
- Update
create_investigation_session() to handle issue_key
- Add issue fetching logic
- Update
_build_investigation_prompt() to include issue details
-
Tests
tests/test_investigate_command.py - Add tests for issue key support
integration-tests/test_investigation.sh - Add integration tests
-
Documentation
AGENTS.md - Update command examples
devflow/cli_skills/daf-workflow/SKILL.md - Update workflow guidance
- Command help text
Edge Cases to Handle
- Issue key matches existing session name (prefer session name)
- Issue not found / access denied
- Both
issue_key and --goal provided (goal overrides)
- Invalid issue key format
- Network/API failures when fetching issue
- Investigation session already exists for this issue
Similar Patterns in Codebase
This enhancement mirrors existing patterns:
daf open <issue_key> (devflow/cli/commands/open_command.py:326-351)
daf jira open <issue_key> (devflow/cli/commands/jira_open_command.py)
daf git new <type> (devflow/cli/commands/git_new_command.py)
Benefits
- Faster workflow: Users can jump directly from issue to investigation
- Consistency: Matches
daf open <issue_key> pattern
- Auto-tracking: Issue key automatically linked to investigation session
- Better context: Initial prompt includes full issue details
- Reduced errors: No manual copy-paste of ticket summaries
Example Workflows
Before (Current)
# User opens JIRA ticket in browser
# Copies summary: "Investigate Redis caching for subscription API"
daf investigate --goal "Investigate Redis caching for subscription API" --parent PROJ-12345
After (Enhanced)
# Direct from issue key
daf investigate PROJ-12345
Related
- Existing:
daf open <issue_key> for development sessions
- Existing:
daf jira new <type> for ticket creation sessions
- This enhancement:
daf investigate <issue_key> for investigation sessions
Overview
Enhance the
daf investigatecommand to accept an issue key argument, similar to howdaf open <issue_key>works. This allows users to create investigation-only sessions directly from existing issue tracker tickets.Current Behavior
Currently,
daf investigaterequires an explicit--goalparameter:Users working on investigation-focused tickets must:
--goalProposed Enhancement
Add support for passing an issue key directly:
The command should:
Implementation Approach
Based on codebase analysis:
1. Command Signature Update
In
devflow/cli/main.py, modify theinvestigatecommand to accept an optional positional argument:2. Issue Key Detection
Follow the pattern from
open_command.py:326-351:3. Backend-Specific Fetching
JIRA:
GitHub/GitLab:
4. Session Creation
Pass extracted data to existing
create_investigation_session():5. Initial Prompt Enhancement
Update
_build_investigation_prompt()to include issue details when created from ticket:Acceptance Criteria
daf investigate <JIRA-KEY>creates investigation session from JIRA ticketdaf investigate owner/repo#123creates investigation session from GitHub issuedaf investigate #123creates investigation session from GitHub issue (current repo)investigate-<issue-key>if not provided--goalflag still works and overrides issue summary if both provideddaf investigate --helpreflects new usageTechnical Details
Files to Modify
devflow/cli/main.py (~line 1917-1956)
issue_keyargument toinvestigatecommanddevflow/cli/commands/investigate_command.py
create_investigation_session()to handle issue_key_build_investigation_prompt()to include issue detailsTests
tests/test_investigate_command.py- Add tests for issue key supportintegration-tests/test_investigation.sh- Add integration testsDocumentation
AGENTS.md- Update command examplesdevflow/cli_skills/daf-workflow/SKILL.md- Update workflow guidanceEdge Cases to Handle
issue_keyand--goalprovided (goal overrides)Similar Patterns in Codebase
This enhancement mirrors existing patterns:
daf open <issue_key>(devflow/cli/commands/open_command.py:326-351)daf jira open <issue_key>(devflow/cli/commands/jira_open_command.py)daf git new <type>(devflow/cli/commands/git_new_command.py)Benefits
daf open <issue_key>patternExample Workflows
Before (Current)
After (Enhanced)
# Direct from issue key daf investigate PROJ-12345Related
daf open <issue_key>for development sessionsdaf jira new <type>for ticket creation sessionsdaf investigate <issue_key>for investigation sessions