Skip to the content.

← Command reference · CLI overview

lean-pkg report

read-only: a redacted bug report in the repository’s issue format; dry run unless –yes (files it with gh issue create).

Usage

lean-pkg report [--command ARGS] [--body TEXT] [--from-log FILE[:N]] [--expected TEXT]
                [--workaround TEXT] [--blocking {yes,no}] [--package NAME]
                [--title TITLE] [--enhancement] [--target-repo OWNER/NAME] [--dry-run]
                [--yes] [--json]

Arguments and flags

Argument or flag Description
--command ARGS the lean-pkg arguments to capture, quoted as one string (“status NAME”); re-run in a subprocess (with –json when the subcommand has it) unless it would write; a value starting with ‘-‘ needs –command=VALUE
--body TEXT free text for What happened, nothing re-run (before the re-run when –command is given too); redacted like everything else
--from-log FILE[:N] the last N lines (default 200) of a stage log, under Log excerpt in What happened; redacted like everything else; a missing file is a usage error
--expected TEXT what you expected instead, for What you expected; redacted like –body
--workaround TEXT what you did instead, as a Workaround section after What you expected; redacted like –body
--blocking {yes,no} whether the problem blocks your work: a Blocking line before Version (none without it). Choices: yes, no.
--package NAME add the package’s registry record (status, lease, receipt commits); its .lean-pkg-private-patterns joins the redaction
--title TITLE issue title (default: report: <the command>, else report: lean-pkg <version>)
--enhancement label enhancement instead of bug
--target-repo OWNER/NAME repository to file on (default lean-pkg/lean-pkg) (old spelling –repo, kept working)
--dry-run print title, labels and body; file nothing (default)
--yes file it with gh issue create and print the URL (needs gh auth login)

Details

Form What it does Key flags
report read-only: assemble a bug report in the shape of .github/ISSUE_TEMPLATE/bug_report.md (same section headings, same order) and, with --yes, file it on lean-pkg/lean-pkg with gh issue create --label bug (--label enhancement with --enhancement; --repo OWNER/NAME for a fork) and print the issue URL. Filled automatically: Version (the --version line, Python version, platform; the ok/warn lines of doctor --json; the comparator host-check --json verdict); Command and What happened with --command "ARGS" (the lean-pkg arguments as one string; a value starting with - needs --command=ARGS): the command re-run in a subprocess, with --json appended when it is not there and the subcommand has the flag, its exit code, stdout and stderr (a long stream keeps its first 150 and last 50 lines); a command that would write (the registry or event log, wiki --out, formalization --write/--out, comparator config, index render/migrate, claims migrate) is not re-run and the body says so; --body TEXT (free text, nothing re-run) and --from-log FILE[:N] (the last N lines, default 200, of a stage log, under a Log excerpt line with the redacted path) go first in What happened, before the re-run when --command is given too; at least one of --command, --body, --from-log is required; Minimal registry or receipt with --package NAME: the record’s status, visibility, lean_toolchain, lease fields with expires_at, and the gate and comparator receipt paths with the commits they bind; Checklist ticked from what is known (--json used, validate passes). Intake fields, each rendered only when given: --blocking yes\|no a **Blocking**: yes (or no) line before Version (no line without the flag; any other value exits 2); --expected TEXT fills What you expected (else the template’s placeholder comment stays); --workaround TEXT a Workaround section after it. The first line of every body, dry run, filed or --json, is the marker <!-- lean-pkg-report/1 -->, so an intake channel can recognise a report and its format. Redaction is mandatory and applies to every captured text, the title, body text, --expected, --workaround and log excerpt included, in this order: in the sections report attaches itself (version, doctor, host-check, the record, the re-run’s stdout and stderr) only, every record’s and lease’s agent, workspace and contact value to <agent>, <workspace>, <contact>; the registry file to <registry>, its directory to <registry-dir>, every record’s checkout (stored, $HOME-joined and resolved) to <checkout>, the user-level default registry, when another one, to <user-default-registry>/<user-default-registry-dir>, the other local paths doctor and the version line name, whole (stored and resolved): lean-pkg’s package directory to <lean-pkg-install>, an editable install’s checkout to <lean-pkg-checkout>, the Python executable to <python>, the git work tree holding the registry to <registry-repo>, the index directory to <index-dir>, an event log that is not the registry’s sibling to <events-path>; the home directory to ~; then the public-safety scanner (its built-in families, the --package checkout’s and the registry directory’s .lean-pkg-private-patterns, the names derived from every record’s local_path, agent, workspace and lease; email addresses always), each match […]. Each redacted section is scanned again, line by line: the user’s own text (title, --command, --body, --from-log, --package, --expected, --workaround) and every attached section, not the report’s own fixed prose (a derived name can be an ordinary word such as home). A private name in the user’s own text is redacted ([…]), not refused; the guard refuses only what redaction left. A blocking hit left refuses, exit 1, nothing filed, the hit families listed (--json families[]) and the sections named, in text (“in your text (–body)”, “in an attached section (doctor)”) and in --json sections[] {section, origin user or attached, families}. Default is a dry run: print the title, labels, repository, redaction count and body, exit 0. --yes refuses, exit 1 with the gh auth login hint, when gh is not on PATH or gh auth status fails. --json: ok, filed, url (null unless filed), title, labels[], body, redactions (replacements made), schema (lean-pkg-report/1, the marker’s format), and log_excerpt {path (redacted), lines (included)} with --from-log. Usage errors (none of --command/--body/--from-log, an empty or unsplittable --command, an empty --body, --expected or --workaround, a --blocking other than yes or no, a missing --from-log file or an N that is not a positive integer, --repo not OWNER/NAME, an empty --title, --dry-run with --yes) exit 2 [--command ARGS] [--body TEXT] [--from-log FILE[:N]] [--package NAME] [--expected TEXT] [--workaround TEXT] [--blocking yes\|no] [--title T] [--enhancement] [--repo OWNER/NAME] [--dry-run\|--yes]

Exit codes

0 success (dry runs and no-ops included), 1 refused or failed, 2 usage error; see Exit codes.

Exit 1 is also a negative answer here:

Examples

Assemble a redacted bug report (version, doctor and host-check lines, the command re-run with its output, the package’s record) and print it; a dry run by default that files nothing.

lean-pkg report --command "status my-proof" --package my-proof

Sample output:

title: report: lean-pkg status my-proof
labels: bug
repository: lean-pkg/lean-pkg
redactions: 15
---
...

File it on lean-pkg/lean-pkg with gh issue create and print the issue URL; refused with exit 1 when gh is missing or not logged in (a blocking private-pattern hit left after redaction refuses in either mode).

lean-pkg report --from-log logs/build.log:100 --body "lake build hangs at Mathlib.Order" --yes

A triageable report for an intake channel; the body starts with the <!-- lean-pkg-report/1 --> marker, then a Blocking line before Version, the expected result under What you expected and a Workaround section after it, all three redacted like –body.

lean-pkg report --title "claim refused" --body "claim refused on a free package" --expected "the lease granted" --workaround "claimed from another checkout" --blocking yes

Sample output:

title: claim refused
labels: bug
repository: lean-pkg/lean-pkg
redactions: 12
---
<!-- lean-pkg-report/1 -->
<!-- filed with `lean-pkg report`: captured text is redacted (paths, home directory, private patterns, registry-derived names) -->

**Blocking**: yes

**Version**: lean-pkg ...
...