refactor: reorganize the repo into packages/ (core + server) - #116
Merged
Conversation
codetrek
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Reorganize the repository into a top-level
packages/layout so future non-Go clients (e.g. a VSCodeextension) have a natural home alongside the Go code, without disturbing the Go build.
New layout:
packages/core/— Go modulegithub.com/codetrek/haystack/core(the search/index library).packages/server/— Go modulegithub.com/codetrek/haystack/server(the server + CLI app; holdsinternal/,cmd/,go.mod,go.sum,.go-cov.toml,config.example.yaml,Dockerfile.test).go.work(uses./packages/server+./packages/core), regeneratedvendor/,build.go,Makefile,deps/,docs/,git-hooks/,scripts/,.github/.Module paths intentionally do not carry a
packages/segment (…/core,…/server) — the repo isbuilt as a Go workspace and released as a binary, so this is consistent and
go build/go test/go run build.goall resolve viago.work.Plumbing repaired for the new layout
The bulk of the churn is repointing everything that referenced the old flat layout. Fixed and each
verified by running the real command:
ci.yml) — Core jobworking-directory: core→packages/core(all three steps)..github/workflows/scripts/test_and_coverage.sh) nowcdsinto
packages/server(it previously targeted the repo root, then brieflypackages/core), so theserver module is tested + coverage-gated again;
packages/server/.go-cov.tomlproject/excludesfixed to the
servermodule. Verified: server go-cov exits 0 overserver/…packages.packages/server/Dockerfile.testreworked for the workspace (base imagegolang:1.24to satisfy thego1.24.2toolchain; drops the now-broken rootCOPY go.mod go.sumandrelies on the mounted
vendor/); module-targetedgo testin the Dockerfile CMD and the Makefiletest-safe-raceoverride. Verified:docker build+ offline (--network=none)go testpass..gitattributesretargeted topackages/core/tokenizer/fstcjk/dict.fst(so thego:embed'd FST is not shipped as a 132-byte pointer on fresh clones). Verified viagit check-attr.go test ./.../go run .//go build ./(root is no longer a module)→ module-targeted forms; README quickstart updated (
cd haystack,cp packages/server/config.example.yaml …,go run ./packages/server/cmd/haystack …,make build/make test).packages/core/Dockerfile.test;packages/core/.gitignore.core/→.coverage/;release.ymlGo1.23→1.24.2(+setup-go@v5);.vscode/launch.jsonand root
.gitignorerepointed; stale doc comments refreshed.Verification
go build ./.../go vet/go test -short/gofmt -lgreen under the workspace.exit 0).packages/server/Dockerfile.testbuilds and runs its test offline against the vendored deps.go run build.goproduces the release binaries;make buildworks.🤖 Generated with Claude Code
via Happy