Skip to content

Copy a workspace's changes into a folder with changes --copy-to - #116

Merged
lydakis merged 2 commits into
mainfrom
claude/project-thread-1pmqyw
Oct 21, 2026
Merged

lydakis merged 2 commits into
mainfrom
claude/project-thread-1pmqyw

Conversation

@lydakis

@lydakis lydakis commented Oct 21, 2026

Copy link
Copy Markdown
Owner

Requested by George · project thread

Closes #41. Second of the small changes for "an agent whose only files are a sandfs workspace": once its work is reviewed, the keep step is one command.

Before. The only way to get changes out was a shell loop over sandfs changes output, which broke on unusual names.

After.

  • New option: sandfs changes NAME [PATH...] --copy-to DIR. It writes the listed changes into DIR:
    • Added and modified files and links are copied with their executable bit.
    • Deleted ones are removed.
    • Deletions go first, so a file can replace a folder it deleted.
  • What it leaves alone: it writes nothing outside DIR and never writes through a link it finds there. An agent's link can't carry a later file out of DIR, and such a copy is refused with "… is a link".
  • Emptied folders: a folder that a deletion leaves empty is removed only if the workspace no longer has it either.
  • Filtering: PATH arguments limit changes to some files or folders, with or without --copy-to. The idea comes from CLI: a script-safe way to get a workspace's changes out #41's note about tool caches.
  • Git mounts: a git mount's .git stays out, as in the listing.

API. No core or Python changes. This adds the new crates/sandfs-cli/src/copy.rs and wires it into the Changes command in main.rs.

Docs. Root README, sandfs-cli README and changelog.

Tests. All pass locally, with the mount test running under FUSE (SANDFS_REQUIRE_FUSE=1).

  • cargo test -p sandfs-cli copy_to runs three tests:
    • cli.rs: copying only the paths asked for, then everything.
    • cli.rs: refusing to write through a link in DIR.
    • mount.rs: links, the executable bit, and a file replacing a folder, all through a real mount.

Generated by Claude Code

@lydakis lydakis self-assigned this Oct 21, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-21T02:15:36.678982Z 5f3bb0d New commits
🔒 Security Review ✅ Completed 2026-10-21T02:21:07.871514Z 5f3bb0d New commits

Security findings

Advisory findings (2)

ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 815974e6b0

ℹ️ 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".

Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/main.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/main.rs Resolved
@lydakis
lydakis force-pushed the claude/project-thread-1pmqyw branch from a61742f to 5eef898 Compare October 21, 2026 01:26

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 5eef89847f

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread crates/sandfs-cli/src/main.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ Codex Security Review · Automatically triggered

Here are some automated security review suggestions for this pull request.

Reviewed commit: 1165d1f70f

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

Comment thread crates/sandfs-cli/src/copy.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1165d1f70f

ℹ️ 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".

Comment thread crates/sandfs-cli/src/main.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4ad6ddb643

ℹ️ 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".

Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved
Comment thread crates/sandfs-cli/src/copy.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 326531af8f

ℹ️ 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".

Comment thread crates/sandfs-cli/src/main.rs Resolved
`sandfs changes NAME [PATH...] --copy-to DIR` writes the changes listed
into DIR: added and modified files and links with their executable bit,
deleted ones removed, deletions first so a file can replace a folder.
Every file and link is made in a staging folder inside DIR before DIR
changes, so a copy retried after a mount's save replaced what it read
leaves nothing behind. Nothing is written through a link found in DIR, and
nothing into a folder any Mac or Windows disk would read as .git. PATH
arguments limit the listing to some files or folders. Replaces the hand
loop over `changes` (#41).

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01LCMApy2YCT332kuwV3wdNn
@lydakis
lydakis force-pushed the claude/project-thread-1pmqyw branch from 326531a to 6cf86b9 Compare October 21, 2026 02:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6cf86b98e4

ℹ️ 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".

Comment thread crates/sandfs-cli/src/main.rs Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5f3bb0dba0

ℹ️ 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".

let git_dir = git_dir.transpose()?;
let listed: Vec<_> = changes
.iter()
.filter(|change| !git_dir.as_ref().is_some_and(|dir| change.path.starts_with(dir)))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Count git-mount changes omitted before copying

When a git-backed workspace has changes under /mnt/.git—for example, an in-mount commit updates its index or refs—this filter removes them before copy::copy_to can include them in held_back. Consequently changes --copy-to succeeds without the promised warning or count even though it omitted changes; count these filtered entries when copying, rather than silently discarding them first.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving this as is. In a git: mount, .git is sandfs's own view of the repository and isn't part of the files, so changes never lists it and --copy-to copies only what's listed. The count is for .git folders that do appear among the listed files, in a host folder that has one.


Generated by Claude Code

@lydakis
lydakis merged commit ba225af into main Oct 21, 2026
16 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.

CLI: a script-safe way to get a workspace's changes out

2 participants