@share-crm/sharedev-cli 0.0.4-rc.50-test.3 → 0.0.4-rc.52

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 (2) hide show
  1. package/dist/sharedev.js +329 -996
  2. package/package.json +1 -2
package/dist/sharedev.js CHANGED
@@ -8572,8 +8572,6 @@ const index_ts_1 = __webpack_require__(22841);
8572
8572
  const context_ts_1 = __webpack_require__(29531);
8573
8573
  const logger_ts_1 = __webpack_require__(87562);
8574
8574
  const request_ts_1 = __webpack_require__(83733);
8575
- const request_channel_ts_1 = __webpack_require__(43355);
8576
- const sharecrm_session_ts_1 = __webpack_require__(47166);
8577
8575
  const pkgMeta_ts_1 = __webpack_require__(48559);
8578
8576
  const normalize_ts_1 = __importDefault(__webpack_require__(80399));
8579
8577
  const debug_ts_1 = __webpack_require__(90667);
@@ -8699,8 +8697,6 @@ async function bootstrap() {
8699
8697
  }
8700
8698
  const runtimeContext = await (0, context_ts_1.createCliRuntimeContext)(bootstrapOptions);
8701
8699
  request_ts_1.requestService.configure(runtimeContext.settings);
8702
- (0, request_channel_ts_1.configureRequestChannel)(runtimeContext.settings);
8703
- (0, sharecrm_session_ts_1.configureSharecrmSession)(runtimeContext.settings);
8704
8700
  // npm 与 spec 版本检查并发执行(均带 1.5s 超时,错误吞掉,不影响命令执行)
8705
8701
  await Promise.all([
8706
8702
  checkForNpmUpdate(pkgMeta.name, version),
@@ -8958,6 +8954,7 @@ var __webpack_unused_export__;
8958
8954
 
8959
8955
  __webpack_unused_export__ = ({ value: true });
8960
8956
  exports.registerAplNamespace = registerAplNamespace;
8957
+ const hide_unverified_new_ts_1 = __webpack_require__(46110);
8961
8958
  const command_ts_1 = __webpack_require__(51481);
8962
8959
  const apl_command_ts_1 = __webpack_require__(10508);
8963
8960
  const index_ts_1 = __webpack_require__(76266);
@@ -9093,91 +9090,94 @@ Examples:
9093
9090
  await (0, index_ts_1.aplLogDetailNewCommand)(args[0], context, options);
9094
9091
  }));
9095
9092
  // ============ 操作中心链路(-new):与上方 FHH 链路指令一一对应,便于对比改造前后行为 ============
9096
- apl.command('list-new')
9097
- .description('[operation-center] List APL functions with pagination and server-side filters')
9098
- .requiredOption('--pageNumber <number>', 'Query page number, starting from 1')
9099
- .requiredOption('--pageSize <size>', 'Page size')
9100
- .option('--api_name <apiName>', 'Filter by API name')
9101
- .option('--binding_object_api_name <name>', 'Filter by binding object API name')
9102
- .option('--function_name <name>', 'Filter by function name keyword')
9103
- .option('--body <keyword>', 'Filter by function body keyword')
9104
- .option('--package_name <name>', 'Filter by package name')
9105
- .option('--return_type <type>', 'Filter by return type')
9106
- .option('--type <type>', 'Filter by function type')
9107
- .option('--selectFieldName <field>', 'Select function name or body as the keyword query field')
9108
- .option('--lang <number>', 'Filter by script language code')
9109
- .option('--is_active <boolean>', 'Filter by active status: true or false')
9110
- .action((0, command_ts_1.createCommandAction)('apl', 'list-new', runtimeContext, async ({ options, context }) => {
9111
- await (0, index_ts_1.aplListNewCommand)(context, options);
9112
- }));
9113
- apl.command('info-new <apiName>')
9114
- .description('[operation-center] Show APL function details')
9115
- .option('--bind <bindingObjectApiName>', 'Provide binding object api name for bound functions')
9116
- .action((0, command_ts_1.createCommandAction)('apl', 'info-new', runtimeContext, async ({ args, options, context }) => {
9117
- await (0, index_ts_1.aplInfoNewCommand)(args[0], context, options);
9118
- }));
9119
- apl.command('pull-new [apiName]')
9120
- .description('[operation-center] Pull APL source from remote')
9121
- .option('--all', 'Pull all APL functions')
9122
- .option('--parameters <json>', 'Override function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9123
- .action((0, command_ts_1.createCommandAction)('apl', 'pull-new', runtimeContext, async ({ args, options, context }) => {
9124
- await (0, index_ts_1.aplPullNewCommand)(args[0], context, options);
9125
- }));
9126
- apl.command('diff-new [apiName]')
9127
- .description('[operation-center] Compare local APL source with snapshot or remote version')
9128
- .option('-r, --remote <versionOrLatest>', 'Compare with remote version or latest')
9129
- .action((0, command_ts_1.createCommandAction)('apl', 'diff-new', runtimeContext, async ({ args, options, context }) => {
9130
- await (0, index_ts_1.aplDiffNewCommand)(args[0], context, options);
9131
- }));
9132
- apl.command('push-new [apiName]')
9133
- .description('[operation-center] Push local APL source to remote with a required commit comment')
9134
- .requiredOption('-m, --remark <comment>', 'Required push comment submitted as remote commit_log; [apiName] targets one function, omit it to push all tracked local changes')
9135
- .option('--force', 'Force push only when remote version changed')
9136
- .option('--parameters <json>', 'Override function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9137
- .action((0, command_ts_1.createCommandAction)('apl', 'push-new', runtimeContext, async ({ args, options, context }) => {
9138
- await (0, index_ts_1.aplPushNewCommand)(args[0], context, options);
9139
- }));
9140
- apl.command('reset-new [apiName]')
9141
- .description('[operation-center] Reset local APL source to remote latest or a specific version')
9142
- .option('-r, --remote <versionOrLatest>', 'Reset to remote latest or a specific version')
9143
- .action((0, command_ts_1.createCommandAction)('apl', 'reset-new', runtimeContext, async ({ args, options, context }) => {
9144
- await (0, index_ts_1.aplResetNewCommand)(args[0], context, options);
9145
- }));
9146
- apl.command('analyze-new [apiName]')
9147
- .description('[operation-center] Analyze local APL source against remote metadata')
9148
- .action((0, command_ts_1.createCommandAction)('apl', 'analyze-new', runtimeContext, async ({ args, context }) => {
9149
- await (0, index_ts_1.aplAnalyzeNewCommand)(args[0], context);
9150
- }));
9151
- apl.command('compile-new [apiName]')
9152
- .description('[operation-center] Compile-check local APL source against remote metadata')
9153
- .action((0, command_ts_1.createCommandAction)('apl', 'compile-new', runtimeContext, async ({ args, context }) => {
9154
- await (0, index_ts_1.aplCompileNewCommand)(args[0], context);
9155
- }));
9156
- apl.command('debug-new [apiName]')
9157
- .description('[operation-center] Debug local tracked APL source against remote metadata')
9158
- .option('--data-id <id>', 'Pass object data ID for bound-object debug runs')
9159
- .option('--params <name=value...>', 'Pass debug params once; separate entries by space or comma, e.g. --params a=1 b=2 or --params a=1,b=2')
9160
- .action((0, command_ts_1.createCommandAction)('apl', 'debug-new', runtimeContext, async ({ args, options, context }) => {
9161
- await (0, index_ts_1.aplDebugNewCommand)(args[0], context, options);
9162
- }));
9163
- apl.command('create-new')
9164
- .description('[operation-center] Create a new APL function/class and write local groovy source')
9165
- .option('--apiname <apiName>', 'APL API name')
9166
- .option('--function-name <functionName>', 'APL display/function name')
9167
- .option('--type <type>', 'APL type: function | class', 'function')
9168
- .option('--namespace <namespace>', 'Namespace value')
9169
- .option('--return-type <returnType>', 'Return type (required when --type function)')
9170
- .option('--bind <bindingObjectApiName>', 'Binding object API name, or NONE for unbound')
9171
- .option('--remark <remark>', 'Description (max 200 chars)')
9172
- .option('--template-id <templateId>', 'Code template id from remote template list')
9173
- .option('--parameters <json>', 'Function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9174
- .action((0, command_ts_1.createCommandAction)('apl', 'create-new', runtimeContext, async ({ options, context }) => {
9175
- const resolvedOptions = {
9176
- ...options,
9177
- apiName: options.apiName ?? options.apiname
9178
- };
9179
- await (0, index_ts_1.aplCreateNewCommand)(context, resolvedOptions);
9180
- }));
9093
+ // 临时屏蔽:服务端操作中心未上线 code-dev apl 相关 action,放开:SHAREDEV_ENABLE_NEW_COMMANDS=1
9094
+ if ((0, hide_unverified_new_ts_1.isNewCommandEnabled)(runtimeContext.settings?.domain)) {
9095
+ apl.command('list-new')
9096
+ .description('[operation-center] List APL functions with pagination and server-side filters')
9097
+ .requiredOption('--pageNumber <number>', 'Query page number, starting from 1')
9098
+ .requiredOption('--pageSize <size>', 'Page size')
9099
+ .option('--api_name <apiName>', 'Filter by API name')
9100
+ .option('--binding_object_api_name <name>', 'Filter by binding object API name')
9101
+ .option('--function_name <name>', 'Filter by function name keyword')
9102
+ .option('--body <keyword>', 'Filter by function body keyword')
9103
+ .option('--package_name <name>', 'Filter by package name')
9104
+ .option('--return_type <type>', 'Filter by return type')
9105
+ .option('--type <type>', 'Filter by function type')
9106
+ .option('--selectFieldName <field>', 'Select function name or body as the keyword query field')
9107
+ .option('--lang <number>', 'Filter by script language code')
9108
+ .option('--is_active <boolean>', 'Filter by active status: true or false')
9109
+ .action((0, command_ts_1.createCommandAction)('apl', 'list-new', runtimeContext, async ({ options, context }) => {
9110
+ await (0, index_ts_1.aplListNewCommand)(context, options);
9111
+ }));
9112
+ apl.command('info-new <apiName>')
9113
+ .description('[operation-center] Show APL function details')
9114
+ .option('--bind <bindingObjectApiName>', 'Provide binding object api name for bound functions')
9115
+ .action((0, command_ts_1.createCommandAction)('apl', 'info-new', runtimeContext, async ({ args, options, context }) => {
9116
+ await (0, index_ts_1.aplInfoNewCommand)(args[0], context, options);
9117
+ }));
9118
+ apl.command('pull-new [apiName]')
9119
+ .description('[operation-center] Pull APL source from remote')
9120
+ .option('--all', 'Pull all APL functions')
9121
+ .option('--parameters <json>', 'Override function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9122
+ .action((0, command_ts_1.createCommandAction)('apl', 'pull-new', runtimeContext, async ({ args, options, context }) => {
9123
+ await (0, index_ts_1.aplPullNewCommand)(args[0], context, options);
9124
+ }));
9125
+ apl.command('diff-new [apiName]')
9126
+ .description('[operation-center] Compare local APL source with snapshot or remote version')
9127
+ .option('-r, --remote <versionOrLatest>', 'Compare with remote version or latest')
9128
+ .action((0, command_ts_1.createCommandAction)('apl', 'diff-new', runtimeContext, async ({ args, options, context }) => {
9129
+ await (0, index_ts_1.aplDiffNewCommand)(args[0], context, options);
9130
+ }));
9131
+ apl.command('push-new [apiName]')
9132
+ .description('[operation-center] Push local APL source to remote with a required commit comment')
9133
+ .requiredOption('-m, --remark <comment>', 'Required push comment submitted as remote commit_log; [apiName] targets one function, omit it to push all tracked local changes')
9134
+ .option('--force', 'Force push only when remote version changed')
9135
+ .option('--parameters <json>', 'Override function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9136
+ .action((0, command_ts_1.createCommandAction)('apl', 'push-new', runtimeContext, async ({ args, options, context }) => {
9137
+ await (0, index_ts_1.aplPushNewCommand)(args[0], context, options);
9138
+ }));
9139
+ apl.command('reset-new [apiName]')
9140
+ .description('[operation-center] Reset local APL source to remote latest or a specific version')
9141
+ .option('-r, --remote <versionOrLatest>', 'Reset to remote latest or a specific version')
9142
+ .action((0, command_ts_1.createCommandAction)('apl', 'reset-new', runtimeContext, async ({ args, options, context }) => {
9143
+ await (0, index_ts_1.aplResetNewCommand)(args[0], context, options);
9144
+ }));
9145
+ apl.command('analyze-new [apiName]')
9146
+ .description('[operation-center] Analyze local APL source against remote metadata')
9147
+ .action((0, command_ts_1.createCommandAction)('apl', 'analyze-new', runtimeContext, async ({ args, context }) => {
9148
+ await (0, index_ts_1.aplAnalyzeNewCommand)(args[0], context);
9149
+ }));
9150
+ apl.command('compile-new [apiName]')
9151
+ .description('[operation-center] Compile-check local APL source against remote metadata')
9152
+ .action((0, command_ts_1.createCommandAction)('apl', 'compile-new', runtimeContext, async ({ args, context }) => {
9153
+ await (0, index_ts_1.aplCompileNewCommand)(args[0], context);
9154
+ }));
9155
+ apl.command('debug-new [apiName]')
9156
+ .description('[operation-center] Debug local tracked APL source against remote metadata')
9157
+ .option('--data-id <id>', 'Pass object data ID for bound-object debug runs')
9158
+ .option('--params <name=value...>', 'Pass debug params once; separate entries by space or comma, e.g. --params a=1 b=2 or --params a=1,b=2')
9159
+ .action((0, command_ts_1.createCommandAction)('apl', 'debug-new', runtimeContext, async ({ args, options, context }) => {
9160
+ await (0, index_ts_1.aplDebugNewCommand)(args[0], context, options);
9161
+ }));
9162
+ apl.command('create-new')
9163
+ .description('[operation-center] Create a new APL function/class and write local groovy source')
9164
+ .option('--apiname <apiName>', 'APL API name')
9165
+ .option('--function-name <functionName>', 'APL display/function name')
9166
+ .option('--type <type>', 'APL type: function | class', 'function')
9167
+ .option('--namespace <namespace>', 'Namespace value')
9168
+ .option('--return-type <returnType>', 'Return type (required when --type function)')
9169
+ .option('--bind <bindingObjectApiName>', 'Binding object API name, or NONE for unbound')
9170
+ .option('--remark <remark>', 'Description (max 200 chars)')
9171
+ .option('--template-id <templateId>', 'Code template id from remote template list')
9172
+ .option('--parameters <json>', 'Function parameters, e.g. \'[{"name":"xx","type":"String","remark":"xx","default_value":"xx"}]\'')
9173
+ .action((0, command_ts_1.createCommandAction)('apl', 'create-new', runtimeContext, async ({ options, context }) => {
9174
+ const resolvedOptions = {
9175
+ ...options,
9176
+ apiName: options.apiName ?? options.apiname
9177
+ };
9178
+ await (0, index_ts_1.aplCreateNewCommand)(context, resolvedOptions);
9179
+ }));
9180
+ }
9181
9181
  }
9182
9182
 
9183
9183
 
@@ -9893,48 +9893,6 @@ function registerApprovalNamespace(program, runtimeContext) {
9893
9893
  }
9894
9894
 
9895
9895
 
9896
- /***/ },
9897
-
9898
- /***/ 85971
9899
- (__unused_webpack_module, exports, __webpack_require__) {
9900
-
9901
- var __webpack_unused_export__;
9902
-
9903
- __webpack_unused_export__ = ({ value: true });
9904
- exports.registerAuthCommand = registerAuthCommand;
9905
- const command_ts_1 = __webpack_require__(51481);
9906
- const index_ts_1 = __webpack_require__(98695);
9907
- /**
9908
- * auth 命令依赖工作区存在(登录环境从 settings.json 的 domain 反向推导):
9909
- * 未 init 的目录下执行会在 bootstrap 阶段被引导先运行 `sharedev init`。
9910
- */
9911
- function registerAuthCommand(program, runtimeContext) {
9912
- const auth = program.command('auth').description('Manage sharecrm login state for sharedev CLI');
9913
- auth
9914
- .command('login')
9915
- .description('Login via sharecrm device flow (environment inherited from workspace domain)')
9916
- .addHelpText('after', `
9917
- Examples:
9918
- $ sharedev auth login
9919
- `)
9920
- .action((0, command_ts_1.createCommandAction)('auth', 'login', runtimeContext, async ({ context }) => {
9921
- await (0, index_ts_1.authLoginCommand)(context.settings.domain);
9922
- }));
9923
- auth
9924
- .command('status')
9925
- .description('Show current login state (sharecrm login and certificate config)')
9926
- .action((0, command_ts_1.createCommandAction)('auth', 'status', runtimeContext, async ({ context }) => {
9927
- await (0, index_ts_1.authStatusCommand)(context.settings);
9928
- }));
9929
- auth
9930
- .command('logout')
9931
- .description('Clear workspace login state (does not logout sharecrm itself)')
9932
- .action((0, command_ts_1.createCommandAction)('auth', 'logout', runtimeContext, async () => {
9933
- await (0, index_ts_1.authLogoutCommand)();
9934
- }));
9935
- }
9936
-
9937
-
9938
9896
  /***/ },
9939
9897
 
9940
9898
  /***/ 5264
@@ -12311,6 +12269,46 @@ function registerFlowNamespace(program, runtimeContext) {
12311
12269
  }
12312
12270
 
12313
12271
 
12272
+ /***/ },
12273
+
12274
+ /***/ 46110
12275
+ (__unused_webpack_module, exports) {
12276
+
12277
+ var __webpack_unused_export__;
12278
+
12279
+ __webpack_unused_export__ = ({ value: true });
12280
+ exports.isNewCommandEnabled = isNewCommandEnabled;
12281
+ /**
12282
+ * 操作中心 -new 命令的环境开关。
12283
+ *
12284
+ * 服务端操作中心按环境部署:ceshi112 环境已上线 code-dev 相关 action,其余环境
12285
+ * (如 fktest5642 所在环境)执行这些命令只会得到 "Command does not exist"。
12286
+ * 已验证可用的操作中心命令(apl set-active / logs / log-detail)不受此开关影响。
12287
+ *
12288
+ * 放开条件(满足其一):
12289
+ * - 工作区 settings.domain 的 hostname 命中 ENABLED_DOMAIN_HOSTS;
12290
+ * - 环境变量 SHAREDEV_ENABLE_NEW_COMMANDS=1(联调验证用)。
12291
+ *
12292
+ * 注意:--help 走 placeholder 上下文(domain 为哨兵值),help 输出中看不到
12293
+ * 这些命令;在放开环境下直接执行即可,或用环境变量让 help 也显示。
12294
+ */
12295
+ const ENABLED_DOMAIN_HOSTS = new Set(['crm.ceshi112.com']);
12296
+ function isNewCommandEnabled(domain) {
12297
+ if (process.env.SHAREDEV_ENABLE_NEW_COMMANDS === '1') {
12298
+ return true;
12299
+ }
12300
+ if (!domain) {
12301
+ return false;
12302
+ }
12303
+ try {
12304
+ return ENABLED_DOMAIN_HOSTS.has(new URL(domain).hostname);
12305
+ }
12306
+ catch {
12307
+ return false;
12308
+ }
12309
+ }
12310
+
12311
+
12314
12312
  /***/ },
12315
12313
 
12316
12314
  /***/ 22841
@@ -12349,11 +12347,9 @@ const er_ts_1 = __webpack_require__(40402);
12349
12347
  const semantic_ts_1 = __webpack_require__(35185);
12350
12348
  const access_ts_1 = __webpack_require__(9759);
12351
12349
  const app_dev_ts_1 = __webpack_require__(82916);
12352
- const auth_ts_1 = __webpack_require__(85971);
12353
12350
  function registerNamespaces(program, context) {
12354
12351
  (0, init_ts_1.registerInitCommand)(program, context);
12355
12352
  (0, config_ts_1.registerConfigCommand)(program, context);
12356
- (0, auth_ts_1.registerAuthCommand)(program, context);
12357
12353
  (0, apl_ts_1.registerAplNamespace)(program, context);
12358
12354
  (0, completion_ts_1.registerCompletionCommand)(program, context);
12359
12355
  (0, docs_ts_1.registerDocsNamespace)(program, context);
@@ -13752,6 +13748,7 @@ var __webpack_unused_export__;
13752
13748
  __webpack_unused_export__ = ({ value: true });
13753
13749
  exports.registerPwcNamespace = registerPwcNamespace;
13754
13750
  const commander_1 = __webpack_require__(63219);
13751
+ const hide_unverified_new_ts_1 = __webpack_require__(46110);
13755
13752
  const command_ts_1 = __webpack_require__(51481);
13756
13753
  const pwc_command_ts_1 = __webpack_require__(10372);
13757
13754
  const index_ts_1 = __webpack_require__(60063);
@@ -13780,6 +13777,9 @@ Examples:
13780
13777
  $ sharedev pwc push --apiname MyPlugin --type plugin
13781
13778
  $ sharedev pwc deploy --apiname MyComponent --type component
13782
13779
  $ sharedev pwc create --type component --name Demo --apiname demo__c
13780
+ $ sharedev pwc create --type component --name Demo --apiname demo__c
13781
+ $ sharedev pwc dev src/index.js
13782
+ ${(0, hide_unverified_new_ts_1.isNewCommandEnabled)(runtimeContext.settings?.domain) ? `
13783
13783
  $ sharedev pwc list-new --type component
13784
13784
  $ sharedev pwc info-new --apiname MyComponent --type component
13785
13785
  $ sharedev pwc pull-new --apiname MyComponent --type component
@@ -13787,8 +13787,7 @@ Examples:
13787
13787
  $ sharedev pwc push-new --apiname MyComponent --type component
13788
13788
  $ sharedev pwc deploy-new --apiname MyComponent --type component
13789
13789
  $ sharedev pwc create-new --type component --name Demo --apiname demo__c
13790
- $ sharedev pwc dev src/index.js
13791
- `);
13790
+ ` : ''}`);
13792
13791
  pwc.command('info')
13793
13792
  .description('Show detail info (URL, type, clients) for a PWC resource by apiName')
13794
13793
  .requiredOption('--apiname <apiName>', 'PWC resource API name')
@@ -13862,81 +13861,84 @@ Examples:
13862
13861
  await (0, pwc_command_ts_1.pwcPushCommand)(target, options, context);
13863
13862
  }));
