@autodevjapan/godd-mcp-alpha 0.19.0 → 0.20.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/godd.cjs +391 -168
- package/package.json +1 -1
package/dist/godd.cjs
CHANGED
|
@@ -2981,7 +2981,7 @@ var require_compile = __commonJS({
|
|
|
2981
2981
|
const schOrFunc = root.refs[ref];
|
|
2982
2982
|
if (schOrFunc)
|
|
2983
2983
|
return schOrFunc;
|
|
2984
|
-
let _sch =
|
|
2984
|
+
let _sch = resolve4.call(this, root, ref);
|
|
2985
2985
|
if (_sch === void 0) {
|
|
2986
2986
|
const schema = (_a2 = root.localRefs) === null || _a2 === void 0 ? void 0 : _a2[ref];
|
|
2987
2987
|
const { schemaId } = this.opts;
|
|
@@ -3008,7 +3008,7 @@ var require_compile = __commonJS({
|
|
|
3008
3008
|
function sameSchemaEnv(s1, s2) {
|
|
3009
3009
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3010
3010
|
}
|
|
3011
|
-
function
|
|
3011
|
+
function resolve4(root, ref) {
|
|
3012
3012
|
let sch;
|
|
3013
3013
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3014
3014
|
ref = sch;
|
|
@@ -3583,7 +3583,7 @@ var require_fast_uri = __commonJS({
|
|
|
3583
3583
|
}
|
|
3584
3584
|
return uri;
|
|
3585
3585
|
}
|
|
3586
|
-
function
|
|
3586
|
+
function resolve4(baseURI, relativeURI, options) {
|
|
3587
3587
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3588
3588
|
const resolved = resolveComponent(parse3(baseURI, schemelessOptions), parse3(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3589
3589
|
schemelessOptions.skipEscape = true;
|
|
@@ -3810,7 +3810,7 @@ var require_fast_uri = __commonJS({
|
|
|
3810
3810
|
var fastUri = {
|
|
3811
3811
|
SCHEMES,
|
|
3812
3812
|
normalize,
|
|
3813
|
-
resolve:
|
|
3813
|
+
resolve: resolve4,
|
|
3814
3814
|
resolveComponent,
|
|
3815
3815
|
equal,
|
|
3816
3816
|
serialize,
|
|
@@ -26538,7 +26538,7 @@ var Protocol = class {
|
|
|
26538
26538
|
return;
|
|
26539
26539
|
}
|
|
26540
26540
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
26541
|
-
await new Promise((
|
|
26541
|
+
await new Promise((resolve4) => setTimeout(resolve4, pollInterval));
|
|
26542
26542
|
options?.signal?.throwIfAborted();
|
|
26543
26543
|
}
|
|
26544
26544
|
} catch (error48) {
|
|
@@ -26555,7 +26555,7 @@ var Protocol = class {
|
|
|
26555
26555
|
*/
|
|
26556
26556
|
request(request, resultSchema, options) {
|
|
26557
26557
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
26558
|
-
return new Promise((
|
|
26558
|
+
return new Promise((resolve4, reject) => {
|
|
26559
26559
|
const earlyReject = (error48) => {
|
|
26560
26560
|
reject(error48);
|
|
26561
26561
|
};
|
|
@@ -26633,7 +26633,7 @@ var Protocol = class {
|
|
|
26633
26633
|
if (!parseResult.success) {
|
|
26634
26634
|
reject(parseResult.error);
|
|
26635
26635
|
} else {
|
|
26636
|
-
|
|
26636
|
+
resolve4(parseResult.data);
|
|
26637
26637
|
}
|
|
26638
26638
|
} catch (error48) {
|
|
26639
26639
|
reject(error48);
|
|
@@ -26894,12 +26894,12 @@ var Protocol = class {
|
|
|
26894
26894
|
}
|
|
26895
26895
|
} catch {
|
|
26896
26896
|
}
|
|
26897
|
-
return new Promise((
|
|
26897
|
+
return new Promise((resolve4, reject) => {
|
|
26898
26898
|
if (signal.aborted) {
|
|
26899
26899
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
26900
26900
|
return;
|
|
26901
26901
|
}
|
|
26902
|
-
const timeoutId = setTimeout(
|
|
26902
|
+
const timeoutId = setTimeout(resolve4, interval);
|
|
26903
26903
|
signal.addEventListener("abort", () => {
|
|
26904
26904
|
clearTimeout(timeoutId);
|
|
26905
26905
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -27769,12 +27769,12 @@ var StdioServerTransport = class {
|
|
|
27769
27769
|
this.onclose?.();
|
|
27770
27770
|
}
|
|
27771
27771
|
send(message) {
|
|
27772
|
-
return new Promise((
|
|
27772
|
+
return new Promise((resolve4) => {
|
|
27773
27773
|
const json2 = serializeMessage(message);
|
|
27774
27774
|
if (this._stdout.write(json2)) {
|
|
27775
|
-
|
|
27775
|
+
resolve4();
|
|
27776
27776
|
} else {
|
|
27777
|
-
this._stdout.once("drain",
|
|
27777
|
+
this._stdout.once("drain", resolve4);
|
|
27778
27778
|
}
|
|
27779
27779
|
});
|
|
27780
27780
|
}
|
|
@@ -27828,6 +27828,7 @@ var ConfigSchema = external_exports3.object({
|
|
|
27828
27828
|
database: external_exports3.array(external_exports3.string()).default([]),
|
|
27829
27829
|
orm: external_exports3.array(external_exports3.string()).default([]),
|
|
27830
27830
|
infra: external_exports3.array(external_exports3.string()).default([]),
|
|
27831
|
+
game: external_exports3.array(external_exports3.string()).default([]),
|
|
27831
27832
|
other: external_exports3.array(external_exports3.string()).default([]),
|
|
27832
27833
|
tools: ToolsSchema.default({})
|
|
27833
27834
|
});
|
|
@@ -28079,6 +28080,20 @@ var KNOWN_INFRAS = /* @__PURE__ */ new Set([
|
|
|
28079
28080
|
"pulumi",
|
|
28080
28081
|
"netlify"
|
|
28081
28082
|
]);
|
|
28083
|
+
var KNOWN_GAME_ENGINES = /* @__PURE__ */ new Set([
|
|
28084
|
+
"godot",
|
|
28085
|
+
"phaser",
|
|
28086
|
+
"unity",
|
|
28087
|
+
"unreal",
|
|
28088
|
+
"bevy",
|
|
28089
|
+
"love2d",
|
|
28090
|
+
"monogame",
|
|
28091
|
+
"pygame",
|
|
28092
|
+
"libgdx",
|
|
28093
|
+
"cocos2d",
|
|
28094
|
+
"defold",
|
|
28095
|
+
"renpy"
|
|
28096
|
+
]);
|
|
28082
28097
|
function levenshtein(a, b) {
|
|
28083
28098
|
const la = a.length;
|
|
28084
28099
|
const lb = b.length;
|
|
@@ -28116,7 +28131,8 @@ var FIELD_KNOWN_MAP = [
|
|
|
28116
28131
|
{ field: "backend", known: KNOWN_BACKENDS },
|
|
28117
28132
|
{ field: "database", known: KNOWN_DATABASES },
|
|
28118
28133
|
{ field: "orm", known: KNOWN_ORMS },
|
|
28119
|
-
{ field: "infra", known: KNOWN_INFRAS }
|
|
28134
|
+
{ field: "infra", known: KNOWN_INFRAS },
|
|
28135
|
+
{ field: "game", known: KNOWN_GAME_ENGINES }
|
|
28120
28136
|
];
|
|
28121
28137
|
function validateConfigValues(config2) {
|
|
28122
28138
|
const issues = [];
|
|
@@ -28135,6 +28151,40 @@ function validateConfigValues(config2) {
|
|
|
28135
28151
|
}
|
|
28136
28152
|
return issues;
|
|
28137
28153
|
}
|
|
28154
|
+
var FIELD_DOCS = [
|
|
28155
|
+
{ field: "display_language", type: "string", description: "GoDD \u306E\u8868\u793A\u8A00\u8A9E\uFF08en / ja / ru\uFF09", values: ["en", "ja", "ru"] },
|
|
28156
|
+
{ field: "main_language", type: "string", description: "\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u306E\u30E1\u30A4\u30F3\u8A00\u8A9E\uFF08en / ja / ru\uFF09", values: ["en", "ja", "ru"] },
|
|
28157
|
+
{ field: "sub_languages", type: "string[]", description: "\u30C1\u30FC\u30E0\u306E\u30B5\u30D6\u8A00\u8A9E", values: ["en", "ja", "ru"] },
|
|
28158
|
+
{ field: "programming_languages", type: "string[]", description: "\u30D7\u30ED\u30B0\u30E9\u30DF\u30F3\u30B0\u8A00\u8A9E", values: [...KNOWN_PROGRAMMING_LANGUAGES] },
|
|
28159
|
+
{ field: "frontend", type: "string[]", description: "\u30D5\u30ED\u30F3\u30C8\u30A8\u30F3\u30C9\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF", values: [...KNOWN_FRONTENDS] },
|
|
28160
|
+
{ field: "backend", type: "string[]", description: "\u30D0\u30C3\u30AF\u30A8\u30F3\u30C9\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF", values: [...KNOWN_BACKENDS] },
|
|
28161
|
+
{ field: "database", type: "string[]", description: "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9", values: [...KNOWN_DATABASES] },
|
|
28162
|
+
{ field: "orm", type: "string[]", description: "ORM", values: [...KNOWN_ORMS] },
|
|
28163
|
+
{ field: "infra", type: "string[]", description: "\u30A4\u30F3\u30D5\u30E9", values: [...KNOWN_INFRAS] },
|
|
28164
|
+
{ field: "game", type: "string[]", description: "\u30B2\u30FC\u30E0\u30A8\u30F3\u30B8\u30F3 / \u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF", values: [...KNOWN_GAME_ENGINES] },
|
|
28165
|
+
{ field: "other", type: "string[]", description: "\u305D\u306E\u4ED6\uFF08\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u5BFE\u8C61\u5916\u3001\u81EA\u7531\u8A18\u8FF0\uFF09", values: [] }
|
|
28166
|
+
];
|
|
28167
|
+
function getKnownFieldNames() {
|
|
28168
|
+
return /* @__PURE__ */ new Set([
|
|
28169
|
+
...FIELD_DOCS.map((d) => d.field),
|
|
28170
|
+
"tools"
|
|
28171
|
+
]);
|
|
28172
|
+
}
|
|
28173
|
+
function getKnownValuesDocumentation() {
|
|
28174
|
+
const lines = [];
|
|
28175
|
+
for (const doc of FIELD_DOCS) {
|
|
28176
|
+
lines.push(`### ${doc.field} (${doc.type})`);
|
|
28177
|
+
lines.push(doc.description);
|
|
28178
|
+
if (doc.values.length > 0) {
|
|
28179
|
+
lines.push(`\u6709\u52B9\u5024: ${doc.values.join(", ")}`);
|
|
28180
|
+
}
|
|
28181
|
+
lines.push("");
|
|
28182
|
+
}
|
|
28183
|
+
lines.push("### tools (object)");
|
|
28184
|
+
lines.push("\u30C4\u30FC\u30EB\u8A2D\u5B9A\uFF08\u7701\u7565\u53EF\uFF09\u3002\u30AD\u30FC: vcs, browser_automation, e2e_testing, unit_testing, linting, formatting, type_checking, coverage, documentation, secret_scanning, security_analysis, unused_code, dependency_analysis");
|
|
28185
|
+
lines.push("");
|
|
28186
|
+
return lines.join("\n");
|
|
28187
|
+
}
|
|
28138
28188
|
var CONTACT_URL = "https://www.getgodd.dev/contact";
|
|
28139
28189
|
function formatConfigIssuesForAI(issues) {
|
|
28140
28190
|
const grouped = /* @__PURE__ */ new Map();
|
|
@@ -28166,7 +28216,7 @@ function formatConfigIssuesForAI(issues) {
|
|
|
28166
28216
|
}
|
|
28167
28217
|
|
|
28168
28218
|
// src/version.ts
|
|
28169
|
-
var VERSION = true ? "0.
|
|
28219
|
+
var VERSION = true ? "0.20.0" : "0.0.0-dev";
|
|
28170
28220
|
|
|
28171
28221
|
// src/tools/base.ts
|
|
28172
28222
|
var COMPOSITE_PROMPTS = {
|
|
@@ -28214,7 +28264,8 @@ var TOOL_ARGUMENTS = {
|
|
|
28214
28264
|
adr: [{ name: "title", description: "\u5224\u65AD\u306E\u30BF\u30A4\u30C8\u30EB", required: false }],
|
|
28215
28265
|
release: [{ name: "tag", description: "\u5BFE\u8C61\u30BF\u30B0\uFF08\u7701\u7565\u6642: \u76F4\u8FD1\u30EA\u30EA\u30FC\u30B9\u304B\u3089 HEAD\uFF09", required: false }],
|
|
28216
28266
|
setup: [{ name: "preset", description: "\u30B9\u30BF\u30C3\u30AF\u30D7\u30EA\u30BB\u30C3\u30C8\uFF08omakase = \u63A8\u5968\u69CB\u6210\uFF09", required: false }],
|
|
28217
|
-
github: [{ name: "request", description: "\u8A2D\u5B9A\u5185\u5BB9", required: false }]
|
|
28267
|
+
github: [{ name: "request", description: "\u8A2D\u5B9A\u5185\u5BB9", required: false }],
|
|
28268
|
+
config: []
|
|
28218
28269
|
};
|
|
28219
28270
|
function getAllPrompts() {
|
|
28220
28271
|
const p = brand.toolPrefix;
|
|
@@ -28233,9 +28284,11 @@ function getAllPrompts() {
|
|
|
28233
28284
|
{ name: `${p}deploy`, description: "\u30C7\u30D7\u30ED\u30A4\uFF08\u691C\u8A3C\u30FB\u30ED\u30FC\u30EB\u30D0\u30C3\u30AF\u8A08\u753B\u4ED8\u304D\uFF09" },
|
|
28234
28285
|
{ name: `${p}adr`, description: "ADR\uFF08Architecture Decision Record\uFF09\u4F5C\u6210" },
|
|
28235
28286
|
{ name: `${p}release`, description: "\u30EA\u30EA\u30FC\u30B9\u30CE\u30FC\u30C8\u751F\u6210\uFF08SemVer \u6E96\u62E0\uFF09" },
|
|
28236
|
-
{ name: `${p}github`, description: "GitHub \u8A2D\u5B9A\uFF08\u30EA\u30DD\u30B8\u30C8\u30EA/\u30D6\u30E9\u30F3\u30C1\u4FDD\u8B77\u7B49\uFF09" }
|
|
28287
|
+
{ name: `${p}github`, description: "GitHub \u8A2D\u5B9A\uFF08\u30EA\u30DD\u30B8\u30C8\u30EA/\u30D6\u30E9\u30F3\u30C1\u4FDD\u8B77\u7B49\uFF09" },
|
|
28288
|
+
{ name: `${p}config`, description: "config.godd \u3092\u6B63\u78BA\u306B\u751F\u6210\u30FB\u4FEE\u6B63\u3059\u308B\uFF08\u30B9\u30BF\u30C3\u30AF\u81EA\u52D5\u691C\u51FA + \u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\uFF09" }
|
|
28237
28289
|
];
|
|
28238
28290
|
}
|
|
28291
|
+
var LOCAL_SLUGS = /* @__PURE__ */ new Set(["config"]);
|
|
28239
28292
|
function getAllTools() {
|
|
28240
28293
|
const p = brand.toolPrefix;
|
|
28241
28294
|
return getAllPrompts().map((prompt) => {
|
|
@@ -28255,115 +28308,13 @@ function getAllTools() {
|
|
|
28255
28308
|
});
|
|
28256
28309
|
}
|
|
28257
28310
|
|
|
28258
|
-
// src/
|
|
28259
|
-
var import_node_fs2 = require("node:fs");
|
|
28260
|
-
var import_node_os = require("node:os");
|
|
28261
|
-
var import_node_path2 = require("node:path");
|
|
28262
|
-
function resolveRealPath(p) {
|
|
28263
|
-
try {
|
|
28264
|
-
return (0, import_node_fs2.realpathSync)(p);
|
|
28265
|
-
} catch {
|
|
28266
|
-
return p;
|
|
28267
|
-
}
|
|
28268
|
-
}
|
|
28269
|
-
var NPM_PACKAGE_NAME = "@autodevjapan/godd-mcp-alpha";
|
|
28270
|
-
function resolveNpxCliPath() {
|
|
28271
|
-
const nodeDir = (0, import_node_path2.join)(resolveRealPath(process.execPath), "..");
|
|
28272
|
-
const npxCliPath = (0, import_node_path2.join)(nodeDir, "node_modules", "npm", "bin", "npx-cli.js");
|
|
28273
|
-
return (0, import_node_fs2.existsSync)(npxCliPath) ? npxCliPath : null;
|
|
28274
|
-
}
|
|
28275
|
-
function resolveServerCommand() {
|
|
28276
|
-
if (typeof globalThis.__pkg !== "undefined" || process.pkg) {
|
|
28277
|
-
return { command: process.execPath, args: ["serve"] };
|
|
28278
|
-
}
|
|
28279
|
-
const nodeCommand = resolveRealPath(process.execPath);
|
|
28280
|
-
const npxCliPath = resolveNpxCliPath();
|
|
28281
|
-
if (npxCliPath) {
|
|
28282
|
-
return {
|
|
28283
|
-
command: nodeCommand,
|
|
28284
|
-
args: [npxCliPath, "-y", `${NPM_PACKAGE_NAME}@latest`, "serve"]
|
|
28285
|
-
};
|
|
28286
|
-
}
|
|
28287
|
-
const scriptPath = process.argv[1];
|
|
28288
|
-
if (scriptPath && (0, import_node_fs2.existsSync)(scriptPath)) {
|
|
28289
|
-
return { command: nodeCommand, args: [resolveRealPath(scriptPath), "serve"] };
|
|
28290
|
-
}
|
|
28291
|
-
return { command: nodeCommand, args: [scriptPath ?? "godd.cjs", "serve"] };
|
|
28292
|
-
}
|
|
28293
|
-
function readMcpConfig(mcpJsonPath) {
|
|
28294
|
-
if ((0, import_node_fs2.existsSync)(mcpJsonPath)) {
|
|
28295
|
-
try {
|
|
28296
|
-
const raw = (0, import_node_fs2.readFileSync)(mcpJsonPath, "utf-8");
|
|
28297
|
-
const parsed = JSON.parse(raw);
|
|
28298
|
-
return { mcpServers: parsed.mcpServers ?? {} };
|
|
28299
|
-
} catch {
|
|
28300
|
-
console.error(
|
|
28301
|
-
` [WARN] ${mcpJsonPath} \u304C\u58CA\u308C\u3066\u3044\u308B\u305F\u3081\u65B0\u898F\u4F5C\u6210\u3057\u307E\u3059`
|
|
28302
|
-
);
|
|
28303
|
-
}
|
|
28304
|
-
}
|
|
28305
|
-
return { mcpServers: {} };
|
|
28306
|
-
}
|
|
28307
|
-
function installMcpServer(licenseKey) {
|
|
28308
|
-
const cursorDir = (0, import_node_path2.join)((0, import_node_os.homedir)(), ".cursor");
|
|
28309
|
-
const mcpJsonPath = (0, import_node_path2.join)(cursorDir, "mcp.json");
|
|
28310
|
-
if (!(0, import_node_fs2.existsSync)(cursorDir)) {
|
|
28311
|
-
(0, import_node_fs2.mkdirSync)(cursorDir, { recursive: true });
|
|
28312
|
-
}
|
|
28313
|
-
const config2 = readMcpConfig(mcpJsonPath);
|
|
28314
|
-
const serverKey = brand.mcpKey;
|
|
28315
|
-
const { command, args } = resolveServerCommand();
|
|
28316
|
-
const existing = config2.mcpServers[serverKey];
|
|
28317
|
-
const env = {};
|
|
28318
|
-
if (licenseKey) {
|
|
28319
|
-
env.GODD_LICENSE_KEY = licenseKey;
|
|
28320
|
-
} else if (existing?.env?.GODD_LICENSE_KEY) {
|
|
28321
|
-
env.GODD_LICENSE_KEY = existing.env.GODD_LICENSE_KEY;
|
|
28322
|
-
}
|
|
28323
|
-
const nodeDir = (0, import_node_path2.dirname)(resolveRealPath(process.execPath));
|
|
28324
|
-
if (process.platform === "win32") {
|
|
28325
|
-
const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
|
|
28326
|
-
env.PATH = [
|
|
28327
|
-
nodeDir,
|
|
28328
|
-
(0, import_node_path2.join)(systemRoot, "system32"),
|
|
28329
|
-
systemRoot,
|
|
28330
|
-
(0, import_node_path2.join)(systemRoot, "System32", "Wbem")
|
|
28331
|
-
].join(import_node_path2.delimiter);
|
|
28332
|
-
} else {
|
|
28333
|
-
env.PATH = [nodeDir, "/usr/local/bin", "/usr/bin", "/bin"].join(import_node_path2.delimiter);
|
|
28334
|
-
}
|
|
28335
|
-
const newEntry = {
|
|
28336
|
-
command,
|
|
28337
|
-
args,
|
|
28338
|
-
...Object.keys(env).length > 0 ? { env } : {}
|
|
28339
|
-
};
|
|
28340
|
-
const isNew = !existing;
|
|
28341
|
-
const changed = isNew || JSON.stringify(existing) !== JSON.stringify(newEntry);
|
|
28342
|
-
if (changed) {
|
|
28343
|
-
config2.mcpServers[serverKey] = newEntry;
|
|
28344
|
-
(0, import_node_fs2.writeFileSync)(mcpJsonPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
28345
|
-
}
|
|
28346
|
-
const status = isNew ? "created" : changed ? "updated" : "unchanged";
|
|
28347
|
-
return { mcpJsonPath, status, serverKey };
|
|
28348
|
-
}
|
|
28349
|
-
function uninstallMcpServer() {
|
|
28350
|
-
const mcpJsonPath = (0, import_node_path2.join)((0, import_node_os.homedir)(), ".cursor", "mcp.json");
|
|
28351
|
-
if (!(0, import_node_fs2.existsSync)(mcpJsonPath)) {
|
|
28352
|
-
return { removed: false, mcpJsonPath };
|
|
28353
|
-
}
|
|
28354
|
-
const config2 = readMcpConfig(mcpJsonPath);
|
|
28355
|
-
const serverKey = brand.mcpKey;
|
|
28356
|
-
if (!config2.mcpServers[serverKey]) {
|
|
28357
|
-
return { removed: false, mcpJsonPath };
|
|
28358
|
-
}
|
|
28359
|
-
delete config2.mcpServers[serverKey];
|
|
28360
|
-
(0, import_node_fs2.writeFileSync)(mcpJsonPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
28361
|
-
return { removed: true, mcpJsonPath };
|
|
28362
|
-
}
|
|
28363
|
-
|
|
28364
|
-
// src/cli/init.ts
|
|
28311
|
+
// src/tools/config-tool.ts
|
|
28365
28312
|
var import_node_fs3 = require("node:fs");
|
|
28366
28313
|
var import_node_path3 = require("node:path");
|
|
28314
|
+
|
|
28315
|
+
// src/cli/init.ts
|
|
28316
|
+
var import_node_fs2 = require("node:fs");
|
|
28317
|
+
var import_node_path2 = require("node:path");
|
|
28367
28318
|
var import_node_readline = require("node:readline");
|
|
28368
28319
|
var import_node_child_process = require("node:child_process");
|
|
28369
28320
|
|
|
@@ -28384,6 +28335,7 @@ var en = {
|
|
|
28384
28335
|
selectDatabase: "Databases:",
|
|
28385
28336
|
selectOrm: "ORM:",
|
|
28386
28337
|
selectInfra: "Infrastructure:",
|
|
28338
|
+
selectGame: "Game engines / frameworks:",
|
|
28387
28339
|
toolRecommendationsTitle: "Recommended tools for your stack:",
|
|
28388
28340
|
toolInstallMode: "How would you like to install?",
|
|
28389
28341
|
toolInstallDefault: "Default (install all)",
|
|
@@ -28422,6 +28374,7 @@ var en = {
|
|
|
28422
28374
|
database: "Database",
|
|
28423
28375
|
orm: "ORM",
|
|
28424
28376
|
infra: "Infra",
|
|
28377
|
+
game: "Game",
|
|
28425
28378
|
pressEnterToClose: "Press Enter to close...",
|
|
28426
28379
|
unknownCommand: "Unknown command",
|
|
28427
28380
|
usage: "Usage:",
|
|
@@ -28458,6 +28411,7 @@ var ja = {
|
|
|
28458
28411
|
selectDatabase: "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9:",
|
|
28459
28412
|
selectOrm: "ORM:",
|
|
28460
28413
|
selectInfra: "\u30A4\u30F3\u30D5\u30E9:",
|
|
28414
|
+
selectGame: "\u30B2\u30FC\u30E0\u30A8\u30F3\u30B8\u30F3 / \u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF:",
|
|
28461
28415
|
toolRecommendationsTitle: "\u30B9\u30BF\u30C3\u30AF\u306B\u63A8\u5968\u3055\u308C\u308B\u30C4\u30FC\u30EB:",
|
|
28462
28416
|
toolInstallMode: "\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\u65B9\u6CD5\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044:",
|
|
28463
28417
|
toolInstallDefault: "\u30C7\u30D5\u30A9\u30EB\u30C8\uFF08\u3059\u3079\u3066\u30A4\u30F3\u30B9\u30C8\u30FC\u30EB\uFF09",
|
|
@@ -28496,6 +28450,7 @@ var ja = {
|
|
|
28496
28450
|
database: "\u30C7\u30FC\u30BF\u30D9\u30FC\u30B9",
|
|
28497
28451
|
orm: "ORM",
|
|
28498
28452
|
infra: "\u30A4\u30F3\u30D5\u30E9",
|
|
28453
|
+
game: "\u30B2\u30FC\u30E0",
|
|
28499
28454
|
pressEnterToClose: "Enter \u30AD\u30FC\u3092\u62BC\u3059\u3068\u9589\u3058\u307E\u3059...",
|
|
28500
28455
|
unknownCommand: "\u4E0D\u660E\u306A\u30B3\u30DE\u30F3\u30C9",
|
|
28501
28456
|
usage: "\u4F7F\u3044\u65B9:",
|
|
@@ -28532,6 +28487,7 @@ var ru = {
|
|
|
28532
28487
|
selectDatabase: "\u0411\u0430\u0437\u044B \u0434\u0430\u043D\u043D\u044B\u0445:",
|
|
28533
28488
|
selectOrm: "ORM:",
|
|
28534
28489
|
selectInfra: "\u0418\u043D\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043A\u0442\u0443\u0440\u0430:",
|
|
28490
|
+
selectGame: "\u0418\u0433\u0440\u043E\u0432\u044B\u0435 \u0434\u0432\u0438\u0436\u043A\u0438 / \u0444\u0440\u0435\u0439\u043C\u0432\u043E\u0440\u043A\u0438:",
|
|
28535
28491
|
toolRecommendationsTitle: "\u0420\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0443\u0435\u043C\u044B\u0435 \u0438\u043D\u0441\u0442\u0440\u0443\u043C\u0435\u043D\u0442\u044B \u0434\u043B\u044F \u0432\u0430\u0448\u0435\u0433\u043E \u0441\u0442\u0435\u043A\u0430:",
|
|
28536
28492
|
toolInstallMode: "\u041A\u0430\u043A \u0432\u044B \u0445\u043E\u0442\u0438\u0442\u0435 \u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C?",
|
|
28537
28493
|
toolInstallDefault: "\u041F\u043E \u0443\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044E (\u0443\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0432\u0441\u0435)",
|
|
@@ -28570,6 +28526,7 @@ var ru = {
|
|
|
28570
28526
|
database: "\u0411\u0430\u0437\u0430 \u0434\u0430\u043D\u043D\u044B\u0445",
|
|
28571
28527
|
orm: "ORM",
|
|
28572
28528
|
infra: "\u0418\u043D\u0444\u0440\u0430",
|
|
28529
|
+
game: "\u0418\u0433\u0440\u044B",
|
|
28573
28530
|
pressEnterToClose: "\u041D\u0430\u0436\u043C\u0438\u0442\u0435 Enter \u0434\u043B\u044F \u0432\u044B\u0445\u043E\u0434\u0430...",
|
|
28574
28531
|
unknownCommand: "\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F \u043A\u043E\u043C\u0430\u043D\u0434\u0430",
|
|
28575
28532
|
usage: "\u0418\u0441\u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u043D\u0438\u0435:",
|
|
@@ -29527,8 +29484,8 @@ function createRl() {
|
|
|
29527
29484
|
return (0, import_node_readline.createInterface)({ input: process.stdin, output: process.stdout });
|
|
29528
29485
|
}
|
|
29529
29486
|
function ask(rl, question) {
|
|
29530
|
-
return new Promise((
|
|
29531
|
-
rl.question(question, (answer) =>
|
|
29487
|
+
return new Promise((resolve4) => {
|
|
29488
|
+
rl.question(question, (answer) => resolve4(answer.trim()));
|
|
29532
29489
|
});
|
|
29533
29490
|
}
|
|
29534
29491
|
async function selectOne(rl, prompt, options) {
|
|
@@ -29566,35 +29523,35 @@ async function confirmYesNo(rl, prompt, msg) {
|
|
|
29566
29523
|
}
|
|
29567
29524
|
function readJsonSafe(filePath) {
|
|
29568
29525
|
try {
|
|
29569
|
-
return JSON.parse((0,
|
|
29526
|
+
return JSON.parse((0, import_node_fs2.readFileSync)(filePath, "utf-8"));
|
|
29570
29527
|
} catch {
|
|
29571
29528
|
return null;
|
|
29572
29529
|
}
|
|
29573
29530
|
}
|
|
29574
29531
|
function readTextSafe(filePath) {
|
|
29575
29532
|
try {
|
|
29576
|
-
return (0,
|
|
29533
|
+
return (0, import_node_fs2.readFileSync)(filePath, "utf-8");
|
|
29577
29534
|
} catch {
|
|
29578
29535
|
return "";
|
|
29579
29536
|
}
|
|
29580
29537
|
}
|
|
29581
29538
|
function checkExt(dir, ext) {
|
|
29582
29539
|
try {
|
|
29583
|
-
return (0,
|
|
29540
|
+
return (0, import_node_fs2.readdirSync)(dir).some((f) => f.endsWith(ext));
|
|
29584
29541
|
} catch {
|
|
29585
29542
|
return false;
|
|
29586
29543
|
}
|
|
29587
29544
|
}
|
|
29588
29545
|
function checkDir(dir, name) {
|
|
29589
29546
|
try {
|
|
29590
|
-
const p = (0,
|
|
29591
|
-
return (0,
|
|
29547
|
+
const p = (0, import_node_path2.resolve)(dir, name);
|
|
29548
|
+
return (0, import_node_fs2.existsSync)(p) && (0, import_node_fs2.statSync)(p).isDirectory();
|
|
29592
29549
|
} catch {
|
|
29593
29550
|
return false;
|
|
29594
29551
|
}
|
|
29595
29552
|
}
|
|
29596
29553
|
function detectStack(projectDir) {
|
|
29597
|
-
const check2 = (file2) => (0,
|
|
29554
|
+
const check2 = (file2) => (0, import_node_fs2.existsSync)((0, import_node_path2.resolve)(projectDir, file2));
|
|
29598
29555
|
const has = (arr, v) => arr.includes(v);
|
|
29599
29556
|
const stack = {
|
|
29600
29557
|
programming_languages: [],
|
|
@@ -29603,12 +29560,13 @@ function detectStack(projectDir) {
|
|
|
29603
29560
|
database: [],
|
|
29604
29561
|
orm: [],
|
|
29605
29562
|
infra: [],
|
|
29563
|
+
game: [],
|
|
29606
29564
|
other: []
|
|
29607
29565
|
};
|
|
29608
29566
|
if (check2("tsconfig.json") || check2("tsconfig.base.json")) {
|
|
29609
29567
|
stack.programming_languages.push("typescript");
|
|
29610
29568
|
} else if (check2("package.json")) {
|
|
29611
|
-
const pkg = readJsonSafe((0,
|
|
29569
|
+
const pkg = readJsonSafe((0, import_node_path2.resolve)(projectDir, "package.json"));
|
|
29612
29570
|
const deps = { ...pkg?.dependencies ?? {}, ...pkg?.devDependencies ?? {} };
|
|
29613
29571
|
if (deps["typescript"]) {
|
|
29614
29572
|
stack.programming_languages.push("typescript");
|
|
@@ -29624,7 +29582,7 @@ function detectStack(projectDir) {
|
|
|
29624
29582
|
if (check2("pom.xml") || check2("build.gradle") || check2("build.gradle.kts")) {
|
|
29625
29583
|
const gradleKts = check2("build.gradle.kts");
|
|
29626
29584
|
const gradleFile = gradleKts ? "build.gradle.kts" : check2("build.gradle") ? "build.gradle" : null;
|
|
29627
|
-
const gradleContent = gradleFile ? readTextSafe((0,
|
|
29585
|
+
const gradleContent = gradleFile ? readTextSafe((0, import_node_path2.resolve)(projectDir, gradleFile)) : "";
|
|
29628
29586
|
stack.programming_languages.push("java");
|
|
29629
29587
|
if (gradleKts || gradleContent.includes("kotlin")) {
|
|
29630
29588
|
stack.programming_languages.push("kotlin");
|
|
@@ -29639,7 +29597,7 @@ function detectStack(projectDir) {
|
|
|
29639
29597
|
if (checkExt(projectDir, ".fsproj")) stack.programming_languages.push("fsharp");
|
|
29640
29598
|
if (checkExt(projectDir, ".vbproj")) stack.programming_languages.push("visual-basic");
|
|
29641
29599
|
if (check2("CMakeLists.txt")) {
|
|
29642
|
-
const cmake = readTextSafe((0,
|
|
29600
|
+
const cmake = readTextSafe((0, import_node_path2.resolve)(projectDir, "CMakeLists.txt"));
|
|
29643
29601
|
if (cmake.includes("CXX") || cmake.includes("cpp") || cmake.includes("c++")) {
|
|
29644
29602
|
stack.programming_languages.push("cpp");
|
|
29645
29603
|
} else {
|
|
@@ -29676,7 +29634,7 @@ function detectStack(projectDir) {
|
|
|
29676
29634
|
stack.programming_languages.push("objective-c");
|
|
29677
29635
|
}
|
|
29678
29636
|
if (check2("package.json")) {
|
|
29679
|
-
const pkg = readJsonSafe((0,
|
|
29637
|
+
const pkg = readJsonSafe((0, import_node_path2.resolve)(projectDir, "package.json"));
|
|
29680
29638
|
const deps = { ...pkg?.dependencies ?? {}, ...pkg?.devDependencies ?? {} };
|
|
29681
29639
|
if (deps["react"] || deps["react-dom"]) stack.frontend.push("react");
|
|
29682
29640
|
if (deps["next"]) stack.frontend.push("nextjs");
|
|
@@ -29704,20 +29662,20 @@ function detectStack(projectDir) {
|
|
|
29704
29662
|
if (deps["hardhat"]) stack.other.push("hardhat");
|
|
29705
29663
|
}
|
|
29706
29664
|
if (check2("pubspec.yaml")) {
|
|
29707
|
-
const pubspec = readTextSafe((0,
|
|
29665
|
+
const pubspec = readTextSafe((0, import_node_path2.resolve)(projectDir, "pubspec.yaml"));
|
|
29708
29666
|
if (pubspec.includes("flutter")) stack.frontend.push("flutter");
|
|
29709
29667
|
}
|
|
29710
29668
|
if (checkExt(projectDir, ".csproj")) {
|
|
29711
|
-
const files = (0,
|
|
29669
|
+
const files = (0, import_node_fs2.readdirSync)(projectDir).filter((f) => f.endsWith(".csproj"));
|
|
29712
29670
|
for (const f of files) {
|
|
29713
|
-
const content = readTextSafe((0,
|
|
29671
|
+
const content = readTextSafe((0, import_node_path2.resolve)(projectDir, f));
|
|
29714
29672
|
if (content.includes("Microsoft.AspNetCore.Components")) {
|
|
29715
29673
|
stack.frontend.push("blazor");
|
|
29716
29674
|
break;
|
|
29717
29675
|
}
|
|
29718
29676
|
}
|
|
29719
29677
|
}
|
|
29720
|
-
const pyDeps = check2("pyproject.toml") ? readTextSafe((0,
|
|
29678
|
+
const pyDeps = check2("pyproject.toml") ? readTextSafe((0, import_node_path2.resolve)(projectDir, "pyproject.toml")) : check2("requirements.txt") ? readTextSafe((0, import_node_path2.resolve)(projectDir, "requirements.txt")) : "";
|
|
29721
29679
|
if (pyDeps) {
|
|
29722
29680
|
if (pyDeps.includes("fastapi")) stack.backend.push("fastapi");
|
|
29723
29681
|
if (pyDeps.includes("django")) stack.backend.push("django");
|
|
@@ -29727,7 +29685,7 @@ function detectStack(projectDir) {
|
|
|
29727
29685
|
if (pyDeps.includes("peewee")) stack.orm.push("peewee");
|
|
29728
29686
|
}
|
|
29729
29687
|
if (check2("composer.json")) {
|
|
29730
|
-
const composer = readJsonSafe((0,
|
|
29688
|
+
const composer = readJsonSafe((0, import_node_path2.resolve)(projectDir, "composer.json"));
|
|
29731
29689
|
const req = {
|
|
29732
29690
|
...composer?.require ?? {},
|
|
29733
29691
|
...composer?.["require-dev"] ?? {}
|
|
@@ -29740,14 +29698,14 @@ function detectStack(projectDir) {
|
|
|
29740
29698
|
if (req["doctrine/orm"]) stack.orm.push("doctrine");
|
|
29741
29699
|
}
|
|
29742
29700
|
if (check2("Gemfile")) {
|
|
29743
|
-
const gemfile = readTextSafe((0,
|
|
29701
|
+
const gemfile = readTextSafe((0, import_node_path2.resolve)(projectDir, "Gemfile"));
|
|
29744
29702
|
if (gemfile.includes("rails")) stack.backend.push("rails");
|
|
29745
29703
|
if (gemfile.includes("sinatra")) stack.backend.push("sinatra");
|
|
29746
29704
|
if (gemfile.includes("hanami")) stack.backend.push("hanami");
|
|
29747
29705
|
if (gemfile.includes("activerecord")) stack.orm.push("activerecord");
|
|
29748
29706
|
}
|
|
29749
29707
|
if (check2("pom.xml")) {
|
|
29750
|
-
const pom = readTextSafe((0,
|
|
29708
|
+
const pom = readTextSafe((0, import_node_path2.resolve)(projectDir, "pom.xml"));
|
|
29751
29709
|
if (pom.includes("spring-boot")) stack.backend.push("spring-boot");
|
|
29752
29710
|
if (pom.includes("quarkus")) stack.backend.push("quarkus");
|
|
29753
29711
|
if (pom.includes("micronaut")) stack.backend.push("micronaut");
|
|
@@ -29755,7 +29713,7 @@ function detectStack(projectDir) {
|
|
|
29755
29713
|
if (pom.includes("mybatis")) stack.orm.push("mybatis");
|
|
29756
29714
|
}
|
|
29757
29715
|
if (check2("build.gradle") || check2("build.gradle.kts")) {
|
|
29758
|
-
const gradle = readTextSafe((0,
|
|
29716
|
+
const gradle = readTextSafe((0, import_node_path2.resolve)(projectDir, check2("build.gradle.kts") ? "build.gradle.kts" : "build.gradle"));
|
|
29759
29717
|
if (gradle.includes("spring-boot")) stack.backend.push("spring-boot");
|
|
29760
29718
|
if (gradle.includes("quarkus")) stack.backend.push("quarkus");
|
|
29761
29719
|
if (gradle.includes("ktor")) stack.backend.push("ktor");
|
|
@@ -29764,15 +29722,15 @@ function detectStack(projectDir) {
|
|
|
29764
29722
|
if (gradle.includes("exposed")) stack.orm.push("exposed");
|
|
29765
29723
|
}
|
|
29766
29724
|
if (checkExt(projectDir, ".csproj")) {
|
|
29767
|
-
const files = (0,
|
|
29725
|
+
const files = (0, import_node_fs2.readdirSync)(projectDir).filter((f) => f.endsWith(".csproj"));
|
|
29768
29726
|
for (const f of files) {
|
|
29769
|
-
const content = readTextSafe((0,
|
|
29727
|
+
const content = readTextSafe((0, import_node_path2.resolve)(projectDir, f));
|
|
29770
29728
|
if (content.includes("Microsoft.AspNetCore")) stack.backend.push("aspnet");
|
|
29771
29729
|
if (content.includes("Microsoft.EntityFrameworkCore")) stack.orm.push("entity-framework");
|
|
29772
29730
|
}
|
|
29773
29731
|
}
|
|
29774
29732
|
if (check2("go.mod")) {
|
|
29775
|
-
const gomod = readTextSafe((0,
|
|
29733
|
+
const gomod = readTextSafe((0, import_node_path2.resolve)(projectDir, "go.mod"));
|
|
29776
29734
|
if (gomod.includes("gin-gonic")) stack.backend.push("gin");
|
|
29777
29735
|
if (gomod.includes("labstack/echo")) stack.backend.push("echo");
|
|
29778
29736
|
if (gomod.includes("gofiber/fiber")) stack.backend.push("fiber");
|
|
@@ -29781,7 +29739,7 @@ function detectStack(projectDir) {
|
|
|
29781
29739
|
if (gomod.includes("entgo.io/ent")) stack.orm.push("ent");
|
|
29782
29740
|
}
|
|
29783
29741
|
if (check2("Cargo.toml")) {
|
|
29784
|
-
const cargo = readTextSafe((0,
|
|
29742
|
+
const cargo = readTextSafe((0, import_node_path2.resolve)(projectDir, "Cargo.toml"));
|
|
29785
29743
|
if (cargo.includes("actix-web")) stack.backend.push("actix-web");
|
|
29786
29744
|
if (cargo.includes("axum")) stack.backend.push("axum");
|
|
29787
29745
|
if (cargo.includes("rocket")) stack.backend.push("rocket");
|
|
@@ -29789,38 +29747,38 @@ function detectStack(projectDir) {
|
|
|
29789
29747
|
if (cargo.includes("sea-orm")) stack.orm.push("sea-orm");
|
|
29790
29748
|
}
|
|
29791
29749
|
if (check2("mix.exs")) {
|
|
29792
|
-
const mix = readTextSafe((0,
|
|
29750
|
+
const mix = readTextSafe((0, import_node_path2.resolve)(projectDir, "mix.exs"));
|
|
29793
29751
|
if (mix.includes("phoenix")) stack.backend.push("phoenix");
|
|
29794
29752
|
if (mix.includes("ecto")) stack.orm.push("ecto");
|
|
29795
29753
|
}
|
|
29796
29754
|
if (check2("build.sbt")) {
|
|
29797
|
-
const sbt = readTextSafe((0,
|
|
29755
|
+
const sbt = readTextSafe((0, import_node_path2.resolve)(projectDir, "build.sbt"));
|
|
29798
29756
|
if (sbt.includes("play")) stack.backend.push("play");
|
|
29799
29757
|
if (sbt.includes("akka-http")) stack.backend.push("akka-http");
|
|
29800
29758
|
}
|
|
29801
29759
|
if (check2("Package.swift")) {
|
|
29802
|
-
const swift = readTextSafe((0,
|
|
29760
|
+
const swift = readTextSafe((0, import_node_path2.resolve)(projectDir, "Package.swift"));
|
|
29803
29761
|
if (swift.includes("vapor")) stack.backend.push("vapor");
|
|
29804
29762
|
}
|
|
29805
29763
|
if (checkExt(projectDir, ".cabal") || check2("stack.yaml")) {
|
|
29806
|
-
const cabalFiles = (0,
|
|
29807
|
-
const content = cabalFiles.length > 0 ? readTextSafe((0,
|
|
29764
|
+
const cabalFiles = (0, import_node_fs2.readdirSync)(projectDir).filter((f) => f.endsWith(".cabal"));
|
|
29765
|
+
const content = cabalFiles.length > 0 ? readTextSafe((0, import_node_path2.resolve)(projectDir, cabalFiles[0])) : "";
|
|
29808
29766
|
if (content.includes("servant")) stack.backend.push("servant");
|
|
29809
29767
|
if (content.includes("yesod")) stack.backend.push("yesod");
|
|
29810
29768
|
}
|
|
29811
29769
|
if (check2("cpanfile")) {
|
|
29812
|
-
const cpanfile = readTextSafe((0,
|
|
29770
|
+
const cpanfile = readTextSafe((0, import_node_path2.resolve)(projectDir, "cpanfile"));
|
|
29813
29771
|
if (cpanfile.includes("Mojolicious")) stack.backend.push("mojolicious");
|
|
29814
29772
|
if (cpanfile.includes("Dancer")) stack.backend.push("dancer");
|
|
29815
29773
|
}
|
|
29816
29774
|
if (check2("project.clj") || check2("deps.edn")) {
|
|
29817
|
-
const clj = check2("deps.edn") ? readTextSafe((0,
|
|
29775
|
+
const clj = check2("deps.edn") ? readTextSafe((0, import_node_path2.resolve)(projectDir, "deps.edn")) : readTextSafe((0, import_node_path2.resolve)(projectDir, "project.clj"));
|
|
29818
29776
|
if (clj.includes("ring")) stack.backend.push("ring");
|
|
29819
29777
|
if (clj.includes("pedestal")) stack.backend.push("pedestal");
|
|
29820
29778
|
}
|
|
29821
29779
|
if (check2("docker-compose.yml") || check2("docker-compose.yaml")) {
|
|
29822
29780
|
const compose = readTextSafe(
|
|
29823
|
-
(0,
|
|
29781
|
+
(0, import_node_path2.resolve)(projectDir, check2("docker-compose.yml") ? "docker-compose.yml" : "docker-compose.yaml")
|
|
29824
29782
|
);
|
|
29825
29783
|
if (compose.includes("postgres")) stack.database.push("postgresql");
|
|
29826
29784
|
if (compose.includes("mysql") || compose.includes("mariadb")) stack.database.push("mysql");
|
|
@@ -29847,13 +29805,31 @@ function detectStack(projectDir) {
|
|
|
29847
29805
|
stack.infra.push("kubernetes");
|
|
29848
29806
|
}
|
|
29849
29807
|
if (check2("wrangler.toml") || check2("wrangler.jsonc")) stack.infra.push("cloudflare");
|
|
29808
|
+
if (check2("project.godot")) stack.game.push("godot");
|
|
29809
|
+
if (check2("package.json")) {
|
|
29810
|
+
const pkg = readJsonSafe((0, import_node_path2.resolve)(projectDir, "package.json"));
|
|
29811
|
+
const deps = { ...pkg?.dependencies ?? {}, ...pkg?.devDependencies ?? {} };
|
|
29812
|
+
if (deps["phaser"]) stack.game.push("phaser");
|
|
29813
|
+
}
|
|
29814
|
+
if (check2("ProjectSettings/ProjectVersion.txt") || checkDir(projectDir, "Assets")) {
|
|
29815
|
+
if (check2("ProjectSettings/ProjectVersion.txt")) stack.game.push("unity");
|
|
29816
|
+
}
|
|
29817
|
+
if (checkExt(projectDir, ".uproject")) stack.game.push("unreal");
|
|
29818
|
+
if (check2("Cargo.toml")) {
|
|
29819
|
+
const cargo = readTextSafe((0, import_node_path2.resolve)(projectDir, "Cargo.toml"));
|
|
29820
|
+
if (cargo.includes("bevy")) stack.game.push("bevy");
|
|
29821
|
+
}
|
|
29822
|
+
if (check2("main.lua") && check2("conf.lua")) stack.game.push("love2d");
|
|
29823
|
+
if (checkDir(projectDir, "game") && check2("game/script.rpy")) stack.game.push("renpy");
|
|
29824
|
+
if (pyDeps && pyDeps.includes("pygame")) stack.game.push("pygame");
|
|
29825
|
+
if (check2("game.project")) stack.game.push("defold");
|
|
29850
29826
|
for (const key of Object.keys(stack)) {
|
|
29851
29827
|
stack[key] = [...new Set(stack[key])];
|
|
29852
29828
|
}
|
|
29853
29829
|
return stack;
|
|
29854
29830
|
}
|
|
29855
29831
|
function isStackEmpty(stack) {
|
|
29856
|
-
return stack.programming_languages.length === 0 && stack.frontend.length === 0 && stack.backend.length === 0 && stack.database.length === 0 && stack.orm.length === 0 && stack.infra.length === 0;
|
|
29832
|
+
return stack.programming_languages.length === 0 && stack.frontend.length === 0 && stack.backend.length === 0 && stack.database.length === 0 && stack.orm.length === 0 && stack.infra.length === 0 && stack.game.length === 0;
|
|
29857
29833
|
}
|
|
29858
29834
|
var PROGRAMMING_LANGUAGES = [...KNOWN_PROGRAMMING_LANGUAGES];
|
|
29859
29835
|
var FRONTENDS = [...KNOWN_FRONTENDS];
|
|
@@ -29861,6 +29837,7 @@ var BACKENDS = [...KNOWN_BACKENDS];
|
|
|
29861
29837
|
var DATABASES = [...KNOWN_DATABASES];
|
|
29862
29838
|
var ORMS = [...KNOWN_ORMS];
|
|
29863
29839
|
var INFRAS = [...KNOWN_INFRAS];
|
|
29840
|
+
var GAME_ENGINES = [...KNOWN_GAME_ENGINES];
|
|
29864
29841
|
async function interviewStack(rl, msg) {
|
|
29865
29842
|
const toOptions = (items) => items.map((v) => ({ value: v, label: v }));
|
|
29866
29843
|
const hint = msg.selectSubLanguagesHint;
|
|
@@ -29870,7 +29847,8 @@ async function interviewStack(rl, msg) {
|
|
|
29870
29847
|
const database = await selectMultiple(rl, msg.selectDatabase, hint, toOptions(DATABASES));
|
|
29871
29848
|
const orm = await selectMultiple(rl, msg.selectOrm, hint, toOptions(ORMS));
|
|
29872
29849
|
const infra = await selectMultiple(rl, msg.selectInfra, hint, toOptions(INFRAS));
|
|
29873
|
-
|
|
29850
|
+
const game = await selectMultiple(rl, msg.selectGame, hint, toOptions(GAME_ENGINES));
|
|
29851
|
+
return { programming_languages, frontend, backend, database, orm, infra, game, other: [] };
|
|
29874
29852
|
}
|
|
29875
29853
|
function printStack(stack, msg) {
|
|
29876
29854
|
const show = (label, items) => {
|
|
@@ -29882,6 +29860,7 @@ function printStack(stack, msg) {
|
|
|
29882
29860
|
show(msg.database, stack.database);
|
|
29883
29861
|
show(msg.orm, stack.orm);
|
|
29884
29862
|
show(msg.infra, stack.infra);
|
|
29863
|
+
show(msg.game, stack.game);
|
|
29885
29864
|
}
|
|
29886
29865
|
function getInstallCmd(rec) {
|
|
29887
29866
|
const platform2 = process.platform;
|
|
@@ -29932,6 +29911,7 @@ function formatConfigGodd(config2) {
|
|
|
29932
29911
|
`database: ${formatArray(config2.stack.database)}`,
|
|
29933
29912
|
`orm: ${formatArray(config2.stack.orm)}`,
|
|
29934
29913
|
`infra: ${formatArray(config2.stack.infra)}`,
|
|
29914
|
+
`game: ${formatArray(config2.stack.game)}`,
|
|
29935
29915
|
`other: ${formatArray(config2.stack.other)}`
|
|
29936
29916
|
];
|
|
29937
29917
|
const toolEntries = Object.entries(config2.tools).filter(([, v]) => v);
|
|
@@ -29945,8 +29925,8 @@ function formatConfigGodd(config2) {
|
|
|
29945
29925
|
return lines.join("\n");
|
|
29946
29926
|
}
|
|
29947
29927
|
async function initProjectInteractive(projectDir = process.cwd(), options = {}) {
|
|
29948
|
-
const configPath = (0,
|
|
29949
|
-
if ((0,
|
|
29928
|
+
const configPath = (0, import_node_path2.resolve)(projectDir, brand.configFile);
|
|
29929
|
+
if ((0, import_node_fs2.existsSync)(configPath) && !options.force) {
|
|
29950
29930
|
return {
|
|
29951
29931
|
configPath,
|
|
29952
29932
|
status: "already_exists",
|
|
@@ -30037,10 +30017,10 @@ async function initProjectInteractive(projectDir = process.cwd(), options = {})
|
|
|
30037
30017
|
tools
|
|
30038
30018
|
};
|
|
30039
30019
|
const content = formatConfigGodd(config2);
|
|
30040
|
-
(0,
|
|
30020
|
+
(0, import_node_fs2.writeFileSync)(configPath, content, "utf-8");
|
|
30041
30021
|
return {
|
|
30042
30022
|
configPath,
|
|
30043
|
-
status: (0,
|
|
30023
|
+
status: (0, import_node_fs2.existsSync)(configPath) ? "overwritten" : "created",
|
|
30044
30024
|
config: config2
|
|
30045
30025
|
};
|
|
30046
30026
|
} finally {
|
|
@@ -30048,6 +30028,241 @@ async function initProjectInteractive(projectDir = process.cwd(), options = {})
|
|
|
30048
30028
|
}
|
|
30049
30029
|
}
|
|
30050
30030
|
|
|
30031
|
+
// src/tools/config-tool.ts
|
|
30032
|
+
function parseRawFields(configPath) {
|
|
30033
|
+
if (!(0, import_node_fs3.existsSync)(configPath)) return [];
|
|
30034
|
+
try {
|
|
30035
|
+
const raw = (0, import_node_fs3.readFileSync)(configPath, "utf-8");
|
|
30036
|
+
const fields = [];
|
|
30037
|
+
for (const line of raw.split("\n")) {
|
|
30038
|
+
const trimmed = line.trim();
|
|
30039
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
30040
|
+
const indent = line.length - line.trimStart().length;
|
|
30041
|
+
if (indent >= 2) continue;
|
|
30042
|
+
const colonIdx = trimmed.indexOf(":");
|
|
30043
|
+
if (colonIdx > 0) {
|
|
30044
|
+
fields.push(trimmed.slice(0, colonIdx).trim());
|
|
30045
|
+
}
|
|
30046
|
+
}
|
|
30047
|
+
return fields;
|
|
30048
|
+
} catch {
|
|
30049
|
+
return [];
|
|
30050
|
+
}
|
|
30051
|
+
}
|
|
30052
|
+
function detectUnknownFields(configPath) {
|
|
30053
|
+
const rawFields = parseRawFields(configPath);
|
|
30054
|
+
const knownFields = getKnownFieldNames();
|
|
30055
|
+
return rawFields.filter((f) => !knownFields.has(f));
|
|
30056
|
+
}
|
|
30057
|
+
function generateConfigContext(projectDir = process.cwd()) {
|
|
30058
|
+
const configPath = (0, import_node_path3.resolve)(projectDir, brand.configFile);
|
|
30059
|
+
const sections = [];
|
|
30060
|
+
sections.push(`## config.godd \u8A2D\u5B9A\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8
|
|
30061
|
+
|
|
30062
|
+
\u3042\u306A\u305F\u306F config.godd \u306E\u8A2D\u5B9A\u3092\u6B63\u78BA\u306B\u751F\u6210\u30FB\u4FEE\u6B63\u3059\u308B\u30A2\u30B7\u30B9\u30BF\u30F3\u30C8\u3067\u3059\u3002
|
|
30063
|
+
\u4EE5\u4E0B\u306E\u60C5\u5831\u3092\u4F7F\u3063\u3066\u3001\u30E6\u30FC\u30B6\u30FC\u3068\u5BFE\u8A71\u3057\u306A\u304C\u3089\u6B63\u3057\u3044 config.godd \u3092\u4F5C\u6210\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
|
30064
|
+
|
|
30065
|
+
### \u624B\u9806
|
|
30066
|
+
1. \u81EA\u52D5\u691C\u51FA\u7D50\u679C\u3068\u73FE\u5728\u306E config \u3092\u78BA\u8A8D\u3059\u308B
|
|
30067
|
+
2. \u30E6\u30FC\u30B6\u30FC\u306B\u4E0D\u8DB3\u30FB\u8AA4\u308A\u304C\u306A\u3044\u304B\u78BA\u8A8D\u3059\u308B
|
|
30068
|
+
3. \u78BA\u5B9A\u3057\u305F\u3089\u3001\u4E0B\u8A18\u300C\u66F8\u5F0F\u30AC\u30A4\u30C9\u300D\u306B\u5F93\u3063\u3066 config.godd \u3092\u66F8\u304D\u51FA\u3059
|
|
30069
|
+
4. \u66F8\u304D\u51FA\u3057\u5F8C\u3001\u30E6\u30FC\u30B6\u30FC\u306B Cursor \u518D\u8D77\u52D5\u3092\u4FC3\u3059`);
|
|
30070
|
+
sections.push(`## \u6709\u52B9\u306A\u30D5\u30A3\u30FC\u30EB\u30C9\u3068\u5024\u306E\u4E00\u89A7\uFF08SSOT\uFF09
|
|
30071
|
+
|
|
30072
|
+
\u4EE5\u4E0B\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u3068\u5024\u306E\u307F\u304C\u6709\u52B9\u3067\u3059\u3002
|
|
30073
|
+
\u3053\u3053\u306B\u306A\u3044\u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u306F Zod \u30B9\u30AD\u30FC\u30DE\u306B\u3088\u308A**\u9ED9\u3063\u3066\u7121\u8996**\u3055\u308C\u307E\u3059\u3002
|
|
30074
|
+
\u3053\u3053\u306B\u306A\u3044\u5024\u306F**\u5168\u30C4\u30FC\u30EB\u304C\u30D6\u30ED\u30C3\u30AF**\u3055\u308C\u308B\u30A8\u30E9\u30FC\u306B\u306A\u308A\u307E\u3059\u3002
|
|
30075
|
+
|
|
30076
|
+
${getKnownValuesDocumentation()}`);
|
|
30077
|
+
if ((0, import_node_fs3.existsSync)(configPath)) {
|
|
30078
|
+
const rawContent = (0, import_node_fs3.readFileSync)(configPath, "utf-8");
|
|
30079
|
+
sections.push(`## \u73FE\u5728\u306E config.godd
|
|
30080
|
+
|
|
30081
|
+
\`\`\`
|
|
30082
|
+
${rawContent.trim()}
|
|
30083
|
+
\`\`\``);
|
|
30084
|
+
const config2 = loadConfig(projectDir);
|
|
30085
|
+
if (config2) {
|
|
30086
|
+
const issues = validateConfigValues(config2);
|
|
30087
|
+
if (issues.length > 0) {
|
|
30088
|
+
sections.push(`## \u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u30A8\u30E9\u30FC\uFF08\u5024\u306E\u554F\u984C\uFF09
|
|
30089
|
+
|
|
30090
|
+
${formatIssuesList(issues)}`);
|
|
30091
|
+
}
|
|
30092
|
+
}
|
|
30093
|
+
const unknownFields = detectUnknownFields(configPath);
|
|
30094
|
+
if (unknownFields.length > 0) {
|
|
30095
|
+
sections.push(`## \u672A\u77E5\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\uFF08\u9ED9\u3063\u3066\u7121\u8996\u3055\u308C\u3066\u3044\u308B\uFF09
|
|
30096
|
+
|
|
30097
|
+
\u4EE5\u4E0B\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u30B9\u30AD\u30FC\u30DE\u306B\u5B58\u5728\u3057\u306A\u3044\u305F\u3081\u3001\u8AAD\u307F\u8FBC\u307F\u6642\u306B\u7121\u8996\u3055\u308C\u3066\u3044\u307E\u3059:
|
|
30098
|
+
${unknownFields.map((f) => `- \`${f}\` \u2014 \u3053\u306E\u30D5\u30A3\u30FC\u30EB\u30C9\u306F\u5B58\u5728\u3057\u307E\u305B\u3093\u3002\u6B63\u3057\u3044\u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u3092\u4E0A\u306E\u4E00\u89A7\u304B\u3089\u9078\u3093\u3067\u304F\u3060\u3055\u3044\u3002`).join("\n")}`);
|
|
30099
|
+
}
|
|
30100
|
+
} else {
|
|
30101
|
+
sections.push(`## \u73FE\u5728\u306E config.godd
|
|
30102
|
+
|
|
30103
|
+
config.godd \u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002\u65B0\u898F\u4F5C\u6210\u304C\u5FC5\u8981\u3067\u3059\u3002`);
|
|
30104
|
+
}
|
|
30105
|
+
const detected = detectStack(projectDir);
|
|
30106
|
+
const detectedLines = [];
|
|
30107
|
+
for (const [key, values] of Object.entries(detected)) {
|
|
30108
|
+
if (Array.isArray(values) && values.length > 0) {
|
|
30109
|
+
detectedLines.push(` ${key}: ${values.join(", ")}`);
|
|
30110
|
+
}
|
|
30111
|
+
}
|
|
30112
|
+
if (detectedLines.length > 0) {
|
|
30113
|
+
sections.push(`## \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u81EA\u52D5\u691C\u51FA\u7D50\u679C
|
|
30114
|
+
|
|
30115
|
+
\u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u30B9\u30AD\u30E3\u30F3\u3057\u305F\u7D50\u679C:
|
|
30116
|
+
${detectedLines.join("\n")}
|
|
30117
|
+
|
|
30118
|
+
\u3053\u306E\u7D50\u679C\u3092\u30D9\u30FC\u30B9\u306B\u3001\u30E6\u30FC\u30B6\u30FC\u306B\u78BA\u8A8D\u30FB\u4FEE\u6B63\u3092\u6C42\u3081\u3066\u304F\u3060\u3055\u3044\u3002`);
|
|
30119
|
+
} else {
|
|
30120
|
+
sections.push(`## \u30D7\u30ED\u30B8\u30A7\u30AF\u30C8\u81EA\u52D5\u691C\u51FA\u7D50\u679C
|
|
30121
|
+
|
|
30122
|
+
\u81EA\u52D5\u691C\u51FA\u3067\u304D\u305F\u30B9\u30BF\u30C3\u30AF\u306F\u3042\u308A\u307E\u305B\u3093\u3002\u30E6\u30FC\u30B6\u30FC\u306B\u624B\u52D5\u3067\u9078\u629E\u3057\u3066\u3082\u3089\u3063\u3066\u304F\u3060\u3055\u3044\u3002`);
|
|
30123
|
+
}
|
|
30124
|
+
sections.push(`## config.godd \u66F8\u5F0F\u30AC\u30A4\u30C9\uFF08MUST\uFF09
|
|
30125
|
+
|
|
30126
|
+
config.godd \u306F\u4EE5\u4E0B\u306E\u66F8\u5F0F\u3067\u8A18\u8FF0\u3057\u3066\u304F\u3060\u3055\u3044:
|
|
30127
|
+
|
|
30128
|
+
\`\`\`
|
|
30129
|
+
display_language: ja
|
|
30130
|
+
main_language: ja
|
|
30131
|
+
sub_languages: []
|
|
30132
|
+
programming_languages: [typescript, python]
|
|
30133
|
+
frontend: [react, nextjs]
|
|
30134
|
+
backend: [fastapi]
|
|
30135
|
+
database: [postgresql]
|
|
30136
|
+
orm: [sqlalchemy]
|
|
30137
|
+
infra: [docker, github-actions]
|
|
30138
|
+
game: []
|
|
30139
|
+
other: []
|
|
30140
|
+
\`\`\`
|
|
30141
|
+
|
|
30142
|
+
### \u30EB\u30FC\u30EB
|
|
30143
|
+
- \u914D\u5217\u306F \`[value1, value2]\` \u5F62\u5F0F\uFF08\u5F15\u7528\u7B26\u306A\u3057\uFF09
|
|
30144
|
+
- \u7A7A\u914D\u5217\u306F \`[]\`
|
|
30145
|
+
- \u6587\u5B57\u5217\u306F\u5F15\u7528\u7B26\u306A\u3057
|
|
30146
|
+
- \u30D5\u30A3\u30FC\u30EB\u30C9\u540D\u306F\u4E0A\u8A18\u4E00\u89A7\u306E\u3082\u306E\u3060\u3051\u3092\u4F7F\u7528
|
|
30147
|
+
- \u5024\u306F\u4E0A\u8A18\u4E00\u89A7\u306E\u3082\u306E\u3060\u3051\u3092\u4F7F\u7528\uFF08other \u306F\u81EA\u7531\u8A18\u8FF0\u53EF\uFF09
|
|
30148
|
+
- tools \u30BB\u30AF\u30B7\u30E7\u30F3\u306F\u7701\u7565\u53EF\uFF08godd init \u3067\u81EA\u52D5\u8A2D\u5B9A\u3055\u308C\u308B\uFF09`);
|
|
30149
|
+
return sections.join("\n\n---\n\n");
|
|
30150
|
+
}
|
|
30151
|
+
function formatIssuesList(issues) {
|
|
30152
|
+
return issues.map((issue2) => {
|
|
30153
|
+
if (issue2.suggestion) {
|
|
30154
|
+
return `- \`${issue2.field}\`: "${issue2.value}" \u2192 \u3082\u3057\u304B\u3057\u3066 "${issue2.suggestion}"\uFF1F`;
|
|
30155
|
+
}
|
|
30156
|
+
return `- \`${issue2.field}\`: "${issue2.value}" \u2192 \u6709\u52B9\u5024\u4E00\u89A7\u306B\u3042\u308A\u307E\u305B\u3093`;
|
|
30157
|
+
}).join("\n");
|
|
30158
|
+
}
|
|
30159
|
+
|
|
30160
|
+
// src/cli/installer.ts
|
|
30161
|
+
var import_node_fs4 = require("node:fs");
|
|
30162
|
+
var import_node_os = require("node:os");
|
|
30163
|
+
var import_node_path4 = require("node:path");
|
|
30164
|
+
function resolveRealPath(p) {
|
|
30165
|
+
try {
|
|
30166
|
+
return (0, import_node_fs4.realpathSync)(p);
|
|
30167
|
+
} catch {
|
|
30168
|
+
return p;
|
|
30169
|
+
}
|
|
30170
|
+
}
|
|
30171
|
+
var NPM_PACKAGE_NAME = "@autodevjapan/godd-mcp-alpha";
|
|
30172
|
+
function resolveNpxCliPath() {
|
|
30173
|
+
const nodeDir = (0, import_node_path4.join)(resolveRealPath(process.execPath), "..");
|
|
30174
|
+
const npxCliPath = (0, import_node_path4.join)(nodeDir, "node_modules", "npm", "bin", "npx-cli.js");
|
|
30175
|
+
return (0, import_node_fs4.existsSync)(npxCliPath) ? npxCliPath : null;
|
|
30176
|
+
}
|
|
30177
|
+
function resolveServerCommand() {
|
|
30178
|
+
if (typeof globalThis.__pkg !== "undefined" || process.pkg) {
|
|
30179
|
+
return { command: process.execPath, args: ["serve"] };
|
|
30180
|
+
}
|
|
30181
|
+
const nodeCommand = resolveRealPath(process.execPath);
|
|
30182
|
+
const npxCliPath = resolveNpxCliPath();
|
|
30183
|
+
if (npxCliPath) {
|
|
30184
|
+
return {
|
|
30185
|
+
command: nodeCommand,
|
|
30186
|
+
args: [npxCliPath, "-y", `${NPM_PACKAGE_NAME}@latest`, "serve"]
|
|
30187
|
+
};
|
|
30188
|
+
}
|
|
30189
|
+
const scriptPath = process.argv[1];
|
|
30190
|
+
if (scriptPath && (0, import_node_fs4.existsSync)(scriptPath)) {
|
|
30191
|
+
return { command: nodeCommand, args: [resolveRealPath(scriptPath), "serve"] };
|
|
30192
|
+
}
|
|
30193
|
+
return { command: nodeCommand, args: [scriptPath ?? "godd.cjs", "serve"] };
|
|
30194
|
+
}
|
|
30195
|
+
function readMcpConfig(mcpJsonPath) {
|
|
30196
|
+
if ((0, import_node_fs4.existsSync)(mcpJsonPath)) {
|
|
30197
|
+
try {
|
|
30198
|
+
const raw = (0, import_node_fs4.readFileSync)(mcpJsonPath, "utf-8");
|
|
30199
|
+
const parsed = JSON.parse(raw);
|
|
30200
|
+
return { mcpServers: parsed.mcpServers ?? {} };
|
|
30201
|
+
} catch {
|
|
30202
|
+
console.error(
|
|
30203
|
+
` [WARN] ${mcpJsonPath} \u304C\u58CA\u308C\u3066\u3044\u308B\u305F\u3081\u65B0\u898F\u4F5C\u6210\u3057\u307E\u3059`
|
|
30204
|
+
);
|
|
30205
|
+
}
|
|
30206
|
+
}
|
|
30207
|
+
return { mcpServers: {} };
|
|
30208
|
+
}
|
|
30209
|
+
function installMcpServer(licenseKey) {
|
|
30210
|
+
const cursorDir = (0, import_node_path4.join)((0, import_node_os.homedir)(), ".cursor");
|
|
30211
|
+
const mcpJsonPath = (0, import_node_path4.join)(cursorDir, "mcp.json");
|
|
30212
|
+
if (!(0, import_node_fs4.existsSync)(cursorDir)) {
|
|
30213
|
+
(0, import_node_fs4.mkdirSync)(cursorDir, { recursive: true });
|
|
30214
|
+
}
|
|
30215
|
+
const config2 = readMcpConfig(mcpJsonPath);
|
|
30216
|
+
const serverKey = brand.mcpKey;
|
|
30217
|
+
const { command, args } = resolveServerCommand();
|
|
30218
|
+
const existing = config2.mcpServers[serverKey];
|
|
30219
|
+
const env = {};
|
|
30220
|
+
if (licenseKey) {
|
|
30221
|
+
env.GODD_LICENSE_KEY = licenseKey;
|
|
30222
|
+
} else if (existing?.env?.GODD_LICENSE_KEY) {
|
|
30223
|
+
env.GODD_LICENSE_KEY = existing.env.GODD_LICENSE_KEY;
|
|
30224
|
+
}
|
|
30225
|
+
const nodeDir = (0, import_node_path4.dirname)(resolveRealPath(process.execPath));
|
|
30226
|
+
if (process.platform === "win32") {
|
|
30227
|
+
const systemRoot = process.env.SystemRoot ?? "C:\\Windows";
|
|
30228
|
+
env.PATH = [
|
|
30229
|
+
nodeDir,
|
|
30230
|
+
(0, import_node_path4.join)(systemRoot, "system32"),
|
|
30231
|
+
systemRoot,
|
|
30232
|
+
(0, import_node_path4.join)(systemRoot, "System32", "Wbem")
|
|
30233
|
+
].join(import_node_path4.delimiter);
|
|
30234
|
+
} else {
|
|
30235
|
+
env.PATH = [nodeDir, "/usr/local/bin", "/usr/bin", "/bin"].join(import_node_path4.delimiter);
|
|
30236
|
+
}
|
|
30237
|
+
const newEntry = {
|
|
30238
|
+
command,
|
|
30239
|
+
args,
|
|
30240
|
+
...Object.keys(env).length > 0 ? { env } : {}
|
|
30241
|
+
};
|
|
30242
|
+
const isNew = !existing;
|
|
30243
|
+
const changed = isNew || JSON.stringify(existing) !== JSON.stringify(newEntry);
|
|
30244
|
+
if (changed) {
|
|
30245
|
+
config2.mcpServers[serverKey] = newEntry;
|
|
30246
|
+
(0, import_node_fs4.writeFileSync)(mcpJsonPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
30247
|
+
}
|
|
30248
|
+
const status = isNew ? "created" : changed ? "updated" : "unchanged";
|
|
30249
|
+
return { mcpJsonPath, status, serverKey };
|
|
30250
|
+
}
|
|
30251
|
+
function uninstallMcpServer() {
|
|
30252
|
+
const mcpJsonPath = (0, import_node_path4.join)((0, import_node_os.homedir)(), ".cursor", "mcp.json");
|
|
30253
|
+
if (!(0, import_node_fs4.existsSync)(mcpJsonPath)) {
|
|
30254
|
+
return { removed: false, mcpJsonPath };
|
|
30255
|
+
}
|
|
30256
|
+
const config2 = readMcpConfig(mcpJsonPath);
|
|
30257
|
+
const serverKey = brand.mcpKey;
|
|
30258
|
+
if (!config2.mcpServers[serverKey]) {
|
|
30259
|
+
return { removed: false, mcpJsonPath };
|
|
30260
|
+
}
|
|
30261
|
+
delete config2.mcpServers[serverKey];
|
|
30262
|
+
(0, import_node_fs4.writeFileSync)(mcpJsonPath, JSON.stringify(config2, null, 2) + "\n", "utf-8");
|
|
30263
|
+
return { removed: true, mcpJsonPath };
|
|
30264
|
+
}
|
|
30265
|
+
|
|
30051
30266
|
// src/cli/update-checker.ts
|
|
30052
30267
|
var GITHUB_REPO = "BM1314/GoDD";
|
|
30053
30268
|
var GITHUB_API_URL = `https://api.github.com/repos/${GITHUB_REPO}/releases/latest`;
|
|
@@ -30422,11 +30637,11 @@ async function validateLicense(registryUrl, licenseKey) {
|
|
|
30422
30637
|
|
|
30423
30638
|
// src/index.ts
|
|
30424
30639
|
function waitForEnter() {
|
|
30425
|
-
return new Promise((
|
|
30640
|
+
return new Promise((resolve4) => {
|
|
30426
30641
|
const rl = (0, import_node_readline2.createInterface)({ input: process.stdin, output: process.stdout });
|
|
30427
30642
|
rl.question(" Press Enter to close... ", () => {
|
|
30428
30643
|
rl.close();
|
|
30429
|
-
|
|
30644
|
+
resolve4();
|
|
30430
30645
|
});
|
|
30431
30646
|
});
|
|
30432
30647
|
}
|
|
@@ -30548,13 +30763,17 @@ function startServer() {
|
|
|
30548
30763
|
prompts: getAllPrompts()
|
|
30549
30764
|
}));
|
|
30550
30765
|
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
30766
|
+
const promptName = request.params.name;
|
|
30767
|
+
const slug = promptName.replace(brand.toolPrefix, "");
|
|
30768
|
+
if (LOCAL_SLUGS.has(slug)) {
|
|
30769
|
+
const text = slug === "config" ? generateConfigContext() : "";
|
|
30770
|
+
return { messages: [{ role: "user", content: { type: "text", text } }] };
|
|
30771
|
+
}
|
|
30551
30772
|
if (configIssues.length > 0) {
|
|
30552
30773
|
return {
|
|
30553
30774
|
messages: [{ role: "user", content: { type: "text", text: formatConfigIssuesForAI(configIssues) } }]
|
|
30554
30775
|
};
|
|
30555
30776
|
}
|
|
30556
|
-
const promptName = request.params.name;
|
|
30557
|
-
const slug = promptName.replace(brand.toolPrefix, "");
|
|
30558
30777
|
if (!registryClient) {
|
|
30559
30778
|
return {
|
|
30560
30779
|
messages: [
|
|
@@ -30599,15 +30818,19 @@ function startServer() {
|
|
|
30599
30818
|
tools: getAllTools()
|
|
30600
30819
|
}));
|
|
30601
30820
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
30821
|
+
const toolName = request.params.name;
|
|
30822
|
+
const slug = toolName.replace(brand.toolPrefix, "");
|
|
30823
|
+
const args = request.params.arguments ?? {};
|
|
30824
|
+
if (LOCAL_SLUGS.has(slug)) {
|
|
30825
|
+
const text = slug === "config" ? generateConfigContext() : "";
|
|
30826
|
+
return { content: [{ type: "text", text }] };
|
|
30827
|
+
}
|
|
30602
30828
|
if (configIssues.length > 0) {
|
|
30603
30829
|
return {
|
|
30604
30830
|
isError: true,
|
|
30605
30831
|
content: [{ type: "text", text: formatConfigIssuesForAI(configIssues) }]
|
|
30606
30832
|
};
|
|
30607
30833
|
}
|
|
30608
|
-
const toolName = request.params.name;
|
|
30609
|
-
const slug = toolName.replace(brand.toolPrefix, "");
|
|
30610
|
-
const args = request.params.arguments ?? {};
|
|
30611
30834
|
if (!registryClient) {
|
|
30612
30835
|
return {
|
|
30613
30836
|
isError: true,
|