@lark-apaas/fullstack-cli 1.1.71-alpha.20261103095356 → 1.1.71-alpha.20261103103857

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.
Files changed (3) hide show
  1. package/README.md +5 -2
  2. package/dist/index.js +62 -19
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -108,7 +108,10 @@ fullstack-cli action-plugin form-action @office/feishu-bitable --json
108
108
  # 查看某个动作的 inputSchema / outputSchema(动作名 camelCase 或 kebab-case 都行)
109
109
  fullstack-cli action-plugin form-action @office/feishu-bitable get-table-fields --help --json
110
110
 
111
- # 执行:入参从文件读,结果 JSON 输出到 stdout
111
+ # 执行:入参直接给 JSON(支持嵌套),结果 JSON 输出到 stdout
112
+ fullstack-cli action-plugin form-action @office/feishu-bitable list-tables --input '{"appToken":"bascnABC"}'
113
+
114
+ # 入参较大或含单引号时改用文件,二者只能给一个
112
115
  fullstack-cli action-plugin form-action @office/feishu-bitable list-tables --input-file ./input.json
113
116
 
114
117
  # 修改已有实例时带实例 ID(实例 formValue 进 ctx.formValue),或用草稿整体替换
@@ -290,7 +293,7 @@ fullstack-cli action-plugin --help
290
293
  fullstack-cli action-plugin install <plugin>
291
294
  fullstack-cli action-plugin list [--json]
292
295
  fullstack-cli action-plugin form-action <plugin> [action] [--help] [--json]
293
- fullstack-cli action-plugin form-action <plugin> <action> --input-file <f> [--instance-id <id> | --draft-file <f>] [--timeout <ms>]
296
+ fullstack-cli action-plugin form-action <plugin> <action> (--input <json> | --input-file <f>) [--instance-id <id> | --draft-file <f>] [--timeout <ms>]
294
297
 
295
298
  # 能力配置管理
296
299
  fullstack-cli capability --help
package/dist/index.js CHANGED
@@ -4946,6 +4946,16 @@ function readJsonFile(filePath, label) {
4946
4946
  );
4947
4947
  }
4948
4948
  }
4949
+ function parseJsonText(text, label) {
4950
+ try {
4951
+ return JSON.parse(text);
4952
+ } catch (error) {
4953
+ throw new FormCliError(
4954
+ FormCliErrorCode.INVALID_INPUT,
4955
+ `${label} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`
4956
+ );
4957
+ }
4958
+ }
4949
4959
  function readJsonObjectFile(filePath, label) {
4950
4960
  const value = readJsonFile(filePath, label);
4951
4961
  if (!value || typeof value !== "object" || Array.isArray(value)) {
@@ -5186,15 +5196,27 @@ function describeFormAction(pluginKey, action) {
5186
5196
  }
5187
5197
  };
5188
5198
  }