13864
13863
  // ============ 操作中心链路(-new):与上方 FHH 链路指令对应,便于对比改造前后行为 ============
13865
- pwc.command('list-new')
13866
- .description('[operation-center] List PWC resources by type')
13867
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13868
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13869
- .makeOptionMandatory())
13870
- .option('--componentType <componentType>', 'Component type filter (component only)')
13871
- .option('--scopePageTypes <scopePageTypes>', 'Component page types filter (component only)')
13872
- .option('--pageNumber <pageNumber>', 'Component list page number (component only)')
13873
- .option('--pageSize <pageSize>', 'Component list page size (component only)')
13874
- .option('--clients <clients>', 'Component clients filter (component only)')
13875
- .option('--scopeObjects <scopeObjects>', 'Component objects filter (component only)')
13876
- .option('--keyword <keyword>', 'Component keyword filter (component only)')
13877
- .action((0, command_ts_1.createCommandAction)('pwc', 'list-new', runtimeContext, async ({ options }) => {
13878
- await (0, index_ts_1.pwcPwcListCommand)(options);
13879
- }));
13880
- pwc.command('info-new')
13881
- .description('[operation-center] Show PWC resource details by apiName')
13882
- .requiredOption('--apiname <apiName>', 'PWC resource API name')
13883
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13884
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13885
- .makeOptionMandatory())
13886
- .action((0, command_ts_1.createCommandAction)('pwc', 'info-new', runtimeContext, async ({ options }) => {
13887
- await (0, index_ts_1.pwcPwcInfoCommand)(options);
13888
- }));
13889
- pwc.command('pull-new')
13890
- .description('[operation-center] Pull PWC source from remote')
13891
- .option('--apiname <apiName>', 'Pull one PWC resource by apiName')
13892
- .option('--all', 'Pull all PWC resources of the specified type')
13893
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13894
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13895
- .makeOptionMandatory())
13896
- .action((0, command_ts_1.createCommandAction)('pwc', 'pull-new', runtimeContext, async ({ options, context }) => {
13897
- await (0, index_ts_1.pwcPwcPullCommand)(options, context);
13898
- }));
13899
- pwc.command('push-new')
13900
- .description('[operation-center] Push local PWC source to remote (upload files and update metadata, no build)')
13901
- .option('--apiname <apiName>', 'Push one PWC resource by apiName')
13902
- .option('--path <path>', 'Push one PWC resource by local path')
13903
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13904
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13905
- .makeOptionMandatory())
13906
- .action((0, command_ts_1.createCommandAction)('pwc', 'push-new', runtimeContext, async ({ options, context }) => {
13907
- await (0, index_ts_1.pwcPwcPushCommand)(options, context);
13908
- }));
13909
- pwc.command('deploy-new')
13910
- .description('[operation-center] Deploy local PWC source to remote (push + build)')
13911
- .option('--apiname <apiName>', 'Deploy one PWC resource by apiName')
13912
- .option('--path <path>', 'Deploy one PWC resource by local path')
13913
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13914
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13915
- .makeOptionMandatory())
13916
- .action((0, command_ts_1.createCommandAction)('pwc', 'deploy-new', runtimeContext, async ({ options, context }) => {
13917
- await (0, index_ts_1.pwcPwcDeployCommand)(options, context);
13918
- }));
13919
- pwc.command('create-new')
13920
- .description('[operation-center] Create a new PWC resource and pull it into local workspace')
13921
- .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13922
- .choices(pwc_types_ts_1.PWC_TYPE_VALUES))
13923
- .option('--name <name>', 'PWC name')
13924
- .option('--apiname <apiName>', 'PWC API name')
13925
- .option('--description <description>', 'Description')
13926
- .option('--component-type <componentType>', 'Component type, e.g. vue/applet')
13927
- .option('--client-types <clientTypes>', 'Component client types, comma separated: web,app')
13928
- .option('--scope-page-types <scopePageTypes>', 'Component page types, comma separated')
13929
- .option('--client <client>', 'Plugin client: web or app')
13930
- .option('--plugin-type <pluginType>', 'Plugin type value')
13931
- .option('--limit-obj <limitObj>', 'Restrict objects: true or false')
13932
- .option('--scope-objects <scopeObjects>', 'Object api names, comma separated')
13933
- .action((0, command_ts_1.createCommandAction)('pwc', 'create-new', runtimeContext, async ({ options, context }) => {
13934
- const resolvedOptions = {
13935
- ...options,
13936
- apiName: options.apiName ?? options.apiname
13937
- };
13938
- await (0, index_ts_1.pwcPwcCreateCommand)(resolvedOptions, context);
13939
- }));
13864
+ // 临时屏蔽:服务端操作中心未上线 code-dev apl 相关 action,放开:SHAREDEV_ENABLE_NEW_COMMANDS=1
13865
+ if ((0, hide_unverified_new_ts_1.isNewCommandEnabled)(runtimeContext.settings?.domain)) {
13866
+ pwc.command('list-new')
13867
+ .description('[operation-center] List PWC resources by type')
13868
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13869
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13870
+ .makeOptionMandatory())
13871
+ .option('--componentType <componentType>', 'Component type filter (component only)')
13872
+ .option('--scopePageTypes <scopePageTypes>', 'Component page types filter (component only)')
13873
+ .option('--pageNumber <pageNumber>', 'Component list page number (component only)')
13874
+ .option('--pageSize <pageSize>', 'Component list page size (component only)')
13875
+ .option('--clients <clients>', 'Component clients filter (component only)')
13876
+ .option('--scopeObjects <scopeObjects>', 'Component objects filter (component only)')
13877
+ .option('--keyword <keyword>', 'Component keyword filter (component only)')
13878
+ .action((0, command_ts_1.createCommandAction)('pwc', 'list-new', runtimeContext, async ({ options }) => {
13879
+ await (0, index_ts_1.pwcPwcListCommand)(options);
13880
+ }));
13881
+ pwc.command('info-new')
13882
+ .description('[operation-center] Show PWC resource details by apiName')
13883
+ .requiredOption('--apiname <apiName>', 'PWC resource API name')
13884
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13885
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13886
+ .makeOptionMandatory())
13887
+ .action((0, command_ts_1.createCommandAction)('pwc', 'info-new', runtimeContext, async ({ options }) => {
13888
+ await (0, index_ts_1.pwcPwcInfoCommand)(options);
13889
+ }));
13890
+ pwc.command('pull-new')
13891
+ .description('[operation-center] Pull PWC source from remote')
13892
+ .option('--apiname <apiName>', 'Pull one PWC resource by apiName')
13893
+ .option('--all', 'Pull all PWC resources of the specified type')
13894
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13895
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13896
+ .makeOptionMandatory())
13897
+ .action((0, command_ts_1.createCommandAction)('pwc', 'pull-new', runtimeContext, async ({ options, context }) => {
13898
+ await (0, index_ts_1.pwcPwcPullCommand)(options, context);
13899
+ }));
13900
+ pwc.command('push-new')
13901
+ .description('[operation-center] Push local PWC source to remote (upload files and update metadata, no build)')
13902
+ .option('--apiname <apiName>', 'Push one PWC resource by apiName')
13903
+ .option('--path <path>', 'Push one PWC resource by local path')
13904
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13905
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13906
+ .makeOptionMandatory())
13907
+ .action((0, command_ts_1.createCommandAction)('pwc', 'push-new', runtimeContext, async ({ options, context }) => {
13908
+ await (0, index_ts_1.pwcPwcPushCommand)(options, context);
13909
+ }));
13910
+ pwc.command('deploy-new')
13911
+ .description('[operation-center] Deploy local PWC source to remote (push + build)')
13912
+ .option('--apiname <apiName>', 'Deploy one PWC resource by apiName')
13913
+ .option('--path <path>', 'Deploy one PWC resource by local path')
13914
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13915
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES)
13916
+ .makeOptionMandatory())
13917
+ .action((0, command_ts_1.createCommandAction)('pwc', 'deploy-new', runtimeContext, async ({ options, context }) => {
13918
+ await (0, index_ts_1.pwcPwcDeployCommand)(options, context);
13919
+ }));
13920
+ pwc.command('create-new')
13921
+ .description('[operation-center] Create a new PWC resource and pull it into local workspace')
13922
+ .addOption(new commander_1.Option('--type <type>', 'PWC type: component or plugin')
13923
+ .choices(pwc_types_ts_1.PWC_TYPE_VALUES))
13924
+ .option('--name <name>', 'PWC name')
13925
+ .option('--apiname <apiName>', 'PWC API name')
13926
+ .option('--description <description>', 'Description')
13927
+ .option('--component-type <componentType>', 'Component type, e.g. vue/applet')
13928
+ .option('--client-types <clientTypes>', 'Component client types, comma separated: web,app')
13929
+ .option('--scope-page-types <scopePageTypes>', 'Component page types, comma separated')
13930
+ .option('--client <client>', 'Plugin client: web or app')
13931
+ .option('--plugin-type <pluginType>', 'Plugin type value')
13932
+ .option('--limit-obj <limitObj>', 'Restrict objects: true or false')
13933
+ .option('--scope-objects <scopeObjects>', 'Object api names, comma separated')
13934
+ .action((0, command_ts_1.createCommandAction)('pwc', 'create-new', runtimeContext, async ({ options, context }) => {
13935
+ const resolvedOptions = {
13936
+ ...options,
13937
+ apiName: options.apiName ?? options.apiname
13938
+ };
13939
+ await (0, index_ts_1.pwcPwcCreateCommand)(resolvedOptions, context);
13940
+ }));
13941
+ }
13940
13942
  }
