Skip to content

feat(core): Go scanner with tree-sitter infrastructure #129

@prosdev

Description

@prosdev

Summary

Implement core Go language scanner using tree-sitter WASM, establishing reusable infrastructure for future language support.

Background

Part of Epic #128: Go Language Support

Tasks

Tree-sitter Infrastructure

  • Add web-tree-sitter dependency
  • Add tree-sitter-go WASM grammar
  • Create tree-sitter utility module for query execution
  • Handle grammar loading and caching

Go Scanner Core

  • Implement GoScanner class implementing Scanner interface
  • Extract top-level functions with signatures
  • Extract struct definitions
  • Extract interface definitions
  • Extract type aliases
  • Extract exported constants and variables
  • Detect exported status (capital letter convention)

Basic Testing

  • Unit tests for each extraction type
  • Integration test with sample Go files
  • Test error handling for malformed Go files

Technical Notes

Dependencies:

{
  "web-tree-sitter": "^0.22.x",
  "tree-sitter-go": "^0.21.x"
}

File Extensions: .go

Scanner Interface:

class GoScanner implements Scanner {
  readonly language = "go";
  readonly capabilities: ScannerCapabilities = {
    syntax: true,
    types: true,
    documentation: true,
  };
  
  canHandle(filePath: string): boolean;
  async scan(files: string[], repoRoot: string): Promise<Document[]>;
}

Acceptance Criteria

  • GoScanner extracts functions, structs, interfaces, types from .go files
  • Tree-sitter infrastructure is modular and reusable
  • Basic test coverage for core extraction
  • Scanner can be instantiated and used standalone

References

  • Scanner types: packages/core/src/scanner/types.ts
  • TypeScript scanner example: packages/core/src/scanner/typescript.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg:corepackages/core - indexer, scanner, vectortype:featureNew functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions