Skip to content

Commit 24fef39

Browse files
aksOpsclaude
andauthored
refactor: hoist Go module from go/ to repo root (#162)
The /go/ subdirectory was a relic of the Java/Go coexistence period. Phase 6 cutover (#132) deleted the Java side a month ago, leaving the Go module stranded one level deep. That cost the project a clean `go install` story: users had to type `github.com/randomcodespace/codeiq/go/cmd/codeiq@v0.3.x` and pseudo- version resolution kicked in because there were no `go/vX.Y.Z` tags. This commit moves the module to the repo root so: - `go install github.com/randomcodespace/codeiq/cmd/codeiq@v0.3.x` resolves directly to the matching `vX.Y.Z` tag (no `/go/` suffix, no separate tag namespace). - `cd codeiq && go build ./cmd/codeiq` Just Works. - Standard Go project layout — what every contributor expects. ### What moved - `go/cmd/` → `cmd/` - `go/internal/` → `internal/` - `go/testdata/` → `testdata/` - `go/parity/` → `parity/` - `go/go.mod` → `go.mod` (module path drops `/go`) - `go/go.sum` → `go.sum` - `go/.gitignore` → merged into root `.gitignore` `git mv` was used for every tracked path so `git log --follow` history survives the rename. ### Mechanical rewrites - 320 Go files: import path `github.com/randomcodespace/codeiq/go/...` → `github.com/randomcodespace/codeiq/...` - 5 CI workflows: dropped `working-directory: go`, `cache-dependency-path: go/go.sum`, `cd go &&` wrappers, and the `go/cmd go/internal` jscpd target prefix. - `.goreleaser.yml`: dropped `dir: go` from each build, removed `cd go &&` from the `before:` hooks, updated all `-X …/go/internal/buildinfo.*` ldflags to the new path. - `.github/dependabot.yml`: `directory: "/go"` → `directory: "/"`. - README: replaced `cd codeiq/go` with `cd codeiq`; added an explicit `go install` example targeting the now-root-level path. - CLAUDE.md, PROJECT_SUMMARY.md, AGENTS.md: directory map + module-path callouts updated. ### Tests + verification - `CGO_ENABLED=1 go build ./...` — clean. - `CGO_ENABLED=1 go test ./... -count=1` — full suite passes, 0 FAIL across 41 test-bearing packages. - Smoke on `testdata/fixture-minimal`: - `index` exits 0 (5 files / 44 nodes / 24 edges). - `enrich` exits 0 (45 nodes / 68 edges / 1 service / FTS indexed). Historical `docs/superpowers/plans/*.md` keep their original `go/internal/...` references — those are point-in-time snapshots, not living docs. Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
1 parent c20c109 commit 24fef39

447 files changed

Lines changed: 872 additions & 912 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ version: 2
1414
updates:
1515
# ----- Go modules (the codeiq application) -----
1616
- package-ecosystem: "gomod"
17-
directory: "/go"
17+
directory: "/"
1818
schedule:
1919
interval: "weekly"
2020
day: "monday"

.github/workflows/go-ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ jobs:
2020
runs-on: ubuntu-latest
2121
env:
2222
CGO_ENABLED: "1"
23-
defaults:
24-
run:
25-
working-directory: go
2623
steps:
2724
- uses: actions/checkout@v6
2825
- uses: actions/setup-go@v6
@@ -32,7 +29,7 @@ jobs:
3229
# infinite loop) which is reachable via review.Client.Review.
3330
go-version: '1.25.10'
3431
cache: true
35-
cache-dependency-path: go/go.sum
32+
cache-dependency-path: go.sum
3633
- name: Install C toolchain
3734
run: sudo apt-get update -y && sudo apt-get install -y build-essential
3835
- name: go vet

.github/workflows/perf-gate.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
name: perf-gate
2-
32
# Performance regression gate. Runs `codeiq index` against fixture-multi-lang
43
# and asserts wall-clock + node-count budgets. Catches regressions like:
54
# - Regex pathology re-introduced (e.g. the CertificateAuthDetector
65
# pre-screen miss that pushed indexing from 0.1s → 42s on PSA).
76
# - Detector over-emission past the dedup budget.
87
#
9-
# Trigger: push to main + PRs that touch go/**. Manual via workflow_dispatch.
8+
# Trigger: push to main + PRs that touch any source. Manual via workflow_dispatch.
109
# Failure is informational on PRs (`continue-on-error`) until the threshold
1110
# is curated against real-world load; once stable, set strict gate.
12-
1311
on:
1412
push:
1513
branches: [main]
@@ -20,10 +18,8 @@ on:
2018
# status to be reported" on non-Go PRs. Wall-clock is ~1 minute; the
2119
# signal is worth the cost.
2220
workflow_dispatch:
23-
2421
permissions:
2522
contents: read
26-
2723
jobs:
2824
bench:
2925
name: index perf gate (fixture-multi-lang)
@@ -51,14 +47,13 @@ jobs:
5147
with:
5248
go-version: '1.25.10'
5349
cache: true
54-
cache-dependency-path: go/go.sum
50+
cache-dependency-path: go.sum
5551
- name: Install C toolchain
5652
run: sudo apt-get update -y && sudo apt-get install -y build-essential
5753
- name: Build codeiq
58-
working-directory: go
5954
run: go build -o /tmp/codeiq ./cmd/codeiq
6055
- name: Stage fixture (separate copy so cache writes don't dirty git)
61-
run: cp -r go/testdata/fixture-multi-lang /tmp/fm-perf
56+
run: cp -r testdata/fixture-multi-lang /tmp/fm-perf
6257
- name: Run + measure
6358
id: bench
6459
run: |
@@ -67,7 +62,6 @@ jobs:
6762
/tmp/codeiq index /tmp/fm-perf > /tmp/perf.log 2>&1
6863
END=$(date +%s.%N)
6964
ELAPSED=$(awk "BEGIN{printf \"%.3f\", $END - $START}")
70-
7165
# Parse the "Files: F Nodes: N Edges: E ..." summary line.
7266
NODES=$(awk -F'[ ]+' '/^Files:/ {print $4}' /tmp/perf.log)
7367
EDGES=$(awk -F'[ ]+' '/^Files:/ {print $6}' /tmp/perf.log)
@@ -77,12 +71,10 @@ jobs:
7771
DEDUP_NODES=${DEDUP_NODES:-0}
7872
DROPPED=$(awk -F'[ ]+' '/^Deduped:/ {for(i=1;i<=NF;i++) if($i=="Dropped:") print $(i+1)}' /tmp/perf.log)
7973
DROPPED=${DROPPED:-0}
80-
8174
echo "elapsed=$ELAPSED" >> "$GITHUB_OUTPUT"
8275
echo "nodes=$NODES" >> "$GITHUB_OUTPUT"
8376
echo "edges=$EDGES" >> "$GITHUB_OUTPUT"
8477
echo "dropped=$DROPPED" >> "$GITHUB_OUTPUT"
85-
8678
{
8779
echo "## codeiq perf gate"
8880
echo ""
@@ -94,9 +86,7 @@ jobs:
9486
echo "| deduped nodes | $DEDUP_NODES | — |"
9587
echo "| dropped phantom edges | $DROPPED | ratio gated |"
9688
} >> "$GITHUB_STEP_SUMMARY"
97-
9889
cat /tmp/perf.log >> "$GITHUB_STEP_SUMMARY"
99-
10090
# --- Hard gates ---
10191
fail=0
10292
if awk "BEGIN{exit !($ELAPSED > $MAX_INDEX_SECONDS)}"; then
@@ -129,7 +119,6 @@ jobs:
129119
RSS=$(awk -F': ' '/Maximum resident set size/ {print $2}' /tmp/perf-enrich.time)
130120
RSS=${RSS:-0}
131121
ELAPSED=$(awk -F': ' '/Elapsed \(wall clock\)/ {print $2}' /tmp/perf-enrich.time)
132-
133122
{
134123
echo ""
135124
echo "## codeiq enrich memory gate"
@@ -140,7 +129,6 @@ jobs:
140129
echo "| wall-clock | $ELAPSED | — |"
141130
} >> "$GITHUB_STEP_SUMMARY"
142131
cat /tmp/perf-enrich.log >> "$GITHUB_STEP_SUMMARY"
143-
144132
if [ "$RSS" -gt "$MAX_ENRICH_RSS_KB" ]; then
145133
echo "::error::enrich peak RSS ${RSS} KB exceeds budget ${MAX_ENRICH_RSS_KB} KB"
146134
exit 1

.github/workflows/release-darwin.yml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: release-darwin
2-
32
# darwin/arm64 release on a macos-14 runner. Attaches binaries to the
43
# existing GitHub Release created by release-go.yml (which only builds
54
# linux). Runs after the linux release lands so the target Release
@@ -11,7 +10,6 @@ name: release-darwin
1110
# - macos-14 runners are arm64 (M1+); cross-compile to darwin/arm64
1211
# happens via native CC = clang.
1312
# - The two workflows publish to the same tag → same Release.
14-
1513
on:
1614
push:
1715
tags:
@@ -21,18 +19,15 @@ on:
2119
tag:
2220
description: 'Tag to release (e.g. v0.3.0). Release must already exist.'
2321
required: true
24-
2522
permissions:
2623
contents: write
2724
id-token: write # Sigstore keyless via GitHub OIDC
2825
attestations: write
29-
3026
# Pass the input/ref to the shell via env vars (not inline `${{ }}`
3127
# interpolation) — Semgrep `yaml.github-actions.security.run-shell-injection`
3228
# rule. inputs.tag for workflow_dispatch; GITHUB_REF_NAME for tag pushes.
3329
env:
3430
TAG: ${{ github.event.inputs.tag || github.ref_name }}
35-
3631
jobs:
3732
release-darwin:
3833
name: release (darwin / arm64)
@@ -45,10 +40,8 @@ jobs:
4540
with:
4641
go-version: '1.25.10'
4742
cache: true
48-
cache-dependency-path: go/go.sum
49-
43+
cache-dependency-path: go.sum
5044
- name: Build darwin/arm64 binary
51-
working-directory: go
5245
env:
5346
CGO_ENABLED: '1'
5447
GOOS: darwin
@@ -58,32 +51,28 @@ jobs:
5851
go build \
5952
-trimpath \
6053
-ldflags "-s -w \
61-
-X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Version=${VERSION}' \
62-
-X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Commit=$(git rev-parse --short HEAD)' \
63-
-X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)' \
64-
-X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Dirty=false'" \
54+
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Version=${VERSION}' \
55+
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Commit=$(git rev-parse --short HEAD)' \
56+
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Date=$(date -u +%Y-%m-%dT%H:%M:%SZ)' \
57+
-X 'github.com/randomcodespace/codeiq/internal/buildinfo.Dirty=false'" \
6558
-o codeiq ./cmd/codeiq
66-
6759
- name: Package archive
68-
working-directory: go
6960
run: |
7061
VERSION="${TAG#v}"
7162
ARCHIVE_DIR="codeiq_${VERSION}_darwin_arm64"
7263
mkdir -p "${ARCHIVE_DIR}"
7364
cp codeiq "${ARCHIVE_DIR}/"
74-
cp ../LICENSE "${ARCHIVE_DIR}/" 2>/dev/null || true
75-
cp ../README.md "${ARCHIVE_DIR}/" 2>/dev/null || true
76-
cp ../CHANGELOG.md "${ARCHIVE_DIR}/" 2>/dev/null || true
77-
tar czf "../${ARCHIVE_DIR}.tar.gz" "${ARCHIVE_DIR}"
78-
65+
cp LICENSE "${ARCHIVE_DIR}/" 2>/dev/null || true
66+
cp README.md "${ARCHIVE_DIR}/" 2>/dev/null || true
67+
cp CHANGELOG.md "${ARCHIVE_DIR}/" 2>/dev/null || true
68+
tar czf "${ARCHIVE_DIR}.tar.gz" "${ARCHIVE_DIR}"
7969
- name: Install Syft (SBOM)
8070
uses: anchore/sbom-action/download-syft@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0
8171
- name: Generate SBOM
8272
run: |
8373
VERSION="${TAG#v}"
8474
ARCHIVE="codeiq_${VERSION}_darwin_arm64.tar.gz"
8575
syft "$ARCHIVE" --output spdx-json="${ARCHIVE}.sbom.spdx.json"
86-
8776
- name: Install Cosign (signing)
8877
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2
8978
- name: Sign archive (Sigstore keyless, bundle format)
@@ -94,7 +83,6 @@ jobs:
9483
--yes \
9584
--bundle "${ARCHIVE}.cosign.bundle" \
9685
"$ARCHIVE"
97-
9886
- name: Upload to GitHub Release
9987
env:
10088
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -116,7 +104,6 @@ jobs:
116104
done
117105
echo "::error::Release $TAG never appeared; release-go.yml may have failed"
118106
exit 1
119-
120107
- name: Attest darwin archive (build provenance)
121108
uses: actions/attest-build-provenance@a2bbfa25375fe432b6a289bc6b6cd05ecd0c4c32 # v4.1.0
122109
with:

.github/workflows/release-go.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838
with:
3939
go-version: '1.25.10'
4040
cache: true
41-
cache-dependency-path: go/go.sum
41+
cache-dependency-path: go.sum
4242
- name: Install build deps
4343
run: |
4444
sudo apt-get update -y

.github/workflows/security.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
# go-ci.yml) is the call-graph-aware companion that filters to
5151
# *reachable* vulns — keeping both gives both "have we got it"
5252
# AND "are we exposed".
53-
run: ./osv-scanner --lockfile=go/go.mod
53+
run: ./osv-scanner --lockfile=go.mod
5454

5555
trivy:
5656
name: Trivy (filesystem + container scan)
@@ -136,8 +136,8 @@ jobs:
136136
node-version: '20'
137137
- run: |
138138
# Scope jscpd to Go production code only:
139-
# - go/cmd — main entry point
140-
# - go/internal — production code (100 detectors + pipeline + MCP)
139+
# - cmd — main entry point
140+
# - internal — production code (100 detectors + pipeline + MCP)
141141
# Tests share fixture/assertion shape by design (parallelism for
142142
# catching contract regressions, not a refactoring target).
143143
#
@@ -160,7 +160,7 @@ jobs:
160160
--reporters consoleFull \
161161
--format "go" \
162162
--ignore "**/vendor/**,**/testdata/**,**/grammar/**,**/generated/**,**/dist/**,**/coverage/**,**/intelligence/extractor/**/language_extractor.go,**/detector/**/structures.go" \
163-
go/cmd go/internal
163+
cmd internal
164164
165165
sbom:
166166
name: SBOM (SPDX + CycloneDX)

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,11 @@ phase*-plan.md
113113
# ignored directory's contents cannot be re-included by a later pattern.
114114
!docs/superpowers/plans/
115115
!docs/superpowers/plans/*.md
116+
117+
# ---- merged from go/.gitignore on go/ → root hoist ----
118+
/codeiq
119+
/codeiq.exe
120+
/coverage.out
121+
/coverage.html
122+
/dist/
123+
/.cache/

.goreleaser.yml

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,23 @@
66
# CGO is required (kuzudb + go-sqlite3 native deps), so we cross-compile
77
# via per-target runners — see the release workflow matrix. This file
88
# is consumed once per target OS.
9-
109
version: 2
1110
project_name: codeiq
12-
1311
env:
1412
- CGO_ENABLED=1
1513
- GO_VERSION=1.25.10
16-
1714
before:
1815
hooks:
1916
# Sanity gate. Failing here aborts the release before any binary
20-
# leaves the runner. Goreleaser runs each hook via exec.Command
21-
# (no shell), so bare `cd go && …` fails — `cd` isn't an executable
22-
# in $PATH. Wrap in `sh -c` to get a working-directory side-effect.
23-
- sh -c "cd go && go mod download"
24-
- sh -c "cd go && go test ./... -count=1"
25-
17+
# leaves the runner. Module lives at repo root since the hoist; no
18+
# subdirectory `cd` is needed. Hooks still go via `sh -c` for parity
19+
# with the build steps and to keep shell features available.
20+
- sh -c "go mod download"
21+
- sh -c "go test ./... -count=1"
2622
builds:
2723
# linux/amd64 — native build on the ubuntu-latest runner.
2824
- id: codeiq-linux-amd64
2925
main: ./cmd/codeiq
30-
dir: go
3126
binary: codeiq
3227
env:
3328
- CGO_ENABLED=1
@@ -36,17 +31,16 @@ builds:
3631
- -trimpath
3732
ldflags:
3833
- -s -w
39-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Version={{.Version}}'
40-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Commit={{.ShortCommit}}'
41-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Date={{.Date}}'
42-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Dirty={{.IsGitDirty}}'
34+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Version={{.Version}}'
35+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Commit={{.ShortCommit}}'
36+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Date={{.Date}}'
37+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Dirty={{.IsGitDirty}}'
4338
goos: [linux]
4439
goarch: [amd64]
4540
# linux/arm64 — cross-compile from the ubuntu-latest runner using
4641
# gcc-aarch64-linux-gnu installed in the release workflow.
4742
- id: codeiq-linux-arm64
4843
main: ./cmd/codeiq
49-
dir: go
5044
binary: codeiq
5145
env:
5246
- CGO_ENABLED=1
@@ -55,15 +49,14 @@ builds:
5549
- -trimpath
5650
ldflags:
5751
- -s -w
58-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Version={{.Version}}'
59-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Commit={{.ShortCommit}}'
60-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Date={{.Date}}'
61-
- -X 'github.com/randomcodespace/codeiq/go/internal/buildinfo.Dirty={{.IsGitDirty}}'
52+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Version={{.Version}}'
53+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Commit={{.ShortCommit}}'
54+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Date={{.Date}}'
55+
- -X 'github.com/randomcodespace/codeiq/internal/buildinfo.Dirty={{.IsGitDirty}}'
6256
goos: [linux]
6357
goarch: [arm64]
6458
# darwin/arm64 ships from `release-darwin.yml` (macos-14 runner) and
6559
# attaches to the same Release that this config creates.
66-
6760
archives:
6861
- id: codeiq
6962
formats: [tar.gz]
@@ -73,14 +66,11 @@ archives:
7366
- LICENSE*
7467
- README.md
7568
- CHANGELOG.md
76-
7769
checksum:
7870
name_template: 'checksums.sha256'
7971
algorithm: sha256
80-
8172
snapshot:
8273
version_template: '{{ incpatch .Version }}-next'
83-
8474
# SBOM generation — Plan §5 SBOM signing requirement. Syft is the
8575
# OSS-CLI choice (matches the existing security.yml stack).
8676
sboms:
@@ -93,7 +83,6 @@ sboms:
9383
- '$artifact'
9484
- --output
9585
- 'spdx-json={{ .ArtifactName }}.sbom.spdx.json'
96-
9786
# Cosign keyless signing of the checksum manifest. The release workflow
9887
# supplies the OIDC token via `id-token: write`; cosign records the
9988
# signature transparency entry in Rekor (public Sigstore log). No
@@ -113,7 +102,6 @@ signs:
113102
artifacts: checksum
114103
output: true
115104
signature: '${artifact}.cosign.bundle'
116-
117105
release:
118106
github:
119107
owner: RandomCodeSpace
@@ -124,14 +112,10 @@ release:
124112
name_template: 'v{{ .Version }}'
125113
header: |
126114
## codeiq v{{ .Version }}
127-
128115
Deterministic code knowledge graph — Go single-binary release.
129-
130116
Verify the download:
131-
132117
# Checksum
133118
sha256sum -c checksums.sha256
134-
135119
# Signature (Sigstore keyless, bundle format)
136120
cosign verify-blob \
137121
--bundle checksums.sha256.cosign.bundle \

0 commit comments

Comments
 (0)