13941
13943
 
13942
13944
 
@@ -14840,11 +14842,9 @@ exports.getProjectPath = getProjectPath;
14840
14842
  exports.findSettings = findSettings;
14841
14843
  exports.validateSettings = validateSettings;
14842
14844
  exports.loadSettings = loadSettings;
14843
- exports.loadRelaxedSettings = loadRelaxedSettings;
14844
14845
  const node_path_1 = __importDefault(__webpack_require__(76760));
14845
14846
  const file_ts_1 = __webpack_require__(57452);
14846
14847
  const path_ts_1 = __webpack_require__(89213);
14847
- const logger_ts_1 = __webpack_require__(87562);
14848
14848
  const SHAREDEV_RELATIVE_PATH = node_path_1.default.join('.sharedev');
14849
14849
  const SETTINGS_NAME = 'settings.json';
14850
14850
  function isValidUrl(value) {
@@ -14877,10 +14877,7 @@ async function findSharedevPath(startDir) {
14877
14877
  let currentDir = node_path_1.default.resolve(startDir);
14878
14878
  while (true) {
14879
14879
  const candidate = node_path_1.default.join(currentDir, SHAREDEV_RELATIVE_PATH);
14880
- // .sharedev 目录必须包含 settings.json 才算已初始化的工作区:
14881
- // 只存在 .sharedev 目录(如家目录的文档/快照残留)时继续向上查找,
14882
- // 避免误命中导致 settings 读写与 init 落位跑到错误目录
14883
- if (await (0, file_ts_1.pathExists)(node_path_1.default.join(candidate, SETTINGS_NAME))) {
14880
+ if (await (0, file_ts_1.pathExists)(candidate)) {
14884
14881
  return candidate;
14885
14882
  }
14886
14883
  const parentDir = node_path_1.default.dirname(currentDir);
@@ -14905,8 +14902,9 @@ async function findSettings(startDir) {
14905
14902
  return node_path_1.default.join(sharedevPath, SETTINGS_NAME);
14906
14903
  }
14907
14904
  function validateSettings(settings) {
14908
- // certificate 允许为空(工作区可仅以 sharecrm 登录态运行);
14909
- // FHH 请求在 certificate 缺失时由通道层给出明确引导
14905
+ if (!settings.certificate?.trim()) {
14906
+ throw new Error('Missing certificate in .sharedev/settings.json.');
14907
+ }
14910
14908
  if (!settings.domain?.trim()) {
14911
14909
  throw new Error('Missing domain in .sharedev/settings.json.');
14912
14910
  }
@@ -14935,37 +14933,6 @@ async function loadSettings(startDir) {
14935
14933
  validateSettings(settings);
14936
14934
  return settings;
14937
14935
  }
14938
- /**
14939
- * 宽松读取 settings(不做 certificate/domain 校验),供「无 certificate + sharecrm 登录态」
14940
- * 的运行模式兜底使用:settings.json 缺失时返回空字段形态,存在时尽量保留 domain 等信息
14941
- * (环境一致性校验仍依赖 domain)。
14942
- */
14943
- async function loadRelaxedSettings(startDir, fallbackDir) {
14944
- const settingsPath = await findSettings(startDir);
14945
- let rawSettings = {};
14946
- if (settingsPath) {
14947
- try {
14948
- rawSettings = await (0, file_ts_1.readJsonFile)(settingsPath);
14949
- }
14950
- catch (error) {
14951
- // 文件不存在(.sharedev 目录在但 settings.json 没有)是正常的登录态模式场景,静默跳过;
14952
- // 文件存在但解析失败则必须警告——静默会丢失 domain 等工作区环境信息
14953
- if (error.code !== 'ENOENT') {
14954
- logger_ts_1.loggerService.warn(`Failed to parse ${settingsPath} (${error instanceof Error ? error.message : String(error)}). ` +
14955
- 'Running with sharecrm login state only; fix the settings file to restore environment checks.');
14956
- }
14957
- }
14958
- }
14959
- return {
14960
- certificate: typeof rawSettings.certificate === 'string' ? rawSettings.certificate : '',
14961
- domain: typeof rawSettings.domain === 'string' ? rawSettings.domain : '',
14962
- developerName: typeof rawSettings.developerName === 'string' ? rawSettings.developerName : '',
14963
- developerMobile: typeof rawSettings.developerMobile === 'string' ? rawSettings.developerMobile : '',
14964
- specVersion: typeof rawSettings.specVersion === 'string' ? rawSettings.specVersion : '',
14965
- settingsPath: settingsPath ?? '',
14966
- settingsDir: settingsPath ? node_path_1.default.dirname(settingsPath) : fallbackDir
14967
- };
14968
- }
14969
14936
 
14970
14937
 
14971
14938
  /***/ },
@@ -14979,28 +14946,11 @@ __webpack_unused_export__ = ({ value: true });
14979
14946
  exports.createCliRuntimeContext = createCliRuntimeContext;
14980
14947
  const config_ts_1 = __webpack_require__(43120);
14981
14948
  const logger_ts_1 = __webpack_require__(87562);
14982
- const sharecrm_session_ts_1 = __webpack_require__(47166);
14983
14949
  const path_ts_1 = __webpack_require__(89213);
14984
14950
  async function createCliRuntimeContext(_options) {
14985
14951
  const cwd = process.cwd();
14986
14952
  const searchDir = await (0, config_ts_1.resolveSettingsSearchDir)(undefined, cwd);
14987
- let settings;
14988
- try {
14989
- settings = await (0, config_ts_1.loadSettings)(searchDir);
14990
- }
14991
- catch (error) {
14992
- // settings 文件缺失或内容损坏时,工作区内存在登录凭证(.sharedev/session.json)则降级为
14993
- // 「登录态模式」继续运行(certificate 可为空,业务请求走 open API 通道)。
14994
- // 此时 configureSharecrmSession 尚未注入,直接按 .sharedev 目录读取凭证文件。
14995
- const sharedevDir = await (0, config_ts_1.findSharedevPath)(searchDir);
14996
- const session = sharedevDir ? (0, sharecrm_session_ts_1.readSharedevAuthSession)(sharedevDir) : null;
14997
- if (!session?.accessToken) {
14998
- const message = error instanceof Error ? error.message : String(error);
14999
- throw new Error(`${message}\nRun \`sharedev init\` to initialize a workspace first, then \`sharedev auth login\`.`);
15000
- }
15001
- settings = await (0, config_ts_1.loadRelaxedSettings)(searchDir, cwd);
15002
- logger_ts_1.loggerService.info('No valid certificate configured; running with sharecrm login state.');
15003
- }
14953
+ const settings = await (0, config_ts_1.loadSettings)(searchDir);
15004
14954
  logger_ts_1.loggerService.debug(`settingsPath = ${settings.settingsPath}`);
15005
14955
  logger_ts_1.loggerService.debug(`domain = ${settings.domain}`);
15006
14956
  logger_ts_1.loggerService.debug(`certificate = ${(0, path_ts_1.maskCertificate)(settings.certificate)}`);
@@ -15851,126 +15801,6 @@ const fetchLatestNpmVersion = (packageName, timeoutMs = 1500) => new Promise((re
15851
15801
  exports.fetchLatestNpmVersion = fetchLatestNpmVersion;
15852
15802
 
15853
15803
 
15854
- /***/ },
15855
-
15856
- /***/ 59848
15857
- (__unused_webpack_module, exports, __webpack_require__) {
15858
-
15859
-
15860
- var __importDefault = (this && this.__importDefault) || function (mod) {
15861
- return (mod && mod.__esModule) ? mod : { "default": mod };
15862
- };
15863
- Object.defineProperty(exports, "__esModule", ({ value: true }));
15864
- exports.OpenApiCommandError = void 0;
15865
- exports.executeOpenApiCommand = executeOpenApiCommand;
15866
- const node_crypto_1 = __webpack_require__(77598);
15867
- const logger_ts_1 = __webpack_require__(87562);
15868
- const sharecrm_session_ts_1 = __webpack_require__(47166);
15869
- const normalize_ts_1 = __importDefault(__webpack_require__(80399));
15870
- const pkgMeta_ts_1 = __webpack_require__(48559);
15871
- const isDebugEnabled_ts_1 = __webpack_require__(27570);
15872
- /**
15873
- * 操作中心 Open API 网关客户端。
15874
- *
15875
- * 与 FHH 网关(request.ts,certificate 鉴权)平行:本通道走
15876
- * `POST {apiUrl}/api/v1/commands/execute`,鉴权为 sharecrm 登录的
15877
- * `Authorization: Bearer <FSDTK token>`。两网关票据不通用,命令注册以
15878
- * docs/action-centre-integration.md 的实测记录为准(注意 code-dev function 新命名)。
15879
- */
15880
- class OpenApiCommandError extends Error {
15881
- constructor(message, resultCode, detail, traceId) {
15882
- super(message);
15883
- this.name = 'OpenApiCommandError';
15884
- this.resultCode = resultCode;
15885
- this.detail = detail;
15886
- this.traceId = traceId;
15887
- }
15888
- }
15889
- exports.OpenApiCommandError = OpenApiCommandError;
15890
- function toExecuteUrl(apiUrl) {
15891
- if (!apiUrl) {
15892
- throw new Error('Login session is missing apiUrl. Run `sharedev auth login` again.');
15893
- }
15894
- return `${apiUrl.replace(/\/+$/, '')}/api/v1/commands/execute`;
15895
- }
15896
- async function buildCommandHeaders(session) {
15897
- const locale = normalize_ts_1.default.normalizeAcceptLanguage(process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG);
15898
- const { version } = await (0, pkgMeta_ts_1.readCliPackageMeta)();
15899
- return {
15900
- 'Content-Type': 'application/json',
15901
- Authorization: `Bearer ${session.accessToken}`,
15902
- 'X-CLI-Id': 'sharedev-cli',
15903
- 'X-CLI-Version': version || '0.0.0',
15904
- 'X-Caller-Type': 'cli',
15905
- 'X-Request-Id': (0, node_crypto_1.randomUUID)(),
15906
- 'Accept-Language': locale ?? 'en-US',
15907
- 'X-FS-Locale': locale ?? 'en-US'
15908
- };
15909
- }
15910
- async function executeOnce(session, commandKey, args, flags) {
15911
- const response = await fetch(toExecuteUrl(session.apiUrl), {
15912
- method: 'POST',
15913
- headers: await buildCommandHeaders(session),
15914
- body: JSON.stringify({
15915
- commandKey,
15916
- arguments: args ?? {},
15917
- ...(flags?.length ? { flags } : {})
15918
- })
15919
- });
15920
- let payload;
15921
- try {
15922
- payload = (await response.json());
15923
- }
15924
- catch {
15925
- throw new OpenApiCommandError(`Open API command failed: HTTP ${response.status} ${response.statusText}`, `HTTP_${response.status}`);
15926
- }
15927
- if ((0, isDebugEnabled_ts_1.isRuntimeDebugEnabled)()) {
15928
- const dataPreview = typeof payload.data === 'string'
15929
- ? payload.data.slice(0, 200)
15930
- : JSON.stringify(payload.data ?? null)?.slice(0, 200);
15931
- logger_ts_1.loggerService.debug(`Open API response: ${commandKey} -> ${payload.resultCode ?? 'UNKNOWN'} ${dataPreview ?? ''}`);
15932
- }
15933
- if (payload.traceId) {
15934
- logger_ts_1.loggerService.addTraceId(payload.traceId);
15935
- }
15936
- if (payload.resultCode === 'SUCCESS') {
15937
- if (payload.helpInfoReturned === true) {
15938
- const usage = payload.data && typeof payload.data === 'object'
15939
- ? payload.data.usage
15940
- : undefined;
15941
- throw new OpenApiCommandError(`Open API command "${commandKey}" was not executed: missing required arguments.${usage ? `\nUsage: ${usage}` : ''}`, 'HELP_INFO_RETURNED');
15942
- }
15943
- // 外层信封中 traceId 已在上方消费、helpInfoReturned 已转错误,
15944
- // 对调用方有价值的只剩 content——统一在此剥出,调用方直接拿业务数据
15945
- const envelope = payload.data;
15946
- return (typeof envelope === 'object' && envelope !== null ? envelope.content : undefined);
15947
- }
15948
- const detail = typeof payload.data === 'string' ? payload.data : JSON.stringify(payload.data ?? '');
15949
- throw new OpenApiCommandError(`Open API command "${commandKey}" failed: ${payload.resultCode ?? 'UNKNOWN'}${detail ? ` ${detail}` : ''}`, payload.resultCode ?? 'UNKNOWN', detail || undefined, payload.traceId);
15950
- }
15951
- /**
15952
- * 执行操作中心 Open API 命令,返回解包后的 content(外层信封已统一处理)。
15953
- *
15954
- * 未登录抛错引导 `sharedev auth login`;token 过期自动刷新;
15955
- * 服务端返回 AUTH_FAIL 时刷新一次后重试(服务端会话失效场景)。
15956
- * flags 用于透传确认标记等命令行语义(如 NEED_CONFIRM 的 --yes)。
15957
- */
15958
- async function executeOpenApiCommand(commandKey, args = {}, options) {
15959
- const session = await (0, sharecrm_session_ts_1.ensureValidSharedevAuthSession)();
15960
- try {
15961
- return await executeOnce(session, commandKey, args, options?.flags);
15962
- }
15963
- catch (error) {
15964
- if (error instanceof OpenApiCommandError && error.resultCode === 'AUTH_FAIL') {
15965
- const refreshed = await (0, sharecrm_session_ts_1.refreshSharecrmSession)(session);
15966
- (0, sharecrm_session_ts_1.saveSharedevAuthSession)(refreshed);
15967
- return await executeOnce(refreshed, commandKey, args, options?.flags);
15968
- }
15969
- throw error;
15970
- }
15971
- }
15972
-
15973
-
15974
15804
  /***/ },
15975
15805
 
15976
15806
  /***/ 2067
@@ -16253,47 +16083,6 @@ class PassthroughCommandBuilder {
16253
16083
  __webpack_unused_export__ = PassthroughCommandBuilder;
16254
16084
 
16255
16085
 
16256
- /***/ },
16257
-
16258
- /***/ 43355
16259
- (__unused_webpack_module, exports, __webpack_require__) {
16260
-
16261
- var __webpack_unused_export__;
16262
-
16263
- __webpack_unused_export__ = ({ value: true });
16264
- exports.configureRequestChannel = configureRequestChannel;
16265
- exports.resolveRequestChannel = resolveRequestChannel;
16266
- exports.hasCertificateCredential = hasCertificateCredential;
16267
- const logger_ts_1 = __webpack_require__(87562);
16268
- const sharecrm_session_ts_1 = __webpack_require__(47166);
16269
- let currentSettings;
16270
- /** bootstrap 时注入运行时 settings(与 requestService.configure 同位置调用一次) */
16271
- function configureRequestChannel(settings) {
16272
- currentSettings = settings;
16273
- }
16274
- /** 解析当前应使用的请求通道;双登录态并存时登录态优先 */
16275
- function resolveRequestChannel() {
16276
- const session = (0, sharecrm_session_ts_1.readSharedevAuthSession)();
16277
- if (session?.accessToken) {
16278
- logger_ts_1.loggerService.debug('Request channel: openapi (sharecrm login).');
16279
- return 'openapi';
16280
- }
16281
- if (currentSettings?.certificate?.trim()) {
16282
- logger_ts_1.loggerService.debug('Request channel: fhh (certificate).');
16283
- return 'fhh';
16284
- }
16285
- throw new Error('No credentials available. Run `sharedev auth login`, or configure certificate/domain in .sharedev/settings.json.');
16286
- }
16287
- /**
16288
- * 是否存在可用的 certificate 凭证(与 resolveRequestChannel 的判定一致)。
16289
- * 供个别命令在 openapi 能力未就绪期间做局部降级:登录态优先的原则管「能力对等时的选择」,
16290
- * 能力缺失时(如 PWC download-file 未就绪)允许回退 certificate,避免功能回退。
16291
- */
16292
- function hasCertificateCredential() {
16293
- return Boolean(currentSettings?.certificate?.trim());
16294
- }
16295
-
16296
-
16297
16086
  /***/ },
16298
16087
 
16299
16088
  /***/ 23634
@@ -16725,46 +16514,11 @@ __webpack_unused_export__ = ({ value: true });
16725
16514
  exports.y = void 0;
16726
16515
  exports.executeShareCliCommand = executeShareCliCommand;
16727
16516
  const request_ts_1 = __webpack_require__(83733);
16728
- const request_channel_ts_1 = __webpack_require__(43355);
16729
- const openapi_request_ts_1 = __webpack_require__(59848);
16730
16517
  const trace_ts_1 = __webpack_require__(36097);
16731
16518
  /** 操作中心 shareCli/execute 的业务方标识 */
16732
16519
  exports.y = 'sharedev-cli';
16733
- /**
16734
- * open API 侧 code-dev 命名空间迁移:apl → function(子命令同名,2026-10-21 实测)。
16735
- * list 例外:open API 未注册 code-dev function list,等价能力为 object-dev function query。
16736
- */
16737
- function toOpenApiCommandPath(commandPath) {
16738
- if (commandPath.length >= 3 && commandPath[0] === 'code-dev' && commandPath[1] === 'apl') {
16739
- if (commandPath[2] === 'list') {
16740
- throw new Error('Command "code-dev apl list" is not registered on the Open API gateway; the equivalent is "object-dev function query".');
16741
- }
16742
- return ['code-dev', 'function', ...commandPath.slice(2)];
16743
- }
16744
- return commandPath;
16745
- }
16746
- /**
16747
- * 执行操作中心命令(透传族统一入口)。
16748
- *
16749
- * 双通道(二期):sharecrm 登录态 → open API `commands/execute`(commandKey = commandPath 空格连接,
16750
- * code-dev apl * 自动映射为迁移后的 function 命名空间);
16751
- * certificate → FHH `shareCli/execute`(现状不动)。响应统一适配为 ShareCliExecuteResponse
16752
- * 形态({success, code, message, data}),上层 PassthroughCommandManager 无感。
16753
- */
16754
16520
  async function executeShareCliCommand(commandPath, data, others) {
16755
16521
  (0, trace_ts_1.traceExecute)(commandPath.join(' '));
16756
- const channel = (0, request_channel_ts_1.resolveRequestChannel)();
16757
- if (channel === 'openapi') {
16758
- // open API 侧确认协议:flags 形式(sharecrm 同款);agentChannels 为 FHH 侧统计标记,暂无对应物
16759
- const flags = others?.yes === true ? ['--yes'] : undefined;
16760
- const commandKey = toOpenApiCommandPath(commandPath).join(' ');
16761
- const content = await (0, openapi_request_ts_1.executeOpenApiCommand)(commandKey, data ?? {}, flags ? { flags } : undefined);
16762
- return {
16763
- success: true,
16764
- code: 'OK',
16765
- data: content
16766
- };
16767
- }
16768
16522
  const payload = {
16769
16523
  commandPath,
16770
16524
  // 所有 sharedev 发起的操作中心请求统一携带 agentChannels,服务端按 Agent 渠道路由/统计
@@ -17125,231 +16879,6 @@ class RequestService {
17125
16879
  exports.requestService = new RequestService();
17126
16880
 
17127
16881
 
17128
- /***/ },
17129
-
17130
- /***/ 47166
17131
- (__unused_webpack_module, exports, __webpack_require__) {
17132
-
17133
-
17134
- var __importDefault = (this && this.__importDefault) || function (mod) {
17135
- return (mod && mod.__esModule) ? mod : { "default": mod };
17136
- };
17137
- Object.defineProperty(exports, "__esModule", ({ value: true }));
17138
- exports.DOMAIN_HOST_TO_LOGIN_ENV = void 0;
17139
- exports.configureSharecrmSession = configureSharecrmSession;
17140
- exports.getRuntimeRequire = getRuntimeRequire;
17141
- exports.readSharecrmSession = readSharecrmSession;
17142
- exports.saveSharedevAuthSession = saveSharedevAuthSession;
17143
- exports.readSharedevAuthSession = readSharedevAuthSession;
17144
- exports.clearSharedevAuthSession = clearSharedevAuthSession;
17145
- exports.isSessionExpired = isSessionExpired;
17146
- exports.refreshSharecrmSession = refreshSharecrmSession;
17147
- exports.ensureValidSharedevAuthSession = ensureValidSharedevAuthSession;
17148
- exports.readSharecrmConfig = readSharecrmConfig;
17149
- const node_module_1 = __webpack_require__(98995);
17150
- const node_fs_1 = __importDefault(__webpack_require__(73024));
17151
- const node_os_1 = __importDefault(__webpack_require__(48161));
17152
- const node_path_1 = __importDefault(__webpack_require__(76760));
17153
- /**
17154
- * 工作区企业 domain → 登录环境(open API 网关)映射(环境域知识的唯一登记处)。
17155
- * 登录环境继承 init 配置的工作区环境(无交互选择)。
17156
- * 新增环境(香港/国际等)在此登记即可。
17157
- */
17158
- exports.DOMAIN_HOST_TO_LOGIN_ENV = {
17159
- 'www.fxiaoke.com': { authBaseUrl: 'https://open.fxiaoke.com/', apiBaseUrl: 'https://open.fxiaoke.com/cli/' },
17160
- 'crm.ceshi112.com': { authBaseUrl: 'https://open.ceshi112.com/', apiBaseUrl: 'https://open.ceshi112.com/cli/' }
17161
- };
17162
- const SESSION_FILE_NAME = 'session.json';
17163
- const GITIGNORE_ENTRY = '.sharedev/session.json';
17164
- /** 由 bootstrap 注入的工作区 .sharedev 目录;skipSettings 分支(--help 等)不会注入 */
17165
- let currentSharedevDir;
17166
- /** bootstrap 时注入工作区 settings(与 requestService.configure 同位置调用一次) */
17167
- function configureSharecrmSession(settings) {
17168
- currentSharedevDir = settings.settingsDir;
17169
- }
17170
- function resolveSessionFile(sharedevDir) {
17171
- const dir = sharedevDir ?? currentSharedevDir;
17172
- return dir ? node_path_1.default.join(dir, SESSION_FILE_NAME) : undefined;
17173
- }
17174
- /** 登录态写入 .sharedev/session.json 时确保工作区 .gitignore 覆盖该敏感文件(失败不阻断登录) */
17175
- function ensureGitignoreEntry() {
17176
- if (!currentSharedevDir) {
17177
- return;
17178
- }
17179
- const workspaceRoot = node_path_1.default.dirname(currentSharedevDir);
17180
- const gitignorePath = node_path_1.default.join(workspaceRoot, '.gitignore');
17181
- try {
17182
- let content = '';
17183
- try {
17184
- content = node_fs_1.default.readFileSync(gitignorePath, 'utf8');
17185
- }
17186
- catch {
17187
- // .gitignore 不存在,直接创建
17188
- }
17189
- const covered = content.split('\n').some((line) => line.trim() === GITIGNORE_ENTRY);
17190
- if (!covered) {
17191
- const prefix = content && !content.endsWith('\n') ? '\n' : '';
17192
- node_fs_1.default.appendFileSync(gitignorePath, `${prefix}${GITIGNORE_ENTRY}\n`);
17193
- }
17194
- }
17195
- catch {
17196
- // .gitignore 追加失败不阻断登录流程
17197
- }
17198
- }
17199
- // createRequire(import.meta.url) 会被 webpack 静态求值为构建机的绝对源码路径,发布后失效;
17200
- // 与 pwc beefly 加载一致:以运行时入口(bin/cli.mjs / dist/sharedev.js,即 process.argv[1])
17201
- // 做解析基准,从 CLI 自身安装位置向上命中包内 node_modules 的 @share-crm/sharecrm-cli。
17202
- // npm link 场景下 argv[1] 是全局 bin 的 symlink,Node 解析不穿透 symlink,字面路径向上
17203
- // 找不到 node_modules,必须先 realpath 回真实安装位置再解析。
17204
- function getRuntimeRequire() {
17205
- const entry = process.argv[1] ?? process.cwd();
17206
- try {
17207
- return (0, node_module_1.createRequire)(node_fs_1.default.realpathSync(entry));
17208
- }
17209
- catch {
17210
- return (0, node_module_1.createRequire)(entry);
17211
- }
17212
- }
17213
- function loadAuthSessionStoreModule() {
17214
- const require = getRuntimeRequire();
17215
- return require('@share-crm/sharecrm-cli/dist/core/state/authSessionStore.js');
17216
- }
17217
- /** 读取 sharecrm 当前登录会话(login 中转用);未登录返回 null;依赖缺失/结构变化抛出可读错误 */
17218
- async function readSharecrmSession() {
17219
- let module;
17220
- try {
17221
- module = loadAuthSessionStoreModule();
17222
- }
17223
- catch {
17224
- throw new Error('Failed to load @share-crm/sharecrm-cli. Reinstall sharedev dependencies and try again.');
17225
- }
17226
- if (!module || typeof module.AuthSessionStore !== 'function') {
17227
- throw new Error('Incompatible @share-crm/sharecrm-cli detected (AuthSessionStore missing). Upgrade sharedev or @share-crm/sharecrm-cli.');
17228
- }
17229
- try {
17230
- return await new module.AuthSessionStore().load();
17231
- }
17232
- catch (error) {
17233
- // AuthSessionStore.load() 在未登录时返回 null 而不抛错;
17234
- // 走到这里意味着本地会话存储读取失败(钥匙串被拒 / 文件损坏等),
17235
- // 不是未登录——原样抛出,避免误导用户重新 login。
17236
- throw new Error(`Failed to read sharecrm session store: ${error instanceof Error ? error.message : String(error)}`);
17237
- }
17238
- }
17239
- function saveSharedevAuthSession(session) {
17240
- const sessionFile = resolveSessionFile();
17241
- if (!sessionFile) {
17242
- throw new Error('Workspace context is not configured. Run this command inside a sharedev workspace.');
17243
- }
17244
- ensureGitignoreEntry();
17245
- node_fs_1.default.writeFileSync(sessionFile, JSON.stringify(session, null, 2), { mode: 0o600 });
17246
- }
17247
- function readSharedevAuthSession(sharedevDir) {
17248
- const sessionFile = resolveSessionFile(sharedevDir);
17249
- if (!sessionFile) {
17250
- return null;
17251
- }
17252
- try {
17253
- const session = JSON.parse(node_fs_1.default.readFileSync(sessionFile, 'utf8'));
17254
- return session && typeof session.accessToken === 'string' && session.accessToken ? session : null;
17255
- }
17256
- catch {
17257
- return null;
17258
- }
17259
- }
17260
- /** 只清当前工作区的登录凭证,不影响 sharecrm 自己的登录态 */
17261
- function clearSharedevAuthSession() {
17262
- const sessionFile = resolveSessionFile();
17263
- if (!sessionFile) {
17264
- return;
17265
- }
17266
- try {
17267
- node_fs_1.default.rmSync(sessionFile, { force: true });
17268
- }
17269
- catch {
17270
- // ignore
17271
- }
17272
- }
17273
- function isSessionExpired(session) {
17274
- return !session.tokenExpireAt || session.tokenExpireAt <= Date.now();
17275
- }
17276
- /** authBaseUrl 由登录下发的 apiUrl 推导(https://open.fxiaoke.com/cli/ -> https://open.fxiaoke.com/);缺失即凭证异常 */
17277
- function deriveAuthBaseUrl(apiUrl) {
17278
- if (!apiUrl) {
17279
- throw new Error('Login session is missing apiUrl. Run `sharedev auth login` again.');
17280
- }
17281
- try {
17282
- return `${new URL(apiUrl).origin}/`;
17283
- }
17284
- catch {
17285
- throw new Error(`Invalid apiUrl in login session: ${apiUrl}. Run \`sharedev auth login\` again.`);
17286
- }
17287
- }
17288
- /**
17289
- * 用 refreshToken 刷新 accessToken(与 sharecrm 的 /oauth2.0/token 契约一致)。
17290
- * 成功返回新会话(不落盘,由调用方决定是否保存),失败抛出带重登指引的错误。
17291
- */
17292
- async function refreshSharecrmSession(session) {
17293
- const response = await fetch(new URL('oauth2.0/token', deriveAuthBaseUrl(session.apiUrl)), {
17294
- method: 'POST',
17295
- headers: { 'Content-Type': 'application/json' },
17296
- body: JSON.stringify({
17297
- appId: session.appId,
17298
- grantType: 'refresh_token',
17299
- refreshToken: session.refreshToken
17300
- })
17301
- });
17302
- let payload;
17303
- try {
17304
- payload = (await response.json());
17305
- }
17306
- catch {
17307
- throw new Error(`sharecrm token refresh failed (HTTP ${response.status}). Run \`sharedev auth login\` again.`);
17308
- }
17309
- if (payload.errorCode !== 0 || !payload.accessToken) {
17310
- throw new Error(`sharecrm token refresh failed: ${payload.errorMessage ?? `errorCode ${payload.errorCode}`}. Run \`sharedev auth login\` again.`);
17311
- }
17312
- // OAuth 刷新响应允许不回发新 refreshToken(沿用旧值,sharecrm 同款行为);
17313
- // expiresIn 是计算过期时间的必要输入,缺失即报错
17314
- if (typeof payload.expiresIn !== 'number' || !Number.isFinite(payload.expiresIn) || payload.expiresIn <= 0) {
17315
- throw new Error('sharecrm token refresh response is missing expiresIn. Run `sharedev auth login` again.');
17316
- }
17317
- return {
17318
- ...session,
17319
- accessToken: payload.accessToken,
17320
- refreshToken: payload.refreshToken ?? session.refreshToken,
17321
- tokenExpireAt: Date.now() + payload.expiresIn * 1000
17322
- };
17323
- }
17324
- /** 读取工作区登录凭证并保证可用:过期时自动刷新并回写工作区文件 */
17325
- async function ensureValidSharedevAuthSession() {
17326
- const session = readSharedevAuthSession();
17327
- if (!session) {
17328
- throw new Error('Not logged in. Run `sharedev auth login` first.');
17329
- }
17330
- if (!isSessionExpired(session)) {
17331
- return session;
17332
- }
17333
- const refreshed = await refreshSharecrmSession(session);
17334
- saveSharedevAuthSession(refreshed);
17335
- return refreshed;
17336
- }
17337
- /**
17338
- * 读取 sharecrm 全局 config(login 前的环境冲突检测用:config 优先级高于环境变量注入,
17339
- * 用户在 sharecrm 侧固定过环境时,sharedev 的环境注入会被压制)。
17340
- */
17341
- function readSharecrmConfig() {
17342
- const configPath = node_path_1.default.join(node_os_1.default.homedir(), '.sharecrm-cli', 'config.json');
17343
- try {
17344
- const config = JSON.parse(node_fs_1.default.readFileSync(configPath, 'utf8'));
17345
- return config && typeof config === 'object' ? config : {};
17346
- }
17347
- catch {
17348
- return {};
17349
- }
17350
- }
17351
-
17352
-
17353
16882
  /***/ },
17354
16883
 
17355
16884
  /***/ 36097
@@ -19458,47 +18987,7 @@ exports.createAplTemplate = createAplTemplate;
19458
18987
  exports.createFuncSource = createFuncSource;
19459
18988
  const node_crypto_1 = __webpack_require__(77598);
19460
18989
  const request_ts_1 = __webpack_require__(83733);
19461
- const openapi_request_ts_1 = __webpack_require__(59848);
19462
- const request_channel_ts_1 = __webpack_require__(43355);
19463
- /**
19464
- * open API 通道的函数列表查询(sharecrm 登录态时替代 FHH biz/query)。
19465
- * 参数形态 2026-10-21 实测:分页为字符串,name_space 为数组,binding 过滤与 FHH 同名。
19466
- */
19467
- async function getFuncListViaOpenApi(options) {
19468
- const args = { pageNumber: '1', pageSize: '3000' };
19469
- const bind = options.bind?.trim();
19470
- if (bind) {
19471
- args.binding_object_api_name = bind;
19472
- }
19473
- const space = options.space?.trim();
19474
- if (space) {
19475
- args.name_space = [space];
19476
- }
19477
- const content = await (0, openapi_request_ts_1.executeOpenApiCommand)('object-dev function query', args);
19478
- return content?.result?.function ?? [];
19479
- }
19480
- /**
19481
- * open API 通道的单函数详情(sharecrm 登录态时替代 FHH biz/find / batchQuery)。
19482
- * 响应含完整函数体(body 源码),字段与 IFuncData 同构(2026-10-21 实测)。
19483
- */
19484
- async function findFuncByApiNameViaOpenApi(apiName, bindingObjectApiName) {
19485
- const content = await (0, openapi_request_ts_1.executeOpenApiCommand)('code-dev function get-by-apiname-and-binding-object-apiname', {
19486
- api_name: apiName,
19487
- ...(bindingObjectApiName ? { binding_object_api_name: bindingObjectApiName } : {})
19488
- });
19489
- if (content?.errCode && content.errCode !== 0) {
19490
- throw new Error(content.errMessage || `APL function lookup failed (errCode ${content.errCode}): ${apiName}`);
19491
- }
19492
- const func = content?.result?.function;
19493
- if (!func) {
19494
- throw new Error(`APL function not found: ${apiName}`);
19495
- }
19496
- return func;
19497
- }
19498
18990
  async function getFuncList(options = {}) {
19499
- if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
19500
- return getFuncListViaOpenApi(options);
19501
- }
19502
18991
  const bindingObjectApiName = options.bind?.trim();
19503
18992
  const nameSpace = options.space?.trim();
19504
18993
  const data = {
@@ -19517,19 +19006,7 @@ async function getFuncList(options = {}) {
19517
19006
  });
19518
19007
  return response.function ?? [];
19519
19008
  }
19520
- /**
19521
- * open API 通道的批量函数查询(sharecrm 登录态时替代 FHH biz/batchQuery)。
19522
- * 响应结构 2026-10-21 实测:content.function 直接为数组(无 result 嵌套,
19523
- * 与 get-by-apiname-and-binding-object-apiname 的 {result:{function}} 不同形)。
19524
- */
19525
- async function findFuncByApiNamesViaOpenApi(apiNames) {
19526
- const content = await (0, openapi_request_ts_1.executeOpenApiCommand)('code-dev function query-by-apinames', { apiNames });
19527
- return content?.function ?? [];
19528
- }
19529
19009
  async function findFuncByApiNames(apiNames) {
19530
- if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
19531
- return findFuncByApiNamesViaOpenApi(apiNames);
19532
- }
19533
19010
  const response = await request_ts_1.requestService.FHH({
19534
19011
  url: '/EM1HFUNC/biz/batchQuery',
19535
19012
  data: {
@@ -19539,9 +19016,6 @@ async function findFuncByApiNames(apiNames) {
19539
19016
  return response.function;
19540
19017
  }
19541
19018
  async function findFuncByApiName(apiName, bindingObjectApiName = '') {
19542
- if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
19543
- return findFuncByApiNameViaOpenApi(apiName, bindingObjectApiName);
19544
- }
19545
19019
  if (bindingObjectApiName) {
19546
19020
  const response = await request_ts_1.requestService.FHH({
19547
19021
  url: '/EM1HFUNC/biz/find',
@@ -21828,39 +21302,13 @@ var __webpack_unused_export__;
21828
21302
  __webpack_unused_export__ = ({ value: true });
21829
21303
  exports.aplListNewService = aplListNewService;
21830
21304
  const request_execute_command_paths_ts_1 = __webpack_require__(23634);
21831
- const openapi_request_ts_1 = __webpack_require__(59848);
21832
- const request_channel_ts_1 = __webpack_require__(43355);
21833
- const logger_ts_1 = __webpack_require__(87562);
21834
21305
  const types_ts_1 = __webpack_require__(42801);
21835
21306
  const request_ts_1 = __webpack_require__(25285);
21836
- /**
21837
- * open API 通道的 list-new 查询:open API 未注册 code-dev function list,
21838
- * 等价能力为 object-dev function query(过滤参数同名,2026-10-21 实测);
21839
- * 响应包成 AplResponse 兼容信封,下游解析逻辑零改动。
21840
- *
21841
- * ⚠️ body / selectFieldName 为 FHH 老链路参数,object-dev function query 不支持
21842
- * (2026-10-21 实测:传入后被服务端静默忽略、过滤不生效),显式剔除并提示用户。
21843
- */
21844
- const requestAplListViaOpenApi = async (filters) => {
21845
- const { body, selectFieldName, ...supported } = filters;
21846
- if (body !== undefined || selectFieldName !== undefined) {
21847
- logger_ts_1.loggerService.warn('Filters "body" and "selectFieldName" are not supported on the sharecrm login channel and were ignored.');
21848
- }
21849
- const content = await (0, openapi_request_ts_1.executeOpenApiCommand)('object-dev function query', supported);
21850
- return {
21851
- success: true,
21852
- code: 'OK',
21853
- data: { result: { function: content?.result?.function ?? [] } },
21854
- };
21855
- };
21856
21307
  /**
21857
21308
  * 操作中心接口包装调用:apl list(分页查询函数列表)
21858
21309
  * pageNumber/pageSize 为必填(服务端要求字符串形态),其余为可选过滤条件
21859
21310
  */
21860
21311
  const requestAplListExecute = async (filters) => {
21861
- if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
21862
- return requestAplListViaOpenApi(filters);
21863
- }
21864
21312
  const data = {
21865
21313
  pageNumber: filters.pageNumber,
21866
21314
  pageSize: filters.pageSize
@@ -25919,150 +25367,6 @@ async function executeApprovalRuntimeShareCli(commandPath, data, others) {
25919
25367
  }
25920
25368
 
25921
25369
 
25922
- /***/ },
25923
-
25924
- /***/ 52402
25925
- (__unused_webpack_module, exports, __webpack_require__) {
25926
-
25927
-
25928
- var __importDefault = (this && this.__importDefault) || function (mod) {
25929
- return (mod && mod.__esModule) ? mod : { "default": mod };
25930
- };
25931
- Object.defineProperty(exports, "__esModule", ({ value: true }));
25932
- exports.authLoginCommand = authLoginCommand;
25933
- exports.authStatusCommand = authStatusCommand;
25934
- exports.authLogoutCommand = authLogoutCommand;
25935
- const node_child_process_1 = __webpack_require__(31421);
25936
- const node_path_1 = __importDefault(__webpack_require__(76760));
25937
- const logger_ts_1 = __webpack_require__(87562);
25938
- const openapi_request_ts_1 = __webpack_require__(59848);
25939
- const sharecrm_session_ts_1 = __webpack_require__(47166);
25940
- /** 解析依赖包 @share-crm/sharecrm-cli 的 bin 入口(不走 PATH / 全局安装) */
25941
- function resolveSharecrmBinEntry() {
25942
- const require = (0, sharecrm_session_ts_1.getRuntimeRequire)();
25943
- const packageJsonPath = require.resolve('@share-crm/sharecrm-cli/package.json');
25944
- return node_path_1.default.join(node_path_1.default.dirname(packageJsonPath), 'dist', 'index.js');
25945
- }
25946
- /** 从工作区 domain 推导登录环境;未知 domain 报错并列出受支持的环境 */
25947
- function deriveLoginEnvFromDomain(domain) {
25948
- let host;
25949
- try {
25950
- host = new URL(domain).hostname;
25951
- }
25952
- catch {
25953
- throw new Error(`Invalid workspace domain: ${domain}. Fix it in .sharedev/settings.json or run \`sharedev init\`.`);
25954
- }
25955
- const loginEnv = sharecrm_session_ts_1.DOMAIN_HOST_TO_LOGIN_ENV[host];
25956
- if (!loginEnv) {
25957
- const supported = Object.keys(sharecrm_session_ts_1.DOMAIN_HOST_TO_LOGIN_ENV).join(', ');
25958
- throw new Error(`Workspace domain "${host}" has no known login environment mapping (supported: ${supported}). ` +
25959
- 'Ask the sharedev maintainers to add it, or switch the workspace domain.');
25960
- }
25961
- return loginEnv;
25962
- }
25963
- async function authLoginCommand(domain) {
25964
- const loginEnv = deriveLoginEnvFromDomain(domain);
25965
- // sharecrm 全局 config 优先级高于环境变量注入,固定过环境时会压制工作区推导——提前拦截
25966
- const sharecrmConfig = (0, sharecrm_session_ts_1.readSharecrmConfig)();
25967
- const pinned = sharecrmConfig.authBaseUrl?.trim();
25968
- if (pinned && pinned.replace(/\/+$/, '') !== loginEnv.authBaseUrl.replace(/\/+$/, '')) {
25969
- throw new Error(`sharecrm global config pins login environment to ${pinned}, conflicting with workspace (${loginEnv.authBaseUrl}). ` +
25970
- 'Remove authBaseUrl from ~/.sharecrm-cli/config.json or fix the workspace domain.');
25971
- }
25972
- let entry;
25973
- try {
25974
- entry = resolveSharecrmBinEntry();
25975
- }
25976
- catch {
25977
- throw new Error('Failed to locate @share-crm/sharecrm-cli. Reinstall sharedev dependencies and try again.');
25978
- }
25979
- logger_ts_1.loggerService.info(`Login environment (from workspace domain): ${loginEnv.authBaseUrl}`);
25980
- logger_ts_1.loggerService.info('Starting sharecrm device-flow login. Complete the authorization in your browser.');
25981
- // 环境通过环境变量注入子进程(优先级低于 sharecrm config,上面已检测冲突),不写 sharecrm 全局配置
25982
- const exitCode = await new Promise((resolve, reject) => {
25983
- const child = (0, node_child_process_1.spawn)(process.execPath, [entry, 'auth', 'share-dev-login'], {
25984
- stdio: 'inherit',
25985
- env: {
25986
- ...process.env,
25987
- FS_CLI_AUTH_BASE_URL: loginEnv.authBaseUrl,
25988
- FS_CLI_API_BASE_URL: loginEnv.apiBaseUrl
25989
- }
25990
- });
25991
- child.on('error', reject);
25992
- child.on('exit', (code) => resolve(code));
25993
- });
25994
- if (exitCode !== 0) {
25995
- throw new Error(`sharecrm auth share-dev-login exited with code ${exitCode ?? 'unknown'}.`);
25996
- }
25997
- const session = await (0, sharecrm_session_ts_1.readSharecrmSession)();
25998
- if (!session?.accessToken) {
25999
- throw new Error('sharecrm login finished but no session was stored. Run `sharedev auth login` again.');
26000
- }
26001
- // 中转完成:凭证固化到工作区(.sharedev/session.json,凭证跟工作区走)
26002
- (0, sharecrm_session_ts_1.saveSharedevAuthSession)(session);
26003
- logger_ts_1.loggerService.success(`Logged in as ${session.userName || `user ${session.userId}`} (appId ${session.appId}).`);
26004
- // 端到端验证 Open API 通道(只读查询;失败仅 warn,部分环境命令集较旧属已知限制)
26005
- try {
26006
- const result = await (0, openapi_request_ts_1.executeOpenApiCommand)('object-dev function query', {
26007
- pageNumber: '1',
26008
- pageSize: '1'
26009
- });
26010
- const total = result?.result?.totalNumber;
26011
- logger_ts_1.loggerService.success(`Open API channel verified${typeof total === 'number' ? `: ${total} functions visible` : ''}.`);
26012
- }
26013
- catch (error) {
26014
- logger_ts_1.loggerService.warn(`Open API channel verification failed: ${error instanceof Error ? error.message : String(error)}`);
26015
- }
26016
- }
26017
- function formatExpireTime(session) {
26018
- if (!session.tokenExpireAt) {
26019
- return 'unknown';
26020
- }
26021
- return new Date(session.tokenExpireAt).toLocaleString();
26022
- }
26023
- async function authStatusCommand(settings) {
26024
- const session = (0, sharecrm_session_ts_1.readSharedevAuthSession)();
26025
- logger_ts_1.loggerService.info(`Workspace environment: ${settings.domain}`);
26026
- if (!session) {
26027
- logger_ts_1.loggerService.info('sharecrm login: not logged in. Run `sharedev auth login`.');
26028
- }
26029
- else {
26030
- const expired = (0, sharecrm_session_ts_1.isSessionExpired)(session);
26031
- logger_ts_1.loggerService.info([
26032
- `sharecrm login: ${session.userName || `user ${session.userId}`} (appId ${session.appId})`,
26033
- ` apiUrl: ${session.apiUrl ?? 'https://open.fxiaoke.com/cli/'}`,
26034
- ` token : ${expired ? 'expired, will auto-refresh on next command' : `valid until ${formatExpireTime(session)}`}`
26035
- ].join('\n'));
26036
- }
26037
- // certificate 方式状态(老登录方式,配置在 .sharedev/settings.json;来自 bootstrap 加载的 settings)
26038
- if (settings.certificate?.trim()) {
26039
- logger_ts_1.loggerService.info(`certificate login: configured (${settings.settingsPath})`);
26040
- }
26041
- else {
26042
- logger_ts_1.loggerService.info('certificate login: not configured');
26043
- }
26044
- }
26045
- async function authLogoutCommand() {
26046
- (0, sharecrm_session_ts_1.clearSharedevAuthSession)();
26047
- logger_ts_1.loggerService.success('Workspace login state cleared (sharecrm own session is untouched).');
26048
- }
26049
-
26050
-
26051
- /***/ },
26052
-
26053
- /***/ 98695
26054
- (__unused_webpack_module, exports, __webpack_require__) {
26055
-
26056
- var __webpack_unused_export__;
26057
-
26058
- __webpack_unused_export__ = ({ value: true });
26059
- exports.authLogoutCommand = exports.authStatusCommand = exports.authLoginCommand = void 0;
26060
- var auth_command_ts_1 = __webpack_require__(52402);
26061
- Object.defineProperty(exports, "authLoginCommand", ({ enumerable: true, get: function () { return auth_command_ts_1.authLoginCommand; } }));
26062
- Object.defineProperty(exports, "authStatusCommand", ({ enumerable: true, get: function () { return auth_command_ts_1.authStatusCommand; } }));
26063
- Object.defineProperty(exports, "authLogoutCommand", ({ enumerable: true, get: function () { return auth_command_ts_1.authLogoutCommand; } }));
26064
-
26065
-
26066
25370
  /***/ },
26067
25371
 
26068
25372
  /***/ 73302
@@ -26153,7 +25457,33 @@ async function bpmDefUpdateDefinitionCommand(_context, options) {
26153
25457
  nameTranslateInfo: "object",
26154
25458
  descTranslateInfo: "object"
26155
25459
  };
26156
- const data = buildOptionsData(options, typeMap);
25460
+ const updates = buildOptionsData(options, typeMap);
25461
+ // 服务端为全量更新语义:必须先按 --id 拉取完整定义,再合并增量提交
25462
+ if (!updates.id) {
25463
+ throw new Error('bpm-dev update-definition requires --id to locate and load the full definition.');
25464
+ }
25465
+ const changedFields = Object.keys(updates).filter((key) => key !== 'id');
25466
+ if (changedFields.length === 0) {
25467
+ throw new Error('bpm-dev update-definition requires at least one field to update besides --id.');
25468
+ }
25469
+ logger_ts_1.loggerService.startLoading('Loading bpmDef detail for full definition');
25470
+ let outline;
25471
+ try {
25472
+ const detailResponse = await (0, bpm_def_service_ts_1.executeBpmDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('bpmDef', 'detail'), { id: updates.id });
25473
+ logger_ts_1.loggerService.stopLoading();
25474
+ const envelope = (detailResponse && typeof detailResponse === 'object')
25475
+ ? detailResponse
25476
+ : {};
25477
+ if (envelope.success !== true || !envelope.data?.outline) {
25478
+ throw new Error(`Failed to load full definition via bpmDef detail: ${envelope.message ?? 'outline missing'}.`);
25479
+ }
25480
+ outline = envelope.data.outline;
25481
+ }
25482
+ catch (error) {
25483
+ logger_ts_1.loggerService.stopLoading();
25484
+ throw error;
25485
+ }
25486
+ const data = { ...outline, ...updates };
26157
25487
  logger_ts_1.loggerService.startLoading('Executing bpmDef update-definition');
26158
25488
  try {
26159
25489
  const response = await (0, bpm_def_service_ts_1.executeBpmDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('bpmDef', 'updateDefinition'), data);
@@ -29403,7 +28733,6 @@ const node_path_1 = __importDefault(__webpack_require__(76760));
29403
28733
  const prompts_1 = __webpack_require__(53503);
29404
28734
  const logger_ts_1 = __webpack_require__(87562);
29405
28735
  const request_ts_1 = __webpack_require__(83733);
29406
- const sharecrm_session_ts_1 = __webpack_require__(47166);
29407
28736
  const file_ts_1 = __webpack_require__(57452);
29408
28737
  const pkgMeta_ts_1 = __webpack_require__(48559);
29409
28738
  const apl_command_ts_1 = __webpack_require__(10508);
@@ -29472,7 +28801,7 @@ async function collectInitSettings(options) {
29472
28801
  domain = await askWithDefault('Enter enterprise domain', 'https://www.fxiaoke.com');
29473
28802
  }
29474
28803
  if (!certificate) {
29475
- certificate = await askWithDefault('Enter developer certificate (optional — leave empty to use sharecrm login)', '');
28804
+ certificate = await askWithDefault('Enter developer certificate');
29476
28805
  }
29477
28806
  // if (!developerName) {
29478
28807
  // developerName = await askWithDefault('Enter your developer name (optional)');
@@ -29490,8 +28819,9 @@ async function collectInitSettings(options) {
29490
28819
  if (!isValidUrl(domain)) {
29491
28820
  throw new Error('Invalid enterprise domain URL. Use a full URL, e.g. https://www.fxiaoke.com.');
29492
28821
  }
29493
- // certificate 可选:留空时工作区以 sharecrm 登录态运行(sharedev auth login),
29494
- // FHH 通道命令在未配置时由通道层给出引导
28822
+ if (!certificate) {
28823
+ throw new Error('Missing developer certificate. Use --certificate or provide it in interactive mode.');
28824
+ }
29495
28825
  return {
29496
28826
  enterpriseEA,
29497
28827
  domain,
@@ -29733,28 +29063,22 @@ async function runInitMetadataDownload(context) {
29733
29063
  await (0, dev_metadata_workspace_ts_1.writeNamespaceMetadataFile)(namespacesDir, namespaceResult.raw);
29734
29064
  logger_ts_1.loggerService.success(`Metadata download complete: objects=${succeeded}${failed ? `, failed=${failed}` : ''}, namespaces=${namespaceResult.namespaces.length}`);
29735
29065
  }
29736
- async function runInitDownloadsConcurrently(context, options, pullSelections, agentName, hasCredentials) {
29066
+ async function runInitDownloadsConcurrently(context, options, pullSelections, agentName) {
29737
29067
  const tasks = [];
29738
- if (!hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
29739
- // 凭证未就绪(certificate 未配置且工作区未登录):远端拉取类任务全部跳过,
29740
- // 文档/spec 模板(公网资源)照常下载
29741
- logger_ts_1.loggerService.warn('Credentials not ready (no certificate configured and not logged in). Skipping remote pulls.');
29742
- logger_ts_1.loggerService.info('Run `sharedev auth login` first, then `sharedev apl pull --all` / `sharedev pwc pull --all --type <component|plugin>`.');
29743
- }
29744
29068
  if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
29745
29069
  tasks.push(runInitDocsDownload(context, pullSelections));
29746
29070
  }
29747
29071
  if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
29748
29072
  tasks.push(runInitSpec(context, options, agentName));
29749
29073
  }
29750
- if (hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
29074
+ if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
29751
29075
  request_ts_1.requestService.configure(context.settings);
29752
29076
  tasks.push(runInitMetadataDownload(context));
29753
29077
  }
29754
- if (hasCredentials && pullSelections.pullAllApl) {
29078
+ if (pullSelections.pullAllApl) {
29755
29079
  tasks.push(runInitAplPull(context));
29756
29080
  }
29757
- if (hasCredentials && pullSelections.pullAllPwc) {
29081
+ if (pullSelections.pullAllPwc) {
29758
29082
  tasks.push(runInitPwcPull(context));
29759
29083
  }
29760
29084
  const results = await Promise.allSettled(tasks);
@@ -29788,10 +29112,8 @@ async function initProjectCommand(runtimeContext, options) {
29788
29112
  await (0, file_ts_1.writeJsonFile)(settingsPath, payload);
29789
29113
  logger_ts_1.loggerService.success(`Initialization completed: ${settingsPath}`);
29790
29114
  logger_ts_1.loggerService.info(`Workspace folder created: ${workspaceDir}`);
29791
- // 凭证就绪判定:本次配置了 certificate,或工作区已存在 sharecrm 登录态(--force 重建场景)
29792
- const hasCredentials = Boolean(payload.certificate?.trim()) || Boolean((0, sharecrm_session_ts_1.readSharedevAuthSession)(settingsDir)?.accessToken);
29793
29115
  const initContext = createInitRuntimeContext(runtimeContext, workspaceDir, settingsDir, settingsPath, payload);
29794
- await runInitDownloadsConcurrently(initContext, options, pullSelections, agentName, hasCredentials);
29116
+ await runInitDownloadsConcurrently(initContext, options, pullSelections, agentName);
29795
29117
  }
29796
29118
 
29797
29119
 
@@ -34168,11 +33490,13 @@ exports.objectDevImportSettingPushCommand = objectDevImportSettingPushCommand;
34168
33490
  var __webpack_unused_export__;
34169
33491
 
34170
33492
  __webpack_unused_export__ = ({ value: true });
34171
- exports.objectDevObjectMappingUpdateCommand = exports.objectDevObjectMappingCreateCommand = exports.objectDevObjectMappingPullCommand = exports.objectDevButtonPushCommand = exports.objectDevButtonUpdateCommand = exports.objectDevButtonCreateCommand = exports.objectDevButtonPullCommand = exports.objectDevButtonListCommand = exports.objectDevValidateRuleUpdateCommand = exports.objectDevValidateRulePushCommand = exports.objectDevValidateRulePullCommand = exports.objectDevValidateRuleListCommand = exports.objectDevValidateRuleCreateCommand = exports.objectDevLayoutRuleUpdateCommand = exports.objectDevLayoutRulePushCommand = exports.objectDevLayoutRulePullCommand = exports.objectDevLayoutRuleListCommand = exports.objectDevLayoutRuleCreateCommand = exports.objectDevLayoutUpdateCommand = exports.objectDevLayoutPushCommand = exports.objectDevLayoutPullCommand = exports.objectDevLayoutListCommand = exports.objectDevLayoutEnableEditCommand = exports.objectDevLayoutEditStatusCommand = exports.objectDevLayoutCreateCommand = exports.objectDevFieldPushCommand = exports.objectDevFieldUpdateCommand = exports.objectDevFieldCreateCommand = exports.objectDevFieldListCommand = exports.objectDevObjectPushCommand = exports.objectDevObjectUpdateCommand = exports.objectDevObjectCreateCommand = exports.objectDevSceneUpdateCommand = exports.objectDevScenePushCommand = exports.objectDevScenePullCommand = exports.objectDevSceneListCommand = exports.objectDevSceneCreateCommand = exports.objectDevMultiCurrencyPushCommand = exports.objectDevMultiCurrencyPullCommand = exports.objectDevGlobalVariablePushCommand = exports.objectDevGlobalVariablePullCommand = exports.objectDevOptionSetUpdateCommand = exports.objectDevOptionSetPushCommand = exports.objectDevOptionSetPullCommand = exports.objectDevOptionSetListCommand = exports.objectDevOptionSetDeleteCommand = exports.objectDevOptionSetCreateCommand = exports.objectDevObjectRelatedPullCommand = exports.objectDevObjectPullCommand = exports.objectDevObjectListCommand = void 0;
34172
- exports.objectDevPrintTemplateDeleteCommand = exports.objectDevPrintTemplatePushCommand = exports.objectDevPrintTemplateUpdateCommand = exports.objectDevPrintTemplateCreateCommand = exports.objectDevPrintTemplatePullCommand = __webpack_unused_export__ = exports.objectDevEmailTemplateDeleteCommand = exports.objectDevEmailTemplatePushCommand = exports.objectDevEmailTemplateUpdateCommand = exports.objectDevEmailTemplateCreateCommand = exports.objectDevEmailTemplatePullCommand = exports.objectDevEmailTemplateListCommand = exports.objectDevObjectPluginPushCommand = exports.objectDevObjectPluginUpdateCommand = exports.objectDevObjectPluginCreateCommand = exports.objectDevObjectPluginPullCommand = exports.objectDevTagPushCommand = exports.objectDevTagUpdateCommand = exports.objectDevTagCreateCommand = exports.objectDevTagPullCommand = exports.objectDevImportSettingPushCommand = exports.objectDevImportSettingUpdateCommand = exports.objectDevImportSettingPullCommand = exports.objectDevObjectExtensionPushCommand = exports.objectDevObjectExtensionUpdateCommand = exports.objectDevObjectExtensionCreateCommand = exports.objectDevObjectExtensionPullCommand = exports.objectDevArchiveRulePushCommand = exports.objectDevArchiveRuleUpdateCommand = exports.objectDevArchiveRuleCreateCommand = exports.objectDevArchiveRulePullCommand = exports.objectDevConvertRulePushCommand = exports.objectDevConvertRuleUpdateCommand = exports.objectDevConvertRuleCreateCommand = exports.objectDevConvertRulePullCommand = exports.objectDevConvertRuleListCommand = exports.objectDevObjectMappingPushCommand = void 0;
33493
+ exports.objectDevObjectMappingPullCommand = exports.objectDevButtonPushCommand = exports.objectDevButtonUpdateCommand = exports.objectDevButtonCreateCommand = exports.objectDevButtonPullCommand = exports.objectDevButtonListCommand = exports.objectDevValidateRuleUpdateCommand = exports.objectDevValidateRulePushCommand = exports.objectDevValidateRulePullCommand = exports.objectDevValidateRuleListCommand = exports.objectDevValidateRuleCreateCommand = exports.objectDevLayoutRuleUpdateCommand = exports.objectDevLayoutRulePushCommand = exports.objectDevLayoutRulePullCommand = exports.objectDevLayoutRuleListCommand = exports.objectDevLayoutRuleCreateCommand = exports.objectDevLayoutUpdateCommand = exports.objectDevLayoutPushCommand = exports.objectDevLayoutPullCommand = exports.objectDevLayoutListCommand = exports.objectDevLayoutEnableEditCommand = exports.objectDevLayoutEditStatusCommand = exports.objectDevLayoutCreateCommand = exports.objectDevFieldPushCommand = exports.objectDevFieldUpdateCommand = exports.objectDevFieldCreateCommand = exports.objectDevFieldListCommand = exports.objectDevObjectPushCommand = exports.objectDevObjectUpdateCommand = exports.objectDevObjectCreateCommand = exports.objectDevSceneUpdateCommand = exports.objectDevScenePushCommand = exports.objectDevScenePullCommand = exports.objectDevSceneListCommand = exports.objectDevSceneCreateCommand = exports.objectDevMultiCurrencyPushCommand = exports.objectDevMultiCurrencyPullCommand = exports.objectDevGlobalVariablePushCommand = exports.objectDevGlobalVariablePullCommand = exports.objectDevOptionSetUpdateCommand = exports.objectDevOptionSetPushCommand = exports.objectDevOptionSetPullCommand = exports.objectDevOptionSetListCommand = exports.objectDevOptionSetDeleteCommand = exports.objectDevOptionSetCreateCommand = exports.objectDevObjectRelatedPullCommand = __webpack_unused_export__ = __webpack_unused_export__ = exports.objectDevObjectPullCommand = exports.objectDevObjectListCommand = void 0;
33494
+ exports.objectDevPrintTemplateDeleteCommand = exports.objectDevPrintTemplatePushCommand = exports.objectDevPrintTemplateUpdateCommand = exports.objectDevPrintTemplateCreateCommand = exports.objectDevPrintTemplatePullCommand = __webpack_unused_export__ = exports.objectDevEmailTemplateDeleteCommand = exports.objectDevEmailTemplatePushCommand = exports.objectDevEmailTemplateUpdateCommand = exports.objectDevEmailTemplateCreateCommand = exports.objectDevEmailTemplatePullCommand = exports.objectDevEmailTemplateListCommand = exports.objectDevObjectPluginPushCommand = exports.objectDevObjectPluginUpdateCommand = exports.objectDevObjectPluginCreateCommand = exports.objectDevObjectPluginPullCommand = exports.objectDevTagPushCommand = exports.objectDevTagUpdateCommand = exports.objectDevTagCreateCommand = exports.objectDevTagPullCommand = exports.objectDevImportSettingPushCommand = exports.objectDevImportSettingUpdateCommand = exports.objectDevImportSettingPullCommand = exports.objectDevObjectExtensionPushCommand = exports.objectDevObjectExtensionUpdateCommand = exports.objectDevObjectExtensionCreateCommand = exports.objectDevObjectExtensionPullCommand = exports.objectDevArchiveRulePushCommand = exports.objectDevArchiveRuleUpdateCommand = exports.objectDevArchiveRuleCreateCommand = exports.objectDevArchiveRulePullCommand = exports.objectDevConvertRulePushCommand = exports.objectDevConvertRuleUpdateCommand = exports.objectDevConvertRuleCreateCommand = exports.objectDevConvertRulePullCommand = exports.objectDevConvertRuleListCommand = exports.objectDevObjectMappingPushCommand = exports.objectDevObjectMappingUpdateCommand = exports.objectDevObjectMappingCreateCommand = void 0;
34173
33495
  var object_ts_1 = __webpack_require__(13087);
34174
33496
  Object.defineProperty(exports, "objectDevObjectListCommand", ({ enumerable: true, get: function () { return object_ts_1.objectDevObjectListCommand; } }));
34175
33497
  Object.defineProperty(exports, "objectDevObjectPullCommand", ({ enumerable: true, get: function () { return object_ts_1.objectDevObjectPullCommand; } }));
33498
+ __webpack_unused_export__ = ({ enumerable: true, get: function () { return object_ts_1.ObjectDevObjectListOptions; } });
33499
+ __webpack_unused_export__ = ({ enumerable: true, get: function () { return object_ts_1.ObjectDevObjectPullOptions; } });
34176
33500
  var object_related_ts_1 = __webpack_require__(90165);
34177
33501
  Object.defineProperty(exports, "objectDevObjectRelatedPullCommand", ({ enumerable: true, get: function () { return object_related_ts_1.objectDevObjectRelatedPullCommand; } }));
34178
33502
  var option_set_ts_1 = __webpack_require__(98892);
@@ -41724,9 +41048,9 @@ async function objectPullService(shouldQueryAll, queryType = null, apiName, skip
41724
41048
  logger_ts_1.loggerService.info(`Skipped public object count: ${skippedPublicApiNames.length}`);
41725
41049
  }
41726
41050
  }
41727
- // 50个分批拉取
41051
+ // 20个分批拉取
41728
41052
  const apiNamesListGroups = apiNamesList.reduce((acc, item, index) => {
41729
- const groupIndex = Math.floor(index / 50);
41053
+ const groupIndex = Math.floor(index / 20);
41730
41054
  if (!acc[groupIndex]) {
41731
41055
  acc[groupIndex] = [];
41732
41056
  }
@@ -45960,12 +45284,12 @@ exports.pwcInfoCommand = pwcInfoCommand;
45960
45284
  exports.pwcDevCommand = pwcDevCommand;
45961
45285
  exports.pwcPlaceholderCommand = pwcPlaceholderCommand;
45962
45286
  const node_path_1 = __importDefault(__webpack_require__(76760));
45287
+ const node_module_1 = __webpack_require__(98995);
45963
45288
  const prompts_1 = __webpack_require__(53503);
45964
45289
  const file_ts_1 = __webpack_require__(57452);
45965
45290
  const zip_ts_1 = __webpack_require__(89139);
45966
45291
  const logger_ts_1 = __webpack_require__(87562);
45967
45292
  const request_ts_1 = __webpack_require__(83733);
45968
- const sharecrm_session_ts_1 = __webpack_require__(47166);
45969
45293
  const pwc_service_ts_1 = __webpack_require__(63358);
45970
45294
  const pwc_types_ts_1 = __webpack_require__(55844);
45971
45295
  const pwc_mateXml_ts_1 = __webpack_require__(53683);
@@ -46402,10 +45726,11 @@ async function pwcDevCommand(filePath, context, options = {}) {
46402
45726
  logger_ts_1.loggerService.info(shouldQueryAll
46403
45727
  ? `Starting Beefly dev server for ${outputNames.length} entr${outputNames.length === 1 ? 'y' : 'ies'}`
46404
45728
  : `Starting Beefly dev server with ${normalizedFilePath}`);
46405
- // 运行时入口路径(bin/cli.mjs / dist/sharedev.js,即 process.argv[1])做解析基准,
46406
- // 从 CLI 自身安装位置向上命中包内 node_modules 的 @share-crm/beefly;
46407
- // npm link 下 argv[1] 是全局 bin symlink,getRuntimeRequire 会先 realpath 穿透再解析。
46408
- const beefly = (0, sharecrm_session_ts_1.getRuntimeRequire)()('@share-crm/beefly');
45729
+ // createRequire(import.meta.url) 会被 webpack 静态求值为构建机的绝对源码路径,发布后失效;
45730
+ // 改用运行时入口路径(bin/cli.mjs / dist/sharedev.js,即 process.argv[1])做解析基准,
45731
+ // 从 CLI 自身安装位置向上命中包内 node_modules 的 @share-crm/beefly。
45732
+ const require = (0, node_module_1.createRequire)(process.argv[1] ?? process.cwd());
45733
+ const beefly = require('@share-crm/beefly');
46409
45734
  // 复用 Beefly 官方 API 启动 webpack dev server,入口名称决定预览产物名称。
46410
45735
  const server = await beefly.cli.dev({
46411
45736
  port: options.port,
@@ -47318,7 +46643,6 @@ function validatePwcMateXmlContent(input) {
47318
46643
  var __webpack_unused_export__;
47319
46644
 
47320
46645
  __webpack_unused_export__ = ({ value: true });
47321
- exports.assertPwcFileUploadChannel = assertPwcFileUploadChannel;
47322
46646
  exports.fetchCode = fetchCode;
47323
46647
  exports.fetchCodeByType = fetchCodeByType;
47324
46648
  exports.updateCodeSource = updateCodeSource;
@@ -47332,41 +46656,7 @@ exports.createPluginSource = createPluginSource;
47332
46656
  exports.enablePwcResource = enablePwcResource;
47333
46657
  exports.getUrlByApiName = getUrlByApiName;
47334
46658
  const request_ts_1 = __webpack_require__(83733);
47335
- const request_channel_ts_1 = __webpack_require__(43355);
47336
- const logger_ts_1 = __webpack_require__(87562);
47337
- /**
47338
- * PWC 命令的通道保护:openapi 能力未就绪期间——
47339
- * 有 certificate 则 warn 后降级走 FHH(避免登录态+certificate 并存的功能回退);
47340
- * 无 certificate 抛错引导配置。待服务端 download-file 修复后移除。
47341
- */
47342
- function assertPwcChannelOrFallback() {
47343
- if ((0, request_channel_ts_1.resolveRequestChannel)() !== 'openapi') {
47344
- return;
47345
- }
47346
- if ((0, request_channel_ts_1.hasCertificateCredential)()) {
47347
- logger_ts_1.loggerService.warn('PWC commands run via certificate channel (sharecrm login channel not ready for PWC file download).');
47348
- return;
47349
- }
47350
- throw new Error('PWC commands are not yet available on the sharecrm login channel ' +
47351
- '(Open API download-file returns empty content and has no URL query, 2026-10-21 measured). ' +
47352
- 'Use certificate mode (.sharedev/settings.json) for PWC commands.');
47353
- }
47354
- /**
47355
- * PWC 文件上传环节的通道断言:*-new 链路主体走 openapi(code-dev 命令),
47356
- * 但源码包上传(uploadFileList)仍依赖 FHH——纯登录态时给出明确引导而非服务端原始报错。
47357
- */
47358
- function assertPwcFileUploadChannel() {
47359
- if ((0, request_channel_ts_1.resolveRequestChannel)() !== 'openapi') {
47360
- return;
47361
- }
47362
- if ((0, request_channel_ts_1.hasCertificateCredential)()) {
47363
- return;
47364
- }
47365
- throw new Error('PWC file upload requires the certificate channel (not yet available on the sharecrm login channel). ' +
47366
- 'Use certificate mode (.sharedev/settings.json) for PWC push/deploy/create.');
47367
- }
47368
46659
  async function fetchCode(type, apiName) {
47369
- assertPwcChannelOrFallback();
47370
46660
  const response = await request_ts_1.requestService.FHH({
47371
46661
  url: '/EM2HCompBuild/VscodeExtension/downloadCode',
47372
46662
  data: {
@@ -47377,7 +46667,6 @@ async function fetchCode(type, apiName) {
47377
46667
  return response.components ?? [];
47378
46668
  }
47379
46669
  async function fetchCodeByType(type) {
47380
- assertPwcChannelOrFallback();
47381
46670
  const response = await request_ts_1.requestService.FHH({
47382
46671
  url: '/EM2HCompBuild/VscodeExtension/downloadCode',
47383
46672
  data: {
@@ -47431,14 +46720,12 @@ async function updatePluginSource(apiName, params) {
47431
46720
  });
47432
46721
  }
47433
46722
  async function updateCodeSource(type, apiName, params) {
47434
- assertPwcChannelOrFallback();
47435
46723
  if (type === 'plugin') {
47436
46724
  return updatePluginSource(apiName, params);
47437
46725
  }
47438
46726
  return updateComponentSource(apiName, params);
47439
46727
  }
47440
46728
  async function buildCode(type, apiName, client = 'web') {
47441
- assertPwcChannelOrFallback();
47442
46729
  if (type === 'component') {
47443
46730
  return request_ts_1.requestService.FHH({
47444
46731
  url: '/EM9HCompBuild/Component/AsynBuildComponent',
@@ -47451,7 +46738,6 @@ async function buildCode(type, apiName, client = 'web') {
47451
46738
  });
47452
46739
  }
47453
46740
  async function getBuildResult(buildId, type) {
47454
- assertPwcChannelOrFallback();
47455
46741
  return request_ts_1.requestService.FHH({
47456
46742
  url: `/EM1HCompBuild/${type}/getBuildResult`,
47457
46743
  data: { buildId }
@@ -47490,7 +46776,6 @@ async function hydratePwcComponent(component) {
47490
46776
  };
47491
46777
  }
47492
46778
  async function getPwcConfig() {
47493
- assertPwcChannelOrFallback();
47494
46779
  const response = await request_ts_1.requestService.FHH({
47495
46780
  url: '/EM1HCompBuild/Component/getConfig',
47496
46781
  data: {}
@@ -47498,7 +46783,6 @@ async function getPwcConfig() {
47498
46783
  return response.config ?? {};
47499
46784
  }
47500
46785
  async function getObjectApiNames() {
47501
- assertPwcChannelOrFallback();
47502
46786
  const response = await request_ts_1.requestService.FHH({
47503
46787
  url: '/EM1HNCRM/API/v1/object/describe/service/findDescribeManageList',
47504
46788
  data: {
@@ -47515,14 +46799,12 @@ async function getObjectApiNames() {
47515
46799
  .filter((item) => Boolean(item)))).sort((a, b) => a.localeCompare(b));
47516
46800
  }
47517
46801
  async function createComponentSource(data) {
47518
- assertPwcChannelOrFallback();
47519
46802
  await request_ts_1.requestService.FHH({
47520
46803
  url: '/EM1HCompBuild/Component/createComponent',
47521
46804
  data
47522
46805
  });
47523
46806
  }
47524
46807
  async function createPluginSource(data) {
47525
- assertPwcChannelOrFallback();
47526
46808
  await request_ts_1.requestService.FHH({
47527
46809
  url: '/EM1HCompBuild/Plugin/createPlugin',
47528
46810
  data
@@ -47533,7 +46815,6 @@ async function createPluginSource(data) {
47533
46815
  * create 成功后必须立即调用,失败时由请求层抛错并中止后续本地回拉流程。
47534
46816
  */
47535
46817
  async function enablePwcResource(type, apiName) {
47536
- assertPwcChannelOrFallback();
47537
46818
  const resourceType = type === 'plugin' ? 'Plugin' : 'Component';
47538
46819
  const action = type === 'plugin' ? 'enablePlugin' : 'enableComponent';
47539
46820
  await request_ts_1.requestService.FHH({
@@ -47542,7 +46823,6 @@ async function enablePwcResource(type, apiName) {
47542
46823
  });
47543
46824
  }
47544
46825
  async function getUrlByApiName(apiName, type) {
47545
- assertPwcChannelOrFallback();
47546
46826
  if (type === 'plugin') {
47547
46827
  const response = await request_ts_1.requestService.FHH({
47548
46828
  url: '/EM1HCompBuild/Plugin/queryPluginInfo',
@@ -48130,7 +47410,6 @@ async function pwcCreateNewService(input, context) {
48130
47410
  let remoteFiles = [];
48131
47411
  if (useAppletZip) {
48132
47412
  logger_ts_1.loggerService.updateLoading('Uploading initialization template archive');
48133
- (0, pwc_service_ts_1.assertPwcFileUploadChannel)();
48134
47413
  const zipBuffer = await (0, zip_ts_1.createZipBufferFromTextFiles)(input.templateFiles);
48135
47414
  const [remoteZip] = await request_ts_1.requestService.uploadFileList([
48136
47415
  {
@@ -48146,7 +47425,6 @@ async function pwcCreateNewService(input, context) {
48146
47425
  }
48147
47426
  else {
48148
47427
  logger_ts_1.loggerService.updateLoading('Uploading initialization template files');
48149
- (0, pwc_service_ts_1.assertPwcFileUploadChannel)();
48150
47428
  const uploaded = await request_ts_1.requestService.uploadFileList(input.templateFiles.map((file) => ({
48151
47429
  fileName: file.fileName,
48152
47430
  base64String: Buffer.from(file.content, 'utf8').toString('base64')
@@ -48680,7 +47958,6 @@ const request_ts_1 = __webpack_require__(83733);
48680
47958
  const request_ts_2 = __webpack_require__(35604);
48681
47959
  const types_ts_1 = __webpack_require__(6500);
48682
47960
  const pwc_mateXml_ts_1 = __webpack_require__(53683);
48683
- const pwc_service_ts_1 = __webpack_require__(63358);
48684
47961
  const pwc_workspace_ts_1 = __webpack_require__(64635);
48685
47962
  const pwc_types_ts_1 = __webpack_require__(55844);
48686
47963
  /**
@@ -48736,7 +48013,6 @@ async function pwcPushNewService(apiName, type, context) {
48736
48013
  const { readFile } = await Promise.resolve(/* import() */).then(() => (__webpack_require__(59031)));
48737
48014
  const zipBuffer = await readFile(appletZipPath);
48738
48015
  logger_ts_1.loggerService.updateLoading(`Uploading ${apiName}.zip`);
48739
- (0, pwc_service_ts_1.assertPwcFileUploadChannel)();
48740
48016
  const [remoteZip] = await request_ts_1.requestService.uploadFileList([
48741
48017
  {
48742
48018
  fileName: `${apiName}.zip`,
@@ -48755,7 +48031,6 @@ async function pwcPushNewService(apiName, type, context) {
48755
48031
  bundle = await (0, pwc_workspace_ts_1.readLocalPwcUploadBundle)(context, type, apiName, (0, pwc_mateXml_ts_1.buildPwcTypeConstraints)(config));
48756
48032
  // 上传源码 / 静态资源 / fileTree
48757
48033
  logger_ts_1.loggerService.updateLoading(`Uploading ${bundle.uploadFiles.length} files`);
48758
- (0, pwc_service_ts_1.assertPwcFileUploadChannel)();
48759
48034
  const uploaded = await request_ts_1.requestService.uploadFileList(bundle.uploadFiles.map((item) => ({
48760
48035
  fileName: item.fileName,
48761
48036
  base64String: item.base64String
@@ -49895,6 +49170,10 @@ async function stageDefDeployCommand(_context, options) {
49895
49170
  descTranslateInfo: "object"
49896
49171
  };
49897
49172
  const data = buildOptionsData(options, typeMap);
49173
+ // 空 body 会被服务端直接拒绝为 500,本地先校验定位字段
49174
+ if (!data.id && !data.sourceWorkflowId) {
49175
+ throw new Error('stage-dev deploy requires --id or --sourceWorkflowId to locate the definition.');
49176
+ }
49898
49177
  logger_ts_1.loggerService.startLoading('Executing stageDef deploy');
49899
49178
  try {
49900
49179
  const response = await (0, stage_def_service_ts_1.executeStageDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('stageDef', 'deploy'), data);
@@ -49925,7 +49204,36 @@ async function stageDefUpdateCommand(_context, options) {
49925
49204
  nameTranslateInfo: "object",
49926
49205
  descTranslateInfo: "object"
49927
49206
  };
49928
- const data = buildOptionsData(options, typeMap);
49207
+ const updates = buildOptionsData(options, typeMap);
49208
+ // 服务端为全量更新语义:必须先按 --sourceWorkflowId 拉取完整定义,再合并增量提交
49209
+ if (!updates.sourceWorkflowId) {
49210
+ throw new Error('stage-dev update requires --sourceWorkflowId to locate and load the full definition.');
49211
+ }
49212
+ const changedFields = Object.keys(updates).filter((key) => key !== 'sourceWorkflowId');
49213
+ if (changedFields.length === 0) {
49214
+ throw new Error('stage-dev update requires at least one field to update besides --sourceWorkflowId.');
49215
+ }
49216
+ logger_ts_1.loggerService.startLoading('Loading stageDef detail for full definition');
49217
+ let fullDefinition;
49218
+ try {
49219
+ const detailResponse = await (0, stage_def_service_ts_1.executeStageDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('stageDef', 'detail'), { sourceWorkflowId: updates.sourceWorkflowId });
49220
+ logger_ts_1.loggerService.stopLoading();
49221
+ const envelope = (detailResponse && typeof detailResponse === 'object')
49222
+ ? detailResponse
49223
+ : {};
49224
+ if (envelope.success !== true || !envelope.data) {
49225
+ throw new Error(`Failed to load full definition via stageDef detail: ${envelope.message ?? 'definition missing'}.`);
49226
+ }
49227
+ fullDefinition = envelope.data;
49228
+ }
49229
+ catch (error) {
49230
+ logger_ts_1.loggerService.stopLoading();
49231
+ throw error;
49232
+ }
49233
+ // 服务端 schema 将 id 定义为 object 类型,detail 返回的 string id 回传会被校验拒绝;
49234
+ // 定位统一交给 sourceWorkflowId(schema 中 id 非必填)
49235
+ const { id: _omitId, ...data } = { ...fullDefinition, ...updates };
49236
+ void _omitId;
49929
49237
  logger_ts_1.loggerService.startLoading('Executing stageDef update');
49930
49238
  try {
49931
49239
  const response = await (0, stage_def_service_ts_1.executeStageDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('stageDef', 'update'), data);
@@ -50556,7 +49864,33 @@ async function workflowDefUpdateDefinitionCommand(_context, options) {
50556
49864
  nameTranslateInfo: "object",
50557
49865
  descTranslateInfo: "object"
50558
49866
  };
50559
- const data = buildOptionsData(options, typeMap);
49867
+ const updates = buildOptionsData(options, typeMap);
49868
+ // 服务端为全量更新语义:必须先按 --sourceWorkflowId 拉取完整定义,再合并增量提交
49869
+ if (!updates.sourceWorkflowId) {
49870
+ throw new Error('workflow-dev update-definition requires --sourceWorkflowId to locate and load the full definition.');
49871
+ }
49872
+ const changedFields = Object.keys(updates).filter((key) => key !== 'sourceWorkflowId');
49873
+ if (changedFields.length === 0) {
49874
+ throw new Error('workflow-dev update-definition requires at least one field to update besides --sourceWorkflowId.');
49875
+ }
49876
+ logger_ts_1.loggerService.startLoading('Loading workflowDef detail for full definition');
49877
+ let fullDefinition;
49878
+ try {
49879
+ const detailResponse = await (0, workflow_def_service_ts_1.executeWorkflowDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('workflowDef', 'detail'), { sourceWorkflowId: updates.sourceWorkflowId });
49880
+ logger_ts_1.loggerService.stopLoading();
49881
+ const envelope = (detailResponse && typeof detailResponse === 'object')
49882
+ ? detailResponse
49883
+ : {};
49884
+ if (envelope.success !== true || !envelope.data?.workflow) {
49885
+ throw new Error(`Failed to load full definition via workflowDef detail: ${envelope.message ?? 'definition missing'}.`);
49886
+ }
49887
+ fullDefinition = envelope.data.workflow;
49888
+ }
49889
+ catch (error) {
49890
+ logger_ts_1.loggerService.stopLoading();
49891
+ throw error;
49892
+ }
49893
+ const data = { ...fullDefinition, ...updates };
50560
49894
  logger_ts_1.loggerService.startLoading('Executing workflowDef update-definition');
50561
49895
  try {
50562
49896
  const response = await (0, workflow_def_service_ts_1.executeWorkflowDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('workflowDef', 'updateDefinition'), data);
@@ -51101,8 +50435,7 @@ function readRuntimeDebugFlag() {
51101
50435
  }
51102
50436
  function isRuntimeDebugEnabled() {
51103
50437
  const runtimeEnabled = readRuntimeDebugFlag();
51104
- // typeof 保护:webpack DefinePlugin 常量在直跑(bun/tsx/node strip)路径下不存在
51105
- return ( false) || runtimeEnabled || false;
50438
+ return false || runtimeEnabled || false;
51106
50439
  }
51107
50440
 
51108
50441
 
@@ -51303,8 +50636,8 @@ async function readCliPackageMeta() {
51303
50636
  ? "@share-crm/sharedev-cli".trim()
51304
50637
  : '@share-crm/sharedev-cli';
51305
50638
  const debugEnabled = true && Boolean(false);
51306
- const rawVersion = ( true && "0.0.4-rc.50-test.3".trim())
51307
- ? "0.0.4-rc.50-test.3".trim()
50639
+ const rawVersion = ( true && "0.0.4-rc.52".trim())
50640
+ ? "0.0.4-rc.52".trim()
51308
50641
  : '0.0.0';
51309
50642
  const version = rawVersion + (debugEnabled ? '-debug' : '');
51310
50643
  return { name, version };