Package Exports
- flutter_copilot_cli
- flutter_copilot_cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (flutter_copilot_cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
flutter_copilot_cli
TypeScript CLI that drives a running Flutter app via the
ext.flutter.flutter_copilot.* VM service extensions registered by
flutter_copilot_claw.
Think of it as an alternative to flutter_copilot_mcp that is designed for
humans at a terminal and CI pipelines, not just for LLM tool-use.
Highlights (vs flutter_copilot_mcp)
| Feature | MCP | CLI |
|---|---|---|
| tap / drag / scroll / navigate / logs / screenshot | ✅ | ✅ |
| Multi-app instance registry | ❌ | ✅ register, list, doctor |
| Interactive REPL | ❌ | ✅ repl |
| Real-time log/rebuild stream | ❌ | ✅ watch --logs --rebuilds |
| YAML playbooks (CI/smoke) | ❌ | ✅ run script.yaml |
| Self-describing for AI | via MCP | ✅ help-ai (JSON) |
| ADB reverse helper | ❌ | ✅ adb-reverse <port> |
Install
cd packages/flutter_copilot_cli
pnpm install
pnpm build
# optionally: pnpm link --global
# (adds both `flutter_copilot_cli` and `fcl` to your PATH)The package exposes two bin names that point at the same binary:
flutter_copilot_cli— full name, matches the package identifierfcl— short alias used throughout the docs and examples
Help output reflects whichever name you invoke.
Usage
Start an app with flutter_copilot_claw initialised:
void main() => FlutterCopilotBinding.runAppWithConfig(const MyApp());Target resolution — no --uri needed
The CLI picks a VM Service URI from the first source that matches:
--uri <ws://...>— explicit-i <name>— from the instance registryFLUTTER_COPILOT_URIenv var.vm_service_uriin the current directory or any ancestor
Use --no-auto-uri to disable #3/#4 if needed.
Recommended: scripts/flutter_run.sh
The repo ships a helper that wraps flutter run and writes the detected URI to
<repo_root>/.vm_service_uri:
./scripts/flutter_run.sh -d macos # starts the app; writes .vm_service_uri
fcl doctor # auto-picks the URI from that file
fcl tap --text CounterAlternative: manual registry
fcl register demo ws://127.0.0.1:8181/abc/ws
fcl -i demo doctor
fcl -i demo elements
fcl -i demo tap --text "Increment"
fcl -i demo screenshot -o /tmp/shot.pngReal-time stream
fcl -i demo watch --logs --rebuilds --interval 500Add --watch-uri to survive flutter run restarts — the CLI tails
.vm_service_uri and transparently reconnects (with 100ms→1.6s backoff):
fcl --watch-uri watch --rebuilds
# in another terminal: ctrl-c flutter, restart it → CLI auto-reconnectsThe same flag works for repl too. It's a no-op for one-shot commands and
requires URI auto-detection (it refuses when --uri / -i was used).
Interactive REPL
fcl -i demo repl
fc[demo]> tap text="Increment"
fc[demo]> enter-text key=UsernameField input="demo user"
fc[demo]> screenshot output=/tmp/s.png
fc[demo]> reloadYAML playbook
# smoke.yaml
name: smoke-login
stopOnFailure: true
steps:
- action: tap
key: LoginBtn
- action: enter-text
key: UsernameField
input: demo
- action: wait
ms: 300
- action: screenshot
output: /tmp/after-login.png
- action: assert-element
text: Welcomefcl -i demo run smoke.yamlEach step may carry a retry: { attempts, delay } block.
Android: bridge VM Service over adb reverse
When the app runs on an Android device but the VM Service is bound to the host's loopback, expose it to the device with:
fcl adb-reverse 8181
# ... later
fcl adb-reverse 8181 --removeFails fast if adb is not on PATH.
JSON output for scripting
fcl --json -i demo elements | jq '.elements'Help for AI agents
fcl help-aiOutputs the full command surface and script schema as JSON.
Roadmap (not in v1)
record-video— needs a screencast extension on theflutter_copilot_clawside.pinch-zoom,press-back-button— also need claw additions.- Process / DDS auto-discovery of VM Service URI.
- Embedded MCP server subcommand.