Release v0.2.0

This commit is contained in:
winlifes
2026-05-20 06:06:36 -07:00
parent e01f058e3e
commit 3ab48e2457
18 changed files with 1417 additions and 99 deletions
+32 -1
View File
@@ -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,
};