feat(cmd): add --dry-run to update, create, and fix - #49
Merged
Conversation
Preview what a run would do without writing to Confluence or to any file. Per-file human output is identical to a real run, distinguished only by a leading DRY RUN banner and a dry_run field in --json. Validation is unchanged, so a dry-run exits non-zero on the same failures a real run would, and it honors update's mtime skip and --force so the forecast matches what would actually happen. Attachment sync is split into a plan phase and an execute phase: planAttachments decides created/updated/skipped per file by reading the page's existing attachments and each local checksum, PlanAttachments reports that plan for --dry-run, and SyncAttachments executes it. The two paths therefore cannot disagree about what an upload would do. Because a create dry-run creates nothing, a previewed page has no id or URL and an in-set child's parent is unresolved; the parent's source .md is reported in the parent_file field, which is now present in every run.
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.
Adds
--dry-runtoupdate,create, andfix: preview what a run would do without writing to Confluence or to any file.Closes #11.
Behavior
DRY RUNbanner and adry_run: truefield in--json.update's mtime skip and--forceare honored, so the forecast matches what a real run would actually do.create— frontmatter write-backs.Attachments
Attachment sync is split into a plan phase and an execute phase:
planAttachmentsdecides created/updated/skipped per file, reading the page's existing attachments and each local checksum.PlanAttachmentsreports that plan for--dry-run.SyncAttachmentsexecutes it.Both paths consume the same plan, so they cannot disagree about what an upload would do.
Create previews
A
createdry-run creates nothing, so a previewed page has no id or URL, and an in-set child'sparentis unresolved. The parent's source.mdis reported in theparent_fileoutput field, which is now present in every run.Notes
schema/json-output/v1.jsonis updated for the newdry_runandparent_filefields, soTestSchemaConformancestays green._plans/016_dry-run.md.make test && make lint && make vetpass.