Skip to content

Commit da22758

Browse files
committed
feat(terraphim_grep): hybrid search with KG boost and v1.20.0 release plumbing
PR #1825 -- completes terraphim_grep crate, adds v1.20.0 release plumbing for workspace + per-crate tagging. Refs #1743. Merge override: GitHub Actions release-comprehensive run 26364488190 verified 7/7 build targets passing; adf/build local automation failed at opaque step 4 with no published log.
2 parents 5e1706f + 7710926 commit da22758

26 files changed

Lines changed: 5234 additions & 32 deletions

.github/workflows/release-comprehensive.yml

Lines changed: 113 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- 'terraphim_server-v*'
88
- 'terraphim-ai-desktop-v*'
99
- 'terraphim_agent-v*'
10+
- 'terraphim_grep-v*'
1011
workflow_dispatch:
1112
inputs:
1213
test_run:
@@ -71,7 +72,7 @@ jobs:
7172
echo "Workspace version (from terraphim_server): $WORKSPACE_VERSION"
7273
7374
# Check key binaries
74-
BINARIES=("terraphim_server" "terraphim_agent" "terraphim-cli")
75+
BINARIES=("terraphim_server" "terraphim_agent" "terraphim-cli" "terraphim_grep")
7576
FAILED=0
7677
7778
for pkg in "${BINARIES[@]}"; do
@@ -102,17 +103,19 @@ jobs:
102103
fail-fast: false
103104
matrix:
104105
include:
105-
# Linux builds
106-
- os: ubuntu-22.04
106+
# Linux builds -- run on bigbox self-hosted runner for faster Docker
107+
# access (cross uses Docker for musl targets) and to keep paid runner
108+
# minutes for the macOS notarise + Windows builds that bigbox can't host.
109+
- os: [self-hosted, bigbox]
107110
target: x86_64-unknown-linux-gnu
108111
use_cross: false
109-
- os: ubuntu-22.04
112+
- os: [self-hosted, bigbox]
110113
target: x86_64-unknown-linux-musl
111114
use_cross: true
112-
- os: ubuntu-22.04
115+
- os: [self-hosted, bigbox]
113116
target: aarch64-unknown-linux-musl
114117
use_cross: true
115-
- os: ubuntu-22.04
118+
- os: [self-hosted, bigbox]
116119
target: armv7-unknown-linux-musleabihf
117120
use_cross: true
118121
# macOS builds
@@ -229,6 +232,13 @@ jobs:
229232
${{ matrix.use_cross && 'cross' || 'cargo' }} build --release \
230233
--target ${{ matrix.target }} -p terraphim-cli --bin terraphim-cli
231234
235+
- name: Build Grep binary
236+
shell: bash
237+
run: |
238+
${{ matrix.use_cross && 'cross' || 'cargo' }} build --release \
239+
--target ${{ matrix.target }} -p terraphim_grep --bin terraphim-grep \
240+
--features "code-search openrouter"
241+
232242
- name: Verify binary versions (native builds only)
233243
if: matrix.target == 'x86_64-unknown-linux-gnu'
234244
shell: bash
@@ -261,6 +271,14 @@ jobs:
261271
exit 1
262272
fi
263273
274+
# Verify terraphim-grep
275+
GREP_VERSION=$(./target/${{ matrix.target }}/release/terraphim-grep --version 2>&1 | head -1)
276+
echo "terraphim-grep: $GREP_VERSION"
277+
if [[ "$GREP_VERSION" != *"$EXPECTED_VERSION"* ]]; then
278+
echo "::error::terraphim-grep version mismatch: expected $EXPECTED_VERSION in '$GREP_VERSION'"
279+
exit 1
280+
fi
281+
264282
echo "All binary versions verified successfully!"
265283
266284
- name: Prepare artifacts (Unix)
@@ -279,12 +297,15 @@ jobs:
279297
-C "target/${{ matrix.target }}/release" terraphim-agent
280298
tar -czf "artifacts/terraphim-cli-${VERSION}-${{ matrix.target }}.tar.gz" \
281299
-C "target/${{ matrix.target }}/release" terraphim-cli
300+
tar -czf "artifacts/terraphim-grep-${VERSION}-${{ matrix.target }}.tar.gz" \
301+
-C "target/${{ matrix.target }}/release" terraphim-grep
282302
# Also copy raw binaries for backward compatibility
283303
if [ -f "target/${{ matrix.target }}/release/terraphim_server" ]; then
284304
cp target/${{ matrix.target }}/release/terraphim_server artifacts/terraphim_server-${{ matrix.target }}
285305
fi
286306
cp target/${{ matrix.target }}/release/terraphim-agent artifacts/terraphim-agent-${{ matrix.target }}
287307
cp target/${{ matrix.target }}/release/terraphim-cli artifacts/terraphim-cli-${{ matrix.target }}
308+
cp target/${{ matrix.target }}/release/terraphim-grep artifacts/terraphim-grep-${{ matrix.target }}
288309
chmod +x artifacts/*
289310
290311
- name: Prepare artifacts (Windows)
@@ -302,11 +323,13 @@ jobs:
302323
fi
303324
7z a -tzip "../../../artifacts/terraphim-agent-${VERSION}-${{ matrix.target }}.zip" terraphim-agent.exe
304325
7z a -tzip "../../../artifacts/terraphim-cli-${VERSION}-${{ matrix.target }}.zip" terraphim-cli.exe
326+
7z a -tzip "../../../artifacts/terraphim-grep-${VERSION}-${{ matrix.target }}.zip" terraphim-grep.exe
305327
cd -
306328
# Also copy raw binaries for backward compatibility
307329
cp target/${{ matrix.target }}/release/terraphim_server.exe artifacts/terraphim_server-${{ matrix.target }}.exe || true
308330
cp target/${{ matrix.target }}/release/terraphim-agent.exe artifacts/terraphim-agent-${{ matrix.target }}.exe || true
309331
cp target/${{ matrix.target }}/release/terraphim-cli.exe artifacts/terraphim-cli-${{ matrix.target }}.exe || true
332+
cp target/${{ matrix.target }}/release/terraphim-grep.exe artifacts/terraphim-grep-${{ matrix.target }}.exe || true
310333
311334
- name: Upload binary artifacts
312335
uses: actions/upload-artifact@v5
@@ -349,15 +372,23 @@ jobs:
349372
aarch64/terraphim-agent-aarch64-apple-darwin \
350373
-output universal/terraphim-agent-universal-apple-darwin
351374
375+
# Create universal binary for terraphim-grep
376+
lipo -create \
377+
x86_64/terraphim-grep-x86_64-apple-darwin \
378+
aarch64/terraphim-grep-aarch64-apple-darwin \
379+
-output universal/terraphim-grep-universal-apple-darwin
380+
352381
chmod +x universal/*
353382
354383
# Verify universal binaries
355384
echo "Verifying universal binaries:"
356385
file universal/terraphim_server-universal-apple-darwin
357386
file universal/terraphim-agent-universal-apple-darwin
387+
file universal/terraphim-grep-universal-apple-darwin
358388
359389
lipo -info universal/terraphim_server-universal-apple-darwin
360390
lipo -info universal/terraphim-agent-universal-apple-darwin
391+
lipo -info universal/terraphim-grep-universal-apple-darwin
361392
362393
- name: Upload universal binaries
363394
uses: actions/upload-artifact@v5
@@ -424,6 +455,18 @@ jobs:
424455
"$CERT_BASE64" \
425456
"$CERT_PASSWORD"
426457
458+
- name: Sign and notarize terraphim-grep
459+
env:
460+
RUNNER_TEMP: ${{ runner.temp }}
461+
run: |
462+
./scripts/sign-macos-binary.sh \
463+
"universal/terraphim-grep-universal-apple-darwin" \
464+
"$APPLE_ID" \
465+
"$APPLE_TEAM_ID" \
466+
"$APPLE_APP_PASSWORD" \
467+
"$CERT_BASE64" \
468+
"$CERT_PASSWORD"
469+
427470
- name: Verify signed binaries
428471
run: |
429472
echo "==> Verifying terraphim_server"
@@ -434,6 +477,10 @@ jobs:
434477
codesign --verify --deep --strict --verbose=2 universal/terraphim-agent-universal-apple-darwin
435478
file universal/terraphim-agent-universal-apple-darwin
436479
480+
echo "==> Verifying terraphim-grep"
481+
codesign --verify --deep --strict --verbose=2 universal/terraphim-grep-universal-apple-darwin
482+
file universal/terraphim-grep-universal-apple-darwin
483+
437484
- name: Upload signed binaries
438485
uses: actions/upload-artifact@v5
439486
with:
@@ -442,7 +489,7 @@ jobs:
442489

443490
build-debian-packages:
444491
name: Build Debian packages
445-
runs-on: ubuntu-22.04
492+
runs-on: [self-hosted, bigbox]
446493
steps:
447494
- name: Checkout repository
448495
uses: actions/checkout@v6
@@ -492,6 +539,13 @@ jobs:
492539
# Build agent package
493540
cargo deb -p terraphim_agent --output target/debian/
494541
542+
# Build grep package (requires code-search + openrouter features for the
543+
# hybrid pipeline; cargo-deb reads [package.metadata.deb] from the crate's
544+
# Cargo.toml). The compile step uses the same features the release binary
545+
# build uses so behaviour parity with the tarball artefacts is preserved.
546+
cargo deb -p terraphim_grep --output target/debian/ \
547+
-- --features "code-search openrouter"
548+
495549
- name: Upload Debian packages
496550
uses: actions/upload-artifact@v5
497551
with:
@@ -667,13 +721,20 @@ jobs:
667721
**Signed and Notarized** - No Gatekeeper warnings
668722
- `terraphim_server-universal-apple-darwin`: Server binary for all Macs
669723
- `terraphim-agent-universal-apple-darwin`: TUI binary for all Macs
724+
- `terraphim-grep-universal-apple-darwin`: Hybrid grep CLI for all Macs
670725
671726
### Server Binaries
672727
- `terraphim_server-*`: Server binaries for various platforms
673728
674729
### TUI Binaries
675730
- `terraphim-agent-*`: Terminal UI binaries for various platforms
676731
732+
### Grep Binaries
733+
- `terraphim-grep-*`: Hybrid grep CLI (knowledge-graph boost + LLM fallback)
734+
for various platforms. See
735+
[crates/terraphim_grep/RELEASE_NOTES_v1.20.0.md](https://github.com/terraphim/terraphim-ai/blob/main/crates/terraphim_grep/RELEASE_NOTES_v1.20.0.md)
736+
for crate-focused details.
737+
677738
### Desktop Applications
678739
Desktop applications are now built and released separately in the [terraphim-ai-desktop](https://github.com/terraphim/terraphim-ai-desktop) repository.
679740
- `*.dmg`: macOS desktop installer
@@ -731,10 +792,12 @@ jobs:
731792
# macOS universal binaries
732793
SERVER_SHA=$(grep "terraphim_server-universal-apple-darwin" checksums.txt | awk '{print $1}')
733794
AGENT_SHA=$(grep "terraphim-agent-universal-apple-darwin" checksums.txt | awk '{print $1}')
795+
GREP_SHA=$(grep "terraphim-grep-universal-apple-darwin" checksums.txt | awk '{print $1}')
734796
735797
# Linux GNU binaries (for Homebrew)
736798
SERVER_LINUX_GNU_SHA=$(grep "terraphim_server-x86_64-unknown-linux-gnu" checksums.txt | grep -v tar.gz | awk '{print $1}')
737799
AGENT_LINUX_GNU_SHA=$(grep "terraphim-agent-x86_64-unknown-linux-gnu" checksums.txt | grep -v tar.gz | awk '{print $1}')
800+
GREP_LINUX_GNU_SHA=$(grep "terraphim-grep-x86_64-unknown-linux-gnu" checksums.txt | grep -v tar.gz | awk '{print $1}')
738801
739802
# Fallback to MUSL if GNU not available
740803
if [ -z "$SERVER_LINUX_GNU_SHA" ]; then
@@ -745,16 +808,24 @@ jobs:
745808
AGENT_LINUX_GNU_SHA=$(grep "terraphim-agent-x86_64-unknown-linux-musl" checksums.txt | grep -v tar.gz | awk '{print $1}')
746809
echo "⚠️ Using MUSL fallback for agent"
747810
fi
811+
if [ -z "$GREP_LINUX_GNU_SHA" ]; then
812+
GREP_LINUX_GNU_SHA=$(grep "terraphim-grep-x86_64-unknown-linux-musl" checksums.txt | grep -v tar.gz | awk '{print $1}')
813+
echo "⚠️ Using MUSL fallback for grep"
814+
fi
748815
749816
echo "server_sha=$SERVER_SHA" >> $GITHUB_OUTPUT
750817
echo "agent_sha=$AGENT_SHA" >> $GITHUB_OUTPUT
818+
echo "grep_sha=$GREP_SHA" >> $GITHUB_OUTPUT
751819
echo "server_linux_gnu_sha=$SERVER_LINUX_GNU_SHA" >> $GITHUB_OUTPUT
752820
echo "agent_linux_gnu_sha=$AGENT_LINUX_GNU_SHA" >> $GITHUB_OUTPUT
821+
echo "grep_linux_gnu_sha=$GREP_LINUX_GNU_SHA" >> $GITHUB_OUTPUT
753822
754823
echo "Server universal binary SHA256: $SERVER_SHA"
755824
echo "Agent universal binary SHA256: $AGENT_SHA"
825+
echo "Grep universal binary SHA256: $GREP_SHA"
756826
echo "Server Linux GNU SHA256: $SERVER_LINUX_GNU_SHA"
757827
echo "Agent Linux GNU SHA256: $AGENT_LINUX_GNU_SHA"
828+
echo "Grep Linux GNU SHA256: $GREP_LINUX_GNU_SHA"
758829
759830
- name: Clone Homebrew tap
760831
run: |
@@ -768,8 +839,10 @@ jobs:
768839
VERSION: ${{ steps.version.outputs.version }}
769840
SERVER_SHA: ${{ steps.checksums.outputs.server_sha }}
770841
AGENT_SHA: ${{ steps.checksums.outputs.agent_sha }}
842+
GREP_SHA: ${{ steps.checksums.outputs.grep_sha }}
771843
SERVER_LINUX_GNU_SHA: ${{ steps.checksums.outputs.server_linux_gnu_sha }}
772844
AGENT_LINUX_GNU_SHA: ${{ steps.checksums.outputs.agent_linux_gnu_sha }}
845+
GREP_LINUX_GNU_SHA: ${{ steps.checksums.outputs.grep_linux_gnu_sha }}
773846
run: |
774847
cd homebrew-terraphim
775848
@@ -844,11 +917,44 @@ jobs:
844917
end
845918
EOF
846919
920+
# Update terraphim-grep.rb -- hybrid grep CLI with KG boost and LLM fallback
921+
cat > Formula/terraphim-grep.rb << EOF
922+
class TerraphimGrep < Formula
923+
desc "Intelligent hybrid grep with knowledge-graph boosting and LLM fallback"
924+
homepage "https://github.com/terraphim/terraphim-ai"
925+
version "${VERSION}"
926+
license "MIT"
927+
928+
on_macos do
929+
url "https://github.com/terraphim/terraphim-ai/releases/download/v${VERSION}/terraphim-grep-universal-apple-darwin"
930+
sha256 "${GREP_SHA}"
931+
end
932+
933+
on_linux do
934+
url "https://github.com/terraphim/terraphim-ai/releases/download/v${VERSION}/terraphim-grep-x86_64-unknown-linux-gnu"
935+
sha256 "${GREP_LINUX_GNU_SHA}"
936+
end
937+
938+
def install
939+
if OS.mac?
940+
bin.install "terraphim-grep-universal-apple-darwin" => "terraphim-grep"
941+
else
942+
bin.install "terraphim-grep-x86_64-unknown-linux-gnu" => "terraphim-grep"
943+
end
944+
end
945+
946+
test do
947+
assert_match "terraphim", shell_output("#{bin}/terraphim-grep --version 2>&1", 0)
948+
end
949+
end
950+
EOF
951+
847952
git add Formula/
848953
git commit -m "feat: update formulas to v${VERSION} with universal binaries
849954
850955
- terraphim-server v${VERSION}
851956
- terraphim-agent v${VERSION}
957+
- terraphim-grep v${VERSION}
852958
853959
🤖 Automated update from release workflow"
854960

.release-plz.toml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ name = "terraphim_agent"
4141
changelog_path = "./crates/terraphim_tui/CHANGELOG.md"
4242
changelog_update = true
4343

44+
[[package]]
45+
name = "terraphim_grep"
46+
changelog_path = "./crates/terraphim_grep/CHANGELOG.md"
47+
changelog_update = true
48+
4449
# Don't release internal crates automatically
4550
[[package]]
4651
name = "terraphim_automata"
@@ -64,7 +69,13 @@ release = false
6469

6570
[[package]]
6671
name = "terraphim_service"
67-
release = false
72+
# Released as part of the workspace publish chain. Was previously `release = false`,
73+
# which let the crates.io version drift from `terraphim_types` (1.16.34 vs 1.19.3) and
74+
# left consumers like `terraphim_grep` unable to `cargo install` because the published
75+
# service didn't initialise `min_quality`/`quality_score` fields added in newer types.
76+
# Releasing service alongside types keeps the chain coherent for downstream consumers.
77+
changelog_path = "./crates/terraphim_service/CHANGELOG.md"
78+
changelog_update = true
6879

6980
[[package]]
7081
name = "terraphim_settings"

0 commit comments

Comments
 (0)