unity-mcp-cli 0.66.0 → 0.66.1

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 (49) hide show
  1. package/CHANGELOG.md +60 -0
  2. package/README.md +30 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +11 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/commands/bootstrap-local.d.ts +17 -0
  7. package/dist/commands/bootstrap-local.js +83 -0
  8. package/dist/commands/bootstrap-local.js.map +1 -0
  9. package/dist/commands/configure.js +37 -45
  10. package/dist/commands/configure.js.map +1 -1
  11. package/dist/commands/install-plugin.js +41 -23
  12. package/dist/commands/install-plugin.js.map +1 -1
  13. package/dist/commands/remove-plugin.js +21 -9
  14. package/dist/commands/remove-plugin.js.map +1 -1
  15. package/dist/commands/setup-mcp.js +32 -81
  16. package/dist/commands/setup-mcp.js.map +1 -1
  17. package/dist/index.js +2 -0
  18. package/dist/index.js.map +1 -1
  19. package/dist/lib/configure.d.ts +10 -0
  20. package/dist/lib/configure.js +85 -0
  21. package/dist/lib/configure.js.map +1 -0
  22. package/dist/lib/install-plugin.d.ts +8 -0
  23. package/dist/lib/install-plugin.js +68 -0
  24. package/dist/lib/install-plugin.js.map +1 -0
  25. package/dist/lib/logger.d.ts +7 -0
  26. package/dist/lib/logger.js +18 -0
  27. package/dist/lib/logger.js.map +1 -0
  28. package/dist/lib/progress.d.ts +7 -0
  29. package/dist/lib/progress.js +16 -0
  30. package/dist/lib/progress.js.map +1 -0
  31. package/dist/lib/remove-plugin.d.ts +7 -0
  32. package/dist/lib/remove-plugin.js +51 -0
  33. package/dist/lib/remove-plugin.js.map +1 -0
  34. package/dist/lib/setup-mcp.d.ts +12 -0
  35. package/dist/lib/setup-mcp.js +141 -0
  36. package/dist/lib/setup-mcp.js.map +1 -0
  37. package/dist/lib/types.d.ts +132 -0
  38. package/dist/lib/types.js +8 -0
  39. package/dist/lib/types.js.map +1 -0
  40. package/dist/lib/validation.d.ts +37 -0
  41. package/dist/lib/validation.js +50 -0
  42. package/dist/lib/validation.js.map +1 -0
  43. package/dist/lib.d.ts +5 -0
  44. package/dist/lib.js +18 -0
  45. package/dist/lib.js.map +1 -0
  46. package/dist/utils/manifest.d.ts +31 -3
  47. package/dist/utils/manifest.js +27 -11
  48. package/dist/utils/manifest.js.map +1 -1
  49. package/package.json +20 -2
