AGENTS.md
internal/commands/AGENTS.mdAGENTS.md
Quality
66/100
Scores the file, not the repository.Length
416 words
4 headings · 0 code blocksRepository
40k
— · pushed 0 days agoLast changed
2 days ago
First indexed 2 days ago.1# Command-Line Guidelines23**Last Updated:** June 16, 202645## CLI Conventions67- Prefer shared helpers such as `DryRunFlag(...)` and `YesFlag()` when adding command flags.8- Build CLI role help from the registered role map (never hand-maintained literals) so each edition lists exactly the roles it accepts: `commands.UserRoleUsageFor(<map>)` / `RoleStrings.CliUsageString()`, passing CE `acl.UserRoles` or an edition's own static `auth.UserRoles` (Portal's includes `cluster_admin`; editions reference their own map, not the runtime-reassigned `acl.UserRoles`, to dodge the init-order problem). For federatable or cluster-instance contexts (LDAP `--ldap-role`, OIDC group→role, cluster grants) use `acl.ClusterInstanceRolesCliUsageString()`, which lists the instance-login roles and excludes `cluster_admin`/`visitor`.9- Prefer `--json` for automation. `photoprism show commands --json [--nested]` exposes the command tree; add `--all` for hidden entries.10- Use `internal/commands/catalog` to inspect commands and flags without running the binary; when validating large JSON docs, marshal DTOs with `catalog.BuildFlat` or `catalog.BuildNode`.11- Expect `show` commands to return arrays of snake_case rows, except `photoprism show config`, which returns `{ sections: [...] }`, and `config-options` or `config-yaml`, which flatten to a top-level array.1213## CLI Tests1415- `urfave/cli` calls `os.Exit(code)` when a command returns `cli.Exit(...)`. Wrap command tests with `RunWithTestContext(cmd, args)` so `cli.OsExiter` is overridden and `go test` keeps running.16- If you only need the exit code, call `cmd.Action(ctx)` directly and assert `err.(cli.ExitCoder).ExitCode()`.17- Set `PHOTOPRISM_CLI=noninteractive` and or pass `--yes` to avoid prompts in tests and CI.18- Some commands defer `conf.Shutdown()` or emit signals that close the DB. Avoid invoking `start` or sending process signals in unit tests.19- `internal/commands/start.go` waits on `process.Signal`; avoid `process.Shutdown()` and `process.Restart()` in unit tests.2021## Download CLI Workbench2223Code anchors:24- CLI flags and examples: `internal/commands/download.go`25- Core implementation: `internal/commands/download_impl.go`26- yt-dlp helpers: `internal/photoprism/dl/*`27- Importer entry point: `internal/photoprism/get/import.go`2829Focused runs:30- `go test ./internal/commands -run 'DownloadImpl|HelpFlags' -count=1`31- `go test ./internal/photoprism/dl -run 'Options|Created|PostprocessorArgs' -count=1`3233FFmpeg-less tests:34- Set `c.Options().FFmpegBin = "/bin/false"` and `c.Settings().Index.Convert = false` when the test is not validating remux behavior.3536Stubbing yt-dlp without network:37- Use a small shell script that prints minimal JSON for `--dump-single-json` and creates a file when `--print` is requested.38- Supported harness env vars: `YTDLP_ARGS_LOG`, `YTDLP_OUTPUT_FILE`, and `YTDLP_DUMMY_CONTENT`.3940Remux and defaults:41- Pipe mode always remuxes through PhotoPrism ffmpeg and embeds title, description, and created time.42- File mode relies on yt-dlp output and passes `--postprocessor-args 'ffmpeg:-metadata creation_time=<RFC3339>'` so imports still get `Created`.43- Default remux policy is `auto`; use `always` when you need the most complete metadata.44- `photoprism dl` defaults to `--method pipe` and `--impersonate firefox`; pass `-i none` to disable impersonation.4546
Also in photoprism/photoprism
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| photoprism/photoprisminternal/config/AGENTS.md · 40k | AGENTS.md | databasedo-not | 46/100 | 2 days ago | |
| photoprism/photoprisminternal/entity/migrate/AGENTS.md · 40k | AGENTS.md | testtesting-strategydatabase | 63/100 | 2 days ago | |
| photoprism/photoprisminternal/photoprism/AGENTS.md · 40k | AGENTS.md | no sections | 39/100 | 2 days ago | |
| photoprism/photoprisminternal/service/cluster/AGENTS.md · 40k | AGENTS.md | buildtestapi | 76/100 | 2 days ago | |
| photoprism/photoprismpkg/AGENTS.md · 40k | AGENTS.md | teststylesecurity | 55/100 | 2 days ago | |
| photoprism/photoprism.claude/CLAUDE.md · 40k | CLAUDE.md | buildtestlint-formatstyle+7 | 96/100 | 2 days ago | |
| photoprism/photoprism.github/copilot-instructions.md · 40k | Copilot instructions | buildtestlint-formatstyle+5 | 90/100 | 2 days ago | |
| photoprism/photoprism.github/instructions/backend.instructions.md · 40k | Copilot instructions | testlint-formatstyletypes+4 | 83/100 | 2 days ago | |
| photoprism/photoprism.github/instructions/frontend.instructions.md · 40k | Copilot instructions | testlint-formatstyleagent-behaviour | 76/100 | 2 days ago | |
| photoprism/photoprismAGENTS.md · 40k | AGENTS.md | setupbuildtestlint-format+8 | 82/100 | 2 days ago | |
| photoprism/photoprismfrontend/AGENTS.md · 40k | AGENTS.md | setupteststyletesting-strategy+1 | 76/100 | 2 days ago | |
| photoprism/photoprisminternal/AGENTS.md · 40k | AGENTS.md | teststyletesting-strategy | 71/100 | 2 days ago | |
| photoprism/photoprisminternal/api/AGENTS.md · 40k | AGENTS.md | teststyletesting-strategyapi | 62/100 | 2 days ago |
Diff against internal/config/AGENTS.md Diff against internal/entity/migrate/AGENTS.md Diff against internal/photoprism/AGENTS.md Diff against internal/service/cluster/AGENTS.md Diff against pkg/AGENTS.md Diff against .claude/CLAUDE.md Diff against .github/copilot-instructions.md Diff against .github/instructions/backend.instructions.md Diff against .github/instructions/frontend.instructions.md Diff against AGENTS.md Diff against frontend/AGENTS.md Diff against internal/AGENTS.md Diff against internal/api/AGENTS.md
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| code-yeongyu/oh-my-openagentpackages/web/AGENTS.md · 67k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 2 days ago | |
| TryGhost/Ghoste2e/AGENTS.md · 55k | AGENTS.md | setupteststylearch+2 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| trick77/agents-md-syncAGENTS.md · 2 | AGENTS.md | setupbuildteststyle+5 | 100/100 | 3 days ago | |
| ethereum/go-ethereumAGENTS.md · 51k | AGENTS.md | buildtestlint-formatgit+1 | 100/100 | 3 days ago |
