### Quick Start: Clone, Install Tools, Build, and Run Project Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This comprehensive snippet outlines the initial setup for the claude-code-ntfy project. It covers cloning the repository, installing development dependencies, building the project binary, and executing it to verify basic functionality. ```bash # Clone the repository git clone https://github.com/Veraticus/claude-code-ntfy cd claude-code-ntfy # Install required tools (one-time setup) make install-tools # Build and test make test make build # Run the binary ./build/claude-code-ntfy -help ``` -------------------------------- ### Install claude-code-ntfy using Go Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Installs the claude-code-ntfy binary directly using the Go toolchain. ```bash go install github.com/Veraticus/claude-code-ntfy/cmd/claude-code-ntfy@latest ``` -------------------------------- ### Example claude-code-ntfy configuration file Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Provides an example of a config.yaml file for claude-code-ntfy, demonstrating how to set notification topic, server, timeout, and other options. ```yaml ntfy_topic: "my-claude-notifications" ntfy_server: "https://ntfy.sh" backstop_timeout: "30s" quiet: false claude_path: "/usr/local/bin/claude" ``` -------------------------------- ### Install claude-code-ntfy using nix-env Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Installs claude-code-ntfy to the user environment using nix-env from a local default.nix file. ```bash nix-env -f ./default.nix -i ``` -------------------------------- ### Development workflow for claude-code-ntfy Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Outlines the typical development workflow for claude-code-ntfy, including commands for one-time setup, running tests, and pre-commit checks. ```bash # One-time setup make install-tools # Install required development tools # During development make test # Run tests with race detection # Before committing make fix # Auto-fix issues make verify # Run all checks ``` -------------------------------- ### Run claude-code-ntfy Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Executes claude-code-ntfy. If installed via Nix, the 'claude' command is automatically wrapped; otherwise, use 'claude-code-ntfy' directly. ```bash # If installed via Nix (automatically uses wrapper) claude # If installed via Go or built from source claude-code-ntfy ``` -------------------------------- ### Common Task: Build Project Binary Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command compiles the project's source code into an executable binary. It is a fundamental step required before running or deploying the application. ```bash make build ``` -------------------------------- ### Configure claude-code-ntfy with Home Manager Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Enables and configures claude-code-ntfy for user-level installation using Home Manager, allowing custom settings like ntfy topic and server. ```nix { programs.claude-code-ntfy = { enable = true; # Optional: Define configuration settings = { ntfy_topic = "my-claude-notifications"; ntfy_server = "https://ntfy.sh"; backstop_timeout = "30s"; }; }; } ``` -------------------------------- ### Install claude-code-ntfy to user profile with Nix Flakes Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Installs claude-code-ntfy to the user's Nix profile using Nix Flakes, which automatically hijacks the 'claude' command. ```bash nix profile install github.com/Veraticus/claude-code-ntfy ``` -------------------------------- ### Common Task: Format Project Code Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command automatically formats the project's source code. It ensures consistent styling and readability across the entire codebase, adhering to predefined standards. ```bash make fmt ``` -------------------------------- ### Run claude-code-ntfy directly with Nix Flakes Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Executes claude-code-ntfy using Nix Flakes without permanent installation, useful for testing or one-off runs. ```bash nix run github:Veraticus/claude-code-ntfy -- --help ``` -------------------------------- ### Common Task: Run Project Tests Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command executes the project's test suite, including race detection. It is used to verify code correctness and identify potential concurrency issues. ```bash make test ``` -------------------------------- ### Development Workflow: Auto-Fix and Verify Before Commit Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md These commands are crucial for ensuring code quality before committing changes. `make fix` automatically formats code and resolves common issues, while `make verify` executes all checks, including tests and linting, to ensure adherence to project standards. ```bash make fix # Auto-fix formatting and common issues make verify # Run all checks (tests, linting, etc.) ``` -------------------------------- ### Development Workflow: Run Tests with Race Detection Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command is used during the development workflow to quickly run the project's test suite. It automatically includes race detection to identify potential concurrency issues early. ```bash make test # Quick - runs tests with race detection ``` -------------------------------- ### Common Task: Clean Build Artifacts Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command removes all generated build artifacts and temporary files from the project directory. It provides a clean environment for subsequent builds or development tasks. ```bash make clean ``` -------------------------------- ### Common Task: Lint Project Code Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command runs linters on the project's source code. It helps identify potential errors, stylistic inconsistencies, and suspicious constructs, contributing to overall code quality. ```bash make lint ``` -------------------------------- ### Common Task: Generate Test Coverage Report Source: https://github.com/veraticus/claude-code-ntfy/blob/main/docs/development.md This command generates a report detailing the test coverage of the project. It indicates which parts of the code are exercised by tests, helping developers identify areas that require more testing. ```bash make cover ``` -------------------------------- ### Build and Development Commands for Claude Code Ntfy Source: https://github.com/veraticus/claude-code-ntfy/blob/main/CLAUDE.md This section lists the primary `make` commands used for building the binary, running tests with race detection, formatting code, and executing linters for the Claude Code Ntfy Go project. It also includes helper commands for quick development cycles, auto-fixing issues, and verifying all checks for CI/pre-commit. ```bash # Core commands make build # Build the binary make test # Run tests with race detection make fmt # Format code make lint # Run linters (golangci-lint + staticcheck) # Development helpers make quick # Format and test (for development) make fix # Auto-fix formatting and other issues make verify # Run all checks (for CI/pre-commit) make cover # Generate test coverage report ``` -------------------------------- ### Build claude-code-ntfy from source Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Clones the claude-code-ntfy repository and builds the binary from its source code using 'make build'. ```bash git clone https://github.com/Veraticus/claude-code-ntfy cd claude-code-ntfy make build ``` -------------------------------- ### Build claude-code-ntfy from source with traditional Nix Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Builds claude-code-ntfy using the traditional Nix package manager from a local default.nix file. ```bash nix-build -E 'with import {}; callPackage ./default.nix {}' ``` -------------------------------- ### Pre-commit Development Workflow Commands Source: https://github.com/veraticus/claude-code-ntfy/blob/main/CLAUDE.md Outlines the recommended `make` commands to execute before committing changes in the Claude Code Ntfy project. These commands ensure code is automatically fixed for style and other issues, and that all project checks (tests, linting) pass successfully. ```bash make fix # Auto-fix issues make verify # Ensure everything passes ``` -------------------------------- ### Claude Code Ntfy Directory Structure Source: https://github.com/veraticus/claude-code-ntfy/blob/main/CLAUDE.md Provides an overview of the Claude Code Ntfy project's directory structure, detailing the purpose and contents of key packages such as `config`, `process`, `monitor`, `notification`, `idle`, `interfaces`, and `testutil`, along with the main entry point `cmd`. ```text pkg/ ├── config/ # Configuration loading and validation ├── process/ # Process management and PTY handling ├── monitor/ # Output monitoring and pattern matching ├── notification/ # Notification management, batching, rate limiting ├── idle/ # Platform-specific idle detection ├── interfaces/ # Core interface definitions └── testutil/ # Testing utilities cmd/ └── claude-code-ntfy/ # Main entry point ``` -------------------------------- ### Claude Code Ntfy Go Package Structure Source: https://github.com/veraticus/claude-code-ntfy/blob/main/ARCHITECTURE.md This snippet outlines the directory and file structure of the claude-code-ntfy project's `pkg/` directory. It details the organization of Go packages, including `config` for configuration, `process` for process and PTY handling, `monitor` for output activity tracking, `notification` for the notification system, `interfaces` for core definitions, and `testutil` for testing utilities. ```Go pkg/ ├── config/ # Configuration loading and validation │ └── config.go # Config struct and loading logic ├── process/ # Process management and PTY handling │ ├── manager.go # Process lifecycle management │ ├── pty.go # PTY creation and I/O handling │ └── interfaces.go # PTY interface definition ├── monitor/ # Output monitoring │ ├── output_monitor.go # Activity tracking and bell detection │ ├── terminal_detector.go # Terminal sequence detection │ └── terminal_state.go # Terminal state management ├── notification/ # Notification system │ ├── notification.go # Notification type │ ├── backstop_notifier.go # Inactivity timer logic │ ├── ntfy_client.go # HTTP client for ntfy.sh │ └── stdout_notifier.go # Testing/debug notifier ├── interfaces/ # Core interface definitions │ └── interfaces.go # Shared interfaces └── testutil/ # Testing utilities └── mocks.go # Mock implementations ``` -------------------------------- ### YAML Configuration File Format Source: https://github.com/veraticus/claude-code-ntfy/blob/main/ARCHITECTURE.md Illustrates the structure of the config.yaml file, located in ~/.config/claude-code-ntfy/, for configuring notification settings, backstop timeout, quiet mode, and the path to the Claude binary. ```yaml # ~/.config/claude-code-ntfy/config.yaml # Notification settings ntfy_topic: "my-claude-notifications" ntfy_server: "https://ntfy.sh" # Backstop timeout (default: 30s) backstop_timeout: "30s" # Disable all notifications quiet: false # Path to real claude binary (auto-detected if not set) claude_path: "/usr/local/bin/claude" ``` -------------------------------- ### Simplified Claude Code Ntfy Architecture Diagram Source: https://github.com/veraticus/claude-code-ntfy/blob/main/ARCHITECTURE.md This diagram illustrates the high-level architecture of claude-code-ntfy, showing the main components and their interactions. It depicts how user input flows through the system, how claude-code-ntfy wraps Claude Code, and the internal components like Config Loader, Process Manager, PTY Manager, Output Monitor, Input Handler, Backstop Notifier, and Ntfy Client, leading to notifications. ```Diagram ┌─────────────────┐ │ User Input │ └────────┬────────┘ │ ▼ ┌─────────────────────────────────────────┐ │ claude-code-ntfy │ │ │ │ ┌─────────────┐ ┌────────────────┐ │ │ │ Config │ │ Process │ │ │ │ Loader │ │ Manager │ │ │ └─────────────┘ └───────┬────────┘ │ │ │ │ │ ┌─────────────┐ ┌───────┴────────┐ │ │ │ Output │◄───┤ PTY │ │ │ │ Monitor │ │ Manager │ │ │ └──────┬──────┘ └───────┬────────┘ │ │ │ │ │ │ ▼ ▼ │ │ ┌─────────────┐ ┌────────────────┐ │ │ │ Backstop │ │ Input Handler │ │ │ │ Notifier │◄───┤ (stdin) │ │ │ └──────┬──────┘ └────────────────┘ │ │ │ │ │ ▼ │ │ ┌─────────────┐ │ │ │ Ntfy Client │ │ │ └─────────────┘ │ └─────────────────────────────────────────┘ │ ▼ ┌─────────────────┐ │ Claude Code │ └─────────────────┘ ``` -------------------------------- ### Add claude-code-ntfy to NixOS configuration.nix Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Integrates claude-code-ntfy into a NixOS system-wide configuration.nix, fetching it from GitHub and adding it to system packages. ```nix { pkgs, ... }: let claude-code-ntfy = pkgs.callPackage (pkgs.fetchFromGitHub { owner = "Veraticus"; repo = "claude-code-ntfy"; rev = "main"; sha256 = "sha256-AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="; } + "/default.nix") { }; in { environment.systemPackages = [ claude-code-ntfy ]; } ``` -------------------------------- ### Go Interfaces for Data Handling and Notifications Source: https://github.com/veraticus/claude-code-ntfy/blob/main/ARCHITECTURE.md Defines the core Go interfaces used throughout the project: DataHandler for processing output, Notifier for sending notifications, and ActivityMarker for signaling activity to a backstop timer. ```go // DataHandler processes raw output data type DataHandler interface { HandleData(data []byte) HandleLine(line string) } // Notifier sends notifications type Notifier interface { Send(notification Notification) error } // ActivityMarker marks activity for backstop timer type ActivityMarker interface { MarkActivity() } ``` -------------------------------- ### Environment Variable Configuration Source: https://github.com/veraticus/claude-code-ntfy/blob/main/ARCHITECTURE.md Shows how to configure the application using environment variables, which override settings from the config file. These variables mirror the configuration options available in the YAML file. ```bash export CLAUDE_NOTIFY_TOPIC="my-topic" export CLAUDE_NOTIFY_SERVER="https://ntfy.sh" export CLAUDE_NOTIFY_BACKSTOP_TIMEOUT="30s" export CLAUDE_NOTIFY_QUIET="false" export CLAUDE_NOTIFY_CLAUDE_PATH="/usr/local/bin/claude" ``` -------------------------------- ### Integrate claude-code-ntfy into flake.nix for NixOS Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Adds claude-code-ntfy as an input and module to a NixOS system configuration using flake.nix, enabling it system-wide. ```nix { inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; claude-code-ntfy.url = "github:Veraticus/claude-code-ntfy"; }; outputs = { self, nixpkgs, claude-code-ntfy }: # For NixOS system configuration nixosConfigurations.mysystem = nixpkgs.lib.nixosSystem { modules = [ claude-code-ntfy.nixosModules.default { programs.claude-code-ntfy.enable = true; } ]; }; }; } ``` -------------------------------- ### Set Ntfy topic for claude-code-ntfy Source: https://github.com/veraticus/claude-code-ntfy/blob/main/README.md Sets the required CLAUDE_NOTIFY_TOPIC environment variable, which specifies the Ntfy topic for notifications. ```bash export CLAUDE_NOTIFY_TOPIC="my-claude-notifications" ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.