Skip to content

feat(sheets): add read-format command and borders guardrails#284

Merged
steipete merged 3 commits intosteipete:mainfrom
nilzzzzzz:feature/sheets-read-format-borders
Mar 8, 2026
Merged

feat(sheets): add read-format command and borders guardrails#284
steipete merged 3 commits intosteipete:mainfrom
nilzzzzzz:feature/sheets-read-format-borders

Conversation

@nilzzzzzz
Copy link
Copy Markdown
Contributor

@nilzzzzzz nilzzzzzz commented Feb 16, 2026

Description

Hi @steipete,

follow-up to #72.
This PR adds Sheets format readback and tightens formatting safety around border typos.

Also includes a tiny contacts compile fix (2 signature type corrections) to unblock CI/build on current main.

What this PR changes

  • Adds gog sheets read-format (aliases: get-format, format-read).
  • Adds --effective mode for read-format.
  • Hardens gog sheets format input validation for boarders typo and unknown JSON keys.
  • Adds tests, docs, changelog updates.
  • Fixes contacts helper arg types to make go build / CI pass.

Command behavior (clear contract)

gog sheets read-format <spreadsheetId> <range>

  • Reads user-entered cell format (userEnteredFormat) for every formatted cell in range.
  • JSON output fields:
    • spreadsheetId
    • range
    • source (userEnteredFormat)
    • formats[] with sheet, a1, row, col, value, format
  • Text output:
    • table columns: A1, VALUE, FORMAT (format serialized as JSON)

gog sheets read-format <spreadsheetId> <range> --effective

  • Reads effective computed format (effectiveFormat) instead of user-entered format.
  • Useful to verify final rendered format after defaults/theme/rules.

gog sheets format ... --format-json ... --format-fields ... (existing command improved)

  • --format-json now uses strict decode (DisallowUnknownFields) so unknown keys fail early.
  • --format-fields now detects boarders typo and returns explicit guidance to use borders.

Why the contacts fix is in this PR

Current main has a compile break in internal/cmd/contacts_crud.go due mismatched helper argument types.
Without fixing that, CI fails before Sheets tests run.
This PR applies the minimal 2-line signature correction only to unblock build.

Prompt history (verbatim-ish)

  • "We have the format command for sheets but not a way to read it... put the read format value ... and check the boarders"
  • "install it also and update my skil"
  • "did we add tests like in the other pr?"
  • "...test to format this nicely"
  • "mention it also that we did this to unblock ci. Explain better what really the different commands we implemnted do in the pr, make it less sloppy"

How has this been tested?

  • go build ./cmd/gog
  • go test ./internal/cmd -run 'TestSheetsReadFormatCmd|TestSheetsFormatCmd_BordersTopStyle|TestApplyForceSendFields_BordersTopStyle|TestHasBoardersTypo|TestSheetsFormat_ValidationErrors|TestExecute_SheetsMoreCommands|TestContacts(Create|Update)' -count=1
  • Manual live test on provided sheet/tab:
    • spreadsheet: 1T2R_IXqmrSz1rGOj1ERq7U7TM2v3wZ_2rOsgcYA8jAQ
    • tab (gid=1911010233): Original Plan
    • applied header/body/border/number formatting
    • verified via gog sheets read-format ... --json

@nilzzzzzz nilzzzzzz marked this pull request as draft February 16, 2026 10:43
@nilzzzzzz nilzzzzzz marked this pull request as ready for review February 16, 2026 10:54
@steipete steipete force-pushed the feature/sheets-read-format-borders branch from ea8662c to 57ff818 Compare March 8, 2026 17:23
@steipete steipete merged commit 79546b9 into steipete:main Mar 8, 2026
2 of 5 checks passed
@steipete
Copy link
Copy Markdown
Owner

steipete commented Mar 8, 2026

Landed after manual rebase/conflict resolution onto main.

  • Gate: go test ./internal/cmd -run 'TestSheets(ReadFormatCmd|FormatCmd_BordersTopStyle|ApplyForceSendFields_BordersTopStyle|HasBoardersTypo|Execute_SheetsMoreCommands)' -count=1; make ci
  • Land commit: 57ff818
  • Merge commit: 79546b9

Thanks @nilzzzzzz!

klodr pushed a commit to klodr/gogcli that referenced this pull request Apr 22, 2026
…e#284)

* feat(sheets): add read-format and harden borders formatting

* style(sheets): satisfy format check on landed branch (steipete#284)

* refactor(sheets): satisfy read-format lint on landed branch (steipete#284)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
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.

2 participants