Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>AILogNew to Visual Studio Code? Get it now.
AILog

AILog

Hamza Cantürk

|
1 install
| (0) | Free
Debug project via AI
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AILog

English | Turkce

AI-Powered Automated Debug Analysis Engine for VS Code

AILog is a VS Code Chat Participant that automatically discovers and runs your project, captures runtime and test logs through intelligent retry cycles, detects flaky bugs, and uses AI to produce a structured TypeScript diagnostic report (ailog.tsx).


Features

  • Intelligent Command Discovery — Automatically scans your workspace for runnable commands (npm/yarn/pnpm scripts, .NET projects, monorepo packages) and ranks them with a scoring algorithm
  • Startup Signal Detection — Recognizes when dev servers are ready via heuristic text matching (ready in, listening on, compiled successfully, etc.) and collects 5 seconds of post-startup logs
  • Stable Failure Detection — When a process crashes with the same exit code and error pattern twice in a row, retries stop immediately (deterministic bug, not flaky)
  • Flaky Bug Detection — Runs your project in a loop (up to 5 attempts), comparing exit codes, output sizes, and diagnostic lines across runs to detect intermittent failures
  • Long-Running Process Recognition — Automatically detects web servers and other processes that never exit, stopping retries after 2 consecutive timeouts instead of exhausting all attempts
  • Multi-Service .NET Support — All runnable .NET projects (Web + Exe) are presented in the QuickPick, not just the highest-scored one
  • Broad Monorepo Support — Scans packages/, apps/, services/, projects/, and modules/ directories for child workspace packages
  • Test Report Aggregation — Scans for structured test output from Playwright, Cypress, and Jest (JSON/XML), selecting the most recently modified report
  • AI-Driven Log Analysis — Sends combined runtime + test logs to the active language model for expert-level debugging analysis
  • Structured TypeScript Output — Generates a typed ailog.tsx report with categorized errors, network issues, and UI problems with confidence levels
  • Zero External Dependencies — Uses only Node.js built-ins and VS Code APIs; no third-party packages at runtime
  • Cross-Platform Process Management — Native tree-kill implementation for both Windows (taskkill) and Unix (process.kill(-pid))
  • Multi-Workspace Support — Prompts workspace folder selection in multi-root workspaces
  • Workspace Trust Enforcement — Refuses to execute commands in untrusted workspaces

How It Works

                         +---------------------+
                         |    @ailog in Chat    |
                         |   (User triggers)    |
                         +----------+----------+
                                    |
                                    v
                    +-------------------------------+
                    |   1. COMMAND DISCOVERY         |
                    |   Scan workspace for:          |
                    |   - package.json scripts       |
                    |   - Framework configs           |
                    |   - .sln / .csproj files        |
                    |   - Monorepo child packages     |
                    |   Score & rank candidates       |
                    +---------------+---------------+
                                    |
                                    v
                    +-------------------------------+
                    |   2. USER CONSENT              |
                    |   QuickPick: top 5 commands     |
                    |   Modal confirmation dialog     |
                    +---------------+---------------+
                                    |
                                    v
                    +-------------------------------+
                    |   3. PROCESS LIFECYCLE          |
                    |   +-------------------------+  |
                    |   |  Attempt 1              |  |
                    |   |  child_process.spawn    |  |
                    |   |  120s timeout / 2MB buf |  |
                    |   +------------+------------+  |
                    |                |                |
                    |       Compare with prev run     |
                    |       Exit code changed? -----> FLAKY
                    |       Startup signal? --------> READY (stop)
                    |       All timeouts? ----------> LONG-RUNNING (stop)
                    |       Same crash twice? ------> STABLE FAILURE (stop)
                    |       Exit 0 twice? ----------> STABLE (stop)
                    |                |                |
                    |   +------------+------------+  |
                    |   |  Attempt 2..5           |  |
                    |   |  (if needed)            |  |
                    |   +-------------------------+  |
                    +---------------+---------------+
                                    |
                                    v
                    +-------------------------------+
                    |   4. TEST REPORT AGGREGATION   |
                    |   Scan known test folders:      |
                    |   test-results/                 |
                    |   playwright-report/            |
                    |   cypress/results/              |
                    |   jest-reports/                  |
                    |   Pick most recent .json/.xml   |
                    +---------------+---------------+
                                    |
                                    v
                    +-------------------------------+
                    |   5. AI ANALYSIS               |
                    |   Combined logs --> LLM         |
                    |   request.model.sendRequest()   |
                    |   Strict JSON-only output       |
                    +---------------+---------------+
                                    |
                                    v
                    +-------------------------------+
                    |   6. REPORT GENERATION         |
                    |   Parse AI response (JSON)      |
                    |   Fallback: raw output capture   |
                    |   Write ailog.tsx                |
                    |   Open in editor                 |
                    +-------------------------------+

