Skip to content

feat(cli-peer): expose file explorer and Git read surfaces - #3492

Merged
bobleer merged 7 commits into
openBitFun:mainfrom
Raing5Days:fix/cli-peer-file-surface
Nov 2, 2026
Merged

bobleer merged 7 commits into
openBitFun:mainfrom
Raing5Days:fix/cli-peer-file-surface

Conversation

@Raing5Days

Copy link
Copy Markdown
Contributor

Summary

  • Fix CLI Peer Host rejection of explorer_get_children and its paginated/tree aliases, restoring the backend surface used by the file tree, file-reference picker and editor breadcrumb.
  • Expose whole-tree reads, file metadata, editor sync hashes and file creation through the existing filesystem owners.
  • Wire host-local file watching to the peer controller event emitter so attached controllers receive file-system-changed events.
  • Add nine Git read commands using existing GitService DTOs: repository/basic repository, status, branches/enhanced branches, commits, diff, changed files and revision resolution.
  • Synchronize operation registry, generated artifacts and the reviewed CLI file-watch feature closure.

Type and Areas

Type: Bug fix / feature completion

Areas: CLI Peer Host, shared filesystem routing, product operation registry

Motivation / Impact

A controller invokes the new explorer_* command names, but the CLI host only implemented the historical directory commands and rejected the aliases before dispatch. This also affected file references and editor navigation. Basic Git panel reads likewise had no CLI peer handlers despite the shared Git owner already being available.

Verification

  • cargo test --locked -p openbitfun-cli --bin openbitfun peer_host:: — 107 passed.
  • cargo test --locked -p openbitfun-product-domains --no-default-features remote_surface — 20 passed.
  • pnpm run capabilities:check — passed.
  • pnpm run fmt:rs — completed.
  • git diff --check origin/main...HEAD — passed.
  • Earlier file-watch feature closure verification: pnpm run check:core-boundaries and pnpm run check:core-boundaries:test — passed (154 boundary tests).

New Git fixture tests cover response fields, legacy/structured payloads, malformed inputs, workspace-ID authority, remote-scope rejection and unchanged HEAD/index/file content after reads.

Reviewer Notes

  • CLI-owned local workspaces are supported. Git inspection and native file watching of SSH/remote workspaces are explicitly rejected without local filesystem fallback. Filesystem reads continue to resolve the owning connection through the existing workspace routing.
  • Git ownership-trust failures retain their machine-recognizable wire form. This does not grant repository trust or add Git mutation handlers.
  • Git graph, file-content-at-revision, Git mutations and workspace search remain outside this change; this is not full CLI/Desktop parity.
  • Remote scenario evidence: local tests only, including rejection-path tests. No live Peer Device controller/relay, SSH workspace, mobile/IM or Detached Dispatch integration was exercised.
  • No persisted shape migration or required protocol field was introduced; existing command names remain supported.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • Existing public response fields and command names are preserved; no new UI copy or locale keys were added.

A Desktop controller driving a CLI Peer Host renders the workspace through the
`explorer_*` reads and refreshes it from `file-system-changed`. The CLI Peer
Host answered only the historical command names, so the file tree, the `@`
reference picker and the editor breadcrumb all failed with "command
'explorer_get_children' is not supported on CLI peer host" even though this
host already served the same directory read under another name.

- Alias `explorer_get_children`, `explorer_get_children_paginated` and
  `explorer_get_file_tree` onto the existing readers instead of refusing them.
- Add `get_file_tree`, `get_file_metadata`, `get_file_editor_sync_hash` and
  `create_file`, resolving local and remote-connection IO through a portable
  `path_operations` owner next to the existing read/write/rename helpers.
- Add `start_file_watch`, `stop_file_watch` and `get_watched_paths`, and install
  the peer controller emitter for the watcher so change events reach attached
  controllers instead of leaving their tree stale after the first read.
- Graduate the ten registry rows to `Handled`, correct the `stop_file_watch`
  remote-workspace stance, and regenerate the capability artifacts.
- Declare `file-watch` in the CLI Core capability closure and pin the surface
  with a dispatch gate test.
Reuse GitService for repository, status, branches, log, diff, changed-file and revision reads. Preserve workspace-ID authority and reject remote workspaces without local fallback. Keep desktop owner DTOs, legacy payload compatibility and ownership-trust diagnostics. Add real-repository fixture tests covering nonmutation, wire fields and invalid inputs; update registry and generated projections.
Main already serves the explorer_* aliases and get_file_tree on the CLI
peer host with workspace-aware connection resolution; keep that owner
and drop this branch's duplicate tree handler. Adapt the metadata, sync
hash, create_file and file-watch handlers to the path-aware
file_connection, keep main's ACP rows and get_file_watch_status row,
and regenerate the remote surface artifacts.
@bobleer

bobleer commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Pushed two commits to resolve the conflicts with main (including #3669):

  • Merge upstream/main (8973999): main already serves explorer_get_children, explorer_get_children_paginated and get_file_tree/explorer_get_file_tree on the CLI peer host, through workspace-aware directory_connection, and has its own test. I kept main's handler and dropped this branch's duplicate get_file_tree/ensure_directory_path. The new metadata, editor sync hash, create_file and file-watch handlers now use main's path-aware file_connection(state, request, &path). Registry rows keep main's CLI_NO_ACP_CLIENT_HOST ACP rows and the new get_file_watch_status row; this PR's HANDLED rows and the stop_file_watch → Unsupported correction are kept. The latter matches Desktop, whose stop_file_watch shares file_watch_target and refuses remote workspaces. Generated artifacts are regenerated.
  • test(core) (c0bb1dd): adds local coverage for create_empty_file (truncates, like Desktop), the metadata wire fields for files, directories and missing paths, and editor_sync_hash parity with FileSystemService.

Verified:

  • cargo test --locked -p openbitfun-cli --bin openbitfun peer_host::: 122 passed
  • cargo test --locked -p openbitfun-product-domains --no-default-features remote_surface: 20 passed
  • cargo test -p openbitfun-core --no-default-features --features agent-runtime,git,ssh-remote --lib path_operations: 7 passed
  • pnpm run capabilities:check, pnpm run check:core-boundaries, node --test scripts/check-core-boundaries.test.mjs (157): passed

Still open: get_file_watch_status and retry_file_watch stay CLI_NOT_IMPLEMENTED on CLI hosts. Remote evidence is local tests only, with no live controller/relay or SSH run.

Regenerate the remote surface registry artifacts after openBitFun#3677 and openBitFun#3591.
Regenerate the remote surface registry artifacts after openBitFun#3670.
Regenerate the remote surface registry artifacts after openBitFun#3659.
@bobleer
bobleer merged commit 69e4280 into openBitFun:main Nov 2, 2026
25 of 27 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.

2 participants