### Install and Run git-mux Source: https://context7.com/nooesc/git-mux/llms.txt Instructions for building and installing git-mux from source using cargo, and running the application. It also shows how to set the GITHUB_TOKEN environment variable for authentication. ```bash # Build and install from source cargo install --path . # Run the application git-mux # On first run, enter your GitHub personal access token when prompted # Or set it via environment variable before running export GITHUB_TOKEN=ghp_your_token_here git-mux ``` -------------------------------- ### TOML Configuration for git-mux Source: https://context7.com/nooesc/git-mux/llms.txt Example of a TOML configuration file for git-mux, detailing settings for refresh intervals, repository and organization inclusions/exclusions, and workspace management. ```toml [general] refresh_interval_secs = 60 # Auto-refresh interval default_view = "repos" # Default view on startup [orgs] include = [] # Only show these orgs (empty = all) exclude = ["some-org"] # Hide repos from these orgs [repos] exclude = ["owner/repo-name"] # Hide specific repos [workspaces] dir = "~/dev-mux" # Where cloned workspaces live source_dirs = ["~/dev-personal", "~/dev-work"] # Existing checkout dirs for env file copying cleanup_after_days = 7 # Auto-remove stale workspaces (0 to disable) ``` -------------------------------- ### GET /repos/{owner}/{repo}/actions/runs Source: https://context7.com/nooesc/git-mux/llms.txt Fetches recent CI workflow runs for a repository. ```APIDOC ## GET /repos/{owner}/{repo}/actions/runs ### Description Retrieves recent CI workflow runs including status, conclusion, and duration. ### Method GET ### Endpoint /repos/{owner}/{repo}/actions/runs ### Response #### Success Response (200) - **id** (Integer) - Workflow run ID. - **name** (String) - Workflow name. - **status** (String) - Current status. - **conclusion** (String) - Final result. ``` -------------------------------- ### GET /repos/{owner}/{repo}/issues Source: https://context7.com/nooesc/git-mux/llms.txt Fetches issues for a specific repository with pagination support. ```APIDOC ## GET /repos/{owner}/{repo}/issues ### Description Returns open and closed issues for a repository, sorted by update time. ### Method GET ### Endpoint /repos/{owner}/{repo}/issues ### Parameters #### Path Parameters - **owner** (String) - Required - The account owner. - **repo** (String) - Required - The repository name. ### Response #### Success Response (200) - **number** (Integer) - Issue ID. - **state** (String) - Open or closed. - **title** (String) - Issue title. - **comments** (Integer) - Comment count. ``` -------------------------------- ### GET /user/contributions Source: https://context7.com/nooesc/git-mux/llms.txt Fetches the authenticated user's contribution data for heatmap visualization. ```APIDOC ## GET /user/contributions ### Description Retrieves contribution calendar data. ### Method GET ### Endpoint /user/contributions ### Response #### Success Response (200) - **total_contributions** (Integer) - Sum of contributions. - **weeks** (Array) - List of weekly contribution data. ``` -------------------------------- ### GET /repos/{owner}/{repo}/pulls Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves all pull requests for a specific repository, including open, closed, and merged statuses. ```APIDOC ## GET /repos/{owner}/{repo}/pulls ### Description Fetches all pull requests for a specific repository sorted by most recently updated. ### Method GET ### Endpoint /repos/{owner}/{repo}/pulls ### Parameters #### Path Parameters - **owner** (String) - Required - The account owner of the repository. - **repo** (String) - Required - The name of the repository. ### Response #### Success Response (200) - **number** (Integer) - PR number. - **title** (String) - PR title. - **merged** (Boolean) - Whether the PR is merged. - **state** (String) - Current state (open/closed). ``` -------------------------------- ### New Message Variants for TUI Communication Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Defines new message variants used for communication within the TUI. These messages handle events such as showing action menus, user selections, dismissing menus, starting work operations, and receiving asynchronous callbacks for workspace operations. ```text New `Message` variants: - `ShowActionMenu` — triggered by Enter on an Issue/PR item - `ActionMenuSelect` — triggered by Enter within the action menu - `ActionMenuDismiss` — triggered by Esc within the action menu - `StartWork` — begins the clone + branch + tmux flow - `WorkspaceReady` / `WorkspaceError` — async callbacks when the operation completes or fails - `BranchNameSubmit` — user confirms branch name on Home screen ``` -------------------------------- ### Create GitHub Client (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Shows how to instantiate an authenticated `GitHubClient` in Rust. This involves fetching the user's GitHub token and loading their profile information, returning a thread-safe client instance. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { // Create authenticated client (fetches user info) let client = GitHubClient::new().await?; println!("Logged in as: {}", client.username); println!("Avatar URL: {}", client.user_info.avatar_url); println!("Public repos: {}", client.user_info.public_repos); println!("Followers: {}", client.user_info.followers); if let Some(name) = &client.user_info.name { println!("Name: {}", name); } if let Some(bio) = &client.user_info.bio { println!("Bio: {}", bio); } Ok(()) } ``` -------------------------------- ### Manage Startup and Repo Caches Source: https://context7.com/nooesc/git-mux/llms.txt Provides disk-based persistence for startup data and repository details. Caches are versioned and include freshness checks to minimize network requests. ```rust use git_mux::cache::{load_startup_cache, save_startup_cache, StartupCache, load_repo_detail_cache, save_repo_detail_cache, RepoDetailCache, repo_detail_cache_is_fresh}; fn main() -> anyhow::Result<()> { if let Some(cache) = load_startup_cache() { println!("Cache loaded from: {}", cache.saved_at); } let repo_name = "owner/repo"; if let Some(detail) = load_repo_detail_cache(repo_name) { if repo_detail_cache_is_fresh(detail.saved_at) { println!("Cache is fresh - skip network fetch"); } } let mut detail = RepoDetailCache::new(repo_name.to_string()); save_repo_detail_cache(&detail)?; Ok(()) } ``` -------------------------------- ### Fetch All Repositories via GitHub Client (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Demonstrates fetching all repositories (personal and organizational) for the authenticated user using `GitHubClient::fetch_all_repos()`. The results are deduplicated and sorted by the last push date. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch all repos (personal + orgs, deduplicated, sorted by push date) let repos = client.fetch_all_repos().await?; for repo in repos.iter().take(10) { println!("{}", repo.full_name); println!(" Stars: {} | Forks: {} | Issues: {}", repo.stargazers_count, repo.forks_count, repo.open_issues_count); if let Some(desc) = &repo.description { println!(" {}", desc); } if let Some(lang) = &repo.language { println!(" Language: {}", lang); } println!(" Private: {} | URL: {}", repo.is_private, repo.html_url); } Ok(()) } ``` -------------------------------- ### Cache Module: Startup and Repository Details Source: https://context7.com/nooesc/git-mux/llms.txt Provides functions for managing application startup caches and repository-specific detail caches, optimizing load times by persisting data to disk with versioning and expiration. ```APIDOC ## Cache Module: Startup and Repository Details ### Description The cache module provides fast startup by persisting data to disk. Caches are versioned and expire after 7 days. ### Functions - `load_startup_cache() -> Option`: Loads the main startup cache. - `save_startup_cache(cache: &StartupCache) -> Result<()>`: Saves the startup cache. - `load_repo_detail_cache(repo_name: &str) -> Option`: Loads the detail cache for a specific repository. - `save_repo_detail_cache(detail: &RepoDetailCache) -> Result<()>`: Saves the repository detail cache. - `repo_detail_cache_is_fresh(saved_at: DateTime) -> bool`: Checks if the repository detail cache is considered fresh (within 15 minutes). ### Data Structures - `StartupCache`: Contains cached data like repositories, user info, contributions, and notifications. - `RepoDetailCache`: Contains detailed information for a specific repository, such as PRs, issues, and commits. ### Usage Examples ```rust use git_mux::cache::{ load_startup_cache, save_startup_cache, StartupCache, load_repo_detail_cache, save_repo_detail_cache, RepoDetailCache, repo_detail_cache_is_fresh, }; use chrono::Utc; // Load and save startup cache if let Some(cache) = load_startup_cache() { println!("Cache loaded from: {}", cache.saved_at); } let mut cache = StartupCache::fresh_from_previous(load_startup_cache()); save_startup_cache(&cache)?; // Load and save repo detail cache let repo_name = "owner/repo"; if let Some(detail) = load_repo_detail_cache(repo_name) { println!("Detail cache for {}: {} PRs, {} issues", repo_name, detail.prs.len(), detail.issues.len()); if repo_detail_cache_is_fresh(detail.saved_at) { println!("Cache is fresh - skip network fetch"); } } let mut detail = RepoDetailCache::new(repo_name.to_string()); save_repo_detail_cache(&detail)?; ``` ``` -------------------------------- ### Load git-mux Configuration (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Demonstrates how to load the git-mux configuration from the default TOML file using the `Config::load()` function in Rust. It prints various configuration settings to the console. ```rust use git_mux::config::Config; fn main() -> anyhow::Result<()> { // Load config (creates default if not present) let config = Config::load()?; println!("Refresh interval: {}s", config.general.refresh_interval_secs); println!("Excluded orgs: {:?}", config.orgs.exclude); println!("Excluded repos: {:?}", config.repos.exclude); println!("Workspace dir: {}", config.workspaces.dir); println!("Source dirs: {:?}", config.workspaces.source_dirs); println!("Cleanup after: {} days", config.workspaces.cleanup_after_days); Ok(()) } ``` -------------------------------- ### Tmux Integration for Workspace Opening Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Details how git-mux integrates with tmux to open workspaces. It prioritizes selecting an existing tmux pane with the matching working directory. If none exists, it creates a new tmux window. It also includes logic for detecting if the application is running within tmux. ```text Open workspace: find an existing tmux pane whose cwd matches the workspace directory. If found, select that window. If not, create a new window with `tmux new-window -n -c ` Detection: use `tmux list-panes -a -F '#{pane_current_path}'` to match by working directory, not window name (avoids name collisions across repos) If git-mux detects it is not running inside tmux (`$TMUX` env var absent), skip tmux window creation and show the workspace path in the status line instead ``` -------------------------------- ### Testing Considerations for Git-Mux Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Outlines key areas that require thorough testing within the git-mux project. This includes edge cases in branch name generation, different source matching scenarios, correctness of environment file copying, safety of workspace cleanup, idempotency of operations, and validation of branch names. ```text Slug generation: branch names with slashes, unicode, long titles, special chars Source matching: SSH vs HTTPS remote URLs, repos at different depths in source_dirs, no-match fallback Env file copying: `.env*` glob correctness, size cap enforcement, symlink skip Cleanup safety: skip dirty workspaces, skip workspaces with active tmux panes, respect `cleanup_after_days = 0` Idempotency: existing workspace reopens instead of failing, `git fetch` updates on reopen Branch validation: reject invalid ref names, handle max length, sanitize directory slug separately ``` -------------------------------- ### Manage Application State with Elm-style Updates in Rust Source: https://context7.com/nooesc/git-mux/llms.txt Demonstrates the central update function used to handle state transitions in git-mux. It shows how to initialize the AppState and process various messages like navigation, view toggling, and search inputs. ```rust use git_mux::app::{AppState, Message, Screen, RepoSection, ViewMode, update}; fn main() { // Initialize application state let mut state = AppState::new(); // State starts on Home screen assert_eq!(state.screen, Screen::Home); assert_eq!(state.view_mode, ViewMode::Cards); // Navigation messages update(&mut state, Message::Down); // Move selection down update(&mut state, Message::Up); // Move selection up update(&mut state, Message::Left); // Move left / prev tab update(&mut state, Message::Right); // Move right / next tab // View mode toggle update(&mut state, Message::ToggleListMode); assert_eq!(state.view_mode, ViewMode::List); // Search update(&mut state, Message::EnterSearch); assert!(state.search_mode); update(&mut state, Message::SearchInput('r')); update(&mut state, Message::SearchInput('u')); update(&mut state, Message::SearchInput('s')); update(&mut state, Message::SearchInput('t')); assert_eq!(state.search_input, "rust"); update(&mut state, Message::ConfirmSearch); assert_eq!(state.search_query, "rust"); // Quit update(&mut state, Message::Quit); assert!(state.should_quit); } ``` -------------------------------- ### Core Git Commands Used by Git-Mux Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Lists essential Git commands that git-mux utilizes for its operations. These include cloning repositories, checking out branches, fetching updates, retrieving remote URLs, and checking the status of the workspace. ```bash git clone git checkout -b git fetch origin pull//head: git -C remote get-url origin git status --porcelain ``` -------------------------------- ### Clone Repository to Workspace (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Initializes a WorkspaceOps handler and clones repositories into a structured workspace directory. The path follows the pattern `~/workspaces/owner/repo/branch-slug/`. It determines the clone URL based on source repository configuration and handles existing workspaces. Requires 'git-mux' and 'std::path::PathBuf'. ```rust use git_mux::workspace::{WorkspaceOps, clone_url, find_source_repo}; use std::path::PathBuf; fn main() -> anyhow::Result<()> { // Initialize workspace operations with base directory let ws = WorkspaceOps::new("~/dev-mux".to_string()); // Check if workspace already exists if ws.workspace_exists("owner", "repo", "issue-123-fix-bug") { println!("Workspace already exists"); let ws_dir = ws.workspace_dir("owner", "repo", "issue-123-fix-bug"); println!("Path: {:?}", ws_dir); } else { // Find source repo for env files and protocol detection let source_dirs = vec!["~/dev-personal".to_string()]; let source = find_source_repo(&source_dirs, "owner", "repo"); // Determine clone URL (SSH if source uses SSH, else HTTPS) let source_remote = source.as_ref() .and_then(|p| git_mux::workspace::get_remote_url(p)); let url = clone_url(source_remote.as_deref(), "owner", "repo"); // Clone the repository let ws_dir = ws.clone_repo(&url, "owner", "repo", "issue-123-fix-bug")?; println!("Cloned to: {:?}", ws_dir); } Ok(()) } ``` -------------------------------- ### Core Tmux Commands Used by Git-Mux Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Lists essential tmux commands that git-mux utilizes for managing terminal sessions. This includes listing panes with their current paths for workspace detection and creating new windows with a specified working directory. ```bash tmux list-panes -a -F '#{pane_current_path}' tmux new-window -n -c ``` -------------------------------- ### Keyboard Navigation Source: https://context7.com/nooesc/git-mux/llms.txt Describes the keyboard navigation paradigm used within the git-mux application, emphasizing its vim-style bindings and context-dependent key assignments. ```APIDOC ## Keyboard Navigation ### Description git-mux uses vim-style keyboard navigation throughout the application. The key bindings vary based on the current screen and focus area. ### Overview Users can navigate and interact with git-mux using familiar vim keybindings. The specific commands available will change depending on the active view or component (e.g., file explorer, commit history, issue tracker). ### Example Key Bindings (Illustrative) - `j`/`k`: Navigate up/down lists. - `h`/`l`: Navigate between tabs or sections. - `Enter`: Select an item or open a file/directory. - `?`: Display help or keybinding reference for the current context. *Note: Actual keybindings are dynamic and context-sensitive. Refer to the application's help screen for precise details.* ``` -------------------------------- ### Copy Environment Files (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Copies environment files (e.g., .env, .env.local) from a source repository to a specified workspace directory. It intelligently finds source repositories and skips files larger than 1MB or symlinks for security. Requires 'git-mux' and 'std::path::Path'. ```rust use git_mux::workspace::{copy_env_files, find_source_repo}; use std::path::Path; fn main() -> anyhow::Result<()> { // Find source repo with existing env files let source_dirs = vec!["~/dev-personal".to_string(), "~/dev-work".to_string()]; if let Some(source_path) = find_source_repo(&source_dirs, "owner", "repo") { let workspace_path = Path::new("/home/user/dev-mux/owner/repo/feature-branch"); // Copy .env, .env.local, .env.development, etc. let copied_count = copy_env_files(&source_path, workspace_path)?; println!("Copied {} environment files", copied_count); // Files over 1MB and symlinks are skipped for safety } else { println!("No local source repo found - env files not copied"); } Ok(()) } ``` -------------------------------- ### Fetch repository issues Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves issues for a specified repository with support for pagination. Returns both open and closed issues sorted by their update time. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch issues for a specific repo let issues = client.fetch_repo_issues("owner", "repo-name").await?; for issue in issues { println!("#{} [{}] {}", issue.number, issue.state, issue.title); println!(" Author: {} | Comments: {}", issue.user, issue.comments); if !issue.labels.is_empty() { println!(" Labels: {}", issue.labels.join(", ")); } println!(" URL: {}", issue.html_url); } Ok(()) } ``` -------------------------------- ### Fetch repository open counts via GraphQL Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves accurate open issue and pull request counts for multiple repositories. It processes repositories in batches of 20 to optimize API performance. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; let repos = client.fetch_all_repos().await?; // Fetch accurate issue/PR counts via GraphQL let counts = client.fetch_repo_open_counts(&repos).await?; for count in counts.iter().take(5) { println!("{}: {} open issues, {} open PRs", count.full_name, count.open_issues_count, count.open_prs_count); } Ok(()) } ``` -------------------------------- ### POST /graphql/repo-counts Source: https://context7.com/nooesc/git-mux/llms.txt Fetches accurate open issue and PR counts for multiple repositories using the GitHub GraphQL API. ```APIDOC ## POST /graphql/repo-counts ### Description Fetches accurate open issue and PR counts for multiple repositories. Processes repositories in batches of 20 for efficiency. ### Method POST ### Endpoint /graphql/repo-counts ### Parameters #### Request Body - **repos** (Array) - Required - List of repository objects to query. ### Response #### Success Response (200) - **full_name** (String) - Repository identifier. - **open_issues_count** (Integer) - Count of open issues. - **open_prs_count** (Integer) - Count of open pull requests. ``` -------------------------------- ### Fetch repository CI workflow runs Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves recent CI workflow runs for a repository, providing details on status, conclusion, execution duration, and branch context. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch recent CI runs let runs = client.fetch_repo_ci("owner", "repo-name").await?; for run in runs { let conclusion = run.conclusion.as_deref().unwrap_or("pending"); let duration = run.duration_secs .map(|d| format!("{}s", d)) .unwrap_or_else(|| "running".to_string()); println!("[{}] {} - {} ({})", run.status, run.name, conclusion, duration); println!(" Branch: {} | ID: {}", run.head_branch, run.id); println!(" URL: {}", run.html_url); } Ok(()) } ``` -------------------------------- ### Manage Tmux Workspace Windows Source: https://context7.com/nooesc/git-mux/llms.txt Handles opening workspaces in tmux windows. It checks if the current environment is inside tmux and intelligently reuses existing windows if the directory is already active. ```rust use git_mux::workspace::{open_tmux_window, is_inside_tmux}; use std::path::Path; fn main() -> anyhow::Result<()> { if !is_inside_tmux() { println!("Not running inside tmux - workspace path will be shown instead"); return Ok(()); } let workspace_dir = Path::new("/home/user/dev-mux/owner/repo/feature-branch"); let window_name = "feature-branch"; open_tmux_window(workspace_dir, window_name)?; println!("Opened tmux window for workspace"); Ok(()) } ``` -------------------------------- ### Manage Branches in Workspace (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Handles creating new branches for issues or checking out existing Pull Request branches within workspace directories. It utilizes helper functions for generating branch names and directory slugs. Requires 'git-mux' and 'std::path::Path'. ```rust use git_mux::workspace::{WorkspaceOps, issue_branch_name, pr_dir_slug}; use std::path::Path; fn main() -> anyhow::Result<()> { let ws = WorkspaceOps::new("~/dev-mux".to_string()); // For an issue: create a new branch let issue_branch = issue_branch_name(123, "Fix authentication timeout"); // Result: "issue-123-fix-authentication-timeout" let ws_dir = ws.workspace_dir("owner", "repo", &issue_branch); // After cloning, create and checkout the branch WorkspaceOps::checkout_new_branch(&ws_dir, &issue_branch)?; println!("Created branch: {}", issue_branch); // For a PR: fetch and checkout the PR's head ref let pr_number = 456u64; let pr_slug = pr_dir_slug(pr_number, "Add new feature"); // Result: "pr-456-add-new-feature" let pr_ws_dir = ws.workspace_dir("owner", "repo", &pr_slug); // After cloning, fetch and checkout PR WorkspaceOps::checkout_pr(&pr_ws_dir, pr_number, "feature-branch")?; println!("Checked out PR #{}", pr_number); Ok(()) } ``` -------------------------------- ### Workspace Cleanup Logic Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md This logic describes the process for cleaning up old Git workspaces. It involves checking modification times, uncommitted changes, and active tmux panes to determine if a workspace should be removed. The cleanup is performed once on application startup. ```text 1. Find the most recently modified file (recursive) to determine true last-activity time 2. Check `git status --porcelain` — if the workspace has uncommitted changes, skip it regardless of age 3. If older than `cleanup_after_days` AND no tmux pane has its cwd set to this workspace → remove it 4. If a tmux pane is using this directory → skip, regardless of file age ``` -------------------------------- ### Tmux Integration: Window Management Source: https://context7.com/nooesc/git-mux/llms.txt Functions to interact with tmux, allowing workspaces to be opened in new or existing tmux windows intelligently, and checking if the current environment is within tmux. ```APIDOC ## Tmux Integration: Window Management ### Description Opens workspaces in tmux windows with intelligent window reuse. If a pane already has the workspace directory as its cwd, selects that window instead of creating a new one. ### Functions - `open_tmux_window(workspace_dir: &Path, window_name: &str) -> Result<()>`: Opens or selects a tmux window for the given workspace directory. - `is_inside_tmux() -> bool`: Checks if the current process is running inside a tmux session. ### Usage Examples ```rust use git_mux::workspace::{open_tmux_window, is_inside_tmux}; use std::path::Path; // Check if running inside tmux if !is_inside_tmux() { println!("Not running inside tmux - workspace path will be shown instead"); return Ok(()); } // Open workspace in tmux let workspace_dir = Path::new("/home/user/dev-mux/owner/repo/feature-branch"); let window_name = "feature-branch"; open_tmux_window(workspace_dir, window_name)?; println!("Opened tmux window for workspace"); ``` ``` -------------------------------- ### Fetch user contributions Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves contribution data for the authenticated user, including total counts and daily activity suitable for heatmap visualization. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch contribution data for heatmap let contributions = client.fetch_contributions().await?; println!("Total contributions: {}", contributions.total_contributions); println!("Contribution weeks: {}", contributions.weeks.len()); // Access daily contribution data for week in contributions.weeks.iter().take(4) { for day in &week.contribution_days { if day.contribution_count > 0 { println!(" {}: {} contributions", day.date, day.contribution_count); } } } Ok(()) } ``` -------------------------------- ### Fetch repository pull requests Source: https://context7.com/nooesc/git-mux/llms.txt Retrieves a list of pull requests for a specific repository, including open, closed, and merged statuses. Results are sorted by the most recently updated timestamp. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch PRs for a specific repo let prs = client.fetch_repo_prs("owner", "repo-name").await?; for pr in prs { let status = if pr.merged { "merged" } else if pr.draft { "draft" } else { &pr.state }; println!("#{} [{}] {}", pr.number, status, pr.title); println!(" Author: {} | {} -> {}", pr.user, pr.head_ref, pr.base_ref); println!(" +{} -{} | {}", pr.additions, pr.deletions, pr.html_url); } Ok(()) } ``` -------------------------------- ### TUI State Management Additions Source: https://github.com/nooesc/git-mux/blob/main/docs/plans/2026-03-04-workspace-command-center-design.md Lists new state additions for the Text User Interface (TUI), including overlay states for action menus and input fields, as well as states for managing workspace operations and their progress or errors. ```text New state additions: - `ActionMenu` overlay state (selected action index, target item) - `BranchNameInput` state (for Home screen `w` key flow) - `WorkspaceOp` state (current step: cloning/copying/checking-out, status message, error) ``` -------------------------------- ### POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun Source: https://context7.com/nooesc/git-mux/llms.txt Re-runs a failed or completed CI workflow by its run ID. ```APIDOC ## POST /repos/{owner}/{repo}/actions/runs/{run_id}/rerun ### Description Triggers a re-run for a specific workflow run ID. ### Method POST ### Endpoint /repos/{owner}/{repo}/actions/runs/{run_id}/rerun ### Parameters #### Path Parameters - **run_id** (Integer) - Required - The ID of the workflow run to restart. ``` -------------------------------- ### Fetch GitHub Unread Notifications (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Fetches unread notifications for the authenticated user using the GitHubClient. It retrieves information about PR reviews, issue mentions, and repository activity. Requires the 'git-mux' and 'tokio' crates. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::new().await?; // Fetch notifications let notifications = client.fetch_notifications().await?; let unread_count = notifications.iter().filter(|n| n.unread).count(); println!("Unread notifications: {}", unread_count); for notif in notifications { let status = if notif.unread { "[UNREAD]" } else { "[read]" }; println!("{} {} - {}", status, notif.subject_type, notif.subject_title); println!(" Repo: {} | Reason: {}", notif.repo_full_name, notif.reason); if let Some(url) = ¬if.url { println!(" URL: {}", url); } } Ok(()) } ``` -------------------------------- ### Workspace Utilities: Branch Validation and Slugification Source: https://context7.com/nooesc/git-mux/llms.txt Provides functions to validate branch names against Git ref format rules and to convert strings into URL-safe slugs for directory or branch names. ```APIDOC ## Workspace Utilities: Branch Validation and Slugification ### Description Validates user-provided branch names against git ref format rules and converts strings to safe directory/branch slugs. ### Functions - `validate_branch_name(name: &str) -> Result<(), String>`: Validates if a given string is a valid Git branch name. - `slugify(text: &str) -> String`: Converts a string into a URL-safe slug. - `issue_branch_name(issue_number: u32, title: &str) -> String`: Generates a branch name from an issue number and title. ### Usage Examples ```rust use git_mux::workspace::{validate_branch_name, slugify, issue_branch_name}; // Validate branch names match validate_branch_name("feature/my-new-feature") { Ok(_) => println!("Valid branch name"), Err(e) => println!("Invalid: {}", e), } // Slugify strings let slug = slugify("feat: Add OAuth 2.0 Support!"); assert_eq!(slug, "feat-add-oauth-2-0-support"); // Generate issue branch name let branch = issue_branch_name(42, "Fix login timeout"); assert_eq!(branch, "issue-42-fix-login-timeout"); ``` ``` -------------------------------- ### WorkspaceOps::cleanup_old_workspaces() Source: https://context7.com/nooesc/git-mux/llms.txt Manages workspace cleanup by automatically removing stale directories based on their modification time, while respecting uncommitted changes and active tmux sessions. ```APIDOC ## WorkspaceOps::cleanup_old_workspaces() ### Description Automatically removes stale workspaces based on file modification time. Skips workspaces with uncommitted changes or active tmux sessions. ### Method `WorkspaceOps::cleanup_old_workspaces(days: u64) -> Result` ### Parameters - `days` (u64): The maximum age in days for a workspace to be considered stale. A value of 0 disables cleanup. ### Returns - `Ok(usize)`: The number of stale workspaces removed. ### Usage Examples ```rust use git_mux::workspace::WorkspaceOps; let ws = WorkspaceOps::new("~/dev-mux".to_string()); // Cleanup workspaces older than 7 days let removed = ws.cleanup_old_workspaces(7)?; println!("Removed {} stale workspaces", removed); // Disable cleanup let removed = ws.cleanup_old_workspaces(0)?; assert_eq!(removed, 0); ``` ``` -------------------------------- ### Validate Branch Names and Slugify Strings Source: https://context7.com/nooesc/git-mux/llms.txt Provides functions to validate branch names against Git ref rules and convert strings into URL-safe or directory-safe slugs. It also includes a helper to generate standardized issue branch names. ```rust use git_mux::workspace::{validate_branch_name, slugify, issue_branch_name}; fn main() { match validate_branch_name("feature/my-new-feature") { Ok(_) => println!("Valid branch name"), Err(e) => println!("Invalid: {}", e), } assert!(validate_branch_name("").is_err()); assert!(validate_branch_name("my..branch").is_err()); assert!(validate_branch_name("name.lock").is_err()); assert!(validate_branch_name("has spaces").is_err()); let slug = slugify("feat: Add OAuth 2.0 Support!"); assert_eq!(slug, "feat-add-oauth-2-0-support"); let branch = issue_branch_name(42, "Fix login timeout"); assert_eq!(branch, "issue-42-fix-login-timeout"); } ``` -------------------------------- ### Cleanup Stale Workspaces Source: https://context7.com/nooesc/git-mux/llms.txt Automates the removal of old workspaces based on modification time. It safely skips directories that contain uncommitted changes or are currently active in a tmux session. ```rust use git_mux::workspace::WorkspaceOps; fn main() -> anyhow::Result<()> { let ws = WorkspaceOps::new("~/dev-mux".to_string()); let removed = ws.cleanup_old_workspaces(7)?; println!("Removed {} stale workspaces", removed); let removed = ws.cleanup_old_workspaces(0)?; assert_eq!(removed, 0); Ok(()) } ``` -------------------------------- ### Mark GitHub Notification as Read (Rust) Source: https://context7.com/nooesc/git-mux/llms.txt Marks a specific GitHub notification as read using its thread ID. This operation updates the notification status on GitHub via the GitHubClient. Requires the 'git-mux' and 'tokio' crates. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::from_token()?; // Mark a notification as read let thread_id = "12345678"; client.mark_notification_read(thread_id).await?; println!("Notification {} marked as read", thread_id); Ok(()) } ``` -------------------------------- ### Re-run CI workflow Source: https://context7.com/nooesc/git-mux/llms.txt Triggers a re-run of a specific CI workflow using its unique run ID. This is useful for retrying failed builds without requiring new commits. ```rust use git_mux::github::GitHubClient; #[tokio::main] async fn main() -> anyhow::Result<()> { let client = GitHubClient::from_token()?; // Lightweight client without user info // Re-run a specific workflow let run_id = 12345678u64; match client.rerun_workflow("owner", "repo-name", run_id).await { Ok(_) => println!("Workflow {} re-run triggered successfully", run_id), Err(e) => eprintln!("Failed to re-run workflow: {}", e), } Ok(()) } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.