siluzan-tso-cli 1.1.30-beta.1 → 1.1.30-beta.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/README.md CHANGED
@@ -51,7 +51,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
51
51
  siluzan-tso init --force # 强制覆盖已存在文件
52
52
  ```
53
53
 
54
- > **注意**:当前为测试版(1.1.30-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.30-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -2820,7 +2820,40 @@ function installProcessHandlers() {
2820
2820
  process.exit(1);
2821
2821
  });
2822
2822
  }
2823
+ function hasSiluzanAgentCredentials() {
2824
+ const apiKey = process.env.SILUZAN_API_KEY?.trim();
2825
+ const authToken = process.env.SILUZAN_AUTH_TOKEN?.trim();
2826
+ return Boolean(apiKey || authToken);
2827
+ }
2828
+ function isSiluzanAgentEnv() {
2829
+ const raw = process.env.IS_SILUZAN_AGENT_ENV?.trim().toLowerCase();
2830
+ return raw === "true" || raw === "1";
2831
+ }
2832
+ function skipAuthSetupInAgentEnv(commandLabel) {
2833
+ if (!isSiluzanAgentEnv()) return false;
2834
+ if (hasSiluzanAgentCredentials()) {
2835
+ console.log(
2836
+ `
2837
+ \u2139\uFE0F \u68C0\u6D4B\u5230 Siluzan Agent \u73AF\u5883\uFF08IS_SILUZAN_AGENT_ENV=true\uFF09\uFF0C\u51ED\u636E\u5DF2\u7531\u6C99\u7BB1\u6CE8\u5165\uFF0C\u65E0\u9700\u6267\u884C ${commandLabel}\u3002
2838
+ `
2839
+ );
2840
+ } else {
2841
+ console.log(
2842
+ `
2843
+ \u2139\uFE0F \u68C0\u6D4B\u5230 Siluzan Agent \u73AF\u5883\uFF08IS_SILUZAN_AGENT_ENV=true\uFF09\u3002
2844
+ ${commandLabel} \u5DF2\u8DF3\u8FC7\uFF1B\u8BF7\u7531 Agent \u6C99\u7BB1\u6CE8\u5165 SILUZAN_API_KEY \u6216 SILUZAN_AUTH_TOKEN\u3002
2845
+ `
2846
+ );
2847
+ }
2848
+ return true;
2849
+ }
2823
2850
  function printAuthMissingHelp(binName) {
2851
+ if (isSiluzanAgentEnv()) {
2852
+ console.error(
2853
+ "\n\u274C Siluzan Agent \u73AF\u5883\u4E2D\u672A\u627E\u5230\u8BA4\u8BC1\u51ED\u636E\u3002\n\nAgent \u6C99\u7BB1\u5E94\u901A\u8FC7\u73AF\u5883\u53D8\u91CF\u6CE8\u5165\u4EE5\u4E0B\u4EFB\u610F\u4E00\u79CD\uFF08\u65E0\u9700 login\uFF09\uFF1A\n SILUZAN_API_KEY=<YOUR_API_KEY>\n SILUZAN_AUTH_TOKEN=<YOUR_TOKEN>\n\n\u8BF7\u68C0\u67E5 Agent \u8FD0\u884C\u65F6\u662F\u5426\u5DF2\u8BBE\u7F6E IS_SILUZAN_AGENT_ENV=true \u5E76\u5B8C\u6210\u51ED\u636E\u6CE8\u5165\u3002\n"
2854
+ );
2855
+ process.exit(1);
2856
+ }
2824
2857
  console.error(
2825
2858
  `
2826
2859
  \u274C \u672A\u627E\u5230\u8BA4\u8BC1\u51ED\u636E\u3002\u8BF7\u9009\u62E9\u4EE5\u4E0B\u4EFB\u610F\u4E00\u79CD\u65B9\u5F0F\uFF1A
