feat(cli): add examples to ao preview --help#388
Merged
Conversation
Update the preview command help to include a concise Examples section covering the four common workflows: ao preview ao preview file:///home/aoagent/ReverbCode/index.html ao preview http://localhost:5173 ao preview clear Replace the workspace-relative path (./dist/index.html) in the Long description with the absolute file:// URL pattern agents actually use. Command syntax and behavior are unchanged. Closes #387
harshitsinghbhandari
requested changes
Jun 22, 2026
harshitsinghbhandari
left a comment
Collaborator
There was a problem hiding this comment.
PR Review: #388
Consumer Impact
backend/internal/cli/preview.go:26says bareao preview“opens the workspace’s index.html.” That is incomplete for the real daemon behavior:setPreviewfirst autodetects a workspace entry, but if none exists it falls back to the session’s existing preview target. There is already a controller test for that fallback:TestSessionsAPI_SetPreviewEmptyURLReusesExistingTargetWhenNoEntryExists. The help text should preserve that nuance while still using the betterfile://$(pwd)/index.htmlexample.
Suggested wording:
"With no argument it opens the workspace's static entry point, falling back\n" +
"to this session's existing preview target when no entry point exists. A local\n" +
"file can be opened by its absolute file:// URL (e.g. file:///home/me/proj/index.html).\n" +Boundary Verification
Skipped. The production change is help text only: no new function calls, imports, file I/O, network calls, serialization, schemas, or behavior changes. The boundary risk is the human-facing CLI help contract, covered above.
Testing
I ran:
go test ./internal/cli -run 'TestPreview' -count=1
go test ./internal/cli -count=1
go run ./cmd/ao preview --help
git diff --check origin/main...HEADAll passed. The rendered help includes the requested ao preview file://$(pwd)/index.html example.
Recommendation
Request Changes
The requested example is good, but the no-argument behavior description regressed from slightly over-specific to still inaccurate in a different way. Fixing that wording should be enough.
Address review feedback on #388: the no-argument description now reflects the daemon's actual behavior — autodetect the workspace entry point, fall back to the session's existing preview target when none exists.
harshitsinghbhandari
approved these changes
Jun 22, 2026
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.
What
Improves
ao preview --helpwith concrete examples for the common workflows.Closes #387
Changes
Examplefield to the preview command — renders anExamples:section in--helpwith the four common workflows:ao preview ao preview file://$(pwd)/index.html ao preview http://localhost:5173 ao preview clearLongdescription — replaced the workspace-relative path (./dist/index.html) with the absolutefile://URL pattern agents actually use.TestPreview_HelpIncludesExamples) verifying the examples section is present, thefile://example exists, and the old relative-path reference is gone.Acceptance criteria
ao preview --helpincludes a concise examples sectionfile://$(pwd)/index.html, not./index.htmlTest output