diff --git a/codeagent-wrapper/main.go b/codeagent-wrapper/main.go index c5d0772..a77eea0 100644 --- a/codeagent-wrapper/main.go +++ b/codeagent-wrapper/main.go @@ -14,7 +14,7 @@ import ( ) const ( - version = "5.7.2" + version = "5.8.0" defaultWorkdir = "." defaultTimeout = 7200 // seconds (2 hours) defaultCoverageTarget = 90.0 diff --git a/codeagent-wrapper/main_test.go b/codeagent-wrapper/main_test.go index 2f1da9e..5b98c88 100644 --- a/codeagent-wrapper/main_test.go +++ b/codeagent-wrapper/main_test.go @@ -3051,7 +3051,7 @@ func TestVersionFlag(t *testing.T) { } }) - want := "codeagent-wrapper version 5.7.2\n" + want := "codeagent-wrapper version 5.8.0\n" if output != want { t.Fatalf("output = %q, want %q", output, want) @@ -3067,7 +3067,7 @@ func TestVersionShortFlag(t *testing.T) { } }) - want := "codeagent-wrapper version 5.7.2\n" + want := "codeagent-wrapper version 5.8.0\n" if output != want { t.Fatalf("output = %q, want %q", output, want) @@ -3083,7 +3083,7 @@ func TestVersionLegacyAlias(t *testing.T) { } }) - want := "codex-wrapper version 5.7.2\n" + want := "codex-wrapper version 5.8.0\n" if output != want { t.Fatalf("output = %q, want %q", output, want) diff --git a/package.json b/package.json index 6b8fe3c..e0442f6 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ccg-workflow", - "version": "1.7.93", + "version": "1.7.94", "description": "Claude + Codex + Gemini multi-model collaboration system - smart routing development workflow", "type": "module", "packageManager": "pnpm@10.17.1", diff --git a/src/utils/installer.ts b/src/utils/installer.ts index 15c8652..e9f8b8d 100644 --- a/src/utils/installer.ts +++ b/src/utils/installer.ts @@ -41,6 +41,17 @@ export { writeFastContextPrompt, } from './installer-prompt' +// ═══════════════════════════════════════════════════════ +// Binary version tracking +// ═══════════════════════════════════════════════════════ + +/** + * Expected codeagent-wrapper binary version. + * Must match the `version` constant in codeagent-wrapper/main.go. + * When this differs from the installed binary, update triggers re-download. + */ +const EXPECTED_BINARY_VERSION = '5.8.0' + // ═══════════════════════════════════════════════════════ // Install context — shared across sub-functions // ═══════════════════════════════════════════════════════ @@ -499,15 +510,22 @@ async function installBinaryFile(ctx: InstallContext): Promise { const destBinary = join(binDir, process.platform === 'win32' ? 'codeagent-wrapper.exe' : 'codeagent-wrapper') - // Skip download if binary already exists and is functional + // Check if binary exists, is functional, AND version matches if (await fs.pathExists(destBinary)) { try { const { execSync } = await import('node:child_process') - execSync(`"${destBinary}" --version`, { stdio: 'pipe' }) - // Binary exists and works — skip download - ctx.result.binPath = binDir - ctx.result.binInstalled = true - return + const versionOutput = execSync(`"${destBinary}" --version`, { stdio: 'pipe' }).toString().trim() + const installedVersion = versionOutput.replace(/^.*version\s*/, '') + + // Compare with expected version from package + const expectedVersion = EXPECTED_BINARY_VERSION + if (installedVersion === expectedVersion) { + // Binary exists, works, and version matches — skip download + ctx.result.binPath = binDir + ctx.result.binInstalled = true + return + } + // Version mismatch — fall through to re-download } catch { // Binary exists but broken — fall through to re-download