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.
- package/CHANGELOG.md +60 -0
- package/README.md +30 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/bootstrap-local.d.ts +17 -0
- package/dist/commands/bootstrap-local.js +83 -0
- package/dist/commands/bootstrap-local.js.map +1 -0
- package/dist/commands/configure.js +37 -45
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/install-plugin.js +41 -23
- package/dist/commands/install-plugin.js.map +1 -1
- package/dist/commands/remove-plugin.js +21 -9
- package/dist/commands/remove-plugin.js.map +1 -1
- package/dist/commands/setup-mcp.js +32 -81
- package/dist/commands/setup-mcp.js.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/configure.d.ts +10 -0
- package/dist/lib/configure.js +85 -0
- package/dist/lib/configure.js.map +1 -0
- package/dist/lib/install-plugin.d.ts +8 -0
- package/dist/lib/install-plugin.js +68 -0
- package/dist/lib/install-plugin.js.map +1 -0
- package/dist/lib/logger.d.ts +7 -0
- package/dist/lib/logger.js +18 -0
- package/dist/lib/logger.js.map +1 -0
- package/dist/lib/progress.d.ts +7 -0
- package/dist/lib/progress.js +16 -0
- package/dist/lib/progress.js.map +1 -0
- package/dist/lib/remove-plugin.d.ts +7 -0
- package/dist/lib/remove-plugin.js +51 -0
- package/dist/lib/remove-plugin.js.map +1 -0
- package/dist/lib/setup-mcp.d.ts +12 -0
- package/dist/lib/setup-mcp.js +141 -0
- package/dist/lib/setup-mcp.js.map +1 -0
- package/dist/lib/types.d.ts +132 -0
- package/dist/lib/types.js +8 -0
- package/dist/lib/types.js.map +1 -0
- package/dist/lib/validation.d.ts +37 -0
- package/dist/lib/validation.js +50 -0
- package/dist/lib/validation.js.map +1 -0
- package/dist/lib.d.ts +5 -0
- package/dist/lib.js +18 -0
- package/dist/lib.js.map +1 -0
- package/dist/utils/manifest.d.ts +31 -3
- package/dist/utils/manifest.js +27 -11
- package/dist/utils/manifest.js.map +1 -1
- package/package.json +20 -2
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
|
-
import * as fs from 'fs';
|
|
3
|
-
import * as path from 'path';
|
|
4
2
|
import * as ui from '../utils/ui.js';
|
|
5
3
|
import { verbose } from '../utils/ui.js';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { getAgentById, getAgentIds, listAgentTable, resolveServerBinaryPath, writeJsonAgentConfig, writeTomlAgentConfig, MCP_SERVER_NAME, } from '../utils/agents.js';
|
|
4
|
+
import { getAgentById, getAgentIds, listAgentTable, MCP_SERVER_NAME, } from '../utils/agents.js';
|
|
5
|
+
import { setupMcp } from '../lib/setup-mcp.js';
|
|
9
6
|
function listAgents() {
|
|
10
7
|
listAgentTable('Available AI Agents', 'Config Path', (a) => a.configPathDisplay);
|
|
11
8
|
}
|
|
@@ -27,93 +24,47 @@ export const setupMcpCommand = new Command('setup-mcp')
|
|
|
27
24
|
ui.info(`Available agent IDs: ${getAgentIds().join(', ')}`);
|
|
28
25
|
process.exit(1);
|
|
29
26
|
}
|
|
27
|
+
// Resolve the agent up-front so we can:
|
|
28
|
+
// 1. Use the display name in user-facing strings (matches the
|
|
29
|
+
// historical `Configuring <Name> ...` phrasing).
|
|
30
|
+
// 2. Preserve the prior `ui.error(...)` + `ui.info("Available
|
|
31
|
+
// agent IDs: ...")` split for the unknown-agent error path.
|
|
30
32
|
const agent = getAgentById(agentId);
|
|
31
33
|
if (!agent) {
|
|
32
34
|
ui.error(`Unknown agent: "${agentId}"`);
|
|
33
35
|
ui.info(`Available agent IDs: ${getAgentIds().join(', ')}`);
|
|
34
36
|
process.exit(1);
|
|
35
37
|
}
|
|
36
|
-
const transport = options.transport ?? 'http';
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
const transport = (options.transport ?? 'http');
|
|
39
|
+
const spinner = ui.startSpinner(`Configuring ${agent.name} (${transport})...`);
|
|
40
|
+
const result = await setupMcp({
|
|
41
|
+
agentId,
|
|
42
|
+
unityProjectPath: positionalPath,
|
|
43
|
+
transport,
|
|
44
|
+
url: options.url,
|
|
45
|
+
token: options.token,
|
|
46
|
+
});
|
|
47
|
+
if (!result.success) {
|
|
48
|
+
spinner.error('Failed to write config');
|
|
49
|
+
ui.error(result.error?.message ?? 'Unknown error');
|
|
45
50
|
process.exit(1);
|
|
46
51
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const config = readConfig(projectPath);
|
|
50
|
-
const fromConfig = config
|
|
51
|
-
? resolveConnectionFromConfig(config)
|
|
52
|
-
: { url: undefined, token: undefined };
|
|
53
|
-
const port = (() => {
|
|
54
|
-
if (!config?.host)
|
|
55
|
-
return generatePortFromDirectory(projectPath);
|
|
56
|
-
try {
|
|
57
|
-
return parseInt(new URL(config.host).port, 10) || generatePortFromDirectory(projectPath);
|
|
58
|
-
}
|
|
59
|
-
catch {
|
|
60
|
-
return generatePortFromDirectory(projectPath);
|
|
61
|
-
}
|
|
62
|
-
})();
|
|
63
|
-
const timeout = config?.timeoutMs ?? 10000;
|
|
64
|
-
const auth = config?.authOption ?? 'none';
|
|
65
|
-
const token = options.token ?? fromConfig.token ?? '';
|
|
66
|
-
const authRequired = auth === 'required';
|
|
67
|
-
// Resolve server binary path
|
|
68
|
-
const serverPath = resolveServerBinaryPath(projectPath).replace(/\\/g, '/');
|
|
69
|
-
verbose(`Server binary: ${serverPath}`);
|
|
70
|
-
// Resolve URL for HTTP
|
|
71
|
-
let serverUrl;
|
|
72
|
-
if (options.url) {
|
|
73
|
-
serverUrl = options.url.replace(/\/$/, '');
|
|
74
|
-
}
|
|
75
|
-
else if (fromConfig.url) {
|
|
76
|
-
serverUrl = fromConfig.url.replace(/\/$/, '');
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
serverUrl = `http://localhost:${port}`;
|
|
52
|
+
if (positionalPath) {
|
|
53
|
+
verbose(`Project path: ${positionalPath}`);
|
|
80
54
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
verbose(`Config file: ${configPath}`);
|
|
84
|
-
let props;
|
|
85
|
-
let removeKeys;
|
|
86
|
-
if (transport === 'stdio') {
|
|
87
|
-
props = agent.getStdioProps(serverPath, port, timeout, auth, token);
|
|
88
|
-
removeKeys = agent.stdioRemoveKeys;
|
|
55
|
+
if (result.configPath) {
|
|
56
|
+
verbose(`Config file: ${result.configPath}`);
|
|
89
57
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
writeTomlAgentConfig(configPath, agent.bodyPath, MCP_SERVER_NAME, props, removeKeys);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
writeJsonAgentConfig(configPath, agent.bodyPath, MCP_SERVER_NAME, props, removeKeys);
|
|
102
|
-
}
|
|
103
|
-
spinner.success(`${agent.name} configured successfully`);
|
|
58
|
+
spinner.success(`${agent.name} configured successfully`);
|
|
59
|
+
console.log('');
|
|
60
|
+
if (result.configPath)
|
|
61
|
+
ui.label('Config file', result.configPath);
|
|
62
|
+
if (result.transport)
|
|
63
|
+
ui.label('Transport', result.transport);
|
|
64
|
+
ui.label('Server name', MCP_SERVER_NAME);
|
|
65
|
+
for (const warning of result.warnings) {
|
|
104
66
|
console.log('');
|
|
105
|
-
ui.
|
|
106
|
-
ui.label('Transport', transport);
|
|
107
|
-
ui.label('Server name', MCP_SERVER_NAME);
|
|
108
|
-
if (transport === 'stdio' && !fs.existsSync(serverPath.replace(/\//g, path.sep))) {
|
|
109
|
-
console.log('');
|
|
110
|
-
ui.warn('Server binary not found. Open Unity with the MCP plugin to download it automatically.');
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch (err) {
|
|
114
|
-
spinner.error('Failed to write config');
|
|
115
|
-
ui.error(err instanceof Error ? err.message : String(err));
|
|
116
|
-
process.exit(1);
|
|
67
|
+
ui.warn(warning);
|
|
117
68
|
}
|
|
118
69
|
});
|
|
119
70
|
//# sourceMappingURL=setup-mcp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup-mcp.js","sourceRoot":"","sources":["../../src/commands/setup-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"setup-mcp.js","sourceRoot":"","sources":["../../src/commands/setup-mcp.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAU/C,SAAS,UAAU;IACjB,cAAc,CAAC,qBAAqB,EAAE,aAAa,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACnF,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,OAAO,CAAC,WAAW,CAAC;KACpD,WAAW,CAAC,kCAAkC,CAAC;KAC/C,QAAQ,CAAC,YAAY,EAAE,4CAA4C,CAAC;KACpE,QAAQ,CAAC,QAAQ,EAAE,sCAAsC,CAAC;KAC1D,MAAM,CACL,yBAAyB,EACzB,iDAAiD,EACjD,MAAM,CACP;KACA,MAAM,CAAC,aAAa,EAAE,0CAA0C,CAAC;KACjE,MAAM,CAAC,iBAAiB,EAAE,qBAAq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C,OAAO,EAAE,CAAC;QACpB,OAAO,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;QACxC,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,IAAI,eAAe,CAAC,CAAC;QACnD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,CAAC,iBAAiB,cAAc,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,IAAI,MAAM,CAAC,UAAU,EAAE,CAAC;QACtB,OAAO,CAAC,gBAAgB,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,OAAO,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,IAAI,0BAA0B,CAAC,CAAC;IAEzD,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,IAAI,MAAM,CAAC,UAAU;QAAE,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;IAClE,IAAI,MAAM,CAAC,SAAS;QAAE,EAAE,CAAC,KAAK,CAAC,WAAW,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC;IAC9D,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,eAAe,CAAC,CAAC;IAEzC,KAAK,MAAM,OAAO,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACtC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAChB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnB,CAAC;AACH,CAAC,CACF,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { createRequire } from 'module';
|
|
3
|
+
import { bootstrapLocalCommand } from './commands/bootstrap-local.js';
|
|
3
4
|
import { createProjectCommand } from './commands/create-project.js';
|
|
4
5
|
import { installUnityCommand } from './commands/install-unity.js';
|
|
5
6
|
import { openCommand } from './commands/open.js';
|
|
@@ -26,6 +27,7 @@ program
|
|
|
26
27
|
.option('-v, --verbose', 'Enable verbose diagnostic output');
|
|
27
28
|
// Register all subcommands
|
|
28
29
|
const subcommands = [
|
|
30
|
+
bootstrapLocalCommand,
|
|
29
31
|
configureCommand,
|
|
30
32
|
createProjectCommand,
|
|
31
33
|
installPluginCommand,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,KAAK,IAAI,O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I,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConfigureOptions, ConfigureResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Configure Unity-MCP features (tools / prompts / resources) for a
|
|
4
|
+
* Unity project. Library-safe: no stdout noise, no process.exit.
|
|
5
|
+
*
|
|
6
|
+
* If none of `tools`/`prompts`/`resources` are supplied, the call is a
|
|
7
|
+
* read-only "create-if-missing and return snapshot" — mirrors the CLI's
|
|
8
|
+
* `--list` behaviour minus the rendering.
|
|
9
|
+
*/
|
|
10
|
+
export declare function configure(opts: ConfigureOptions): Promise<ConfigureResult>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import * as path from 'path';
|
|
2
|
+
import { getOrCreateConfig, writeConfig, updateFeatures, } from '../utils/config.js';
|
|
3
|
+
import { emitProgress } from './progress.js';
|
|
4
|
+
import { requireExistingPath } from './validation.js';
|
|
5
|
+
const CONFIG_RELATIVE_PATH = 'UserSettings/AI-Game-Developer-Config.json';
|
|
6
|
+
function hasAnyAction(action) {
|
|
7
|
+
if (!action)
|
|
8
|
+
return false;
|
|
9
|
+
return ((Array.isArray(action.enableNames) && action.enableNames.length > 0) ||
|
|
10
|
+
(Array.isArray(action.disableNames) && action.disableNames.length > 0) ||
|
|
11
|
+
action.enableAll === true ||
|
|
12
|
+
action.disableAll === true);
|
|
13
|
+
}
|
|
14
|
+
function snapshotFeatures(config, key) {
|
|
15
|
+
const raw = config[key];
|
|
16
|
+
if (!Array.isArray(raw))
|
|
17
|
+
return [];
|
|
18
|
+
return raw
|
|
19
|
+
.filter((f) => typeof f === 'object' && f !== null && typeof f.name === 'string' && typeof f.enabled === 'boolean')
|
|
20
|
+
.map((f) => ({ name: f.name, enabled: f.enabled }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Configure Unity-MCP features (tools / prompts / resources) for a
|
|
24
|
+
* Unity project. Library-safe: no stdout noise, no process.exit.
|
|
25
|
+
*
|
|
26
|
+
* If none of `tools`/`prompts`/`resources` are supplied, the call is a
|
|
27
|
+
* read-only "create-if-missing and return snapshot" — mirrors the CLI's
|
|
28
|
+
* `--list` behaviour minus the rendering.
|
|
29
|
+
*/
|
|
30
|
+
export async function configure(opts) {
|
|
31
|
+
const warnings = [];
|
|
32
|
+
try {
|
|
33
|
+
const validated = requireExistingPath(opts?.unityProjectPath);
|
|
34
|
+
if (!validated.ok) {
|
|
35
|
+
return { success: false, warnings, error: validated.error };
|
|
36
|
+
}
|
|
37
|
+
const { projectPath } = validated;
|
|
38
|
+
const configPath = path.join(projectPath, CONFIG_RELATIVE_PATH);
|
|
39
|
+
emitProgress(opts.onProgress, { phase: 'start', message: `Configuring Unity-MCP features for ${projectPath}` });
|
|
40
|
+
const config = getOrCreateConfig(projectPath);
|
|
41
|
+
const hasToolsAction = hasAnyAction(opts.tools);
|
|
42
|
+
const hasPromptsAction = hasAnyAction(opts.prompts);
|
|
43
|
+
const hasResourcesAction = hasAnyAction(opts.resources);
|
|
44
|
+
if (hasToolsAction) {
|
|
45
|
+
updateFeatures(config, 'tools', opts.tools);
|
|
46
|
+
}
|
|
47
|
+
if (hasPromptsAction) {
|
|
48
|
+
updateFeatures(config, 'prompts', opts.prompts);
|
|
49
|
+
}
|
|
50
|
+
if (hasResourcesAction) {
|
|
51
|
+
updateFeatures(config, 'resources', opts.resources);
|
|
52
|
+
}
|
|
53
|
+
if (hasToolsAction || hasPromptsAction || hasResourcesAction) {
|
|
54
|
+
writeConfig(projectPath, config);
|
|
55
|
+
emitProgress(opts.onProgress, {
|
|
56
|
+
phase: 'manifest-patched',
|
|
57
|
+
message: `Wrote ${configPath}`,
|
|
58
|
+
manifestPath: configPath,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
emitProgress(opts.onProgress, { phase: 'done', message: 'Configure complete.' });
|
|
62
|
+
return {
|
|
63
|
+
success: true,
|
|
64
|
+
configPath,
|
|
65
|
+
snapshot: {
|
|
66
|
+
host: typeof config.host === 'string' ? config.host : undefined,
|
|
67
|
+
keepConnected: typeof config.keepConnected === 'boolean' ? config.keepConnected : undefined,
|
|
68
|
+
transportMethod: typeof config.transportMethod === 'string' ? config.transportMethod : undefined,
|
|
69
|
+
authOption: typeof config.authOption === 'string' ? config.authOption : undefined,
|
|
70
|
+
tools: snapshotFeatures(config, 'tools'),
|
|
71
|
+
prompts: snapshotFeatures(config, 'prompts'),
|
|
72
|
+
resources: snapshotFeatures(config, 'resources'),
|
|
73
|
+
},
|
|
74
|
+
warnings,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
return {
|
|
79
|
+
success: false,
|
|
80
|
+
warnings,
|
|
81
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=configure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configure.js","sourceRoot":"","sources":["../../src/lib/configure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EACL,iBAAiB,EACjB,WAAW,EACX,cAAc,GAGf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAQtD,MAAM,oBAAoB,GAAG,4CAA4C,CAAC;AAE1E,SAAS,YAAY,CAAC,MAAiC;IACrD,IAAI,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAC1B,OAAO,CACL,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;QACpE,CAAC,KAAK,CA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CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;gBAC/D,aAAa,EAAE,OAAO,MAAM,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;gBAC3F,eAAe,EAAE,OAAO,MAAM,CAAC,eAAe,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;gBAChG,UAAU,EAAE,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,SAAS;gBACjF,KAAK,EAAE,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC;gBACxC,OAAO,EAAE,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC;gBAC5C,SAAS,EAAE,gBAAgB,CAAC,MAAM,EAAE,WAAW,CAAC;aACjD;YACD,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,QAAQ;YACR,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { InstallPluginOptions, InstallResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Install the Unity-MCP plugin into a Unity project. Library-safe:
|
|
4
|
+
* never calls `process.exit`, never prints to stdout / stderr, never
|
|
5
|
+
* throws past the public boundary — errors are returned in
|
|
6
|
+
* `{ success: false, error }`.
|
|
7
|
+
*/
|
|
8
|
+
export declare function installPlugin(opts: InstallPluginOptions): Promise<InstallResult>;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { addPluginToManifest, resolveLatestVersion } from '../utils/manifest.js';
|
|
2
|
+
import { silentLogger } from './logger.js';
|
|
3
|
+
import { emitProgress } from './progress.js';
|
|
4
|
+
import { requireUnityProject } from './validation.js';
|
|
5
|
+
/**
|
|
6
|
+
* Install the Unity-MCP plugin into a Unity project. Library-safe:
|
|
7
|
+
* never calls `process.exit`, never prints to stdout / stderr, never
|
|
8
|
+
* throws past the public boundary — errors are returned in
|
|
9
|
+
* `{ success: false, error }`.
|
|
10
|
+
*/
|
|
11
|
+
export async function installPlugin(opts) {
|
|
12
|
+
const warnings = [];
|
|
13
|
+
const nextSteps = [];
|
|
14
|
+
try {
|
|
15
|
+
const validated = requireUnityProject(opts?.unityProjectPath);
|
|
16
|
+
if (!validated.ok) {
|
|
17
|
+
return {
|
|
18
|
+
success: false,
|
|
19
|
+
manifestPath: validated.manifestPath,
|
|
20
|
+
warnings,
|
|
21
|
+
nextSteps,
|
|
22
|
+
error: validated.error,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const { projectPath } = validated;
|
|
26
|
+
emitProgress(opts.onProgress, { phase: 'start', message: `Installing Unity-MCP plugin into ${projectPath}` });
|
|
27
|
+
let version = opts.version;
|
|
28
|
+
const isExplicitVersion = !!version;
|
|
29
|
+
if (!version) {
|
|
30
|
+
version = await resolveLatestVersion(silentLogger);
|
|
31
|
+
emitProgress(opts.onProgress, {
|
|
32
|
+
phase: 'dependencies-resolved',
|
|
33
|
+
message: `Resolved latest plugin version: ${version}`,
|
|
34
|
+
version,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
const result = addPluginToManifest(projectPath, version, isExplicitVersion, silentLogger);
|
|
38
|
+
if (result.resolvedVersion !== version && !isExplicitVersion) {
|
|
39
|
+
warnings.push(`Plugin already at version ${result.resolvedVersion} (>= ${version}). ` +
|
|
40
|
+
'Skipping version update. Pass an explicit `version` to force a specific value.');
|
|
41
|
+
}
|
|
42
|
+
emitProgress(opts.onProgress, {
|
|
43
|
+
phase: 'manifest-patched',
|
|
44
|
+
message: result.modified
|
|
45
|
+
? `Updated ${result.manifestPath}`
|
|
46
|
+
: 'manifest.json is already up to date.',
|
|
47
|
+
manifestPath: result.manifestPath,
|
|
48
|
+
});
|
|
49
|
+
nextSteps.push('Open the Unity project in the Editor to complete installation.');
|
|
50
|
+
emitProgress(opts.onProgress, { phase: 'done', message: 'Install complete.' });
|
|
51
|
+
return {
|
|
52
|
+
success: true,
|
|
53
|
+
installedVersion: result.resolvedVersion,
|
|
54
|
+
manifestPath: result.manifestPath,
|
|
55
|
+
warnings,
|
|
56
|
+
nextSteps,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
return {
|
|
61
|
+
success: false,
|
|
62
|
+
warnings,
|
|
63
|
+
nextSteps,
|
|
64
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=install-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-plugin.js","sourceRoot":"","sources":["../../src/lib/install-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,IAA0B;IAC5D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAa,EAAE,CAAC;IAE/B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YAClB,OAAO;gBACL,OAAO,EAAE,KAAK;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IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,EAAE,CAAC,CAAC;QAE/E,OAAO;YACL,OAAO,EAAE,IAAI;YACb,gBAAgB,EAAE,MAAM,CAAC,eAAe;YACxC,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,QAAQ;YACR,SAAS;SACV,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,QAAQ;YACR,SAAS;YACT,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Minimal logger interface used by shared utility functions that are
|
|
2
|
+
// exercised from BOTH the CLI (which wants chalk-styled console output)
|
|
3
|
+
// and the library API (which must stay silent).
|
|
4
|
+
//
|
|
5
|
+
// The CLI passes an adapter backed by the existing `ui` module; the
|
|
6
|
+
// library API passes `silentLogger` which swallows every call.
|
|
7
|
+
//
|
|
8
|
+
// This file intentionally has no top-level side effects and no
|
|
9
|
+
// dependency on `chalk`, `commander`, or any other UI layer — the
|
|
10
|
+
// library entry (lib.ts) imports it, and the library entry is
|
|
11
|
+
// required to stay side-effect-free.
|
|
12
|
+
export const silentLogger = {
|
|
13
|
+
info: () => { },
|
|
14
|
+
success: () => { },
|
|
15
|
+
warn: () => { },
|
|
16
|
+
error: () => { },
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,wEAAwE;AACxE,gDAAgD;AAChD,EAAE;AACF,oEAAoE;AACpE,+DAA+D;AAC/D,EAAE;AACF,+DAA+D;AAC/D,kEAAkE;AAClE,8DAA8D;AAC9D,qCAAqC;AASrC,MAAM,CAAC,MAAM,YAAY,GAAc;IACrC,IAAI,EAAE,GAAG,EAAE,GAA8B,CAAC;IAC1C,OAAO,EAAE,GAAG,EAAE,GAA8B,CAAC;IAC7C,IAAI,EAAE,GAAG,EAAE,GAA8B,CAAC;IAC1C,KAAK,EAAE,GAAG,EAAE,GAA8B,CAAC;CAC5C,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ProgressCallback, ProgressEvent } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Forward a single progress event to the caller's optional callback,
|
|
4
|
+
* swallowing any exception the callback throws. A broken onProgress
|
|
5
|
+
* handler must never abort the underlying library operation.
|
|
6
|
+
*/
|
|
7
|
+
export declare function emitProgress(onProgress: ProgressCallback | undefined, event: ProgressEvent): void;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forward a single progress event to the caller's optional callback,
|
|
3
|
+
* swallowing any exception the callback throws. A broken onProgress
|
|
4
|
+
* handler must never abort the underlying library operation.
|
|
5
|
+
*/
|
|
6
|
+
export function emitProgress(onProgress, event) {
|
|
7
|
+
if (!onProgress)
|
|
8
|
+
return;
|
|
9
|
+
try {
|
|
10
|
+
onProgress(event);
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
// Intentionally ignored — see doc comment.
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=progress.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress.js","sourceRoot":"","sources":["../../src/lib/progress.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,UAAwC,EAAE,KAAoB;IACzF,IAAI,CAAC,UAAU;QAAE,OAAO;IACxB,IAAI,CAAC;QACH,UAAU,CAAC,KAAK,CAAC,CAAC;IACpB,CAAC;IAAC,MAAM,CAAC;QACP,2CAA2C;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { RemovePluginOptions, RemoveResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Remove the Unity-MCP plugin from a Unity project. Library-safe:
|
|
4
|
+
* never calls `process.exit`, never prints to stdout / stderr, never
|
|
5
|
+
* throws past the public boundary.
|
|
6
|
+
*/
|
|
7
|
+
export declare function removePlugin(opts: RemovePluginOptions): Promise<RemoveResult>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { removePluginFromManifest } from '../utils/manifest.js';
|
|
2
|
+
import { silentLogger } from './logger.js';
|
|
3
|
+
import { emitProgress } from './progress.js';
|
|
4
|
+
import { requireUnityProject } from './validation.js';
|
|
5
|
+
/**
|
|
6
|
+
* Remove the Unity-MCP plugin from a Unity project. Library-safe:
|
|
7
|
+
* never calls `process.exit`, never prints to stdout / stderr, never
|
|
8
|
+
* throws past the public boundary.
|
|
9
|
+
*/
|
|
10
|
+
export async function removePlugin(opts) {
|
|
11
|
+
const warnings = [];
|
|
12
|
+
try {
|
|
13
|
+
const validated = requireUnityProject(opts?.unityProjectPath);
|
|
14
|
+
if (!validated.ok) {
|
|
15
|
+
return {
|
|
16
|
+
success: false,
|
|
17
|
+
manifestPath: validated.manifestPath,
|
|
18
|
+
warnings,
|
|
19
|
+
error: validated.error,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const { projectPath } = validated;
|
|
23
|
+
emitProgress(opts.onProgress, { phase: 'start', message: `Removing Unity-MCP plugin from ${projectPath}` });
|
|
24
|
+
const result = removePluginFromManifest(projectPath, silentLogger);
|
|
25
|
+
if (!result.removed) {
|
|
26
|
+
warnings.push('Unity-MCP plugin was not installed. Nothing was removed.');
|
|
27
|
+
}
|
|
28
|
+
emitProgress(opts.onProgress, {
|
|
29
|
+
phase: 'manifest-patched',
|
|
30
|
+
message: result.removed
|
|
31
|
+
? `Removed plugin from ${result.manifestPath}`
|
|
32
|
+
: 'manifest.json left untouched (plugin not installed).',
|
|
33
|
+
manifestPath: result.manifestPath,
|
|
34
|
+
});
|
|
35
|
+
emitProgress(opts.onProgress, { phase: 'done', message: 'Remove complete.' });
|
|
36
|
+
return {
|
|
37
|
+
success: true,
|
|
38
|
+
removed: result.removed,
|
|
39
|
+
manifestPath: result.manifestPath,
|
|
40
|
+
warnings,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
catch (err) {
|
|
44
|
+
return {
|
|
45
|
+
success: false,
|
|
46
|
+
warnings,
|
|
47
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=remove-plugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-plugin.js","sourceRoot":"","sources":["../../src/lib/remove-plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAGtD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,IAAyB;IAC1D,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAC9D,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,CAAC;YAClB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,YAAY,EAAE,SAAS,CAAC,YAAY;gBACpC,QAAQ;gBACR,KAAK,EAAE,SAAS,CAAC,KAAK;aACvB,CAAC;QACJ,CAAC;QACD,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;QAElC,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,kCAAkC,WAAW,EAAE,EAAE,CAAC,CAAC;QAE5G,MAAM,MAAM,GAAG,wBAAwB,CAAC,WAAW,EAAE,YAAY,CAAC,CAAC;QAEnE,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,QAAQ,CAAC,IAAI,CAAC,0DAA0D,CAAC,CAAC;QAC5E,CAAC;QAED,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE;YAC5B,KAAK,EAAE,kBAAkB;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACrB,CAAC,CAAC,uBAAuB,MAAM,CAAC,YAAY,EAAE;gBAC9C,CAAC,CAAC,sDAAsD;YAC1D,YAAY,EAAE,MAAM,CAAC,YAAY;SAClC,CAAC,CAAC;QAEH,YAAY,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;QAE9E,OAAO;YACL,OAAO,EAAE,IAAI;YACb,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,YAAY,EAAE,MAAM,CAAC,YAAY;YACjC,QAAQ;SACT,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO;YACL,OAAO,EAAE,KAAK;YACd,QAAQ;YACR,KAAK,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SetupMcpOptions, SetupMcpResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Write MCP configuration for the given AI agent, so it can talk to
|
|
4
|
+
* Unity-MCP. Library-safe: no stdout noise, no process.exit, no throws
|
|
5
|
+
* past the public boundary.
|
|
6
|
+
*/
|
|
7
|
+
export declare function setupMcp(opts: SetupMcpOptions): Promise<SetupMcpResult>;
|
|
8
|
+
/**
|
|
9
|
+
* List every agent id known to the `setupMcp` function. Useful for
|
|
10
|
+
* consumer UIs that want to render a picker.
|
|
11
|
+
*/
|
|
12
|
+
export declare function listAgentIds(): string[];
|