@edgemodders/edgedeck-mcp 0.0.0-stage → 0.28.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Edgemodders
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.
package/README.md CHANGED
@@ -1,3 +1,51 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @edgemodders/edgedeck-mcp
2
+
3
+ EDGEdeck's MCP server and command line, for managing Cyberpunk 2077 mods from an AI assistant or a script. It is the same library and deployer as the [EDGEdeck](https://marketplace.visualstudio.com/items?itemName=edgemodders.edgedeck) extension for VS Code, and the two can run side by side: they share the library folder, and the extension reloads when the tools change it.
4
+
5
+ Windows only, like the game's mod tools. Needs Node.js 20 or newer.
6
+
7
+ ## The MCP server
8
+
9
+ ```
10
+ npx -y @edgemodders/edgedeck-mcp [--library <folder>] [--game <folder>]
11
+ ```
12
+
13
+ It talks MCP over stdio. The library defaults to `%USERPROFILE%\EDGEdeck`; the game is found through Steam, GOG or Epic. For Claude Code:
14
+
15
+ ```
16
+ claude mcp add edgedeck -- npx -y @edgemodders/edgedeck-mcp
17
+ ```
18
+
19
+ Tools:
20
+
21
+ | Tool | Does |
22
+ |---|---|
23
+ | `edgedeck_list` | Every mod: on or off, version, kinds, status, size; the frameworks line after a game patch |
24
+ | `edgedeck_mod` | One mod in detail: files, versions, Nexus info |
25
+ | `edgedeck_add` | Add a zip, 7z, rar, single mod file or folder to the library |
26
+ | `edgedeck_install_project` | Add or refresh a REDcode or WolvenKit project's packed output; `sameName` (`follow` or `version`) settles a mod of the same name from another folder |
27
+ | `edgedeck_turn` | Turn a mod on or off |
28
+ | `edgedeck_move` | Move a mod up or down; higher wins a conflict |
29
+ | `edgedeck_rename` | A new name for a mod in EDGEdeck, for all its versions; empty puts the first name back |
30
+ | `edgedeck_remove` | Remove a mod from the library |
31
+ | `edgedeck_pending` | What the next deploy would add, replace, put back or remove, and why |
32
+ | `edgedeck_deploy` | Put the active loadout in the game (refuses while the game runs); `mod` deploys that mod's changes only |
33
+ | `edgedeck_undo` | Take everything EDGEdeck deployed out again, putting backups back |
34
+ | `edgedeck_changes` | Deployed files changed or missing in the game folder since |
35
+ | `edgedeck_conflicts` | Files two enabled mods both have, and who wins |
36
+ | `edgedeck_loadout` | Save, switch to (load) or list loadouts |
37
+ | `edgedeck_vortex` | List and import the mods Vortex has for the game (Vortex is not changed) |
38
+
39
+ Nothing touches the game folder until `edgedeck_deploy` or `edgedeck_undo`; the server tells the assistant to ask the player first. These two and `edgedeck_remove` also carry `_meta: { "anthropic/requiresUserInteraction": true }`, so Claude Code asks you before every call, in every permission mode, auto mode included.
40
+
41
+ ## The command line
42
+
43
+ ```
44
+ npx -p @edgemodders/edgedeck-mcp edgedeck list
45
+ ```
46
+
47
+ or, installed with `npm i -g @edgemodders/edgedeck-mcp`, just `edgedeck list`. Commands: `list`, `mod`, `add`, `install-project`, `on`, `off`, `up`, `down`, `rename`, `remove`, `pending`, `deploy`, `undo`, `changes`, `conflicts`, `loadout save|load|list`, `vortex list|import`, `mcp`. Options `--library`, `--game`, and `--json` for machine output.
48
+
49
+ ## More
50
+
51
+ Guide and design: https://edgemodders.github.io/EDGEdeck/. Source and issues: https://github.com/Edgemodders/EDGEdeck. MIT licensed; it ships 7-Zip's `7za.exe` (GNU LGPL), see ThirdPartyNotices.txt. Not affiliated with CD PROJEKT.
@@ -0,0 +1,237 @@
1
+ EDGEdeck includes third-party software. Their notices follow.
2
+
3
+ ------------------------------------------------------------------------------
4
+
5
+ 7-Zip 21.07 (bin/7za.exe, from the 7zip-bin npm package)
6
+ Copyright (C) 1999-2021 Igor Pavlov.
7
+ 7za.exe is free software. Most of its code is under the GNU Lesser General Public License,
8
+ version 2.1 or later; some parts are under the BSD 3-clause license.
9
+ License text: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
10
+ Source code and full license terms: https://www.7-zip.org/
11
+
12
+ ------------------------------------------------------------------------------
13
+
14
+ @modelcontextprotocol/sdk 1.32.1
15
+
16
+ MIT License
17
+
18
+ Copyright (c) 2024 Anthropic, PBC
19
+
20
+ Permission is hereby granted, free of charge, to any person obtaining a copy
21
+ of this software and associated documentation files (the "Software"), to deal
22
+ in the Software without restriction, including without limitation the rights
23
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
24
+ copies of the Software, and to permit persons to whom the Software is
25
+ furnished to do so, subject to the following conditions:
26
+
27
+ The above copyright notice and this permission notice shall be included in all
28
+ copies or substantial portions of the Software.
29
+
30
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
31
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
32
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
33
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
34
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
35
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
36
+ SOFTWARE.
37
+
38
+ ------------------------------------------------------------------------------
39
+
40
+ ajv 8.20.0
41
+
42
+ The MIT License (MIT)
43
+
44
+ Copyright (c) 2015-2021 Evgeny Poberezkin
45
+
46
+ Permission is hereby granted, free of charge, to any person obtaining a copy
47
+ of this software and associated documentation files (the "Software"), to deal
48
+ in the Software without restriction, including without limitation the rights
49
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
50
+ copies of the Software, and to permit persons to whom the Software is
51
+ furnished to do so, subject to the following conditions:
52
+
53
+ The above copyright notice and this permission notice shall be included in all
54
+ copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
57
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
58
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
59
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
60
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
61
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
62
+ SOFTWARE.
63
+
64
+ ------------------------------------------------------------------------------
65
+
66
+ ajv-formats 3.0.1
67
+
68
+ MIT License
69
+
70
+ Copyright (c) 2020 Evgeny Poberezkin
71
+
72
+ Permission is hereby granted, free of charge, to any person obtaining a copy
73
+ of this software and associated documentation files (the "Software"), to deal
74
+ in the Software without restriction, including without limitation the rights
75
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
76
+ copies of the Software, and to permit persons to whom the Software is
77
+ furnished to do so, subject to the following conditions:
78
+
79
+ The above copyright notice and this permission notice shall be included in all
80
+ copies or substantial portions of the Software.
81
+
82
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
83
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
84
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
85
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
86
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
87
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
88
+ SOFTWARE.
89
+
90
+ ------------------------------------------------------------------------------
91
+
92
+ fast-deep-equal 3.1.3
93
+
94
+ MIT License
95
+
96
+ Copyright (c) 2017 Evgeny Poberezkin
97
+
98
+ Permission is hereby granted, free of charge, to any person obtaining a copy
99
+ of this software and associated documentation files (the "Software"), to deal
100
+ in the Software without restriction, including without limitation the rights
101
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
102
+ copies of the Software, and to permit persons to whom the Software is
103
+ furnished to do so, subject to the following conditions:
104
+
105
+ The above copyright notice and this permission notice shall be included in all
106
+ copies or substantial portions of the Software.
107
+
108
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
109
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
110
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
111
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
112
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
113
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
114
+ SOFTWARE.
115
+
116
+ ------------------------------------------------------------------------------
117
+
118
+ fast-uri 3.1.8
119
+
120
+ Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
121
+ Copyright (c) 2021-present The Fastify team <https://github.com/fastify/fastify#team>
122
+ All rights reserved.
123
+
124
+ Redistribution and use in source and binary forms, with or without
125
+ modification, are permitted provided that the following conditions are met:
126
+ * Redistributions of source code must retain the above copyright
127
+ notice, this list of conditions and the following disclaimer.
128
+ * Redistributions in binary form must reproduce the above copyright
129
+ notice, this list of conditions and the following disclaimer in the
130
+ documentation and/or other materials provided with the distribution.
131
+ * The names of any contributors may not be used to endorse or promote
132
+ products derived from this software without specific prior written
133
+ permission.
134
+
135
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
136
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
137
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
138
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY
139
+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
140
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
141
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
142
+ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
143
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
144
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
145
+
146
+ * * *
147
+
148
+ The complete list of contributors can be found at:
149
+ - https://github.com/garycourt/uri-js/graphs/contributors
150
+
151
+ ------------------------------------------------------------------------------
152
+
153
+ json-schema-traverse 1.0.0
154
+
155
+ MIT License
156
+
157
+ Copyright (c) 2017 Evgeny Poberezkin
158
+
159
+ Permission is hereby granted, free of charge, to any person obtaining a copy
160
+ of this software and associated documentation files (the "Software"), to deal
161
+ in the Software without restriction, including without limitation the rights
162
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
163
+ copies of the Software, and to permit persons to whom the Software is
164
+ furnished to do so, subject to the following conditions:
165
+
166
+ The above copyright notice and this permission notice shall be included in all
167
+ copies or substantial portions of the Software.
168
+
169
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
170
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
171
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
172
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
173
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
174
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
175
+ SOFTWARE.
176
+
177
+ ------------------------------------------------------------------------------
178
+
179
+ vscode-jsonrpc 9.0.3
180
+
181
+ Copyright (c) Microsoft Corporation
182
+
183
+ All rights reserved.
184
+
185
+ MIT License
186
+
187
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
188
+
189
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
190
+
191
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
192
+
193
+ ------------------------------------------------------------------------------
194
+
195
+ zod 4.6.7
196
+
197
+ MIT License
198
+
199
+ Copyright (c) 2025 Colin McDonnell
200
+
201
+ Permission is hereby granted, free of charge, to any person obtaining a copy
202
+ of this software and associated documentation files (the "Software"), to deal
203
+ in the Software without restriction, including without limitation the rights
204
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
205
+ copies of the Software, and to permit persons to whom the Software is
206
+ furnished to do so, subject to the following conditions:
207
+
208
+ The above copyright notice and this permission notice shall be included in all
209
+ copies or substantial portions of the Software.
210
+
211
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
212
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
213
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
214
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
215
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
216
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
217
+ SOFTWARE.
218
+
219
+ ------------------------------------------------------------------------------
220
+
221
+ zod-to-json-schema 3.25.2
222
+
223
+ ISC License
224
+
225
+ Copyright (c) 2020, Stefan Terdell
226
+
227
+ Permission to use, copy, modify, and/or distribute this software for any
228
+ purpose with or without fee is hereby granted, provided that the above
229
+ copyright notice and this permission notice appear in all copies.
230
+
231
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
232
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
233
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
234
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
235
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
236
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
237
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package/bin/7za.exe ADDED
Binary file
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ // EDGEdeck's MCP server on its own, for assistants and plugins: the same server as `edgedeck mcp` and
3
+ // the one the extension registers in VS Code, over stdio.
4
+ //
5
+ // edgedeck-mcp [--library <folder>] [--game <folder>]
6
+ //
7
+ // The library defaults to %USERPROFILE%\EDGEdeck and the game is found through Steam, GOG or Epic.
8
+ import { createRequire } from "node:module";
9
+ import * as path from "node:path";
10
+ import { fileURLToPath } from "node:url";
11
+
12
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
13
+ createRequire(import.meta.url)(path.join(root, "dist", "mcp.js"));
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ // The EDGEdeck command line: the same library and deployer as the extension, for scripts, CI and
3
+ // assistants. State is the library's JSON files, so every command prints JSON with --json.
4
+ //
5
+ // edgedeck list [--size] what is in the library, its size and status (--size: largest first)
6
+ // edgedeck mod <id> one mod in full: files, sizes, source, Nexus data, conflicts
7
+ // edgedeck add <file|folder> [--name N] [--option FOLDER]
8
+ // edgedeck install-project <.cpmodproj> [--follow | --keep-both]
9
+ // add a REDcode or WolvenKit project's packed output, or refresh it, and turn it on;
10
+ // beside a mod of the same name: --follow makes that mod follow this project,
11
+ // --keep-both adds the project as another version of it, on in its place
12
+ // edgedeck on <id> | off <id> turn a mod on or off
13
+ // edgedeck up <id> | down <id> change the order (first wins conflicts)
14
+ // edgedeck rename <id> [name...] a new name in EDGEdeck, for all its versions (no name: the first one back)
15
+ // edgedeck remove <id>
16
+ // edgedeck deploy [--keep PATH...] [--restore PATH...] [--mod ID] --mod: that mod's changes only
17
+ // edgedeck undo
18
+ // edgedeck changes files changed in the game folder since the deploy
19
+ // edgedeck pending what the next deploy adds, replaces, puts back or removes, and why
20
+ // edgedeck conflicts conflicts by file path (archive conflicts need the extension)
21
+ // edgedeck loadout save <name> | load <name or file> | list
22
+ // edgedeck vortex list | import
23
+ // edgedeck mcp serve the same verbs as MCP tools over stdio
24
+ //
25
+ // Options: --library <folder> (default %USERPROFILE%\EDGEdeck), --game <folder> (default: the
26
+ // library's remembered game, else the Steam folder), --json.
27
+
28
+ import { createRequire } from "node:module";
29
+ import * as fs from "node:fs";
30
+ import * as path from "node:path";
31
+ import { fileURLToPath } from "node:url";
32
+
33
+ const require = createRequire(import.meta.url);
34
+ // fileURLToPath decodes the URL: a folder with a space ("Cyberpunk 2077") arrives as %20 otherwise.
35
+ const root = path.join(path.dirname(fileURLToPath(import.meta.url)), "..");
36
+
37
+ const args = process.argv.slice(2);
38
+ const flags = {};
39
+ const positional = [];
40
+ for (let i = 0; i < args.length; i++) {
41
+ const a = args[i];
42
+ if (a.startsWith("--")) {
43
+ const key = a.slice(2);
44
+ const multi = key === "keep" || key === "restore";
45
+ const value = args[i + 1] !== undefined && !args[i + 1].startsWith("--") ? args[++i] : true;
46
+ if (multi) (flags[key] ??= []).push(value);
47
+ else flags[key] = value;
48
+ } else positional.push(a);
49
+ }
50
+ const [cmd, ...rest] = positional;
51
+
52
+ if (cmd === "mcp") {
53
+ // The bundled server reads --library and --game from process.argv itself.
54
+ require(path.join(root, "dist", "mcp.js"));
55
+ } else {
56
+ const core = require(path.join(root, "dist", "core.js"));
57
+ const json = !!flags.json;
58
+ const out = (v) => console.log(json ? JSON.stringify(v.data, null, 2) : v.text);
59
+ const fail = (msg) => {
60
+ console.error(json ? JSON.stringify({ error: msg }) : `error: ${msg}`);
61
+ process.exit(1);
62
+ };
63
+ const need = (value, what) => value ?? fail(`${cmd} needs ${what}`);
64
+ const usage = () => console.log(fs.readFileSync(new URL(import.meta.url), "utf8").split("\n").filter((l) => l.startsWith("//")).slice(1).map((l) => l.replace(/^\/\/ ?/, "")).join("\n"));
65
+
66
+ try {
67
+ const s = core.openSession({ library: flags.library, game: flags.game, extensionRoot: root });
68
+ const v = core.verbs;
69
+ switch (cmd) {
70
+ case "list": out(await v.list(s, !!flags.size)); break;
71
+ case "mod": out(v.mod(s, need(rest[0], "a mod id"))); break;
72
+ case "add": out(await v.add(s, need(rest[0], "a file or folder"), flags.name, flags.option)); break;
73
+ case "install-project": out(v.installProject(s, need(rest[0], "a .cpmodproj file"), flags.follow ? "follow" : flags["keep-both"] ? "version" : undefined)); break;
74
+ case "on":
75
+ case "off": out(v.turn(s, need(rest[0], "a mod id"), cmd === "on")); break;
76
+ case "up":
77
+ case "down": out(v.move(s, need(rest[0], "a mod id"), cmd)); break;
78
+ case "rename": out(v.rename(s, need(rest[0], "a mod id"), rest.slice(1).join(" "))); break;
79
+ case "remove": out(v.remove(s, need(rest[0], "a mod id"))); break;
80
+ case "deploy": out(await v.deploy(s, flags.keep ?? [], flags.restore ?? [], typeof flags.mod === "string" ? flags.mod : undefined)); break;
81
+ case "undo": out(v.undo(s)); break;
82
+ case "changes": out(v.changes(s)); break;
83
+ case "pending": out(v.pending(s)); break;
84
+ case "conflicts": out(v.conflicts(s)); break;
85
+ case "loadout": out(v.loadout(s, rest[0] === "save" || rest[0] === "load" ? rest[0] : "list", rest[1])); break;
86
+ case "vortex": out(v.vortex(s, rest[0] === "import" ? "import" : "list")); break;
87
+ default:
88
+ usage();
89
+ if (cmd) process.exit(1);
90
+ }
91
+ } catch (err) {
92
+ fail(err instanceof Error ? err.message : String(err));
93
+ }
94
+ }