Skip to content

feat: macOS support (BSD date/stat, locale-safe rendering)#23

Merged
ropdias merged 1 commit into
inbrace-tech:mainfrom
xinnaider:feat/macos-support
Jun 30, 2026
Merged

feat: macOS support (BSD date/stat, locale-safe rendering)#23
ropdias merged 1 commit into
inbrace-tech:mainfrom
xinnaider:feat/macos-support

Conversation

@xinnaider

Copy link
Copy Markdown
Contributor

What

Adds macOS support, implementing the proposal in #2.

tokenline.sh abstracts the GNU-only calls behind two helpers that branch on a
one-time behavior probe (not uname, so Homebrew coreutils is picked up
automatically):

  • epoch_from_iso() — GNU date -d vs BSD date -u -j -f "%Y-%m-%dT%H:%M:%S"
    (first 19 chars of the ISO string; transcript timestamps are UTC).
  • file_mtime() — GNU stat -c %Y vs BSD stat -f %m.

On Linux the probe selects the GNU branch, which runs the original commands
verbatim
— no behavior change.

It also pins LC_ALL=C. A comma-decimal locale (e.g. pt_BR) otherwise makes
awk/printf emit 46,2k and reject dotted input, diverging from the C-locale
CI. LC_ALL is used (not LC_NUMERIC) because it wins when a user exports
LC_ALL. Output is ASCII/bytes, so this is safe.

mapfile still needs bash 4+, so macOS users brew install bash — documented in
the README and surfaced by install.sh.

Changes

  • tokenline.sh: GNU/BSD probe, epoch_from_iso, file_mtime, LC_ALL=C.
  • install.sh: date/stat checks accept BSD (GNU-first); macOS hints.
  • src/infra/system.ts: checkPlatform() accepts darwin.
  • README / AGENTS.md: requirements, troubleshooting, roadmap, platform badge.
  • changeset (minor).

Testing

  • ShellCheck -s bash clean on tokenline.sh and install.sh.
  • pnpm lint, pnpm typecheck, pnpm build pass.
  • Rendered on macOS (bash 5.x, BSD date/stat): same fixture → same lines as
    Linux, including under a hostile LC_ALL=pt_BR.UTF-8.
  • install.sh passes its dependency check on macOS with Homebrew bash + BSD
    coreutils.

Closes #2

Abstract date/stat over GNU vs BSD by probing behavior once
(epoch_from_iso, file_mtime), so macOS works without coreutils. Pin
LC_ALL=C so comma-decimal locales (e.g. pt_BR) render identically to
the C-locale CI. install.sh accepts BSD date/stat; the npm CLI accepts
darwin as a supported platform.

Closes inbrace-tech#2
@xinnaider xinnaider requested a review from ropdias as a code owner June 29, 2026 16:32
@xinnaider

Copy link
Copy Markdown
Contributor Author

Suggested labels (couldn't self-apply from a fork): platform:macos, area:statusline, area:installer, feature, effort:M.

@ropdias ropdias left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the really thorough work here, @xinnaider, excellent first contribution! 🙌

It cleanly implements #2: probing behavior instead of uname (so Homebrew
coreutils is picked up automatically), keeping the GNU branch verbatim so Linux
output is unchanged, and the LC_ALL=C pin is a great catch for comma-decimal
locales.

I reviewed and verified locally:

  • ShellCheck -s bash clean on both tokenline.sh and install.sh
  • Same fixture → identical rendered output vs main on Linux (the macOS
    acceptance criterion)

One low-severity edge case I want to track separately: the BSD parse in
epoch_from_iso() uses a fixed %Y-%m-%dT%H:%M:%S mask, guaranteed for Claude
Code's .timestamp but unverified for Antigravity's .created_at. It degrades
gracefully (mtime fallback) and doesn't touch Linux, so I'm merging as-is and
opening a follow-up issue for it.

Approving, thank you again! 🚀

@ropdias ropdias merged commit 5e7274b into inbrace-tech:main Jun 30, 2026
3 checks passed
@ropdias ropdias added platform:macos macOS support area:statusline tokenline.sh render path (model/context/cache, economics, rate limits) area:installer install.sh + npm CLI (src/cli.ts), settings.json patching effort:M Multi-file change (~half day) feature New feature or request labels Jun 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:installer install.sh + npm CLI (src/cli.ts), settings.json patching area:statusline tokenline.sh render path (model/context/cache, economics, rate limits) effort:M Multi-file change (~half day) feature New feature or request platform:macos macOS support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

macOS support (BSD date/stat, bash 3.2)

2 participants