5189
- async function executeFormAction(options) {
5190
- const timeoutMs = parseTimeout(options.timeout);
5191
- if (!options.inputFile) {
5199
+ function readFormActionInput(options) {
5200
+ if (options.input !== void 0 && options.inputFile !== void 0) {
5192
5201
  throw new FormCliError(
5193
5202
  FormCliErrorCode.INVALID_INPUT,
5194
- "--input-file <file> is required to execute a form action (use --help to see its input schema)"
5203
+ "Use either --input <json> or --input-file <file>, not both"
5195
5204
  );
5196
5205
  }
5197
- const input = readJsonFile(options.inputFile, "input file");
5206
+ if (options.input !== void 0) {
5207
+ return parseJsonText(options.input, "--input");
5208
+ }
5209
+ if (options.inputFile) {
5210
+ return readJsonFile(options.inputFile, "input file");
5211
+ }
5212
+ throw new FormCliError(
5213
+ FormCliErrorCode.INVALID_INPUT,
5214
+ "--input <json> or --input-file <file> is required to execute a form action (use --help to see its input schema)"
5215
+ );
5216
+ }
5217
+ async function executeFormAction(options) {
5218
+ const timeoutMs = parseTimeout(options.timeout);
5219
+ const input = readFormActionInput(options);
5198
5220
  const resolved = await resolveInstalledPlugin(options.pluginKey);
5199
5221
  const formAction2 = findFormAction(
5200
5222
  options.pluginKey,
@@ -5271,7 +5293,7 @@ function printFormActionText(description) {
5271
5293
  }
5272
5294
  lines.push("");
5273
5295
  lines.push(
5274
- `Run: fullstack-cli action-plugin form-action ${description.key} ${action.alias} --input-file <input.json> [--instance-id <id> | --draft-file <draft.json>] [--timeout <ms>]`
5296
+ `Run: fullstack-cli action-plugin form-action ${description.key} ${action.alias} (--input '<json>' | --input-file <input.json>) [--instance-id <id> | --draft-file <draft.json>] [--timeout <ms>]`
5275
5297
  );
5276
5298
  console.log(lines.join("\n"));
5277
5299
  }
@@ -5298,6 +5320,7 @@ async function formAction(options) {
5298
5320
  const result = await executeFormAction({
5299
5321
  pluginKey: options.pluginKey,
5300
5322
  action: options.action,
5323
+ input: options.input,
5301
5324
  inputFile: options.inputFile,
5302
5325
  instanceId: options.instanceId,
5303
5326
  draftFile: options.draftFile,
@@ -5477,7 +5500,7 @@ var formActionCommand = {
5477
5500
  name: "form-action",
5478
5501
  description: "List, describe or run a plugin form action (config-time query, e.g. list tables)",
5479
5502
  register(program) {
5480
- program.command(this.name).description(this.description).helpOption(false).argument("<key>", "Plugin key (e.g., @office/feishu-bitable)").argument("[action]", "Form action name, camelCase or kebab-case (e.g., getTableFields / get-table-fields)").option("--help", "Describe the plugin form actions, or one action when <action> is given").option("--json", "Output JSON (with --help: full inputSchema / outputSchema)").option("--input-file <file>", "JSON file with the action input (required to execute)").option("--instance-id <id>", "Existing capability ID; its formValue becomes ctx.formValue").option("--draft-file <file>", "JSON file used as ctx.formValue (replaces the instance value entirely)").option("--timeout <ms>", "Execution timeout in milliseconds (default: 60000)").action(
5503
+ program.command(this.name).description(this.description).helpOption(false).argument("<key>", "Plugin key (e.g., @office/feishu-bitable)").argument("[action]", "Form action name, camelCase or kebab-case (e.g., getTableFields / get-table-fields)").option("--help", "Describe the plugin form actions, or one action when <action> is given").option("--json", "Output JSON (with --help: full inputSchema / outputSchema)").option("--input <json>", "Action input as inline JSON (use this or --input-file to execute)").option("--input-file <file>", "JSON file with the action input (use this or --input to execute)").option("--instance-id <id>", "Existing capability ID; its formValue becomes ctx.formValue").option("--draft-file <file>", "JSON file used as ctx.formValue (replaces the instance value entirely)").option("--timeout <ms>", "Execution timeout in milliseconds (default: 60000)").action(
5481
5504
  async (key, action, options) => {
5482
5505
  await formAction({ pluginKey: key, action, ...options });
5483
5506
  }
@@ -5583,13 +5606,31 @@ function isZodLikeSchema(value) {
5583
5606
  function isLegacyManifest(manifest) {
5584
5607
  return manifest.formActions === void 0 && manifest.hasValidateForm === void 0;
5585
5608
  }
5609
+ var DEFAULT_FORM_ISSUE_CODE = "VALIDATION_FAILED";
5586
5610
  var ISSUE_SEVERITIES = /* @__PURE__ */ new Set(["error", "warning"]);
5587
- function isWellFormedIssue(issue) {
5611
+ function normalizeIssue(issue) {
5588
5612
  if (!issue || typeof issue !== "object" || Array.isArray(issue)) {
5589
- return false;
5613
+ return void 0;
5590
5614
  }
5591
5615
  const { code, severity, message, path: path28 } = issue;
5592
- return typeof code === "string" && code !== "" && ISSUE_SEVERITIES.has(severity) && typeof message === "string" && message !== "" && (path28 === void 0 || typeof path28 === "string");
5616
+ if (typeof message !== "string" || message === "") {
5617
+ return void 0;
5618
+ }
5619
+ if (code !== void 0 && (typeof code !== "string" || code === "")) {
5620
+ return void 0;
5621
+ }
5622
+ if (severity !== void 0 && !ISSUE_SEVERITIES.has(severity)) {
5623
+ return void 0;
5624
+ }
5625
+ if (path28 !== void 0 && typeof path28 !== "string") {
5626
+ return void 0;
5627
+ }
5628
+ return {
5629
+ ...issue,
5630
+ code: code ?? DEFAULT_FORM_ISSUE_CODE,
5631
+ severity: severity ?? "error",
5632
+ message
5633
+ };
5593
5634
  }
5594
5635
  function normalizeIssues(raw) {
5595
5636
  const issues = raw?.issues;
@@ -5599,15 +5640,17 @@ function normalizeIssues(raw) {
5599
5640
  "validateForm returned an unexpected shape: expected { issues: FormIssue[] }"
5600
5641
  );
5601
5642
  }
5602
- const invalidIndex = issues.findIndex((issue) => !isWellFormedIssue(issue));
5603
- if (invalidIndex !== -1) {
5604
- throw new FormCliError(
5605
- FormCliErrorCode.VALIDATION_EXECUTION_FAILED,
5606
- `validateForm returned a malformed issue at index ${invalidIndex}: expected { code: string, severity: "error" | "warning", message: string, path?: string }`,
5607
- { details: { issue: issues[invalidIndex] } }
5608
- );
5609
- }
5610
- return issues;
5643
+ return issues.map((rawIssue, index) => {
5644
+ const issue = normalizeIssue(rawIssue);
5645
+ if (!issue) {
5646
+ throw new FormCliError(
5647
+ FormCliErrorCode.VALIDATION_EXECUTION_FAILED,
5648
+ `validateForm returned a malformed issue at index ${index}: message must be a non-empty string; code, if given, must be a non-empty string; severity, if given, must be "error" or "warning"`,
5649
+ { details: { issue: rawIssue } }
5650
+ );
5651
+ }
5652
+ return issue;
5653
+ });
5611
5654
  }
5612
5655
  async function runValidate(options) {
5613
5656
  const timeoutMs = parseTimeout(options.timeout);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.71-alpha.20261103095356",
3
+ "version": "1.1.71-alpha.20261103103857",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",