@ganglion/xacpx 0.8.1 → 0.8.2
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/cli.js +39 -9
- package/dist/plugins/plugin-renames.d.ts +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2174,6 +2174,21 @@ var init_workspace_path = __esm(() => {
|
|
|
2174
2174
|
init_path();
|
|
2175
2175
|
});
|
|
2176
2176
|
|
|
2177
|
+
// src/plugins/plugin-renames.ts
|
|
2178
|
+
function normalizePluginPackageName(packageName) {
|
|
2179
|
+
return LEGACY_PLUGIN_PACKAGE_RENAMES.get(packageName) ?? packageName;
|
|
2180
|
+
}
|
|
2181
|
+
function isLegacyPluginPackageName(packageName) {
|
|
2182
|
+
return LEGACY_PLUGIN_PACKAGE_RENAMES.has(packageName);
|
|
2183
|
+
}
|
|
2184
|
+
var LEGACY_PLUGIN_PACKAGE_RENAMES;
|
|
2185
|
+
var init_plugin_renames = __esm(() => {
|
|
2186
|
+
LEGACY_PLUGIN_PACKAGE_RENAMES = new Map([
|
|
2187
|
+
["@ganglion/weacpx-channel-feishu", "@ganglion/xacpx-channel-feishu"],
|
|
2188
|
+
["@ganglion/weacpx-channel-yuanbao", "@ganglion/xacpx-channel-yuanbao"]
|
|
2189
|
+
]);
|
|
2190
|
+
});
|
|
2191
|
+
|
|
2177
2192
|
// src/config/resolve-agent-command.ts
|
|
2178
2193
|
function resolveAgentCommand(driver, command) {
|
|
2179
2194
|
if (!command) {
|
|
@@ -2395,7 +2410,8 @@ function parsePluginConfig(raw, index) {
|
|
|
2395
2410
|
if (!isRecord(raw)) {
|
|
2396
2411
|
throw new Error(`plugins[${index}] must be an object`);
|
|
2397
2412
|
}
|
|
2398
|
-
const
|
|
2413
|
+
const rawName = typeof raw.name === "string" ? raw.name.trim() : "";
|
|
2414
|
+
const name = normalizePluginPackageName(rawName);
|
|
2399
2415
|
if (!name) {
|
|
2400
2416
|
throw new Error(`plugins[${index}].name must be a non-empty string`);
|
|
2401
2417
|
}
|
|
@@ -2417,15 +2433,26 @@ function parsePlugins(rawPlugins) {
|
|
|
2417
2433
|
if (!Array.isArray(rawPlugins)) {
|
|
2418
2434
|
throw new Error("plugins must be an array");
|
|
2419
2435
|
}
|
|
2420
|
-
const parsed = rawPlugins.map((entry, index) =>
|
|
2421
|
-
|
|
2436
|
+
const parsed = rawPlugins.map((entry, index) => ({
|
|
2437
|
+
plugin: parsePluginConfig(entry, index),
|
|
2438
|
+
originalName: isRecord(entry) && typeof entry.name === "string" ? entry.name.trim() : ""
|
|
2439
|
+
}));
|
|
2440
|
+
const pluginsByName = new Map;
|
|
2422
2441
|
for (const entry of parsed) {
|
|
2423
|
-
|
|
2442
|
+
const existing = pluginsByName.get(entry.plugin.name);
|
|
2443
|
+
if (!existing) {
|
|
2444
|
+
pluginsByName.set(entry.plugin.name, entry);
|
|
2445
|
+
continue;
|
|
2446
|
+
}
|
|
2447
|
+
const hasLegacyName = isLegacyPluginPackageName(existing.originalName) || isLegacyPluginPackageName(entry.originalName);
|
|
2448
|
+
if (!hasLegacyName) {
|
|
2424
2449
|
throw new Error("plugins names must be unique");
|
|
2425
2450
|
}
|
|
2426
|
-
|
|
2451
|
+
if (isLegacyPluginPackageName(existing.originalName) && !isLegacyPluginPackageName(entry.originalName)) {
|
|
2452
|
+
pluginsByName.set(entry.plugin.name, entry);
|
|
2453
|
+
}
|
|
2427
2454
|
}
|
|
2428
|
-
return
|
|
2455
|
+
return Array.from(pluginsByName.values()).map((entry) => entry.plugin);
|
|
2429
2456
|
}
|
|
2430
2457
|
function parseRuntimeChannelConfig(raw, index) {
|
|
2431
2458
|
if (!isRecord(raw)) {
|
|
@@ -2500,6 +2527,7 @@ function parseOrchestrationConfig(raw) {
|
|
|
2500
2527
|
var DEFAULT_PERF_LOG_CONFIG, DEFAULT_LOGGING_CONFIG, DEFAULT_PERMISSION_MODE = "approve-all", DEFAULT_NON_INTERACTIVE_PERMISSIONS = "deny", DEFAULT_QUEUE_OWNER_TTL_SECONDS = 1800, DEFAULT_CHANNEL_CONFIG, DEFAULT_ORCHESTRATION_CONFIG, DEFAULT_LATER_CONFIG;
|
|
2501
2528
|
var init_load_config = __esm(() => {
|
|
2502
2529
|
init_workspace_path();
|
|
2530
|
+
init_plugin_renames();
|
|
2503
2531
|
DEFAULT_PERF_LOG_CONFIG = {
|
|
2504
2532
|
enabled: false,
|
|
2505
2533
|
maxSizeBytes: 5 * 1024 * 1024,
|
|
@@ -46175,6 +46203,7 @@ async function inspectPlugins(input) {
|
|
|
46175
46203
|
|
|
46176
46204
|
// src/plugins/plugin-cli.ts
|
|
46177
46205
|
init_known_plugins();
|
|
46206
|
+
init_plugin_renames();
|
|
46178
46207
|
function looksLikePath(spec) {
|
|
46179
46208
|
return spec === "." || spec.startsWith("./") || spec.startsWith("../") || spec.startsWith("/") || spec.startsWith(".\\") || spec.startsWith("..\\") || spec.startsWith("\\") || /^[a-zA-Z]:[\\/]/.test(spec) || isAbsolute(spec);
|
|
46180
46209
|
}
|
|
@@ -46276,7 +46305,8 @@ function parseRestartAndVersionFlags(args) {
|
|
|
46276
46305
|
return { ok: true, rest, restart: restart ? "restart" : noRestart ? "no-restart" : "ask", ...version2 ? { version: version2 } : {} };
|
|
46277
46306
|
}
|
|
46278
46307
|
function findPlugin(plugins, name) {
|
|
46279
|
-
|
|
46308
|
+
const normalizedName = normalizePluginPackageName(name);
|
|
46309
|
+
return plugins.find((plugin) => normalizePluginPackageName(plugin.name) === normalizedName);
|
|
46280
46310
|
}
|
|
46281
46311
|
async function validateInstalledPluginDefault(packageName, pluginHome) {
|
|
46282
46312
|
const moduleValue = await importPluginFromHome(packageName, pluginHome);
|
|
@@ -46363,7 +46393,7 @@ async function addPlugin(packageSpec, rawArgs, deps) {
|
|
|
46363
46393
|
deps.print(`插件 ${packageSpec} 安装失败:${describeError(error2)}`);
|
|
46364
46394
|
return 1;
|
|
46365
46395
|
}
|
|
46366
|
-
const recordedName = looksLikePath(packageSpec) ? await resolveLocalPluginName(installSpec, pluginHome, namesBeforeInstall) : packageSpec;
|
|
46396
|
+
const recordedName = normalizePluginPackageName(looksLikePath(packageSpec) ? await resolveLocalPluginName(installSpec, pluginHome, namesBeforeInstall) : packageSpec);
|
|
46367
46397
|
const validate = deps.validateInstalledPlugin ?? ((name) => validateInstalledPluginDefault(name, pluginHome));
|
|
46368
46398
|
let summary;
|
|
46369
46399
|
try {
|
|
@@ -46381,7 +46411,7 @@ async function addPlugin(packageSpec, rawArgs, deps) {
|
|
|
46381
46411
|
enabled: true
|
|
46382
46412
|
};
|
|
46383
46413
|
if (existing) {
|
|
46384
|
-
config2.plugins = config2.plugins.
|
|
46414
|
+
config2.plugins = config2.plugins.filter((entry) => normalizePluginPackageName(entry.name) !== recordedName).concat(next);
|
|
46385
46415
|
} else {
|
|
46386
46416
|
config2.plugins = [...config2.plugins, next];
|
|
46387
46417
|
}
|