package/CHANGELOG.md ADDED
@@ -0,0 +1,60 @@
1
+ # Changelog
2
+
3
+ All notable changes to `unity-mcp-cli` will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.67.0] - 2026-04-21
9
+
10
+ ### Added
11
+
12
+ - **Library API.** The package now exposes its core commands as a typed,
13
+ side-effect-free library alongside the existing CLI binary.
14
+ Consumers can do:
15
+
16
+ ```ts
17
+ import { installPlugin, removePlugin, configure, setupMcp } from 'unity-mcp-cli';
18
+ ```
19
+
20
+ Available functions:
21
+ - `installPlugin(opts)` — install the Unity-MCP plugin into a Unity project
22
+ - `removePlugin(opts)` — remove the Unity-MCP plugin from a Unity project
23
+ - `configure(opts)` — enable/disable MCP tools, prompts, resources
24
+ - `setupMcp(opts)` — write an agent MCP config file
25
+ - `listAgentIds()` — list every supported agent id
26
+
27
+ All functions return a typed `{ success, ... }` result (never throw past the
28
+ public boundary) and accept an optional `onProgress(event)` callback that
29
+ fires for `start`, `dependencies-resolved`, `manifest-patched`, and
30
+ `done` phases.
31
+
32
+ - **`package.json` `exports` field.** The package now ships with a
33
+ conditional-exports map:
34
+ - `"."` — the library entry (`dist/lib.js`)
35
+ - `"./cli"` — the CLI entry (`dist/cli.js`), identical behaviour to
36
+ the `unity-mcp-cli` binary
37
+
38
+ ### Changed
39
+
40
+ - Command handlers (`install-plugin`, `remove-plugin`, `configure`,
41
+ `setup-mcp`) are now thin Commander wrappers that delegate to the
42
+ library functions. Terminal output and exit codes are unchanged from
43
+ the user's perspective.
44
+
45
+ - `utils/manifest.ts` functions now accept an optional `logger` argument
46
+ so the library can run silently while the CLI preserves its chalk-
47
+ styled output. `addPluginToManifest` and `removePluginFromManifest`
48
+ also return structured result objects; return values are purely
49
+ additive and the existing call sites are unaffected.
50
+
51
+ ### Notes
52
+
53
+ - No breaking changes to the CLI binary. `unity-mcp-cli install-plugin
54
+ ./MyProject` and friends still work exactly as before.
55
+ - The library entry point has no top-level side effects: importing
56
+ `unity-mcp-cli` never writes to stdout/stderr and never parses argv.
57
+ An `import 'unity-mcp-cli'` or dynamic `import('unity-mcp-cli')`
58
+ call is safe to do anywhere.
59
+
60
+ [0.67.0]: https://github.com/IvanMurzak/Unity-MCP/releases/tag/cli-0.67.0
package/README.md CHANGED
@@ -557,3 +557,33 @@ Commands that manage editors or create projects use the **Unity Hub CLI** (`--he
557
557
  > For the full Unity-MCP project documentation, see the [main README](https://github.com/IvanMurzak/Unity-MCP/blob/main/README.md).
558
558
 
559
559
  ![AI Game Developer — Unity SKILLS and MCP](https://github.com/IvanMurzak/Unity-MCP/blob/main/docs/img/promo/hazzard-divider.svg?raw=true)
560
+
561
+ # Library API (v0.67.0+)
562
+
563
+ In addition to the CLI binary, `unity-mcp-cli` exposes its core commands as a typed, side-effect-free library so other Node.js / TypeScript tools can embed the same install / configure flow without shelling out.
564
+
565
+ ```ts
566
+ import { installPlugin, removePlugin, configure, setupMcp } from 'unity-mcp-cli';
567
+
568
+ const result = await installPlugin({
569
+ unityProjectPath: './MyUnityProject',
570
+ // version: '0.67.0', // optional — defaults to latest from OpenUPM
571
+ onProgress: (event) => {
572
+ // phase is one of: 'start' | 'dependencies-resolved' | 'manifest-patched' | 'done'
573
+ console.log(event.phase, event.message);
574
+ },
575
+ });
576
+
577
+ if (!result.success) {
578
+ console.error('Install failed:', result.error?.message);
579
+ return;
580
+ }
581
+
582
+ console.log(`Installed v${result.installedVersion}`);
583
+ for (const warning of result.warnings) console.warn(warning);
584
+ for (const step of result.nextSteps) console.log(step);
585
+ ```
586
+
587
+ Each function returns a typed `{ success, ... }` result object; errors are never thrown past the public boundary. The library entry has no top-level side effects — `import 'unity-mcp-cli'` never parses argv and never writes to stdout or stderr.
588
+
589
+ See [`CHANGELOG.md`](CHANGELOG.md#0670---2026-04-21) for the full list of exported functions and types.
package/dist/cli.d.ts ADDED
@@ -0,0 +1 @@
1
+ import './index.js';
package/dist/cli.js ADDED
@@ -0,0 +1,11 @@
1
+ // CLI entry for `unity-mcp-cli`, exported at the `./cli` subpath.
2
+ //
3
+ // Importing this file runs the Commander-based CLI exactly as the
4
+ // `unity-mcp-cli` binary does — it parses argv, dispatches subcommands,
5
+ // and exits the process.
6
+ //
7
+ // Consumers that want the programmatic, side-effect-free surface
8
+ // should import the package root (`import { installPlugin } from
9
+ // "unity-mcp-cli"`) — NOT this file.
10
+ import './index.js';
11
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,kEAAkE;AAClE,wEAAwE;AACxE,yBAAyB;AACzB,EAAE;AACF,iEAAiE;AACjE,iEAAiE;AACjE,qCAAqC;AAErC,OAAO,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+ import { type UnityConnectionConfig } from '../utils/config.js';
3
+ /**
4
+ * Produce a new config object with local-mode fields pinned to `url` / `token`.
5
+ * Preserves all other keys from `current` (immutable update — does not mutate `current`).
6
+ *
7
+ * The plugin-side ConnectionMode enum only accepts "Custom" (local) or "Cloud".
8
+ * We intentionally normalize any integer (0 → Custom, 1 → Cloud) representation
9
+ * to the canonical string "Custom" so the on-disk file is explicit.
10
+ */
11
+ export declare function pinLocalModeConfig(current: Readonly<UnityConnectionConfig>, url: string, token: string): UnityConnectionConfig;
12
+ /**
13
+ * Returns true iff `current` already reflects local mode with matching url + token.
14
+ * Used to make bootstrap-local a no-op when nothing would change on disk.
15
+ */
16
+ export declare function isAlreadyPinned(current: Readonly<UnityConnectionConfig>, url: string, token: string): boolean;
17
+ export declare const bootstrapLocalCommand: Command;
@@ -0,0 +1,83 @@
1
+ // Copyright (c) 2025 Ivan Murzak. All rights reserved.
2
+ // Licensed under the Apache License, Version 2.0.
3
+ import { Command } from 'commander';
4
+ import * as path from 'path';
5
+ import * as fs from 'fs';
6
+ import * as ui from '../utils/ui.js';
7
+ import { verbose } from '../utils/ui.js';
8
+ import { resolveAndValidateProjectPath } from '../utils/connection.js';
9
+ import { readConfig, writeConfig, } from '../utils/config.js';
10
+ /**
11
+ * Produce a new config object with local-mode fields pinned to `url` / `token`.
12
+ * Preserves all other keys from `current` (immutable update — does not mutate `current`).
13
+ *
14
+ * The plugin-side ConnectionMode enum only accepts "Custom" (local) or "Cloud".
15
+ * We intentionally normalize any integer (0 → Custom, 1 → Cloud) representation
16
+ * to the canonical string "Custom" so the on-disk file is explicit.
17
+ */
18
+ export function pinLocalModeConfig(current, url, token) {
19
+ return {
20
+ ...current,
21
+ connectionMode: 'Custom',
22
+ host: url,
23
+ token,
24
+ };
25
+ }
26
+ /**
27
+ * Returns true iff `current` already reflects local mode with matching url + token.
28
+ * Used to make bootstrap-local a no-op when nothing would change on disk.
29
+ */
30
+ export function isAlreadyPinned(current, url, token) {
31
+ // Accept both "Custom" (string) and 0 (legacy int) as already-local.
32
+ // Anything else (including "Cloud", 1, or unset) means we still need to pin.
33
+ const mode = current.connectionMode;
34
+ if (mode !== 'Custom' && mode !== 0)
35
+ return false;
36
+ return current.host === url && current.token === token;
37
+ }
38
+ export const bootstrapLocalCommand = new Command('bootstrap-local')
39
+ .description('Pin a Unity project\'s MCP config to local mode with the given URL/token. Idempotent.')
40
+ .argument('[path]', 'Unity project path (defaults to cwd)')
41
+ .option('--path <path>', 'Unity project path (defaults to cwd)')
42
+ .requiredOption('--url <url>', 'Local MCP server URL to pin (e.g. http://localhost:5140/)')
43
+ .requiredOption('--token <token>', 'Local MCP bearer token to pin')
44
+ .option('--dry-run', 'Report what would change without writing to disk')
45
+ .action(async (positionalPath, options) => {
46
+ const projectPath = resolveAndValidateProjectPath(positionalPath, options);
47
+ // commander's requiredOption guarantees url/token are defined before the action runs.
48
+ const url = options.url.replace(/\/$/, '');
49
+ const token = options.token;
50
+ verbose(`Project path: ${projectPath}`);
51
+ verbose(`Target URL: ${url}`);
52
+ verbose(`Target token: ${'*'.repeat(Math.min(token.length, 8))}... (length ${token.length})`);
53
+ const configPath = path.join(projectPath, 'UserSettings', 'AI-Game-Developer-Config.json');
54
+ const existedBefore = fs.existsSync(configPath);
55
+ // Use readConfig (not getOrCreateConfig) so --dry-run truly has no side effects.
56
+ // When the file doesn't exist we pin onto an empty base; this mirrors a fresh
57
+ // worktree where the plugin has not yet written its default Cloud config.
58
+ const current = readConfig(projectPath) ?? {};
59
+ if (isAlreadyPinned(current, url, token)) {
60
+ ui.success(`MCP config already pinned to local mode (${url}). No changes written.`);
61
+ return;
62
+ }
63
+ const next = pinLocalModeConfig(current, url, token);
64
+ if (options.dryRun) {
65
+ ui.heading('bootstrap-local (dry run)');
66
+ ui.label('Config file', configPath);
67
+ ui.label('connectionMode', `${String(current.connectionMode ?? 'unset')} → Custom`);
68
+ ui.label('host', `${String(current.host ?? 'unset')} → ${url}`);
69
+ ui.label('token', `${current.token ? '<previous>' : '<unset>'} → <supplied>`);
70
+ ui.info('No changes written (--dry-run).');
71
+ return;
72
+ }
73
+ writeConfig(projectPath, next);
74
+ ui.heading('bootstrap-local');
75
+ ui.label('Config file', configPath);
76
+ ui.label('connectionMode', 'Custom');
77
+ ui.label('host', url);
78
+ ui.label('token', '<supplied>');
79
+ ui.success(existedBefore
80
+ ? 'Config updated to pin local mode.'
81
+ : 'Config created and pinned to local mode.');
82
+ });
83
+ //# sourceMappingURL=bootstrap-local.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bootstrap-local.js","sourceRoot":"","sources":["../../src/commands/boot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,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;QACpF,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;QAChE,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS,eAAe,CAAC,CAAC;QAC9E,EAAE,CAAC,IAAI,CAAC,iCAAiC,CAAC,CAAC;QAC3C,OAAO;IACT,CAAC;IAED,WAAW,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC;IAE/B,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC9B,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC;IACpC,EAAE,CAAC,KAAK,CAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;IACrC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACtB,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAChC,EAAE,CAAC,OAAO,CACR,aAAa;QACX,CAAC,CAAC,mCAAmC;QACrC,CAAC,CAAC,0CAA0C,CAC/C,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -1,12 +1,21 @@
1
1
  import { Command } from 'commander';
2
2
  import * as path from 'path';
3
- import * as fs from 'fs';
4
- import { getOrCreateConfig, writeConfig, updateFeatures } from '../utils/config.js';
5
3
  import * as ui from '../utils/ui.js';
6
4
  import { verbose } from '../utils/ui.js';
5
+ import { configure } from '../lib/configure.js';
7
6
  function parseCommaSeparated(value) {
8
7
  return value.split(',').map((s) => s.trim()).filter(Boolean);
9
8
  }
9
+ function buildAction(enable, disable, enableAll, disableAll) {
10
+ if (!enable && !disable && !enableAll && !disableAll)
11
+ return undefined;
12
+ return {
13
+ enableNames: enable,
14
+ disableNames: disable,
15
+ enableAll,
16
+ disableAll,
17
+ };
18
+ }
10
19
  export const configureCommand = new Command('configure')
11
20
  .description('Configure MCP tools, prompts, and resources in AI-Game-Developer-Config.json')
12
21
  .argument('[path]', 'Path to the Unity project')
@@ -31,63 +40,46 @@ export const configureCommand = new Command('configure')
31
40
  process.exit(1);
32
41
  }