Usage

In VS Code Chat

Open the Copilot Chat panel and type:

@ailog analyze my project

AILog will:

  1. Discover runnable commands in your workspace
  2. Present the top candidates via QuickPick for you to select
  3. Ask for explicit confirmation before running anything
  4. Execute the command and capture all output
  5. Analyze the logs with AI
  6. Generate ailog.tsx in your workspace root

Example Chat Session

User:    @ailog debug this project
AILog:   Starting AILog analysis...
         Selected command: dotnet run --project WebApp/WebApp.csproj
         Running dotnet run --project WebApp/WebApp.csproj (Attempt 1/5)...
         Attempt 1 exited with code timeout.
         Running dotnet run --project WebApp/WebApp.csproj (Attempt 2/5)...
         Process timed out 2 consecutive times. Treating as a long-running
         process (e.g., web server) and stopping retries.
         Analyzing logs with AI...
         Report successfully generated and saved to ailog.tsx.

Output Report Format

The generated ailog.tsx contains a structured TypeScript export:

export const debugReport = {
  run: "2026-03-12T21:18:46.002Z",
  isRawOutput: false,
  data: {
    "errors": [
      {
        "file": "Program.cs",
        "line": 42,
        "error": "NullReferenceException in database initialization",
        "confidence": "high"
      }
    ],
    "networkErrors": [
      {
        "endpoint": "/api/health",
        "status": 500,
        "confidence": "medium"
      }
    ],
    "uiIssues": [
      {
        "description": "Application never reaches ready state within timeout",
        "confidence": "low"
      }
    ]
  }
};

Command Discovery Scoring

AILog uses a weighted scoring algorithm to rank runnable commands:

Signal Score Description
scripts.dev in root package.json +70 Primary dev server script (+50 base, +20 root bonus)
scripts.start in root package.json +60 Start script (+40 base, +20 root bonus)
.NET Web project (Microsoft.NET.Sdk.Web) +70 ASP.NET Core web app (HTTP endpoints, middleware)
.NET Exe project (<OutputType>Exe</OutputType>) +60 Console application
Monorepo child scripts.dev +50 Dev script in workspace package (packages/, apps/, services/, projects/, modules/)
Framework config (Vite, Next, Nuxt) +50 Modern framework detected (+30 base, +20 root bonus)
dotnet run (generic) +40 Fallback .NET run command
.NET class library +20 Non-runnable — falls back to plain dotnet run
Monorepo root build +15 Root build as last resort

Supported Project Types

Ecosystem Detection Method
Node.js package.json scripts (dev, start)
Vite vite.config.ts / vite.config.js
Next.js next.config.js / next.config.mjs
Nuxt nuxt.config.ts / nuxt.config.js
.NET / C# .sln files + .csproj scanning (3 levels deep)
pnpm Workspaces pnpm-workspace.yaml + child package scanning
Nx nx.json
Turborepo turbo.json
Lerna lerna.json
Yarn Workspaces yarn.lock detection

Package Manager Detection

AILog automatically detects your package manager:

Lock File Package Manager Used
pnpm-lock.yaml pnpm
yarn.lock yarn
(default) npm

Flaky Bug Detection

AILog's retry loop intelligently distinguishes between five scenarios:

Startup Detected

A startup signal (ready in, listening on, compiled successfully, etc.) is found in stdout/stderr. AILog collects 5 more seconds of post-startup logs and stops — no retries needed.

Attempt 1: startup signal detected → Server is running. Stop.

Stable Success

Process exits with code 0 on two consecutive runs — no flakiness detected.

Attempt 1: exit 0 (verifying)
Attempt 2: exit 0 → Stable. Stop.

Stable Failure (Deterministic Crash)

Same non-zero exit code + same error pattern on two consecutive runs. This is a deterministic bug, not a flaky one — retries stop immediately.

Attempt 1: exit 1 (ECONNREFUSED to SQL Server)
Attempt 2: exit 1 (ECONNREFUSED to SQL Server) → Deterministic crash. Stop.

Flaky Failure

Exit codes or error patterns differ between runs.

