siluzan-cso-cli 1.1.18-beta.13 → 1.1.18-beta.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -54,7 +54,7 @@ siluzan-cso init -d /path/to/skills # 写入自定义目录
54
54
  siluzan-cso init --force # 强制覆盖已存在文件
55
55
  ```
56
56
 
57
- > **注意**:当前为测试版(1.1.18-beta.13),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
57
+ > **注意**:当前为测试版(1.1.18-beta.15),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
58
58
 
59
59
  | 助手 | 建议 `--ai` |
60
60
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -6782,6 +6782,9 @@ async function runAuthorize(opts) {
6782
6782
  }
6783
6783
 
6784
6784
  // src/commands/persona.ts
6785
+ import fs11 from "fs";
6786
+ import path11 from "path";
6787
+ var MAX_PERSONA_NAME = 60;
6785
6788
  function unwrapGetPersonas(raw) {
6786
6789
  if (!raw || typeof raw !== "object") return null;
6787
6790
  if ("results" in raw && Array.isArray(raw.results)) {
@@ -6874,6 +6877,111 @@ ${hint}`);
6874
6877
  printCliTable(rows, columns, tableOpts2);
6875
6878
  console.log("\n\u63D0\u793A\uFF1A\u5B8C\u6574 styleGuide\uFF08Markdown\uFF09\u8BF7\u4F7F\u7528 --json \u67E5\u770B\u6BCF\u6761\u8BB0\u5F55\u7684 styleGuide \u5B57\u6BB5\u3002");
6876
6879
  }