33
42
  const projectPath = path.resolve(resolvedPath);
34
- if (!fs.existsSync(projectPath)) {
35
- ui.error(`Project path does not exist: ${projectPath}`);
43
+ verbose(`Loading config for project: ${projectPath}`);
44
+ // `--list` must be read-only: previously this command short-
45
+ // circuited before applying any enable/disable flags. Preserve
46
+ // that semantics by suppressing the mutating actions whenever
47
+ // `options.list` is set, regardless of other flags.
48
+ const toolsAction = buildAction(options.enableTools, options.disableTools, options.enableAllTools, options.disableAllTools);
49
+ const promptsAction = buildAction(options.enablePrompts, options.disablePrompts, options.enableAllPrompts, options.disableAllPrompts);
50
+ const resourcesAction = buildAction(options.enableResources, options.disableResources, options.enableAllResources, options.disableAllResources);
51
+ const result = await configure({
52
+ unityProjectPath: projectPath,
53
+ tools: options.list ? undefined : toolsAction,
54
+ prompts: options.list ? undefined : promptsAction,
55
+ resources: options.list ? undefined : resourcesAction,
56
+ });
57
+ if (!result.success) {
58
+ ui.error(result.error?.message ?? 'Unknown error');
36
59
  process.exit(1);
37
60
  }
38
- verbose(`Loading config for project: ${projectPath}`);
39
- const config = getOrCreateConfig(projectPath);
40
- if (options.list) {
61
+ if (options.list && result.snapshot) {
41
62
  ui.heading('Current configuration');
42
- ui.label('Host', config.host ?? 'not set');
43
- ui.label('Keep Connected', String(config.keepConnected ?? false));
44
- ui.label('Transport', config.transportMethod ?? 'streamableHttp');
45
- ui.label('Auth', config.authOption ?? 'none');
63
+ ui.label('Host', result.snapshot.host ?? 'not set');
64
+ ui.label('Keep Connected', String(result.snapshot.keepConnected ?? false));
65
+ ui.label('Transport', result.snapshot.transportMethod ?? 'streamableHttp');
66
+ ui.label('Auth', result.snapshot.authOption ?? 'none');
46
67
  const printFeatures = (featureLabel, features) => {
47
- if (!features || features.length === 0) {
48
- ui.heading(featureLabel);
68
+ ui.heading(featureLabel);
69
+ if (features.length === 0) {
49
70
  ui.info('(none configured - all enabled by default)');
50
71
  return;
51
72
  }
52
- ui.heading(featureLabel);
53
73
  for (const f of features) {
54
74
  ui.featureRow(f.name, f.enabled);
55
75
  }
56
76
  };
57
- printFeatures('Tools', config.tools);
58
- printFeatures('Prompts', config.prompts);
59
- printFeatures('Resources', config.resources);
77
+ printFeatures('Tools', result.snapshot.tools);
78
+ printFeatures('Prompts', result.snapshot.prompts);
79
+ printFeatures('Resources', result.snapshot.resources);
60
80
  return;
61
81
  }
62
- // Apply tool changes
63
- if (options.enableTools || options.disableTools || options.enableAllTools || options.disableAllTools) {
64
- updateFeatures(config, 'tools', {
65
- enableNames: options.enableTools,
66
- disableNames: options.disableTools,
67
- enableAll: options.enableAllTools,
68
- disableAll: options.disableAllTools,
69
- });
70
- }
71
- // Apply prompt changes
72
- if (options.enablePrompts || options.disablePrompts || options.enableAllPrompts || options.disableAllPrompts) {
73
- updateFeatures(config, 'prompts', {
74
- enableNames: options.enablePrompts,
75
- disableNames: options.disablePrompts,
76
- enableAll: options.enableAllPrompts,
77
- disableAll: options.disableAllPrompts,
78
- });
79
- }
80
- // Apply resource changes
81
- if (options.enableResources || options.disableResources || options.enableAllResources || options.disableAllResources) {
82
- updateFeatures(config, 'resources', {
83
- enableNames: options.enableResources,
84
- disableNames: options.disableResources,
85
- enableAll: options.enableAllResources,
86
- disableAll: options.disableAllResources,
87
- });
88
- }
89
82
  verbose('Writing updated configuration');
90
- writeConfig(projectPath, config);
91
83
  ui.success('Configuration updated successfully.');
92
84
  });
93
85
  //# sourceMappingURL=configure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/commands/configure.ts"],"names":[],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,QAAQ,CAAC,SAAS,CAAC,CAAC;QACtD,OAAO;IACT,CAAC;IAED,OAAO,CAAC,+BAA+B,CAAC,CAAC;IACzC,EAAE,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { Command } from 'commander';
2
2
  import * as path from 'path';
3
- import * as fs from 'fs';
4
- import { addPluginToManifest, resolveLatestVersion } from '../utils/manifest.js';
5
3
  import * as ui from '../utils/ui.js';
6
4
  import { verbose } from '../utils/ui.js';
5
+ import { installPlugin } from '../lib/install-plugin.js';
7
6
  export const installPluginCommand = new Command('install-plugin')
8
7
  .description('Install Unity-MCP plugin into a Unity project')
9
8
  .argument('[path]', 'Path to the Unity project')
@@ -16,31 +15,50 @@ export const installPluginCommand = new Command('install-plugin')
16
15
  process.exit(1);
17
16
  }
