Commit Graph

7 Commits

Author SHA1 Message Date
Grok
700e70a355 fix: resolve golangci-lint v2.1.6 staticcheck failures
All checks were successful
CI / Test (push) Successful in 17s
Release / Create Release (push) Successful in 1m33s
CI / Lint (push) Successful in 22s
CI / Build (push) Successful in 20s
- SA9003 (empty branch): rewrote TestFormatLargeAndScientific to actually
  call FormatForDisplay and perform a minimal non-empty assertion instead of
  an if-with-no-body.
- SA1019 (deprecated keyStyle.Copy()): replaced all .Copy() with direct
  assignment or method chaining on the base keyStyle. lipgloss styles are
  immutable and their builder methods already return new instances.
- Removed now-unused "strings" import from calc_test.go.
- All changes pass go test -short, go build, go vet, and gofmt.

This makes the Lint job (which runs golangci-lint-action + staticcheck) green.
The v0.3.0 tag was already pushed from the prior commit; this is master
hygiene so future CI + any follow-up tags are clean.
2026-06-06 17:09:43 +01:00
Grok
17303d1446 feat(calc,ui): complete tight-mode HEX entry with cross-base chaining and result formatting
Some checks failed
CI / Test (push) Successful in 16s
Release / Create Release (push) Failing after 2m1s
CI / Build (push) Has been skipped
CI / Lint (push) Failing after 26s
- Add formatResultEntryForBase + update Equals/Mod/ChangeSign so committed results
  format in the active display base (e.g. HEX shows "C8", "1B0" not decimal).
- Robust per-line centering for dynamic A-F hexRow and keypad rows under display
  (prevents split key borders/decorations on bottom row).
- Updated test expectation for HEX result digits.
- Enables validated cross-base flow: DEC entry, Tab to HEX, continue op, see
  result in active base, Tab back converts displayed value correctly.
- style: gofmt -s all touched sources (ui_test.go, version_test.go etc.).
- ci: add lint and cross targets to Makefile.
  - cross produces the 6 platform binaries expected by release.yml on v* tags.
  - lint target for local parity (CI continues to use golangci-lint-action).

This is the v0.3.0 release-ready state (user-validated: 100 DEC -> Tab HEX +64 = C8 -> Tab DEC 200).
2026-06-06 17:04:11 +01:00
Grok
b78f6d7c2b test: add thorough test coverage for engine, UI model, and version
Some checks failed
Release / Create Release (push) Failing after 12s
CI / Test (push) Successful in 16s
CI / Build (push) Has been skipped
CI / Lint (push) Failing after 28s
- Expanded calc_test.go with additional cases for decimal point, backspace, sign change, mod, div0, multi-step ops, negatives, format, is-integer with entry, etc. (calc coverage to ~86%)
- New ui_test.go: unit tests for App (New, Update key sequences for digits/ops/MOD/HEX entry/base cycle/CERR/clears/flashes/pressed state, View contains checks). ui coverage ~82%
- New version_test.go: 100% for String()
- All tests pass (go test ./...); total project coverage ~81%
- Complements the HEX entry and UI polish work.
- Uses table-friendly and direct model testing suitable for the Bubble Tea spike.
2026-06-06 16:02:56 +01:00
Grok
0812bc162f sketch: tight-scope HEX entry via keyboard (A-F only while base=HEX)
- Engine:
  * EnterDigit now accepts A-F (uppercased) only for BaseHEX; decimal path now validates 0-9.
  * EnterDecimalPoint ignored for non-DEC.
  * currentNumericValue parses entry using current base (ParseInt base 16 for HEX, extended to BIN/OCT for robustness).
  * FormatForDisplay prefers returning the raw (upper) entry string when active *and* base indicator matches (so typing 1A in HEX shows '1A', not 26).
  * CycleBase now commits any active entry (parsed with old base) before switching. This makes mid-entry Tab safe and preserves CERR semantics.
- UI: added A-F/a-f key handling in Update (only when CurrentBase()==HEX). Sets pressedKey (harmless since no visual A-F buttons in tight scope).
- Tests: added 4 focused tests for hex digit acceptance, decimal ignore, mode gating, and mid-entry base switch + subsequent arithmetic.
- All existing behavior (DEC, CERR, etc.) preserved.
- Build + tests green.

This is the minimal 'keyboard only while indicator says HEX' scope requested. No visual A-F keypad buttons, no fractional hex, no changes to BIN/OCT entry.
2026-06-06 15:55:02 +01:00
Grok
0af68d45eb fix(engine): remove unused fmt import
Engine now builds and all CERR + arithmetic tests pass cleanly.
2026-06-06 14:29:42 +01:00
Grok
a3ed82c6d9 feat(engine): implement core calculation engine (phase 2)
- float64 decimal math + classic entry buffer (in-progress digits visible)
- CycleBase() with IsInteger() (epsilon) + ErrConversionNotPossible (CERR)
- FormatForDisplay() for DEC/HEX/BIN/OCT (integer formatting for non-DEC)
- Basic ops: + - * / and MOD (math.Mod)
- Equals, SetOperator, EnterDigit/DecimalPoint, ClearEntry, AllClear, ChangeSign, Backspace
- Comprehensive tests covering the critical CERR path (23/6, 1/3 + BASE) plus arithmetic and MOD

This completes the pure engine. The engine is now usable by the upcoming TUI spike. Paper trail updated.
2026-06-06 14:29:36 +01:00
Grok
2a26148c8a chore(skeleton): minimal Go project layout + build system
- go.mod (1.24.2 + initial bubbletea/lipgloss)
- Makefile (build, install to ~/.local/bin/gralculator, test, clean; ldflags version injection)
- internal/version (ldflags-compatible String())
- main.go stub (version flag + placeholder)
- internal/calc/ (Engine skeleton with Base, CycleBase, IsInteger, ErrConversionNotPossible, FormatForDisplay stub + basic tests for CERR path)
- internal/ui/ (App model stub with Tab handling placeholder + lipgloss import for future rendering)

This establishes the three-phase foundation. Next: flesh out engine (phase 2), then TUI spike (phase 3). Paper trail continues.
2026-06-06 14:28:59 +01:00