Skip to content

Commit c312c0d

Browse files
committed
Docs: Update CODEMAP.md and AGENTS.md photoprism#5220
Signed-off-by: Michael Mayer <[email protected]>
1 parent 6e33575 commit c312c0d

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

AGENTS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ If anything in this file conflicts with the `Makefile` or the Developer Guide, t
192192

193193
- Capture output with `RunWithTestContext`; usage and report values may be quoted and re‑ordered (e.g., set semantics). Use substring checks or regex for the final ", or <last>" rule from `CliUsageString`.
194194
- Prefer JSON output (`--json`) for stable machine assertions when commands offer it.
195+
- Cataloging CLI commands (new):
196+
- Use `internal/commands/catalog` to enumerate commands/flags without invoking the CLI or capturing stdout.
197+
- Default format for `photoprism show commands` is Markdown; pass `--json` for machine output and `--nested` to get a tree. Hidden commands/flags appear only with `--all`.
198+
- Nested `help` subcommands are omitted; the top‑level `photoprism help` remains included.
199+
- When asserting large JSON documents, build DTOs via `catalog.BuildFlat/BuildNode` and marshal directly to avoid pipe back‑pressure in tests.
195200
- JSON shapes for `show` commands:
196201
- Most return a top‑level array of row objects (keys = snake_case columns).
197202
- `photoprism show config` returns `{ sections: [{ title, items[] }] }`.

CODEMAP.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Executables & Entry Points
1919
- CLI app (binary name across docs/images is `photoprism`):
2020
- Main: `cmd/photoprism/photoprism.go`
2121
- Commands registry: `internal/commands/commands.go` (array `commands.PhotoPrism`)
22+
- Catalog helpers: `internal/commands/catalog` (DTOs and builders to enumerate commands/flags; Markdown renderer)
2223
- Web server:
2324
- Startup: `internal/commands/start.go``server.Start` (starts HTTP(S), workers, session cleanup)
2425
- HTTP server: `internal/server/start.go` (compression, security, healthz, readiness, TLS/AutoTLS/unix socket)
@@ -27,6 +28,7 @@ Executables & Entry Points
2728

2829
High-Level Package Map (Go)
2930
- `internal/api` — Gin handlers and Swagger annotations; only glue, no business logic
31+
- `internal/commands/catalog` — DTOs (App, Command, Flag, Node), builders (BuildFlat/BuildNode, CommandInfo, FlagsToCatalog), and a templated Markdown renderer (RenderMarkdown) for the CLI commands catalog. Depends only on `urfave/cli/v2` and stdlib.
3032
- `internal/server` — HTTP server, middleware, routing, static/ui/webdav
3133
- `internal/config` — configuration, flags/env/options, client config, DB init/migrate
3234
- `internal/entity` — GORM v1 models, queries, search helpers, migrations
@@ -53,6 +55,7 @@ Configuration & Flags
5355
- Available flags/env: `internal/config/cli_flags_report.go` + `internal/config/report_sections.go` → surfaced by `photoprism show config-options --md/--json`
5456
- YAML options mapping: `internal/config/options_report.go` + `internal/config/report_sections.go` → surfaced by `photoprism show config-yaml --md/--json`
5557
- Report current values: `internal/config/report.go` → surfaced by `photoprism show config` (alias `photoprism config --md`).
58+
- CLI commands catalog: `internal/commands/show_commands.go` → surfaced by `photoprism show commands` (Markdown by default; `--json` alternative; `--nested` optional tree; `--all` includes hidden commands/flags; nested `help` subcommands omitted).
5659
- Precedence: `defaults.yml` < CLI/env < `options.yml` (global options rule). See Agent Tips in `AGENTS.md`.
5760
- Getters are grouped by topic, e.g. DB in `internal/config/config_db.go`, server in `config_server.go`, TLS in `config_tls.go`, etc.
5861
- Client Config (read-only)

0 commit comments

Comments
 (0)