Conversation
Add block command group (list, get, replace, update-text, insert, move, delete), page format/compact/ensure-block-ids/strip-block-ids subcommands, block ID persistence in MarkdownBlockParser, install command, and comprehensive CLI tests. Simplification: deduplicate preview computation in Update.run() (removed ~30 lines of copy-paste between dryRun branches), eliminate double document parsing in block preview functions by extracting lookupBlock helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d823c1ab4c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if lines.count > 1, lines.last == "" { | ||
| lines.removeLast() |
There was a problem hiding this comment.
Preserve trailing empty paragraph blocks when parsing
PageBlockParser.parseBlocks unconditionally drops the last empty line, but serialized block-ID output uses a trailing empty line to represent a final empty paragraph block. For pages that end with an empty paragraph (including the default page create template # Title\n\n), this turns the last block into an orphan <!-- block-id: ... --> comment on the next parse, so the block disappears and its persisted selector can no longer be resolved.
Useful? React with 👍 / 👎.
|
|
||
| init(markdown: String) { | ||
| let (metadata, content) = MarkdownBlockParser.parseMetadata(markdown) | ||
| self.persistsBlockIDs = content.contains("<!-- block-id:") |
There was a problem hiding this comment.
Derive ID persistence from valid block-id comments
BlockDocument enables includeBlockIDComments based on a raw substring check (content.contains("<!-- block-id:")), which treats arbitrary user comments as internal ID markers. If a note contains a non-UUID comment like <!-- block-id: draft -->, opening and saving it will unexpectedly inject generated block-id comments throughout the document even though no valid persisted IDs were present.
Useful? React with 👍 / 👎.
Summary
blockcommand group with list, get, replace, update-text, insert, move, delete subcommands for granular markdown block editingpage format,page compact,page ensure-block-ids,page strip-block-idssubcommands<!-- block-id: ... -->comments)installcommand and install scriptSimplification
PageCommand.Update.run()— preview was computed identically in both dryRun and non-dryRun branches (~30 lines removed)lookupBlockhelper fromresolveWorkspacePageBlockto eliminate double document parsing inpreviewWorkspacePageBlockUpdate,previewWorkspacePageBlockTextUpdate, andpreviewWorkspacePageBlockMoveloadWorkspacePagebefore output switch statementsTest plan
swift buildsucceeds🤖 Generated with Claude Code