Make local : commands browser-safe and reusable by the web client#79
Merged
Conversation
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>
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.
Why
The CLI's local-command layer (
:help,:tree,:tunnel, …) lived in adart:io-bound module (local_command.dartimporteddart: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
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 fromomnyshell_client_web.dart.file_transfer_commands.dartholds thedart:io/OmnyDrive commands (:download,:upload,:drive) behind aFileTransferCommandsextension (addFileTransferCommands()). Shared remote-path helpers moved toremote_path.dart.LocalCommandRegistry.withDefaults()now returns the browser-safe set; native embedders opt into the filesystem commands. The CLI (bin/omnyshell.dart) now doeswithDefaults()..addFileTransferCommands().LocalCommandContext.registrylets:helplist the exact installed set (so the CLI still shows:download/etc.).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 withaddFileTransferCommands().Tests
local_command_test.dartupdated to build the full registry for the file-transfer command cases.🤖 Generated with Claude Code