Aller au contenu
login
arrow_backRetour aux issues
fu351/Doberman-Core #438

cli: add `--json` to `doberman memory`

ecoDébutant enhancement good first issue level-3

descriptionDescription

`doberman memory` (`src/doberman/cli/main.py:1476`) prints a human summary built from `memory_summary(path)`, which is already a plain dict with `decisions`, `verdicts`, `top_path_classes`, `secrets_seen`. Every sibling view in the Daily/Policy panels has a `--json`: `scan` (`:254`), `status` (`:789`), `doctor` (`:808`), `policy-history`, `tune`. `memory` is the one left out, so scripts have to scrape its text. **What to do** 1. Add `as_json: bool = typer.Option(False, "--json", help="Emit the learned-memory summary as one JSON document.")` to `memory()`, copied from `status`'s option. 2. Before the human output: `if as_json: typer.echo(json.dumps(summary, sort_keys=True, separators=(",", ":"))); return`. Same call shape as the other five, so it lands inside the shared JSON-output contract in docs/CLI.md automatically. Add the command to that doc's machine-readable list. 3. New `tests/unit/test_cli_memory_json.py`, shaped like `tests/unit/test_cli_scan_json.py`: seed with `doberman demo --fast`, run `memory --json`, `json.loads` it, assert the four keys are present and the text is compact. `memory_summary` already returns counts and classes only, so the JSON path exposes nothing the text path doesn't.
codeOuvre sur GitHub