@@ -102958,6 +102991,7 @@ function normalizeBearerTokenInput(raw) {
102958
102991
 
102959
102992
  // src/commands/login/send-code.ts
102960
102993
  async function runSendLoginCode(opts) {
102994
+ if (skipAuthSetupInAgentEnv("siluzan-tso send-login-code")) return;
102961
102995
  const phone = validateAndNormalizePhone(opts.phone);
102962
102996
  const tsoApiBase = process.env.SILUZAN_TSO_API_BASE ?? DEFAULT_API_BASE;
102963
102997
  const ssoBaseUrl = deriveSsoBaseUrl(tsoApiBase);
@@ -103257,6 +103291,7 @@ async function runLoginMethodMenu(menuOpts) {
103257
103291
  await runInteractivePhoneLogin(menuOpts);
103258
103292
  }
103259
103293
  async function runLogin(opts = {}) {
103294
+ if (skipAuthSetupInAgentEnv("siluzan-tso login")) return;
103260
103295
  if (opts.apiKey !== void 0) {
103261
103296
  const key = opts.apiKey.trim();
103262
103297
  if (!key) {
@@ -103354,12 +103389,21 @@ function cmdConfigShow() {
103354
103389
  const googleApiUrl = process.env.SILUZAN_GOOGLE_API ?? deriveGoogleApiUrl(apiBaseUrl);
103355
103390
  const webUrl = deriveWebUrl(apiBaseUrl);
103356
103391
  if (!effectiveApiKey && !effectiveAuthToken) {
103392
+ if (isSiluzanAgentEnv()) {
103393
+ console.log(
103394
+ "\nSiluzan Agent \u73AF\u5883\uFF08IS_SILUZAN_AGENT_ENV=true\uFF09\u3002\n\u51ED\u636E\u5E94\u7531\u6C99\u7BB1\u6CE8\u5165 SILUZAN_API_KEY \u6216 SILUZAN_AUTH_TOKEN\uFF0C\u65E0\u9700 login\u3002\n"
103395
+ );
103396
+ return;
103397
+ }
103357
103398
  console.log(
103358
103399
  "\n\u5C1A\u672A\u914D\u7F6E\u8BA4\u8BC1\u51ED\u636E\u3002\n\n \u65B9\u5F0F\u4E00\uFF08\u63A8\u8350\uFF09\uFF1AAPI Key\n siluzan-tso login --api-key <YOUR_API_KEY>\n\n \u65B9\u5F0F\u4E8C\uFF1AJWT Token\n siluzan-tso login\n\n \u4E5F\u53EF\u901A\u8FC7\u73AF\u5883\u53D8\u91CF\u4F20\u5165\uFF08CI/CD \u63A8\u8350\uFF09\uFF1A\n export SILUZAN_API_KEY=<YOUR_API_KEY>\n export SILUZAN_AUTH_TOKEN=<YOUR_TOKEN>\n"
103359
103400
  );
103360
103401
  return;
103361
103402
  }
103362
103403
  console.log("\n\u5F53\u524D\u914D\u7F6E\uFF1A");
103404
+ if (isSiluzanAgentEnv()) {
103405
+ console.log(" agentEnv : IS_SILUZAN_AGENT_ENV=true \u2190 Siluzan Agent \u6C99\u7BB1");
103406
+ }
103363
103407
  console.log(` tsoApiBaseUrl : ${apiBaseUrl}`);
103364
103408
  console.log(` googleApiUrl : ${googleApiUrl}`);
103365
103409
  console.log(` webUrl : ${webUrl}`);
@@ -103385,6 +103429,7 @@ function cmdConfigShow() {
103385
103429
  console.log();
103386
103430
  }
103387
103431
  function cmdConfigSet(opts) {
103432
+ if (skipAuthSetupInAgentEnv("siluzan-tso config set")) return;
103388
103433
  if (!opts.token && !opts.apiKey) {
103389
103434
  console.error("\n\u274C \u8BF7\u81F3\u5C11\u63D0\u4F9B\u4E00\u4E2A\u8981\u66F4\u65B0\u7684\u914D\u7F6E\u9879\uFF08--api-key \u6216 --token\uFF09\n");
103390
103435
  process.exit(1);
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.30-beta.1",
4
- "publishedAt": 1782266724841
3
+ "version": "1.1.30-beta.2",
4
+ "publishedAt": 1782286975360
5
5
  }
@@ -9,7 +9,7 @@ $ErrorActionPreference = 'Stop'
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  $PKG_NAME = 'siluzan-tso-cli'
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- $PKG_VERSION = '1.1.30-beta.1'
12
+ $PKG_VERSION = '1.1.30-beta.2'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -242,10 +242,13 @@ function Main {
242
242
  Write-Info 'Registering Skill to all AI platform global directories...'
243
243
  & $CLI_BIN init --global --force
244
244
 
245
- # Step 3: Configure API Key
246
- Write-Step 'Step 3/4: Configure API Key'
247
- Write-Host ''
248
- & $CLI_BIN login
245
+ if ($CLI_BIN -eq 'siluzan-seo') {
246
+ Write-Info 'siluzan-seo does not require login; skipping API Key setup.'
247
+ } else {
248
+ Write-Step 'Step 3/4: Configure API Key'
249
+ Write-Host ''
250
+ & $CLI_BIN login
251
+ }
249
252
 
250
253
  # Step 4: Done
251
254
  Write-Step 'Step 4/4: Complete'
@@ -9,7 +9,7 @@ set -euo pipefail
9
9
  # -- Package info (injected at build time) ------------------------------------
10
10
  readonly PKG_NAME="siluzan-tso-cli"
11
11
  # PKG_VERSION 锁定到与本脚本同批构建产物一致的版本,避免与 dist/skill 错位
12
- readonly PKG_VERSION="1.1.30-beta.1"
12
+ readonly PKG_VERSION="1.1.30-beta.2"
13
13
  readonly CLI_BIN="siluzan-tso"
14
14
  readonly SKILL_LABEL="Siluzan TSO"
15
15
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
@@ -152,10 +152,13 @@ main() {
152
152
  info "Registering Skill to all AI platform global directories..."
153
153
  ${CLI_BIN} init --global --force
154
154
 
155
- # Step 3: Configure API Key
156
- step "Step 3/4: Configure API Key"
157
- echo ""
158
- ${CLI_BIN} login
155
+ if [ "${CLI_BIN}" = "siluzan-seo" ]; then
156
+ info "siluzan-seo does not require login; skipping API Key setup."
157
+ else
158
+ step "Step 3/4: Configure API Key"
159
+ echo ""
160
+ ${CLI_BIN} login
161
+ fi
159
162
 
160
163
  # Step 4: Done
161
164
  step "Step 4/4: Complete"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.30-beta.1",
3
+ "version": "1.1.30-beta.2",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",