Expand description
GitHub context extraction from Bash tool events.
This module parses Bash commands and their output to extract GitHub issue/PR references and worktree information. This provides more accurate context than branch name parsing alone, capturing:
- Explicit
gh issue/prcommands - GitHub URLs in command output (e.g., from
gh pr create) Fixes #Nreferences in PR bodies- Git worktree operations
§Usage
ⓘ
use mi6_core::github::{extract_context, SessionContextUpdate};
use std::path::Path;
let cwd = Path::new("/home/user/project");
let update = extract_context(
"gh issue view 52 --repo paradigmxyz/mi6",
None,
cwd,
);
assert_eq!(update.github_repo, Some("paradigmxyz/mi6".to_string()));
assert_eq!(update.github_issue, Some(52));Structs§
- Session
Context Update - Context update derived from a Bash tool event.
Functions§
- extract_
context - Extract all context from a Bash tool event.
- parse_
cd_ path - Parse cd command for directory changes.
- parse_
closes_ references - Parse PR body text for “Closes #N” references.
- parse_
gh_ command - Parse a Bash command for gh issue/pr references.
- parse_
git_ c_ path - Parse
git -C <path>from a command. - parse_
github_ urls - Parse tool output for GitHub URLs.
- parse_
worktree_ add - Parse git worktree add command.