feat(cli): p export claude takes --cwd behind the resume-remote feature - #247
Open
ecalifornica wants to merge 6 commits into
Open
feat(cli): p export claude takes --cwd behind the resume-remote feature#247ecalifornica wants to merge 6 commits into
ecalifornica wants to merge 6 commits into
Conversation
|
🔍 Preview deployed: https://cc3904e0.toolpath.pages.dev |
akesling
requested changes
Aug 28, 2026
| } | ||
|
|
||
| /// `run_claude` with no remote-session flag set. | ||
| fn run_claude_without_remote_session( |
Contributor
There was a problem hiding this comment.
Maybe we should migrate to some form of config with builder or something so we don't have to have this telescoping wrapper and forcing all callers to think about remote-ness?
Collaborator
Author
There was a problem hiding this comment.
Added the ClaudeArgs struct for the config, feels much better.
| .stdout(predicate::str::contains("pathbase")); | ||
| } | ||
|
|
||
| #[cfg(feature = "resume-remote")] |
Contributor
There was a problem hiding this comment.
You can nest these tests under a module that you apply the flag to once.
ecalifornica
commented
Aug 28, 2026
| .stdout(predicate::str::contains("pathbase")); | ||
| } | ||
|
|
||
| #[cfg(feature = "resume-remote")] |
| } | ||
|
|
||
| /// `run_claude` with no remote-session flag set. | ||
| fn run_claude_without_remote_session( |
Collaborator
Author
There was a problem hiding this comment.
Added the ClaudeArgs struct for the config, feels much better.
| use std::collections::HashMap; | ||
| use toolpath::v1::{ArtifactChange, PathIdentity, Step, StepIdentity, StructuralChange}; | ||
|
|
||
| pub(super) fn make_path_doc() -> toolpath::v1::Graph { |
Collaborator
Author
There was a problem hiding this comment.
dropped this visibility
`reroot(dir)` sets the directory everywhere the format carries it: `project_path`, every entry's `cwd` that is present, and a top-level `cwd` on a preamble line. Message content and tool results are not touched. toolpath-claude 0.13.1.
`--cwd <dir>` roots the session: the directory becomes the `cwd` of every line that carries one, through `Conversation::reroot`. It must be an absolute POSIX path in normalized form (no `.`, `..`, or empty component; one trailing `/` is dropped) and does not have to exist on this machine. It conflicts with `--project`. Message content and tool results are not touched. The rewrite runs only when the flag is given; clap validates the value at parse time. The flag and its tests live in `cmd_export/remote_session.rs` and compile only with the `resume-remote` cargo feature, off by default. The feature keeps the flag out of the default binary: it serves `scripts/resume-remote.sh`, which builds with the feature, and is not a supported `path` surface. Without the feature, `p export claude --help` shows no trace of the flag. The gate is `all(feature = "resume-remote", not(target_os = "emscripten"))`: `p export claude` bails on emscripten, so the feature has no effect on the wasm build and the module carries no emscripten cfgs. Both states pass `cargo test -p path-cli` and clippy with `-D warnings`. path-cli 0.19.0; toolpath-cli 0.19.0 (lockstep bump of the shim).
The script builds path-cli with the `resume-remote` feature. Step 5 exports with `--cwd <remote-dir>`, checks the output carries the remote project directory as its cwd, and rewrites only the sessionId keys to the minted ID.
ecalifornica
force-pushed
the
ecalifornica/export-claude-cwd
branch
from
August 28, 2026 22:58
2eb3f4c to
080f155
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.
scripts/resume-remote.shships a session to another host, and the session it ships must record the remote project directory as itscwd, sop export claudetakes--cwd <dir>. The flag is behind a new cargo feature,resume-remote, off by default.The rewrite is
Conversation::reroot(dir), a newtoolpath-claudemethod that setsproject_pathand everycwdthe format carries, while message content, tool results, and session IDs are not touched.clap validates the value (an absolute normalized POSIX path, which need not exist locally) at parse time, and
--cwdconflicts with--project. The script builds with the feature, exports with--cwd <remote-dir>, and rewrites only thesessionIdkeys withsed.Three commits: the library method, the flag, the script.
toolpath-claude 0.13.1, path-cli 0.19.0, toolpath-cli 0.19.0. Stacked on #246.
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.