18
17
  const projectPath = path.resolve(resolvedPath);
19
- // Validate project exists
20
- const manifestPath = path.join(projectPath, 'Packages', 'manifest.json');
21
- if (!fs.existsSync(manifestPath)) {
22
- ui.error(`Not a valid Unity project (missing Packages/manifest.json): ${projectPath}`);
23
- process.exit(1);
18
+ // Wire the library's progress events back into the CLI's chalk-
19
+ // styled ui so the terminal experience stays identical.
20
+ let spinner;
21
+ if (!options.pluginVersion) {
22
+ spinner = ui.startSpinner('Resolving latest plugin version...');
24
23
  }
25
- // Resolve version
26
- let version = options.pluginVersion;
27
- const isExplicitVersion = !!version;
28
- if (!version) {
29
- const spinner = ui.startSpinner('Resolving latest plugin version...');
30
- try {
31
- version = await resolveLatestVersion();
32
- spinner.success(`Resolved plugin version: ${version}`);
33
- }
34
- catch (err) {
24
+ const result = await installPlugin({
25
+ unityProjectPath: projectPath,
26
+ version: options.pluginVersion,
27
+ onProgress: (event) => {
28
+ if (event.phase === 'dependencies-resolved' && spinner) {
29
+ spinner.success(`Resolved plugin version: ${event.version}`);
30
+ spinner = undefined;
31
+ return;
32
+ }
33
+ if (event.phase === 'manifest-patched') {
34
+ // Preserve the historical `ui.success("Updated …")` vs
35
+ // `ui.info("manifest.json is already up to date.")` split
36
+ // that the shared manifest helpers used to print directly.
37
+ if (event.message.startsWith('Updated ')) {
38
+ ui.success(event.message);
39
+ }
40
+ else {
41
+ ui.info(event.message);
42
+ }
43
+ }
44
+ },
45
+ });
46
+ if (!result.success) {
47
+ if (spinner) {
35
48
  spinner.error('Failed to resolve plugin version');
36
- ui.error(err.message);
37
- process.exit(1);
49
+ spinner = undefined;
38
50
  }
51
+ ui.error(result.error?.message ?? 'Unknown error');
52
+ process.exit(1);
53
+ }
54
+ verbose(`Plugin version: ${result.installedVersion} (explicit: ${!!options.pluginVersion})`);
55
+ if (result.manifestPath) {
56
+ verbose(`Manifest path: ${result.manifestPath}`);
57
+ }
58
+ ui.info(`Installing Unity-MCP plugin v${result.installedVersion} into: ${projectPath}`);
59
+ for (const warning of result.warnings) {
60
+ ui.warn(warning);
39
61
  }
40
- verbose(`Plugin version: ${version} (explicit: ${isExplicitVersion})`);
41
- verbose(`Manifest path: ${manifestPath}`);
42
- ui.info(`Installing Unity-MCP plugin v${version} into: ${projectPath}`);
43
- addPluginToManifest(projectPath, version, isExplicitVersion);
44
62
  ui.success('Done! Open the project in Unity Editor to complete installation.');
45
63
  });
46
64
  //# sourceMappingURL=install-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install-plugin.js","sourceRoot":"","sources":["../../src/commands/install-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,oBAAoB,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CAAC;QACtB,CAAC;QACD,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,mBAAmB,MAAM,CAAC,gBAAgB,eAAe,CAAC,CAAC,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC;IAC7F,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,OAAO,CAAC,kBAAkB,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC;IACnD,CAAC;IACD,EAAE,CAAC,IAAI,CAAC,gCAAgC,MAAM,CAAC,gBAAgB,UAAU,WAAW,EAAE,CAAC,CAAC;IAExF,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;IAED,EAAE,CAAC,OAAO,CAAC,kEAAkE,CAAC,CAAC;AACjF,CAAC,CAAC,CAAC"}
@@ -1,9 +1,8 @@
1
1
  import { Command } from 'commander';
2
2
  import * as path from 'path';
3
- import * as fs from 'fs';
4
- import { removePluginFromManifest } from '../utils/manifest.js';
5
3
  import * as ui from '../utils/ui.js';
6
4
  import { verbose } from '../utils/ui.js';
5
+ import { removePlugin } from '../lib/remove-plugin.js';
7
6
  export const removePluginCommand = new Command('remove-plugin')
8
7
  .description('Remove Unity-MCP plugin from a Unity project')
9
8
  .argument('[path]', 'Path to the Unity project')
@@ -15,15 +14,28 @@ export const removePluginCommand = new Command('remove-plugin')
15
14
  process.exit(1);
16
15
  }
