### CI/CD Summary Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary-formatters.md Example of running AI Distiller with the CI-friendly summary for pipelines. ```bash # For CI/CD pipelines aid ./src --summary-type=ci-friendly ``` -------------------------------- ### Go Server Start Method Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/03_medium/expected/private=0.txt Defines the method to start the server, which includes validating the configuration. ```go // Start validates config and starts the server. func (s *Server) Start() error ``` -------------------------------- ### Go Server Start Method Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/03_medium/expected/implementation=1.txt Implements the Start method for the Server. It performs validation and prints a startup message. ```go // Start validates config and starts the server. func (s *Server) Start() error if err != nil: fmt.Printf("Starting server on %s:%d\n", s.Host, s.Port) return nil ``` -------------------------------- ### Default Summary Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary-formatters.md Example of running AI Distiller with the default visual progress bar summary. ```bash # Default (visual progress bar) aid ./src ``` -------------------------------- ### Manual Cross-Compilation Examples Source: https://github.com/janreges/ai-distiller/blob/main/BUILD.md Manual commands for cross-compiling the AI Distiller binary for specific target platforms. Ensure the necessary CGO toolchains are installed. ```bash # Linux ARM64 CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -o aid-linux-arm64 ./cmd/aid ``` ```bash # Windows AMD64 CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 GOOS=windows GOARCH=amd64 go build -o aid-windows-amd64.exe ./cmd/aid ``` ```bash # macOS (requires macOS host or osxcross) CGO_ENABLED=1 GOOS=darwin GOARCH=amd64 go build -o aid-darwin-amd64 ./cmd/aid ``` -------------------------------- ### Example .aidignore File Syntax Source: https://github.com/janreges/ai-distiller/blob/main/README.md This example demonstrates the basic syntax for creating an `.aidignore` file, including comments, file patterns, directory patterns, and negation. ```bash # Comments start with hash *.test.js # Ignore test files *.spec.ts # Ignore spec files temp/ # Ignore temp directory build/ # Ignore build directory /secrets.py # Ignore secrets.py only in root node_modules/ # Ignore node_modules everywhere **/*.bak # Ignore .bak files in any directory src/test_* # Ignore test_* files in src/ !important.test.js # Don't ignore important.test.js (negation) ``` -------------------------------- ### Install AI Distiller Native Binary Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Installation instructions for macOS/Linux using Homebrew and for Windows using Scoop. ```bash # macOS/Linux brew install janreges/tap/ai-distiller # Windows scoop install ai-distiller # Or download pre-built binaries from GitHub releases ``` -------------------------------- ### Example .aidignore File in Project Root Source: https://github.com/janreges/ai-distiller/blob/main/README.md This example shows common patterns for an `.aidignore` file placed in the project root, excluding dependency directories and test files. ```bash # .aidignore in project root node_modules/ # Excludes all node_modules directories *.test.js # Excludes all test files *.spec.ts # Excludes all spec files dist/ # Excludes dist directory .env.py # Excludes environment config files vendor/ # Excludes vendor directory ``` -------------------------------- ### Install AI Distiller (macOS/Linux/WSL) Source: https://github.com/janreges/ai-distiller/blob/main/README.md Install AI Distiller to ~/.aid/bin without sudo. Alternatively, use the --sudo flag to install to /usr/local/bin. ```bash curl -sSL https://raw.githubusercontent.com/janreges/ai-distiller/main/install.sh | bash ``` ```bash curl -sSL https://raw.githubusercontent.com/janreges/ai-distiller/main/install.sh | bash -s -- --sudo ``` -------------------------------- ### YAML Configuration File Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/02_PRD.md Example of a `.aidrc` configuration file specifying strip options, exclusions, output format, and recursion. ```yaml # .aidrc strip: - implementation - comments exclude: - "*_test.go" - "vendor/*" - "node_modules/*" format: markdown recursive: true ``` -------------------------------- ### ProductNotificationService start Implementation Source: https://github.com/janreges/ai-distiller/blob/main/testdata/kotlin/04_complex/expected/implementation=1.txt Starts the notification service by launching coroutines to collect product updates and distribute notifications to subscribers. ```kotlin = GlobalScope.launch { // Collect product updates launch { repository.productUpdates.collect { update -> val notification = when (update) { is ProductUpdate.Added -> Notification.ProductAdded(update.product.name) is ProductUpdate.Modified -> Notification.ProductUpdated( update.newProduct.name, update.oldProduct.price, update.newProduct.price ) is ProductUpdate.Removed -> Notification.ProductRemoved(update.product.name) } notificationChannel.send(notification) } } // Distribute notifications to subscribers launch { for (notification in notificationChannel) { subscriptions.values.forEach { channel -> channel.trySend(notification) } } } } } ``` -------------------------------- ### Install AI Distiller for Current Project Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/README.md Installs the AI Distiller MCP server for the current project using Claude MCP. This is the recommended installation method. ```bash claude mcp add aid -- npx -y @janreges/ai-distiller-mcp ``` -------------------------------- ### Manual Architecture Override Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/npm-distribution.md Example of how to manually specify the architecture during npm install to override auto-detection if needed. ```bash npm_config_arch=arm64 npm install ``` -------------------------------- ### Specialized Visitor Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/03_IR_SCHEMA_v2.md An example of a specialized visitor (MyVisitor) that handles different node types using type switching. ```go type MyVisitor struct { BaseVisitor } func (v *MyVisitor) Visit(node DistilledNode) IRVisitor { switch n := node.(type) { case *DistilledClass: case *DistilledFunction: default: return v.BaseVisitor.Visit(node) } return v } ``` -------------------------------- ### Test MCP Server Startup Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Run this command to verify that the MCP server starts correctly. ```bash aid --mcp-server --test ``` -------------------------------- ### Install Cross-Compilation Toolchains Source: https://github.com/janreges/ai-distiller/blob/main/README.md Install necessary cross-compilation toolchains on Ubuntu/Debian for building release binaries for different architectures. ```bash # Install cross-compilation toolchains sudo apt-get update sudo apt-get install -y gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 ``` -------------------------------- ### Install AI Distiller MCP Server Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Quick installation command for Claude Code users and manual NPM installation. ```bash # One-line installation for Claude Code users claude mcp add ai-distiller -- npx -y @janreges/ai-distiller-mcp # Or manual installation npm install -g @janreges/ai-distiller-mcp ``` -------------------------------- ### Initialize Development Environment Source: https://github.com/janreges/ai-distiller/blob/main/README.md Setup the development environment for AI Distiller by cloning the repository and running the initialization command. ```bash # Clone and setup git clone https://github.com/janreges/ai-distiller cd ai-distiller make dev-init # Initialize development environment ``` -------------------------------- ### Claude Desktop Configuration for User-Scoped Installation Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/README.md Shows how to configure the 'aid' command in Claude Desktop for user-scoped installations, including the required AID_ROOT environment variable. ```json { "mcpServers": { "aid": { "command": "npx", "args": ["-y", "@janreges/ai-distiller-mcp"], "env": { "AID_ROOT": "/absolute/path/to/your/project" // REQUIRED! } } } } ``` -------------------------------- ### AI Action and Format Command Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/cli-args.TASK-LIST.MD Example of using an AI action with a specific output format. ```bash aid ./test_project/src --ai-action prompt-for-security-analysis --format jsonl ``` -------------------------------- ### C++20 Concepts Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/cpp.md Shows a basic example of C++20 concepts and a function constrained by a concept, demonstrating AI Distiller's partial support for these features. ```cpp // Input template concept Arithmetic = std::is_arithmetic_v; template requires Arithmetic T add(T a, T b) { return a + b; } ``` ```cpp // Output // C++20 Concept: template // concept Arithmetic = std::is_arithmetic_v; template T add(T a, T b); ``` -------------------------------- ### Example Plugin Implementation Source: https://github.com/janreges/ai-distiller/blob/main/testdata/python/04_complex/expected/implementation=1.txt An example concrete plugin that implements the Plugin protocol. It has a 'name' attribute and an 'execute' method that prints the keys of the data it processes. ```python class DataProcessingPlugin: name = "data_processor" def execute(self, data: Dict[str, Any]) -> None: print(f"Processing data: {data.keys()}") ``` -------------------------------- ### Variant 5: CI-Friendly Hybrid Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the CI-friendly hybrid format, demonstrating its clean, parseable structure suitable for logs. ```text [AI Distiller] ✅ -97.6% | 5.2MB → 128KB | 450ms ``` -------------------------------- ### Recipe Card Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the Recipe Card format, illustrating the presentation of distillation metrics in a culinary context. ```text ┌───────────────────────┐ │ 🍲 AI Distiller Recipe Card │ ├───────────────────────┤ │ Dish: "Code Reduction Soufflé"│ │───────────────────────│ │ Ingredients: │ │ • Original: 5.2MB │ │ • Reduced to: 128KB │ │ • Efficiency: 97.6% │ │ • Tokens saved: ~1.17M │ │ • Cook time: 450ms │ ├───────────────────────┤ │ Result: Light & fluffy output! │ └───────────────────────┘ ``` -------------------------------- ### Example Commit Log Entry Source: https://github.com/janreges/ai-distiller/blob/main/CLAUDE.md An example of a commit log entry, showing commit hash, date, author, and commit message. ```text abc123 2025-06-15 14:30:00 +0100 john.doe feat: add new authentication system - Implement JWT token generation - Add user session management - Update API endpoints def456 2025-06-15 11:20:00 +0100 jane.smith fix: resolve memory leak in parser Fixed issue where large files caused excessive memory usage ``` -------------------------------- ### Variant 2: Structured Key-Value Box Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the structured key-value box format, demonstrating its clear separation of distillation details. ```text ┌ Distillation Summary ├─ ⏱️ Speed: 450ms ├─ 📦 Size: 5.2MB → 128KB └─ ✨ Reduction: 97.6% (97.5% tokens) ``` -------------------------------- ### Utility Function and Task Examples Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/05_very_complex/expected/implementation=1.txt Provides utility functions like 'delay' and example task functions for use with the scheduler. These demonstrate how to define asynchronous tasks. ```javascript const delay = (ms) * function counterTask() // implementation * function dataFetcherTask(task) // implementation * function complexIteratorTask() // implementation ``` -------------------------------- ### Install Cross-Compilation Toolchains Source: https://github.com/janreges/ai-distiller/blob/main/BUILD.md Install necessary GCC toolchains for cross-compiling to Linux ARM64 and Windows AMD64 on Debian/Ubuntu systems. ```bash # For Linux ARM64 and Windows sudo apt-get install gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 ``` -------------------------------- ### Build TypeScript and Install Dependencies (Manual Release) Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/docs/HOW-TO-RELEASE-TO-NPMJS.md Steps for the manual release process: install dependencies and build the TypeScript code. This is part of the manual build process before publishing. ```bash cd mcp-npm/ npm install npm run build ``` -------------------------------- ### Command-Line Examples for Code Analysis Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/javascript.md Examples of using a command-line tool for analyzing JavaScript and TypeScript code. These commands demonstrate file analysis, filtering by access level, output formatting, and include/exclude patterns. ```bash # Analyze a single JavaScript file aid app.js # Analyze a React project, showing only public APIs aid src/ --private=0 --protected=0 --internal=0,implementation # Generate JSON output for tooling integration aid src/ --format json-structured --output structure.json # Focus on TypeScript files only aid src/ --include "*.ts" --exclude "*.test.ts" ``` -------------------------------- ### Pipeline Example: Extract Structure from Generated Code Source: https://github.com/janreges/ai-distiller/blob/main/README.md This example demonstrates piping generated code from one script to AI Distiller for analysis, specifying the output language. ```bash generate-code.sh | aid --lang typescript --format json ``` -------------------------------- ### Verify NPM Package Installation Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/docs/HOW-TO-RELEASE-TO-NPMJS.md Test the newly published package by installing it globally or using npx. This verifies that the package is available and functional on NPM. ```bash # In a new directory npx @janreges/ai-distiller-mcp@latest # Or install globally npm install -g @janreges/ai-distiller-mcp@latest aid-mcp --version ``` -------------------------------- ### Data Sculptor Report Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md Provides a concrete example of the 'Data Sculptor' report format, illustrating the output with sample data for original block size, refined form, material removed, sculpting time, and tokens refined. ```text ┌───────────────────────────┐ │ AI Distiller: Sculpting │ └───────────────────────────┘ Original Block: 5.2MB [████████████████████] Refined Form: 128KB [░░░░░░░░░░░░░░░░░░░░] ✂️ Material Removed: 97.6% (Efficiency) ⏱️ Sculpting Time: 450ms 💎 Tokens Refined: ~1.17M saved [Chisel Progress] █░█░█░█░█░█░█░█░█░█░ ``` -------------------------------- ### Scheduler and Memory Pool Instantiation Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/05_very_complex/expected/implementation=1.txt Demonstrates the instantiation of CooperativeScheduler and MemoryPool with example configurations. This shows how to set up the core components. ```javascript const scheduler = new CooperativeScheduler() const objectPool = new MemoryPool(() => ({ data: null, reset() { this.data = null; } })) ``` -------------------------------- ### Claude Code Configuration for User-Wide Installation Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/README.md Example JSON configuration for Claude Code to set the AID_ROOT environment variable for user-wide AI Distiller installation. This variable must point to the current project directory. ```json { "mcpServers": { "aid": { "command": "npx", "args": ["-y", "@janreges/ai-distiller-mcp"], "env": { "AID_ROOT": "/absolute/path/to/your/project" } } } } ``` -------------------------------- ### Install Basic Build Tools and Cross-Compilation Toolchains on Ubuntu/Debian Source: https://github.com/janreges/ai-distiller/blob/main/docs/CROSS_COMPILATION.md Installs essential build tools and specific cross-compilation toolchains for Linux ARM64 and Windows AMD64. This is a prerequisite for cross-compiling AI Distiller on Debian-based systems. ```bash sudo apt-get update sudo apt-get install -y build-essential git # Cross-compilation toolchains sudo apt-get install -y gcc-aarch64-linux-gnu gcc-mingw-w64-x86-64 # For osxcross (macOS cross-compilation) sudo apt-get install -y clang cmake libssl-dev liblzma-dev libxml2-dev ``` -------------------------------- ### Install AI Distiller (Windows PowerShell) Source: https://github.com/janreges/ai-distiller/blob/main/README.md Install AI Distiller using PowerShell. This command downloads and executes the installation script. ```powershell iwr https://raw.githubusercontent.com/janreges/ai-distiller/main/install.ps1 -useb | iex ``` -------------------------------- ### Basic Go Constructs Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/go.md Demonstrates fundamental Go syntax like package declaration, imports (aliased and standard), constants, variable blocks, and function definitions with comments. ```go // Package basic provides fundamental Go constructs. // It serves as the baseline for parser testing. package basic import ( "fmt" // Standard library import m "math" // Aliased import ) // Global constant Pi, a fundamental value. const Pi = 3.14159 // var block for multiple declarations. var ( // IsEnabled controls a feature. Doc comments for vars are important. IsEnabled = true // UserCount is a package-level counter. UserCount int64 = 100 ) // Add sums two integers. A trivial function. // It tests basic function declaration and parameter parsing. func Add(x int, y int) int { // Line comment on the function signature // A comment inside the function body. z := x + y // Short variable declaration var result = z // Standard variable declaration _ = m.Abs(-1) // Using an aliased import fmt.Println(result) return result } ``` ```go package basic import ( "fmt" m "math" ) const Pi = 3.14159 var IsEnabled = true var UserCount int64 = 100 func Add(x int, y int) int ``` ```go // Package basic provides fundamental Go constructs. // It serves as the baseline for parser testing. package basic import ( "fmt" // Standard library import m "math" // Aliased import // Global constant Pi, a fundamental value. ) const Pi = 3.14159 // var block for multiple declarations. // IsEnabled controls a feature. Doc comments for vars are important. var IsEnabled = true // UserCount is a package-level counter. var UserCount int64 = 100 // Add sums two integers. A trivial function. // It tests basic function declaration and parameter parsing. func Add(x int, y int) int z := x + y var result = z _ = m.Abs(-1) fmt.Println(result) return result // Line comment on the function signature // A comment inside the function body. // Short variable declaration // Standard variable declaration // Using an aliased import ``` -------------------------------- ### Program Main Method with DI and Command Execution Source: https://github.com/janreges/ai-distiller/blob/main/testdata/csharp/05_very_complex/expected/implementation=1.txt Sets up a Dependency Injection container, resolves IAlgebraService and MathProcessor, creates sample vectors, and iterates through a list of commands, executing them via CalcDispatcher. ```csharp public static class Program { public static void Main() { // Build DI container. using var provider = new ServiceCollection() .AddSingleton() .AddTransient>() .BuildServiceProvider(); var algebra = provider.GetRequiredService(); // Create some vectors. var a = new VectorN(new[] {1.0, 2.0}); var b = new VectorN(new[] {3.5, -1.0}); // Issue commands. IReadOnlyList commands = new CalcCommand[] { new CalcCommand.AddCommand(a, b), new CalcCommand.DotCommand(a, b), new CalcCommand.NormalizeCommand(a), new CalcCommand.UnknownCommand() }; foreach (var cmd in commands) { try { var result = CalcDispatcher.Execute(cmd, algebra); Console.WriteLine($"Result = {result}"); } catch (Exception ex) { Console.WriteLine(ex.Message); } } } } ``` -------------------------------- ### Install Windows AMD64 Cross-Compilation Toolchain Source: https://github.com/janreges/ai-distiller/blob/main/docs/CROSS_COMPILATION.md Installs the MinGW-w64 toolchain for cross-compiling to Windows AMD64. The build process will automatically detect and use the installed `x86_64-w64-mingw32-gcc`. ```bash # Install mingw-w64 sudo apt-get install gcc-mingw-w64-x86-64 # Build will automatically use x86_64-w64-mingw32-gcc ``` -------------------------------- ### Install Linux ARM64 Cross-Compilation Toolchain Source: https://github.com/janreges/ai-distiller/blob/main/docs/CROSS_COMPILATION.md Installs the GCC toolchain for cross-compiling to Linux ARM64. The build process will automatically detect and use the installed `aarch64-linux-gnu-gcc`. ```bash # Install toolchain sudo apt-get install gcc-aarch64-linux-gnu # Build will automatically use aarch64-linux-gnu-gcc ``` -------------------------------- ### Standard Build for Current Platform Source: https://github.com/janreges/ai-distiller/blob/main/BUILD.md Use this command for a standard build on your current machine. Ensure CGO is enabled for full language support. ```bash # Standard build with full language support make build ``` ```bash # Or directly: CGO_ENABLED=1 go build -o build/aid ./cmd/aid ``` -------------------------------- ### No Emoji Summary Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary-formatters.md Example of running AI Distiller with emojis disabled. ```bash # For terminals without emoji support aid ./src --no-emoji ``` -------------------------------- ### Example Usage of ObservableFactory and ConfigManager Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/04_complex/expected/private=0,protected=0,internal=0.txt Demonstrates creating an observable configuration object using ObservableFactory and setting up a logger callback for changes. ```javascript const appConfig = ObservableFactory.create({ apiEndpoint: 'https://api.example.com/v1', timeout: 5000, features: { newUI: false, betaAccess: true } }) const loggerCallback = (change) ``` -------------------------------- ### Disable Summary Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary-formatters.md Example of running AI Distiller with all summary output disabled. ```bash # Disable summary entirely aid ./src --summary-type=off ``` -------------------------------- ### Go Source Code Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/go.md A sample Go file demonstrating package, imports with aliasing, interface, struct, and function definitions. This is the default text format output optimized for AI. ```go package main import ( "fmt" m "math" ) type Writer interface Write(p []byte) (int, error) type Logger struct prefix string writer Writer func NewLogger(prefix string) return &Logger{prefix: prefix} func (l *Logger) Log(message string) fmt.Printf("[%s] %s\n", l.prefix, message) ``` -------------------------------- ### Global Installation Command Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/npm-distribution.md Command to install the ai-distiller-mcp package globally on a user's system. ```bash npm install -g @janreges/ai-distiller-mcp ``` -------------------------------- ### Direct CLI Usage Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/python.md Shows how to use the AI Distiller CLI to generate optimal context for AI assistants and include it in a prompt. ```bash # Generate optimal context for AI assistants aid ./myproject --format text \ --strip "non-public,implementation,comments" \ --output context.txt # Include in your prompt cat < prompt.txt Here's my codebase structure: $(cat context.txt) Please help me implement a new feature that... EOF ``` -------------------------------- ### Go MemoryStorer Get Method Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/02_simple/expected/default.txt Implementation of the Get method for MemoryStorer, retrieving a value from memory. ```go // Get retrieves a value from memory. func (ms MemoryStorer) Get(key string) ([]byte, error) ``` -------------------------------- ### Publishing Process Steps Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/npm-distribution.md Steps to tag a new version, run the full release process, which includes building, creating a GitHub release, and publishing to NPM. ```bash # 1. Update version in main project git tag v0.3.0 # 2. Run full release make release # This will: # - Run tests # - Build cross-platform binaries # - Create GitHub release with binaries # - Publish NPM package ``` -------------------------------- ### Utility Functions and Instantiation Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/05_very_complex/expected/default.txt Provides utility functions like 'delay' and example task functions, along with instantiations of the CooperativeScheduler and MemoryPool. ```javascript const delay = (ms) * function counterTask() * function dataFetcherTask(task) * function complexIteratorTask() const scheduler = new CooperativeScheduler() const objectPool = new MemoryPool(() => ({ data: null, reset() { this.data = null; } })) ``` -------------------------------- ### Include Implementations for Small Projects Source: https://github.com/janreges/ai-distiller/blob/main/README.md For smaller projects, include implementations in the analysis to gain a more complete understanding. Use the --implementation=1 flag. ```bash aid ./my-small-lib --implementation=1 ``` -------------------------------- ### OrderService Class with Proxied Methods Source: https://github.com/janreges/ai-distiller/blob/main/testdata/php/05_very_complex/expected/private=1,protected=1,internal=1,implementation=0.txt An example service class demonstrating the use of ProxyTarget, Intercept, and Memoize attributes on its methods. ```php #[ProxyTarget(['calculatePrice', 'processOrder'], 'OrderServiceProxy')] class OrderService { private AsyncOperationManager $asyncManager; #[Memoize(ttl: 1800, keyGenerator: 'generatePriceKey')] #[Intercept(before: 'logPriceCalculation', after: 'validatePriceResult')] public calculatePrice(list $items, string $currency = 'USD'): float #[Intercept(before: 'validateOrder', after: 'notifyOrderProcessed')] public processOrder(array{customer_id: int, items: list, payment_method: string} $orderData): string Order ID public generatePriceKey(string $methodName, array $arguments): string Cache key protected logPriceCalculation(array $items, string $currency): void protected validatePriceResult(float $result): void protected validateOrder(array $orderData): void protected notifyOrderProcessed(string $orderId): void private getCurrencyMultiplier(string $currency): float private processPayment(array $paymentData): void private updateInventory(array $items): void private sendConfirmation(array $customerData): void public getOrderStatus(string $orderId): array Status information } ``` -------------------------------- ### Nested .aidignore Files Example Source: https://github.com/janreges/ai-distiller/blob/main/README.md Demonstrates the use of nested .aidignore files for more specific control over file inclusion and exclusion within subdirectories. ```bash # project/.aidignore *.test.py !vendor/ # Include vendor in this project # project/src/.aidignore test_*.go *.mock.ts !test_helpers.ts # Exception: include test_helpers.ts ``` -------------------------------- ### Example Call to distillDirectory Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Illustrates how an AI assistant might call the distillDirectory tool to analyze a specific module's structure without including implementation details. ```text Claude: Let me analyze the entire authentication module structure... [Calling distillDirectory with directory_path="src/auth/", include_implementation=false] ``` -------------------------------- ### Go PostgresStorer Get Method Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/02_simple/expected/default.txt Implementation of the Get method for PostgresStorer, designed to retrieve a value from a PostgreSQL database. ```go // Get retrieves a value from Postgres. func (ps *PostgresStorer) Get(key string) ([]byte, error) ``` -------------------------------- ### Manually Run Post-Install Script Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/docs/HOW-TO-RELEASE-TO-NPMJS.md If the binary is not found after installation, you can manually run the post-install script within the package's node_modules directory. ```bash cd node_modules/@janreges/ai-distiller-mcp && npm run postinstall ``` -------------------------------- ### Go NewUser Constructor Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/01_basic/expected/expand=UpdateEmail.txt A common Go pattern for creating a new User instance. It takes an ID and an email. ```go // NewUser creates a new User. // This is a common Go pattern for a constructor. func NewUser(id string, email string) *User ``` -------------------------------- ### Cardio Monitor Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the Cardio Monitor format, showing how distillation metrics are presented with a medical monitoring theme. ```text ┌─────────────────────────────────────────┐ │ ❤️ AI Distiller Health Monitor │ ├─────────────────────────────────────────┤ │ Lead I: /\/\/\/___/\/\_/\/\__ /\/\ │ │ Lead II: \/\/\/___/\/\___/\/\/\/\___/ │ ├─────────────────────────────────────────┤ │ VITALS: │ │ Size: 5.2MB → 128KB │ │ Ratio: 97.6% reduction │ │ Time: 450ms │ │ Tokens: ~1.17M saved │ └─────────────────────────────────────────┘ ``` -------------------------------- ### ObservableFactory Usage Example Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/04_complex/expected/comments=1.txt Demonstrates creating an observable configuration object using ObservableFactory. The loggerCallback is set up to receive notifications about changes. ```javascript const RAW_OBJECT_SYMBOL: symbol = Symbol('rawObject') const objectListeners: WeakMap = { get(target, key, receiver) -> any, set(target, key, value, receiver) -> boolean } class ObservableFactory: static create(initialData: object) -> object static subscribe(observable: object, callback: Function) static unsubscribe(observable: object, callback: Function) static * getMutationHistory() -> Generator any set(key: string, value: any) getChangeHistory() -> Array // Usage Example const appConfig = ObservableFactory.create({ apiEndpoint: 'https://api.example.com/v1', timeout: 5000, features: { newUI: false, betaAccess: true } }) const loggerCallback = (change) // Triggers proxy 'set' trap and notifies subscriber // Note: This is a shallow observation. Deep observation is more complex. // Adding a new property // This change will NOT notify the loggerCallback. // module.exports = { ObservableFactory, ConfigManager, appConfig } ``` -------------------------------- ### Start Dependency-Aware Analysis with Small Depth Source: https://github.com/janreges/ai-distiller/blob/main/README.md Initiate dependency-aware analysis with a limited depth for a quick overview of code relationships. This is useful for initial exploration. ```bash # Start with small depth for quick overview aid main.py --dependency-aware --max-depth=1 ``` -------------------------------- ### Full Release Process Command Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/npm-distribution.md Executes the complete release sequence including testing, building, GitHub release, and NPM publish. Users can install the package globally after completion. ```makefile release: test lint npm-build github-release npm-publish @echo "==> Release v$(VERSION) completed!" @echo "==> Users can now install with: npm install -g @janreges/ai-distiller-mcp" ``` -------------------------------- ### User Service with Repository Source: https://github.com/janreges/ai-distiller/blob/main/testdata/csharp/03_medium/expected/implementation=1.txt This service class demonstrates how to use a repository to manage `User` entities. It includes methods for creating and retrieving users. ```csharp public record User( Id Guid, string Name, string Email, bool IsValid) : EntityBase(Id); public class UserService { public UserService(IRepository userRepository) { _userRepository = userRepository; } public async Task CreateUserAsync(string name, string email) { var user = new User(Guid.NewGuid(), name, email); if (!user.IsValid) return null; await _userRepository.AddAsync(user); return user; } public Task GetUserAsync(Guid id) => _userRepository.GetAsync(id); } ``` -------------------------------- ### Example Call to distillFile Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Demonstrates an AI assistant invoking the distillFile tool to examine the structure of a single Python service file, excluding its implementation. ```text Claude: Let me analyze the user service structure... [Calling distillFile with file_path="services/user_service.py", include_implementation=false] ``` -------------------------------- ### Example of Well-Implemented Pattern Source: https://github.com/janreges/ai-distiller/blob/main/internal/aiactions/templates/best-practices.md This snippet represents an example of a well-implemented pattern within the codebase. It serves as a positive indicator during the best practices analysis. ```plaintext // Example of well-implemented pattern ``` -------------------------------- ### Main Function and Global Variables Source: https://github.com/janreges/ai-distiller/blob/main/testdata/kotlin/04_complex/expected/private=0.txt The entry point of the application and declarations for key service instances. This sets up the application's core components. ```kotlin fun main() var notificationService var serviceJob var subscription var config var connection var orchestrator var processingJob ``` -------------------------------- ### Variant 3: Visual Progress Bar Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the visual progress bar format, illustrating the progress bar and celebratory message. ```text Distilled in 450ms! [5.2MB] ░░░░░░░░░░░░░░░ [128KB] 98% saved! ``` -------------------------------- ### Main Function and Global Variables Source: https://github.com/janreges/ai-distiller/blob/main/testdata/kotlin/04_complex/expected/comments=1.txt Entry point of the application and declaration of key service instances and configurations. ```kotlin fun main() var notificationService var serviceJob var subscription var config var connection var orchestrator var processingJob ``` -------------------------------- ### PHP Trait Support Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/php.md Demonstrates how AI Distiller recognizes and processes PHP traits and their usage within classes. Shows the input code with traits and the resulting output. ```php // Input trait Timestampable { private ?DateTime $createdAt = null; public function touch(): void { $this->createdAt = new DateTime(); } } class User { use Timestampable, Loggable; public string $name; } ``` ```php // Output trait Timestampable { public touch(): void } class User { use Timestampable; use Loggable; public name: string } ``` -------------------------------- ### Variant 1: Minimalist Sparkline Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the minimalist sparkline format, showing distillation time, size reduction, and token savings. ```text ✨ Distilled in 450ms. 📦 5.2MB → 128KB (97.6% saved). 🎟️ Tokens: ~1.2M → ~30k. ``` -------------------------------- ### Example Call to listFiles Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/mcp-integration.md Shows an AI assistant using the listFiles tool to find all Python test files within a specified directory. ```text Claude: I'll check what test files you have... [Calling listFiles with path="tests/", pattern="test_*.py"] ``` -------------------------------- ### Clone and Install osxcross Dependencies Source: https://github.com/janreges/ai-distiller/blob/main/docs/CROSS_COMPILATION.md Clones the osxcross repository and installs its required dependencies. This is the first step in setting up macOS cross-compilation on a Linux system. ```bash # Clone osxcross (already done in tools/osxcross) cd tools git clone https://github.com/tpoechtrager/osxcross # Install dependencies sudo apt-get install -y clang cmake libssl-dev liblzma-dev libxml2-dev ``` -------------------------------- ### DSL Context Initialization in Ruby Source: https://github.com/janreges/ai-distiller/blob/main/testdata/ruby/04_complex/expected/protected=0.txt Illustrates the initialization of a DSL context object, which takes a target object to operate on. ```ruby class DSLContext def initialize(target) ``` -------------------------------- ### Deep Sea Dive Log Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md An example of the Deep Sea Dive Log format, showing concrete values for data distillation metrics. ```text ┌───────────────────────────┐ │ AI Distiller: Deep Dive │ └───────────────────────────┘ 🌊 Ocean Depth: 5.2MB (Vast, uncharted) 🤿 Pearl Cache: 128KB (Condensed, valuable) 🐠 Data Density: 97.6% (Discovery Rate) ⏱️ Dive Duration: 450ms ✨ Pearls Harvested: ~1.17M tokens saved [Sonar Scan] <--[••••••••••••••••••••]--> ``` -------------------------------- ### Example Performance Analysis Format Source: https://github.com/janreges/ai-distiller/blob/main/internal/aiactions/templates/performance.md Illustrates the expected format for reporting algorithmic complexity issues, including current and optimal complexity, practical impact, and suggested fixes. ```text Function: processUserData() at UserService.ts:45 Current: O(n²) - nested loops over users and permissions Optimal: O(n log n) - using sorted merge approach Impact: At 10K users, current takes ~5s, optimal would take ~0.1s Fix: Implement hash-based lookup instead of nested iteration ``` -------------------------------- ### Worker Structure and Start Method Source: https://github.com/janreges/ai-distiller/blob/main/testdata/go/04_complex/expected/private=1,protected=1,internal=1,implementation=0.txt Defines the Worker struct with its ID, job channel, and WaitGroup. The start method initiates the worker's lifecycle. ```go package worker import ( "context" "sync" ) type Job struct { ID int } type Worker struct { id int jobChannel <-chan Job wg *sync.WaitGroup } func (w *Worker) start(ctx context.Context) ``` -------------------------------- ### Basic Java Class Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/java.md Shows a basic Java class and its AI-friendly representations. The compact version omits implementation details, while the full version includes them. ```java package com.aidi.test.basic; /** * A basic class to test fundamental parsing */ public class Basic { private static final String GREETING_PREFIX = "Hello, "; public static void main(String[] args) { String world = "World"; System.out.println(createGreeting(world)); } private static String createGreeting(String name) { return GREETING_PREFIX + name; } } ``` ```java package com.aidi.test.basic public class Basic { public static void main(String[] args); } ``` ```java package com.aidi.test.basic import java.util.Objects public class Basic { private static final String GREETING_PREFIX = "Hello, "; public static void main(String[] args) { String world = "World"; int repetitions = 3; for (int i = 0; i < repetitions; i++) { String message = createGreeting(world, i + 1); System.out.println(message); } } private static String createGreeting(String name, int number) { return String.format("%s%s #%d", GREETING_PREFIX, name, number); } } ``` -------------------------------- ### Run Migration Helper Source: https://github.com/janreges/ai-distiller/blob/main/internal/testrunner/README.md Execute the Go migration script to convert existing tests to the new directory structure and naming conventions. ```bash go run internal/testrunner/migrate.go ``` -------------------------------- ### Bash Quick Development Testing Command Source: https://github.com/janreges/ai-distiller/blob/main/CLAUDE.md Demonstrates how to use the `make aid` command for rapid development testing, combining build and run steps for the CLI. ```bash # Instead of: make && ./aid test.php --stdout # Use: make aid test.php --stdout # Works with all parameters: make aid testdata/php/06_edge_cases/source.php -vvv make aid --help ``` -------------------------------- ### Variant 4: Adaptive Emoji Header Examples Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/summary.md Multiple examples of the adaptive emoji header format, showcasing different emojis and messages based on performance. ```text 🚀 Incredible! Distilled in 450ms, saving 97.6% (5.2MB → 128KB). ``` ```text ✨ Excellent! Distilled in 320ms, saving 85.2% (3.1MB → 459KB). ``` ```text 👍 Great! Distilled in 210ms, saving 65.8% (1.8MB → 615KB). ``` ```text ✅ Success! Distilled in 120ms, saving 45.2% (1.1MB → 602KB). ``` -------------------------------- ### Quick Testing with stdin: Basic Example Source: https://github.com/janreges/ai-distiller/blob/main/CLAUDE.md Test code snippets directly using stdin without creating files. The tool automatically detects the language and outputs to stdout. ```bash echo 'class UserService: def get_user(self, id): return self.db.find(id)' | aid --format text ``` -------------------------------- ### Creating an Observable Configuration Object Source: https://github.com/janreges/ai-distiller/blob/main/testdata/javascript/04_complex/expected/default.txt Demonstrates how to create an observable configuration object using `ObservableFactory.create` with initial data. ```javascript const appConfig = ObservableFactory.create({ apiEndpoint: 'https://api.example.com/v1', timeout: 5000, features: { newUI: false, betaAccess: true } }) ``` -------------------------------- ### Install AI Distiller User-Wide Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/README.md Installs the AI Distiller MCP server globally for the user. Requires setting the AID_ROOT environment variable in Claude Code configuration. ```bash claude mcp add --scope=user aid -- npx -y @janreges/ai-distiller-mcp ``` -------------------------------- ### Visibility Options: Everything Source: https://github.com/janreges/ai-distiller/blob/main/mcp-npm/examples/example-prompts.md Configuration snippet to include all members and full method implementations, resulting in the largest output context. Use this for deep, detailed analysis. ```javascript include_private: true, include_protected: true, include_internal: true, include_implementation: true ``` -------------------------------- ### Git Commit History Example Source: https://github.com/janreges/ai-distiller/blob/main/CLAUDE.md Example output format for Git commit history, showing hash, date, time, author, and subject. Multi-line messages are indented. ```text [1b4aa1b] 2025-06-17 00:56:32 | jan.reges | fix(formatters): major C++ and Ruby formatter improvements - Ruby: Add 'def' keyword to methods, remove Python-style colons from class/module declarations - C++: Fix critical bug where implementation was always shown in text format - C++: Improve return type parsing - collect types before function declarator - C++: Fix parameter type extraction This resolves major issues in both languages' output formatting. [816a7d3] 2025-06-17 00:39:48 | jan.reges | fix(swift): improve Swift line parser formatting - Add func keyword to function declarations - Fix protocol/class/struct inheritance regex to exclude opening braces - Fix protocol property regex to be optional ``` -------------------------------- ### Troubleshooting: No Project Root Found Warning Source: https://github.com/janreges/ai-distiller/blob/main/docs/user/project-root-detection.md If you encounter a warning indicating no project root was found, create an `.aidrc` file in your project's root directory to resolve the issue and ensure consistent behavior. ```bash cd /path/to/project touch .aidrc ``` -------------------------------- ### MCP Integration Example Conversation Source: https://github.com/janreges/ai-distiller/blob/main/docs/lang/csharp.md An example conversation illustrating how Claude, integrated with AI Distiller via MCP, can analyze a C# codebase and provide insights and suggestions for improvement. ```text > **You**: Show me the structure of our payment processing system and identify potential improvements. > **Claude**: I'll analyze your payment processing system using AI Distiller. *Claude automatically calls:* ``` distillDirectory("Services/Payment/", include_implementation=false) listFiles("Services/Payment/", pattern="*.cs") ``` *Claude receives the distilled structure and responds:* > Based on the analysis, your payment processing system has: > > **Core Components:** > - `IPaymentProcessor` interface with methods: `ProcessPaymentAsync()`, `RefundAsync()`, `GetTransactionStatusAsync()` > - `StripePaymentProcessor : IPaymentProcessor` - Stripe implementation > - `PayPalPaymentProcessor : IPaymentProcessor` - PayPal implementation > - `PaymentService` - Orchestrator using strategy pattern > > **Identified Improvements:** > 1. **Missing Circuit Breaker**: Add resilience for external API calls > 2. **No Idempotency**: Payment operations should be idempotent > 3. **Logging Enhancement**: Current logging lacks structured data > > Here's how to implement these improvements... ``` -------------------------------- ### Program Static Class Source: https://github.com/janreges/ai-distiller/blob/main/testdata/csharp/05_very_complex/expected/private=1,protected=1,internal=1,implementation=0.txt Defines the entry point for the application and methods for service configuration. Includes private service configuration and internal logging setup. ```csharp public static class Program { public static void Main(); private static IServiceCollection ConfigureServices(); internal static void ConfigureLogging(IServiceCollection services); } ``` -------------------------------- ### JSON Structured Output Format Example Source: https://github.com/janreges/ai-distiller/blob/main/docs/internal/gemini_analysis_response.md An example of the proposed `json-structured` output format for distilled code. This format provides detailed information about code elements like files and functions. ```json { "type": "file", "path": "src/main.go", "language": "go", "children": [ { "type": "function", "name": "main", "signature": "func main()", "visibility": "public", "location": {"line": 10, "column": 1} } ] } ``` -------------------------------- ### Install AI Distiller MCP Tool for Claude Source: https://github.com/janreges/ai-distiller/blob/main/README.md Install the AI Distiller MCP tool for seamless integration with Claude Code/Desktop. This enables AI agents to analyze codebases directly within conversations. ```bash # One-line installation claude mcp add aid -- npx -y @janreges/ai-distiller-mcp ```