b4fbd6fe9f
Deploy Site / deploy-vercel (push) Has been skipped
Deploy Site / deploy-docs (push) Has been skipped
Build Skills Index / build-index (push) Has been skipped
CI / Deny unrelated histories (push) Has been skipped
CI / Detect affected areas (push) Successful in 27m35s
CI / OSV scan (push) Failing after 4s
CI / Build&Test Docker image (push) Successful in 9s
CI / Supply-chain scan (push) Has been skipped
CI / Lint Docker scripts (push) Failing after 5m13s
CI / Check contributors (push) Failing after 12m8s
CI / Docs Site (push) Failing after 12m8s
CI / TypeScript (push) Failing after 12m8s
CI / Python lints (push) Failing after 12m9s
CI / Python tests (push) Failing after 12m9s
CI / Check uv.lock (push) Failing after 23m22s
CI / CI timing report (push) Has been cancelled
Build Skills Index / trigger-deploy (push) Has been cancelled
CI / All required checks pass (push) Has been cancelled
101 lines
3.7 KiB
Python
101 lines
3.7 KiB
Python
"""``hermes debug`` subcommand parser.
|
|
|
|
Extracted verbatim from ``hermes_cli/main.py:main()`` (god-file Phase 2).
|
|
Handler injected to avoid importing ``main``.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import argparse
|
|
from typing import Callable
|
|
|
|
|
|
def build_debug_parser(subparsers, *, cmd_debug: Callable) -> None:
|
|
"""Attach the ``debug`` subcommand to ``subparsers``."""
|
|
# =========================================================================
|
|
# debug command
|
|
# =========================================================================
|
|
debug_parser = subparsers.add_parser(
|
|
"debug",
|
|
help="Debug tools — upload logs and system info for support",
|
|
description="Debug utilities for Hermes Agent. Use 'hermes debug share' to "
|
|
"upload a debug report (system info + recent logs) to a paste "
|
|
"service and get a shareable URL.",
|
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
epilog="""\
|
|
Examples:
|
|
hermes debug share Upload debug report (asks for confirmation)
|
|
hermes debug share --yes Skip confirmation (for scripts/CI)
|
|
hermes debug share --lines 500 Include more log lines
|
|
hermes debug share --expire 30 Keep paste for 30 days
|
|
hermes debug share --local Print report locally (no upload)
|
|
hermes debug share --no-redact Disable upload-time secret redaction
|
|
hermes debug share --nous Upload to Nous-internal storage (private)
|
|
hermes debug delete <url> Delete a previously uploaded paste
|
|
""",
|
|
)
|
|
debug_sub = debug_parser.add_subparsers(dest="debug_command")
|
|
share_parser = debug_sub.add_parser(
|
|
"share",
|
|
help="Upload debug report to a paste service and print a shareable URL",
|
|
)
|
|
share_parser.add_argument(
|
|
"--lines",
|
|
type=int,
|
|
default=200,
|
|
help="Number of log lines to include per log file (default: 200)",
|
|
)
|
|
share_parser.add_argument(
|
|
"--expire",
|
|
type=int,
|
|
default=7,
|
|
help="Paste expiry in days (default: 7)",
|
|
)
|
|
share_parser.add_argument(
|
|
"--local",
|
|
action="store_true",
|
|
help="Print the report locally instead of uploading",
|
|
)
|
|
share_parser.add_argument(
|
|
"-y",
|
|
"--yes",
|
|
action="store_true",
|
|
help=(
|
|
"Skip the confirmation prompt and upload immediately. Required "
|
|
"in non-interactive contexts (scripts/CI); without it, and with "
|
|
"no TTY on stdin, the command refuses rather than upload silently."
|
|
),
|
|
)
|
|
share_parser.add_argument(
|
|
"--no-redact",
|
|
action="store_true",
|
|
help=(
|
|
"Disable upload-time secret redaction (default: redact). Logs "
|
|
"are normally run through agent.redact.redact_sensitive_text "
|
|
"with force=True before upload so credentials are not leaked "
|
|
"into the public paste service."
|
|
),
|
|
)
|
|
share_parser.add_argument(
|
|
"--nous",
|
|
action="store_true",
|
|
help=(
|
|
"Upload the debug bundle to Nous-internal storage (AWS S3) instead "
|
|
"of a public paste service. The bundle is private — viewable only "
|
|
"by Nous staff (and allowlisted Discord mods) via a Google-login-"
|
|
"gated viewer — and auto-deletes after 14 days. Still force-redacts "
|
|
"secrets unless --no-redact is also passed."
|
|
),
|
|
)
|
|
delete_parser = debug_sub.add_parser(
|
|
"delete",
|
|
help="Delete a paste uploaded by 'hermes debug share'",
|
|
)
|
|
delete_parser.add_argument(
|
|
"urls",
|
|
nargs="*",
|
|
default=[],
|
|
help="One or more paste URLs to delete (e.g. https://paste.rs/abc123)",
|
|
)
|
|
debug_parser.set_defaults(func=cmd_debug)
|