Module github

Module github 

Source
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/pr commands
  • GitHub URLs in command output (e.g., from gh pr create)
  • Fixes #N references 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§

SessionContextUpdate
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.