openxiangda 1.0.95 → 1.0.97

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/lib/cli.js CHANGED
@@ -24,7 +24,9 @@ const { assertCanInitializeWorkspace, initWorkspace } = require('./workspace-ini
24
24
  const { bootstrapWorkspace } = require('./workspace-bootstrap');
25
25
  const {
26
26
  getDesignGates,
27
+ getDesignTopicCatalog,
27
28
  getResourceExplain,
29
+ renderDesignHelp,
28
30
  renderDesignGatesText,
29
31
  renderDesignTemplate,
30
32
  renderResourceExplain,
@@ -49,6 +51,9 @@ const RUNTIME_UPLOAD_CONCURRENCY = 3;
49
51
 
50
52
  async function main(argv) {
51
53
  const [command, ...rest] = argv;
54
+ if (command === 'version' || command === '--version' || command === '-v') {
55
+ return version(rest);
56
+ }
52
57
  if (!command || command === 'help' || command === '--help' || command === '-h') {
53
58
  printHelp();
54
59
  return;
@@ -91,6 +96,7 @@ function printHelp() {
91
96
  print(`OpenXiangda CLI
92
97
 
93
98
  Usage:
99
+ openxiangda version [--json]
94
100
  openxiangda login <platform-url> [--profile name]
95
101
  openxiangda update check|install [--json] [--registry https://registry.npmjs.org]
96
102
  openxiangda platform add <name> <platform-url>
@@ -153,6 +159,7 @@ Usage:
153
159
 
154
160
  OpenXiangda 使用普通用户登录 token,不需要 AK/SK。
155
161
  表单页、流程表单页和代码页的主链路是 sy-lowcode-app-workspace + openxiangda workspace publish。
162
+ 新 React SPA 公开访问使用 public-access 命令和 src/resources/public-access;settings public-access 仅用于旧表单公开设置兼容/修复。
156
163
  JS_CODE V2 使用 trusted_node;AI 源码必须写在 src/js-code-nodes/<scriptCode>/index.ts,代码自动化源码写在 src/automations/<resourceCode>/index.ts。definition-json 中的 sourceFile.localPath 会在 validate/create/publish 时先 TS 校验、再构建并上传为快照。`);
157
164
  }
158
165
 
@@ -233,6 +240,17 @@ function wantsSubcommandHelp(subcommand, flags) {
233
240
  );
234
241
  }
235
242
 
243
+ async function version(args) {
244
+ const { flags } = parseArgs(args);
245
+ const result = {
246
+ name: NPM_PACKAGE_NAME,
247
+ version: CURRENT_VERSION,
248
+ updateCheckCommand: 'openxiangda update check --json',
249
+ };
250
+ if (flags.json) return writeJson(result);
251
+ print(CURRENT_VERSION);
252
+ }
253
+
236
254
  async function update(args) {
237
255
  const requestedSubcommand = args[0] && !args[0].startsWith('--') ? args[0] : 'check';
238
256
  const parsedArgs = requestedSubcommand === args[0] ? args.slice(1) : args;
@@ -435,7 +453,8 @@ async function design(args) {
435
453
  const { flags, positional } = parseArgs(rest);
436
454
  const topic = flags.topic || positional[0];
437
455
  if (wantsSubcommandHelp(subcommand, flags)) {
438
- print('用法: openxiangda design gates|template [--topic new-app,public-access] [--json]');
456
+ if (flags.json) return writeJson(getDesignTopicCatalog());
457
+ print(renderDesignHelp());
439
458
  return;
440
459
  }
441
460
 
@@ -4016,7 +4035,9 @@ async function commands(args) {
4016
4035
  const { flags } = parseArgs(args);
4017
4036
  const manifest = {
4018
4037
  name: 'openxiangda',
4038
+ version: CURRENT_VERSION,
4019
4039
  commands: [
4040
+ 'version [--json]',
4020
4041
  'login <platform-url> [--profile name]',
4021
4042
  'update check|install',
4022
4043
  'platform add|list|use|remove',
@@ -4048,6 +4069,14 @@ async function commands(args) {
4048
4069
  'feedback preview|submit',
4049
4070
  'skill install|status|bootstrap',
4050
4071
  ],
4072
+ designTopics: getDesignTopicCatalog(),
4073
+ resourceNotes: [
4074
+ 'For formal multi-resource development, prefer src/resources/** + openxiangda resource validate|plan|publish.',
4075
+ 'Use first-class route/public-access/auth-config/function/connector/notification/data-view/menu/permission commands for discovery, diagnosis, dry-run, and small live fixes.',
4076
+ 'public-access is the new React SPA public policy resource for /view/:appType/public/* routes; page code should use PublicAccessGate, and Page SDK hooks must stay inside OpenXiangdaProvider + OpenXiangdaPageProvider.',
4077
+ 'settings public-access is legacy form public-access compatibility/repair and should not be used for new React SPA apps.',
4078
+ 'Direct live mutation commands should use --dry-run first and --write-manifest when the repository should remain source of truth.',
4079
+ ],
4051
4080
  };
4052
4081
  if (flags.json) return writeJson(manifest);
4053
4082
  print(JSON.stringify(manifest, null, 2));
@@ -95,7 +95,7 @@ const DESIGN_GATE_TOPICS = [
95
95
  '是否需要限流、过期时间、审计字段和回收策略',
96
96
  ],
97
97
  recommendedDefaults: [
98
- '新 React SPA 仅使用 /view/:appType/public/* + routes + public-access policy',
98
+ '新 React SPA 仅使用 /view/:appType/public/* + routes + public-access policy + PublicAccessGate',
99
99
  '普通公开页用 scoped public session;敏感页用 ticket 模式',
100
100
  '未显式 grant 的 form/dataView/function/connector 一律拒绝',
101
101
  ],
@@ -294,6 +294,37 @@ function getDesignGates(topicCode) {
294
294
  };
295
295
  }
296
296
 
297
+ function getDesignTopicCatalog() {
298
+ return {
299
+ hardRule: DESIGN_GATE_HARD_RULE,
300
+ topics: DESIGN_GATE_TOPICS.map(topic => ({
301
+ code: topic.code,
302
+ title: topic.title,
303
+ triggers: topic.triggers,
304
+ })),
305
+ aliases: DESIGN_GATE_TOPIC_ALIASES,
306
+ };
307
+ }
308
+
309
+ function renderDesignHelp() {
310
+ const catalog = getDesignTopicCatalog();
311
+ const lines = [
312
+ '用法: openxiangda design gates|template [--topic code[,code...]] [--json]',
313
+ '',
314
+ catalog.hardRule,
315
+ '',
316
+ 'Topics:',
317
+ ];
318
+ for (const topic of catalog.topics) {
319
+ lines.push(`- ${topic.code}: ${topic.title} (${topic.triggers.join('、')})`);
320
+ }
321
+ lines.push('', 'Aliases:');
322
+ for (const [alias, code] of Object.entries(catalog.aliases).sort()) {
323
+ lines.push(`- ${alias} -> ${code}`);
324
+ }
325
+ return lines.join('\n');
326
+ }
327
+
297
328
  function renderDesignGatesText(topicCode) {
298
329
  const gates = getDesignGates(topicCode);
299
330
  const lines = [gates.hardRule, ''];
@@ -326,7 +357,7 @@ function renderDesignTemplate(topicCode) {
326
357
  '## 2. 推荐方案',
327
358
  '- Runtime:React SPA',
328
359
  '- 资源发布:src/resources/** + openxiangda resource plan/publish',
329
- '- 公开访问:仅使用 /view/:appType/public/* + routes + public-access policy',
360
+ '- 公开访问:仅使用 /view/:appType/public/* + routes + public-access policy + PublicAccessGate',
330
361
  '',
331
362
  '## 3. 待确认问题',
332
363
  ];
@@ -391,6 +422,7 @@ const RESOURCE_EXPLAINS = {
391
422
  'openxiangda public-access upsert --json-file src/resources/public-access/public_register.json',
392
423
  'openxiangda public-access session-test public_register --path /view/APP_XXX/public/register',
393
424
  'openxiangda public-access grant-check public_register --form-code customer',
425
+ 'React 页面侧使用 PublicAccessGate;如果使用 Page SDK hooks,放在 OpenXiangdaProvider + OpenXiangdaPageProvider 内',
394
426
  ],
395
427
  },
396
428
  'auth-config': {
@@ -503,8 +535,11 @@ function renderResourceExplain(type) {
503
535
  module.exports = {
504
536
  DESIGN_GATE_HARD_RULE,
505
537
  DESIGN_GATE_TOPICS,
538
+ DESIGN_GATE_TOPIC_ALIASES,
506
539
  getDesignGates,
540
+ getDesignTopicCatalog,
507
541
  getResourceExplain,
542
+ renderDesignHelp,
508
543
  renderDesignGatesText,
509
544
  renderDesignTemplate,
510
545
  renderResourceExplain,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda",
3
- "version": "1.0.95",
3
+ "version": "1.0.97",
4
4
  "description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
5
5
  "private": false,
6
6
  "bin": {