Skip to content

Fix CLI release version fallback#898

Merged
steipete merged 2 commits intosteipete:mainfrom
ThiagoCAltoe:fix-cli-release-version-file
May 11, 2026
Merged

Fix CLI release version fallback#898
steipete merged 2 commits intosteipete:mainfrom
ThiagoCAltoe:fix-cli-release-version-file

Conversation

@ThiagoCAltoe
Copy link
Copy Markdown
Contributor

Summary

  • Add a standalone VERSION file fallback for CodexBarCLI --version when the binary is not inside CodexBar.app.
  • Include VERSION in release CLI tarballs so downloaded standalone codexbar/CodexBarCLI assets report the release version.
  • Extend the release smoke test and CLI entry tests to cover the fallback.

Validation

  • git diff --check HEAD~1..HEAD

Not run locally:

  • swift test --filter CLIEntryTests because Swift is not installed in this Windows environment.

Copilot AI review requested due to automatic review settings May 11, 2026 00:13
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves CodexBarCLI --version for standalone CLI distributions by adding a fallback that reads a VERSION file located next to the executable, and ensures release artifacts include that file so the correct release version is reported outside of CodexBar.app.

Changes:

  • Add VERSION-file fallback in CodexBarCLI.currentVersion(...) when the executable isn’t inside a .app bundle.
  • Extend CLI entry tests to cover the new fallback behavior.
  • Update the release CLI workflow to include VERSION in packaged tarballs and validate --version via the fallback during smoke testing.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Tests/CodexBarTests/CLIEntryTests.swift Adds a test verifying --version can be derived from an adjacent VERSION file.
Sources/CodexBarCLI/CLIIO.swift Adds logic to read and normalize a VERSION file next to the resolved executable when .app detection fails.
.github/workflows/release-cli.yml Writes VERSION for smoke tests and includes it in the release tarball contents.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 47 to +53
guard let executablePath, !executablePath.isEmpty else { return nil }

let executableURL = URL(fileURLWithPath: executablePath).resolvingSymlinksInPath()
return Self.containingAppVersion(for: executableURL)
if let version = Self.containingAppVersion(for: executableURL) {
return version
}
return Self.adjacentVersionFileVersion(for: executableURL)
ThiagoCAltoe and others added 2 commits May 11, 2026 02:23
Co-authored-by: Thiago Costa <thiago12_fera@hotmail.com>
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7969fba5b6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 49 to +53
let executableURL = URL(fileURLWithPath: executablePath).resolvingSymlinksInPath()
return Self.containingAppVersion(for: executableURL)
if let version = Self.containingAppVersion(for: executableURL) {
return version
}
return Self.adjacentVersionFileVersion(for: executableURL)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Resolve executable path before reading adjacent VERSION

When the CLI is launched via PATH (for example, user runs codexbar), CommandLine.arguments.first can be just the program name rather than an absolute path. In that case URL(fileURLWithPath: executablePath) points to the current working directory, so the new fallback reads ./VERSION and may report an unrelated repo/project version instead of CodexBar’s release version. This regression is introduced by adding adjacentVersionFileVersion without first resolving argv[0] to the real executable location.

Useful? React with 👍 / 👎.

@steipete steipete force-pushed the fix-cli-release-version-file branch from 7969fba to 130b749 Compare May 11, 2026 01:25
@steipete steipete merged commit da957fb into steipete:main May 11, 2026
1 check passed
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.

3 participants