Repository navigation
Native --help for X commands; /health reports per-account cooldown state - #47
Conversation
`birdy <cmd> --help` / `-h` / `birdy help <cmd>` used to travel into the bird subprocess (bird's Commander banner, or `env: node: No such file`, or `bird CLI not found` on a runner without bird). The X subcommands run with DisableFlagParsing, so cobra never saw the flag. Answer it in-process before any account is picked or process spawned, on every dispatch path. The flag list is not hand-written per command: cmd/native_help.go keeps one ordered flagDocs table and filters it through nativeAcceptsFlags, the predicate runPassthrough already uses to choose the engine. A test compares help against the parser's accepted set in both directions for every native command, so a flag added to native.go without a doc entry fails CI and help can never advertise a flag the engine rejects. native.go is untouched. GET /health now appends accounts_cooling, accounts_ready, cooldown_seconds (rotation.QuotaCooldown), degraded (no account ready) and accounts_detail (name, cooling, cooldown_remaining_seconds, last_rate_limited_at; never credentials). ok stays a liveness bit. The daemon Config gains an optional Accounts callback; nil keeps the old shape working. Docs: README/COMPATIBILITY said unsupported flags (--max-pages, --cursor) "fall back to bird"; verified live that without bird installed they fail with `bird CLI not found`, and say so now. README gains a daemon section. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01L2FYb2zupuW9VBdnTFjz3Y
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e77df2ea86
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| {names: []string{"-n", "--count", "--limit"}, arg: "N", | ||
| doc: "number of items to return"}, |
There was a problem hiding this comment.
Don't advertise counts for commands that ignore them
For read, thread, and replies, this shared entry causes help to advertise -n/--count/--limit as controlling the number of returned items because nativeAcceptsFlags accepts the common flag set. However, nativeRead, nativeThread, and nativeReplies never read args.count, so invocations such as birdy replies <id> -n 1 are served natively while silently ignoring the documented limit. Restrict this help entry to handlers that consume the count, or narrow the native acceptance tables so unsupported counts fall back instead.
Useful? React with 👍 / 👎.
What
--helpfor the X commands.birdy <cmd> --help,birdy <cmd> -handbirdy help <cmd>now print birdy-authored help — one-liner, usage with positionals, the flags the native engine accepts for that command, birdy's global flags, and 1–2birdyexamples. Help is answered in-process before any account is picked or process spawned, so it works on a runner with no accounts and no bird.--helpis never forwarded on any path (registered command, unknown command, tweet-id shorthand); a literal--helpafter--still passes through.GET /healthreports rate-limit state. Appended to the existing (byte-compatible) six fields:accounts_cooling,accounts_ready,cooldown_seconds(=rotation.QuotaCooldown),degraded(no account ready), andaccounts_detail: [{name, cooling, cooldown_remaining_seconds, last_rate_limited_at, disabled?}].okstays a liveness bit. Names and timestamps only — a test asserts no credential material leaks.birdy daemonsection documenting/health.How the flag list stays DRY
cmd/native_help.gohas one orderedflagDocstable.nativeHelpFlags(cmd)filters it throughnativeAcceptsFlags— the exact predicaterunPassthroughuses to decide whether the native engine serves an invocation.TestNativeHelpMatchesParserFlagSetcompares, for every command innativeCommands, the set of flags shown in help against the set the parser accepts (drawn fromnativeSupportedFlags+commandExtraFlags), in both directions. So a flag added tonative.gowithout a doc entry fails CI, and help can never advertise a flag the engine rejects (e.g.whoami --json).cmd/native.gois untouched. A--json-fulldoc entry is present but inert until the parser accepts it (another branch).Before / after —
birdy search --helpBefore (
main, from a cwd without the bird checkout, or on the CI runner):Before, with a stray
birdy-birdNode shim on PATH: bird's Commander banner (bird unknown — fast X CLI for tweeting, replying, and reading,-V,--json-full,bird tweetexamples). With node hidden:env: node: No such file or directory, exit 127.After (
PATH=/usr/bin:/bin ./birdy search --help, exit 0):birdy trending --help(registered but not native) says so and points at--bird+ a separate bird install instead of forwarding. Rootbirdy --helpretitles the groupX Commands (native Go engine; \birdy --help` lists its flags):and flagstrending` as bird-only.Premise corrections
--max-pages/--cursor"run natively now". They do not: neither is innativeSupportedFlags, and--max-pagesonly exists onfollowing-overlap. Verified live from a clean cwd:birdy search golang --max-pages 2→Error: bird CLI not found, and --bird requires it.The docs were wrong in a different way — "falls back to bird" no longer works out of the box — and now say exactly that.--json-fulldoc mention left as-is per the brief.findBird()does not re-exec birdy; with no shim it returns thebird CLI not founderror above (runner is out of scope here, untouched).Verification
gofmt -l .→ only the pre-existinginternal/vpn/bootstrap_test.go(untouched, out of scope)go vet ./...clean;go test ./... -count=1all packages ok (cmd, internal/daemon incl. 3 newhttptesthealth tests with one cooling + one ready account, all-cooling →degraded, and nilAccountscompatibility)PATH=/usr/bin:/bin ./birdy search --help(above),whoami -h(no--jsonlisted),help news(all six tab flags),--helproot listinggo mod tidypromotedspf13/pflagfrom indirect to direct (already imported directly bycmd/root.goon main)🤖 Generated with Claude Code
https://claude.ai/code/session_01L2FYb2zupuW9VBdnTFjz3Y