Skip to content

feat(docs): add set-page-layout for existing docs (#593)#624

Merged
steipete merged 2 commits into
openclaw:mainfrom
sebsnyk:feat/593-pageless
May 22, 2026
Merged

feat(docs): add set-page-layout for existing docs (#593)#624
steipete merged 2 commits into
openclaw:mainfrom
sebsnyk:feat/593-pageless

Conversation

@sebsnyk

@sebsnyk sebsnyk commented May 21, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds gog docs set-page-layout <docId> [--layout=pageless|paged] so an existing Google Doc's page layout can be flipped from the CLI. Sibling to the existing --pageless flag on docs create / write / update, which only fires on creation — this verb covers docs created upstream (Drive markdown conversion, copy-from-template, etc.) that landed in the wrong layout.

Aliases: page-setup, page-layout. Defaults to --layout=pageless (the case agent-generated multi-tab + table-heavy specs actually want).

Implementation

  • Refactors the existing setDocumentPageless helper into a general setDocumentMode(svc, docID, mode) issuing a single documents.batchUpdate with updateDocumentStyle on documentFormat.documentMode (PAGELESS / PAGES). The existing flag path delegates to it — no behaviour change there.
  • New DocsSetPageLayoutCmd lives in internal/cmd/docs_set_page_layout.go, mirroring the shape of DocsInsertPageBreakCmd (arg <docId>, dry-run support, JSON / plain output, isDocsNotFound translation).
  • Kong enum: tag on --layout rejects bad values at parse time; normalizePageLayout additionally accepts case/whitespace variants and the convenience alias pages.

The Docs Go SDK exposes the layout toggle via DocumentStyle.DocumentFormat.DocumentMode rather than the DocumentStyle.Pageless boolean some REST references mention — the boolean is not present on the generated Go type, so this is the correct field.

Tests

internal/cmd/docs_set_page_layout_test.go covers:

  • --layout default (pageless) emits the expected batchUpdate (UpdateDocumentStyle, fields=documentFormat, documentMode=PAGELESS)
  • --layout=paged emits documentMode=PAGES
  • invalid --layout=portrait rejected by Kong enum validation
  • empty docId rejected with usage("empty docId")
  • dry-run path does not open the docs service
  • normalizePageLayout table test for case / whitespace / alias inputs

Existing TestDocsCreate_Pageless continues to pass — the refactor is wire-compatible.

Test plan

  • go vet ./internal/cmd/
  • go test -count=1 -run 'TestDocsSetPageLayoutCmd|TestNormalizePageLayout|TestDocsCreate_Pageless' ./internal/cmd/ — green
  • go test -count=1 ./internal/cmd/ — full package green (54s)
  • CHANGELOG entry added under 0.17.1 — Added

Closes #593

🤖 Generated with Claude Code

sebsnyk and others added 2 commits May 22, 2026 00:47
Adds `gog docs set-page-layout <docId> [--layout=pageless|paged]` so
documents that were created upstream (e.g. by Drive markdown conversion
or another non-gog tool) can have their page layout flipped without
touching the UI. Sibling to the existing `--pageless` flag on
`docs create`/`write`/`update`, which only fires on creation.

Implementation: refactors the existing `setDocumentPageless` helper into
a general `setDocumentMode(svc, docID, mode)` that issues a single
`documents.batchUpdate` with `updateDocumentStyle` on
`documentFormat.documentMode` (PAGELESS / PAGES). The existing flag path
delegates to it, so behaviour is unchanged.

The Docs Go SDK exposes the layout toggle via
`DocumentStyle.DocumentFormat.DocumentMode` rather than the
`DocumentStyle.Pageless` boolean shown in some REST docs — the latter is
not present on the generated Go type.

Tests cover:
- default `--layout=pageless` emits the expected batchUpdate shape
  (UpdateDocumentStyle, fields=documentFormat, mode=PAGELESS)
- `--layout=paged` emits mode=PAGES
- invalid `--layout` values are rejected by Kong enum validation
- empty docId is rejected
- dry-run does not open the docs service
- `normalizePageLayout` accepts case/whitespace variants of pageless/paged/pages

CHANGELOG entry added under 0.17.1.

Closes openclaw#593
@steipete
steipete force-pushed the feat/593-pageless branch from 0bba5e4 to 7b8c451 Compare May 22, 2026 00:00
@steipete
steipete merged commit 1b8a750 into openclaw:main May 22, 2026
7 checks passed
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.

Feature: expose pageless / page-setup toggle on docs

2 participants