feat(docs): add insert-page-break primitive#614
Merged
steipete merged 4 commits intoMay 20, 2026
Conversation
Closes openclaw#604. Surfaces the Docs API InsertPageBreakRequest as a standalone CLI subcommand. Markdown has no native page-break construct that the markdown writer can translate, and docs format only restyles existing content, so this is the first structural-element insert primitive on the docs side. Usage: gog docs insert-page-break <docId> [--index N | --at-end] [--tab=STRING] Behaviour: - Omitted --index and --at-end both insert at end-of-doc (matches the existing docs write --append default; uses the same docsTargetEndIndexAndTabID + docsAppendIndex helpers). - --index N (>=1) inserts at the explicit body index; --at-end is explicit form of the default. The two are mutually exclusive. - --tab supports both --index and --at-end paths. Aliases: `page-break`, `pb`. Tests cover explicit index, --at-end, default end-of-doc, --tab, mutual exclusion of --at-end + --index, and the negative-index guard. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Realigned by gofmt after adding the InsertPageBreak field. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a8c5754 to
4021e5c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #604.
Summary
Surfaces the Docs API `InsertPageBreakRequest` as a standalone CLI subcommand. Markdown has no native page-break construct that the markdown writer can translate, and `docs format` only restyles existing content — so this is the first structural-element insert primitive on the docs side.
Usage
```
gog docs insert-page-break [--index N | --at-end] [--tab=STRING]
```
Aliases: `page-break`, `pb`.
insert-page-break <id>docsTargetEndIndexAndTabID+docsAppendIndex, same helpers asdocs write --append)insert-page-break <id> --at-endinsert-page-break <id> --index N… --tab=Name--at-endand--indexare mutually exclusive.--index < 1is rejected (index 0 is reserved, matching the existingdocs insertguard).Tests
TestDocsInsertPageBreakCmd_ExplicitIndex— verifies singleInsertPageBreakRequestwith the given index and no extra GET.TestDocsInsertPageBreakCmd_DefaultsToEndOfDoc— omitted flags → one GET + insert atendIndex - 1.TestDocsInsertPageBreakCmd_AtEndFlag— explicit--at-endbehaves identically.TestDocsInsertPageBreakCmd_AtEndAndIndexRejected— mutual exclusion guard.TestDocsInsertPageBreakCmd_NegativeIndexRejected—--index=-1rejected with the same message asdocs insert.TestDocsInsertPageBreakCmd_WithTab— tabs resolution +Location.TabIdpopulated.go test ./internal/cmd/ -count=1→ ok 23.5s.Notes
This PR contains 2 commits — the feature, plus a follow-up
gofmtre-alignment of theDocsCmdstruct tags after adding the new field. Happy to squash on merge.