@lark-apaas/fullstack-cli 1.1.72 → 1.1.73-alpha.20261130055222
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/index.js +42 -6
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5698,16 +5698,43 @@ var actionPluginCommandGroup = {
|
|
|
5698
5698
|
};
|
|
5699
5699
|
|
|
5700
5700
|
// src/commands/capability/list.handler.ts
|
|
5701
|
+
var LIST_FILTER_ENV = "MIAODA_CAPABILITY_LIST_FILTER";
|
|
5702
|
+
function resolveFilters(options) {
|
|
5703
|
+
if (options.ids !== void 0 || options.pluginKeys !== void 0 || !process.env[LIST_FILTER_ENV]) {
|
|
5704
|
+
return options;
|
|
5705
|
+
}
|
|
5706
|
+
const filters = JSON.parse(process.env[LIST_FILTER_ENV]);
|
|
5707
|
+
if (!filters || typeof filters !== "object" || Array.isArray(filters)) {
|
|
5708
|
+
throw new Error(`${LIST_FILTER_ENV} must be an object`);
|
|
5709
|
+
}
|
|
5710
|
+
const { ids, pluginKeys } = filters;
|
|
5711
|
+
for (const value of [ids, pluginKeys]) {
|
|
5712
|
+
if (value !== void 0 && (!Array.isArray(value) || !value.every((item) => typeof item === "string"))) {
|
|
5713
|
+
throw new Error(
|
|
5714
|
+
`${LIST_FILTER_ENV} ids and pluginKeys must be string arrays`
|
|
5715
|
+
);
|
|
5716
|
+
}
|
|
5717
|
+
}
|
|
5718
|
+
return {
|
|
5719
|
+
ids,
|
|
5720
|
+
pluginKeys
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5701
5723
|
async function list2(options) {
|
|
5702
5724
|
try {
|
|
5703
5725
|
if (!capabilitiesDirExists()) {
|
|
5704
|
-
logError(
|
|
5726
|
+
logError(
|
|
5727
|
+
"capabilities directory not found (looked for shared/capabilities and server/capabilities)"
|
|
5728
|
+
);
|
|
5705
5729
|
process.exit(1);
|
|
5706
5730
|
}
|
|
5707
5731
|
if (options.id) {
|
|
5732
|
+
if (options.ids !== void 0 || options.pluginKeys !== void 0) {
|
|
5733
|
+
throw new Error("--id cannot be combined with --ids or --plugin-keys");
|
|
5734
|
+
}
|
|
5708
5735
|
await listSingle(options.id, options.summary);
|
|
5709
5736
|
} else {
|
|
5710
|
-
await listAll(options
|
|
5737
|
+
await listAll(options);
|
|
5711
5738
|
}
|
|
5712
5739
|
} catch (error) {
|
|
5713
5740
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -5724,13 +5751,16 @@ async function listSingle(id, summary) {
|
|
|
5724
5751
|
printJson(hydrated);
|
|
5725
5752
|
}
|
|
5726
5753
|
}
|
|
5727
|
-
async function listAll(
|
|
5728
|
-
const
|
|
5754
|
+
async function listAll(options) {
|
|
5755
|
+
const { ids, pluginKeys } = resolveFilters(options);
|
|
5756
|
+
const capabilities = readAllCapabilities().filter(
|
|
5757
|
+
(cap) => (!ids?.length || ids.includes(cap.id)) && (!pluginKeys?.length || pluginKeys.includes(cap.pluginKey))
|
|
5758
|
+
);
|
|
5729
5759
|
if (capabilities.length === 0) {
|
|
5730
5760
|
printJson([]);
|
|
5731
5761
|
return;
|
|
5732
5762
|
}
|
|
5733
|
-
if (summary) {
|
|
5763
|
+
if (options.summary) {
|
|
5734
5764
|
printJson(capabilities);
|
|
5735
5765
|
} else {
|
|
5736
5766
|
const hydrated = [];
|
|
@@ -6297,7 +6327,13 @@ var listCommand2 = {
|
|
|
6297
6327
|
description: "List capability configurations",
|
|
6298
6328
|
aliases: ["ls"],
|
|
6299
6329
|
register(program) {
|
|
6300
|
-
program.command(this.name).alias("ls").description(this.description).option("--summary", "Return raw capability config (without hydration)").option("--id <id>", "Specify capability ID").
|
|
6330
|
+
program.command(this.name).alias("ls").description(this.description).option("--summary", "Return raw capability config (without hydration)").option("--id <id>", "Specify capability ID").option(
|
|
6331
|
+
"--ids <ids...>",
|
|
6332
|
+
"Filter capability IDs before schema hydration (returns an array)"
|
|
6333
|
+
).option(
|
|
6334
|
+
"--plugin-keys <keys...>",
|
|
6335
|
+
"Filter plugin keys before schema hydration"
|
|
6336
|
+
).action(async (options) => {
|
|
6301
6337
|
await list2(options);
|
|
6302
6338
|
});
|
|
6303
6339
|
}
|