@taptap/maker 0.0.19-beta.1 → 0.0.20
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/README.md +1 -1
- package/dist/maker.js +422 -182
- package/package.json +1 -1
- package/skills/taptap-maker-local/SKILL.md +11 -3
package/README.md
CHANGED
package/dist/maker.js
CHANGED
|
@@ -13005,6 +13005,7 @@ var require_cross_spawn = __commonJS({
|
|
|
13005
13005
|
import { execFileSync, spawn as spawn4, spawnSync as spawnSync6 } from "node:child_process";
|
|
13006
13006
|
import fs13 from "node:fs";
|
|
13007
13007
|
import path14 from "node:path";
|
|
13008
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
13008
13009
|
|
|
13009
13010
|
// node_modules/zod/v3/helpers/util.js
|
|
13010
13011
|
var util;
|
|
@@ -33155,13 +33156,20 @@ async function materialize3dFinalResult(options, toolName) {
|
|
|
33155
33156
|
if ("localPath" in mdlMaterialized) {
|
|
33156
33157
|
nextPayload.mdlLocalPath = mdlMaterialized.localPath;
|
|
33157
33158
|
nextPayload.mdlAbsolutePath = mdlMaterialized.absolutePath;
|
|
33158
|
-
|
|
33159
|
-
|
|
33160
|
-
|
|
33161
|
-
|
|
33162
|
-
|
|
33163
|
-
|
|
33164
|
-
|
|
33159
|
+
let mdlExtractError;
|
|
33160
|
+
try {
|
|
33161
|
+
extractZip(
|
|
33162
|
+
mdlMaterialized.absolutePath,
|
|
33163
|
+
path13.join(options.targetDir, "assets"),
|
|
33164
|
+
"3D model asset"
|
|
33165
|
+
);
|
|
33166
|
+
nextPayload.mdlExtracted = true;
|
|
33167
|
+
nextPayload.mdlExtractedTo = "assets";
|
|
33168
|
+
} catch (error2) {
|
|
33169
|
+
mdlExtractError = `3D model asset extraction failed: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
33170
|
+
nextPayload.mdlExtracted = false;
|
|
33171
|
+
nextPayload.mdlExtractError = mdlExtractError;
|
|
33172
|
+
}
|
|
33165
33173
|
if (mdlUrl) {
|
|
33166
33174
|
upsertGeneratedAssetRecord(options.targetDir, mdlMaterialized.localPath, {
|
|
33167
33175
|
tool: toolName,
|
|
@@ -33175,7 +33183,8 @@ async function materialize3dFinalResult(options, toolName) {
|
|
|
33175
33183
|
taskId,
|
|
33176
33184
|
modelCdnUrl,
|
|
33177
33185
|
renderedImageUrl,
|
|
33178
|
-
mdlConversionError
|
|
33186
|
+
mdlConversionError,
|
|
33187
|
+
mdlExtractError
|
|
33179
33188
|
});
|
|
33180
33189
|
}
|
|
33181
33190
|
}
|
|
@@ -33632,8 +33641,151 @@ function extensionFromUrl(url2) {
|
|
|
33632
33641
|
}
|
|
33633
33642
|
}
|
|
33634
33643
|
|
|
33644
|
+
// src/mcp-proxy/config.ts
|
|
33645
|
+
var DEFAULT_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
33646
|
+
function readStdin() {
|
|
33647
|
+
return new Promise((resolve, reject) => {
|
|
33648
|
+
const chunks = [];
|
|
33649
|
+
process.stdin.on("data", (chunk) => {
|
|
33650
|
+
chunks.push(chunk);
|
|
33651
|
+
});
|
|
33652
|
+
process.stdin.on("end", () => {
|
|
33653
|
+
resolve(Buffer.concat(chunks).toString("utf-8"));
|
|
33654
|
+
});
|
|
33655
|
+
process.stdin.on("error", reject);
|
|
33656
|
+
setTimeout(() => {
|
|
33657
|
+
reject(new Error("Timeout reading from stdin"));
|
|
33658
|
+
}, 5e3);
|
|
33659
|
+
});
|
|
33660
|
+
}
|
|
33661
|
+
async function loadConfig() {
|
|
33662
|
+
let configJson;
|
|
33663
|
+
let source;
|
|
33664
|
+
if (process.argv[2]) {
|
|
33665
|
+
configJson = process.argv[2];
|
|
33666
|
+
source = "command line argument";
|
|
33667
|
+
} else if (process.env.PROXY_CONFIG) {
|
|
33668
|
+
configJson = process.env.PROXY_CONFIG;
|
|
33669
|
+
source = "PROXY_CONFIG environment variable";
|
|
33670
|
+
} else if (!process.stdin.isTTY) {
|
|
33671
|
+
configJson = await readStdin();
|
|
33672
|
+
source = "stdin";
|
|
33673
|
+
} else {
|
|
33674
|
+
throw new Error(
|
|
33675
|
+
`No configuration provided. Please use one of:
|
|
33676
|
+
1. Command line: node index.js '{"server":{...}}'
|
|
33677
|
+
2. Env var: PROXY_CONFIG='{"server":{...}}' node index.js
|
|
33678
|
+
3. Stdin: echo '{"server":{...}}' | node index.js
|
|
33679
|
+
|
|
33680
|
+
See config.example.json for configuration format.`
|
|
33681
|
+
);
|
|
33682
|
+
}
|
|
33683
|
+
console.error(`[Proxy] Loading config from ${source}`);
|
|
33684
|
+
let config2;
|
|
33685
|
+
try {
|
|
33686
|
+
config2 = JSON.parse(configJson);
|
|
33687
|
+
} catch (error2) {
|
|
33688
|
+
throw new Error(
|
|
33689
|
+
`Failed to parse configuration JSON: ${error2 instanceof Error ? error2.message : String(error2)}
|
|
33690
|
+
Received: ${configJson.substring(0, 100)}...`
|
|
33691
|
+
);
|
|
33692
|
+
}
|
|
33693
|
+
validateConfig(config2);
|
|
33694
|
+
return applyDefaults(config2);
|
|
33695
|
+
}
|
|
33696
|
+
function validateConfig(config2) {
|
|
33697
|
+
var _a3;
|
|
33698
|
+
const errors = [];
|
|
33699
|
+
if (!config2.server) {
|
|
33700
|
+
errors.push("- Missing required field: server");
|
|
33701
|
+
} else {
|
|
33702
|
+
if (!config2.server.url) {
|
|
33703
|
+
errors.push("- Missing required field: server.url");
|
|
33704
|
+
}
|
|
33705
|
+
if (config2.server.env && !["rnd", "production"].includes(config2.server.env)) {
|
|
33706
|
+
errors.push('- Invalid server.env: must be "rnd" or "production"');
|
|
33707
|
+
}
|
|
33708
|
+
}
|
|
33709
|
+
if (!config2.tenant) {
|
|
33710
|
+
errors.push("- Missing required field: tenant");
|
|
33711
|
+
} else {
|
|
33712
|
+
if (config2.tenant.custom_fields !== void 0) {
|
|
33713
|
+
const cf = config2.tenant.custom_fields;
|
|
33714
|
+
if (typeof cf !== "object" || cf === null || Array.isArray(cf) || Object.getPrototypeOf(cf) !== Object.prototype) {
|
|
33715
|
+
errors.push("- tenant.custom_fields must be a plain object (Record<string, string>)");
|
|
33716
|
+
} else if (!Object.values(cf).every((v) => typeof v === "string")) {
|
|
33717
|
+
errors.push("- tenant.custom_fields values must all be strings");
|
|
33718
|
+
}
|
|
33719
|
+
}
|
|
33720
|
+
}
|
|
33721
|
+
if (!config2.auth) {
|
|
33722
|
+
errors.push("- Missing required field: auth");
|
|
33723
|
+
} else {
|
|
33724
|
+
if (!config2.auth.kid) {
|
|
33725
|
+
errors.push("- Missing required field: auth.kid");
|
|
33726
|
+
}
|
|
33727
|
+
if (!config2.auth.mac_key) {
|
|
33728
|
+
errors.push("- Missing required field: auth.mac_key");
|
|
33729
|
+
}
|
|
33730
|
+
if (config2.auth.token_type !== "mac") {
|
|
33731
|
+
errors.push('- Invalid auth.token_type: must be "mac"');
|
|
33732
|
+
}
|
|
33733
|
+
if (config2.auth.mac_algorithm !== "hmac-sha-1") {
|
|
33734
|
+
errors.push('- Invalid auth.mac_algorithm: must be "hmac-sha-1"');
|
|
33735
|
+
}
|
|
33736
|
+
}
|
|
33737
|
+
if (((_a3 = config2.options) == null ? void 0 : _a3.exposed_tools) !== void 0) {
|
|
33738
|
+
const exposedTools = config2.options.exposed_tools;
|
|
33739
|
+
if (!Array.isArray(exposedTools)) {
|
|
33740
|
+
errors.push("- options.exposed_tools must be an array of tool names");
|
|
33741
|
+
} else if (!exposedTools.every((toolName) => typeof toolName === "string" && toolName.trim().length > 0)) {
|
|
33742
|
+
errors.push("- options.exposed_tools values must be non-empty strings");
|
|
33743
|
+
}
|
|
33744
|
+
}
|
|
33745
|
+
if (errors.length > 0) {
|
|
33746
|
+
throw new Error("Invalid configuration:\n" + errors.join("\n"));
|
|
33747
|
+
}
|
|
33748
|
+
}
|
|
33749
|
+
var DEFAULT_LOG_ROOT = "/tmp/taptap-mcp/logs";
|
|
33750
|
+
function applyDefaults(config2) {
|
|
33751
|
+
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
33752
|
+
const verbose = ((_a3 = config2.options) == null ? void 0 : _a3.verbose) ?? false;
|
|
33753
|
+
return {
|
|
33754
|
+
server: {
|
|
33755
|
+
url: config2.server.url,
|
|
33756
|
+
env: config2.server.env || "rnd"
|
|
33757
|
+
},
|
|
33758
|
+
tenant: {
|
|
33759
|
+
project_path: config2.tenant.project_path || ".",
|
|
33760
|
+
user_id: config2.tenant.user_id,
|
|
33761
|
+
project_id: config2.tenant.project_id,
|
|
33762
|
+
custom_fields: config2.tenant.custom_fields
|
|
33763
|
+
},
|
|
33764
|
+
auth: config2.auth,
|
|
33765
|
+
options: {
|
|
33766
|
+
verbose,
|
|
33767
|
+
reconnect_interval: ((_b = config2.options) == null ? void 0 : _b.reconnect_interval) ?? 5e3,
|
|
33768
|
+
request_timeout: ((_c = config2.options) == null ? void 0 : _c.request_timeout) ?? 3e4,
|
|
33769
|
+
tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
|
|
33770
|
+
reset_timeout_on_progress: ((_e = config2.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true,
|
|
33771
|
+
health_check_interval: ((_f = config2.options) == null ? void 0 : _f.health_check_interval) ?? 3e4,
|
|
33772
|
+
enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
|
|
33773
|
+
inject_params_per_call: ((_h = config2.options) == null ? void 0 : _h.inject_params_per_call) ?? true,
|
|
33774
|
+
force_inject_progress_token: ((_i = config2.options) == null ? void 0 : _i.force_inject_progress_token) ?? false,
|
|
33775
|
+
exposed_tools: (_j = config2.options) == null ? void 0 : _j.exposed_tools,
|
|
33776
|
+
log: {
|
|
33777
|
+
root: ((_l = (_k = config2.options) == null ? void 0 : _k.log) == null ? void 0 : _l.root) ?? DEFAULT_LOG_ROOT,
|
|
33778
|
+
enabled: ((_n = (_m = config2.options) == null ? void 0 : _m.log) == null ? void 0 : _n.enabled) ?? false,
|
|
33779
|
+
// verbose=true 时自动使用 debug 级别
|
|
33780
|
+
level: verbose ? "debug" : ((_p = (_o = config2.options) == null ? void 0 : _o.log) == null ? void 0 : _p.level) ?? "info",
|
|
33781
|
+
max_days: ((_r = (_q = config2.options) == null ? void 0 : _q.log) == null ? void 0 : _r.max_days) ?? 7
|
|
33782
|
+
}
|
|
33783
|
+
}
|
|
33784
|
+
};
|
|
33785
|
+
}
|
|
33786
|
+
|
|
33635
33787
|
// src/maker/server/mcp.ts
|
|
33636
|
-
var VERSION = true ? "0.0.
|
|
33788
|
+
var VERSION = true ? "0.0.20" : "dev";
|
|
33637
33789
|
var DEFAULT_BUILD_TIMEOUT_MS = 10 * 60 * 1e3;
|
|
33638
33790
|
var DEFAULT_PROXY_RETRY_ATTEMPTS = 5;
|
|
33639
33791
|
var DEFAULT_PROXY_RETRY_DELAY_MS = 30 * 1e3;
|
|
@@ -33663,7 +33815,7 @@ var MakerCloneFailedError = class extends Error {
|
|
|
33663
33815
|
var tools = [
|
|
33664
33816
|
{
|
|
33665
33817
|
name: "maker_status_lite",
|
|
33666
|
-
description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets, supported local path/remote URL/data URL inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.
|
|
33818
|
+
description: "Compatibility status surface for clients using tool output instead of the maker://status resource. Prefer reading maker://status when resources are available. Shows local Maker status for the user current working directory, including Git, Python runtime readiness, maker-lua-lsp readiness for local Lua diagnostics, PAT/TapTap auth, project binding, AI dev kit status, Maker proxy tools status and failures, Maker Git Workflow Policy guidance, Maker Creative Asset Tool Policy guidance to prefer Maker MCP proxy tools for bound game assets, supported local path/remote URL/data URL inputs, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. Standard init/clone/download flow: show the Maker app list first and let the user choose an existing app or 0/new. Create-new-project flow: use taptap-maker init --create only when the user clearly asks to create a new Maker project.",
|
|
33667
33819
|
inputSchema: {
|
|
33668
33820
|
type: "object",
|
|
33669
33821
|
properties: {
|
|
@@ -33742,22 +33894,30 @@ var resources = [
|
|
|
33742
33894
|
{
|
|
33743
33895
|
uri: "maker://status",
|
|
33744
33896
|
name: "Maker status",
|
|
33745
|
-
description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init.
|
|
33897
|
+
description: "Local TapTap Maker project status, including Git, PAT/TapTap auth, project binding, AI dev kit status, and bundled workflow guide document paths. Maker initialization next_step: taptap-maker init. Standard init/clone/download flow: show the Maker app list first and let the user choose an existing app or 0/new. Create-new-project flow: use taptap-maker init --create only when the user clearly asks to create a new Maker project.",
|
|
33746
33898
|
mimeType: "text/plain"
|
|
33747
33899
|
}
|
|
33748
33900
|
];
|
|
33749
33901
|
async function listMakerTools(options) {
|
|
33750
33902
|
let remoteTools = [];
|
|
33751
33903
|
try {
|
|
33904
|
+
const context = await resolveMakerProjectContext({
|
|
33905
|
+
targetDir: options.targetDir,
|
|
33906
|
+
listClientRoots: options.listClientRoots,
|
|
33907
|
+
allowFallbackOnAmbiguousRoots: false
|
|
33908
|
+
});
|
|
33752
33909
|
const listedRemoteTools = options.listRemoteTools ?? (() => listRemoteProxyTools({
|
|
33753
|
-
targetDir:
|
|
33910
|
+
targetDir: context.targetDir,
|
|
33754
33911
|
serverUrl: options.serverUrl,
|
|
33755
33912
|
env: options.env
|
|
33756
33913
|
}));
|
|
33757
33914
|
remoteTools = filterExposedRemoteProxyTools(await listedRemoteTools()).map(
|
|
33758
33915
|
decorateRemoteProxyToolDefinition
|
|
33759
33916
|
);
|
|
33760
|
-
} catch {
|
|
33917
|
+
} catch (error2) {
|
|
33918
|
+
if (isMakerProjectContextAmbiguousError(error2)) {
|
|
33919
|
+
logLifecycleEvent("maker-tools-list-roots-ambiguous", String(error2));
|
|
33920
|
+
}
|
|
33761
33921
|
remoteTools = [];
|
|
33762
33922
|
}
|
|
33763
33923
|
return {
|
|
@@ -33770,14 +33930,30 @@ function filterExposedRemoteProxyTools(toolsToFilter) {
|
|
|
33770
33930
|
}
|
|
33771
33931
|
function decorateRemoteProxyToolDefinition(tool) {
|
|
33772
33932
|
const guidance = remoteProxyToolGuidance(tool.name);
|
|
33773
|
-
if (!guidance) {
|
|
33774
|
-
return tool;
|
|
33775
|
-
}
|
|
33776
33933
|
return {
|
|
33777
33934
|
...tool,
|
|
33935
|
+
inputSchema: decorateRemoteProxyToolInputSchema(tool.inputSchema),
|
|
33778
33936
|
description: [tool.description, guidance].filter(Boolean).join("\n\n")
|
|
33779
33937
|
};
|
|
33780
33938
|
}
|
|
33939
|
+
function decorateRemoteProxyToolInputSchema(inputSchema) {
|
|
33940
|
+
const schema = isPlainRecord(inputSchema) ? inputSchema : {};
|
|
33941
|
+
const properties = isPlainRecord(schema.properties) ? schema.properties : {};
|
|
33942
|
+
return {
|
|
33943
|
+
...schema,
|
|
33944
|
+
type: schema.type || "object",
|
|
33945
|
+
properties: {
|
|
33946
|
+
...properties,
|
|
33947
|
+
target_dir: {
|
|
33948
|
+
type: "string",
|
|
33949
|
+
description: "Optional local Maker project directory. This is a local Maker MCP private parameter used to resolve the current project for asset materialization and reference rewriting; it is not forwarded to the remote Maker generation tool."
|
|
33950
|
+
}
|
|
33951
|
+
}
|
|
33952
|
+
};
|
|
33953
|
+
}
|
|
33954
|
+
function isPlainRecord(value) {
|
|
33955
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
33956
|
+
}
|
|
33781
33957
|
function remoteProxyToolGuidance(toolName) {
|
|
33782
33958
|
const failurePolicy = "If this Maker proxy tool fails or returns isError, include the full remote_result/error payload from the server so developers can diagnose the issue.";
|
|
33783
33959
|
const localMediaSizeHint = "Large local/data URL media can be slow or fail: image inputs are commonly limited to about 10 MB, video-task image inputs to about 30 MB, video inputs to about 50 MB, and audio inputs to about 15 MB.";
|
|
@@ -33934,6 +34110,8 @@ function createRemoteProxyProgressHandler(progressToken, extra) {
|
|
|
33934
34110
|
}
|
|
33935
34111
|
function createRemoteProxyCallToolOptions(progressToken, extra) {
|
|
33936
34112
|
return {
|
|
34113
|
+
timeout: DEFAULT_TOOL_CALL_TIMEOUT_MS,
|
|
34114
|
+
resetTimeoutOnProgress: true,
|
|
33937
34115
|
onprogress: createRemoteProxyProgressHandler(progressToken, extra)
|
|
33938
34116
|
};
|
|
33939
34117
|
}
|
|
@@ -33950,10 +34128,8 @@ async function startMakerMcpServer() {
|
|
|
33950
34128
|
}
|
|
33951
34129
|
}
|
|
33952
34130
|
);
|
|
33953
|
-
server
|
|
33954
|
-
|
|
33955
|
-
async () => listMakerTools({ targetDir: process.cwd() })
|
|
33956
|
-
);
|
|
34131
|
+
const listClientRoots = createServerClientRootsProvider(server);
|
|
34132
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => listMakerTools({ listClientRoots }));
|
|
33957
34133
|
server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources }));
|
|
33958
34134
|
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
33959
34135
|
const uri = request.params.uri;
|
|
@@ -33965,7 +34141,7 @@ async function startMakerMcpServer() {
|
|
|
33965
34141
|
{
|
|
33966
34142
|
uri,
|
|
33967
34143
|
mimeType: "text/plain",
|
|
33968
|
-
text: await formatStatus()
|
|
34144
|
+
text: await formatStatus({ listClientRoots })
|
|
33969
34145
|
}
|
|
33970
34146
|
]
|
|
33971
34147
|
};
|
|
@@ -33982,7 +34158,8 @@ async function startMakerMcpServer() {
|
|
|
33982
34158
|
type: "text",
|
|
33983
34159
|
text: await formatStatus({
|
|
33984
34160
|
targetDir: args.target_dir,
|
|
33985
|
-
skipRemoteSync: args.skip_remote_sync
|
|
34161
|
+
skipRemoteSync: args.skip_remote_sync,
|
|
34162
|
+
listClientRoots
|
|
33986
34163
|
})
|
|
33987
34164
|
}
|
|
33988
34165
|
]
|
|
@@ -33998,8 +34175,13 @@ async function startMakerMcpServer() {
|
|
|
33998
34175
|
let result;
|
|
33999
34176
|
let progressSummary;
|
|
34000
34177
|
try {
|
|
34178
|
+
const context = await resolveMakerProjectContext({
|
|
34179
|
+
targetDir: args.target_dir,
|
|
34180
|
+
listClientRoots,
|
|
34181
|
+
allowFallbackOnAmbiguousRoots: false
|
|
34182
|
+
});
|
|
34001
34183
|
result = await buildCurrentDirectory({
|
|
34002
|
-
targetDir:
|
|
34184
|
+
targetDir: context.targetDir,
|
|
34003
34185
|
entry: args.entry,
|
|
34004
34186
|
scriptsPath: args.scriptsPath,
|
|
34005
34187
|
entryClient: args.entry_client,
|
|
@@ -34028,10 +34210,18 @@ async function startMakerMcpServer() {
|
|
|
34028
34210
|
};
|
|
34029
34211
|
}
|
|
34030
34212
|
if (isExposedRemoteProxyTool(name)) {
|
|
34213
|
+
const { targetDir, remoteArgs } = splitRemoteProxyToolPrivateArgs(
|
|
34214
|
+
request.params.arguments || {}
|
|
34215
|
+
);
|
|
34216
|
+
const context = await resolveMakerProjectContext({
|
|
34217
|
+
targetDir,
|
|
34218
|
+
listClientRoots,
|
|
34219
|
+
allowFallbackOnAmbiguousRoots: false
|
|
34220
|
+
});
|
|
34031
34221
|
return await callRemoteProxyTool({
|
|
34032
|
-
targetDir:
|
|
34222
|
+
targetDir: context.targetDir,
|
|
34033
34223
|
name,
|
|
34034
|
-
args:
|
|
34224
|
+
args: remoteArgs,
|
|
34035
34225
|
progressToken: (_b = request.params._meta) == null ? void 0 : _b.progressToken,
|
|
34036
34226
|
extra
|
|
34037
34227
|
});
|
|
@@ -34085,7 +34275,12 @@ function installMakerServerExitHandlers() {
|
|
|
34085
34275
|
}
|
|
34086
34276
|
async function formatStatus(options = {}) {
|
|
34087
34277
|
var _a3;
|
|
34088
|
-
const
|
|
34278
|
+
const projectContext = await resolveMakerProjectContext({
|
|
34279
|
+
targetDir: options.targetDir,
|
|
34280
|
+
listClientRoots: options.listClientRoots,
|
|
34281
|
+
allowFallbackOnAmbiguousRoots: true
|
|
34282
|
+
});
|
|
34283
|
+
const targetDir = projectContext.targetDir;
|
|
34089
34284
|
const env = getMakerEnvironment(void 0, targetDir);
|
|
34090
34285
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
34091
34286
|
const mcpCwd = process.cwd();
|
|
@@ -34128,6 +34323,7 @@ async function formatStatus(options = {}) {
|
|
|
34128
34323
|
`- tap_auth: ${tapAuth ? "found" : "missing"} (${getTapAuthPath()})`,
|
|
34129
34324
|
`- pat: ${pat ? "found" : "missing"} (${getPatPath()})`,
|
|
34130
34325
|
`- target_dir: ${targetDir}`,
|
|
34326
|
+
`- project_context_source: ${projectContext.source}`,
|
|
34131
34327
|
`- project_source: ${identify.source}`,
|
|
34132
34328
|
`- project_id: ${identify.projectId || "(none)"}`,
|
|
34133
34329
|
identify.configPath ? `- config: ${identify.configPath}` : "",
|
|
@@ -34143,7 +34339,9 @@ async function formatStatus(options = {}) {
|
|
|
34143
34339
|
"",
|
|
34144
34340
|
formatMakerGitDirectoryStatus(gitDirectoryStatus),
|
|
34145
34341
|
"",
|
|
34146
|
-
|
|
34342
|
+
formatMakerClientRootsStatus(projectContext.roots),
|
|
34343
|
+
"",
|
|
34344
|
+
projectContext.source === "client_roots" ? "" : formatMakerToolRegistrationCwdStatus({
|
|
34147
34345
|
mcpCwd,
|
|
34148
34346
|
targetDir,
|
|
34149
34347
|
projectRoot: identify.projectRoot,
|
|
@@ -34374,11 +34572,180 @@ function formatAiDialogueDirectoryHint(targetDir) {
|
|
|
34374
34572
|
"- do_not_show_app_selection_here: yes"
|
|
34375
34573
|
].join("\n");
|
|
34376
34574
|
}
|
|
34377
|
-
function
|
|
34378
|
-
|
|
34379
|
-
|
|
34575
|
+
function createServerClientRootsProvider(server) {
|
|
34576
|
+
return async () => {
|
|
34577
|
+
const capabilities = server.getClientCapabilities();
|
|
34578
|
+
if (!(capabilities == null ? void 0 : capabilities.roots)) {
|
|
34579
|
+
return void 0;
|
|
34580
|
+
}
|
|
34581
|
+
const result = await server.listRoots(void 0, { timeout: 2e3 });
|
|
34582
|
+
return result.roots;
|
|
34583
|
+
};
|
|
34584
|
+
}
|
|
34585
|
+
async function resolveMakerProjectContext(options = {}) {
|
|
34586
|
+
if (options.targetDir) {
|
|
34587
|
+
return {
|
|
34588
|
+
targetDir: path14.resolve(options.targetDir),
|
|
34589
|
+
source: "explicit_target_dir",
|
|
34590
|
+
roots: { status: "not_requested", roots: [] }
|
|
34591
|
+
};
|
|
34592
|
+
}
|
|
34593
|
+
const roots = await resolveMakerClientRoots(options.listClientRoots);
|
|
34594
|
+
if (roots.status === "selected") {
|
|
34595
|
+
return {
|
|
34596
|
+
targetDir: roots.selectedProjectRoot || roots.selectedRoot,
|
|
34597
|
+
source: "client_roots",
|
|
34598
|
+
roots
|
|
34599
|
+
};
|
|
34600
|
+
}
|
|
34601
|
+
if (roots.status === "ambiguous" && !options.allowFallbackOnAmbiguousRoots) {
|
|
34602
|
+
throw new MakerProjectContextAmbiguousError(
|
|
34603
|
+
[
|
|
34604
|
+
"Multiple Maker project roots are attached to this MCP session.",
|
|
34605
|
+
`maker_project_roots: ${roots.makerProjectRoots.join(", ") || "(none)"}`,
|
|
34606
|
+
"Open a single Maker workspace, or pass target_dir explicitly for this call."
|
|
34607
|
+
].join("\n")
|
|
34608
|
+
);
|
|
34609
|
+
}
|
|
34610
|
+
return {
|
|
34611
|
+
targetDir: process.cwd(),
|
|
34612
|
+
source: "mcp_cwd_fallback",
|
|
34613
|
+
roots
|
|
34614
|
+
};
|
|
34615
|
+
}
|
|
34616
|
+
var MakerProjectContextAmbiguousError = class extends Error {
|
|
34617
|
+
constructor(message) {
|
|
34618
|
+
super(message);
|
|
34619
|
+
this.name = "MakerProjectContextAmbiguousError";
|
|
34620
|
+
}
|
|
34621
|
+
};
|
|
34622
|
+
function isMakerProjectContextAmbiguousError(error2) {
|
|
34623
|
+
return error2 instanceof MakerProjectContextAmbiguousError;
|
|
34624
|
+
}
|
|
34625
|
+
async function resolveMakerClientRoots(listClientRoots) {
|
|
34626
|
+
if (!listClientRoots) {
|
|
34627
|
+
return { status: "not_requested", roots: [] };
|
|
34628
|
+
}
|
|
34629
|
+
let roots;
|
|
34630
|
+
try {
|
|
34631
|
+
roots = await listClientRoots();
|
|
34632
|
+
} catch (error2) {
|
|
34633
|
+
return {
|
|
34634
|
+
status: "unavailable",
|
|
34635
|
+
roots: [],
|
|
34636
|
+
message: error2 instanceof Error ? error2.message : String(error2)
|
|
34637
|
+
};
|
|
34638
|
+
}
|
|
34639
|
+
if (!roots) {
|
|
34640
|
+
return { status: "unsupported", roots: [] };
|
|
34641
|
+
}
|
|
34642
|
+
const rootPaths = uniquePaths(
|
|
34643
|
+
roots.map(rootToLocalPath).filter((item) => Boolean(item))
|
|
34644
|
+
);
|
|
34645
|
+
if (rootPaths.length === 0) {
|
|
34646
|
+
return { status: "no_roots", roots: [] };
|
|
34647
|
+
}
|
|
34648
|
+
if (rootPaths.length === 1) {
|
|
34649
|
+
const identify = identifyMakerProject({ cwd: rootPaths[0] });
|
|
34650
|
+
return {
|
|
34651
|
+
status: "selected",
|
|
34652
|
+
roots: rootPaths,
|
|
34653
|
+
selectedRoot: rootPaths[0],
|
|
34654
|
+
selectedProjectRoot: identify.projectRoot,
|
|
34655
|
+
reason: "single_root"
|
|
34656
|
+
};
|
|
34657
|
+
}
|
|
34658
|
+
const makerProjectRoots = uniquePaths(
|
|
34659
|
+
rootPaths.map((rootPath) => identifyMakerProject({ cwd: rootPath }).projectRoot).filter((item) => Boolean(item))
|
|
34660
|
+
);
|
|
34661
|
+
if (makerProjectRoots.length === 1) {
|
|
34662
|
+
return {
|
|
34663
|
+
status: "selected",
|
|
34664
|
+
roots: rootPaths,
|
|
34665
|
+
selectedRoot: makerProjectRoots[0],
|
|
34666
|
+
selectedProjectRoot: makerProjectRoots[0],
|
|
34667
|
+
reason: "single_maker_project"
|
|
34668
|
+
};
|
|
34669
|
+
}
|
|
34670
|
+
return {
|
|
34671
|
+
status: "ambiguous",
|
|
34672
|
+
roots: rootPaths,
|
|
34673
|
+
makerProjectRoots,
|
|
34674
|
+
message: makerProjectRoots.length > 1 ? "Multiple attached roots are bound Maker projects." : "Multiple attached roots are present and none is a bound Maker project."
|
|
34675
|
+
};
|
|
34676
|
+
}
|
|
34677
|
+
function rootToLocalPath(root) {
|
|
34678
|
+
try {
|
|
34679
|
+
const url2 = new URL(root.uri);
|
|
34680
|
+
if (url2.protocol !== "file:") {
|
|
34681
|
+
return void 0;
|
|
34682
|
+
}
|
|
34683
|
+
return path14.resolve(fileURLToPath2(url2));
|
|
34684
|
+
} catch {
|
|
34685
|
+
return void 0;
|
|
34380
34686
|
}
|
|
34381
|
-
|
|
34687
|
+
}
|
|
34688
|
+
function uniquePaths(values) {
|
|
34689
|
+
const seen = /* @__PURE__ */ new Set();
|
|
34690
|
+
const result = [];
|
|
34691
|
+
for (const value of values) {
|
|
34692
|
+
const normalized = normalizePathForCompare2(value);
|
|
34693
|
+
if (seen.has(normalized)) {
|
|
34694
|
+
continue;
|
|
34695
|
+
}
|
|
34696
|
+
seen.add(normalized);
|
|
34697
|
+
result.push(path14.resolve(value));
|
|
34698
|
+
}
|
|
34699
|
+
return result;
|
|
34700
|
+
}
|
|
34701
|
+
function normalizePathForCompare2(value) {
|
|
34702
|
+
const resolved = path14.resolve(value);
|
|
34703
|
+
try {
|
|
34704
|
+
return fs13.realpathSync.native(resolved);
|
|
34705
|
+
} catch {
|
|
34706
|
+
return resolved;
|
|
34707
|
+
}
|
|
34708
|
+
}
|
|
34709
|
+
function formatMakerClientRootsStatus(roots) {
|
|
34710
|
+
if (roots.status === "not_requested") {
|
|
34711
|
+
return "";
|
|
34712
|
+
}
|
|
34713
|
+
const lines = [
|
|
34714
|
+
"MCP client roots",
|
|
34715
|
+
"",
|
|
34716
|
+
`- status: ${roots.status}`,
|
|
34717
|
+
`- roots: ${roots.roots.join(", ") || "(none)"}`
|
|
34718
|
+
];
|
|
34719
|
+
if (roots.status === "selected") {
|
|
34720
|
+
lines.push(`- selected_root: ${roots.selectedRoot}`);
|
|
34721
|
+
lines.push(`- selected_project_root: ${roots.selectedProjectRoot || "(none)"}`);
|
|
34722
|
+
lines.push(`- reason: ${roots.reason}`);
|
|
34723
|
+
lines.push("- next_action: Continue using the client workspace root as the Maker target.");
|
|
34724
|
+
} else if (roots.status === "ambiguous") {
|
|
34725
|
+
lines.push(`- maker_project_roots: ${roots.makerProjectRoots.join(", ") || "(none)"}`);
|
|
34726
|
+
lines.push(`- issue: ${roots.message}`);
|
|
34727
|
+
lines.push(
|
|
34728
|
+
"- next_action: Open a single Maker workspace, or pass target_dir explicitly for this call."
|
|
34729
|
+
);
|
|
34730
|
+
} else if (roots.status === "unsupported") {
|
|
34731
|
+
lines.push("- next_action: This client did not advertise MCP roots; falling back to MCP cwd.");
|
|
34732
|
+
} else if (roots.status === "unavailable") {
|
|
34733
|
+
lines.push(`- failure_message: ${roots.message || "(unknown)"}`);
|
|
34734
|
+
lines.push("- next_action: Could not read MCP roots; falling back to MCP cwd.");
|
|
34735
|
+
}
|
|
34736
|
+
return lines.join("\n");
|
|
34737
|
+
}
|
|
34738
|
+
function splitRemoteProxyToolPrivateArgs(args) {
|
|
34739
|
+
const remoteArgs = { ...args };
|
|
34740
|
+
const targetDir = remoteArgs.target_dir;
|
|
34741
|
+
delete remoteArgs.target_dir;
|
|
34742
|
+
if (targetDir === void 0) {
|
|
34743
|
+
return { remoteArgs };
|
|
34744
|
+
}
|
|
34745
|
+
if (typeof targetDir !== "string") {
|
|
34746
|
+
throw new Error("target_dir must be a string when provided.");
|
|
34747
|
+
}
|
|
34748
|
+
return { targetDir, remoteArgs };
|
|
34382
34749
|
}
|
|
34383
34750
|
async function formatAiDevKitStatus(projectRoot, options = {}) {
|
|
34384
34751
|
const devKitStatus = inspectAiDevKit(projectRoot);
|
|
@@ -34419,6 +34786,7 @@ async function formatAutoProjectListFromPat() {
|
|
|
34419
34786
|
return [
|
|
34420
34787
|
"本地已有 Maker PAT,当前目录尚未绑定 Maker 项目。",
|
|
34421
34788
|
"绑定项目时必须先提醒用户:0,创建新项目 / 0. Create a new Maker project。",
|
|
34789
|
+
"普通初始化、clone、拉取远端项目的标准流程:先展示 app 列表,让用户选择已有 app;用户明确选择 0/new 或明确要求创建时再创建新项目。",
|
|
34422
34790
|
"即使发现和当前目录同名的 Maker app,也不能只推荐同名 app;必须同时展示创建新项目选项。",
|
|
34423
34791
|
"当前目录未绑定时,先展示下面的 Maker Apps 预览和总数;选择、解释和 clone 顺序请参考 taptap-maker-local workflow guide document。",
|
|
34424
34792
|
"用户选择 0/new 或已有 app 后,next_step: 执行 `taptap-maker init`。",
|
|
@@ -34469,6 +34837,7 @@ function formatStatusProjectList(projects) {
|
|
|
34469
34837
|
hiddenCount > 0 ? "如需完整列表,请运行 taptap-maker apps --json 查看全部 app。" : void 0,
|
|
34470
34838
|
"0,创建新项目 / 0. Create a new Maker project",
|
|
34471
34839
|
"AI 必须把上面这一行作为可选项展示给用户;即使压缩 app 列表,也不要删除创建项目入口。",
|
|
34840
|
+
"AI 标准流程:先让用户从 app 列表选择已有 app;当用户选择 0/new 或明确要求创建新项目时,再进入创建流程。",
|
|
34472
34841
|
"AI 展示建议:如果聊天或客户端宽度足够,可把 app 预览整理成两列紧凑布局;每个 app 保留序号、app_id、名称,以及可用的最近活跃时间或 user_id。窄屏保持单列。选择 app 前先获取用户确认。",
|
|
34473
34842
|
"",
|
|
34474
34843
|
...visibleProjects.map(
|
|
@@ -35209,7 +35578,7 @@ async function refreshMakerPreview(buildResult) {
|
|
|
35209
35578
|
clearTimeout(timeout);
|
|
35210
35579
|
}
|
|
35211
35580
|
}
|
|
35212
|
-
function createRemoteRuntimeLogClient(proxy, timeoutMs =
|
|
35581
|
+
function createRemoteRuntimeLogClient(proxy, timeoutMs = DEFAULT_TOOL_CALL_TIMEOUT_MS, options = {}) {
|
|
35213
35582
|
let client;
|
|
35214
35583
|
const createTransport = options.createTransport || (() => trackMakerChildTransport(
|
|
35215
35584
|
new HiddenStdioClientTransport({
|
|
@@ -36017,8 +36386,7 @@ async function runInit(parsed, ctx) {
|
|
|
36017
36386
|
ides,
|
|
36018
36387
|
env,
|
|
36019
36388
|
pkg: MAKER_NPM_PACKAGE,
|
|
36020
|
-
mcpName: DEFAULT_MCP_NAME
|
|
36021
|
-
cwd: targetDir
|
|
36389
|
+
mcpName: DEFAULT_MCP_NAME
|
|
36022
36390
|
});
|
|
36023
36391
|
for (const result of installResults) {
|
|
36024
36392
|
emit(ctx, "mcp_install", result.message, result);
|
|
@@ -36156,9 +36524,9 @@ function formatMakerMcpToolsAvailability(availability) {
|
|
|
36156
36524
|
return lines.join("\n");
|
|
36157
36525
|
}
|
|
36158
36526
|
function samePath2(left, right) {
|
|
36159
|
-
return
|
|
36527
|
+
return normalizePathForCompare3(left) === normalizePathForCompare3(right);
|
|
36160
36528
|
}
|
|
36161
|
-
function
|
|
36529
|
+
function normalizePathForCompare3(value) {
|
|
36162
36530
|
const resolved = path15.resolve(value);
|
|
36163
36531
|
try {
|
|
36164
36532
|
return fs14.realpathSync.native(resolved);
|
|
@@ -36586,7 +36954,8 @@ async function runAgentsUpdate(parsed, ctx) {
|
|
|
36586
36954
|
}
|
|
36587
36955
|
async function runUpgrade(parsed, ctx) {
|
|
36588
36956
|
rejectPackageOption(parsed);
|
|
36589
|
-
const
|
|
36957
|
+
const explicitTargetDir = stringOption(parsed, "target_dir");
|
|
36958
|
+
const targetDir = path15.resolve(explicitTargetDir || process.cwd());
|
|
36590
36959
|
const env = makerEnvOption(parsed);
|
|
36591
36960
|
const ides = parseIdeList(stringOption(parsed, "ide") || stringOption(parsed, "ides") || "");
|
|
36592
36961
|
const installResults = installMcpConfigs({
|
|
@@ -36594,7 +36963,7 @@ async function runUpgrade(parsed, ctx) {
|
|
|
36594
36963
|
env,
|
|
36595
36964
|
pkg: MAKER_NPM_PACKAGE,
|
|
36596
36965
|
mcpName: stringOption(parsed, "name") || DEFAULT_MCP_NAME,
|
|
36597
|
-
cwd: targetDir
|
|
36966
|
+
cwd: explicitTargetDir ? targetDir : void 0
|
|
36598
36967
|
});
|
|
36599
36968
|
const identify = identifyMakerProject({ cwd: targetDir });
|
|
36600
36969
|
const agentsResult = identify.projectRoot ? updateMakerAgentsPolicy(identify.projectRoot) : void 0;
|
|
@@ -36685,7 +37054,7 @@ async function runDevKitUpdate(parsed, ctx) {
|
|
|
36685
37054
|
async function runLogsWatch(parsed, ctx) {
|
|
36686
37055
|
const targetDir = path15.resolve(stringOption(parsed, "target_dir") || process.cwd());
|
|
36687
37056
|
const intervalMs = parseDurationMs(stringOption(parsed, "interval") || "5s");
|
|
36688
|
-
const timeoutMs = numberOption(parsed, "timeout_ms") ??
|
|
37057
|
+
const timeoutMs = numberOption(parsed, "timeout_ms") ?? DEFAULT_TOOL_CALL_TIMEOUT_MS;
|
|
36689
37058
|
const maxPolls = numberOption(parsed, "max_polls");
|
|
36690
37059
|
const maxConsecutiveFailures = numberOption(parsed, "max_consecutive_failures");
|
|
36691
37060
|
const proxy = createRemoteProxyContext({
|
|
@@ -37465,6 +37834,13 @@ function printHelp() {
|
|
|
37465
37834
|
" [--create --name NAME]",
|
|
37466
37835
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
37467
37836
|
" [--json]",
|
|
37837
|
+
"",
|
|
37838
|
+
"Init flows:",
|
|
37839
|
+
" Standard init/clone/download flow: run `taptap-maker init`; the CLI shows",
|
|
37840
|
+
" the Maker app list, then the user chooses an existing app or 0/new.",
|
|
37841
|
+
" Create-new-project flow: add `--create --name NAME` only when the user",
|
|
37842
|
+
" clearly asks to create a new Maker project; NAME is the requested project name.",
|
|
37843
|
+
"",
|
|
37468
37844
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
37469
37845
|
" taptap-maker python doctor [--json]",
|
|
37470
37846
|
" taptap-maker python setup [--json]",
|
|
@@ -37504,149 +37880,6 @@ function formatCliError(error2) {
|
|
|
37504
37880
|
return error2 instanceof Error ? error2.message : String(error2);
|
|
37505
37881
|
}
|
|
37506
37882
|
|
|
37507
|
-
// src/mcp-proxy/config.ts
|
|
37508
|
-
var DEFAULT_TOOL_CALL_TIMEOUT_MS = 60 * 60 * 1e3;
|
|
37509
|
-
function readStdin() {
|
|
37510
|
-
return new Promise((resolve, reject) => {
|
|
37511
|
-
const chunks = [];
|
|
37512
|
-
process.stdin.on("data", (chunk) => {
|
|
37513
|
-
chunks.push(chunk);
|
|
37514
|
-
});
|
|
37515
|
-
process.stdin.on("end", () => {
|
|
37516
|
-
resolve(Buffer.concat(chunks).toString("utf-8"));
|
|
37517
|
-
});
|
|
37518
|
-
process.stdin.on("error", reject);
|
|
37519
|
-
setTimeout(() => {
|
|
37520
|
-
reject(new Error("Timeout reading from stdin"));
|
|
37521
|
-
}, 5e3);
|
|
37522
|
-
});
|
|
37523
|
-
}
|
|
37524
|
-
async function loadConfig() {
|
|
37525
|
-
let configJson;
|
|
37526
|
-
let source;
|
|
37527
|
-
if (process.argv[2]) {
|
|
37528
|
-
configJson = process.argv[2];
|
|
37529
|
-
source = "command line argument";
|
|
37530
|
-
} else if (process.env.PROXY_CONFIG) {
|
|
37531
|
-
configJson = process.env.PROXY_CONFIG;
|
|
37532
|
-
source = "PROXY_CONFIG environment variable";
|
|
37533
|
-
} else if (!process.stdin.isTTY) {
|
|
37534
|
-
configJson = await readStdin();
|
|
37535
|
-
source = "stdin";
|
|
37536
|
-
} else {
|
|
37537
|
-
throw new Error(
|
|
37538
|
-
`No configuration provided. Please use one of:
|
|
37539
|
-
1. Command line: node index.js '{"server":{...}}'
|
|
37540
|
-
2. Env var: PROXY_CONFIG='{"server":{...}}' node index.js
|
|
37541
|
-
3. Stdin: echo '{"server":{...}}' | node index.js
|
|
37542
|
-
|
|
37543
|
-
See config.example.json for configuration format.`
|
|
37544
|
-
);
|
|
37545
|
-
}
|
|
37546
|
-
console.error(`[Proxy] Loading config from ${source}`);
|
|
37547
|
-
let config2;
|
|
37548
|
-
try {
|
|
37549
|
-
config2 = JSON.parse(configJson);
|
|
37550
|
-
} catch (error2) {
|
|
37551
|
-
throw new Error(
|
|
37552
|
-
`Failed to parse configuration JSON: ${error2 instanceof Error ? error2.message : String(error2)}
|
|
37553
|
-
Received: ${configJson.substring(0, 100)}...`
|
|
37554
|
-
);
|
|
37555
|
-
}
|
|
37556
|
-
validateConfig(config2);
|
|
37557
|
-
return applyDefaults(config2);
|
|
37558
|
-
}
|
|
37559
|
-
function validateConfig(config2) {
|
|
37560
|
-
var _a3;
|
|
37561
|
-
const errors = [];
|
|
37562
|
-
if (!config2.server) {
|
|
37563
|
-
errors.push("- Missing required field: server");
|
|
37564
|
-
} else {
|
|
37565
|
-
if (!config2.server.url) {
|
|
37566
|
-
errors.push("- Missing required field: server.url");
|
|
37567
|
-
}
|
|
37568
|
-
if (config2.server.env && !["rnd", "production"].includes(config2.server.env)) {
|
|
37569
|
-
errors.push('- Invalid server.env: must be "rnd" or "production"');
|
|
37570
|
-
}
|
|
37571
|
-
}
|
|
37572
|
-
if (!config2.tenant) {
|
|
37573
|
-
errors.push("- Missing required field: tenant");
|
|
37574
|
-
} else {
|
|
37575
|
-
if (config2.tenant.custom_fields !== void 0) {
|
|
37576
|
-
const cf = config2.tenant.custom_fields;
|
|
37577
|
-
if (typeof cf !== "object" || cf === null || Array.isArray(cf) || Object.getPrototypeOf(cf) !== Object.prototype) {
|
|
37578
|
-
errors.push("- tenant.custom_fields must be a plain object (Record<string, string>)");
|
|
37579
|
-
} else if (!Object.values(cf).every((v) => typeof v === "string")) {
|
|
37580
|
-
errors.push("- tenant.custom_fields values must all be strings");
|
|
37581
|
-
}
|
|
37582
|
-
}
|
|
37583
|
-
}
|
|
37584
|
-
if (!config2.auth) {
|
|
37585
|
-
errors.push("- Missing required field: auth");
|
|
37586
|
-
} else {
|
|
37587
|
-
if (!config2.auth.kid) {
|
|
37588
|
-
errors.push("- Missing required field: auth.kid");
|
|
37589
|
-
}
|
|
37590
|
-
if (!config2.auth.mac_key) {
|
|
37591
|
-
errors.push("- Missing required field: auth.mac_key");
|
|
37592
|
-
}
|
|
37593
|
-
if (config2.auth.token_type !== "mac") {
|
|
37594
|
-
errors.push('- Invalid auth.token_type: must be "mac"');
|
|
37595
|
-
}
|
|
37596
|
-
if (config2.auth.mac_algorithm !== "hmac-sha-1") {
|
|
37597
|
-
errors.push('- Invalid auth.mac_algorithm: must be "hmac-sha-1"');
|
|
37598
|
-
}
|
|
37599
|
-
}
|
|
37600
|
-
if (((_a3 = config2.options) == null ? void 0 : _a3.exposed_tools) !== void 0) {
|
|
37601
|
-
const exposedTools = config2.options.exposed_tools;
|
|
37602
|
-
if (!Array.isArray(exposedTools)) {
|
|
37603
|
-
errors.push("- options.exposed_tools must be an array of tool names");
|
|
37604
|
-
} else if (!exposedTools.every((toolName) => typeof toolName === "string" && toolName.trim().length > 0)) {
|
|
37605
|
-
errors.push("- options.exposed_tools values must be non-empty strings");
|
|
37606
|
-
}
|
|
37607
|
-
}
|
|
37608
|
-
if (errors.length > 0) {
|
|
37609
|
-
throw new Error("Invalid configuration:\n" + errors.join("\n"));
|
|
37610
|
-
}
|
|
37611
|
-
}
|
|
37612
|
-
var DEFAULT_LOG_ROOT = "/tmp/taptap-mcp/logs";
|
|
37613
|
-
function applyDefaults(config2) {
|
|
37614
|
-
var _a3, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r;
|
|
37615
|
-
const verbose = ((_a3 = config2.options) == null ? void 0 : _a3.verbose) ?? false;
|
|
37616
|
-
return {
|
|
37617
|
-
server: {
|
|
37618
|
-
url: config2.server.url,
|
|
37619
|
-
env: config2.server.env || "rnd"
|
|
37620
|
-
},
|
|
37621
|
-
tenant: {
|
|
37622
|
-
project_path: config2.tenant.project_path || ".",
|
|
37623
|
-
user_id: config2.tenant.user_id,
|
|
37624
|
-
project_id: config2.tenant.project_id,
|
|
37625
|
-
custom_fields: config2.tenant.custom_fields
|
|
37626
|
-
},
|
|
37627
|
-
auth: config2.auth,
|
|
37628
|
-
options: {
|
|
37629
|
-
verbose,
|
|
37630
|
-
reconnect_interval: ((_b = config2.options) == null ? void 0 : _b.reconnect_interval) ?? 5e3,
|
|
37631
|
-
request_timeout: ((_c = config2.options) == null ? void 0 : _c.request_timeout) ?? 3e4,
|
|
37632
|
-
tool_call_timeout: ((_d = config2.options) == null ? void 0 : _d.tool_call_timeout) ?? DEFAULT_TOOL_CALL_TIMEOUT_MS,
|
|
37633
|
-
reset_timeout_on_progress: ((_e = config2.options) == null ? void 0 : _e.reset_timeout_on_progress) ?? true,
|
|
37634
|
-
health_check_interval: ((_f = config2.options) == null ? void 0 : _f.health_check_interval) ?? 3e4,
|
|
37635
|
-
enable_cookie_sticky: ((_g = config2.options) == null ? void 0 : _g.enable_cookie_sticky) ?? true,
|
|
37636
|
-
inject_params_per_call: ((_h = config2.options) == null ? void 0 : _h.inject_params_per_call) ?? true,
|
|
37637
|
-
force_inject_progress_token: ((_i = config2.options) == null ? void 0 : _i.force_inject_progress_token) ?? false,
|
|
37638
|
-
exposed_tools: (_j = config2.options) == null ? void 0 : _j.exposed_tools,
|
|
37639
|
-
log: {
|
|
37640
|
-
root: ((_l = (_k = config2.options) == null ? void 0 : _k.log) == null ? void 0 : _l.root) ?? DEFAULT_LOG_ROOT,
|
|
37641
|
-
enabled: ((_n = (_m = config2.options) == null ? void 0 : _m.log) == null ? void 0 : _n.enabled) ?? false,
|
|
37642
|
-
// verbose=true 时自动使用 debug 级别
|
|
37643
|
-
level: verbose ? "debug" : ((_p = (_o = config2.options) == null ? void 0 : _o.log) == null ? void 0 : _p.level) ?? "info",
|
|
37644
|
-
max_days: ((_r = (_q = config2.options) == null ? void 0 : _q.log) == null ? void 0 : _r.max_days) ?? 7
|
|
37645
|
-
}
|
|
37646
|
-
}
|
|
37647
|
-
};
|
|
37648
|
-
}
|
|
37649
|
-
|
|
37650
37883
|
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/transport.js
|
|
37651
37884
|
function normalizeHeaders(headers) {
|
|
37652
37885
|
if (!headers)
|
|
@@ -40133,6 +40366,13 @@ function printHelp2() {
|
|
|
40133
40366
|
" [--create --name NAME]",
|
|
40134
40367
|
" [--skip-confirm] [--skip-mcp-install] [--register-mcp codex,cursor,claude]",
|
|
40135
40368
|
" [--json]",
|
|
40369
|
+
"",
|
|
40370
|
+
"Init flows:",
|
|
40371
|
+
" Standard init/clone/download flow: run `taptap-maker init`; the CLI shows",
|
|
40372
|
+
" the Maker app list, then the user chooses an existing app or 0/new.",
|
|
40373
|
+
" Create-new-project flow: add `--create --name NAME` only when the user",
|
|
40374
|
+
" clearly asks to create a new Maker project; NAME is the requested project name.",
|
|
40375
|
+
"",
|
|
40136
40376
|
" taptap-maker doctor [--target-dir DIR] [--env rnd|production] [--json]",
|
|
40137
40377
|
" taptap-maker python doctor [--json]",
|
|
40138
40378
|
" taptap-maker python setup [--json]",
|
package/package.json
CHANGED
|
@@ -56,6 +56,10 @@ exists.
|
|
|
56
56
|
|
|
57
57
|
## Create New Maker Project Intent
|
|
58
58
|
|
|
59
|
+
Standard initialization, clone, download, continue, or "pull remote project" requests use
|
|
60
|
+
`taptap-maker init`; the CLI shows the Maker app list and asks the user to choose an existing app
|
|
61
|
+
or `0`/`new`. Add `--create` only when the user clearly asks to create a new Maker project.
|
|
62
|
+
|
|
59
63
|
Treat these user phrases as an explicit request to create a new Maker project:
|
|
60
64
|
|
|
61
65
|
- 创建新项目
|
|
@@ -241,13 +245,17 @@ Workflow:
|
|
|
241
245
|
5. Run `taptap-maker init` in the user's intended Maker directory. The CLI will request PAT if
|
|
242
246
|
missing, fetch TapTap token, show a paged app preview, ask the user to choose or create a Maker
|
|
243
247
|
project, clone the Maker project, prepare the AI dev kit, and install/verify MCP config.
|
|
248
|
+
For ordinary init/clone/download requests, use `taptap-maker init` so the CLI shows the app
|
|
249
|
+
list first. Add `--create` only when the user clearly asks to create a new Maker project.
|
|
244
250
|
The app preview always includes `0,创建新项目 / 0. Create a new Maker project`. This row must
|
|
245
251
|
remain visible when an AI summarizes or truncates a long app list, even if another app name
|
|
246
252
|
appears to match the current directory. Users can choose `0`/`new` and enter a project name,
|
|
247
253
|
or use `taptap-maker init --create --name "my-local-game"` for non-interactive runs.
|
|
248
|
-
The generated MCP config
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
The generated user-level MCP config does not pin the selected Maker project directory as `cwd`
|
|
255
|
+
by default. Clients that support MCP Roots should let the current workspace root identify the
|
|
256
|
+
Maker project, so multiple AI clients or Maker projects do not overwrite one shared cwd. If a
|
|
257
|
+
client does not support MCP Roots, the user can explicitly run
|
|
258
|
+
`taptap-maker mcp install --target-dir <PROJECT_DIR>` as a compatibility fix.
|
|
251
259
|
Tell the user that the first Maker clone can take 20+ seconds because the server may be
|
|
252
260
|
preparing the repository, and that they should keep the command running while the CLI retries
|
|
253
261
|
transient 503/5xx failures.
|