agent-discogs 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. agent_discogs-0.1.0/LICENSE.txt +201 -0
  2. agent_discogs-0.1.0/PKG-INFO +210 -0
  3. agent_discogs-0.1.0/README.md +185 -0
  4. agent_discogs-0.1.0/pyproject.toml +148 -0
  5. agent_discogs-0.1.0/pyproject.toml.orig +131 -0
  6. agent_discogs-0.1.0/src/agent_discogs/__init__.py +151 -0
  7. agent_discogs-0.1.0/src/agent_discogs/__main__.py +5 -0
  8. agent_discogs-0.1.0/src/agent_discogs/client.py +30 -0
  9. agent_discogs-0.1.0/src/agent_discogs/commands/__init__.py +0 -0
  10. agent_discogs-0.1.0/src/agent_discogs/commands/cache.py +16 -0
  11. agent_discogs-0.1.0/src/agent_discogs/commands/get.py +794 -0
  12. agent_discogs-0.1.0/src/agent_discogs/commands/search.py +275 -0
  13. agent_discogs-0.1.0/src/agent_discogs/commands/skills.py +92 -0
  14. agent_discogs-0.1.0/src/agent_discogs/commands/status.py +22 -0
  15. agent_discogs-0.1.0/src/agent_discogs/errors.py +149 -0
  16. agent_discogs-0.1.0/src/agent_discogs/formatting.py +741 -0
  17. agent_discogs-0.1.0/src/agent_discogs/json_output.py +66 -0
  18. agent_discogs-0.1.0/src/agent_discogs/pagination.py +190 -0
  19. agent_discogs-0.1.0/src/agent_discogs/projections.py +300 -0
  20. agent_discogs-0.1.0/src/agent_discogs/py.typed +0 -0
  21. agent_discogs-0.1.0/src/agent_discogs/refs.py +59 -0
  22. agent_discogs-0.1.0/src/agent_discogs/skills/core/SKILL.md +140 -0
  23. agent_discogs-0.1.0/src/agent_discogs/skills/core/references/commands.md +174 -0
  24. agent_discogs-0.1.0/src/agent_discogs/skills/core/references/discogs-domain.md +278 -0
  25. agent_discogs-0.1.0/src/agent_discogs/skills/core/references/pressings-guide.md +77 -0
  26. agent_discogs-0.1.0/src/agent_discogs/skills/core/references/search-patterns.md +72 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Jean-Marc Fontaine
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,210 @@
1
+ Metadata-Version: 2.4
2
+ Name: agent-discogs
3
+ Version: 0.1.0
4
+ Summary: Token-efficient Discogs CLI for AI agents
5
+ Keywords: ai-agent,cli,discogs,discogs-api,music-database
6
+ Author: Jean-Marc Fontaine
7
+ Author-email: Jean-Marc Fontaine <jm@jmfontaine.net>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE.txt
10
+ Classifier: Programming Language :: Python :: 3 :: Only
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Programming Language :: Python :: 3.14
16
+ Classifier: Programming Language :: Python :: 3.15
17
+ Requires-Dist: click>=8.3.1
18
+ Requires-Dist: discogs-sdk>=0.4.0
19
+ Requires-Dist: pydantic>=2.12.5
20
+ Requires-Python: >=3.10
21
+ Project-URL: Homepage, https://github.com/jmfontaine/agent-discogs
22
+ Project-URL: Issues, https://github.com/jmfontaine/agent-discogs/issues
23
+ Project-URL: Repository, https://github.com/jmfontaine/agent-discogs
24
+ Description-Content-Type: text/markdown
25
+
26
+ # agent-discogs
27
+
28
+ A token-efficient Discogs CLI for AI agents that minimizes API calls.
29
+
30
+ ```bash
31
+ agent-discogs search "Nine Inch Nails"
32
+ agent-discogs get release @r352665 # ref from search output
33
+ agent-discogs tracks @r352665 # tracklist shortcut
34
+ agent-discogs price @r352665 # price guide shortcut
35
+ ```
36
+
37
+ ## Installation
38
+
39
+ ```bash
40
+ pipx install agent-discogs
41
+ ```
42
+
43
+ Or with [uv](https://docs.astral.sh/uv/):
44
+
45
+ ```bash
46
+ uv tool install agent-discogs
47
+ ```
48
+
49
+ Or with pip:
50
+
51
+ ```bash
52
+ pip install agent-discogs
53
+ ```
54
+
55
+ Requires Python 3.10+.
56
+
57
+ ### AI Coding Agent Skill
58
+
59
+ Install the skill so your AI coding agent can use agent-discogs automatically:
60
+
61
+ ```bash
62
+ npx skills add jmfontaine/agent-discogs
63
+ ```
64
+
65
+ The installed skill is a thin pointer; the usage guide itself ships inside the package and is served by `agent-discogs skills get core`, so agents always read instructions that match the version they run (see [skills](#skills)).
66
+
67
+ ## Authentication
68
+
69
+ Set your personal access token from [your Discogs developer settings](https://www.discogs.com/settings/developers):
70
+
71
+ ```bash
72
+ export DISCOGS_TOKEN="your-token-here"
73
+ ```
74
+
75
+ A token is required for search and price lookups. Without it, only direct entity lookups work (25 requests/minute). With a token, every command except `price` is available at 60 requests/minute.
76
+
77
+ `price` needs one thing more than a token: Discogs only returns price suggestions to accounts that have filled out their [seller settings](https://www.discogs.com/settings/seller). Until you do, the endpoint answers 404 and `price` tells you so; every other command is unaffected.
78
+
79
+ > [!TIP]
80
+ > Use a `.env` file with [direnv](https://direnv.net/) to avoid exporting tokens manually in every shell.
81
+
82
+ ## Commands
83
+
84
+ ### search
85
+
86
+ Search the Discogs database. Aliases: `find`, `query`.
87
+
88
+ ```bash
89
+ agent-discogs search "The Downward Spiral"
90
+ agent-discogs search release "The Downward Spiral" --year 1994
91
+ agent-discogs search artist "Nine Inch Nails" --limit 10
92
+ agent-discogs search label "Nothing Records"
93
+ agent-discogs search release "The Downward Spiral" --release-type all
94
+ agent-discogs search release "When The Whip Comes Down" --release-type unofficial
95
+ ```
96
+
97
+ Prefix a type (`release`, `master`, `artist`, `label`) to narrow results. Use `--limit` (default: 5) for page size. To continue, paste the `Next page:` command printed under the results: the default `--release-type official` filter is applied client-side, so continuation is a cursor (`--after`), not a page number. `--page` works only with `--release-type all` (server-side pages) or artist/label searches.
98
+
99
+ Filters: `--artist`, `--barcode`, `--catno`, `--country`, `--format`, `--genre`, `--label`, `--release-type {official,unofficial,all}` (default: official), `--style`, `--year`. Use `--json` for JSON output (see [JSON output](#json-output)).
100
+
101
+ ### get
102
+
103
+ Get entity details by noun and ref. Aliases: `fetch`, `show`.
104
+
105
+ ```bash
106
+ agent-discogs get release @r352665
107
+ agent-discogs get artist @a3857
108
+ agent-discogs get master @m3719
109
+ agent-discogs get label @l647
110
+ agent-discogs get tracklist @r352665
111
+ agent-discogs get releases @a3857 --limit 20
112
+ agent-discogs get versions @m3719 --country US --format Vinyl
113
+ agent-discogs get price @r352665
114
+ ```
115
+
116
+ Nouns: `artist`, `credits`, `identifiers` (alias `ids`), `label`, `master`, `price`, `release`, `releases`, `tracklist`, `versions`.
117
+
118
+ `release` output carries inline refs for its artists and label (`[@a...]`, `[@l...]`), plus country and release date. `credits` lists who did what on a release, grouped by role, each person with an artist ref. `identifiers` lists barcodes, matrix/runout etchings, and other codes: the data that tells two pressings with the same catalog number apart. `-v, --verbose` on `release` appends notes, credits, and identifiers in one call; `-c, --compact` replaces the tracklist with a one-line `Tracks: 14 (65:01)` summary; the total is omitted when any track lacks a duration (use `tracks` when the tracklist is what you want).
119
+
120
+ Paginated nouns (`releases`, `versions`) support `--limit` (default: 5) and `--page`; `releases --role` filters client-side and continues via the printed `--after` cursor instead. `releases` takes an artist ref (discography, with `--role` and `--sort year|title|format`) or a label ref (catalogue; the API offers no filters or sorting there, so `--year` on a label is a client-side scan that continues via the printed `--after` cursor). `versions` accepts `--country`, `--format`, `--label`, `--year`, and `--sort released|title|format|label|catno|country`; add `--desc` to any `--sort`. Every navigable name in `artist` and `label` output carries a ref: members and former members, parent label, sub-labels. Use `--json` for JSON output.
121
+
122
+ ### tracks / price
123
+
124
+ Shortcuts for `get tracklist` and `get price`. Both support `--json`.
125
+
126
+ `get`, `tracks`, and `price` accept up to 10 refs and run them in sequence, so comparing pressings is one command: `agent-discogs get release @r352665 @r847868 -c`. Text blocks are separated by a blank line; a ref that fails reports inline and the rest still run (exit code 1 if any failed). With `--json` and several refs the output is a list, with `{"ref": ..., "error": {...}}` items for failures.
127
+
128
+ ```bash
129
+ agent-discogs tracks @r352665
130
+ agent-discogs price @r352665
131
+ ```
132
+
133
+ ### status
134
+
135
+ Show version, authentication mode, and cache location:
136
+
137
+ ```bash
138
+ agent-discogs status
139
+ ```
140
+
141
+ ### cache
142
+
143
+ Manage the HTTP response cache:
144
+
145
+ ```bash
146
+ agent-discogs cache clear
147
+ ```
148
+
149
+ ### skills
150
+
151
+ Print the bundled agent guide. The content ships in the package, so it always matches the installed version:
152
+
153
+ ```bash
154
+ agent-discogs skills # list bundled skills with the installed version
155
+ agent-discogs skills get core # workflows, output format, common patterns, troubleshooting
156
+ agent-discogs skills get core --full # plus references: command reference, search patterns, pressings guide, Discogs data model
157
+ agent-discogs skills path [core] # directory holding the bundled skill files
158
+ ```
159
+
160
+ ## JSON output
161
+
162
+ `search`, `get`, `tracks`, and `price` accept `--json`. The output is a compact projection of what the text view shows — refs, names, catalog numbers, counts — not the raw Discogs record, so a release is ~2 KB instead of ~30–50 KB of image URLs and bookkeeping. Empty fields are omitted, so test for a key rather than for null (the `pagination` envelope is the exception: its keys are always present, and `next_cursor` is `null` when nothing remains). `credits` is grouped by role: `{"Producer":[{"ref":"@a20661","name":"Flood","tracks":"1, 2"}],...}`. Lists are wrapped as `{"pagination":{...},"results":[...]}`.
163
+
164
+ ```bash
165
+ agent-discogs get release @r352665 --json # projection
166
+ agent-discogs get release @r352665 --json -v # plus notes, credits, and identifiers
167
+ agent-discogs get release @r352665 --json --full # raw SDK model, when you need a field the projection drops
168
+ ```
169
+
170
+ Errors under `--json` are a JSON document on stdout with exit code 1:
171
+
172
+ ```json
173
+ {"error":{"code":"not_found","message":"Master @m... not found.","hint":"Try: agent-discogs search \"<title>\"","status":404}}
174
+ ```
175
+
176
+ Codes: `not_found`, `seller_settings_required`, `auth_required`, `forbidden`, `rate_limited` (with `retry_after` seconds when provided), `api_error`, `connection_error`, `invalid_argument`, `unexpected`.
177
+
178
+ ## Ref system
179
+
180
+ Output includes typed refs that encode the entity type and Discogs ID. Copy them into subsequent commands.
181
+
182
+ | Prefix | Type | Example |
183
+ |---|---|---|
184
+ | `@r` | Release | `@r352665` |
185
+ | `@a` | Artist | `@a3857` |
186
+ | `@m` | Master | `@m3719` |
187
+ | `@l` | Label | `@l647` |
188
+
189
+ Raw numeric IDs also work: `agent-discogs get release 352665`.
190
+
191
+ Smart resolution: `get versions @r352665` auto-resolves the release to its master.
192
+
193
+ ## Caching
194
+
195
+ HTTP responses are cached automatically with a 1-hour TTL. The cache is stored at `~/.cache/agent-discogs/` (or `$XDG_CACHE_HOME/agent-discogs/`). Clear it with `agent-discogs cache clear`.
196
+
197
+ ## Error handling
198
+
199
+ The CLI maps API errors to recovery-oriented messages with suggested next steps:
200
+
201
+ ```
202
+ ✗ Release 999999999 not found. Try: agent-discogs search "<title>"
203
+ ✗ Authentication failed. Check your DISCOGS_TOKEN.
204
+ ✗ Rate limit exceeded. Wait a moment and retry.
205
+ ✗ Connection error. Check your network and retry.
206
+ ```
207
+
208
+ ## License
209
+
210
+ agent-discogs is licensed under the [Apache License 2.0](LICENSE.txt).
@@ -0,0 +1,185 @@
1
+ # agent-discogs
2
+
3
+ A token-efficient Discogs CLI for AI agents that minimizes API calls.
4
+
5
+ ```bash
6
+ agent-discogs search "Nine Inch Nails"
7
+ agent-discogs get release @r352665 # ref from search output
8
+ agent-discogs tracks @r352665 # tracklist shortcut
9
+ agent-discogs price @r352665 # price guide shortcut
10
+ ```
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ pipx install agent-discogs
16
+ ```
17
+
18
+ Or with [uv](https://docs.astral.sh/uv/):
19
+
20
+ ```bash
21
+ uv tool install agent-discogs
22
+ ```
23
+
24
+ Or with pip:
25
+
26
+ ```bash
27
+ pip install agent-discogs
28
+ ```
29
+
30
+ Requires Python 3.10+.
31
+
32
+ ### AI Coding Agent Skill
33
+
34
+ Install the skill so your AI coding agent can use agent-discogs automatically:
35
+
36
+ ```bash
37
+ npx skills add jmfontaine/agent-discogs
38
+ ```
39
+
40
+ The installed skill is a thin pointer; the usage guide itself ships inside the package and is served by `agent-discogs skills get core`, so agents always read instructions that match the version they run (see [skills](#skills)).
41
+
42
+ ## Authentication
43
+
44
+ Set your personal access token from [your Discogs developer settings](https://www.discogs.com/settings/developers):
45
+
46
+ ```bash
47
+ export DISCOGS_TOKEN="your-token-here"
48
+ ```
49
+
50
+ A token is required for search and price lookups. Without it, only direct entity lookups work (25 requests/minute). With a token, every command except `price` is available at 60 requests/minute.
51
+
52
+ `price` needs one thing more than a token: Discogs only returns price suggestions to accounts that have filled out their [seller settings](https://www.discogs.com/settings/seller). Until you do, the endpoint answers 404 and `price` tells you so; every other command is unaffected.
53
+
54
+ > [!TIP]
55
+ > Use a `.env` file with [direnv](https://direnv.net/) to avoid exporting tokens manually in every shell.
56
+
57
+ ## Commands
58
+
59
+ ### search
60
+
61
+ Search the Discogs database. Aliases: `find`, `query`.
62
+
63
+ ```bash
64
+ agent-discogs search "The Downward Spiral"
65
+ agent-discogs search release "The Downward Spiral" --year 1994
66
+ agent-discogs search artist "Nine Inch Nails" --limit 10
67
+ agent-discogs search label "Nothing Records"
68
+ agent-discogs search release "The Downward Spiral" --release-type all
69
+ agent-discogs search release "When The Whip Comes Down" --release-type unofficial
70
+ ```
71
+
72
+ Prefix a type (`release`, `master`, `artist`, `label`) to narrow results. Use `--limit` (default: 5) for page size. To continue, paste the `Next page:` command printed under the results: the default `--release-type official` filter is applied client-side, so continuation is a cursor (`--after`), not a page number. `--page` works only with `--release-type all` (server-side pages) or artist/label searches.
73
+
74
+ Filters: `--artist`, `--barcode`, `--catno`, `--country`, `--format`, `--genre`, `--label`, `--release-type {official,unofficial,all}` (default: official), `--style`, `--year`. Use `--json` for JSON output (see [JSON output](#json-output)).
75
+
76
+ ### get
77
+
78
+ Get entity details by noun and ref. Aliases: `fetch`, `show`.
79
+
80
+ ```bash
81
+ agent-discogs get release @r352665
82
+ agent-discogs get artist @a3857
83
+ agent-discogs get master @m3719
84
+ agent-discogs get label @l647
85
+ agent-discogs get tracklist @r352665
86
+ agent-discogs get releases @a3857 --limit 20
87
+ agent-discogs get versions @m3719 --country US --format Vinyl
88
+ agent-discogs get price @r352665
89
+ ```
90
+
91
+ Nouns: `artist`, `credits`, `identifiers` (alias `ids`), `label`, `master`, `price`, `release`, `releases`, `tracklist`, `versions`.
92
+
93
+ `release` output carries inline refs for its artists and label (`[@a...]`, `[@l...]`), plus country and release date. `credits` lists who did what on a release, grouped by role, each person with an artist ref. `identifiers` lists barcodes, matrix/runout etchings, and other codes: the data that tells two pressings with the same catalog number apart. `-v, --verbose` on `release` appends notes, credits, and identifiers in one call; `-c, --compact` replaces the tracklist with a one-line `Tracks: 14 (65:01)` summary; the total is omitted when any track lacks a duration (use `tracks` when the tracklist is what you want).
94
+
95
+ Paginated nouns (`releases`, `versions`) support `--limit` (default: 5) and `--page`; `releases --role` filters client-side and continues via the printed `--after` cursor instead. `releases` takes an artist ref (discography, with `--role` and `--sort year|title|format`) or a label ref (catalogue; the API offers no filters or sorting there, so `--year` on a label is a client-side scan that continues via the printed `--after` cursor). `versions` accepts `--country`, `--format`, `--label`, `--year`, and `--sort released|title|format|label|catno|country`; add `--desc` to any `--sort`. Every navigable name in `artist` and `label` output carries a ref: members and former members, parent label, sub-labels. Use `--json` for JSON output.
96
+
97
+ ### tracks / price
98
+
99
+ Shortcuts for `get tracklist` and `get price`. Both support `--json`.
100
+
101
+ `get`, `tracks`, and `price` accept up to 10 refs and run them in sequence, so comparing pressings is one command: `agent-discogs get release @r352665 @r847868 -c`. Text blocks are separated by a blank line; a ref that fails reports inline and the rest still run (exit code 1 if any failed). With `--json` and several refs the output is a list, with `{"ref": ..., "error": {...}}` items for failures.
102
+
103
+ ```bash
104
+ agent-discogs tracks @r352665
105
+ agent-discogs price @r352665
106
+ ```
107
+
108
+ ### status
109
+
110
+ Show version, authentication mode, and cache location:
111
+
112
+ ```bash
113
+ agent-discogs status
114
+ ```
115
+
116
+ ### cache
117
+
118
+ Manage the HTTP response cache:
119
+
120
+ ```bash
121
+ agent-discogs cache clear
122
+ ```
123
+
124
+ ### skills
125
+
126
+ Print the bundled agent guide. The content ships in the package, so it always matches the installed version:
127
+
128
+ ```bash
129
+ agent-discogs skills # list bundled skills with the installed version
130
+ agent-discogs skills get core # workflows, output format, common patterns, troubleshooting
131
+ agent-discogs skills get core --full # plus references: command reference, search patterns, pressings guide, Discogs data model
132
+ agent-discogs skills path [core] # directory holding the bundled skill files
133
+ ```
134
+
135
+ ## JSON output
136
+
137
+ `search`, `get`, `tracks`, and `price` accept `--json`. The output is a compact projection of what the text view shows — refs, names, catalog numbers, counts — not the raw Discogs record, so a release is ~2 KB instead of ~30–50 KB of image URLs and bookkeeping. Empty fields are omitted, so test for a key rather than for null (the `pagination` envelope is the exception: its keys are always present, and `next_cursor` is `null` when nothing remains). `credits` is grouped by role: `{"Producer":[{"ref":"@a20661","name":"Flood","tracks":"1, 2"}],...}`. Lists are wrapped as `{"pagination":{...},"results":[...]}`.
138
+
139
+ ```bash
140
+ agent-discogs get release @r352665 --json # projection
141
+ agent-discogs get release @r352665 --json -v # plus notes, credits, and identifiers
142
+ agent-discogs get release @r352665 --json --full # raw SDK model, when you need a field the projection drops
143
+ ```
144
+
145
+ Errors under `--json` are a JSON document on stdout with exit code 1:
146
+
147
+ ```json
148
+ {"error":{"code":"not_found","message":"Master @m... not found.","hint":"Try: agent-discogs search \"<title>\"","status":404}}
149
+ ```
150
+
151
+ Codes: `not_found`, `seller_settings_required`, `auth_required`, `forbidden`, `rate_limited` (with `retry_after` seconds when provided), `api_error`, `connection_error`, `invalid_argument`, `unexpected`.
152
+
153
+ ## Ref system
154
+
155
+ Output includes typed refs that encode the entity type and Discogs ID. Copy them into subsequent commands.
156
+
157
+ | Prefix | Type | Example |
158
+ |---|---|---|
159
+ | `@r` | Release | `@r352665` |
160
+ | `@a` | Artist | `@a3857` |
161
+ | `@m` | Master | `@m3719` |
162
+ | `@l` | Label | `@l647` |
163
+
164
+ Raw numeric IDs also work: `agent-discogs get release 352665`.
165
+
166
+ Smart resolution: `get versions @r352665` auto-resolves the release to its master.
167
+
168
+ ## Caching
169
+
170
+ HTTP responses are cached automatically with a 1-hour TTL. The cache is stored at `~/.cache/agent-discogs/` (or `$XDG_CACHE_HOME/agent-discogs/`). Clear it with `agent-discogs cache clear`.
171
+
172
+ ## Error handling
173
+
174
+ The CLI maps API errors to recovery-oriented messages with suggested next steps:
175
+
176
+ ```
177
+ ✗ Release 999999999 not found. Try: agent-discogs search "<title>"
178
+ ✗ Authentication failed. Check your DISCOGS_TOKEN.
179
+ ✗ Rate limit exceeded. Wait a moment and retry.
180
+ ✗ Connection error. Check your network and retry.
181
+ ```
182
+
183
+ ## License
184
+
185
+ agent-discogs is licensed under the [Apache License 2.0](LICENSE.txt).