1use crate::HelpTopic;
4
5#[must_use]
7pub const fn help_text(topic: HelpTopic) -> &'static str {
8 match topic {
9 HelpTopic::Root => ROOT_HELP,
10 HelpTopic::Login => LOGIN_HELP,
11 HelpTopic::Logout => LOGOUT_HELP,
12 HelpTopic::Setup => SETUP_HELP,
13 HelpTopic::Status => STATUS_HELP,
14 HelpTopic::Version => VERSION_HELP,
15 HelpTopic::Auth => AUTH_HELP,
16 HelpTopic::Json => JSON_HELP,
17 HelpTopic::Examples => EXAMPLES_HELP,
18 HelpTopic::Projects => PROJECTS_HELP,
19 HelpTopic::Usage => USAGE_HELP,
20 HelpTopic::Read => READ_HELP,
21 HelpTopic::ReadLogs => READ_LOGS_HELP,
22 HelpTopic::ReadIssues => READ_ISSUES_HELP,
23 HelpTopic::ReadActions => READ_ACTIONS_HELP,
24 HelpTopic::ReadReleases => READ_RELEASES_HELP,
25 HelpTopic::ReadTraces => READ_TRACES_HELP,
26 HelpTopic::ReadTrace => READ_TRACE_HELP,
27 HelpTopic::ReadIssue => READ_ISSUE_HELP,
28 HelpTopic::Watch => WATCH_HELP,
29 HelpTopic::Explain => EXPLAIN_HELP,
30 HelpTopic::Investigate => INVESTIGATE_HELP,
31 HelpTopic::NativeDebugArtifacts => NATIVE_DEBUG_ARTIFACTS_HELP,
32 HelpTopic::Set => SET_HELP,
33 HelpTopic::Support => SUPPORT_HELP,
34 }
35}
36
37const ROOT_HELP: &str = "\
39LogBrew CLI
40
41Usage:
42 logbrew login [--no-open] [--json]
43 logbrew logout [--json]
44 logbrew setup [--auto] [--yes] [--json]
45 logbrew projects [--json]
46 logbrew usage [--json]
47 logbrew status [--json]
48 logbrew health [--json]
49 logbrew doctor [--json]
50 logbrew doctor --project <project_id> [--json]
51 logbrew whoami [--json]
52 logbrew me [--json]
53 logbrew version [--json]
54 logbrew support create --category <category> --title <title> --description <description> [--json]
55 logbrew support list [--status <status>] [--category <category>] [--json]
56 logbrew support show <ticket_id> [--json]
57 logbrew support context <ticket_id> [--json]
58 logbrew support reply <ticket_id> --context <text> --retry-key <key> [--diagnostics] [--json]
59 logbrew support close <ticket_id> [--json]
60 logbrew support reopen <ticket_id> [--json]
61 logbrew read logs [--severity error] [--search checkout] [--release <release>] [--environment \
62 production] [--since 24h] [--json]
63 logbrew logs checkout failed [--severity error] [--release <release>] [--environment \
64 production] [--json]
65 logbrew logs error checkout failed [--release <release>] [--environment production] [--json]
66 logbrew search checkout [--release <release>] [--environment production] [--json]
67 logbrew find checkout [--release <release>] [--environment production] [--json]
68 logbrew grep checkout [--release <release>] [--environment production] [--json]
69 logbrew show logs [--release <release>] [--environment production] [--json]
70 logbrew latest logs [--limit 20] [--json]
71 logbrew last 10 logs [--json]
72 logbrew last 5 open issues [--json]
73 logbrew list issues [--status unresolved] [--json]
74 logbrew issues open [--release <release>] [--environment production] [--json]
75 logbrew issue open [--release <release>] [--environment production] [--json]
76 logbrew open issues [--release <release>] [--environment production] [--json]
77 logbrew open issue [--release <release>] [--environment production] [--json]
78 logbrew errors closed [--release <release>] [--environment production] [--json]
79 logbrew get issue <issue_id> [--json]
80 logbrew read issues [--release <release>] [--environment production] [--status unresolved] \
81 [--json]
82 logbrew read actions [--release <release>] [--environment production] [--name checkout_failed] \
83 [--json]
84 logbrew events checkout_failed [--release <release>] [--environment production] [--json]
85 logbrew read releases [--environment production] [--json]
86 logbrew traces [--service <service_name>] [--status error] [--since 24h] [--json]
87 logbrew read trace <trace_id> [--release <release>] [--environment production] [--json]
88 logbrew trace <trace_id> [--release <release>] [--environment production] [--json]
89 logbrew issue <issue_id> [--json]
90 logbrew issue <issue_id> explain [--json]
91 logbrew trace <trace_id> explain [--json]
92 logbrew explain issue <issue_id> [--json]
93 logbrew explain trace <trace_id> [--json]
94 logbrew explain <issue_id_or_trace_id> [--json]
95 logbrew investigate issue <issue_id> [--json]
96 logbrew debug-artifacts upload <path> --project <project_id> --release <release> --environment \
97 <environment> --service <service> [--json]
98 logbrew debug-artifacts lookup --project <project_id> --release <release> --environment \
99 <environment> --service <service> --image-uuid <uuid> --architecture \
100 <architecture> [--json]
101 logbrew <issue_id_or_trace_id> explain [--json]
102 logbrew set issue <issue_id> resolved [--json]
103 logbrew resolve <issue_id> [--json]
104 logbrew close <issue_id> [--json]
105 logbrew ignore <issue_id> [--json]
106 logbrew reopen <issue_id> [--json]
107
108Popular terms: auth, status, health, setup, projects, usage, logs, issues, errors, traces, spans, \
109 actions, events, releases, environments, support.
110Health aliases: logbrew status, logbrew health, logbrew ping, logbrew doctor.
111Setup aliases (non-mutating plan): logbrew init, logbrew install, logbrew configure, logbrew sdk.
112Shortcuts: logbrew auth, logbrew whoami, logbrew me, logbrew log, logbrew logs, logbrew issues, \
113 logbrew logs checkout failed, logbrew logs error checkout, logbrew \
114 search checkout, logbrew find checkout, logbrew grep checkout, logbrew \
115 errors, logbrew actions, logbrew events, logbrew events checkout_failed, \
116 logbrew release, logbrew releases, logbrew trace <id>, logbrew issue \
117 <id>, logbrew resolve <id>, logbrew close <id>, logbrew ignore <id>, \
118 logbrew reopen <id>.
119Read verbs: logbrew show logs, logbrew latest logs, logbrew last 10 logs, logbrew recent issues, \
120 logbrew list issues, logbrew get issue <id>.
121Singular read aliases: logbrew read log, read release, show log, list issue, get release.
122Pasted IDs: logbrew issue_123 or logbrew <trace_id>.
123Examples: logbrew examples.
124Topic help: logbrew logs --help, logbrew help logs, logbrew help read logs, or logbrew help json.
125JSON mode: logbrew --json status and logbrew status --json both work.
126Use --json for stable machine-readable output.";
127
128const LOGIN_HELP: &str = "\
130Usage:
131 logbrew login [--no-open] [--json]
132
133Starts browser login for the native CLI and stores a private local access/refresh pair.
134Authenticated commands refresh local auth once after an expired-token response.
135Use --no-open to print the URL without opening a browser.
136--json prints the auth handoff without opening a browser.";
137
138const LOGOUT_HELP: &str = "\
140Usage:
141 logbrew logout [--json]
142
143Attempts to revoke the stored server session, then always removes both local CLI credentials.
144If LOGBREW_TOKEN is set, unset it separately to fully log out.";
145
146const SETUP_HELP: &str = "\
148Usage:
149 logbrew setup [--auto] [--yes] [--json]
150
151Detects supported project manifests and prints a non-mutating SDK setup plan.
152No files are changed. Install: not ready.
153Aliases (same non-mutating plan): logbrew init, logbrew install, logbrew configure, logbrew sdk.
154Options: --auto records automatic detection preference; --yes records confirmation preference; \
155 --json prints stable setup JSON.
156Supported manifests: package.json, pyproject.toml, Pipfile, Cargo.toml, Package.swift, \
157 project.yml, project.yaml, .xcodeproj, .xcworkspace, go.mod, \
158 composer.json.
159Package managers: npm, pnpm, yarn, bun, pip, uv, poetry, pipenv, cargo, SwiftPM, XcodeGen, Go, \
160 Composer.";
161
162const STATUS_HELP: &str = "\
164Usage:
165 logbrew status [--json]
166 logbrew health [--json]
167 logbrew ping [--json]
168 logbrew doctor [--json]
169 logbrew doctor --project <project_id> [--json]
170 logbrew whoami [--json]
171 logbrew me [--json]
172 logbrew auth status [--json]
173
174Checks local auth and API reachability.
175Identity aliases: logbrew whoami, logbrew me, logbrew auth status.";
176
177const VERSION_HELP: &str = "\
179Usage:
180 logbrew version [--json]
181 logbrew --version [--json]
182
183Prints the installed CLI version.
184The CLI is a native Rust binary.";
185
186const AUTH_HELP: &str = "\
188Usage:
189 logbrew login [--no-open] [--json]
190 logbrew auth login [--no-open] [--json]
191 logbrew status [--json]
192 logbrew auth status [--json]
193 logbrew auth whoami [--json]
194 logbrew auth me [--json]
195 logbrew whoami [--json]
196 logbrew me [--json]
197 logbrew logout [--json]
198 logbrew auth logout [--json]
199
200Use login once, status/whoami/me to verify API/auth state, and logout to revoke the stored
201server session when possible and always remove local credentials.
202Use --json for agent-readable auth checks.";
203
204const JSON_HELP: &str = "\
206Usage:
207 logbrew --json status
208 logbrew status --json
209 logbrew logs --json
210 logbrew help json --json
211
212Use --json before or after commands for stable machine-readable output.
213Stable JSON keeps server response shapes for reads and mutations.
214Errors include ok, error, message, and next.";
215
216const EXAMPLES_HELP: &str = "\
218Usage:
219 logbrew examples
220 logbrew help examples
221
222First run:
223 logbrew status
224 logbrew login
225 logbrew setup
226
227Troubleshoot:
228 logbrew logs error checkout failed --release checkout@1 --environment production
229 logbrew issues open --release checkout@1 --environment production
230 logbrew issue issue_123
231 logbrew explain issue issue_123
232 logbrew trace <trace_id>
233
234Live:
235 logbrew watch --json
236 logbrew watch --severity error,critical --json
237
238Agent JSON:
239 logbrew --json status
240 logbrew logs checkout failed --json
241 logbrew explain trace <trace_id> --json
242
243More help:
244 logbrew help logs
245 logbrew help issues
246 logbrew help watch
247 logbrew help json";
248
249const PROJECTS_HELP: &str = "\
251Usage:
252 logbrew projects [--json]
253 logbrew project [--json]
254 logbrew projects create <name> --ingest-key-file <path> [--runtime <runtime>] \
255 [--environment <environment>] [--abandon-retry] [--json]
256 logbrew setup --create-project [--json]
257 logbrew projects setup <project_id> [--runtime <runtime>] [--source api|cli|sdk] \
258[--environment <environment>] [--json]
259
260Project creation, setup status, and project-scoped ingest credentials are backend-owned.
261Project creation stores the one-time ingest key in a new owner-only file before reporting success;
262it never prints the one-time ingest key or its file path. An ambiguous attempt reuses the pending retry key only for the exact same request; --abandon-retry starts a new explicit attempt.
263Builds that cannot prove owner-only file permissions fail before sending the create request.
264No local install, quota, or usage state is created.
265Project setup uses POST /api/projects/{project_id}/setup/seen and preserves backend setup status JSON.
266Project-scoped SDK/ingest credentials are shown only when backend returns one-time credentials.
267Never use an account bearer token as SDK or ingest configuration.
268Next: run logbrew setup for the current non-mutating local plan.";
269
270const USAGE_HELP: &str = "\
272Usage:
273 logbrew usage [--json]
274 logbrew account usage [--json]
275
276Reads authenticated account usage, configured limits, quota state, and reset dates without mutating \
277account or billing state.
278Human output is bounded to plan, state, totals, limits, the driving limit, and one next step. JSON \
279preserves the exact validated account-usage object for agents.
280The CLI does not calculate or persist usage/quota state from local files.
281Next: run logbrew usage to inspect current account usage.";
282
283const READ_HELP: &str = "\
285Usage:
286 logbrew read logs [filters] [--json]
287 logbrew read log [filters] [--json]
288 logbrew show logs [filters] [--json]
289 logbrew list issues [filters] [--json]
290 logbrew get issue <issue_id> [--json]
291 logbrew read issues [filters] [--json]
292 logbrew read actions [filters] [--json]
293 logbrew read releases [filters] [--json]
294 logbrew read release [filters] [--json]
295 logbrew read traces [filters] [--json]
296 logbrew read trace <trace_id> [--json]
297 logbrew read issue <issue_id> [--json]
298
299Reads historical observability data for agents and developers.
300Singular read aliases: logbrew read log, read release, show log, list issue, get release.
301Recency counts are limit shortcuts: logbrew last 10 logs or logbrew recent 5 issues.
302Use --environment <environment> with logs, issues, actions, releases, or traces.
303Use --service <service_name> with logs, issues, actions, or releases.
304Filter aliases: --service-name, --env, --project-id, --trace-id, and --distinct-id.";
305
306const READ_LOGS_HELP: &str = "\
308Usage:
309 logbrew read logs [--severity error] [--search checkout] [--release <release>] [--environment \
310 production] [--service <service_name>] [--since 24h] [--trace \
311 <trace_id>] [--project <project_id>] [--pagination cursor] [--limit \
312 100] [--json]
313 logbrew read logs [filters] --pagination cursor --cursor-time <RFC3339> --cursor-id <uuid> \
314 [--limit 100] [--json]
315 logbrew logs checkout failed [--severity error] [--release <release>] [--environment \
316 production] [--json]
317 logbrew logs error checkout failed [--release <release>] [--environment production] [--json]
318
319Reads structured logs. Severity values are info, warning, error, and critical.
320Legacy severity aliases are accepted on input and normalized.
321Severity matching is case-insensitive. --level is accepted as a compatibility alias for \
322 --severity.
323The logs shortcut accepts obvious multi-word search text, such as logbrew logs checkout failed.
324Shortcut levels can include search text, such as logbrew logs error checkout failed.
325Recency counts are limit shortcuts, such as logbrew last 10 logs.
326Explicit filters accept unquoted search text too, such as logbrew logs --severity warning checkout \
327 failed or logbrew logs --search checkout failed.
328Use -- before literal flag-looking search text, such as logbrew logs -- --timeout --json.
329Filter by severity, message search, release, or trace_id to correlate logs with spans.
330--service-name <service_name> is accepted as an alias for --service <service_name>.
331Cursor pagination preserves JSON as {logs,next_cursor}; next_cursor is either {time,id} or null.
332Use --pagination cursor alone for the first page. Continue with --cursor-time and --cursor-id from \
333 next_cursor.
334Keep the same active filters and pagination limit on every continuation page.
335Limit must be a positive whole number.";
336
337const READ_ISSUES_HELP: &str = "\
339Usage:
340 logbrew read issues [--release <release>] [--environment production] [--status unresolved] \
341 [--service <service_name>] [--since <24h|7d|RFC3339>] [--project \
342 <project_id>] [--pagination cursor] [--limit 100] [--json]
343 logbrew read issues [filters] --pagination cursor --cursor-time <RFC3339> --cursor-id <uuid> \
344 [--limit 100] [--json]
345 logbrew issues open [--release <release>] [--environment production] [--json]
346 logbrew issue open [--release <release>] [--environment production] [--json]
347 logbrew open issues [--release <release>] [--environment production] [--json]
348 logbrew open issue [--release <release>] [--environment production] [--json]
349 logbrew last 5 open issues [--json]
350 logbrew errors closed [--release <release>] [--environment production] [--json]
351
352Reads grouped issues across releases and environments.
353Status accepts unresolved/open, resolved/closed, or ignored, case-insensitively.
354Issue shortcuts accept status words, such as logbrew issues open, logbrew issue open, logbrew open \
355 issues, logbrew open issue, or logbrew errors closed.
356Recency issue shortcuts can include status and count, such as logbrew last 5 open issues.
357--service-name <service_name> is accepted as an alias for --service <service_name>.
358Since accepts positive compact durations such as 24h or 7d, or an RFC3339 timestamp such as \
359 2026-05-01T00:00:00Z.
360Cursor pagination preserves JSON as {issues,next_cursor}; next_cursor is either {time,id} or null.
361Use --pagination cursor alone for the first page. Continue with --cursor-time and --cursor-id from \
362 next_cursor.
363Keep the same active filters and pagination limit on every continuation page.
364Limit must be a positive whole number.";
365
366const READ_ACTIONS_HELP: &str = "\
368Usage:
369 logbrew read actions [--release <release>] [--environment production] [--name checkout_failed] \
370 [--user <distinct_id>] [--service <service_name>] [--since 24h] \
371 [--project <project_id>] [--pagination cursor] [--limit 100] \
372 [--json]
373 logbrew read actions [filters] --pagination cursor --cursor-time <RFC3339> --cursor-id <uuid> \
374 [--limit 100] [--json]
375 logbrew events checkout_failed [--release <release>] [--environment production] [--json]
376
377Reads product actions. Use distinct_id to follow one actor or session.
378Action/event aliases accept one positional name as the same filter as --name.
379--service-name <service_name> is accepted as an alias for --service <service_name>.
380Cursor pagination preserves JSON as {actions,next_cursor}; next_cursor is either {time,id} or null.
381Use --pagination cursor alone for the first page. Continue with --cursor-time and --cursor-id from \
382 next_cursor.
383Keep the same active filters and pagination limit on every continuation page.
384Limit must be a positive whole number.";
385
386const READ_RELEASES_HELP: &str = "\
388Usage:
389 logbrew read releases [--release <release>] [--environment production] [--service \
390 <service_name>] [--since <24h|7d|RFC3339>] [--project \
391 <project_id>] [--limit 100] [--json]
392
393Reads release summaries with counts for issues, logs, trace spans, and actions.
394--service-name <service_name> is accepted as an alias for --service <service_name>.
395Since accepts positive compact durations such as 24h or 7d, or an RFC3339 timestamp such as \
396 2026-05-01T00:00:00Z.
397Limit must be a positive whole number.";
398
399const READ_TRACES_HELP: &str = "\
401Usage:
402 logbrew traces [--project <project_id>] [--service <service_name>] [--release <release>] \
403 [--environment <environment>] [--status <error|ok>] \
404 [--since <24h|7d|RFC3339>] \
405 [--min-duration-ms <milliseconds>] [--limit 100] [--json]
406 logbrew spans [filters] [--json]
407 logbrew latest traces [--limit 100] [--json]
408
409Lists recent distributed traces for incident investigation. JSON preserves the backend bare array.
410Status accepts error or ok, case-insensitively. Minimum duration is a non-negative whole number.
411Since accepts positive compact durations such as 24h or 7d, or an RFC3339 timestamp such as \
412 2026-05-01T00:00:00Z.
413The backend defaults limit to 100 and clamps it to 1..500.
414CLI aliases --project-id, --service-name, and --env still serialize only canonical API query keys.
415Next: run logbrew trace <trace_id> or logbrew explain trace <trace_id>.";
416
417const READ_TRACE_HELP: &str = "\
419Usage:
420 logbrew read trace <trace_id> [--release <release>] [--environment production] [--project \
421 <project_id>] [--json]
422 logbrew trace <trace_id> [--release <release>] [--environment production] [--project \
423 <project_id>] [--json]
424
425Reads spans for one distributed trace.";
426
427const READ_ISSUE_HELP: &str = "\
429Usage:
430 logbrew read issue <issue_id> [--json]
431
432Reads one grouped issue with status, release, environment, and occurrence counts.";
433
434const WATCH_HELP: &str = "\
436Usage:
437 logbrew watch --json
438 logbrew watch logs [--json]
439 logbrew watch issues [--json]
440 logbrew watch actions [--json]
441 logbrew watch --severity error,critical --json
442
443Aliases: tail, follow, and stream use the same live watch flow.
444Live watch uses a short-lived feed ticket and WebSocket stream.
445Transient disconnects reconnect with a fresh ticket and backoff.
446Server-side live filters are not sent yet; severity filtering is applied client-side.";
447
448const EXPLAIN_HELP: &str = "\
450Usage:
451 logbrew explain issue <issue_id> [--json]
452 logbrew explain trace <trace_id> [--json]
453 logbrew explain <issue_id_or_trace_id> [--json]
454 logbrew issue <issue_id> explain [--json]
455 logbrew trace <trace_id> explain [--json]
456 logbrew <issue_id_or_trace_id> explain [--json]
457
458Fetches enough context for an AI agent to explain what happened.
459Pasted UUID/issue_* values are treated as issues; 32-hex/trace_* values are treated as traces.";
460
461const INVESTIGATE_HELP: &str = "\
463Usage:
464 logbrew investigate issue <issue_id> [--json]
465
466Reads the issue first, then follows only its public trace-summary or related-log next action.
467The command is read-only and preserves issue scope in the directed request.
468JSON preserves the issue and exactly one directed result in a stable four-key envelope.";
469
470const NATIVE_DEBUG_ARTIFACTS_HELP: &str = "\
472Usage:
473 logbrew debug-artifacts upload <path> --project <project_id> --release <release> \
474 --environment <environment> --service <service> [--json]
475 logbrew debug-artifacts lookup --project <project_id> --release <release> \
476 --environment <environment> --service <service> --image-uuid <uuid> \
477 --architecture <arm64|arm64e|x86_64> [--json]
478
479Validates Apple dSYM or Mach-O debug objects locally, uploads only supported exact identities, and \
480verifies each identity with an exact authenticated lookup. Local paths and filenames are never \
481included in output or API metadata.";
482
483const SET_HELP: &str = "\
485Usage:
486 logbrew set issue <issue_id> unresolved [--json]
487 logbrew set issue <issue_id> resolved [--json]
488 logbrew set issue <issue_id> ignored [--json]
489 logbrew resolve <issue_id> [--json]
490 logbrew close <issue_id> [--json]
491 logbrew ignore <issue_id> [--json]
492 logbrew reopen <issue_id> [--json]
493 logbrew issue <issue_id> resolve [--json]
494 logbrew issue <issue_id> close [--json]
495 logbrew issue <issue_id> ignore [--json]
496 logbrew issue <issue_id> reopen [--json]
497 logbrew <issue_id> resolve [--json]
498 logbrew resolved <issue_id> [--json]
499 logbrew closed <issue_id> [--json]
500 logbrew ignored <issue_id> [--json]
501 logbrew open <issue_id> [--json]
502 logbrew unresolved <issue_id> [--json]
503
504Updates grouped issue status. Resolve/close map to resolved; ignore maps to ignored; reopen maps \
505 to unresolved.
506Close is an alias for resolved.
507Issue-first, pasted-ID, and status-first aliases are useful after reading issue detail.
508Status values are case-insensitive.";
509
510const SUPPORT_HELP: &str = "\
512Usage:
513 logbrew support create --category <category> --title <title> --description <description> \
514 [--project <project_id>] [--environment <environment>] \
515 [--runtime <runtime>] [--framework <framework>] \
516 [--sdk-package <package>] [--sdk-version <version>] \
517 [--release <release>] [--trace-id <trace_id>] [--event-id <event_id>] \
518 [--diagnostics] [--json]
519 logbrew support list [--project <project_id>] [--status <status>] [--source <source>] \
520 [--category <category>] [--release <release>] [--limit 100] \
521 [--pagination cursor] [--json]
522 logbrew support list [filters] --pagination cursor --cursor-time <RFC3339> \
523 --cursor-id <ticket_id> [--json]
524 logbrew support show <ticket_id> [--json]
525 logbrew support context <ticket_id> [--json]
526 logbrew support reply <ticket_id> --context <text> --retry-key <key> [--diagnostics] [--json]
527 logbrew support close <ticket_id> [--json]
528 logbrew support reopen <ticket_id> [--json]
529
530Creates, reads, adds requested context to, closes, and reopens authenticated account support \
531 tickets. Creation source is \
532 always cli.
533Categories: sdk_install_failure, ingest_failure, auth_failure, project_setup, dashboard_issue, \
534 docs_confusion, cli_issue, mobile_issue, billing_question, other.
535--diagnostics adds only binary, CLI version, operating system, and architecture. It never reads \
536 arbitrary environment variables or files.
537Cursor continuations repeat --pagination cursor, all active filters, and the paired cursor from \
538 next_cursor. JSON preserves the server response exactly.
539Context replies require a retry key. Reuse the key only when retrying the exact same context. \
540 Chat, messages, and internal notes are not part of this command.";