Skip to content

slides format-text: bold/italic/underline/size/color on element text#28

Open
ronaldmannak wants to merge 3 commits into
mainfrom
claude/tender-gates-vc7Mi
Open

slides format-text: bold/italic/underline/size/color on element text#28
ronaldmannak wants to merge 3 commits into
mainfrom
claude/tender-gates-vc7Mi

Conversation

@ronaldmannak

Copy link
Copy Markdown
Contributor

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

Command Tier API
slides format-text <preso> <objectId> [styles] [--start/--end] [--row/--col] .edit presentations.batchUpdate (updateTextStyle)

Styles: --bold/--no-bold, --italic/--no-italic, --underline/--no-underline (tri-state — set or unset), --font-size <pt>, --foreground <hexRGB>.

Notes

  • Styles all the element's text by default, or a --start/--end character range. Targets a shape by objectId (from slides read-slide), or a table cell via --row/--col (consistent with insert-text).
  • Self-contained — no document read: the objectId is supplied and textRange: ALL avoids index math. (Slides can address "all text of a shape"; Docs updateTextStyle can't — see below.)
  • The update fields mask is built from exactly the options given, so unspecified styles are left untouched.
  • Validates: at least one style; positive font size; 6-digit hex; --start/--end paired (start ≥ 0, end > start); --row/--col paired.
  • .edit, with --dry-run / --json.

Docs text styling — deliberately deferred

Docs updateTextStyle is index-based (needs an explicit character range, or a document read to locate one) — that would repeat fill-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

… 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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Comment thread Sources/GogCommands/GogCommand.swift Outdated
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 {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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).

Suggested change
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 {

Comment on lines +4462 to +4465
guard (row == nil) == (col == nil) else {
Shell.bashCurrent.stderr("gog: --row and --col must be given together (table cell)\n")
throw ExitCode(2)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

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)
        }

claude added 2 commits July 9, 2026 04:15
…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
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