17
16
  const projectPath = path.resolve(resolvedPath);
18
- // Validate project exists
19
- const manifestPath = path.join(projectPath, 'Packages', 'manifest.json');
20
- if (!fs.existsSync(manifestPath)) {
21
- ui.error(`Not a valid Unity project (missing Packages/manifest.json): ${projectPath}`);
17
+ ui.info(`Removing Unity-MCP plugin from: ${projectPath}`);
18
+ const result = await removePlugin({ unityProjectPath: projectPath });
19
+ if (!result.success) {
20
+ ui.error(result.error?.message ?? 'Unknown error');
22
21
  process.exit(1);
23
22
  }
24
- verbose(`Manifest path: ${manifestPath}`);
25
- ui.info(`Removing Unity-MCP plugin from: ${projectPath}`);
26
- removePluginFromManifest(projectPath);
23
+ if (result.manifestPath) {
24
+ verbose(`Manifest path: ${result.manifestPath}`);
25
+ }
26
+ if (result.removed) {
27
+ ui.success(`Removed com.ivanmurzak.unity.mcp from ${result.manifestPath}`);
28
+ }
29
+ else {
30
+ ui.info('Unity-MCP plugin is not installed. Nothing to remove.');
31
+ }
32
+ for (const warning of result.warnings) {
33
+ // `removed === false` is already surfaced via the info line above,
34
+ // so skip the duplicate "not installed" warning to avoid noise.
35
+ if (warning.startsWith('Unity-MCP plugin was not installed'))
36
+ continue;
37
+ ui.warn(warning);
38
+ }
27
39
  ui.success('Done!');
28
40
  });
29
41
  //# sourceMappingURL=remove-plugin.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"remove-plugin.js","sourceRoot":"","sources":["../../src/commands/remove-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,OAAO,CAAC,eAAe,CAAC;KAC5D,WAAW,CAAC,8CAA8C,CAAC;KAC3D,QAAQ,CAAC,QAAQ,EAAE,2BAA2B,CAAC;KAC/C,MAAM,CAAC,eAAe,EAAE,2BAA2B,CAAC;KACpD,MAAM,CAAC,KAAK,EAAE,cAAkC,EAAE,OAA0B,EAAE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