@lark-apaas/fullstack-cli 1.1.68-alpha.20260930060426 → 1.1.68-alpha.20261003004004

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 CHANGED
@@ -4882,7 +4882,11 @@ async function hydrateCapability(capability) {
4882
4882
  let pluginInstance = null;
4883
4883
  if (hasDynamicSchema) {
4884
4884
  const plugin = await loadPlugin(capability.pluginKey);
4885
- pluginInstance = plugin.create(capability.formValue || {});
4885
+ try {
4886
+ pluginInstance = plugin.create(capability.formValue || {});
4887
+ } catch {
4888
+ throw new Error("plugin_initialization_failed");
4889
+ }
4886
4890
  }
4887
4891
  const actions = [];
4888
4892
  for (let index = 0; index < manifest.actions.length; index++) {
@@ -4894,9 +4898,14 @@ async function hydrateCapability(capability) {
4894
4898
  if (!pluginInstance) {
4895
4899
  throw new Error(`Plugin instance not available for dynamic schema`);
4896
4900
  }
4897
- const jsonSchema = pluginInstance.getInputJsonSchema(manifestAction.key);
4901
+ let jsonSchema;
4902
+ try {
4903
+ jsonSchema = pluginInstance.getInputJsonSchema(manifestAction.key);
4904
+ } catch {
4905
+ throw new Error("plugin_input_schema_resolution_failed");
4906
+ }
4898
4907
  if (!jsonSchema) {
4899
- throw new Error(`Failed to get input schema for action: ${manifestAction.key}`);
4908
+ throw new Error("plugin_input_schema_resolution_failed");
4900
4909
  }
4901
4910
  inputSchema = jsonSchema;
4902
4911
  } else {
@@ -4907,9 +4916,14 @@ async function hydrateCapability(capability) {
4907
4916
  if (!pluginInstance) {
4908
4917
  throw new Error(`Plugin instance not available for dynamic schema`);
4909
4918
  }
4910
- const jsonSchema = pluginInstance.getOutputJsonSchema(manifestAction.key, capability.formValue || {});
4919
+ let jsonSchema;
4920
+ try {
4921
+ jsonSchema = pluginInstance.getOutputJsonSchema(manifestAction.key, capability.formValue || {});
4922
+ } catch {
4923
+ throw new Error("plugin_output_schema_resolution_failed");
4924
+ }
4911
4925
  if (!jsonSchema) {
4912
- throw new Error(`Failed to get output schema for action: ${manifestAction.key}`);
4926
+ throw new Error("plugin_output_schema_resolution_failed");
4913
4927
  }
4914
4928
  outputSchema = jsonSchema;
4915
4929
  } else {
@@ -4940,6 +4954,21 @@ async function hydrateCapability(capability) {
4940
4954
  };
4941
4955
  }
4942
4956
  }
4957
+ function getHydrationFailureReason(result) {
4958
+ if ("_hydrateError" in result) {
4959
+ return result._hydrateError || "unknown hydration error";
4960
+ }
4961
+ if (!("actions" in result)) {
4962
+ return "hydration result is missing actions";
4963
+ }
4964
+ if (!Array.isArray(result.actions)) {
4965
+ return "hydration result actions is not an array";
4966
+ }
4967
+ if (result.actions.length === 0) {
4968
+ return "hydration result has no actions";
4969
+ }
4970
+ return void 0;
4971
+ }
4943
4972
  function formatJsonOutput(data, compact = false) {
4944
4973
  return compact ? JSON.stringify(data) : JSON.stringify(data, null, 2);
4945
4974
  }
@@ -4974,6 +5003,12 @@ async function listSingle(id, summary) {
4974
5003
  printJson(capability);
4975
5004
  } else {
4976
5005
  const hydrated = await hydrateCapability(capability);
5006
+ const failureReason = getHydrationFailureReason(hydrated);
5007
+ if (failureReason) {
5008
+ throw new Error(
5009
+ `capability_hydration_failed: pluginKey=${capability.pluginKey} capabilityId=${capability.id} reason=${failureReason}`
5010
+ );
5011
+ }
4977
5012
  printJson(hydrated);
4978
5013
  }
4979
5014
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/fullstack-cli",
3
- "version": "1.1.68-alpha.20260930060426",
3
+ "version": "1.1.68-alpha.20261003004004",
4
4
  "description": "CLI tool for fullstack template management",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -6,23 +6,15 @@ const { spawnSync } = require('node:child_process');
6
6
 
7
7
  const SEP = ' ' + '─'.repeat(36);
8
8
 
9
- function failAndExit(step, body, code) {
9
+ function failAndExit(step, body) {
10
10
  process.stderr.write('\n✗ pre-commit failed: ' + step + '\n');
11
- process.stderr.write(' command: npm run lint\n');
12
11
  process.stderr.write(SEP + '\n');
13
12
  if (body && body.length > 0) {
14
- process.stderr.write(body);
15
- if (!body.endsWith('\n')) process.stderr.write('\n');
13
+ process.stderr.write(body.replace(/\s+$/, '') + '\n');
16
14
  }
17
15
  process.stderr.write(SEP + '\n');
18
- process.stderr.write(
19
- ' 修复可编辑代码并重跑 npm run lint(原项目完整检查)。\n'
20
- );
21
- process.stderr.write(
22
- ' 命中平台受保护路径时停止反复编辑该文件或检查配置;记录路径、规则和检查原始输出,交有权限的平台维护者修复并复查。\n'
23
- );
24
- process.stderr.write(' 检查仍未通过;不得声称检查或提交成功。\n');
25
- process.exit(code);
16
+ process.stderr.write(' bypass: git commit --no-verify\n');
17
+ process.exit(1);
26
18
  }
27
19
 
28
20
  function runLint() {
@@ -33,20 +25,12 @@ function runLint() {
33
25
  env: process.env,
34
26
  });
35
27
  if (res.error) {
36
- failAndExit('lint', String(res.error.message || res.error), 1);
28
+ failAndExit('lint', String(res.error.message || res.error));
37
29
  }
38
30
  if (res.status !== 0) {
39
31
  const stdout = res.stdout ? res.stdout.toString() : '';
40
32
  const stderr = res.stderr ? res.stderr.toString() : '';
41
- const body =
42
- stdout +
43
- (stdout && stderr && !stdout.endsWith('\n') ? '\n' : '') +
44
- stderr;
45
- failAndExit(
46
- 'lint',
47
- body + (res.signal ? '\nTerminated by signal: ' + res.signal : ''),
48
- res.status ?? 1
49
- );
33
+ failAndExit('lint', stdout + '\n' + stderr);
50
34
  }
51
35
  }
52
36