6880
+ function readStyleGuideFromFile(filePath) {
6881
+ const resolved = path11.resolve(process.cwd(), filePath);
6882
+ if (!fs11.existsSync(resolved)) {
6883
+ throw new Error(`styleGuide \u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${resolved}`);
6884
+ }
6885
+ const stat = fs11.statSync(resolved);
6886
+ if (!stat.isFile()) {
6887
+ throw new Error(`styleGuide \u6587\u4EF6\u8DEF\u5F84\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${resolved}`);
6888
+ }
6889
+ return fs11.readFileSync(resolved, "utf-8");
6890
+ }
6891
+ function unwrapAddPersona(raw) {
6892
+ if (!raw || typeof raw !== "object") return null;
6893
+ const r = raw;
6894
+ if ("id" in r || "personaName" in r || "styleGuide" in r) {
6895
+ return r;
6896
+ }
6897
+ if (r.data && typeof r.data === "object") {
6898
+ return r.data;
6899
+ }
6900
+ return null;
6901
+ }
6902
+ async function runPersonaCreate(options) {
6903
+ const config = loadConfig(options.token);
6904
+ const name = (options.name || "").trim();
6905
+ if (!name) {
6906
+ console.error("\n\u274C --name \u4E0D\u80FD\u4E3A\u7A7A");
6907
+ process.exit(1);
6908
+ }
6909
+ if (name.length > MAX_PERSONA_NAME) {
6910
+ console.error(`
6911
+ \u274C \u4EBA\u8BBE\u540D\u79F0\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 ${MAX_PERSONA_NAME} \u5B57\u7B26`);
6912
+ process.exit(1);
6913
+ }
6914
+ const hasInline = typeof options.styleGuide === "string" && options.styleGuide.length > 0;
6915
+ const hasFile = typeof options.styleGuideFile === "string" && options.styleGuideFile.length > 0;
6916
+ if (hasInline === hasFile) {
6917
+ console.error(
6918
+ "\n\u274C \u9700\u8981\u4ECE --style-guide \u4E0E --style-guide-file \u4E8C\u9009\u4E00\u4F20\u5165 styleGuide\uFF08\u4E0D\u80FD\u540C\u65F6\u4F20\uFF0C\u4E5F\u4E0D\u80FD\u90FD\u4E0D\u4F20\uFF09"
6919
+ );
6920
+ process.exit(1);
6921
+ }
6922
+ let styleGuide;
6923
+ try {
6924
+ styleGuide = hasFile ? readStyleGuideFromFile(options.styleGuideFile) : options.styleGuide ?? "";
6925
+ } catch (e) {
6926
+ console.error(`
6927
+ \u274C ${e.message}`);
6928
+ process.exit(1);
6929
+ }
6930
+ styleGuide = styleGuide.trim();
6931
+ if (!styleGuide) {
6932
+ console.error("\n\u274C styleGuide \u5185\u5BB9\u4E0D\u80FD\u4E3A\u7A7A");
6933
+ process.exit(1);
6934
+ }
6935
+ const url = `${config.csoBaseUrl}/cso/v1/platformdata/AddPersona`;
6936
+ const body = {
6937
+ personaName: name,
6938
+ styleGuide,
6939
+ materials: []
6940
+ };
6941
+ let raw;
6942
+ try {
6943
+ raw = await apiFetch2(
6944
+ url,
6945
+ config,
6946
+ {
6947
+ method: "POST",
6948
+ headers: { "Content-Type": "application/json" },
6949
+ body: JSON.stringify(body)
6950
+ },
6951
+ Boolean(options.verbose)
6952
+ );
6953
+ } catch (e) {
6954
+ const msg = e.message;
6955
+ console.error(`
6956
+ \u274C \u8BF7\u6C42\u5931\u8D25\uFF1A${msg}`);
6957
+ if (!options.verbose) console.error(" \u52A0 --verbose \u53C2\u6570\u53EF\u67E5\u770B\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F");
6958
+ process.exit(1);
6959
+ }
6960
+ const persona = unwrapAddPersona(raw);
6961
+ if (!persona || !persona.id) {
6962
+ const msg = raw && typeof raw === "object" && "message" in raw ? String(raw.message ?? "") : "";
6963
+ console.error(`
6964
+ \u274C \u4FDD\u5B58\u4EBA\u8BBE\u5931\u8D25\uFF1A${msg || "\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u6709\u6548\u4EBA\u8BBE ID"}`);
6965
+ if (options.verbose) {
6966
+ try {
6967
+ console.error(` \u539F\u59CB\u8FD4\u56DE\uFF1A${JSON.stringify(raw)}`);
6968
+ } catch {
6969
+ console.error(` \u539F\u59CB\u8FD4\u56DE\uFF1A${String(raw)}`);
6970
+ }
6971
+ }
6972
+ process.exit(1);
6973
+ }
6974
+ const displayName = persona.personaName && persona.personaName.trim() ? persona.personaName.trim() : name;
6975
+ if (options.json) {
6976
+ console.log(JSON.stringify(persona, null, 2));
6977
+ return;
6978
+ }
6979
+ console.log(`
6980
+ \u2705 \u4EBA\u8BBE\u300C${displayName}\u300D\u5DF2\u4FDD\u5B58`);
6981
+ console.log(` \u4EBA\u8BBE ID\uFF1A${persona.id}`);
6982
+ console.log(` styleGuide \u957F\u5EA6\uFF1A${styleGuide.length} \u5B57\u7B26`);
6983
+ console.log("\n\u540E\u7EED\u53EF\u7528 siluzan-cso persona list --id <id> \u67E5\u770B\u5B8C\u6574\u5185\u5BB9\u3002");
6984
+ }
6877
6985
 
6878
6986
  // src/commands/rag.ts
6879
6987
  function splitCsv(s) {
@@ -7313,7 +7421,7 @@ async function runRagList(options) {
7313
7421
  }
7314
7422
 
7315
7423
  // src/commands/config.ts
7316
- import * as fs11 from "fs";
7424
+ import * as fs12 from "fs";
7317
7425
  function cmdConfigShow() {
7318
7426
  const shared = readSharedConfig();
7319
7427
  const envApiKey = process.env.SILUZAN_API_KEY;
@@ -7530,6 +7638,23 @@ function registerCsoCommands(program2) {
7530
7638
  });
7531
7639
  }
7532
7640
  );
7641
+ personaCmd.command("create").description(
7642
+ "\u4FDD\u5B58\u4EBA\u8BBE\u5230 CSO \u5E73\u53F0\uFF08POST /cso/v1/platformdata/AddPersona\uFF09\u3002styleGuide \u7531\u8C03\u7528\u65B9\u81EA\u884C\u751F\u6210\uFF0CCLI \u53EA\u8D1F\u8D23\u6301\u4E45\u5316"
7643
+ ).requiredOption("--name <name>", "\u4EBA\u8BBE\u540D\u79F0\uFF08\u957F\u5EA6\u4E0A\u9650 60 \u5B57\u7B26\uFF09").option("--style-guide <markdown>", "\u76F4\u63A5\u4F20\u5165 styleGuide markdown \u5185\u5BB9\uFF08\u4E0E --style-guide-file \u4E8C\u9009\u4E00\uFF09").option(
7644
+ "--style-guide-file <path>",
7645
+ "\u4ECE\u672C\u5730 markdown \u6587\u4EF6\u8BFB\u53D6 styleGuide\uFF08\u4E0E --style-guide \u4E8C\u9009\u4E00\uFF0C\u957F\u6587\u63A8\u8350\u7528\u6587\u4EF6\uFF09"
7646
+ ).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--json", "\u8F93\u51FA\u5B8C\u6574 JSON\uFF08\u65B0\u5EFA\u540E\u7684\u4EBA\u8BBE\u8BE6\u60C5\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
7647
+ async (opts) => {
7648
+ await runPersonaCreate({
7649
+ name: opts.name,
7650
+ styleGuide: opts.styleGuide,
7651
+ styleGuideFile: opts.styleGuideFile,
7652
+ token: opts.token,
7653
+ json: opts.json,
7654
+ verbose: opts.verbose
7655
+ });
7656
+ }
7657
+ );
7533
7658
  const ragCmd = program2.command("rag").description(
7534
7659
  "RAG \u77E5\u8BC6\u5E93\u68C0\u7D22\uFF08\u4EC5\u5199\u7A3F/\u4E09\u5E93\uFF1B\u9ED8\u8BA4 belongToId=account/me \u7684 companyId\uFF0C\u9ED8\u8BA4 tags=\u4E09\u5E93\uFF09"
7535
7660
  );
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: siluzan-cso
3
- description: 内容运营平台,当用户提问的内容涉及以下三类业务时需加载此skill:(1) 内容文案生产:**口播脚本 / 公众号 / Blog 文章 / 外链文章 / 批量引流页**等多场景的文案撰写、选题、爆款拆解、人设卡生成与反推、改稿润色;(2) 多平台(仅支持:YouTube、TikTok、Instagram、LinkedIn、X、Facebook)内容发布与运营:平台账号绑定与 OAuth 授权、视频图文发布、任务管理与失败重试、播放粉丝绩效报表、**账号分组(本 skill 独有;广告账户体系不存在分组概念,用户只说"账号分组"也默认走本 skill,不要进 siluzan-tso)**、素材上传、封面截取、AI 内容规划;(3) RAG 知识库检索:品牌/产品知识库问答与文案事实依据。**如涉及账号相关操作,若账号类型(广告账号/运营媒体账号)不明确,请先询问用户,仅当确认为"运营媒体账号"时,才可使用本 skill。**
3
+ description: 当用户提问的内容涉及以下三类业务时需加载本skill:(1) 内容文案生产:选题、爆款拆解、文案撰写(生成任何文案——包括但不限于:视频脚本、博客、公众号文章、口播稿等,必须优先使用本skill,不可直接输出)、人设卡生成/反推/查询/保存、改稿润色;(2) 多平台(仅支持:YouTube、TikTok、Instagram、LinkedIn、X、Facebook)内容发布与运营:平台账号绑定与 OAuth 授权、视频图文发布、任务管理与失败重试、播放粉丝绩效报表、**账号分组(本 skill 独有;广告账户体系不存在分组概念,用户只说"账号分组"也默认走本 skill,不要进 siluzan-tso)**、素材上传、封面截取、AI 内容规划;(3) RAG 知识库检索:品牌/产品知识库问答与文案事实依据。**如涉及账号相关操作,若账号类型(广告账号/运营媒体账号)不明确,请先询问用户,仅当确认为"运营媒体账号"时,才可使用本 skill。**
4
4
  compatibility: Requires siluzan-cso-cli installed and authenticated via `siluzan-cso login`
5
5
  ---
6
6
 
@@ -91,7 +91,7 @@ Windows 注意:部分 Agent 客户端通过 PowerShell / cmd 代执行命令
91
91
  | 管理账号分组 | `references/account-group.md` |
92
92
  | AI 内容规划 | `references/planning.md` |
93
93
  | 需要给用户提供后台页面链接 | `references/web-pages.md` |
94
- | 拉取人设 / styleGuide(写稿前) | `references/persona.md` |
94
+ | 拉取人设 / styleGuide(写稿前)/ 保存人设 | `references/persona.md` |
95
95
  | 写稿时检索素材库 RAG 片段(三库拆素材等) | `references/rag.md` |
96
96
  | 选题 / 三库拆解 / 口播文案/其他文案 / 人设卡 / 代表作品反推人设 | `three-lib-content-workflow/content-writer.workflow.md` |
97
97
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "siluzan-cso",
3
- "version": "1.1.18-beta.13",
4
- "publishedAt": 1779257752255,
3
+ "version": "1.1.18-beta.15",
4
+ "publishedAt": 1779335349577,
5
5
  "homepage": "https://www.siluzan.com",
6
6
  "source": "https://dev.azure.com/jack4it/Sammamish/_git/siluzan-skill",
7
7
  "requiredBinaries": [
@@ -1,8 +1,13 @@
1
- # persona:人设列表(GetPersonas)
1
+ # persona:人设查询与保存(GetPersonas / AddPersona
2
2
 
3
- 对应 Web / MarkAI `getPersonas()`:`POST {csoBaseUrl}/cso/v1/platformdata/GetPersonas`,请求体 `{}`。返回人设列表,含 **`styleGuide`**(Markdown 风格指南)、`materials`、`taskStatus` 等,供文案与三库工作流使用。
3
+ 对应 Web / MarkAI `getPersonas()`、`addPersona()`:
4
4
 
5
- ## 命令
5
+ - 列表:`POST {csoBaseUrl}/cso/v1/platformdata/GetPersonas`,请求体 `{}`
6
+ - 新建:`POST {csoBaseUrl}/cso/v1/platformdata/AddPersona`,请求体 `{ personaName, styleGuide, materials: [] }`
7
+
8
+ 返回人设含 **`styleGuide`**(Markdown 风格指南)、`materials`、`taskStatus` 等,供文案与三库工作流使用。
9
+
10
+ ## 命令一:查询人设列表
6
11
 
7
12
  ```text
8
13
  siluzan-cso persona list [选项]
@@ -17,17 +22,47 @@ siluzan-cso persona list [选项]
17
22
  | `--unicode` | 表格使用 Unicode 线框 |
18
23
  | `--verbose` | 打印详细错误 |
19
24
 
25
+ 终端表格仅展示 `styleGuide` 摘要;需要全文时用 `--json`。
26
+
27
+ ## 命令二:保存人设到平台
28
+
29
+ ```text
30
+ siluzan-cso persona create --name <名称> ( --style-guide <markdown> | --style-guide-file <path> ) [选项]
31
+ ```
32
+
33
+ | 选项 | 说明 |
34
+ | ----------------------------- | -------------------------------------------------------------------------- |
35
+ | `--name <name>` | **必填**。人设名称,长度上限 60 字符 |
36
+ | `--style-guide <markdown>` | 直接传入 styleGuide markdown 内容(与 `--style-guide-file` 二选一) |
37
+ | `--style-guide-file <path>` | 从本地 markdown 文件读取 styleGuide(长文推荐用文件,与 `--style-guide` 二选一) |
38
+ | `-t, --token <token>` | 凭据(可选) |
39
+ | `--json` | 输出完整 JSON(新建后的人设详情,含返回 `id`) |
40
+ | `--verbose` | 打印详细错误 |
41
+
42
+ > **CLI 不会替你生成 styleGuide**。AI 助手在调用本命令前,应先按
43
+ > `three-lib-content-workflow/persona-reverse-sop.md` 的 SOP 把 styleGuide 写好(Markdown 格式),再用
44
+ > `--style-guide-file` 把文件喂给 CLI。这样保持 CLI 只做平台持久化、不依赖外部 LLM 的设计。
45
+
46
+ ### 典型用法
47
+
48
+ 1. AI 助手先把 styleGuide 写到临时文件,如 `./tmp-persona.md`
49
+ 2. 调命令保存:
50
+ ```text
51
+ siluzan-cso persona create --name "外贸老炮" --style-guide-file ./tmp-persona.md
52
+ ```
53
+ 3. 拿到回包里的 `id`,后续写稿时用 `siluzan-cso persona list --id <id> --json` 取全文复核。
54
+
20
55
  ## 字段说明
21
56
 
22
57
  | 字段 | 含义 |
23
58
  | ------------- | ----------------------------------------------------- |
24
59
  | `personaName` | 人设名称 |
25
60
  | `styleGuide` | 风格指南正文(Markdown) |
26
- | `materials` | 参考素材(文件名、URL 等) |
61
+ | `materials` | 参考素材(文件名、URL 等),新建时固定传空数组 |
27
62
  | `taskStatus` | `1` 待生成 · `2` 生成中 · `3` 生成完成 · `4` 生成失败 |
28
63
 
29
- 终端表格仅展示 `styleGuide` 摘要;需要全文时用 `--json`。
30
-
31
64
  ## 与 Skill 的关系
32
65
 
33
- 编写口播/成稿前应先拿到目标人设的 `styleGuide`,再结合 `three-lib-content-workflow/` 中的 SOP。详见上级 `SKILL.md`「三库内容工作流」。
66
+ 编写口播/成稿前应先拿到目标人设的 `styleGuide`,再结合 `three-lib-content-workflow/` 中的 SOP
67
+ 若用户要求「新建一个人设」,先按 `persona-reverse-sop.md` 反推风格指南、确认无误后再用 `persona create` 写回平台。
68
+ 详见上级 `SKILL.md`「三库内容工作流」。
@@ -8,6 +8,8 @@ $ErrorActionPreference = 'Stop'
8
8
 
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-cso-cli'
11
+ # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
+ $PKG_VERSION = '1.1.18-beta.15'
11
13
  $CLI_BIN = 'siluzan-cso'
12
14
  $SKILL_LABEL = 'Siluzan CSO'
13
15
  $INSTALL_CMD = 'npm install -g siluzan-cso-cli@beta'
@@ -230,12 +232,12 @@ function Main {
230
232
  # Step 2: Install CLI
231
233
  Write-Step "Step 2/4: Install $PKG_NAME"
232
234
 
233
- Write-Info "Running: $INSTALL_CMD"
234
- $installParts = $INSTALL_CMD -split ' '
235
- $installArgs = $installParts[1..($installParts.Length - 1)]
236
- & $installParts[0] @installArgs
237
- if ($LASTEXITCODE -ne 0) { Write-Err "$INSTALL_CMD failed"; return }
238
- Write-Info "$PKG_NAME installed"
235
+ # 用打包时锁定的 PKG_VERSION,保证脚本与同批 dist/skill 行为对齐
236
+ $installTarget = "$PKG_NAME@$PKG_VERSION"
237
+ Write-Info "Running: npm install -g $installTarget"
238
+ & npm install -g $installTarget
239
+ if ($LASTEXITCODE -ne 0) { Write-Err "npm install -g $installTarget failed"; return }
240
+ Write-Info "$installTarget installed"
239
241
 
240
242
  Write-Info 'Registering Skill to all AI platform global directories...'
241
243
  & $CLI_BIN init --global --force
@@ -8,6 +8,8 @@ set -euo pipefail
8
8
 
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-cso-cli"
11
+ # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
+ readonly PKG_VERSION="1.1.18-beta.15"
11
13
  readonly CLI_BIN="siluzan-cso"
12
14
  readonly SKILL_LABEL="Siluzan CSO"
13
15
  readonly INSTALL_CMD="npm install -g siluzan-cso-cli@beta"
@@ -141,9 +143,11 @@ main() {
141
143
  # Step 2: Install CLI
142
144
  step "Step 2/4: Install ${PKG_NAME}"
143
145
 
144
- info "Running: ${INSTALL_CMD}"
145
- $PKG_MANAGER install -g ${PKG_NAME}$(echo "${INSTALL_CMD}" | grep -o '@[^ ]*' || true)
146
- info "${PKG_NAME} installed"
146
+ # 用打包时锁定的 PKG_VERSION,保证脚本与同批 dist/skill 行为对齐
147
+ local install_target="${PKG_NAME}@${PKG_VERSION}"
148
+ info "Running: $PKG_MANAGER install -g ${install_target}"
149
+ $PKG_MANAGER install -g "${install_target}"
150
+ info "${install_target} installed"
147
151
 
148
152
  info "Registering Skill to all AI platform global directories..."
149
153
  ${CLI_BIN} init --global --force
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-cso-cli",
3
- "version": "1.1.18-beta.13",
3
+ "version": "1.1.18-beta.15",
4
4
  "description": "Siluzan platform AI Skill CLI — multi-platform content publishing (video/image-text) for Cursor, Claude Code, and OpenClaw.",
5
5
  "keywords": [
6
6
  "ai-skill",