Documentation
¶
Index ¶
- Constants
- func GeminiSessionFilePattern(homeDir, projectDir, sessionID string) string
- func JsonlPath(tool Tool, homeDir, projectDir, sessionID string) string
- func NormalizeEvent(tool Tool, rawEvent string) string
- func ProjectDir(tool Tool, geminiProjectDir, claudeProjectDir, hookInputCwd string) string
- type Tool
Constants ¶
const EnvSessionName = "MUXAC_SESSION_NAME"
EnvSessionName is the environment variable used to pass the muxac session name.
Variables ¶
This section is empty.
Functions ¶
func GeminiSessionFilePattern ¶ added in v0.0.6
GeminiSessionFilePattern returns a glob pattern that matches the Gemini CLI session JSON file for the given project directory and session ID. Returns "" if sessionID is too short (< 8 characters).
func JsonlPath ¶
JsonlPath returns the tool-specific JSONL file path. Returns "" for tools that do not support JSONL.
func NormalizeEvent ¶
NormalizeEvent maps a tool-specific hook event name to the canonical event name used by the status package. For Claude, events are already canonical. For Unknown tools, Claude conventions are used as a fallback.
func ProjectDir ¶
ProjectDir returns the project directory for the given tool. The hook payload's "cwd" is preferred over env vars because env vars can leak from a parent shell and point at the wrong project.
Types ¶
type Tool ¶
type Tool int
Tool represents a supported agentic coding tool.
func DetectTool ¶
DetectTool determines which coding tool is invoking the hook.
The hook payload's "cwd" is the source of truth for the project directory because env vars can leak from a parent shell: e.g. launching `codex` from a Claude Code session inherits CLAUDE_PROJECT_DIR, which would otherwise make us misdetect Codex hook events as Claude.
Detection rules:
- GEMINI_PROJECT_DIR matches the hook cwd (or cwd is empty) → Gemini. Gemini CLI sets both GEMINI_PROJECT_DIR and CLAUDE_PROJECT_DIR, so this must be checked before Claude.
- CLAUDE_PROJECT_DIR matches the hook cwd (or cwd is empty) → Claude.
- cwd is non-empty → Codex. Codex does not set its own project-dir env var on hook commands but always includes "cwd" in the JSON payload.
- Otherwise → Unknown.
func ToolFromString ¶
ToolFromString converts a database string back to a Tool value. Empty or unrecognized strings return Unknown.