Skip to content

[Push] Add a local files-diff command#379

Merged
adamziel merged 2 commits into
trunkfrom
adamziel/files-local-diff-command
Jul 24, 2026
Merged

[Push] Add a local files-diff command#379
adamziel merged 2 commits into
trunkfrom
adamziel/files-local-diff-command

Conversation

@adamziel

@adamziel adamziel commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

reprint files-diff <target-url> --state-dir=DIR --fs-root=DIR prints the pair's local minimized push operation plan before target exclusions by comparing the local tree with its previous local index. It makes no network request and requires no secret.

Background

A completed files-push saves the local path type, size, and ctime used to plan the next push. Until now that comparison was only available inside files-push.

This change

files-diff derives the same pair key as files-push and requires the same target URL, state directory, and local tree that produced the previous local index. It emits JSONL push records with path_b64, type, size, and ctime, followed by delete records with path_b64 and a complete record with both counts. Paths remain base64 so arbitrary filesystem bytes survive JSON.

After adding wp-content/themes/my-theme/style.css and deleting wp-content/plugins/old-plugin, a report looks like this:

$ reprint files-diff 'https://example.com/export.php?site-export-api' --state-dir=.reprint --fs-root=public
{"command":"files-diff","action":"push","path_b64":"d3AtY29udGVudC90aGVtZXMvbXktdGhlbWUvc3R5bGUuY3Nz","type":"file","size":8421,"ctime":1784822400}
{"command":"files-diff","action":"delete","path_b64":"d3AtY29udGVudC9wbHVnaW5zL29sZC1wbHVnaW4="}
{"command":"files-diff","status":"complete","local_paths_to_push":1,"local_paths_to_delete":1}

The command leaves the previous local index unchanged and stores no resume state. An interrupted run discards its temporary plan; the next run rebuilds and prints the complete report from the beginning.

This renames local_index_at_previous_push.jsonl to previous_local_index.jsonl and gives PushPlan a caller-supplied previous local index, so files-push and files-diff use the same local diff implementation.

Testing

Complete a files-push, stop the target, then add, edit, delete, and change the type of paths in the same local tree. Run files-diff with the same target URL, state directory, and local tree; check the base64 JSONL push and delete records and final counts. Run it again without changing the tree and confirm it prints the same complete report without changing previous_local_index.jsonl.

@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Pull pipeline performance — large-directory

Site: large-directory · 2,000+ plus targeted file-transfer scenarios files · 10,000 posts · 25,000 postmeta · PHP 8.5.8

Stage PR trunk Δ Status Details
playground-sqlite-db-pull 9.91 s 9.63 s ⚪ +281 ms (+2.9%) condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
trunk: condition=db-pull in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=lexer
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=selected
playground-sqlite-db-apply 3.62 s 3.65 s ⚪ -30 ms (-0.8%) condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
trunk: condition=db-apply to SQLite in PHP.wasm
runtime=php.wasm 8.3
wp_mysql_parser=enabled
mode=parser
native_lexer=verified
native_token_stream=WP_MySQL_Native_Token_Stream
native_token_count=18
native_parser=verified
native_ast=WP_MySQL_Native_Parser_Node
sqlite_driver_parser=verified
Total 13.53 s 13.28 s ⚪ +251 ms (+1.9%)

Numbers carry runner noise; treat single-run deltas as directional, not authoritative.

📈 Trunk performance history — commit-by-commit timeline.

@adamziel
adamziel force-pushed the adamziel/files-local-diff-command branch 3 times, most recently from 467fbf3 to a0f683a Compare July 21, 2026 19:28
@adamziel adamziel changed the title [Push] Show local file changes since the last pull [Push] files-diff command: show local file changes since the last pull Jul 21, 2026
@adamziel
adamziel force-pushed the adamziel/files-local-diff-command branch from b4e17ef to ac45313 Compare July 21, 2026 20:53
@adamziel adamziel changed the title [Push] files-diff command: show local file changes since the last pull [Push] Add a local files-diff command Jul 21, 2026
@adamziel
adamziel force-pushed the adamziel/files-local-diff-command branch from ac45313 to 3126ef3 Compare July 21, 2026 22:12
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adamziel
adamziel force-pushed the adamziel/files-local-diff-command branch from 3126ef3 to 74d6077 Compare July 21, 2026 22:36
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adamziel
adamziel force-pushed the adamziel/files-local-diff-command branch from 74d6077 to 9e85c29 Compare July 21, 2026 23:01
@adamziel
adamziel merged commit 5e4dfcc into trunk Jul 24, 2026
20 of 21 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.

1 participant