Skip to content

feat(drive): agents can move, archive and promote documents; CLI push refuses stale overwrites - #99

Merged
Laurin-Notemann merged 1 commit into
mainfrom
fix/drive-mcp-cli-parity
Oct 20, 2026
Merged

Laurin-Notemann merged 1 commit into
mainfrom
fix/drive-mcp-cli-parity

Conversation

@Laurin-Notemann

Copy link
Copy Markdown
Contributor

Problem

Drive's API, CLI and MCP tools work on the same documents through the same /api/v1 endpoints, but they didn't offer the same operations or the same safety:

  • Agents couldn't move, archive or restore documents, make an earlier version current, or create folders. The CLI already could, and the server already supports all of it.
  • MCP's drive_update_document requires the version you inspected and refuses if someone published since. otterdrive artifacts push only checked that with --if-version, so by default it silently published over a newer version.

Fix

MCP: five new tools, each a thin adapter over a new DriveService method and DriveApi call:

Tool Tier Notes
drive_move_document full, destructive The document takes the destination's access. Drive owners only; slug collisions come back as conflict.
drive_archive_document full, destructive Hides the document from everyone. Reversible.
drive_restore_document safe
drive_promote_version safe Makes an earlier immutable version current again.
drive_create_folder safe Defaults to the personal drive and inherits the parent's access. Never shares.

All five refresh the snapshots of thread links that name the document. Creating a folder clears the folder cache. The agent instructions say to move or archive only when the user asks.

CLI:

  • Once a document has a version, push needs either --if-version <n> (the version your files are based on) or --force.
  • Without either, it stops and names the current version.
  • Publishing the first version of an empty document needs neither.
  • pull pins the current version, downloads exactly that, and reports the number to pass back.

Behavior change: scripts that ran push without --if-version now fail until they add it, or --force.

No server, Cloud, Accounts or CLI auth changes. Shared-account's PR owns the Drive CLI login and Drive settings; this PR doesn't touch them. Nothing needs to be deployed.

Validation

  • vp run check:changed passes: format, lint, typecheck for otterdrive, @otterware/drive-contracts and @otterware/drive-engine.
  • CLI: 5 new tests for the push guard.
  • Drive engine: 3 new tests against the fake Drive, 10 passing in total:
    • move, archive, restore and promote, including the thread-link refresh;
    • a slug collision on move maps to conflict;
    • creating a folder defaults to the personal drive and the folder is listed immediately.
  • Not run against the live Drive.

Implemented with Claude Opus 5.5 through the Claude Code harness (T3 Code).

🤖 Generated with Claude Code

@Laurin-Notemann
Laurin-Notemann enabled auto-merge (squash) October 16, 2026 18:53
… refuses stale overwrites

MCP gains drive_move_document, drive_archive_document,
drive_restore_document, drive_promote_version and drive_create_folder,
calling the same Drive /api/v1 endpoints the CLI uses.

otterdrive artifacts push now needs --if-version (the version the files
are based on) or --force once a document has a version, and pull pins
and reports the version it downloaded.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Laurin-Notemann
Laurin-Notemann force-pushed the fix/drive-mcp-cli-parity branch from e337494 to d55941d Compare October 20, 2026 10:36
@Laurin-Notemann
Laurin-Notemann merged commit aaf6b7c into main Oct 20, 2026
19 checks passed
@Laurin-Notemann
Laurin-Notemann deleted the fix/drive-mcp-cli-parity branch October 20, 2026 10:43
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