godot-cli 0.16.2 → 0.17.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/dist/commands/configure.js +24 -1
- package/dist/commands/configure.js.map +1 -1
- package/dist/commands/install-plugin.js +99 -7
- package/dist/commands/install-plugin.js.map +1 -1
- package/dist/commands/login.js +53 -15
- package/dist/commands/login.js.map +1 -1
- package/dist/lib/configure-agent.d.ts +20 -0
- package/dist/lib/configure-agent.js +115 -0
- package/dist/lib/configure-agent.js.map +1 -0
- package/dist/lib/enroll.d.ts +21 -0
- package/dist/lib/enroll.js +100 -0
- package/dist/lib/enroll.js.map +1 -0
- package/dist/lib/install-server.d.ts +25 -0
- package/dist/lib/install-server.js +234 -0
- package/dist/lib/install-server.js.map +1 -0
- package/dist/lib/types.d.ts +138 -0
- package/dist/lib.d.ts +4 -1
- package/dist/lib.js +3 -0
- package/dist/lib.js.map +1 -1
- package/dist/utils/addon-deps.js +2 -2
- package/dist/utils/addon-deps.js.map +1 -1
- package/dist/utils/cloud-login.d.ts +22 -4
- package/dist/utils/cloud-login.js +40 -17
- package/dist/utils/cloud-login.js.map +1 -1
- package/dist/utils/connection.d.ts +4 -7
- package/dist/utils/connection.js +8 -10
- package/dist/utils/connection.js.map +1 -1
- package/dist/utils/enroll.d.ts +39 -0
- package/dist/utils/enroll.js +66 -0
- package/dist/utils/enroll.js.map +1 -0
- package/dist/utils/machine-credentials.d.ts +74 -0
- package/dist/utils/machine-credentials.js +182 -0
- package/dist/utils/machine-credentials.js.map +1 -0
- package/dist/utils/project-identity.d.ts +76 -0
- package/dist/utils/project-identity.js +111 -0
- package/dist/utils/project-identity.js.map +1 -0
- package/dist/utils/project-marker.d.ts +64 -0
- package/dist/utils/project-marker.js +192 -0
- package/dist/utils/project-marker.js.map +1 -0
- package/dist/utils/server-source.d.ts +84 -0
- package/dist/utils/server-source.js +217 -0
- package/dist/utils/server-source.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { InstallServerOptions, InstallServerResult } from './types.js';
|
|
2
|
+
/** Relative path of the CLI-managed server dir inside a project (design 06: "the CLI's managed directory"). */
|
|
3
|
+
export declare const MANAGED_SERVER_REL_DIR: string;
|
|
4
|
+
/** Absolute path of the CLI-managed server directory for a project. */
|
|
5
|
+
export declare function getManagedServerDir(projectPath: string): string;
|
|
6
|
+
/** Absolute path of the managed server executable for a project (the file the `configure` proxy spawns). */
|
|
7
|
+
export declare function getManagedServerExecutablePath(projectPath: string, platform?: NodeJS.Platform): string;
|
|
8
|
+
/**
|
|
9
|
+
* Install the shared `gamedev-mcp-server` binary into the CLI-managed directory
|
|
10
|
+
* `<project>/.ai-game-dev/server/` — the `install-plugin --with-server` flow (D12).
|
|
11
|
+
*
|
|
12
|
+
* 1. Download path (default): resolve the host RID, download the RID-matched
|
|
13
|
+
* `gamedev-mcp-server-<rid>.zip` from github.com only (fail-closed host
|
|
14
|
+
* trust), download the release `SHA256SUMS`, and VERIFY the zip's SHA256
|
|
15
|
+
* against the manifest BEFORE extraction (fail-closed — any non-`verified`
|
|
16
|
+
* verdict aborts and leaves the project untouched). Then extract + swap.
|
|
17
|
+
* 2. Local path (`--server-source`): copy a trusted local server dir / `.zip`
|
|
18
|
+
* into the managed dir with no network + no checksum (the local artifact is
|
|
19
|
+
* trusted). Offline / dev / CI.
|
|
20
|
+
*
|
|
21
|
+
* Library-safe: no stdout noise, no `process.exit`, no throws past the boundary;
|
|
22
|
+
* returns a `{ kind }` union. Materializes into a temp sibling and swaps only on
|
|
23
|
+
* full success, so a partial download/extract is rolled back.
|
|
24
|
+
*/
|
|
25
|
+
export declare function installServer(opts: InstallServerOptions): Promise<InstallServerResult>;
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import * as path from 'path';
|
|
3
|
+
import { DEFAULT_SERVER_VERSION, detectHostRid, serverDownloadUrl, serverAssetName, serverExecutableFileName, sha256SumsUrl, assertTrustedServerUrl, verifyZipChecksum, checksumFailureReason, sha256Hex, } from '../utils/server-source.js';
|
|
4
|
+
import { parseZip } from '../utils/unzip.js';
|
|
5
|
+
import { emitProgress } from './progress.js';
|
|
6
|
+
/** Relative path of the CLI-managed server dir inside a project (design 06: "the CLI's managed directory"). */
|
|
7
|
+
export const MANAGED_SERVER_REL_DIR = path.join('.ai-game-dev', 'server');
|
|
8
|
+
/** Absolute path of the CLI-managed server directory for a project. */
|
|
9
|
+
export function getManagedServerDir(projectPath) {
|
|
10
|
+
return path.join(projectPath, MANAGED_SERVER_REL_DIR);
|
|
11
|
+
}
|
|
12
|
+
/** Absolute path of the managed server executable for a project (the file the `configure` proxy spawns). */
|
|
13
|
+
export function getManagedServerExecutablePath(projectPath, platform = process.platform) {
|
|
14
|
+
return path.join(getManagedServerDir(projectPath), serverExecutableFileName(platform));
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Install the shared `gamedev-mcp-server` binary into the CLI-managed directory
|
|
18
|
+
* `<project>/.ai-game-dev/server/` — the `install-plugin --with-server` flow (D12).
|
|
19
|
+
*
|
|
20
|
+
* 1. Download path (default): resolve the host RID, download the RID-matched
|
|
21
|
+
* `gamedev-mcp-server-<rid>.zip` from github.com only (fail-closed host
|
|
22
|
+
* trust), download the release `SHA256SUMS`, and VERIFY the zip's SHA256
|
|
23
|
+
* against the manifest BEFORE extraction (fail-closed — any non-`verified`
|
|
24
|
+
* verdict aborts and leaves the project untouched). Then extract + swap.
|
|
25
|
+
* 2. Local path (`--server-source`): copy a trusted local server dir / `.zip`
|
|
26
|
+
* into the managed dir with no network + no checksum (the local artifact is
|
|
27
|
+
* trusted). Offline / dev / CI.
|
|
28
|
+
*
|
|
29
|
+
* Library-safe: no stdout noise, no `process.exit`, no throws past the boundary;
|
|
30
|
+
* returns a `{ kind }` union. Materializes into a temp sibling and swaps only on
|
|
31
|
+
* full success, so a partial download/extract is rolled back.
|
|
32
|
+
*/
|
|
33
|
+
export async function installServer(opts) {
|
|
34
|
+
const warnings = [];
|
|
35
|
+
const platform = process.platform;
|
|
36
|
+
try {
|
|
37
|
+
const projectPath = path.resolve(opts.godotProjectPath);
|
|
38
|
+
if (!fs.existsSync(projectPath)) {
|
|
39
|
+
throw new Error(`Project path does not exist: ${projectPath}`);
|
|
40
|
+
}
|
|
41
|
+
const serverDir = getManagedServerDir(projectPath);
|
|
42
|
+
if (opts.source !== undefined && opts.source !== '') {
|
|
43
|
+
return installFromLocal(projectPath, serverDir, opts.source, platform, warnings, opts.onProgress);
|
|
44
|
+
}
|
|
45
|
+
return await installFromDownload(projectPath, serverDir, platform, warnings, opts);
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
return {
|
|
49
|
+
kind: 'failure',
|
|
50
|
+
success: false,
|
|
51
|
+
warnings,
|
|
52
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
async function installFromDownload(projectPath, serverDir, platform, warnings, opts) {
|
|
57
|
+
const rid = (opts.rid ?? detectHostRid()).trim();
|
|
58
|
+
if (rid.includes('unknown')) {
|
|
59
|
+
throw new Error(`Cannot detect a supported host RID (got "${rid}"). Use --server-source <path> to install a server binary manually.`);
|
|
60
|
+
}
|
|
61
|
+
const version = (opts.version ?? DEFAULT_SERVER_VERSION).trim();
|
|
62
|
+
if (version === '') {
|
|
63
|
+
throw new Error('No server version to download. Pass --server-version <x.y.z> or --server-source <path>.');
|
|
64
|
+
}
|
|
65
|
+
const url = serverDownloadUrl(version, rid);
|
|
66
|
+
assertTrustedServerUrl(url);
|
|
67
|
+
const assetName = serverAssetName(rid);
|
|
68
|
+
const fetchImpl = opts.fetchImpl ?? globalThis.fetch;
|
|
69
|
+
emitProgress(opts.onProgress, {
|
|
70
|
+
phase: 'server-downloading',
|
|
71
|
+
message: `Downloading ${assetName} (${version}) from ${url}`,
|
|
72
|
+
url,
|
|
73
|
+
});
|
|
74
|
+
const zipResponse = await fetchImpl(url);
|
|
75
|
+
if (!zipResponse.ok) {
|
|
76
|
+
throw new Error(`Failed to download server ${version} for ${rid}: HTTP ${zipResponse.status} ${zipResponse.statusText} from ${url}. ` +
|
|
77
|
+
`Verify the release v${version} exists with a ${assetName} asset, or use --server-source <path>.`);
|
|
78
|
+
}
|
|
79
|
+
const archive = Buffer.from(await zipResponse.arrayBuffer());
|
|
80
|
+
// Fail-closed integrity: download SHA256SUMS + verify BEFORE extraction.
|
|
81
|
+
const sumsUrl = sha256SumsUrl(version);
|
|
82
|
+
assertTrustedServerUrl(sumsUrl);
|
|
83
|
+
emitProgress(opts.onProgress, { phase: 'server-verifying', message: `Verifying against ${sumsUrl}` });
|
|
84
|
+
const sumsResponse = await fetchImpl(sumsUrl);
|
|
85
|
+
if (!sumsResponse.ok) {
|
|
86
|
+
throw new Error(`Refusing to install an unverified server: could not download ${sumsUrl} (HTTP ${sumsResponse.status}). ` +
|
|
87
|
+
`The release must publish a SHA256SUMS manifest.`);
|
|
88
|
+
}
|
|
89
|
+
const sumsText = await sumsResponse.text();
|
|
90
|
+
const actualDigest = sha256Hex(archive);
|
|
91
|
+
const verdict = verifyZipChecksum(sumsText, assetName, actualDigest);
|
|
92
|
+
if (verdict !== 'verified') {
|
|
93
|
+
throw new Error(`Refusing to install server ${version} for ${rid}: ${checksumFailureReason(verdict, assetName)} (fail-closed).`);
|
|
94
|
+
}
|
|
95
|
+
emitProgress(opts.onProgress, { phase: 'server-extracting', message: 'Extracting verified server zip' });
|
|
96
|
+
const entries = parseZip(archive);
|
|
97
|
+
stageThenSwap(projectPath, serverDir, (staging) => extractServerEntries(entries, staging));
|
|
98
|
+
const executablePath = resolveExecutable(serverDir, platform);
|
|
99
|
+
if (executablePath === null) {
|
|
100
|
+
throw new Error(`Server zip extracted but no ${serverExecutableFileName(platform)} was found under ${serverDir} — the archive is not a valid server release.`);
|
|
101
|
+
}
|
|
102
|
+
makeExecutable(executablePath, platform);
|
|
103
|
+
emitProgress(opts.onProgress, {
|
|
104
|
+
phase: 'server-materialized',
|
|
105
|
+
message: `Downloaded + verified server to ${serverDir}`,
|
|
106
|
+
serverDir,
|
|
107
|
+
source: 'download',
|
|
108
|
+
});
|
|
109
|
+
return {
|
|
110
|
+
kind: 'success',
|
|
111
|
+
success: true,
|
|
112
|
+
source: 'download',
|
|
113
|
+
rid,
|
|
114
|
+
version,
|
|
115
|
+
serverDir,
|
|
116
|
+
executablePath,
|
|
117
|
+
downloadUrl: url,
|
|
118
|
+
warnings,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function installFromLocal(projectPath, serverDir, source, platform, warnings, onProgress) {
|
|
122
|
+
const resolved = path.resolve(source);
|
|
123
|
+
if (!fs.existsSync(resolved)) {
|
|
124
|
+
throw new Error(`--server-source ${resolved} does not exist.`);
|
|
125
|
+
}
|
|
126
|
+
emitProgress(onProgress, { phase: 'server-extracting', message: `Installing server from ${resolved}` });
|
|
127
|
+
const stat = fs.statSync(resolved);
|
|
128
|
+
if (stat.isFile() && resolved.toLowerCase().endsWith('.zip')) {
|
|
129
|
+
const entries = parseZip(fs.readFileSync(resolved));
|
|
130
|
+
stageThenSwap(projectPath, serverDir, (staging) => extractServerEntries(entries, staging));
|
|
131
|
+
}
|
|
132
|
+
else if (stat.isDirectory()) {
|
|
133
|
+
stageThenSwap(projectPath, serverDir, (staging) => {
|
|
134
|
+
fs.cpSync(resolved, staging, { recursive: true });
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new Error(`--server-source ${resolved} must be a directory or a .zip archive.`);
|
|
139
|
+
}
|
|
140
|
+
const executablePath = resolveExecutable(serverDir, platform);
|
|
141
|
+
if (executablePath === null) {
|
|
142
|
+
throw new Error(`--server-source ${resolved} did not yield a ${serverExecutableFileName(platform)} under ${serverDir}.`);
|
|
143
|
+
}
|
|
144
|
+
makeExecutable(executablePath, platform);
|
|
145
|
+
emitProgress(onProgress, {
|
|
146
|
+
phase: 'server-materialized',
|
|
147
|
+
message: `Copied server from ${resolved}`,
|
|
148
|
+
serverDir,
|
|
149
|
+
source: 'local',
|
|
150
|
+
});
|
|
151
|
+
return {
|
|
152
|
+
kind: 'success',
|
|
153
|
+
success: true,
|
|
154
|
+
source: 'local',
|
|
155
|
+
rid: detectHostRid(),
|
|
156
|
+
version: '',
|
|
157
|
+
serverDir,
|
|
158
|
+
executablePath,
|
|
159
|
+
warnings,
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Write every zip entry into `staging` (no `addons/` prefix stripping — the
|
|
164
|
+
* server zip expands to the binary + deps at the archive root). Path-safety:
|
|
165
|
+
* reject zip-slip `../` traversal escaping the staging dir.
|
|
166
|
+
*/
|
|
167
|
+
function extractServerEntries(entries, staging) {
|
|
168
|
+
for (const entry of entries) {
|
|
169
|
+
if (entry.path === '')
|
|
170
|
+
continue;
|
|
171
|
+
const target = path.resolve(staging, entry.path);
|
|
172
|
+
if (target !== staging && !target.startsWith(staging + path.sep)) {
|
|
173
|
+
throw new Error(`Refusing to extract entry escaping the server dir: ${entry.path}`);
|
|
174
|
+
}
|
|
175
|
+
if (entry.isDirectory) {
|
|
176
|
+
fs.mkdirSync(target, { recursive: true });
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
fs.mkdirSync(path.dirname(target), { recursive: true });
|
|
180
|
+
fs.writeFileSync(target, entry.bytes);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/** Locate the server executable at the managed-dir root, else one level down. Null when absent. */
|
|
184
|
+
function resolveExecutable(serverDir, platform) {
|
|
185
|
+
const exeName = serverExecutableFileName(platform);
|
|
186
|
+
const atRoot = path.join(serverDir, exeName);
|
|
187
|
+
if (fs.existsSync(atRoot))
|
|
188
|
+
return atRoot;
|
|
189
|
+
// Self-contained builds sometimes nest under a single top dir; search one level.
|
|
190
|
+
let children;
|
|
191
|
+
try {
|
|
192
|
+
children = fs.readdirSync(serverDir);
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
for (const child of children) {
|
|
198
|
+
const candidate = path.join(serverDir, child, exeName);
|
|
199
|
+
if (fs.existsSync(candidate))
|
|
200
|
+
return candidate;
|
|
201
|
+
}
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
/** Mark the executable runnable on POSIX (no-op on Windows). Best-effort. */
|
|
205
|
+
function makeExecutable(executablePath, platform) {
|
|
206
|
+
if (platform === 'win32')
|
|
207
|
+
return;
|
|
208
|
+
try {
|
|
209
|
+
fs.chmodSync(executablePath, 0o755);
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// Best-effort; never fail the install over a chmod.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Fill a fresh staging sibling, then atomically swap it into `serverDir`. A mid-
|
|
217
|
+
* fill failure discards staging and leaves any existing managed server untouched.
|
|
218
|
+
*/
|
|
219
|
+
function stageThenSwap(projectPath, serverDir, fill) {
|
|
220
|
+
const serverReal = path.resolve(serverDir);
|
|
221
|
+
const staging = path.resolve(projectPath, `.gamedev-server-staging-${process.pid}-${Date.now()}`);
|
|
222
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
223
|
+
fs.mkdirSync(staging, { recursive: true });
|
|
224
|
+
try {
|
|
225
|
+
fill(staging);
|
|
226
|
+
fs.rmSync(serverReal, { recursive: true, force: true });
|
|
227
|
+
fs.mkdirSync(path.dirname(serverReal), { recursive: true });
|
|
228
|
+
fs.renameSync(staging, serverReal);
|
|
229
|
+
}
|
|
230
|
+
finally {
|
|
231
|
+
fs.rmSync(staging, { recursive: true, force: true });
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
//# sourceMappingURL=install-server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install-server.js","sourceRoot":"","sources":["../../src/lib/install-server.ts"],"names":[],"mappings":"AAAA,O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,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,2BAA2B,OAAO,CAAC,GAAG,IAAI,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAClG,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACrD,EAAE,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC;QACH,IAAI,CAAC,OAAO,CAAC,CAAC;QACd,EAAE,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC;IACrC,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,CAAC;AACH,CAAC"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -26,6 +26,28 @@ export type ProgressEvent = {
|
|
|
26
26
|
phase: 'csproj-patched';
|
|
27
27
|
message: string;
|
|
28
28
|
csprojPath: string;
|
|
29
|
+
} | {
|
|
30
|
+
phase: 'server-downloading';
|
|
31
|
+
message: string;
|
|
32
|
+
url: string;
|
|
33
|
+
} | {
|
|
34
|
+
phase: 'server-verifying';
|
|
35
|
+
message: string;
|
|
36
|
+
} | {
|
|
37
|
+
phase: 'server-extracting';
|
|
38
|
+
message: string;
|
|
39
|
+
} | {
|
|
40
|
+
phase: 'server-materialized';
|
|
41
|
+
message: string;
|
|
42
|
+
serverDir: string;
|
|
43
|
+
source: 'download' | 'local';
|
|
44
|
+
} | {
|
|
45
|
+
phase: 'enroll-redeeming';
|
|
46
|
+
message: string;
|
|
47
|
+
} | {
|
|
48
|
+
phase: 'enroll-redeemed';
|
|
49
|
+
message: string;
|
|
50
|
+
serverTarget: string;
|
|
29
51
|
} | {
|
|
30
52
|
phase: 'project-scaffolded';
|
|
31
53
|
message: string;
|
|
@@ -476,3 +498,119 @@ export interface InstallExtensionFailure {
|
|
|
476
498
|
error: Error;
|
|
477
499
|
}
|
|
478
500
|
export type InstallExtensionResult = InstallExtensionSuccess | InstallExtensionFailure;
|
|
501
|
+
export interface InstallServerOptions {
|
|
502
|
+
/** Absolute or relative path to the Godot project root (holds the managed server dir). */
|
|
503
|
+
godotProjectPath: string;
|
|
504
|
+
/**
|
|
505
|
+
* Local path to install the server from instead of downloading it (offline /
|
|
506
|
+
* dev / CI — the `--server-source` flag). May be a directory containing the
|
|
507
|
+
* server binary, or a `.zip` archive of one. When set, no network call is made
|
|
508
|
+
* and no checksum is verified (the local artifact is trusted).
|
|
509
|
+
*/
|
|
510
|
+
source?: string;
|
|
511
|
+
/**
|
|
512
|
+
* Shared-server version to download (`v<version>` release on GameDev-MCP-Server).
|
|
513
|
+
* Defaults to the addon's pinned `ServerVersion`. Ignored when `source` is set.
|
|
514
|
+
*/
|
|
515
|
+
version?: string;
|
|
516
|
+
/** Host RID override (`<os>-<arch>`). Defaults to the detected host RID. */
|
|
517
|
+
rid?: string;
|
|
518
|
+
/** Injectable fetch for tests (mock the GitHub download). Used only on the download path. */
|
|
519
|
+
fetchImpl?: typeof fetch;
|
|
520
|
+
onProgress?: ProgressCallback;
|
|
521
|
+
}
|
|
522
|
+
export interface InstallServerSuccess {
|
|
523
|
+
kind: 'success';
|
|
524
|
+
success: true;
|
|
525
|
+
/** Where the server binary came from. */
|
|
526
|
+
source: 'download' | 'local';
|
|
527
|
+
/** The host RID the binary was resolved for. */
|
|
528
|
+
rid: string;
|
|
529
|
+
/** The downloaded server version (empty on the local path). */
|
|
530
|
+
version: string;
|
|
531
|
+
/** Absolute path to the CLI-managed server directory the binary was extracted into. */
|
|
532
|
+
serverDir: string;
|
|
533
|
+
/** Absolute path to the resolved server executable. */
|
|
534
|
+
executablePath: string;
|
|
535
|
+
/** The download URL used (download path only). */
|
|
536
|
+
downloadUrl?: string;
|
|
537
|
+
warnings: string[];
|
|
538
|
+
}
|
|
539
|
+
export interface InstallServerFailure {
|
|
540
|
+
kind: 'failure';
|
|
541
|
+
success: false;
|
|
542
|
+
warnings: string[];
|
|
543
|
+
error: Error;
|
|
544
|
+
}
|
|
545
|
+
export type InstallServerResult = InstallServerSuccess | InstallServerFailure;
|
|
546
|
+
export interface EnrollPluginOptions {
|
|
547
|
+
/** Absolute or relative path to the Godot project root (holds the project marker). */
|
|
548
|
+
godotProjectPath: string;
|
|
549
|
+
/** The D13 enrollment code to redeem. */
|
|
550
|
+
code: string;
|
|
551
|
+
/** Cloud AS base URL to redeem against (default https://ai-game.dev). */
|
|
552
|
+
baseUrl?: string;
|
|
553
|
+
/** Override the machine credential store directory (tests only). */
|
|
554
|
+
storeBaseDir?: string;
|
|
555
|
+
/** Injectable fetch for the redeem round-trip (tests). */
|
|
556
|
+
fetchImpl?: typeof fetch;
|
|
557
|
+
onProgress?: ProgressCallback;
|
|
558
|
+
}
|
|
559
|
+
export interface EnrollPluginSuccess {
|
|
560
|
+
kind: 'success';
|
|
561
|
+
success: true;
|
|
562
|
+
/** The server target the enrollment code was minted for (recorded in the marker). */
|
|
563
|
+
serverTarget: string;
|
|
564
|
+
/** The D14 routing pin recorded in the marker. */
|
|
565
|
+
pin: string;
|
|
566
|
+
/** The deterministic local port recorded for a localhost target (undefined for a hosted target). */
|
|
567
|
+
port?: number;
|
|
568
|
+
/** Absolute path to the machine credential store the plugin credential was written to. */
|
|
569
|
+
credentialsPath: string;
|
|
570
|
+
/** Absolute path to the project marker written. */
|
|
571
|
+
markerPath: string;
|
|
572
|
+
/** Absolute paths of any existing project-local agent configs whose URL was pin-upserted. */
|
|
573
|
+
pinnedConfigs: string[];
|
|
574
|
+
warnings: string[];
|
|
575
|
+
}
|
|
576
|
+
export interface EnrollPluginFailure {
|
|
577
|
+
kind: 'failure';
|
|
578
|
+
success: false;
|
|
579
|
+
warnings: string[];
|
|
580
|
+
error: Error;
|
|
581
|
+
}
|
|
582
|
+
export type EnrollPluginResult = EnrollPluginSuccess | EnrollPluginFailure;
|
|
583
|
+
export interface ConfigureAgentOptions {
|
|
584
|
+
/** Absolute or relative path to the Godot project root (locates the managed server binary + is the config target). */
|
|
585
|
+
godotProjectPath: string;
|
|
586
|
+
/** The agent id to configure (forwarded verbatim to the server binary's `configure --agent`). */
|
|
587
|
+
agentId: string;
|
|
588
|
+
/** Explicit MCP server URL override (forwarded as `--url`). */
|
|
589
|
+
url?: string;
|
|
590
|
+
/** Injectable `child_process.spawn` for tests (mock the server binary). */
|
|
591
|
+
spawnImpl?: typeof import('child_process').spawn;
|
|
592
|
+
onProgress?: ProgressCallback;
|
|
593
|
+
}
|
|
594
|
+
export interface ConfigureAgentSuccess {
|
|
595
|
+
kind: 'success';
|
|
596
|
+
success: true;
|
|
597
|
+
agentId: string;
|
|
598
|
+
/** Absolute path to the managed server binary that was proxied to. */
|
|
599
|
+
serverBinaryPath: string;
|
|
600
|
+
/** The argv passed to the server binary (after the executable), for diagnostics. */
|
|
601
|
+
args: string[];
|
|
602
|
+
/** The server binary's exit code (0 on success). */
|
|
603
|
+
exitCode: number;
|
|
604
|
+
/** The server binary's captured stdout+stderr (surfaced to the user by the command). */
|
|
605
|
+
output: string;
|
|
606
|
+
warnings: string[];
|
|
607
|
+
}
|
|
608
|
+
export interface ConfigureAgentFailure {
|
|
609
|
+
kind: 'failure';
|
|
610
|
+
success: false;
|
|
611
|
+
/** The server binary's exit code when it ran and failed; undefined when it could not be launched. */
|
|
612
|
+
exitCode?: number;
|
|
613
|
+
warnings: string[];
|
|
614
|
+
error: Error;
|
|
615
|
+
}
|
|
616
|
+
export type ConfigureAgentResult = ConfigureAgentSuccess | ConfigureAgentFailure;
|
package/dist/lib.d.ts
CHANGED
|
@@ -6,6 +6,9 @@ export { setupMcp, listAgentIds } from './lib/setup-mcp.js';
|
|
|
6
6
|
export { setupSkills } from './lib/setup-skills.js';
|
|
7
7
|
export { installPlugin, removePlugin } from './lib/install-plugin.js';
|
|
8
8
|
export { installExtension } from './lib/install-extension.js';
|
|
9
|
+
export { installServer } from './lib/install-server.js';
|
|
10
|
+
export { enrollPlugin } from './lib/enroll.js';
|
|
11
|
+
export { configureAgentViaServer } from './lib/configure-agent.js';
|
|
9
12
|
export { EXTENSIONS_CATALOG, findExtension, hasVersion } from './utils/extensions-catalog.js';
|
|
10
13
|
export type { ExtensionDescriptor, ExtensionTool } from './utils/extensions-catalog.js';
|
|
11
|
-
export type { ProgressEvent, ProgressCallback, ResultKind, OpenProjectOptions, OpenProjectResult, OpenProjectSuccess, OpenProjectFailure, OpenProjectAuthOption, OpenProjectConnectionMode, BuildProjectOptions, BuildProjectResult, BuildProjectSuccess, BuildProjectFailure, BuildSkipReason, CreateProjectOptions, CreateProjectResult, CreateProjectSuccess, CreateProjectFailure, RunToolOptions, RunToolResult, RunToolSuccess, RunToolFailure, RunToolFailureReason, RunSystemToolOptions, RunSystemToolResult, RunSystemToolSuccess, RunSystemToolFailure, SetupMcpOptions, SetupMcpResult, SetupMcpSuccess, SetupMcpFailure, SetupSkillsOptions, SetupSkillsResult, SetupSkillsSuccess, SetupSkillsFailure, InstallPluginOptions, InstallPluginResult, InstallPluginSuccess, InstallPluginFailure, AddonMaterializeOutcome, CsprojPatchOutcome, RemovePluginOptions, RemovePluginResult, RemovePluginSuccess, RemovePluginFailure, InstallExtensionOptions, InstallExtensionResult, InstallExtensionSuccess, InstallExtensionFailure, ExtensionInstallOutcome, } from './lib/types.js';
|
|
14
|
+
export type { ProgressEvent, ProgressCallback, ResultKind, OpenProjectOptions, OpenProjectResult, OpenProjectSuccess, OpenProjectFailure, OpenProjectAuthOption, OpenProjectConnectionMode, BuildProjectOptions, BuildProjectResult, BuildProjectSuccess, BuildProjectFailure, BuildSkipReason, CreateProjectOptions, CreateProjectResult, CreateProjectSuccess, CreateProjectFailure, RunToolOptions, RunToolResult, RunToolSuccess, RunToolFailure, RunToolFailureReason, RunSystemToolOptions, RunSystemToolResult, RunSystemToolSuccess, RunSystemToolFailure, SetupMcpOptions, SetupMcpResult, SetupMcpSuccess, SetupMcpFailure, SetupSkillsOptions, SetupSkillsResult, SetupSkillsSuccess, SetupSkillsFailure, InstallPluginOptions, InstallPluginResult, InstallPluginSuccess, InstallPluginFailure, AddonMaterializeOutcome, CsprojPatchOutcome, RemovePluginOptions, RemovePluginResult, RemovePluginSuccess, RemovePluginFailure, InstallExtensionOptions, InstallExtensionResult, InstallExtensionSuccess, InstallExtensionFailure, ExtensionInstallOutcome, InstallServerOptions, InstallServerResult, InstallServerSuccess, InstallServerFailure, EnrollPluginOptions, EnrollPluginResult, EnrollPluginSuccess, EnrollPluginFailure, ConfigureAgentOptions, ConfigureAgentResult, ConfigureAgentSuccess, ConfigureAgentFailure, } from './lib/types.js';
|
package/dist/lib.js
CHANGED
|
@@ -20,6 +20,9 @@ export { setupMcp, listAgentIds } from './lib/setup-mcp.js';
|
|
|
20
20
|
export { setupSkills } from './lib/setup-skills.js';
|
|
21
21
|
export { installPlugin, removePlugin } from './lib/install-plugin.js';
|
|
22
22
|
export { installExtension } from './lib/install-extension.js';
|
|
23
|
+
export { installServer } from './lib/install-server.js';
|
|
24
|
+
export { enrollPlugin } from './lib/enroll.js';
|
|
25
|
+
export { configureAgentViaServer } from './lib/configure-agent.js';
|
|
23
26
|
// Shared extension catalog (single-sourced from addons/godot_mcp/extensions.catalog.json)
|
|
24
27
|
// + its lookup helpers, so the app can render the same list the dock + CLI install from.
|
|
25
28
|
export { EXTENSIONS_CATALOG, findExtension, hasVersion } from './utils/extensions-catalog.js';
|
package/dist/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,eAAe;AACf,+EAA+E;AAC/E,wDAAwD;AACxD,oDAAoD;AACpD,yEAAyE;AACzE,4DAA4D;AAC5D,+EAA+E;AAC/E,gEAAgE;AAChE,6EAA6E;AAC7E,EAAE;AACF,0EAA0E;AAC1E,4CAA4C;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../src/lib.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,EAAE;AACF,eAAe;AACf,+EAA+E;AAC/E,wDAAwD;AACxD,oDAAoD;AACpD,yEAAyE;AACzE,4DAA4D;AAC5D,+EAA+E;AAC/E,gEAAgE;AAChE,6EAA6E;AAC7E,EAAE;AACF,0EAA0E;AAC1E,4CAA4C;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,0FAA0F;AAC1F,yFAAyF;AACzF,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/utils/addon-deps.js
CHANGED
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
* addon csproj (ReflectorNet first, then McpPlugin).
|
|
20
20
|
*/
|
|
21
21
|
export const ADDON_PACKAGE_REFERENCES = [
|
|
22
|
-
{ id: 'com.IvanMurzak.ReflectorNet', version: '5.3.
|
|
23
|
-
{ id: 'com.IvanMurzak.McpPlugin', version: '
|
|
22
|
+
{ id: 'com.IvanMurzak.ReflectorNet', version: '5.3.2' },
|
|
23
|
+
{ id: 'com.IvanMurzak.McpPlugin', version: '7.0.0' },
|
|
24
24
|
];
|
|
25
25
|
/**
|
|
26
26
|
* The exact `<EmbeddedResource>`s the consumer's project `.csproj` needs, single-sourced
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addon-deps.js","sourceRoot":"","sources":["../../src/utils/addon-deps.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,mFAAmF;AACnF,oEAAoE;AACpE,8EAA8E;AAC9E,yEAAyE;AACzE,EAAE;AACF,6EAA6E;AAC7E,kFAAkF;AAClF,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,iFAAiF;AACjF,+CAA+C;AAC/C,EAAE;AACF,sEAAsE;AAwBtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAqC;IACxE,EAAE,EAAE,EAAE,6BAA6B,EAAE,OAAO,EAAE,OAAO,EAAE;IACvD,EAAE,EAAE,EAAE,0BAA0B,EAAE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"addon-deps.js","sourceRoot":"","sources":["../../src/utils/addon-deps.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,mFAAmF;AACnF,oEAAoE;AACpE,8EAA8E;AAC9E,yEAAyE;AACzE,EAAE;AACF,6EAA6E;AAC7E,kFAAkF;AAClF,8EAA8E;AAC9E,4EAA4E;AAC5E,iFAAiF;AACjF,iFAAiF;AACjF,+CAA+C;AAC/C,EAAE;AACF,sEAAsE;AAwBtE;;;;GAIG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAqC;IACxE,EAAE,EAAE,EAAE,6BAA6B,EAAE,OAAO,EAAE,OAAO,EAAE;IACvD,EAAE,EAAE,EAAE,0BAA0B,EAAE,OAAO,EAAE,OAAO,EAAE;CAC5C,CAAC;AAEX;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAqC;IACxE;QACE,OAAO,EAAE,0CAA0C;QACnD,WAAW,EAAE,mCAAmC;KACjD;CACO,CAAC;AAEX,wFAAwF;AACxF,MAAM,CAAC,MAAM,yBAAyB,GAAG,mCAAmC,CAAC"}
|
|
@@ -1,4 +1,20 @@
|
|
|
1
1
|
import { type DeviceAuthDeps } from './auth.js';
|
|
2
|
+
/**
|
|
3
|
+
* Where a successful `login` persists the credential.
|
|
4
|
+
*
|
|
5
|
+
* - `machine` (the default) → the shared per-machine store `~/.ai-game-dev/credentials.json`
|
|
6
|
+
* (0600 on POSIX / DPAPI on Windows), so the engine plugin auto-adopts it — sign in once per
|
|
7
|
+
* machine (design 06 · D12). `storeBaseDir` overrides the store directory (tests only).
|
|
8
|
+
* - `project` → the legacy project-local override `<projectPath>/.godot-mcp/credentials.json`
|
|
9
|
+
* (gitignored), kept for per-project accounts (the `--project` flag).
|
|
10
|
+
*/
|
|
11
|
+
export type CredentialSink = {
|
|
12
|
+
kind: 'machine';
|
|
13
|
+
storeBaseDir?: string;
|
|
14
|
+
} | {
|
|
15
|
+
kind: 'project';
|
|
16
|
+
projectPath: string;
|
|
17
|
+
};
|
|
2
18
|
export interface CloudLoginOptions {
|
|
3
19
|
/** Cloud base URL to authenticate against (default https://ai-game.dev). */
|
|
4
20
|
baseUrl?: string;
|
|
@@ -8,12 +24,14 @@ export interface CloudLoginOptions {
|
|
|
8
24
|
openBrowserImpl?: (url: string) => void;
|
|
9
25
|
/** Device-flow dependency injection (fetch/sleep/clock) for tests. */
|
|
10
26
|
authDeps?: DeviceAuthDeps;
|
|
27
|
+
/** Where to persist the credential. Defaults to the shared machine store. */
|
|
28
|
+
sink?: CredentialSink;
|
|
11
29
|
}
|
|
12
30
|
/**
|
|
13
|
-
* Run the cloud device-auth flow: initiate, display the user code, open the
|
|
14
|
-
*
|
|
15
|
-
*
|
|
31
|
+
* Run the cloud device-auth flow: initiate, display the user code, open the browser, poll to
|
|
32
|
+
* completion, and persist the token to the resolved {@link CredentialSink} (the shared machine store
|
|
33
|
+
* by default; the project-local override when `--project` is used).
|
|
16
34
|
*
|
|
17
35
|
* Returns the access token on success, or null on failure (errors are printed).
|
|
18
36
|
*/
|
|
19
|
-
export declare function runCloudLogin(
|
|
37
|
+
export declare function runCloudLogin(options?: CloudLoginOptions): Promise<string | null>;
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import * as ui from './ui.js';
|
|
2
2
|
import { DEFAULT_CLOUD_BASE_URL } from './connection.js';
|
|
3
3
|
import { readCredentials, writeCredentials } from './credentials.js';
|
|
4
|
+
import { readMachineCredentials, writeMachineCredentials } from './machine-credentials.js';
|
|
4
5
|
import { deviceAuthFlow } from './auth.js';
|
|
5
6
|
import { openBrowser } from './browser.js';
|
|
6
7
|
/**
|
|
7
|
-
* Run the cloud device-auth flow: initiate, display the user code, open the
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Run the cloud device-auth flow: initiate, display the user code, open the browser, poll to
|
|
9
|
+
* completion, and persist the token to the resolved {@link CredentialSink} (the shared machine store
|
|
10
|
+
* by default; the project-local override when `--project` is used).
|
|
10
11
|
*
|
|
11
12
|
* Returns the access token on success, or null on failure (errors are printed).
|
|
12
13
|
*/
|
|
13
|
-
export async function runCloudLogin(
|
|
14
|
+
export async function runCloudLogin(options = {}) {
|
|
14
15
|
const baseUrl = (options.baseUrl ?? DEFAULT_CLOUD_BASE_URL).replace(/\/$/, '');
|
|
15
16
|
const clientLabel = options.clientLabel ?? 'Godot-MCP CLI';
|
|
16
17
|
const openBrowserImpl = options.openBrowserImpl ?? openBrowser;
|
|
18
|
+
const sink = options.sink ?? { kind: 'machine' };
|
|
17
19
|
let spinner;
|
|
18
20
|
try {
|
|
19
21
|
const result = await deviceAuthFlow(baseUrl, clientLabel, {
|
|
@@ -31,19 +33,7 @@ export async function runCloudLogin(projectPath, options = {}) {
|
|
|
31
33
|
}, options.authDeps);
|
|
32
34
|
if (result.success) {
|
|
33
35
|
spinner?.success('Authorized');
|
|
34
|
-
|
|
35
|
-
let existing = {};
|
|
36
|
-
try {
|
|
37
|
-
existing = readCredentials(projectPath) ?? {};
|
|
38
|
-
}
|
|
39
|
-
catch {
|
|
40
|
-
existing = {};
|
|
41
|
-
}
|
|
42
|
-
writeCredentials(projectPath, {
|
|
43
|
-
...existing,
|
|
44
|
-
cloudToken: result.accessToken,
|
|
45
|
-
cloudBaseUrl: baseUrl,
|
|
46
|
-
});
|
|
36
|
+
persistCredential(sink, result.accessToken, baseUrl);
|
|
47
37
|
return result.accessToken;
|
|
48
38
|
}
|
|
49
39
|
spinner?.stop();
|
|
@@ -62,4 +52,37 @@ export async function runCloudLogin(projectPath, options = {}) {
|
|
|
62
52
|
return null;
|
|
63
53
|
}
|
|
64
54
|
}
|
|
55
|
+
function persistCredential(sink, accessToken, baseUrl) {
|
|
56
|
+
if (sink.kind === 'project') {
|
|
57
|
+
// A corrupt existing credentials file must not block a fresh login.
|
|
58
|
+
let existing = {};
|
|
59
|
+
try {
|
|
60
|
+
existing = readCredentials(sink.projectPath) ?? {};
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
existing = {};
|
|
64
|
+
}
|
|
65
|
+
writeCredentials(sink.projectPath, {
|
|
66
|
+
...existing,
|
|
67
|
+
cloudToken: accessToken,
|
|
68
|
+
cloudBaseUrl: baseUrl,
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
// Machine store: preserve any stored identity/refresh fields, replacing the token material and
|
|
73
|
+
// recording the server target the credential was issued for.
|
|
74
|
+
let existing = {};
|
|
75
|
+
try {
|
|
76
|
+
existing = readMachineCredentials(sink.storeBaseDir) ?? {};
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
existing = {};
|
|
80
|
+
}
|
|
81
|
+
writeMachineCredentials({
|
|
82
|
+
...existing,
|
|
83
|
+
version: 1,
|
|
84
|
+
accessToken,
|
|
85
|
+
serverTarget: baseUrl,
|
|
86
|
+
}, sink.storeBaseDir);
|
|
87
|
+
}
|
|
65
88
|
//# sourceMappingURL=cloud-login.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cloud-login.js","sourceRoot":"","sources":["../../src/utils/cloud-login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,cAAc,EAAuB,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"cloud-login.js","sourceRoot":"","sources":["../../src/utils/cloud-login.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,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,EAAE,CAAC;QAChB,CAAC;QACD,gBAAgB,CAAC,IAAI,CAAC,WAAW,EAAE;YACjC,GAAG,QAAQ;YACX,UAAU,EAAE,WAAW;YACvB,YAAY,EAAE,OAAO;SACtB,CAAC,CAAC;QACH,OAAO;IACT,CAAC;IAED,+FAA+F;IAC/F,6DAA6D;IAC7D,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,CAAC;QACH,QAAQ,GAAG,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,QAAQ,GAAG,EAAE,CAAC;IAChB,CAAC;IACD,uBAAuB,CACrB;QACE,GAAG,QAAQ;QACX,OAAO,EAAE,CAAC;QACV,WAAW;QACX,YAAY,EAAE,OAAO;KACtB,EACD,IAAI,CAAC,YAAY,CAClB,CAAC;AACJ,CAAC"}
|
|
@@ -44,13 +44,10 @@ export declare function resolveAndValidateProjectPath(positionalPath: string | u
|
|
|
44
44
|
* Token priority:
|
|
45
45
|
* 1. --token flag (explicit override)
|
|
46
46
|
* 2. GODOT_MCP_TOKEN env
|
|
47
|
-
* 3. persisted cloud token
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* the Godot plugin is a server-less client whose live config lives in `user://`
|
|
52
|
-
* (outside the project tree). The one project-local surface the CLI DOES own is
|
|
53
|
-
* the `login`-written credentials file, consulted last so `--token`/env still win.
|
|
47
|
+
* 3. persisted cloud token (Cloud mode only) — the project-local
|
|
48
|
+
* `.godot-mcp/credentials.json` (a `--project` login) first, then the shared machine
|
|
49
|
+
* store `~/.ai-game-dev/credentials.json` (a default `godot-cli login`), so a
|
|
50
|
+
* sign-once-per-machine credential is picked up here too.
|
|
54
51
|
*/
|
|
55
52
|
export declare function resolveConnection(projectPath: string, options: ConnectionOptions): {
|
|
56
53
|
url: string;
|