{
  "markdown": "# Gemini CLI Hooks Logger\n\nA comprehensive logging extension for the Gemini CLI that captures and logs all hook events for debugging and analysis purposes.\n\n## Overview\n\nThis extension integrates with the Gemini CLI hook system to provide visibility into the CLI's internal operations. It intercepts every hook event, logs the details to a file, and facilitates easy inspection by automatically opening the log file in VS Code upon session start.\n\n## Features\n\n- **Complete Hook Coverage**: Logs events for all major hooks including `SessionStart`, `BeforeModel`, `AfterModel`, `SessionEnd`, agent interactions, and tool usage.\n- **Structured Logging**: Stores logs as JSON objects with timestamps and session IDs for easy parsing.\n- **Automatic Debugging**: Automatically launches a new VS Code window pointing to the log directory and opens the current session's log file when a new session starts.\n- **Non-Intrusive**: Designed to work transparently alongside your main CLI operations, passing through data so the CLI continues to function normally.\n\n## Installation\n\n1.  Ensure you have the Gemini CLI installed.\n2.  Place this directory `gemini-cli-hooklog` (containing `gemini-extension.json`) into your Gemini CLI extensions directory (e.g., `~/.gemini/extensions/` or wherever your CLI is configured to look for extensions).\n\n## How it Works\n\nThe extension uses a configuration file `hooks/hooks.json` to map every hook event to a single handler script `scripts/hooklog.ts`.\n\nWhen a hook is triggered:\n\n1.  The CLI executes `node scripts/hooklog.ts`.\n2.  The script reads the hook event data (JSON) from `stdin`.\n3.  It appends a formatted log entry to a file in the system's temporary directory:\n    - Linux/Mac: `/tmp/gemini-cli-hooks-log/<session-id>.log` (or similar depending on `os.tmpdir()`)\n    - Windows: `%TEMP%\\gemini-cli-hooks-log\\<session-id>.log`\n4.  If the event is `SessionStart`, it attempts to open the log folder and file in VS Code using the `code` command.\n5.  Finally, it echoes the input JSON to `stdout` to ensure the hook chain continues without interruption.\n\n## Configuration\n\n### Enable/Disable Logging\n\nYou can enable or disable logging via the extension settings.\n\n- **Setting**: `Enable Logging`\n- **Environment Variable**: `GEMINI_HOOKLOG_ENABLE`\n- **Default**: `true` (Enabled)\n- **Description**: Whether to enable logging of hook events. Set to `false` to disable logging.\n\n### Example Usage\n\n```\n> gemini extensions config hooklog\nLoaded cached credentials.\nConfiguring settings for \"hooklog\"...\n✔ Setting \"Enable Logging\" (GEMINI_HOOKLOG_ENABLE) is already set. Overwrite? … yes\n✔ Enable Logging\nWhether to enable logging of hook events. … false\n```\n\nThe `hooks/hooks.json` file defines which hooks are intercepted. Currently, it is configured to intercept:\n\n- `SessionStart`\n- `BeforeModel` / `AfterModel`\n- `SessionEnd`\n- `BeforeAgent` / `AfterAgent`\n- `BeforeToolSelection`\n- `BeforeTool` / `AfterTool`\n- `PreCompress`\n- `Notification`\n\n## Prerequisites\n\n- **Node.js**: The script is executed using `node`.\n- **TypeScript Support**: Since the script is written in TypeScript (`.ts`), you may need a runtime that supports TypeScript directly (like `ts-node` or `bun`) or you might need to compile the script to JavaScript if running with standard Node.js.\n  - _Note: The current `hooks.json` configuration invokes `node`. Ensure your environment supports running the `.ts` file or update the command/file extension accordingly._\n- **VS Code**: For the automatic file opening feature to work, the `code` command must be available in your implementation environment's PATH.\n\n## License\n\nMIT\n",
  "bytes": 3635,
  "sha": "d1c236f05fff27572b6a78ae88db2011c409903ac0bdb6a62c386780e1f0960c",
  "repo_slug": "sandipchitale/hooklog",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_sandipchitale_hooklog_f442edaf/readme"
}