Skip to content

Add engine binary distribution — cross-compile, release, auto-bootstrap - #47

Merged
5uck1ess merged 4 commits into
mainfrom
feat/engine-binary-distribution
Apr 10, 2026
Merged

Add engine binary distribution — cross-compile, release, auto-bootstrap#47
5uck1ess merged 4 commits into
mainfrom
feat/engine-binary-distribution

Conversation

@5uck1ess

Copy link
Copy Markdown
Owner

Summary

The Go engine was never distributed with the plugin. Every YAML workflow invocation fell through to markdown fallback instructions — Claude ran without any deterministic enforcement. This PR fixes that.

  • Makefile: build-for (cross-compile for any GOOS/GOARCH) and build-all (6 targets: linux, darwin, windows x amd64, arm64)
  • Release workflow: Rewritten to 4-stage pipeline — version bump → draft release → parallel binary matrix build → upload assets → publish. Cleanup job deletes draft on failure.
  • Bootstrap script (scripts/install-engine.sh): Auto-detects platform, downloads the correct binary from GitHub releases, installs to /usr/local/bin, ~/.local/bin, or %LOCALAPPDATA%/devkit (Windows)
  • Commands (tri-review, tri-debug, tri-security, pr-ready): Bootstrap check before devkit workflow run. Hard stop if engine unavailable — no fallback.
  • Skills (research, deep-research, autoloop): Fallback markdown sections removed. Engine is required for determinism.
  • Status command: Now reports engine installation health.

Why this matters

Without this, the entire deterministic workflow conversion (PRs #38-#44, ~3,600 lines of work) was theater. YAML workflows existed but the engine never ran them. Claude just read the fallback docs and did whatever it wanted.

Test plan

  • cd src && make build-for GOOS=darwin GOARCH=arm64 produces bin/devkit-darwin-arm64
  • cd src && make build-for GOOS=windows GOARCH=amd64 produces bin/devkit-windows-amd64.exe
  • bash scripts/install-engine.sh --check exits 1 (binary not on PATH) or 0 (installed)
  • Release workflow YAML is valid (check Actions tab after push)
  • Commands no longer contain fallback markdown steps
  • /devkit:status shows engine health section

5uck1ess added 3 commits April 9, 2026 20:23
The Go engine was never distributed with the plugin, so all YAML workflows
fell through to markdown fallbacks and Claude ran without determinism.

- Add build-for/build-all targets to Makefile (linux, darwin, windows x amd64, arm64)
- Rewrite release workflow: draft release → parallel matrix build → upload binaries → publish
- Add scripts/install-engine.sh: auto-detect platform, download from GitHub releases
- Wire bootstrap check into all 4 commands and 3 skills that invoke the engine
- Remove all "Fallback (no engine)" markdown — engine is required, no honor system
- Add engine health check to /devkit:status
Release workflow:
- Fix tag-before-release race: inline cleanup if gh release create fails
- Fix shallow checkout: fetch-depth 0, ref main, tag version-bumped commit
- Fix PR title injection: pass notes via env var, not ${{ }} interpolation
- Fix cleanup conditions: handle cancelled state, use ::warning:: annotations
- Add checksums.txt generation in publish step

Install script:
- Add checksum verification (sha256sum/shasum) against checksums.txt
- Use curl -fSL (capital S) to keep error messages visible
- Validate downloaded file is non-empty before installing
- Export PATH after ~/.local/bin fallback so binary is immediately usable
- Remove 2>/dev/null from mkdir to surface failure reasons
- Add explicit error messages on mv failures
- Add --upgrade flag for re-downloading

Makefile:
- Replace $(eval) footgun with shell conditional for .exe extension
- Add sync-version prerequisite to build-for target

Bootstrap (DRY fix):
- Extract shared ensure-engine.sh wrapper script
- All 7 commands/skills now call ensure-engine.sh instead of inline find
- ensure-engine.sh finds install-engine.sh relative to itself first
- Guard against empty find result with explicit error
- Fix relative paths in fallback messages to absolute GitHub URLs
Review fixes:
- Checksum grep: use awk exact column match instead of substring grep
- Guard empty find in all command/skill markdown (prevents bash "" hang)
- Source install-engine.sh instead of subprocess (PATH exports propagate)
- Remove 2>/dev/null from checksum download (surface failure reasons)
- Post-install PATH verification in ensure-engine.sh

Windows support:
- Search APPDATA and LOCALAPPDATA plugin paths in ensure-engine.sh
- Search Windows plugin paths in all command/skill find patterns
- Check LOCALAPPDATA/devkit in post-install PATH scan
@5uck1ess

Copy link
Copy Markdown
Owner Author

Windows PATH issue with %LOCALAPPDATA%/devkit

That directory isn't on PATH by default, so after install the binary won't be found by ensure-engine.sh or any shell invocation.

The Linux ~/.local/bin fallback already handles this with export PATH, but that only helps the current shell session. Windows has the same problem but worse — no export equivalent in bash-on-Windows that persists.

Recommendation: After installing to %LOCALAPPDATA%/devkit on Windows, add a setx call to persist it to the user's PATH:

if [[ "$OS" == "windows" ]]; then
    install_dir="$LOCALAPPDATA/devkit"
    mkdir -p "$install_dir"
    mv "$tmp/devkit.exe" "$install_dir/devkit.exe"
    export PATH="$install_dir:$PATH"  # current session
    # Persist to user PATH for future sessions
    powershell.exe -Command "[Environment]::SetEnvironmentVariable('Path', [Environment]::GetEnvironmentVariable('Path', 'User') + ';$install_dir', 'User')"
fi

Using [Environment]::SetEnvironmentVariable via PowerShell is safer than setx because setx silently truncates PATH if it exceeds 1024 characters. The PowerShell method has no such limit.

Alternatively, could install to %USERPROFILE%\go\bin if Go is present (already on PATH), but that couples devkit to a Go installation which not all users will have.

- export PATH for current bash session after Windows install
- Use PowerShell SetEnvironmentVariable to persist to user PATH
  (safer than setx which truncates PATH > 1024 chars)
- Graceful fallback if powershell.exe not available
@5uck1ess
5uck1ess merged commit 1d4220d into main Apr 10, 2026
3 checks passed
@5uck1ess
5uck1ess deleted the feat/engine-binary-distribution branch April 10, 2026 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant