feat(discovery): add agentsync ls and status --machine for cross-machine browse - #187
Conversation
…machine browse Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011L7s33UCjpQkreXW7amAw2
|
Warning Review limit reached
More reviews will be available in 49 minutes and 5 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAdds a new Changesls command, status --machine, and shared traversal hardening
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 4
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/commands.md`:
- Line 248: The recovery command documentation for `vault-only` status is
incomplete for cross-machine scenarios. When using `status --machine <peer>`,
the source namespace is the peer machine's namespace, not the local disk, making
the `copy self <path>` instruction incorrect. Update line 248 to clarify that
the recovery command should reference the compared peer machine instead of using
`self`, so users can properly copy content from the peer namespace to the local
disk when comparing across machines.
In `@src/commands/__tests__/status.test.ts`:
- Around line 285-287: Replace the order-dependent artifact selection in the
test with an explicit lookup of the "peer-skill" artifact from snap.artifacts.
Instead of accessing snap.artifacts[0], find the artifact that matches the
"peer-skill" identifier by filtering or searching through snap.artifacts. Add an
assertion or check immediately after to fail fast if the peer-skill artifact is
not found, ensuring the test fails with a clear error rather than proceeding
with an incorrect artifact or undefined plaintext value.
In `@src/commands/copy.ts`:
- Around line 45-47: The containment validation check in the copy command is too
broad in its rejection logic. The condition checking
`containment.startsWith("..")` catches valid paths like `..cache/foo.age` that
aren't actually escaping the directory. Instead of checking if the containment
path simply starts with "..", change it to check for "../" which specifically
indicates directory traversal escaping. This allows valid artifact names that
happen to start with two dots while still properly blocking actual directory
escape attempts.
In `@src/commands/ls.ts`:
- Around line 34-36: The error handling in the reconcile-error catch block
(lines 34-36) and the similar error handling at lines 110-112 currently return
only the raw error message without actionable recovery guidance. Enhance both
catch blocks to include specific next-step instructions that guide users on how
to recover, such as directing them to resolve divergence or run a recovery
command. Modify the error message returned in the reconcile-error object to
combine the descriptive error message with clear, actionable guidance so users
know what to do immediately when reconciliation fails.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 916bdaea-406d-4041-90ef-24322787aa18
📒 Files selected for processing (8)
README.mddocs/commands.mdsrc/cli.tssrc/commands/__tests__/ls.test.tssrc/commands/__tests__/status.test.tssrc/commands/copy.tssrc/commands/ls.tssrc/commands/status.ts
…ne vault-only doc, deterministic fixture Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011L7s33UCjpQkreXW7amAw2
Why
copyneeds an exact logical path (copy work-laptop claude/CLAUDE.md.age), but there was no way to discover those paths.statusonly ever inspected this machine's namespace, and there was no CLI command to list another machine's artifacts — so on a fresh machine you had to guess paths or open the TUI. The "canonical scripting surface" couldn't enumerate what was copyable.Fourth PR in the series (follows #184, #185, #186).
What
agentsync ls [machine] [path]— list machine namespaces, or the copyable.agepaths within one. Read-only and key-free: it lists which encrypted files exist without decrypting, so a machine that is not yet a recipient can still discover whatcopyaccepts.ls selfbrowses your own backup; a path prefix narrows the listing.agentsync status --machine <name>— compare local config against another machine's namespace for a pre-copy diff (synced/local-changed/local-only/vault-only). Validates the name against known machines;selfresolves to this machine.enumerateArtifacts(fixing a leading-slash bug for whole-namespace enumeration);computeSyncStatusgained an optionalsourceMachine.Security (caught in review)
The review panel found a path-traversal info disclosure:
ls work-laptop ../../../../etcwould have enumerated.agefiles outside the namespace (copyblocks this downstream, butlsprinted raw paths). Fixed by a containment guard in the sharedenumerateArtifacts— anyrelDirthat resolves outsidemachineRootreturns[], covering bothlsandcopy's dir-sweep. Regression test included.Tests
ls.test.ts(10): allLsResultkinds,self, path prefix, traversal guard, reconcile-error (diverged history), and the CLI wrapper exit code.status.test.ts(+2): cross-machinesyncedcomparison and unknown-machine error. Full suite: 947 pass / 0 fail.CI note
bun testexits non-zero on the per-file coverage floor; CI treats 0-fail as success.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
lssubcommand for read-only discovery of machines and copyable artifacts in the vault without requiring decryption.statuscommand with--machineoption to compare agent synchronization status against other machines.Bug Fixes
Documentation