Attempt 1: exit 1 (error in auth.ts)
Attempt 2: exit 0 → Flaky! Continue monitoring...
Attempt 3: exit 1 (different error) → Confirmed flaky.

Long-Running Process

Two consecutive timeouts — recognized as a server or daemon, not a failure.

Attempt 1: timeout (120s)
Attempt 2: timeout (120s) → Long-running process. Stop.

Output differences between timeout runs (build cache, DB warmup) are not treated as flakiness — only exit code changes trigger the flaky flag.

Error Pattern Matching

Stable failure detection uses two complementary signals:

  1. Diagnostic keyword lines — Lines containing error, exception, cannot find, eaddrinuse, econnrefused, fatal, panic, syntaxerror, typeerror, etc.
  2. Tail fingerprint — Last 20 non-empty lines with timestamps, PIDs, and durations normalized. Port numbers, HTTP status codes, and line numbers are preserved.

Either signal matching is sufficient to confirm an identical crash pattern.

Test Report Aggregation

AILog scans these directories for structured test output:

Folder Test Runner
test-results/ Playwright
playwright-report/ Playwright
cypress/results/ Cypress
jest-reports/ Jest

Selection criteria:

  • Only .json and .xml files
  • Most recently modified file wins
  • Maximum 1MB file size limit
  • coverage/ folder intentionally excluded (instrumentation data, not failure logs)

Process Management

Timeout & Buffer Limits

Parameter Value Description
Timeout 120 seconds Safety net for cold starts (e.g., Next.js first build)
Post-startup 5 seconds Additional log collection after startup signal
Buffer limit 2 MB Stdout/stderr truncated (keeps tail)
Max retries 5 Maximum execution attempts
Max test file 1 MB Test report size limit

Native Tree-Kill

No external tree-kill dependency. Platform-specific implementation:

Platform Kill Method
Windows taskkill /pid <pid> /t /f (kills process tree)
Unix process.kill(-pid) with detached: true (kill group)

Requirements

  • VS Code 1.95.0 or later
  • GitHub Copilot or compatible language model provider (for AI analysis)
  • Trusted workspace (AILog will not run in untrusted workspaces)

For .NET Projects

  • .NET SDK installed and dotnet available in PATH

For Node.js Projects

  • Node.js installed with npm, yarn, or pnpm

Privacy & Security

  • Uses your existing VS Code language model (request.model) — no external API calls
  • No data leaves your machine beyond what the language model provider handles
  • No telemetry, no tracking, no data storage
  • No API keys required — uses your active Copilot session
  • Explicit user consent required before any command execution (modal confirmation dialog)
  • Workspace Trust enforced — refuses to operate in untrusted workspaces
  • Zero runtime dependencies — only Node.js built-ins and VS Code APIs

Architecture

AILog is built as a single-file extension (~800 lines) with these core functions:

Function Responsibility
activate Registers the @ailog chat participant
handleChatRequest Orchestrates the full pipeline (discover → run → analyze → report)
discoverAndPickCommand Scans workspace, scores candidates, shows QuickPick
runProcessWithFlakyLoop Spawns processes, manages retries, detects flakiness/startup/stable failure
aggregateTestLogs Finds and reads the most recent test report
analyzeWithAI Sends logs to the language model, returns raw response
generateReportFile Parses AI JSON, writes ailog.tsx, opens in editor
decodeUtf8 Helper to decode Uint8Array from vscode.workspace.fs to string

Installation

From VSIX

  1. Download ailog-0.0.1.vsix
  2. In VS Code: Ctrl+Shift+P → Extensions: Install from VSIX...
  3. Select the .vsix file
  4. Reload VS Code

From Source

git clone https://github.com/HamzaCanturk61/AILog.git
cd AILog
npm install
npm run compile
npx vsce package --allow-missing-repository

Known Limitations

  • AI output quality depends on the active language model and log verbosity
  • Startup signal detection is heuristic — some projects may not emit any recognized strings (silent servers, non-English locales, structured JSON logging). Falls back to 120s timeout.
  • Flaky detection uses diagnostic keyword matching and tail fingerprint comparison. Edge cases: partially overlapping error lines, non-deterministic output ordering from concurrent test runners, same exit code with different root causes but similar stack traces.
  • Test report aggregation only supports JSON and XML formats
  • Single-file architecture (future: modular split planned)

License

MIT — see LICENSE for details.


Automated debugging, powered by your existing AI tools — no setup, no API keys, no external services.

Author

Hamza Canturk

GitHub

"Hataları bulmak zor, onları otomatik buldurtmak kolay."

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft