@freelog/cli 0.10.3 → 0.10.4

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.
@@ -1,47 +1,47 @@
1
- # Third-party and separately licensed components
2
-
3
- The PolyForm Noncommercial license for Freelog CLI does not replace the
4
- original licenses of separately licensed components or dependencies.
5
- Those licenses apply only to the respective components, not to Freelog CLI
6
- as a whole. Keep their original copyright and license notices when
7
- redistributing them.
8
-
9
- ## Bundled SDK: @freelog-cli/tools-lib2
10
-
11
- Source in this repository: packages/tools-lib/
12
- The original MIT license and copyright notice are reproduced below.
13
-
14
- MIT License
15
-
16
- Copyright (c) 2021 liu-kai-github
17
-
18
- Permission is hereby granted, free of charge, to any person obtaining a copy
19
- of this software and associated documentation files (the "Software"), to deal
20
- in the Software without restriction, including without limitation the rights
21
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
- copies of the Software, and to permit persons to whom the Software is
23
- furnished to do so, subject to the following conditions:
24
-
25
- The above copyright notice and this permission notice shall be included in all
26
- copies or substantial portions of the Software.
27
-
28
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
- SOFTWARE.
35
-
36
- ## Independently distributed templates
37
-
38
- The template packages under packages/templates/ declare ISC in their own
39
- package.json files. They are not included in the CLI tarball. Their existing
40
- license declarations and notices remain applicable to those templates.
41
-
42
- ## Other dependencies
43
-
44
- Other dependencies retain their own license and copyright notices, whether
45
- installed separately or included in generated bundles. This file documents
46
- the separately licensed workspace components; it is not an exhaustive
47
- inventory of all transitive dependencies.
1
+ # Third-party and separately licensed components
2
+
3
+ The PolyForm Noncommercial license for Freelog CLI does not replace the
4
+ original licenses of separately licensed components or dependencies.
5
+ Those licenses apply only to the respective components, not to Freelog CLI
6
+ as a whole. Keep their original copyright and license notices when
7
+ redistributing them.
8
+
9
+ ## Bundled SDK: @freelog-cli/tools-lib2
10
+
11
+ Source in this repository: packages/tools-lib/
12
+ The original MIT license and copyright notice are reproduced below.
13
+
14
+ MIT License
15
+
16
+ Copyright (c) 2021 liu-kai-github
17
+
18
+ Permission is hereby granted, free of charge, to any person obtaining a copy
19
+ of this software and associated documentation files (the "Software"), to deal
20
+ in the Software without restriction, including without limitation the rights
21
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
22
+ copies of the Software, and to permit persons to whom the Software is
23
+ furnished to do so, subject to the following conditions:
24
+
25
+ The above copyright notice and this permission notice shall be included in all
26
+ copies or substantial portions of the Software.
27
+
28
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
29
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
30
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
31
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
32
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
33
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34
+ SOFTWARE.
35
+
36
+ ## Independently distributed templates
37
+
38
+ The template packages under packages/templates/ declare ISC in their own
39
+ package.json files. They are not included in the CLI tarball. Their existing
40
+ license declarations and notices remain applicable to those templates.
41
+
42
+ ## Other dependencies
43
+
44
+ Other dependencies retain their own license and copyright notices, whether
45
+ installed separately or included in generated bundles. This file documents
46
+ the separately licensed workspace components; it is not an exhaustive
47
+ inventory of all transitive dependencies.
package/README.md CHANGED
@@ -1,33 +1,33 @@
1
- # Freelog CLI
2
-
3
- Freelog 资源发行与管理命令行工具。npm 包名是 **`@freelog/cli`**,安装后的命令是 **`freelog-cli`**,最低要求 **Node.js 22.14.0**。请使用受支持的 Node 22 或 24 LTS。
4
-
5
- **源码公开,仅限非商业用途。** 本包采用 [PolyForm Noncommercial 1.0.0](./LICENSE),不授予商业使用权;已发布旧版本以各自随包许可证为准。
6
-
7
- ```sh
8
- npm install --global @freelog/cli
9
- freelog-cli --cli-version
10
- freelog-cli --help
11
- ```
12
-
13
- `--help` 提供[在线使用手册](https://widget-docs.freelog.cn/cli/)入口。npm包保留本README和许可证,不包含docs目录;仓库文档继续保留。
14
-
15
- 如果 `freelog-cli` 由其他全局包提供,先卸载该包,再安装 `@freelog/cli`,避免全局命令冲突。具体步骤见[安装来源与 AI 代办](https://widget-docs.freelog.cn/cli/)。
16
-
17
- 命令找不到时先重新打开终端,并检查 npm 全局可执行目录是否在 PATH 中。当前 CLI 尚未开放生产平台操作。生产业务请先使用 Console;版本与能力支持范围、验证边界及升级方式见在线手册的「版本记录」和「快速上手」。再按[完整使用手册](https://widget-docs.freelog.cn/cli/)选择首次发行或绑定后更新的教程。
18
-
19
- 支持普通单文件、主题/插件及作者合集的发行管理;主题/插件可从线上模板创建工程。也可管理线上存储、从存储导入发行物、查询市场、创建节点、管理节点展品及节点自建展品合集。作者资源和作者合集可公开或非公开上架。节点新展品签约通过内联auth-cli包执行,用户无需另装授权工具。依赖声明、签约授权、合同及支付由 auth-cli 负责,主 CLI 不提供依赖编辑、支付或旧展品资源授权命令。具体参数和流程以对应版本的使用手册为准。
20
-
21
- 生产教程以对应安装包开放并验证生产能力为前提。节点设置、专用确认删除、主题切换及展品编辑见[在线使用手册](https://widget-docs.freelog.cn/cli/)。节点签约涉及必要上抛或已有合同复用时转浏览器办理。非公开上架来源的 CLI 签入仍待授权模块适配。
22
-
23
- 项目仍处于开发阶段,完整命令组合、Console 双向和三平台矩阵仍有未验部分;部分合集模板有已知后端编译问题。批量发行、RSS维护尚不支持。具体能力起点、历史勘误和未验证流程统一见在线手册「版本记录」。
24
-
25
- 给 AI 指定任务时提供包名、环境、工程目录和目标资源ID或完整授权标识。先通过 `freelog-cli --cli-version` 核对实际安装版本,再按对应版本的手册操作;失败或结果未知时停止后继写入并核对,不盲目重发。
26
-
27
- 源代码、完整手册与开发说明:[freelog-runtime-cli](https://github.com/freelogfe/freelog-runtime-cli#readme)。试用未发布改动时使用维护者提供的对应候选包;核对安装来源、对应版本的手册及实际命令,不仅凭在线文档或版本号推断支持范围。
28
-
29
- 问题及命令体验反馈:[GitHub Issues](https://github.com/freelogfe/freelog-runtime-cli/issues)。请提供 CLI/Node/系统版本、复现步骤和脱敏错误;不要提供密码、令牌、验证码或完整凭据文件。无仓库访问权限时请通过提供 CLI 的团队联系人转交。
30
-
31
- 许可证:[PolyForm Noncommercial 1.0.0](./LICENSE)。独立组件保留原许可,见[第三方许可声明](./LICENSE.thirdparty);这些声明不使整个 CLI 获得 MIT 授权。
32
-
33
- 贡献方式、安全问题私密报告及许可范围请从[仓库公开说明](https://github.com/freelogfe/freelog-runtime-cli#许可与参与贡献)进入。疑似漏洞不要提交到公开 Issue。
1
+ # Freelog CLI
2
+
3
+ Freelog 资源发行与管理命令行工具。npm 包名是 **`@freelog/cli`**,安装后的命令是 **`freelog-cli`**,最低要求 **Node.js 22.14.0**。请使用受支持的 Node 22 或 24 LTS。
4
+
5
+ **源码公开,仅限非商业用途。** 本包采用 [PolyForm Noncommercial 1.0.0](./LICENSE),不授予商业使用权;已发布旧版本以各自随包许可证为准。
6
+
7
+ ```sh
8
+ npm install --global @freelog/cli
9
+ freelog-cli --cli-version
10
+ freelog-cli --help
11
+ ```
12
+
13
+ `--help` 提供[在线使用手册](https://widget-docs.freelog.cn/cli/)入口。npm包保留本README和许可证,不包含docs目录;仓库文档继续保留。
14
+
15
+ 如果 `freelog-cli` 由其他全局包提供,先卸载该包,再安装 `@freelog/cli`,避免全局命令冲突。具体步骤见[安装来源与 AI 代办](https://widget-docs.freelog.cn/cli/)。
16
+
17
+ 命令找不到时先重新打开终端,并检查 npm 全局可执行目录是否在 PATH 中。当前 CLI 尚未开放生产平台操作。生产业务请先使用 Console;版本与能力支持范围、验证边界及升级方式见在线手册的「版本记录」和「快速上手」。再按[完整使用手册](https://widget-docs.freelog.cn/cli/)选择首次发行或绑定后更新的教程。
18
+
19
+ 支持普通单文件、主题/插件及作者合集的发行管理;主题/插件可从线上模板创建工程。也可管理线上存储、从存储导入发行物、查询市场、创建节点、管理节点展品及节点自建展品合集。作者资源和作者合集可公开或非公开上架。节点新展品签约通过内联auth-cli包执行,用户无需另装授权工具。依赖声明、签约授权、合同及支付由 auth-cli 负责,主 CLI 不提供依赖编辑、支付或旧展品资源授权命令。具体参数和流程以对应版本的使用手册为准。
20
+
21
+ 生产教程以对应安装包开放并验证生产能力为前提。节点设置、专用确认删除、主题切换及展品编辑见[在线使用手册](https://widget-docs.freelog.cn/cli/)。节点签约涉及必要上抛或已有合同复用时转浏览器办理。非公开上架来源的 CLI 签入仍待授权模块适配。
22
+
23
+ 项目仍处于开发阶段,完整命令组合、Console 双向和三平台矩阵仍有未验部分;部分合集模板有已知后端编译问题。批量发行、RSS维护尚不支持。具体能力起点、历史勘误和未验证流程统一见在线手册「版本记录」。
24
+
25
+ 给 AI 指定任务时提供包名、环境、工程目录和目标资源ID或完整授权标识。先通过 `freelog-cli --cli-version` 核对实际安装版本,再按对应版本的手册操作;失败或结果未知时停止后继写入并核对,不盲目重发。
26
+
27
+ 源代码、完整手册与开发说明:[freelog-runtime-cli](https://github.com/freelogfe/freelog-runtime-cli#readme)。试用未发布改动时使用维护者提供的对应候选包;核对安装来源、对应版本的手册及实际命令,不仅凭在线文档或版本号推断支持范围。
28
+
29
+ 问题及命令体验反馈:[GitHub Issues](https://github.com/freelogfe/freelog-runtime-cli/issues)。请提供 CLI/Node/系统版本、复现步骤和脱敏错误;不要提供密码、令牌、验证码或完整凭据文件。无仓库访问权限时请通过提供 CLI 的团队联系人转交。
30
+
31
+ 许可证:[PolyForm Noncommercial 1.0.0](./LICENSE)。独立组件保留原许可,见[第三方许可声明](./LICENSE.thirdparty);这些声明不使整个 CLI 获得 MIT 授权。
32
+
33
+ 贡献方式、安全问题私密报告及许可范围请从[仓库公开说明](https://github.com/freelogfe/freelog-runtime-cli#许可与参与贡献)进入。疑似漏洞不要提交到公开 Issue。
package/dist/bin/index.js CHANGED
@@ -37461,6 +37461,8 @@ var init_errorOutcome = __esm({
37461
37461
  "EXHIBIT_RESOURCE_SELECTOR_UNSUPPORTED",
37462
37462
  "RESOURCE_INFO_TARGET_CONFLICT",
37463
37463
  "RESOURCE_INFO_TARGET_REQUIRED",
37464
+ "UPDATE_TITLE_REQUIRED",
37465
+ "UPDATE_TITLE_LONG",
37464
37466
  "IDENTITY_RESOURCE_REQUIRED",
37465
37467
  "RESOURCE_SELECTOR_INVALID",
37466
37468
  "RESOURCE_SELECTOR_EMPTY",
@@ -37726,7 +37728,7 @@ function getEnv2() {
37726
37728
  }
37727
37729
  function assertPlatformAllowed(env = activeEnv) {
37728
37730
  if (env === "prod") {
37729
- throw new CliError("prod \u6682\u672A\u5F00\u653E\uFF0C\u8BF7\u7528 --env test \u6216 --env dev", "PRODUCTION_ENV_DISABLED");
37731
+ throw new CliError("\u5F53\u524D\u7248\u672C\u5C1A\u672A\u5F00\u653E\u751F\u4EA7\u73AF\u5883", "PRODUCTION_ENV_DISABLED");
37730
37732
  }
37731
37733
  return env;
37732
37734
  }
@@ -37950,7 +37952,10 @@ function loadAuth(options2) {
37950
37952
  }
37951
37953
  function assertAuthEnv(auth, env) {
37952
37954
  if (auth.env !== env) {
37953
- throw new CliError(`\u5F53\u524D\u51ED\u636E\u662F ${auth.env}\uFF0C\u672C\u6B21\u662F ${env}\u3002\u8BF7 logout \u518D login --env ${env}`, "AUTH_ENV_MISMATCH");
37955
+ throw new CliError(
37956
+ `\u5F53\u524D\u51ED\u636E\u662F ${auth.env}\uFF0C\u672C\u6B21\u662F ${env}\u3002\u8BF7\u9009\u62E9\u5BF9\u5E94\u5DE5\u7A0B\uFF0C\u6216\u9000\u51FA\u5F53\u524D\u8D26\u53F7\u540E\u91CD\u65B0\u767B\u5F55\u3002`,
37957
+ "AUTH_ENV_MISMATCH"
37958
+ );
37954
37959
  }
37955
37960
  }
37956
37961
  var selectorSchema, secretSchema, authSearchCwd, credentialStore;
@@ -38122,8 +38127,7 @@ var init_notImplemented = __esm({
38122
38127
 
38123
38128
  // src/core/cliArgs.ts
38124
38129
  import { Command as Command2, Option } from "commander";
38125
- function addRequiredSharedValue(command, flags, description) {
38126
- const option = new Option(flags, description);
38130
+ function addRequiredSharedValue(command, option) {
38127
38131
  option.required = false;
38128
38132
  option.optional = true;
38129
38133
  command.addOption(option);
@@ -38134,23 +38138,13 @@ function addRequiredSharedValue(command, flags, description) {
38134
38138
  return command;
38135
38139
  }
38136
38140
  function addSharedOptions(command) {
38137
- addRequiredSharedValue(
38138
- command,
38139
- "--env <env>",
38140
- // i18n: cli.flag.env
38141
- "\u73AF\u5883\uFF08\u672A\u6307\u5B9A\u65F6\u8BFB\u53D6 FREELOG_ENV\uFF0C\u65E0\u914D\u7F6E\u65F6\u9ED8\u8BA4 dev\uFF09"
38142
- );
38141
+ addRequiredSharedValue(command, new Option("--env <env>", "\u5185\u90E8\u6D4B\u8BD5\u73AF\u5883").hideHelp());
38143
38142
  command.option(
38144
38143
  "--yes",
38145
38144
  // i18n: cli.flag.yes
38146
38145
  "\u8DF3\u8FC7\u786E\u8BA4"
38147
38146
  );
38148
- addRequiredSharedValue(
38149
- command,
38150
- "--cwd <dir>",
38151
- // i18n: cli.flag.cwd
38152
- "\u5DE5\u4F5C\u76EE\u5F55"
38153
- );
38147
+ addRequiredSharedValue(command, new Option("--cwd <dir>", "\u5DE5\u4F5C\u76EE\u5F55"));
38154
38148
  command.option(
38155
38149
  "--json",
38156
38150
  // i18n: cli.flag.json
@@ -38158,8 +38152,7 @@ function addSharedOptions(command) {
38158
38152
  );
38159
38153
  return addRequiredSharedValue(
38160
38154
  command,
38161
- "--resource <selector>",
38162
- "\u9009\u62E9\u672C\u5730\u8D44\u6E90\uFF08id:\u3001name:\u3001artifact: \u6216 file:N.json\uFF09"
38155
+ new Option("--resource <selector>", "\u9009\u62E9\u672C\u5730\u8D44\u6E90\uFF08id:\u3001name:\u3001artifact: \u6216 file:N.json\uFF09")
38163
38156
  );
38164
38157
  }
38165
38158
  function readSharedOptions(command) {
@@ -46404,7 +46397,7 @@ function assertBoundIdentityEnvironment(identity2) {
46404
46397
  const activeEnv2 = getEnv2();
46405
46398
  if (identityEnv !== activeEnv2) {
46406
46399
  throw new CliError(
46407
- `\u8D44\u6E90 ${identity2.n}.json \u5C5E\u4E8E ${identityEnv} \u73AF\u5883\uFF0C\u672C\u6B21\u662F ${activeEnv2}\uFF1B\u8BF7\u5207\u6362 --env \u6216\u9009\u62E9\u8BE5\u73AF\u5883\u7684\u8D44\u6E90\u72B6\u6001`,
46400
+ `\u8D44\u6E90 ${identity2.n}.json \u5C5E\u4E8E ${identityEnv} \u73AF\u5883\uFF0C\u672C\u6B21\u662F ${activeEnv2}\u3002\u8BF7\u9009\u62E9\u5F53\u524D\u73AF\u5883\u5BF9\u5E94\u7684\u672C\u5730\u8D44\u6E90\u72B6\u6001\u3002`,
46408
46401
  "RESOURCE_ENV_MISMATCH"
46409
46402
  );
46410
46403
  }
@@ -46775,14 +46768,17 @@ async function runInteractiveApply(input3) {
46775
46768
  }
46776
46769
  throw error3;
46777
46770
  }
46778
- const paramSummary = prepared.template.fields.map((field) => `[${field.slot}]=${String(prepared.values.get(field.slot))}`).join("\u3001") || "\u65E0\u52A8\u6001\u53C2\u6570";
46779
- const preview2 = `\u6700\u7EC8\u7B56\u7565\u8BD1\u6587\uFF1A
46780
- ${prepared.translation}
46781
-
46782
- \u7B56\u7565\u540D\u79F0\uFF1A${name}
46783
- \u53C2\u6570\uFF1A${paramSummary}
46784
- \u786E\u8BA4\u521B\u5EFA\u5E76\u542F\u7528\uFF1F`;
46785
- if (!input3.yes && !await confirmQuestion(preview2, true)) continue;
46771
+ const paramSummary = prepared.template.fields.map((field) => `[${field.slot}]=${terminalText(String(prepared.values.get(field.slot)))}`).join("\u3001") || "\u65E0\u52A8\u6001\u53C2\u6570";
46772
+ const preview2 = [
46773
+ `\u6A21\u677F\u8BF4\u660E\uFF08\u5DF2\u586B\u5199\u53C2\u6570\uFF09\uFF1A
46774
+ ${terminalText(renderTemplateReport(prepared.template, prepared.values), true)}`,
46775
+ `\u5E73\u53F0\u8FD4\u56DE\u7684\u7F16\u8BD1\u8BD1\u6587\uFF1A
46776
+ ${terminalText(prepared.translation, true)}`,
46777
+ `\u7B56\u7565\u540D\u79F0\uFF1A${terminalText(name)}
46778
+ \u53C2\u6570\uFF1A${paramSummary}`,
46779
+ "\u5982\u4E24\u5904\u7684\u6388\u6743\u5BF9\u8C61\u3001\u8303\u56F4\u6216\u4ED8\u6B3E\u6761\u4EF6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u9009\u62E9\u5426\u5E76\u91CD\u65B0\u6838\u5BF9\u3002\n\u786E\u8BA4\u521B\u5EFA\u5E76\u542F\u7528\uFF1F"
46780
+ ].join("\n\n");
46781
+ if (!input3.yes && !await confirmQuestion(preview2, false)) continue;
46786
46782
  try {
46787
46783
  await input3.backend.apply({
46788
46784
  cwd: input3.cwd,
@@ -50052,7 +50048,38 @@ function resultInfo(facts) {
50052
50048
  onlineStatus: facts.exhibit.onlineStatus
50053
50049
  };
50054
50050
  }
50055
- async function updateExhibitInfo(input3) {
50051
+ function prepareExhibitInfo(input3) {
50052
+ if ([input3.title, input3.intro, input3.tags, input3.cover].every((value) => value === void 0) && !input3.clearTags)
50053
+ throw new CliError("\u8BF7\u63D0\u4F9B\u5C55\u54C1\u6807\u9898\u3001\u7B80\u4ECB\u3001\u6807\u7B7E\u6216\u5C01\u9762\u4FEE\u6539", "EXHIBIT_UPDATE_EMPTY");
50054
+ const explicit = changes(input3);
50055
+ let cover;
50056
+ if (input3.cover !== void 0) {
50057
+ try {
50058
+ cover = readLocalImage({
50059
+ cwd: input3.cwd,
50060
+ path: input3.cover,
50061
+ formats: ["jpeg", "png", "gif"],
50062
+ maxBytes: 5 * 1024 * 1024
50063
+ });
50064
+ } catch {
50065
+ throw new CliError(
50066
+ "\u5C01\u9762\u987B\u4E3A5MiB\u4EE5\u5185\u7684\u672C\u5730JPEG/PNG/GIF\uFF1Bstage=image-validation\uFF0CexhibitUpdateSent=false",
50067
+ "EXHIBIT_COVER_INVALID"
50068
+ );
50069
+ }
50070
+ }
50071
+ return { explicit, cover };
50072
+ }
50073
+ function exhibitInfoPreview(changes2, cover) {
50074
+ return {
50075
+ changes: changes2,
50076
+ ...cover ? {
50077
+ cover: { path: cover.absolutePath, format: cover.format },
50078
+ warning: "CLI\u4E0D\u88C1\u526A\uFF1B\u56FE\u7247\u4E0A\u4F20\u6210\u529F\u4E0D\u4EE3\u8868\u5C55\u54C1\u8D44\u6599\u5DF2\u4FDD\u5B58"
50079
+ } : {}
50080
+ };
50081
+ }
50082
+ async function updateExhibitInfo(input3, createdCollection) {
50056
50083
  const scope = operationScope(input3);
50057
50084
  let uploadAttempted = false;
50058
50085
  let exhibitUpdateSent = false;
@@ -50069,27 +50096,11 @@ async function updateExhibitInfo(input3) {
50069
50096
  }
50070
50097
  };
50071
50098
  try {
50072
- if ([input3.title, input3.intro, input3.tags, input3.cover].every((value) => value === void 0) && !input3.clearTags)
50073
- throw new CliError("\u8BF7\u63D0\u4F9B\u5C55\u54C1\u6807\u9898\u3001\u7B80\u4ECB\u3001\u6807\u7B7E\u6216\u5C01\u9762\u4FEE\u6539", "EXHIBIT_UPDATE_EMPTY");
50074
- const explicit = changes(input3);
50075
- let cover;
50076
- if (input3.cover !== void 0) {
50077
- try {
50078
- cover = readLocalImage({
50079
- cwd: input3.cwd,
50080
- path: input3.cover,
50081
- formats: ["jpeg", "png", "gif"],
50082
- maxBytes: 5 * 1024 * 1024
50083
- });
50084
- } catch {
50085
- throw new CliError(
50086
- "\u5C01\u9762\u987B\u4E3A5MiB\u4EE5\u5185\u7684\u672C\u5730JPEG/PNG/GIF\uFF1Bstage=image-validation\uFF0CexhibitUpdateSent=false",
50087
- "EXHIBIT_COVER_INVALID"
50088
- );
50089
- }
50090
- }
50099
+ const { explicit, cover } = createdCollection?.prepared ?? prepareExhibitInfo(input3);
50091
50100
  const before = await readExhibitEditFacts(input3);
50092
50101
  assertActor();
50102
+ if (createdCollection && (before.exhibit.subjectType !== 5 || before.exhibit.nodeId !== createdCollection.nodeId))
50103
+ throw new CliError("\u8D44\u6599\u64CD\u4F5C\u7684\u5C55\u54C1\u7C7B\u578B\u6216\u8282\u70B9\u4E0E\u521B\u5EFA\u7ED3\u679C\u4E0D\u4E00\u81F4", "EXHIBIT_COLLECTION_CHANGED");
50093
50104
  assertInfoEditable(before);
50094
50105
  const changed = {};
50095
50106
  for (const key2 of Object.keys(explicit)) {
@@ -50117,11 +50128,7 @@ async function updateExhibitInfo(input3) {
50117
50128
  exhibitId: input3.exhibitId,
50118
50129
  nodeId: before.exhibit.nodeId,
50119
50130
  before: resultInfo(before),
50120
- changes: changed,
50121
- ...cover ? {
50122
- cover: { path: cover.absolutePath, format: cover.format },
50123
- warning: "CLI\u4E0D\u88C1\u526A\uFF1B\u56FE\u7247\u4E0A\u4F20\u6210\u529F\u4E0D\u4EE3\u8868\u5C55\u54C1\u8D44\u6599\u5DF2\u4FDD\u5B58"
50124
- } : {}
50131
+ ...exhibitInfoPreview(changed, cover)
50125
50132
  },
50126
50133
  ...cover ? {
50127
50134
  prepare: async () => {
@@ -50516,7 +50523,10 @@ function matches2(raw, plan) {
50516
50523
  }
50517
50524
  async function createExhibitCollection(input3) {
50518
50525
  const scope = operationScope(input3);
50519
- return withCollectionActor(
50526
+ const { cwd, cover, intro, tags } = input3;
50527
+ const prepared = [cover, intro, tags].some((value) => value !== void 0) ? prepareExhibitInfo({ cwd, cover, intro, tags }) : void 0;
50528
+ let verifiedCreation;
50529
+ const creation = withCollectionActor(
50520
50530
  input3,
50521
50531
  () => withRemoteOperationsLock(scope, async () => {
50522
50532
  const node2 = await loadOwnedNode({ ...input3, node: nodeId2(input3.node) });
@@ -50549,7 +50559,12 @@ async function createExhibitCollection(input3) {
50549
50559
  assertNodeAccount(input3, scope.userId, scope.env);
50550
50560
  await prompts.confirmWrite(
50551
50561
  JSON.stringify(
50552
- { create: plan, typePath: type.path, ...originalName.trim() === name ? {} : { originalName } },
50562
+ {
50563
+ create: plan,
50564
+ typePath: type.path,
50565
+ ...originalName.trim() === name ? {} : { originalName },
50566
+ ...prepared ? { detailsAfterCreate: exhibitInfoPreview(prepared.explicit, prepared.cover) } : {}
50567
+ },
50553
50568
  null,
50554
50569
  2
50555
50570
  ),
@@ -50589,6 +50604,7 @@ async function createExhibitCollection(input3) {
50589
50604
  throw new CliError("\u521B\u5EFA\u540D\u79F0\u548CID\u8BFB\u56DE\u4E0D\u4E00\u81F4", "EXHIBIT_COLLECTION_CREATE_UNCONFIRMED");
50590
50605
  assertNodeAccount(input3, scope.userId, scope.env);
50591
50606
  closeRemoteOperation(scope, record20);
50607
+ verifiedCreation = byId;
50592
50608
  return byId;
50593
50609
  } catch (error3) {
50594
50610
  if (!acknowledged && error3 instanceof ApiResponseError && error3.rejection) {
@@ -50607,6 +50623,32 @@ async function createExhibitCollection(input3) {
50607
50623
  }
50608
50624
  })
50609
50625
  );
50626
+ try {
50627
+ const created = await creation;
50628
+ if (!prepared) return created;
50629
+ const { presentableId, nodeId: collectionNodeId } = created.exhibit;
50630
+ assertNodeAccount(input3, scope.userId, scope.env);
50631
+ const { exhibit: exhibit2 } = await updateExhibitInfo(
50632
+ { ...input3, exhibitId: presentableId, prompts: headlessPrompts, yes: true },
50633
+ { nodeId: collectionNodeId, prepared }
50634
+ );
50635
+ const { presentableIntro, tags: tags2, coverImages } = exhibit2;
50636
+ return { ...created, details: { status: "saved", presentableIntro, tags: tags2, coverImages } };
50637
+ } catch (cause) {
50638
+ if (!prepared || !verifiedCreation) throw cause;
50639
+ const created = verifiedCreation;
50640
+ const { presentableId } = created.exhibit;
50641
+ const error3 = normalizeCliError(cause);
50642
+ const metadata = failureMetadata(error3.code, error3.code === "EXHIBIT_WRITE_REJECTED" ? "rejected" : void 0);
50643
+ return {
50644
+ ...created,
50645
+ details: {
50646
+ status: "failed",
50647
+ ...machineCliError(error3, metadata),
50648
+ message: `\u5C55\u54C1\u5408\u96C6 ${presentableId} \u5DF2\u521B\u5EFA\uFF0C\u8D44\u6599\u64CD\u4F5C\u672A\u5B8C\u6210\uFF1A${error3.message}\u3002\u8BF7\u7528\u539F\u8D26\u53F7\u6267\u884C exhibit collection show ${presentableId} \u67E5\u8BE2\uFF0C\u6309\u63D0\u793A\u6838\u9A8C\u540E\u7528\u539F ID \u6267\u884C exhibit update\uFF0C\u52FF\u91CD\u590D\u521B\u5EFA\u3002`
50649
+ }
50650
+ };
50651
+ }
50610
50652
  }
50611
50653
  function unknown(record20, cause) {
50612
50654
  const reason = platformFailureMessage(cause, "");
@@ -50641,6 +50683,7 @@ var init_create5 = __esm({
50641
50683
  "src/domain/exhibit/collection/create.ts"() {
50642
50684
  "use strict";
50643
50685
  init_errors();
50686
+ init_errorOutcome();
50644
50687
  init_platformError();
50645
50688
  init_platformName();
50646
50689
  init_headlessInteraction();
@@ -50651,6 +50694,7 @@ var init_create5 = __esm({
50651
50694
  init_service3();
50652
50695
  init_pending();
50653
50696
  init_access();
50697
+ init_info();
50654
50698
  init_access2();
50655
50699
  init_types();
50656
50700
  }
@@ -53377,10 +53421,17 @@ function createExhibitCollectionCommand() {
53377
53421
  nodeOptions(type.command("list")).description("\u67E5\u8BE2\u4E3B\u4F535\u7684\u5B8C\u6574\u7C7B\u578B\u6811\u53CA\u8DEF\u5F84/code\uFF0C\u521B\u5EFA\u65F6\u4ECD\u9700\u9009\u62E9\u6700\u7EC8\u53F6\u5B50").action(async function() {
53378
53422
  output2(await listExhibitCollectionTypes(nodeContext(this)));
53379
53423
  });
53380
- nodeOptions(root.command("create")).description("\u5728\u672C\u4EBA\u8282\u70B9\u521B\u5EFA\u5C55\u54C1\u5408\u96C6\uFF0C\u4E0D\u7B7E\u8D44\u6E90\u3001\u4E0D\u53D1\u884C\u7248\u672C").option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID").option("--title <text>", "\u5408\u96C6\u6807\u9898\uFF0C1\u81F3100\u5B57\u7B26").option("--name <text>", "\u8282\u70B9\u5185\u552F\u4E00\u6388\u6743\u6807\u8BC6\uFF0C\u89C4\u8303\u5316\u540E1\u81F360\u5B57\u7B26").option("--type <code>", "\u542F\u7528\u7684\u5C55\u54C1\u5408\u96C6\u6700\u7EC8\u53F6\u5B50\u7C7B\u578B\u7F16\u53F7").action(async function(options2) {
53381
- output2(
53382
- await createExhibitCollection({ ...nodeContext(this), ...options2, node: await chooseNode2(this, options2.node) })
53383
- );
53424
+ nodeOptions(root.command("create")).description("\u5728\u672C\u4EBA\u8282\u70B9\u521B\u5EFA\u5C55\u54C1\u5408\u96C6\uFF0C\u4E0D\u7B7E\u8D44\u6E90\u3001\u4E0D\u53D1\u884C\u7248\u672C").option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID").option("--title <text>", "\u5408\u96C6\u6807\u9898\uFF0C1\u81F3100\u5B57\u7B26").option("--name <text>", "\u8282\u70B9\u5185\u552F\u4E00\u6388\u6743\u6807\u8BC6\uFF0C\u89C4\u8303\u5316\u540E1\u81F360\u5B57\u7B26").option("--type <code>", "\u542F\u7528\u7684\u5C55\u54C1\u5408\u96C6\u6700\u7EC8\u53F6\u5B50\u7C7B\u578B\u7F16\u53F7").option("--cover <path>", "\u660E\u786E\u7684\u672C\u5730JPEG/PNG/GIF\u5C01\u9762\uFF0C\u6700\u591A5MiB\uFF1B\u4E0D\u88C1\u526A").option("--intro <text>", "\u5408\u96C6\u7B80\u4ECB\uFF0C\u6700\u591A200\u5B57\u7B26").option("--tag <text>", "\u5408\u96C6\u6807\u7B7E\uFF0C\u53EF\u91CD\u590D\u4F20\u5165\uFF0C\u6700\u591A20\u9879\uFF0C\u6BCF\u9879\u6700\u591A20\u5B57\u7B26", collect).action(async function(options2) {
53425
+ const { node: node2, tag, ...fields4 } = options2;
53426
+ const result = await createExhibitCollection({
53427
+ ...nodeContext(this),
53428
+ ...fields4,
53429
+ tags: tag,
53430
+ node: await chooseNode2(this, node2)
53431
+ });
53432
+ output2(result);
53433
+ if ("details" in result && result.details?.status === "failed")
53434
+ process.exitCode = failureMetadata(result.details.code, result.details.category).exitCode;
53384
53435
  });
53385
53436
  nodeOptions(root.command("list")).description("\u67E5\u8BE2\u672C\u4EBA\u8282\u70B9\u81EA\u5EFA\u7684\u5C55\u54C1\u5408\u96C6\uFF0C\u6BCF\u987550\u6761").option("--node <id>", "\u672C\u4EBA\u8282\u70B9ID").option("--page <n>", PAGE_OPTION_DESCRIPTION).action(async function(options2) {
53386
53437
  const page = pageNumber(options2.page);
@@ -53476,6 +53527,7 @@ var init_collection2 = __esm({
53476
53527
  "src/commands/exhibit/collection.ts"() {
53477
53528
  "use strict";
53478
53529
  init_errors();
53530
+ init_errorOutcome();
53479
53531
  init_pagination();
53480
53532
  init_execution();
53481
53533
  init_node3();
@@ -53789,7 +53841,7 @@ var init_readInfo = __esm({
53789
53841
  import { existsSync as existsSync13 } from "fs";
53790
53842
  import path20 from "path";
53791
53843
  import { isDeepStrictEqual } from "util";
53792
- function assertTitle(title) {
53844
+ function assertListingTitle(title) {
53793
53845
  if (!title) {
53794
53846
  throw new CliError("\u8BF7\u8F93\u5165\u8D44\u6E90\u6807\u9898", "UPDATE_TITLE_REQUIRED");
53795
53847
  }
@@ -53905,20 +53957,29 @@ async function updateListingLocked(input3, authUserId, noFlags) {
53905
53957
  const identity2 = resolveBoundIdentity(input3.cwd, input3.file);
53906
53958
  const assertContext = resourceWriteContext(input3, identity2, authUserId);
53907
53959
  const info2 = input3.apis?.info ?? ((params) => FServiceAPI2.Resource.info(params));
53908
- const remote = await readResourceInfo(info2, identity2.resourceId);
53909
- assertContext();
53910
- assertRemoteResourceWritable({ info: remote, resourceId: identity2.resourceId, authUserId });
53911
- if (["feedUrl", "rssGuid", "rssPubDate"].some(
53912
- (key2) => typeof remote[key2] === "string" && remote[key2].trim()
53913
- )) {
53914
- throw new CliError("RSS \u76F8\u5173\u8D44\u6E90\u5F53\u524D\u4E0D\u652F\u6301\u4FEE\u6539\u5C55\u793A\u4FE1\u606F", "UPDATE_RSS_READONLY");
53915
- }
53916
- const before = listingView(remote);
53960
+ const readWritable = async () => {
53961
+ assertContext();
53962
+ const remote = await readResourceInfo(info2, identity2.resourceId);
53963
+ assertContext();
53964
+ assertRemoteResourceWritable({ info: remote, resourceId: identity2.resourceId, authUserId });
53965
+ if (!isResourceStatus(remote.status)) throw new CliError("\u5E73\u53F0\u8D44\u6E90\u72B6\u6001\u65E0\u6548\uFF0C\u62D2\u7EDD\u4FEE\u6539", "UPDATE_INFO_INVALID");
53966
+ if (["feedUrl", "rssGuid", "rssPubDate"].some(
53967
+ (key2) => typeof remote[key2] === "string" && remote[key2].trim()
53968
+ )) {
53969
+ throw new CliError("RSS \u76F8\u5173\u8D44\u6E90\u5F53\u524D\u4E0D\u652F\u6301\u4FEE\u6539\u5C55\u793A\u4FE1\u606F", "UPDATE_RSS_READONLY");
53970
+ }
53971
+ return remote;
53972
+ };
53973
+ const before = listingView(await readWritable());
53974
+ const recheckWritable = async () => {
53975
+ if ((await readWritable()).resourceName !== before.resourceName)
53976
+ throw new CliError("\u5E73\u53F0\u8D44\u6E90\u6388\u6743\u6807\u8BC6\u53D1\u751F\u53D8\u5316\uFF0C\u5DF2\u505C\u6B62\u4FEE\u6539", "UPDATE_INFO_INVALID");
53977
+ };
53917
53978
  input3.onCurrent?.(structuredClone(before));
53918
53979
  let { title, intro, cover, tags } = input3;
53919
53980
  const promptOutput = input3.json ? "stderr" : void 0;
53920
53981
  if (noFlags) {
53921
- title = await askField("\u6807\u9898", before.title, assertTitle, input3, promptOutput);
53982
+ title = await askField("\u6807\u9898", before.title, assertListingTitle, input3, promptOutput);
53922
53983
  cover = await askField(
53923
53984
  "\u5C01\u9762\u56FE\u7247\u8DEF\u5F84",
53924
53985
  before.coverImages.length ? "\u5DF2\u6709\u5C01\u9762" : "\u65E0\u5C01\u9762",
@@ -53944,7 +54005,7 @@ async function updateListingLocked(input3, authUserId, noFlags) {
53944
54005
  };
53945
54006
  title = title?.trim();
53946
54007
  if (title !== void 0) {
53947
- assertTitle(title);
54008
+ assertListingTitle(title);
53948
54009
  if (title !== before.title) payload.resourceTitle = title;
53949
54010
  }
53950
54011
  if (intro !== void 0) {
@@ -53973,10 +54034,18 @@ ${Object.entries(payload).filter(([key2]) => key2 !== "resourceId").map(([key2,
53973
54034
  input3.yes,
53974
54035
  promptOutput
53975
54036
  );
54037
+ await recheckWritable();
53976
54038
  assertContext();
53977
54039
  if (coverBytes) {
53978
54040
  payload.coverImages = [await uploadCover2(coverBytes, input3.apis)];
53979
- assertContext();
54041
+ try {
54042
+ await recheckWritable();
54043
+ assertContext();
54044
+ } catch (error3) {
54045
+ if (error3 instanceof CliError)
54046
+ throw new CliError(`${error3.message}\u3002\u5C01\u9762\u7D20\u6750\u5DF2\u4E0A\u4F20\uFF0C\u8D44\u6E90\u8D44\u6599\u672A\u63D0\u4EA4\u3002`, error3.code);
54047
+ throw error3;
54048
+ }
53980
54049
  }
53981
54050
  const update2 = input3.apis?.update ?? ((params) => FServiceAPI2.Resource.update(params));
53982
54051
  try {
@@ -54048,6 +54117,7 @@ var init_listing2 = __esm({
54048
54117
  init_platformError();
54049
54118
  init_api();
54050
54119
  init_readInfo();
54120
+ init_visibility();
54051
54121
  MAX_TITLE = 100;
54052
54122
  MAX_INTRO = 200;
54053
54123
  MAX_TAGS = 20;
@@ -54096,7 +54166,13 @@ function createUpdateCommand() {
54096
54166
  if (result.changed) displayListing(result.listing);
54097
54167
  }
54098
54168
  });
54099
- return withCommandExecution(command, AUTHOR_EXECUTION, {});
54169
+ return withCommandExecution(command, {
54170
+ ...AUTHOR_EXECUTION,
54171
+ preflight: ({ option }) => {
54172
+ const title = option("title");
54173
+ if (typeof title === "string") assertListingTitle(title.trim());
54174
+ }
54175
+ });
54100
54176
  }
54101
54177
  var init_update3 = __esm({
54102
54178
  "src/commands/listing/update.ts"() {
@@ -55430,7 +55506,7 @@ async function inspectAndApplyPendingOperation(input3) {
55430
55506
  const activeEnv2 = getEnv2();
55431
55507
  if (pending.env !== activeEnv2) {
55432
55508
  throw new CliError(
55433
- `\u672A\u51B3\u64CD\u4F5C\u5C5E\u4E8E ${pending.env} \u73AF\u5883\uFF0C\u672C\u6B21\u662F ${activeEnv2}\uFF1B\u8BF7\u5207\u6362 --env \u540E\u6062\u590D`,
55509
+ `\u672A\u51B3\u64CD\u4F5C\u5C5E\u4E8E ${pending.env} \u73AF\u5883\uFF0C\u672C\u6B21\u662F ${activeEnv2}\u3002\u8BF7\u4F7F\u7528\u539F\u73AF\u5883\u6062\u590D\u3002`,
55434
55510
  "PENDING_OPERATION_ENV_MISMATCH"
55435
55511
  );
55436
55512
  }
@@ -59344,7 +59420,7 @@ ${JSON.stringify({ before: edit.draft, after: candidate }, null, 2)}`;
59344
59420
  const prompts = input3.prompts ?? headlessPrompts;
59345
59421
  if (!await prompts.confirmDestructive(
59346
59422
  preview2,
59347
- "\u786E\u8BA4\u5BFC\u5165\u6240\u9009\u5143\u6570\u636E",
59423
+ "\u5BFC\u5165\u6240\u9009\u5143\u6570\u636E",
59348
59424
  input3.yes,
59349
59425
  prompts.isInteractive(),
59350
59426
  (message, defaultYes) => prompts.confirmQuestion(message, defaultYes)
@@ -59448,7 +59524,7 @@ function createVersionDraftCommand() {
59448
59524
  )
59449
59525
  );
59450
59526
  });
59451
- addSharedOptions(draft.command("import-storage")).description("\u5BFC\u5165\u5B58\u50A8\u5143\u6570\u636E\uFF1A\u4F9D\u8D56\u5408\u5E76\uFF0C\u9009\u5B9A\u5C5E\u6027/\u914D\u7F6E\u9002\u914D\u540E\u66FF\u6362\uFF0C\u4E0D\u6539\u53D8\u6587\u4EF6\u6765\u6E90").argument("<objectId>", "\u5B58\u50A8\u5BF9\u8C61ID").requiredOption("--groups <groups>", "attributes/options\u9017\u53F7\u7EC4\u5408").action(async function(objectId, options2) {
59527
+ addSharedOptions(draft.command("import-storage")).description("\u5BFC\u5165\u5B58\u50A8\u5143\u6570\u636E\uFF1A\u9009\u5B9A\u5C5E\u6027\u6216\u914D\u7F6E\u9002\u914D\u540E\u66FF\u6362\uFF0C\u4FDD\u7559\u5DF2\u6709\u4F9D\u8D56\u548C\u6587\u4EF6\u6765\u6E90").argument("<objectId>", "\u5B58\u50A8\u5BF9\u8C61ID").requiredOption("--groups <groups>", "attributes/options\u9017\u53F7\u7EC4\u5408").action(async function(objectId, options2) {
59452
59528
  const shared = readSharedOptions(this);
59453
59529
  const result = await importStorageMetadata({
59454
59530
  cwd: resolveCwd(shared.cwd),
@@ -60500,7 +60576,7 @@ function machineOutputHelp(command) {
60500
60576
  for (let current = command; current?.parent; current = current.parent) names2.unshift(current.name());
60501
60577
  const path30 = names2.join(" ");
60502
60578
  const details3 = {
60503
- login: "\u767B\u5F55\u4E0D\u652F\u6301 --json\uFF0C\u987B\u7531\u7528\u6237\u5728\u4EA4\u4E92\u7EC8\u7AEF\u5B8C\u6210\uFF1B\u6210\u529F\u63D0\u793A\u4E3A\u6587\u672C\u3002",
60579
+ login: "\u5BC6\u7801\u767B\u5F55\u6210\u529F\u65F6\u8F93\u51FA\u6587\u672C\uFF0C\u53EF\u7528 --json \u8BFB\u53D6\u7ED3\u6784\u5316\u9519\u8BEF\u3002\u9A8C\u8BC1\u7801\u767B\u5F55\u987B\u4F7F\u7528\u4EA4\u4E92\u7EC8\u7AEF\u5E76\u7701\u7565 --json\u3002",
60504
60580
  create: "\u6210\u529F JSON\uFF1AresourceId/name/typeCode\uFF1Bname \u4E3A\u77ED\u540D\u79F0\u3002\u521B\u5EFA\u4E0D\u7B49\u4E8E\u53D1\u884C\u3002",
60505
60581
  "create-version": "\u6210\u529F JSON\uFF1AresourceId/outcome/version/draftRetained\uFF1Bpublished \u624D\u8868\u793A\u5DF2\u53D1\u884C\u3002",
60506
60582
  "update-version": "\u6210\u529F JSON\uFF1AresourceId/outcome/version/draftRetained\uFF1Bpublished \u624D\u8868\u793A\u5DF2\u53D1\u884C\u3002",