siluzan-cso-cli 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1936,7 +1936,7 @@ var require_semver2 = __commonJS({
1936
1936
  });
1937
1937
 
1938
1938
  // src/index.ts
1939
- import { Command } from "commander";
1939
+ import { Command, Option } from "commander";
1940
1940
 
1941
1941
  // src/commands/init.ts
1942
1942
  import * as fs2 from "fs/promises";
@@ -2794,6 +2794,21 @@ var DEFAULT_AGENT_BASE = "https://agent.mysiluzan.com";
2794
2794
 
2795
2795
  // src/commands/login.ts
2796
2796
  async function runLogin(opts = {}) {
2797
+ if (opts.token !== void 0) {
2798
+ const token = opts.token.trim();
2799
+ if (!token) {
2800
+ console.error("\n\u274C Token \u4E0D\u80FD\u4E3A\u7A7A\u3002\n");
2801
+ process.exit(1);
2802
+ }
2803
+ writeSharedConfig({ authToken: token });
2804
+ refreshSiluzanUser(DEFAULT_API_BASE, { authToken: token });
2805
+ console.log(`
2806
+ \u2705 Token \u5DF2\u4FDD\u5B58\uFF08${maskSecret(token)}\uFF09`);
2807
+ console.log(` \u914D\u7F6E\u6587\u4EF6\uFF1A${CONFIG_FILE}`);
2808
+ console.log("\n\u73B0\u5728\u53EF\u4EE5\u8FD0\u884C\uFF1A");
2809
+ console.log(" siluzan-cso list-accounts \u67E5\u770B\u53EF\u7528\u5A92\u4F53\u8D26\u53F7\n");
2810
+ return;
2811
+ }
2797
2812
  if (opts.apiKey !== void 0) {
2798
2813
  const key = opts.apiKey.trim();
2799
2814
  if (!key) {
@@ -2814,73 +2829,37 @@ async function runLogin(opts = {}) {
2814
2829
  const prompt = (q) => new Promise((res) => rl.question(q, (a) => res(a.trim())));
2815
2830
  console.log("\n\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
2816
2831
  console.log(" Siluzan CSO \u767B\u5F55");
2817
- console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
2818
- console.log("\n\u8BF7\u9009\u62E9\u767B\u5F55\u65B9\u5F0F\uFF1A");
2819
- console.log(" 1. API Key\uFF08\u63A8\u8350\uFF0C\u4E0E siluzan-tso \u5171\u7528\uFF09");
2820
- console.log(" 2. JWT Token\n");
2821
- const choice = await prompt("\u8F93\u5165\u5E8F\u53F7\uFF08\u9ED8\u8BA4 1\uFF09\uFF1A");
2822
- if (!choice || choice === "1") {
2823
- if (shared.apiKey) {
2824
- console.log(`
2825
- \u5DF2\u68C0\u6D4B\u5230\u5DF2\u4FDD\u5B58\u7684 API Key\uFF08${maskSecret(shared.apiKey)}\uFF09\u3002`);
2826
- const ans = await prompt("\u662F\u5426\u8986\u76D6\uFF1F(y/N) ");
2827
- if (ans.toLowerCase() !== "y") {
2828
- rl.close();
2829
- console.log("\n\u5DF2\u53D6\u6D88\u3002\n");
2830
- return;
2831
- }
2832
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\n");
2833
+ if (shared.apiKey) {
2834
+ console.log(`\u5DF2\u68C0\u6D4B\u5230\u5DF2\u4FDD\u5B58\u7684 API Key\uFF08${maskSecret(shared.apiKey)}\uFF09\u3002`);
2835
+ const ans = await prompt("\u662F\u5426\u8986\u76D6\uFF1F(y/N) ");
2836
+ if (ans.toLowerCase() !== "y") {
2837
+ rl.close();
2838
+ console.log("\n\u5DF2\u53D6\u6D88\u3002\n");
2839
+ return;
2832
2840
  }
2833
- console.log(`
2841
+ }
2842
+ console.log(`
2834
2843
  \u8BF7\u524D\u5F80\uFF1A${DEFAULT_WEB_BASE}/v3/foreign_trade/settings/apiKeyManagement`);
2835
- console.log("\u521B\u5EFA API Key \u540E\u7C98\u8D34\u5230\u4E0B\u65B9\u3002\n");
2836
- let apiKey = "";
2837
- for (let i = 0; i < 3; i++) {
2838
- const input = await prompt("\u7C98\u8D34 API Key\uFF1A");
2839
- if (input) {
2840
- apiKey = input;
2841
- break;
2842
- }
2843
- console.log("\u274C API Key \u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u8BD5");
2844
- }
2845
- rl.close();
2846
- if (!apiKey) {
2847
- console.error("\n\u274C \u591A\u6B21\u8F93\u5165\u65E0\u6548\u3002\n");
2848
- process.exit(1);
2849
- }
2850
- writeSharedConfig({ apiKey });
2851
- refreshSiluzanUser(DEFAULT_API_BASE, { authToken: "", apiKey });
2852
- console.log(`
2853
- \u2705 API Key \u5DF2\u4FDD\u5B58\uFF08${maskSecret(apiKey)}\uFF09`);
2854
- } else {
2855
- if (shared.authToken) {
2856
- console.log(`
2857
- \u5DF2\u68C0\u6D4B\u5230\u5DF2\u4FDD\u5B58\u7684 Token\uFF08${maskSecret(shared.authToken)}\uFF09\u3002`);
2858
- const ans = await prompt("\u662F\u5426\u8986\u76D6\uFF1F(y/N) ");
2859
- if (ans.toLowerCase() !== "y") {
2860
- rl.close();
2861
- console.log("\n\u5DF2\u53D6\u6D88\u3002\n");
2862
- return;
2863
- }
2864
- }
2865
- let token = "";
2866
- for (let i = 0; i < 3; i++) {
2867
- const input = await prompt("\u7C98\u8D34 Token\uFF1A");
2868
- if (input.split(".").length === 3) {
2869
- token = input;
2870
- break;
2871
- }
2872
- if (input) console.log("\u274C \u683C\u5F0F\u4E0D\u6B63\u786E\uFF08\u5E94\u4E3A JWT\uFF0C\u4E09\u6BB5\u7528 . \u5206\u9694\uFF09\uFF0C\u8BF7\u91CD\u8BD5");
2844
+ console.log("\u521B\u5EFA API Key \u540E\u7C98\u8D34\u5230\u4E0B\u65B9\u3002\n");
2845
+ let apiKey = "";
2846
+ for (let i = 0; i < 3; i++) {
2847
+ const input = await prompt("\u7C98\u8D34 API Key\uFF1A");
2848
+ if (input) {
2849
+ apiKey = input;
2850
+ break;
2873
2851
  }
2874
- rl.close();
2875
- if (!token) {
2876
- console.error("\n\u274C \u591A\u6B21\u8F93\u5165\u65E0\u6548\u3002\n");
2877
- process.exit(1);
2878
- }
2879
- writeSharedConfig({ authToken: token });
2880
- refreshSiluzanUser(DEFAULT_API_BASE, { authToken: token });
2881
- console.log(`
2882
- \u2705 Token \u5DF2\u4FDD\u5B58\uFF08${maskSecret(token)}\uFF09`);
2852
+ console.log("\u274C API Key \u4E0D\u80FD\u4E3A\u7A7A\uFF0C\u8BF7\u91CD\u8BD5");
2883
2853
  }
2854
+ rl.close();
2855
+ if (!apiKey) {
2856
+ console.error("\n\u274C \u591A\u6B21\u8F93\u5165\u65E0\u6548\u3002\n");
2857
+ process.exit(1);
2858
+ }
2859
+ writeSharedConfig({ apiKey });
2860
+ refreshSiluzanUser(DEFAULT_API_BASE, { authToken: "", apiKey });
2861
+ console.log(`
2862
+ \u2705 API Key \u5DF2\u4FDD\u5B58\uFF08${maskSecret(apiKey)}\uFF09`);
2884
2863
  console.log(` \u914D\u7F6E\u6587\u4EF6\uFF1A${CONFIG_FILE}`);
2885
2864
  console.log("\n\u73B0\u5728\u53EF\u4EE5\u8FD0\u884C\uFF1A");
2886
2865
  console.log(" siluzan-cso list-accounts \u67E5\u770B\u53EF\u7528\u5A92\u4F53\u8D26\u53F7");
@@ -6613,8 +6592,8 @@ configCmd.command("set").description("\u4FDD\u5B58\u914D\u7F6E\u5230 ~/.siluzan/
6613
6592
  cmdConfigSet({ apiKey: opts.apiKey, token: opts.token, apiBase: opts.apiBase });
6614
6593
  });
6615
6594
  configCmd.command("clear").description("\u6E05\u7A7A\u5DF2\u4FDD\u5B58\u7684 Token").action(() => cmdConfigClear());
6616
- program.command("login").description("\u5F15\u5BFC\u5B8C\u6210 Siluzan \u8D26\u53F7\u767B\u5F55\uFF0C\u4FDD\u5B58 API Key \u6216 Token \u5230\u672C\u5730").option("--api-key <key>", "\u76F4\u63A5\u4FDD\u5B58 API Key\uFF08\u8DF3\u8FC7\u4EA4\u4E92\u5F0F\u6D41\u7A0B\uFF0C\u4E0E siluzan-tso \u5171\u7528\uFF09").action(async (opts) => {
6617
- await runLogin({ apiKey: opts.apiKey });
6595
+ program.command("login").description("\u5F15\u5BFC\u5B8C\u6210 Siluzan \u8D26\u53F7\u767B\u5F55\uFF0C\u4FDD\u5B58 API Key \u5230\u672C\u5730").option("--api-key <key>", "\u76F4\u63A5\u4FDD\u5B58 API Key\uFF08\u8DF3\u8FC7\u4EA4\u4E92\u5F0F\u6D41\u7A0B\uFF0C\u4E0E siluzan-tso \u5171\u7528\uFF09").addOption(new Option("--token <token>", "\u76F4\u63A5\u4FDD\u5B58 JWT Token").hideHelp()).action(async (opts) => {
6596
+ await runLogin({ apiKey: opts.apiKey, token: opts.token });
6618
6597
  });
6619
6598
  program.command("update").description("\u68C0\u67E5\u5E76\u66F4\u65B0 siluzan-cso-cli \u81F3\u6700\u65B0\u7248\u672C\uFF0C\u540C\u6B65\u5237\u65B0\u6240\u6709\u5DF2\u5B89\u88C5\u7684 skill \u6587\u4EF6").option("--force", "\u8DF3\u8FC7\u7248\u672C\u6BD4\u8F83\uFF0C\u5F3A\u5236\u91CD\u65B0\u5B89\u88C5\u5E76\u5237\u65B0 skill \u6587\u4EF6", false).option("--skip-init", "\u4EC5\u66F4\u65B0 CLI\uFF0C\u4E0D\u91CD\u65B0\u521D\u59CB\u5316 skill \u6587\u4EF6", false).action(async (opts) => {
6620
6599
  await runUpdate({ force: opts.force, skipInit: opts.skipInit });
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-cso",
3
- "version": "1.0.1",
4
- "publishedAt": 1775632871968
3
+ "version": "1.0.2",
4
+ "publishedAt": 1775638574225
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-cso-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Siluzan platform AI Skill CLI — multi-platform content publishing (video/image-text) for Cursor, Claude Code, and OpenClaw.",
5
5
  "type": "module",
6
6
  "bin": {