### Register SessionStart hook Source: https://usegitai.com/docs/agents/claude-web Configuration for the project settings file to execute the install script on session start. ```json { "hooks": { "SessionStart": [ { "hooks": [ { "type": "command", "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/install-git-ai.sh" } ] } ] } } ``` -------------------------------- ### Wire install script in environment.json Source: https://usegitai.com/docs/agents/cursor-agent Configure the .cursor/environment.json file to execute the installation script when the environment boots. ```json { "name": "test-cursor", "install": "bash .cursor/install.sh" } ``` -------------------------------- ### Full Enterprise Configuration Example Source: https://usegitai.com/docs/team-usage/enterprise-configuration A comprehensive configuration file example covering repository paths, update policies, and telemetry settings. ```json { "git_path": "/usr/local/bin/git-og", "update_channel": "latest", "disable_auto_updates": true, "telemetry_oss": "off", "telemetry_enterprise_dsn": "https://key@sentry.internal.acme.com/123" } ``` -------------------------------- ### List repository sessions via cURL Source: https://usegitai.com/docs/sdk-api/repositories/listRepoSessions Example request to retrieve repository sessions using the GET method. ```bash curl -X GET "https://usegitai.com/api/v1/repos/string/string/string/sessions?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### Install Git AI in Codex Cloud Source: https://usegitai.com/docs/agents/codex-cloud Run this command in the Codex web environment's setup or install step to ensure the binary persists across sessions. ```bash curl -fsSL https://raw.githubusercontent.com/git-ai-project/git-ai/refs/heads/main/install.sh | bash ``` -------------------------------- ### Create installation script Source: https://usegitai.com/docs/agents/cursor-agent Define the .cursor/install.sh script to install Git AI during the Background Agent boot process. ```bash #!/usr/bin/env bash set -euo pipefail curl -fsSL https://raw.githubusercontent.com/git-ai-project/git-ai/refs/heads/main/install.sh | bash ``` -------------------------------- ### Git AI Configuration Examples Source: https://usegitai.com/docs/get-started/reference Practical examples for configuring Git AI, including setting boolean values, repository patterns, and feature flags. ```bash # View all configuration git ai config # View a specific setting git ai config exclude_repositories # Set a boolean value git ai config set disable_auto_updates true # Set repository exclusion using glob pattern git ai config set exclude_repositories "private/*" # Set repository exclusion using current repo (resolves to remotes) git ai config set exclude_repositories . # Add to array without replacing existing values git ai config --add exclude_repositories "temp/*" git ai config --add allow_repositories ~/projects/my-repo # Set feature flag using dot notation git ai config set feature_flags.my_flag true git ai config --add feature_flags.another_flag false # Remove a configuration value git ai config unset exclude_repositories ``` -------------------------------- ### Install Git AI on Windows Source: https://usegitai.com/docs Use this PowerShell command for native Windows installations. ```powershell powershell -NoProfile -ExecutionPolicy Bypass -Command "irm http://usegitai.com/install.ps1 | iex" ``` -------------------------------- ### Direct Integration in Agent Loop Source: https://usegitai.com/docs/agents/add-your-agent Example of checking for Git AI installation and executing checkpoints within an agent's file editing loop. ```typescript // On startup, check if git-ai is installed export const GIT_AI_INSTALLED = execSync(`${process.platform === "win32" ? "where" : "which"} git-ai`) /// ... In your agent loop, where files are edited /// if (GIT_AI_INSTALLED) await exec(`git ai checkpoint`) applyFilePatch(editTool.path, editTool.patch) if (GIT_AI_INSTALLED) await exec(`git ai checkpoint <...metadata>`) ``` -------------------------------- ### Example JSON configuration Source: https://usegitai.com/docs/get-started/configuration A sample configuration file structure for Git AI. ```json { "git_path": "/usr/bin/git", "allow_repositories": [ "https://github.com/yourorg/*" ], "disable_auto_updates": false, "update_channel": "latest" } ``` -------------------------------- ### Make script executable Source: https://usegitai.com/docs/agents/claude-web Command to set the execution permissions for the installation script. ```bash chmod +x .claude/hooks/install-git-ai.sh ``` -------------------------------- ### Install Git AI Source: https://usegitai.com/docs/agents/claude-code Execute this command in your terminal to install Git AI without requiring per-repository configuration. ```bash curl -sSL https://usegitai.com/install.sh | bash ``` -------------------------------- ### Install IntelliJ hooks Source: https://usegitai.com/docs/agents/copilot Run this command to ensure the Git AI extension is configured for IntelliJ. ```bash git ai install-hooks ``` -------------------------------- ### List pull request sessions via cURL Source: https://usegitai.com/docs/sdk-api/pull-requests/listRepoPullRequestSessions Example request to retrieve sessions for a pull request using the GET method. ```bash curl -X GET "https://usegitai.com/api/v1/repos/string/string/string/pull-requests/1/sessions?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### JSON Output Example Source: https://usegitai.com/docs/get-started/commit-stats Example structure of the machine-readable JSON response returned by the stats command. ```json { "human_additions": 8, "unknown_additions": 4, "ai_additions": 81, "ai_accepted": 81, "git_diff_deleted_lines": 14, "git_diff_added_lines": 93, "tool_model_breakdown": { "cursor::claude-4.5-opus": { "ai_additions": 75, "ai_accepted": 75 }, "claude-code::claude-opus-4-5-20251101": { "ai_additions": 6, "ai_accepted": 6 } } } ``` -------------------------------- ### Install GitHub Actions for Git AI Source: https://usegitai.com/docs/team-usage/ci-workflows Command to initialize the Git AI workflow in a GitHub repository. ```bash git ai ci github install ``` -------------------------------- ### Example Diff Output Source: https://usegitai.com/docs/get-started/reference Sample output format showing authorship annotations for added and deleted lines. ```diff diff --git a/src/main.rs b/src/main.rs index 5716ca5..8f94139 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,3 +10,5 @@ fn main() { println!("Hello"); - let x = 1; πŸ‘€alice + let x = 2; πŸ€–cursor + let y = 3; πŸ€–cursor println!("World"); ``` -------------------------------- ### GET /repos Source: https://usegitai.com/docs/sdk-api Retrieves a list of repositories tracked by Git AI. ```APIDOC ## GET /repos ### Description Retrieves a list of repositories associated with the authenticated account. ### Method GET ### Endpoint https://usegitai.com/api/v1/repos ### Request Example curl https://usegitai.com/api/v1/repos \ -H "x-api-key: $GIT_AI_API_KEY" ``` -------------------------------- ### Verify Git AI Installation Source: https://usegitai.com/docs/team-usage/guide-for-developers Check if the Git AI binary is available in your system path. ```shell which git-ai # macOS/Linux where git-ai # Windows ``` -------------------------------- ### View AI Blame Output Source: https://usegitai.com/docs/get-started/ai-blame Example output showing line-by-line authorship attribution. ```text a731df7 Lois Tam 1) export async function login(email, password) { a731df7 Lois Tam 2) const user = await db.findByEmail(email) c0fe91a Claude Code 3) logger.info('login attempt', { email }) a731df7 Lois Tam 4) if (!user) throw new AuthError('not found') b9c4e22 Cursor 5) const valid = await bcrypt.compare( b9c4e22 Cursor 6) password, user.passwordHash b9c4e22 Cursor 7) ) b9c4e22 Cursor 8) if (!valid) throw new AuthError('bad creds') a731df7 Lois Tam 9) return issueSession(user) a731df7 Lois Tam 10) } ``` -------------------------------- ### List repositories cURL request Source: https://usegitai.com/docs/sdk-api/repositories/listReposByOrg Example cURL command to fetch repositories for a specified domain and organization. ```bash curl -X GET "https://usegitai.com/api/v1/repos/string/string?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### Install Git AI script Source: https://usegitai.com/docs/agents/claude-web A shell script to detect remote environments, install Git AI if missing, and update the session PATH. ```bash #!/bin/bash set -euo pipefail # Only run in remote (Claude Code on the web) environments if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; then exit 0 fi # Install git-ai for AI code attribution # https://github.com/git-ai-project/git-ai if ! command -v git-ai &> /dev/null; curl -sSL https://usegitai.com/install.sh | bash fi # Ensure git-ai is on the PATH for the session echo "export PATH=\"$HOME/.git-ai/bin:$HOME/.local/bin:$PATH\"" >> "$CLAUDE_ENV_FILE" ``` -------------------------------- ### Configure Git AI in Devin Blueprints Source: https://usegitai.com/docs/agents/devin Add this command to the initialize section of your blueprint.yaml to automate Git AI installation in Devin environments. ```yaml initialize: | curl -fsSL https://raw.githubusercontent.com/git-ai-project/git-ai/refs/heads/main/install.sh | bash ``` -------------------------------- ### List Sessions cURL Request Source: https://usegitai.com/docs/sdk-api/sessions/listSessions Example of a cURL command to fetch sessions, requiring an API key in the header. ```bash curl -X GET "https://usegitai.com/api/v1/sessions?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### List Contributors via cURL Source: https://usegitai.com/docs/sdk-api/contributors/listContributors Example request to retrieve a list of contributors using the x-api-key header for authentication. ```bash curl -X GET "https://usegitai.com/api/v1/contributors?limit=100&offset=0&sortBy=userId&sortDir=asc" \ -H "x-api-key: " ``` -------------------------------- ### GET /repos Source: https://usegitai.com/docs/sdk-api/repositories/listRepos Retrieves a paginated list of repositories. Supports filtering by various attributes and requires an API key for authentication. ```APIDOC ## GET /repos ### Description Retrieves a list of repositories from the Git AI platform. Results can be filtered and are paginated. ### Method GET ### Endpoint https://usegitai.com/api/v1/repos ### Parameters #### Query Parameters - **limit** (integer) - Optional - Default: 100, Range: 1-1000 - **offset** (integer) - Optional - Default: 0, Range: 0-9007199254740991 - **domain** (string) - Optional - Filter by domain - **org** (string) - Optional - Filter by organization - **name** (string) - Optional - Filter by repository name - **url** (string) - Optional - Filter by repository URL - **search** (string) - Optional - Search query ### Request Example curl -X GET "https://usegitai.com/api/v1/repos?limit=100&offset=0" \ -H "x-api-key: " ### Response #### Success Response (200) - **object** (string) - Response type - **data** (array) - List of repository objects - **meta** (object) - Pagination and request metadata #### Response Example { "object": "response", "data": [ { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### API Response examples Source: https://usegitai.com/docs/sdk-api/pull-requests/upsertRepoPullRequestPost JSON response structures for successful requests and various error states. ```json { "object": "response", "data": { "object": "pull_request_post", "location": "comments", "key": "string", "action": "created" }, "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` ```json { "object": "error", "error": { "code": "invalid_request", "message": "string", "details": null }, "meta": { "requestId": "string" } } ``` ```json { "object": "error", "error": { "code": "invalid_request", "message": "string", "details": null }, "meta": { "requestId": "string" } } ``` ```json { "object": "error", "error": { "code": "invalid_request", "message": "string", "details": null }, "meta": { "requestId": "string" } } ``` -------------------------------- ### GET /repos/{domain}/{org} Source: https://usegitai.com/docs/sdk-api/repositories/listReposByOrg Retrieves a list of repositories for a specific organization under a domain. ```APIDOC ## GET /repos/{domain}/{org} ### Description Retrieves a list of repositories for a specific organization under a domain. ### Method GET ### Endpoint https://usegitai.com/api/v1/repos/{domain}/{org} ### Parameters #### Path Parameters - **domain** (string) - Required - The domain name. - **org** (string) - Required - The organization name. #### Query Parameters - **limit** (integer) - Optional - Default: 100, Range: 1-1000. - **offset** (integer) - Optional - Default: 0, Range: 0-9007199254740991. - **domain** (string) - Optional - Filter by domain. - **org** (string) - Optional - Filter by organization. - **name** (string) - Optional - Filter by repository name. - **url** (string) - Optional - Filter by repository URL. - **search** (string) - Optional - Search term for repositories. ### Response #### Success Response (200) - **object** (string) - The response type. - **data** (array) - List of repository objects. - **meta** (object) - Pagination and request metadata. #### Response Example { "object": "response", "data": [ { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### List session events cURL request Source: https://usegitai.com/docs/sdk-api/events/listSessionEvents Example request to retrieve events for a session using the x-api-key header for authentication. ```bash curl -X GET "https://usegitai.com/api/v1/sessions/string/events?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### GET /repos/{domain} Source: https://usegitai.com/docs/sdk-api/repositories/listReposByDomain Retrieves a list of repositories for a given domain. Supports pagination and filtering by organization, name, URL, or search query. ```APIDOC ## GET /repos/{domain} ### Description Retrieves a list of repositories for a given domain. Supports pagination and filtering by organization, name, URL, or search query. ### Method GET ### Endpoint https://usegitai.com/api/v1/repos/{domain} ### Parameters #### Path Parameters - **domain** (string) - Required - The domain to filter repositories by. #### Query Parameters - **limit** (integer) - Optional - Number of items to return. Default: 100. Range: 1-1000. - **offset** (integer) - Optional - Number of items to skip. Default: 0. Range: 0-9007199254740991. - **domain** (string) - Optional - Filter by domain. - **org** (string) - Optional - Filter by organization. - **name** (string) - Optional - Filter by repository name. - **url** (string) - Optional - Filter by repository URL. - **search** (string) - Optional - Search query string. ### Request Example curl -X GET "https://usegitai.com/api/v1/repos/string?limit=100&offset=0" \ -H "x-api-key: " ### Response #### Success Response (200) - **object** (string) - Response type. - **data** (array) - List of repository objects. - **meta** (object) - Pagination and request metadata. #### Response Example { "object": "response", "data": [ { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### View AI Attribution Graph Source: https://usegitai.com/docs/team-usage/poc Example of the AI attribution graph displayed to developers after a commit. ```text you β–ˆβ–ˆβ–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘β–‘ ai 4% 96% 100% AI code accepted ``` -------------------------------- ### cURL request for upserting pull request content Source: https://usegitai.com/docs/sdk-api/pull-requests/upsertRepoPullRequestPost Example of how to perform the PUT request using cURL. ```bash curl -X PUT "https://usegitai.com/api/v1/repos/string/string/string/pull-requests/1/comments/string" \ -H "x-api-key: " \ -H "Content-Type: application/json" \ -d '{ "content": "string" }' ``` -------------------------------- ### List pull request commits cURL request Source: https://usegitai.com/docs/sdk-api/commits/listRepoPullRequestCommits Example of a GET request to retrieve commits for a pull request using cURL. ```bash curl -X GET "https://usegitai.com/api/v1/repos/string/string/string/pull-requests/1/commits?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### Manage configuration via CLI Source: https://usegitai.com/docs/get-started/configuration View, set, or remove configuration values directly from the command line. ```bash # Show all effective configuration as formatted JSON git ai config # Show a specific config value git ai config # Set a config value git ai config set # Add to an array value (extends existing entries instead of replacing) git ai config set --add git ai config --add # Remove a config value (reverts to its default) git ai config unset ``` -------------------------------- ### git ai uninstall-hooks Source: https://usegitai.com/docs/get-started/reference Remove the hooks that git-ai installed. ```APIDOC ## git ai uninstall-hooks ### Description Remove the hooks that git-ai installed. ### Usage `git ai uninstall-hooks` ``` -------------------------------- ### GET /sessions Source: https://usegitai.com/docs/sdk-api/sessions/listSessions Retrieves a list of sessions based on the provided query parameters. ```APIDOC ## GET /sessions ### Description Retrieves a list of sessions. Supports filtering by various criteria such as repository, user, agent, and time range. ### Method GET ### Endpoint https://usegitai.com/api/v1/sessions ### Parameters #### Query Parameters - **limit** (integer) - Optional - Default 100, Range 1-1000 - **offset** (integer) - Optional - Default 0, Range 0-9007199254740991 - **sessionId** (array) - Optional - **repositoryUrl** (string) - Optional - **domain** (string) - Optional - **org** (string) - Optional - **repo** (string) - Optional - **userId** (array) - Optional - **contributorId** (array) - Optional - **agent** (string) - Optional - **model** (string) - Optional - **parentSessionId** (string) - Optional - **minTurns** (integer) - Optional - Range 0-9007199254740991 - **minGeneratedLines** (integer) - Optional - Range 0-9007199254740991 - **minCommittedLines** (integer) - Optional - Range 0-9007199254740991 - **from** (string) - Optional - Format: date-time - **to** (string) - Optional - Format: date-time ### Response #### Success Response (200) - **object** (string) - Response type - **data** (array) - List of session objects - **meta** (object) - Pagination and request metadata #### Response Example { "object": "response", "data": [ { "object": "session", "sessionId": "string", "contributor": { "object": "contributor", "userId": "string", "email": "string", "displayName": "string", "topAgent": "string", "topModel": "string", "lastActiveAt": "2019-08-24T14:15:22Z" }, "repository": { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" }, "agent": "string", "model": "string", "models": ["string"], "startedAt": "2019-08-24T14:15:22Z", "lastActiveAt": "2019-08-24T14:15:22Z", "parentSessionId": "string", "childSessionCount": 0, "turnCount": 0, "generatedLines": 0, "committedLines": 0, "cost": { "inputTokens": 0, "outputTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "estimatedCostUsd": 0 } } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### Configure repository patterns Source: https://usegitai.com/docs/get-started/configuration Use CLI commands to define repository inclusion and exclusion rules using paths or glob patterns. ```bash # Exclude the current repo using path resolution git ai config set exclude_repositories . # Add another repo by path git ai config --add exclude_repositories ~/projects/my-repo # Set with a glob pattern git ai config set allow_repositories "https://github.com/myorg/*" # Add a feature flag using dot notation git ai config --add feature_flags.my_flag true ``` -------------------------------- ### GET /contributors Source: https://usegitai.com/docs/sdk-api/contributors/listContributors Retrieves a list of contributors based on the provided query parameters. ```APIDOC ## GET /contributors ### Description Retrieves a list of contributors. Supports filtering by user ID, email, name, and activity metrics, as well as sorting and pagination. ### Method GET ### Endpoint https://usegitai.com/api/v1/contributors ### Parameters #### Query Parameters - **limit** (integer) - Optional - Default: 100. Range: 1-1000. - **offset** (integer) - Optional - Default: 0. Range: 0-9007199254740991. - **userId** (array) - Optional - **email** (array) - Optional - **name** (array) - Optional - **q** (string) - Optional - **topAgent** (string) - Optional - **topModel** (string) - Optional - **lastActiveFrom** (string) - Optional - Format: date-time - **lastActiveTo** (string) - Optional - Format: date-time - **sortBy** (string) - Optional - Default: "lastActiveAt". Options: "userId", "email", "displayName", "lastActiveAt". - **sortDir** (string) - Optional - Default: "desc". Options: "asc", "desc". ### Request Example curl -X GET "https://usegitai.com/api/v1/contributors?limit=100&offset=0&sortBy=userId&sortDir=asc" -H "x-api-key: " ### Response #### Success Response (200) - **object** (string) - Response type - **data** (array) - List of contributor objects - **meta** (object) - Pagination and request metadata #### Response Example { "object": "response", "data": [ { "object": "contributor", "userId": "string", "email": "string", "displayName": "string", "topAgent": "string", "topModel": "string", "lastActiveAt": "2019-08-24T14:15:22Z" } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### Simulating AI Edits with Mock Integration Source: https://usegitai.com/docs/agents/add-your-agent Commands to simulate AI authorship and human overrides for testing Git AI integration. ```bash git ai checkpoint mock_ai ``` ```bash git ai checkpoint ``` ```bash git commit -a -m "Testing Git AI" ``` ```bash be4f6cc (mock_ai 2025-07-11 19:00:20 -0400 1) mod utils; be4f6cc (Aidan Cunniffe 2025-7-11 19:00:20 -0400 2) // Human overwrote this line be4f6cc (mock_ai 2025-07-11 19:00:20 -0400 3) use clap::Parser; ``` -------------------------------- ### GET /profiles Source: https://usegitai.com/docs/sdk-api/profiles/listProfiles Retrieves profile information for a list of specified user IDs. ```APIDOC ## GET /profiles ### Description Lists display names, emails, and images for organization member or pending-member user IDs. ### Method GET ### Endpoint https://usegitai.com/api/v1/profiles ### Parameters #### Query Parameters - **userId** (array) - Required - List of user IDs to retrieve. 1 <= items <= 100. ### Request Example curl -X GET "https://usegitai.com/api/v1/profiles?userId=string" \ -H "x-api-key: " ### Response #### Success Response (200) - **object** (string) - Response type - **data** (object) - Map of user profile data - **meta** (object) - Pagination and request metadata #### Response Example { "object": "response", "data": { "property1": { "name": "string", "email": "string", "image": "string" } }, "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### Authenticate and List Repositories with cURL Source: https://usegitai.com/docs/sdk-api Use the x-api-key header to authenticate requests to the Git AI API. Ensure the API key is stored securely and loaded from an environment variable. ```bash curl https://usegitai.com/api/v1/repos \ -H "x-api-key: $GIT_AI_API_KEY" ``` -------------------------------- ### GET /contributors/{user_id} Source: https://usegitai.com/docs/sdk-api/contributors/getContributor Retrieves the profile details of a contributor by their user ID. ```APIDOC ## GET /contributors/{user_id} ### Description Retrieves the profile details of a contributor by their user ID. ### Method GET ### Endpoint https://usegitai.com/api/v1/contributors/{user_id} ### Parameters #### Path Parameters - **user_id** (string) - Required - The unique identifier of the contributor. ### Request Example curl -X GET "https://usegitai.com/api/v1/contributors/string" \ -H "x-api-key: " ### Response #### Success Response (200) - **object** (string) - The response type. - **data** (object) - The contributor profile data. - **meta** (object) - Metadata including request ID and pagination. #### Response Example { "object": "response", "data": { "object": "contributor", "userId": "string", "email": "string", "displayName": "string", "topAgent": "string", "topModel": "string", "lastActiveAt": "2019-08-24T14:15:22Z" }, "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### Uninstall Git AI hooks Source: https://usegitai.com/docs/get-started/reference Remove the hooks installed by the Git AI tool. ```bash git ai uninstall-hooks ``` -------------------------------- ### git ai install-hooks Source: https://usegitai.com/docs/get-started/reference Configures external tools to send authorship information to the git-ai binary. ```APIDOC ## git ai install-hooks ### Description Automatically configure Claude Code, Cursor and GitHub Copilot to send authorship information to the git-ai binary. ``` -------------------------------- ### Prompt Gemini CLI Source: https://usegitai.com/docs/agents/gemini-cli Use the Gemini CLI interface to initiate AI actions; AI attribution is applied automatically upon commit. ```bash $ gi| ``` -------------------------------- ### GET /sessions/{session_id} Source: https://usegitai.com/docs/sdk-api/sessions/getSession Retrieves the details of a specific session using its session ID. ```APIDOC ## GET /sessions/{session_id} ### Description Retrieves the details of a specific session using its session ID. ### Method GET ### Endpoint https://usegitai.com/api/v1/sessions/{session_id} ### Parameters #### Path Parameters - **session_id** (string) - Required - The unique identifier of the session. ### Response #### Success Response (200) - **object** (string) - The type of the response object. - **data** (object) - The session details. - **meta** (object) - Metadata including request ID and pagination. #### Response Example { "object": "response", "data": { "object": "session", "sessionId": "string", "contributor": { "object": "contributor", "userId": "string", "email": "string", "displayName": "string", "topAgent": "string", "topModel": "string", "lastActiveAt": "2019-08-24T14:15:22Z" }, "repository": { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" }, "agent": "string", "model": "string", "models": ["string"], "startedAt": "2019-08-24T14:15:22Z", "lastActiveAt": "2019-08-24T14:15:22Z", "parentSessionId": "string", "childSessionCount": 0, "turnCount": 0, "generatedLines": 0, "committedLines": 0, "cost": { "inputTokens": 0, "outputTokens": 0, "cachedReadTokens": 0, "cachedWriteTokens": 0, "reasoningTokens": 0, "totalTokens": 0, "estimatedCostUsd": 0 }, "annotations": [ { "kind": "string", "source": "string", "content": "string", "updatedAt": "2019-08-24T14:15:22Z" } ] }, "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### GET /events Source: https://usegitai.com/docs/sdk-api/events/listEvents Retrieves a list of normalized events based on the provided query parameters. ```APIDOC ## GET /events ### Description Retrieves a list of normalized events. Supports filtering by session, repository, user, contributor, event kind, and time range. ### Method GET ### Endpoint https://usegitai.com/api/v1/events ### Parameters #### Query Parameters - **limit** (integer) - Optional - Default: 100, Range: 1-1000 - **offset** (integer) - Optional - Default: 0, Range: 0-9007199254740991 - **sessionId** (array) - Optional - **repositoryUrl** (string) - Optional - **domain** (string) - Optional - **org** (string) - Optional - **repo** (string) - Optional - **userId** (array) - Optional - **contributorId** (array) - Optional - **eventKind** (array) - Optional - **tool** (string) - Optional - **toolKind** (string) - Optional - **model** (string) - Optional - **skillName** (string) - Optional - **traceId** (string) - Optional - **prNumber** (integer) - Optional - Range: 1-9007199254740991 - **prUrl** (string) - Optional - **q** (string) - Optional - **from** (string) - Optional - Format: date-time - **to** (string) - Optional - Format: date-time ### Response #### Success Response (200) - **object** (string) - Response type - **data** (array) - List of event objects - **meta** (object) - Pagination and request metadata #### Response Example { "object": "response", "data": [ { "object": "event", "sessionId": "string", "contributorUserId": "string", "repository": { "object": "repository", "url": "string", "domain": "string", "org": "string", "name": "string" }, "eventKind": "string", "tool": "string", "toolKind": "string", "model": "string", "occurredAt": "2019-08-24T14:15:22Z", "traceId": "string", "outputSequence": 0, "text": "string", "summary": "string", "target": "string", "skillName": "string", "toolInput": "string", "toolOutput": "string", "permissionKind": "string", "permissionTool": "string", "abortReason": "string", "newModel": "string", "pullRequest": { "number": -9007199254740991, "repositoryUrl": "string", "url": "string" } } ], "meta": { "requestId": "string", "pagination": { "limit": 1, "offset": 0, "total": 0, "hasMore": true, "nextOffset": 0 } } } ``` -------------------------------- ### Configure telemetry API key Source: https://usegitai.com/docs/agents/claude-web Environment variable configuration for enabling telemetry streaming to the Git AI dashboard. ```bash GIT_AI_API_KEY= ``` -------------------------------- ### Test Amp with Git AI Source: https://usegitai.com/docs/agents/amp Verify the Amp integration by running it with the required environment variable. ```bash PLUGINS=all amp ``` -------------------------------- ### Configure Cursor Hooks Source: https://usegitai.com/docs/agents/cursor Define the hooks.json file to enable Git AI tracking for file edits and prompt submissions within Cursor. ```json { "hooks": { "afterFileEdit": [ { "command": "/Users/aidancunniffe/Desktop/git-ai/target/debug/git ai checkpoint cursor --hook-input stdin" } ], "beforeSubmitPrompt": [ { "command": "echo 'them'" }, { "command": "/Users/aidancunniffe/Desktop/git-ai/target/debug/git ai checkpoint cursor --hook-input stdin" } ] }, "version": 1 } ``` -------------------------------- ### Git AI Configuration Commands Source: https://usegitai.com/docs/get-started/reference Basic command syntax for managing Git AI configuration settings. ```bash # Show all config as formatted JSON git ai config # Show specific config value git ai config # Set a config value git ai config set # Add to array (extends existing) git ai config set --add git ai config --add # Remove config value (reverts to default) git ai config unset ``` -------------------------------- ### List repositories with cURL Source: https://usegitai.com/docs/sdk-api/repositories/listRepos Use this cURL command to retrieve a list of repositories from the Git AI API. Ensure the x-api-key header is populated with your valid API token. ```bash curl -X GET "https://usegitai.com/api/v1/repos?limit=100&offset=0" \ -H "x-api-key: " ``` -------------------------------- ### View AI Usage Statistics Source: https://usegitai.com/docs/get-started/reference Displays a summary of AI usage across repositories. Supports filtering by repository name. ```bash # Summary across all tracked repositories git ai usage # Scope to a single repository git ai usage --repo ``` -------------------------------- ### Get JSON Output for Stats Source: https://usegitai.com/docs/get-started/commit-stats Append the --json flag to any stats command to receive machine-readable output. ```bash git ai stats --json git ai stats --json git ai stats .. --json ``` -------------------------------- ### Configure Cursor hooks Source: https://usegitai.com/docs/agents/cursor-agent Define the .cursor/hooks.json file to trigger Git AI checkpoints on file edits and tool usage. ```json { "hooks": { "afterFileEdit": [ { "command": "git-ai checkpoint cursor-background --hook-input stdin" } ], "postToolUse": [ { "command": "git-ai checkpoint cursor-background --hook-input stdin" } ], "preToolUse": [ { "command": "git-ai checkpoint cursor-background --hook-input stdin" } ] }, "version": 1 } ``` -------------------------------- ### Get Single Commit Stats Source: https://usegitai.com/docs/get-started/commit-stats Retrieve AI authorship statistics for the current HEAD or a specific commit SHA. ```bash git ai stats git ai stats ``` -------------------------------- ### Configure Gemini CLI Hooks Source: https://usegitai.com/docs/agents/gemini-cli Define hook settings in the Gemini configuration file to enable Git AI checkpointing on file write or replace operations. ```json { "hooks": { "AfterTool": [ { "hooks": [ { "command": "git ai checkpoint gemini --hook-input stdin", "type": "command" } ], "matcher": "write_file|replace" } ], "BeforeTool": [ { "hooks": [ { "command": "git ai checkpoint gemini --hook-input stdin", "type": "command" } ], "matcher": "write_file|replace" } ] }, "tools": { "enableHooks": true } } ``` -------------------------------- ### Retrieve contributor profile via cURL Source: https://usegitai.com/docs/sdk-api/contributors/getContributor Use this cURL command to perform a GET request to the contributor profile endpoint. ```bash curl -X GET "https://usegitai.com/api/v1/contributors/string" \ -H "x-api-key: " ``` -------------------------------- ### Configure Enhanced Telemetry Source: https://usegitai.com/docs/agents/custom-background-agents Set environment variables to enable real-time streaming of checkpoint and authorship data to the Git AI dashboard. ```bash GIT_AI_API_KEY= GIT_AI_CLOUD_AGENT=1 ```