rom-manager 1.0.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 (50) hide show
  1. rom_manager-1.0.0/LICENSE +21 -0
  2. rom_manager-1.0.0/MANIFEST.in +4 -0
  3. rom_manager-1.0.0/PKG-INFO +372 -0
  4. rom_manager-1.0.0/README.md +334 -0
  5. rom_manager-1.0.0/pyproject.toml +65 -0
  6. rom_manager-1.0.0/requirements.txt +1 -0
  7. rom_manager-1.0.0/rom_manager/__init__.py +29 -0
  8. rom_manager-1.0.0/rom_manager/__main__.py +4 -0
  9. rom_manager-1.0.0/rom_manager/adapters/__init__.py +22 -0
  10. rom_manager-1.0.0/rom_manager/adapters/api_client.py +147 -0
  11. rom_manager-1.0.0/rom_manager/agent_data/IDENTITY.md +21 -0
  12. rom_manager-1.0.0/rom_manager/agent_server.py +96 -0
  13. rom_manager-1.0.0/rom_manager/api_client.py +22 -0
  14. rom_manager-1.0.0/rom_manager/archives.py +24 -0
  15. rom_manager-1.0.0/rom_manager/auth.py +47 -0
  16. rom_manager-1.0.0/rom_manager/conversion.py +15 -0
  17. rom_manager-1.0.0/rom_manager/core/__init__.py +12 -0
  18. rom_manager-1.0.0/rom_manager/core/archives.py +112 -0
  19. rom_manager-1.0.0/rom_manager/core/conversion.py +143 -0
  20. rom_manager-1.0.0/rom_manager/core/naming.py +59 -0
  21. rom_manager-1.0.0/rom_manager/game_codes.py +3390 -0
  22. rom_manager-1.0.0/rom_manager/main_agent.json +13 -0
  23. rom_manager-1.0.0/rom_manager/mcp/__init__.py +13 -0
  24. rom_manager-1.0.0/rom_manager/mcp/mcp_conversion.py +57 -0
  25. rom_manager-1.0.0/rom_manager/mcp/mcp_game_codes.py +53 -0
  26. rom_manager-1.0.0/rom_manager/mcp_config.json +3 -0
  27. rom_manager-1.0.0/rom_manager/mcp_server.py +124 -0
  28. rom_manager-1.0.0/rom_manager/models/__init__.py +24 -0
  29. rom_manager-1.0.0/rom_manager/models/schemas.py +78 -0
  30. rom_manager-1.0.0/rom_manager/naming.py +14 -0
  31. rom_manager-1.0.0/rom_manager/prompts/__init__.py +19 -0
  32. rom_manager-1.0.0/rom_manager/prompts/convert_rom.md +22 -0
  33. rom_manager-1.0.0/rom_manager/rom_manager.py +468 -0
  34. rom_manager-1.0.0/rom_manager/version.py +5 -0
  35. rom_manager-1.0.0/rom_manager.egg-info/PKG-INFO +372 -0
  36. rom_manager-1.0.0/rom_manager.egg-info/SOURCES.txt +48 -0
  37. rom_manager-1.0.0/rom_manager.egg-info/dependency_links.txt +1 -0
  38. rom_manager-1.0.0/rom_manager.egg-info/entry_points.txt +4 -0
  39. rom_manager-1.0.0/rom_manager.egg-info/requires.txt +29 -0
  40. rom_manager-1.0.0/rom_manager.egg-info/top_level.txt +1 -0
  41. rom_manager-1.0.0/setup.cfg +4 -0
  42. rom_manager-1.0.0/tests/test_archives.py +103 -0
  43. rom_manager-1.0.0/tests/test_bridge_concepts.py +65 -0
  44. rom_manager-1.0.0/tests/test_concept_parity.py +90 -0
  45. rom_manager-1.0.0/tests/test_conversion.py +88 -0
  46. rom_manager-1.0.0/tests/test_game_codes.py +44 -0
  47. rom_manager-1.0.0/tests/test_init_dynamics.py +54 -0
  48. rom_manager-1.0.0/tests/test_mcp_registration.py +52 -0
  49. rom_manager-1.0.0/tests/test_naming.py +80 -0
  50. rom_manager-1.0.0/tests/test_startup.py +12 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Audel Rouhi
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,4 @@
1
+ include README.md
2
+ include requirements.txt
3
+ recursive-include rom_manager *.py *.json
4
+ recursive-include rom_manager/agent_data *
@@ -0,0 +1,372 @@
1
+ Metadata-Version: 2.4
2
+ Name: rom-manager
3
+ Version: 1.0.0
4
+ Summary: ROM Converter/Organizer (CHD/RVZ) + MCP Server + A2A Agent
5
+ Author-email: Audel Rouhi <knucklessg1@gmail.com>
6
+ License: MIT
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: License :: Public Domain
9
+ Classifier: Environment :: Console
10
+ Classifier: Operating System :: POSIX :: Linux
11
+ Classifier: Programming Language :: Python :: 3
12
+ Requires-Python: <3.15,>=3.11
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: agent-utilities>=0.47.0
16
+ Requires-Dist: python-dotenv>=1.0.0
17
+ Requires-Dist: tqdm>=4.66.0
18
+ Provides-Extra: mcp
19
+ Requires-Dist: agent-utilities[mcp]>=0.47.0; extra == "mcp"
20
+ Provides-Extra: agent
21
+ Requires-Dist: agent-utilities[agent,logfire]>=0.47.0; extra == "agent"
22
+ Requires-Dist: logfire>=2.0.0; extra == "agent"
23
+ Provides-Extra: native
24
+ Requires-Dist: patool>=2.1.1; extra == "native"
25
+ Provides-Extra: convert
26
+ Requires-Dist: patool>=2.1.1; extra == "convert"
27
+ Provides-Extra: otel
28
+ Requires-Dist: opentelemetry-sdk>=1.27.0; extra == "otel"
29
+ Requires-Dist: opentelemetry-exporter-otlp>=1.27.0; extra == "otel"
30
+ Provides-Extra: all
31
+ Requires-Dist: rom-manager[agent,mcp,native,otel]>=1.0.0; extra == "all"
32
+ Provides-Extra: test
33
+ Requires-Dist: pytest-xdist>=3.6.0; extra == "test"
34
+ Requires-Dist: pytest; extra == "test"
35
+ Requires-Dist: pytest-asyncio; extra == "test"
36
+ Requires-Dist: pytest-cov; extra == "test"
37
+ Dynamic: license-file
38
+
39
+ # ROM Manager
40
+ ## CLI or API | MCP | Agent
41
+
42
+ ![PyPI - Version](https://img.shields.io/pypi/v/rom-manager)
43
+ ![MCP Server](https://badge.mcpx.dev?type=server 'MCP Server')
44
+ ![PyPI - Downloads](https://img.shields.io/pypi/dd/rom-manager)
45
+ ![GitHub Repo stars](https://img.shields.io/github/stars/Knuckles-Team/rom-manager)
46
+ ![GitHub forks](https://img.shields.io/github/forks/Knuckles-Team/rom-manager)
47
+ ![GitHub contributors](https://img.shields.io/github/contributors/Knuckles-Team/rom-manager)
48
+ ![PyPI - License](https://img.shields.io/pypi/l/rom-manager)
49
+ ![GitHub](https://img.shields.io/github/license/Knuckles-Team/rom-manager)
50
+ ![GitHub last commit (by committer)](https://img.shields.io/github/last-commit/Knuckles-Team/rom-manager)
51
+ ![GitHub pull requests](https://img.shields.io/github/issues-pr/Knuckles-Team/rom-manager)
52
+ ![GitHub issues](https://img.shields.io/github/issues/Knuckles-Team/rom-manager)
53
+ ![GitHub top language](https://img.shields.io/github/languages/top/Knuckles-Team/rom-manager)
54
+ ![GitHub repo size](https://img.shields.io/github/repo-size/Knuckles-Team/rom-manager)
55
+ ![PyPI - Wheel](https://img.shields.io/pypi/wheel/rom-manager)
56
+ ![PyPI - Implementation](https://img.shields.io/pypi/implementation/rom-manager)
57
+
58
+ *Version: 1.0.0*
59
+
60
+ > **Documentation** — Installation, deployment, and usage across the API, CLI, and
61
+ > MCP interfaces, plus the integrated A2A agent server, are maintained in the
62
+ > [official documentation](https://knuckles-team.github.io/rom-manager/).
63
+
64
+ > ⚠️ **Back up your ROMs before working with this tool.** Conversion and the
65
+ > `--delete` / `clean_origin_files` options are destructive to source files.
66
+
67
+ ---
68
+
69
+ ## Table of Contents
70
+
71
+ - [Overview](#overview)
72
+ - [Key Features](#key-features)
73
+ - [Architecture](#architecture)
74
+ - [Usage (CLI or API)](#usage-cli-or-api)
75
+ - [MCP](#mcp)
76
+ - [Agent](#agent)
77
+ - [Environment Variables](#environment-variables)
78
+ - [Security & Governance](#security--governance)
79
+ - [External Binary Dependencies](#external-binary-dependencies)
80
+ - [Installation](#installation)
81
+ - [Deployment (agent_server.py)](#deployment-agent_serverpy)
82
+ - [Documentation](#documentation)
83
+ - [Contributing](#contributing)
84
+ - [License](#license)
85
+
86
+ ---
87
+
88
+ ## Overview
89
+
90
+ **ROM Manager** is a production-grade ROM converter/organizer with an integrated
91
+ Model Context Protocol (MCP) server and Agent-to-Agent (A2A) agent. It extracts
92
+ archives, auto-renames ROMs via a known game-code registry, converts ISO/WBFS
93
+ images to **CHD** (`chdman`) or **RVZ** (`dolphin-tool`), generates missing `.cue`
94
+ sheets, and cleans up source files — in parallel.
95
+
96
+ Unlike network connectors, ROM Manager is a **local tool**: there is no service
97
+ URL and no credentials.
98
+
99
+ ---
100
+
101
+ ## Key Features
102
+
103
+ - **Real conversion pipeline:** parallel extract → rename → convert (CHD/RVZ) → cleanup.
104
+ - **Consolidated Action-Routed MCP Tools:** two togglable domains (`conversion`,
105
+ `game-codes`) minimize token overhead and IDE tool bloat.
106
+ - **Integrated Graph Agent:** built-in Pydantic-AI agent (AG-UI / ACP).
107
+ - **Native Telemetry & Tracing:** OpenTelemetry exports out of the box.
108
+ - **Lazy native deps:** archive backends are optional extras, imported only when used.
109
+
110
+ ---
111
+
112
+ ## Architecture
113
+
114
+ ROM Manager keeps a single, well-factored pipeline behind three entry surfaces
115
+ (CLI, MCP server, A2A agent). The orchestrator (`RomManager`) composes focused
116
+ responsibility layers and shells out to external conversion binaries:
117
+
118
+ ```mermaid
119
+ flowchart LR
120
+ subgraph Entry["Entry Surfaces"]
121
+ CLI["CLI<br/>rom-manager"]
122
+ MCP["MCP Server<br/>rom-manager-mcp<br/>(CONCEPT:ROM-001/002)"]
123
+ AGENT["A2A Agent<br/>rom-manager-agent"]
124
+ end
125
+
126
+ CLI --> RM
127
+ MCP --> API["api_client.Api<br/>(facade)"]
128
+ AGENT --> MCP
129
+ API --> RM
130
+
131
+ subgraph Pipeline["RomManager orchestrator"]
132
+ RM["RomManager"] --> ARCH["archives.py<br/>extract + cue"]
133
+ RM --> NAME["naming.py<br/>game-code rename"]
134
+ RM --> CONV["conversion.py<br/>command + runner seam"]
135
+ end
136
+
137
+ ARCH --> P7Z["7z / patool"]
138
+ CONV --> CHDMAN["chdman (CHD)"]
139
+ CONV --> DOLPHIN["dolphin-tool (RVZ)"]
140
+ NAME --> CODES["game_codes.py<br/>(PSX registry, DATA)"]
141
+ ```
142
+
143
+ | Layer | Module | Responsibility |
144
+ |-------|--------|----------------|
145
+ | Orchestrator | `rom_manager/rom_manager.py` | Pipeline composition + CLI (`RomManager`, `rom_manager()`). |
146
+ | Archives | `rom_manager/archives.py` | Archive detection, extraction, `.cue` generation. |
147
+ | Conversion | `rom_manager/conversion.py` | `chdman`/`dolphin-tool` command building + runner seam. |
148
+ | Naming | `rom_manager/naming.py` | Game-code lookup + in-place rename. |
149
+ | Data | `rom_manager/game_codes.py` | Verbatim PSX serial→title registry (DATA). |
150
+ | Facade | `rom_manager/api_client.py` | `Api` wrapper consumed by MCP tools/agent. |
151
+
152
+ ---
153
+
154
+ ## Usage (CLI or API)
155
+
156
+ This package wraps a local ROM conversion pipeline (`rom_manager.rom_manager.RomManager`).
157
+ Use it via the CLI or the `rom_manager.api_client.Api` facade.
158
+
159
+ ```bash
160
+ rom-manager --directory "/games/PSX/" --iso chd --verbose
161
+ ```
162
+
163
+ | Flag | Long | Description |
164
+ |------|------|-------------|
165
+ | `-c` | `--cpu-count` | Limit max CPUs for parallel processing |
166
+ | `-d` | `--directory` | Directory to process ROMs |
167
+ | `-i` | `--iso` | Conversion target: `rvz` or `chd` |
168
+ | `-f` | `--force` | Force overwrite of existing `.chd` files |
169
+ | `-v` | `--verbose` | Display all output messages |
170
+ | `-x` | `--delete` | Delete original files after processing |
171
+
172
+ Detailed API usage is in [docs/usage.md](docs/usage.md).
173
+
174
+ ---
175
+
176
+ ## MCP
177
+
178
+ This server utilizes dynamic Action-Routed tools to optimize token overhead and
179
+ maximize IDE compatibility.
180
+
181
+ ### Available MCP Tools
182
+ | Tool Module | Toggle Env Var | Enabled by Default | Description & Actions |
183
+ |-------------|----------------|--------------------|------------------------|
184
+ | **Conversion** | `CONVERSIONTOOL` | `True` | Manage ROM conversion operations (CONCEPT:ROM-001). Actions: `convert`, `process_directory`, `process_file`, `generate_cue`, `list_files`. |
185
+ | **Game Codes** | `GAMECODESTOOL` | `True` | Manage game code lookup and naming (CONCEPT:ROM-002). Actions: `lookup`, `list`, `rename`. |
186
+
187
+ ### Dynamic Tool Selection
188
+
189
+ Each domain is gated by an environment toggle (default `True`). Set a toggle to
190
+ `False` to omit that tool from the registered surface.
191
+
192
+ ### Running the MCP server
193
+
194
+ ```bash
195
+ # stdio (default)
196
+ rom-manager-mcp
197
+
198
+ # Streamable HTTP
199
+ rom-manager-mcp --transport streamable-http --host 0.0.0.0 --port 8000
200
+ ```
201
+
202
+ #### stdio client config
203
+
204
+ ```json
205
+ {
206
+ "mcpServers": {
207
+ "rom-manager": {
208
+ "command": "uv",
209
+ "args": ["run", "rom-manager-mcp"],
210
+ "env": { "ROM_DIRECTORY": "/games", "CONVERSIONTOOL": "True", "GAMECODESTOOL": "True" }
211
+ }
212
+ }
213
+ }
214
+ ```
215
+
216
+ #### Docker
217
+
218
+ ```bash
219
+ docker run --rm -it -v /games:/games -e ROM_DIRECTORY=/games \
220
+ -p 8000:8000 -e TRANSPORT=streamable-http knucklessg1/rom-manager:latest
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Agent
226
+
227
+ ROM Manager ships a Pydantic-AI agent (`rom-manager-agent`) that calls the MCP
228
+ tool surface and exposes an AG-UI web interface. Its identity lives in
229
+ `rom_manager/agent_data/IDENTITY.md`.
230
+
231
+ ```bash
232
+ rom-manager-agent --web
233
+ ```
234
+
235
+ ---
236
+
237
+ ## Environment Variables
238
+
239
+ All settings are optional — ROM Manager runs with sensible defaults and requires
240
+ no credentials. Copy [`.env.example`](.env.example) to `.env` to override.
241
+
242
+ ### Application Variables
243
+
244
+ | Variable | Default | Description |
245
+ |----------|---------|-------------|
246
+ | `ROM_DIRECTORY` | `.` (cwd) | Default directory of ROMs to process when none is supplied. |
247
+ | `ROM_ISO_TYPE` | `chd` | Conversion target: `chd` (chdman) or `rvz` (dolphin-tool). |
248
+ | `ROM_VERBOSE` | `False` | Emit verbose conversion output. |
249
+ | `ROM_FORCE` | `False` | Force overwrite of existing converted files. |
250
+ | `CONVERSIONTOOL` | `True` | Toggle registration of the **conversion** MCP tool domain (`CONCEPT:ROM-001`). |
251
+ | `GAMECODESTOOL` | `True` | Toggle registration of the **game-codes** MCP tool domain (`CONCEPT:ROM-002`). |
252
+
253
+ > CPU count and "delete originals" are exposed as CLI flags (`--cpu-count` /
254
+ > `--delete`) and MCP action params (`cpu_count` / `clean_origin_files`) rather
255
+ > than environment variables.
256
+
257
+ ### MCP / Framework Variables (agent-utilities)
258
+
259
+ | Variable | Default | Description |
260
+ |----------|---------|-------------|
261
+ | `HOST` | `0.0.0.0` | Bind host for HTTP/SSE transports. |
262
+ | `PORT` | `8000` | Bind port for HTTP/SSE transports. |
263
+ | `TRANSPORT` | `stdio` | MCP transport: `stdio`, `streamable-http`, or `sse`. |
264
+ | `AUTH_TYPE` | `none` | MCP authentication mode (this local tool needs none). |
265
+ | `FASTMCP_LOG_LEVEL` | `ERROR` | FastMCP internal log verbosity (pinned at startup). |
266
+ | `ENABLE_OTEL` | `True` | Enable OpenTelemetry export of traces/metrics. |
267
+ | `EUNOMIA_TYPE` | `none` | Eunomia authorization mode: `none`, `embedded`, or `remote`. |
268
+ | `EUNOMIA_POLICY_FILE` | `mcp_policies.json` | Path to the Eunomia policy file when embedded. |
269
+
270
+ ### Terminal Variables
271
+
272
+ These are set automatically by the server to keep stdio transport clean; you do
273
+ not normally set them yourself.
274
+
275
+ | Variable | Default | Description |
276
+ |----------|---------|-------------|
277
+ | `NO_COLOR` | `1` | Disable ANSI colour codes in child tooling output. |
278
+ | `TERM` | `dumb` | Force a dumb terminal so progress output does not corrupt the stdio channel. |
279
+
280
+ ---
281
+
282
+ ## Security & Governance
283
+
284
+ - **No credentials:** ROM Manager is a local tool with no service URL/token.
285
+ - **Eunomia policies & OpenTelemetry:** inherited from the `agent-utilities`
286
+ middleware (see `.env.example`).
287
+ - **Destructive-op safety:** the agent recommends backing up ROMs before
288
+ `clean_origin_files`/delete operations.
289
+
290
+ ---
291
+
292
+ ## External Binary Dependencies
293
+
294
+ Conversion *actions* shell out to native tools (the Python package installs fine
295
+ without them):
296
+
297
+ - **`chdman`** (CHD) — `apt install mame-tools` (Ubuntu) or MAME tools on Windows.
298
+ - **`dolphin-tool`** (RVZ) — see the Dolphin emulator docs.
299
+ - **`7z` / archive backends** (extraction) — `apt install p7zip-full`; pair with
300
+ the `rom-manager[native]` extra (`patool`).
301
+
302
+ ---
303
+
304
+ ## Installation
305
+
306
+ ```bash
307
+ pip install rom-manager # core CLI + Api
308
+ pip install "rom-manager[mcp]" # + MCP server
309
+ pip install "rom-manager[agent]" # + A2A agent
310
+ pip install "rom-manager[native]" # + patool (archive extraction)
311
+ pip install "rom-manager[all]" # everything
312
+ ```
313
+
314
+ ---
315
+
316
+ ## Deployment (agent_server.py)
317
+
318
+ `rom-manager-agent` (entry point `rom_manager.agent_server:agent_server`) starts a
319
+ Pydantic-AI A2A agent that auto-discovers the MCP tool surface from
320
+ `mcp_config.json` and can expose an AG-UI web interface.
321
+
322
+ ```bash
323
+ # Local: web UI on the default host/port, OTEL enabled
324
+ rom-manager-agent --web --otel \
325
+ --provider openai --model-id gpt-4o-mini \
326
+ --host 0.0.0.0 --port 8080
327
+ ```
328
+
329
+ Container deployment (compose):
330
+
331
+ ```yaml
332
+ # docker/agent.compose.yml (excerpt)
333
+ services:
334
+ rom-manager-agent:
335
+ image: knucklessg1/rom-manager:latest
336
+ command: ["rom-manager-agent", "--web"]
337
+ environment:
338
+ ROM_DIRECTORY: /games
339
+ TRANSPORT: streamable-http
340
+ HOST: 0.0.0.0
341
+ PORT: 8080
342
+ ENABLE_OTEL: "True"
343
+ AUTH_TYPE: none
344
+ volumes:
345
+ - /srv/roms:/games
346
+ ports:
347
+ - "8080:8080"
348
+ ```
349
+
350
+ The MCP server (`rom-manager-mcp`) deploys the same way; see
351
+ [docs/deployment.md](docs/deployment.md) for the full compose/Swarm recipes.
352
+
353
+ ---
354
+
355
+ ## Documentation
356
+
357
+ - [Installation](docs/installation.md)
358
+ - [Deployment](docs/deployment.md)
359
+ - [Usage (API / CLI / MCP)](docs/usage.md)
360
+ - [Overview](docs/overview.md)
361
+ - [Concepts (`CONCEPT:ROM-*`)](docs/concepts.md)
362
+
363
+ ---
364
+
365
+ ## Contributing
366
+
367
+ Contributions are welcome. Run `pre-commit run --all-files` before opening a PR.
368
+ Preserve the real conversion pipeline — wrap `RomManager`, do not break it.
369
+
370
+ ## License
371
+
372
+ MIT © Knuckles-Team