Skip to content

Make local : commands browser-safe and reusable by the web client#79

Merged
gmpassos merged 1 commit into
masterfrom
feat/browser-safe-local-commands
Jun 28, 2026
Merged

Make local : commands browser-safe and reusable by the web client#79
gmpassos merged 1 commit into
masterfrom
feat/browser-safe-local-commands

Conversation

@gmpassos

Copy link
Copy Markdown
Contributor

Why

The CLI's local-command layer (:help, :tree, :tunnel, …) lived in a dart:io-bound module (local_command.dart imported dart:io + OmnyDrive). The browser client therefore could not reuse it, and had no way to intercept : commands — they were sent verbatim to the remote shell. This makes the layer browser-safe so the web client can run : commands exactly as the CLI does.

What

  • Split local_command.dart. The registry, context, base class and every command that needs no local filesystem (:help, :info, :whoami, :os, :arch, :host, :node, :capabilities, :session, :latency, :ping, :tunnel, :tree, :detach, :exit) are now pure Dart and exported from omnyshell_client_web.dart.
  • file_transfer_commands.dart holds the dart:io/OmnyDrive commands (:download, :upload, :drive) behind a FileTransferCommands extension (addFileTransferCommands()). Shared remote-path helpers moved to remote_path.dart.
  • LocalCommandRegistry.withDefaults() now returns the browser-safe set; native embedders opt into the filesystem commands. The CLI (bin/omnyshell.dart) now does withDefaults()..addFileTransferCommands().
  • LocalCommandContext.registry lets :help list the exact installed set (so the CLI still shows :download/etc.).
  • Bumps the package to 1.31.0.

Compatibility

Backward compatible for consumers that build the full set via the new extension. The only behavior change: withDefaults() alone no longer includes :download/:upload/:drive — the CLI restores them with addFileTransferCommands().

Tests

  • Full suite green (489 pass, 9 pre-existing platform skips).
  • local_command_test.dart updated to build the full registry for the file-transfer command cases.

🤖 Generated with Claude Code

The CLI's local-command layer (`:help`, `:tree`, `:tunnel`, …) lived in a
`dart:io`-bound module, so the browser client could not reuse it and had no
way to intercept `:` commands — they were sent verbatim to the remote shell.

Split the layer so the registry, context, base class and all commands that
need no filesystem access are pure Dart and exported from
`omnyshell_client_web.dart`. Filesystem/OmnyDrive commands
(`:download`/`:upload`/`:drive`) move to `file_transfer_commands.dart` behind
an `addFileTransferCommands()` extension; shared remote-path helpers move to
`remote_path.dart`. `withDefaults()` now returns the browser-safe set; the CLI
opts into the filesystem commands. `LocalCommandContext.registry` lets `:help`
list the actual installed set.

Bumps the package to 1.31.0.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@gmpassos gmpassos merged commit beda3b8 into master Jun 28, 2026
5 checks passed
@gmpassos gmpassos deleted the feat/browser-safe-local-commands branch June 28, 2026 19:15
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