slides format-text: bold/italic/underline/size/color on element text#28
slides format-text: bold/italic/underline/size/color on element text#28ronaldmannak wants to merge 3 commits into
Conversation
… text Adds `slides format-text <preso> <objectId>` (updateTextStyle): style a shape's text (or a table cell via --row/--col) — bold/italic/underline as tri-state flags (--bold / --no-bold), --font-size (points), --foreground (hex RGB). Styles all of the element's text by default or a --start/--end range; the update field mask is built from whichever options are given. Self-contained: objectId comes from read-slide, no document read. Validates at least one style, positive font size, 6-digit hex, and the paired range / cell args. Completes the slides authoring arc (create -> insert -> format -> position -> read). 5 wiring tests (verb/mask/objectId, requires-a-style, hex->rgb decode, bad hex, table-cell cellLocation). SKILL.md documents it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
There was a problem hiding this comment.
Code Review
This pull request introduces the gog slides format-text command, enabling users to style text elements in Google Slides with options for bold, italic, underline, font size, and foreground color. It also adds corresponding unit tests to verify request payload generation and input validation. The review feedback suggests improving input validation by ensuring hex color strings do not contain signs (like + or -) and verifying that table cell row and column indices are non-negative.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| var rgb: (r: Double, g: Double, b: Double)? | ||
| if let foreground { | ||
| let hex = foreground.hasPrefix("#") ? String(foreground.dropFirst()) : foreground | ||
| guard hex.count == 6, let v = Int(hex, radix: 16) else { |
There was a problem hiding this comment.
The current validation only checks hex.count == 6 and parses it with Int(hex, radix: 16). However, Int parsing allows signs like + or - (e.g., +FF000 or -FF000), which are not valid hex RGB colors. We should explicitly verify that all characters are hexadecimal digits using hex.allSatisfy(\.isHexDigit).
| guard hex.count == 6, let v = Int(hex, radix: 16) else { | |
| guard hex.count == 6, hex.allSatisfy(\.isHexDigit), let v = Int(hex, radix: 16) else { |
| guard (row == nil) == (col == nil) else { | ||
| Shell.bashCurrent.stderr("gog: --row and --col must be given together (table cell)\n") | ||
| throw ExitCode(2) | ||
| } |
There was a problem hiding this comment.
While we ensure that --row and --col are provided together, we do not validate that they are non-negative. Negative row or column indices are invalid and will cause the Google Slides API request to fail. We should add a validation check to ensure both indices are >= 0.
guard (row == nil) == (col == nil) else {
Shell.bashCurrent.stderr("gog: --row and --col must be given together (table cell)\n")
throw ExitCode(2)
}
if let row, let col, !(row >= 0 && col >= 0) {
Shell.bashCurrent.stderr("gog: --row and --col must be non-negative\n")
throw ExitCode(2)
}…ni on #28) - --foreground now requires all hex digits (allSatisfy(\.isHexDigit)) so a signed value like "-F0000" — which Int(_:radix:) would accept and turn into a wrong color — is rejected. - --row/--col reject negative indices up front instead of sending an invalid cellLocation to the API. Adds a test for each. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
… 26.0.1 macos-latest bumped to Xcode 26.0.1, whose test runner dlopens the xctest bundle without the toolchain lib dir on its dyld path, so it can't load the Span back- deployment shim (libswiftCompatibilitySpan.dylib, linked for our macOS 13 target) and the suite aborts before running. The earlier --no-parallel change did NOT fix this — the parallel helper isn't the cause. Locate the shim in the active toolchain and add its dir to DYLD_FALLBACK_LIBRARY_PATH (with an echo that says so if it's not found). Sibling repos' green CI predates the 26.0.1 runner bump, so there was no config difference to copy — they'd hit the same failure if re-run. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
Slide text styling — the clean half of the "text styling" roadmap item, and the last primitive in the slides authoring arc (create → insert → format → position → read).
New command
slides format-text <preso> <objectId> [styles] [--start/--end] [--row/--col].editpresentations.batchUpdate(updateTextStyle)Styles:
--bold/--no-bold,--italic/--no-italic,--underline/--no-underline(tri-state — set or unset),--font-size <pt>,--foreground <hexRGB>.Notes
--start/--endcharacter range. Targets a shape by objectId (fromslides read-slide), or a table cell via--row/--col(consistent withinsert-text).textRange: ALLavoids index math. (Slides can address "all text of a shape"; DocsupdateTextStylecan't — see below.)fieldsmask is built from exactly the options given, so unspecified styles are left untouched.--start/--endpaired (start ≥ 0, end > start);--row/--colpaired..edit, with--dry-run/--json.Docs text styling — deliberately deferred
Docs
updateTextStyleis index-based (needs an explicit character range, or a document read to locate one) — that would repeatfill-table's read/index complexity and review surface. Rather than bolt on an awkward explicit-index Docs command, I'm leaving Docs text styling as a separate, deliberately-designed follow-up. Slides is the clean, high-value half and it completes the slides authoring arc.Tests
5 wiring tests: verb / field-mask / objectId (ALL range), requires-a-style guard, hex→RGB parsing (decoded), bad-hex rejection, and table-cell
cellLocation. SKILL.md documents it.🤖 Generated with Claude Code
https://claude.ai/code/session_01JGWAxXq3PZatbdBR4P5RrA
Generated by Claude Code