Skip to content

refactor: move ParseTree out of valueobject to enable CGO-free client builds #47

@Anthony-Bible

Description

@Anthony-Bible

Problem

ParseTree currently lives in internal/domain/valueobject/parse_tree.go and directly imports github.com/alexaandru/go-tree-sitter-bare, a CGO dependency. Because Go compiles whole packages, anything that imports valueobject pulls in the tree-sitter CGO requirement — even code that has nothing to do with parsing.

This blocks building the CLI client (cmd/client) as a static, CGO-free binary. The dependency chain is:

client → internal/application/dto → dto/connector.go → internal/domain/valueobject → parse_tree.go → go-tree-sitter-bare (CGO)

Goal

Move ParseTree (and its tree-sitter dependency) out of the domain valueobject package and into the adapter layer where it belongs (e.g. internal/adapter/outbound/treesitter). This would:

  • Keep the domain layer free of infrastructure dependencies
  • Allow cmd/client to be built with CGO_ENABLED=0 as a portable static binary
  • Better align with the hexagonal architecture (CGO/tree-sitter is an infrastructure concern, not a domain concept)

Scope

  • Move internal/domain/valueobject/parse_tree.gointernal/adapter/outbound/treesitter/
  • Update all references across chunking adapters and treesitter interfaces
  • Restore CGO_ENABLED=0 in make build-client and cross-compile targets

Notes

Workaround applied in #: changed make build-client to use CGO_ENABLED=1 so the build works in the interim.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions