Release v0.2.0
This commit is contained in:
+32
-1
@@ -7,6 +7,11 @@ const DEFAULTS = {
|
||||
host: '127.0.0.1',
|
||||
port: 8765,
|
||||
toolProfile: 'core',
|
||||
enabledTools: [],
|
||||
disabledTools: [],
|
||||
enabledToolCategories: [],
|
||||
disabledToolCategories: [],
|
||||
enableSessions: false,
|
||||
autostart: true,
|
||||
maxInteractionLogEntries: 50,
|
||||
lastClientTargetId: 'claude_code',
|
||||
@@ -58,7 +63,26 @@ function clampPort(value) {
|
||||
}
|
||||
|
||||
function normalizeProfile(value) {
|
||||
return String(value || DEFAULTS.toolProfile).toLowerCase() === 'full' ? 'full' : 'core';
|
||||
const normalized = String(value || DEFAULTS.toolProfile).toLowerCase();
|
||||
if (normalized === 'full' || normalized === 'custom') {
|
||||
return normalized;
|
||||
}
|
||||
return 'core';
|
||||
}
|
||||
|
||||
function normalizeStringList(value) {
|
||||
if (Array.isArray(value)) {
|
||||
return value
|
||||
.map((item) => String(item || '').trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
return value
|
||||
.split(/[\n,]/)
|
||||
.map((item) => item.trim())
|
||||
.filter(Boolean);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
function normalizeClientTargetId(value) {
|
||||
@@ -77,6 +101,11 @@ function loadConfig() {
|
||||
host: process.env.COCOS_MCP_HOST || fileConfig.host || DEFAULTS.host,
|
||||
port: clampPort(process.env.COCOS_MCP_PORT || fileConfig.port || DEFAULTS.port),
|
||||
toolProfile: normalizeProfile(process.env.COCOS_MCP_PROFILE || fileConfig.toolProfile || DEFAULTS.toolProfile),
|
||||
enabledTools: normalizeStringList(fileConfig.enabledTools),
|
||||
disabledTools: normalizeStringList(fileConfig.disabledTools),
|
||||
enabledToolCategories: normalizeStringList(fileConfig.enabledToolCategories).map((item) => item.toLowerCase()),
|
||||
disabledToolCategories: normalizeStringList(fileConfig.disabledToolCategories).map((item) => item.toLowerCase()),
|
||||
enableSessions: typeof fileConfig.enableSessions === 'boolean' ? fileConfig.enableSessions : DEFAULTS.enableSessions,
|
||||
autostart: typeof fileConfig.autostart === 'boolean' ? fileConfig.autostart : DEFAULTS.autostart,
|
||||
maxInteractionLogEntries: Number.isInteger(fileConfig.maxInteractionLogEntries)
|
||||
? Math.max(10, Math.min(500, fileConfig.maxInteractionLogEntries))
|
||||
@@ -93,4 +122,6 @@ module.exports = {
|
||||
getProjectName,
|
||||
getCocosVersion,
|
||||
loadConfig,
|
||||
normalizeProfile,
|
||||
normalizeStringList,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user