Skip to content

Parse stack traces and display file/line context #81

@naheel0

Description

@naheel0

Title: Parse stack traces and display file/line context

Problem

CLI output currently shows only the error message; users need a quick pointer to the file and line that caused the error.

Proposed change

Add a stack trace parser that extracts file path, line, column, and function name from Node-style stack traces. Show a small source snippet around the error location when available and expose this info in JSON output.

Files to change

  • add lib/stack-parser.js
  • update lib/formatter.js to include location + snippet
  • update bin/index.js to pass stack to matcher/formatter

Tasks

  • Implement parseStackTrace(errorString) to extract frames (file, line, col, function).
  • Implement sourceSnippet(filepath, line, radius) to read a safe context sample.
  • Add --context flag to run/analyze to enable snippet printing.
  • Add tests for common Node.js stack formats.

Acceptance criteria

  • For input with a stack trace, the CLI prints the location and a 5-line snippet.
  • JSON output includes a locations array with frame details.

Labels: enhancement, medium-priority

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requestmedium-priorityMedium-priority work

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions