siluzan-tso-cli 1.1.32-beta.1 → 1.1.33-beta.1

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.32-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
54
+ > **注意**:当前为测试版(1.1.33-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
55
55
 
56
56
  | 助手 | 建议 `--ai` |
57
57
  | ----------------------- | ------------------------------------ |
package/dist/index.js CHANGED
@@ -1980,6 +1980,7 @@ import * as fs3 from "fs/promises";
1980
1980
  import * as path3 from "path";
1981
1981
  import * as fs4 from "fs/promises";
1982
1982
  import * as path4 from "path";
1983
+ import { spawn as spawn2 } from "child_process";
1983
1984
  import * as path5 from "path";
1984
1985
  import { chmod, mkdir as mkdir3, open, readdir, stat, unlink } from "fs/promises";
1985
1986
  import * as path6 from "path";
@@ -2933,6 +2934,60 @@ function installProcessHandlers() {
2933
2934
  process.exit(1);
2934
2935
  });
2935
2936
  }
2937
+ function tryOpenHttpsUrlInBrowser(url) {
2938
+ try {
2939
+ const parsed = new URL(url);
2940
+ if (parsed.protocol !== "https:") {
2941
+ return false;
2942
+ }
2943
+ if (process.platform === "win32") {
2944
+ const child = spawn2("rundll32", ["url.dll,FileProtocolHandler", parsed.toString()], {
2945
+ detached: true,
2946
+ stdio: "ignore",
2947
+ windowsHide: true
2948
+ });
2949
+ child.unref();
2950
+ } else if (process.platform === "darwin") {
2951
+ const child = spawn2("open", [parsed.toString()], { detached: true, stdio: "ignore" });
2952
+ child.unref();
2953
+ } else {
2954
+ const child = spawn2("xdg-open", [parsed.toString()], { detached: true, stdio: "ignore" });
2955
+ child.unref();
2956
+ }
2957
+ return true;
2958
+ } catch {
2959
+ return false;
2960
+ }
2961
+ }
2962
+ function deliverMediaAccountOAuthLink(opts) {
2963
+ const { mediaLabel, redirectUrl, tryOpenBrowser: tryOpenBrowser2 } = opts;
2964
+ if (isSiluzanAgentEnv()) {
2965
+ console.log(
2966
+ `
2967
+ \u2139\uFE0F \u68C0\u6D4B\u5230 Siluzan Agent \u73AF\u5883\uFF08IS_SILUZAN_AGENT_ENV=true\uFF09\u3002
2968
+ \u8BF7\u6253\u5F00\u4EE5\u4E0B\u94FE\u63A5\u5B8C\u6210 ${mediaLabel} \u5E7F\u544A\u8D26\u6237\u6388\u6743\uFF08\u6C99\u7BB1\u5185\u4E0D\u4F1A\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF09\uFF1A
2969
+
2970
+ ${redirectUrl}
2971
+ `
2972
+ );
2973
+ return;
2974
+ }
2975
+ if (tryOpenBrowser2) {
2976
+ const opened = tryOpenBrowser2(redirectUrl);
2977
+ if (opened) {
2978
+ console.log(`
2979
+ \u2705 \u5DF2\u5728\u9ED8\u8BA4\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00 ${mediaLabel} \u6388\u6743\u9875\u9762\u3002`);
2980
+ console.log(` \u5B8C\u6210\u6388\u6743\u540E\u6D4F\u89C8\u5668\u4F1A\u81EA\u52A8\u8DF3\u56DE\u4E1D\u8DEF\u8D5E\uFF0C\u8D26\u6237\u7ED1\u5B9A\u5373\u751F\u6548\u3002
2981
+ `);
2982
+ } else {
2983
+ console.log(`
2984
+ \u26A0\uFE0F \u65E0\u6CD5\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u624B\u52A8\u590D\u5236\u4EE5\u4E0B\u94FE\u63A5\u5230\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u6388\u6743\uFF1A
2985
+ `);
2986
+ }
2987
+ }
2988
+ console.log(` ${redirectUrl}
2989
+ `);
2990
+ }
2936
2991
  function printAuthMissingHelp(binName) {
2937
2992
  if (isSiluzanAgentEnv()) {
2938
2993
  console.error(
@@ -120909,35 +120964,11 @@ async function runAccountShareDetail(opts) {
120909
120964
 
120910
120965
  // src/commands/account-manage/oauth.ts
120911
120966
  init_auth();
120912
- import { spawn as spawn2 } from "child_process";
120967
+ init_dist();
120913
120968
  function toApiMediaType(media) {
120914
120969
  return media === "Meta" ? "FacebookAds" : media;
120915
120970
  }
120916
- function tryOpenBrowser(url) {
120917
- try {
120918
- const parsed = new URL(url);
120919
- if (parsed.protocol !== "https:") {
120920
- return false;
120921
- }
120922
- if (process.platform === "win32") {
120923
- const child = spawn2("rundll32", ["url.dll,FileProtocolHandler", parsed.toString()], {
120924
- detached: true,
120925
- stdio: "ignore",
120926
- windowsHide: true
120927
- });
120928
- child.unref();
120929
- } else if (process.platform === "darwin") {
120930
- const child = spawn2("open", [parsed.toString()], { detached: true, stdio: "ignore" });
120931
- child.unref();
120932
- } else {
120933
- const child = spawn2("xdg-open", [parsed.toString()], { detached: true, stdio: "ignore" });
120934
- child.unref();
120935
- }
120936
- return true;
120937
- } catch {
120938
- return false;
120939
- }
120940
- }
120971
+ var tryOpenBrowser = tryOpenHttpsUrlInBrowser;
120941
120972
  async function runAccountAuth(opts) {
120942
120973
  const config = loadConfig(opts.token);
120943
120974
  const apiMediaType = toApiMediaType(opts.media);
@@ -120963,17 +120994,11 @@ async function runAccountAuth(opts) {
120963
120994
  `);
120964
120995
  process.exit(1);
120965
120996
  }
120966
- const opened = tryOpenBrowser(redirectUrl);
120967
- if (opened) {
120968
- console.log(`\u2705 \u5DF2\u5728\u9ED8\u8BA4\u6D4F\u89C8\u5668\u4E2D\u6253\u5F00 ${opts.media} \u6388\u6743\u9875\u9762\u3002`);
120969
- console.log(` \u5B8C\u6210\u6388\u6743\u540E\u6D4F\u89C8\u5668\u4F1A\u81EA\u52A8\u8DF3\u56DE\u4E1D\u8DEF\u8D5E\uFF0C\u8D26\u6237\u7ED1\u5B9A\u5373\u751F\u6548\u3002
120970
- `);
120971
- } else {
120972
- console.log(`\u26A0\uFE0F \u65E0\u6CD5\u81EA\u52A8\u6253\u5F00\u6D4F\u89C8\u5668\uFF0C\u8BF7\u624B\u52A8\u590D\u5236\u4EE5\u4E0B\u94FE\u63A5\u5230\u6D4F\u89C8\u5668\u4E2D\u5B8C\u6210\u6388\u6743\uFF1A
120973
- `);
120974
- }
120975
- console.log(` ${redirectUrl}
120976
- `);
120997
+ deliverMediaAccountOAuthLink({
120998
+ mediaLabel: opts.media,
120999
+ redirectUrl,
121000
+ tryOpenBrowser: tryOpenHttpsUrlInBrowser
121001
+ });
120977
121002
  }
120978
121003
 
120979
121004
  // src/commands/account-manage/google-mcc.ts
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.32-beta.1",
4
- "publishedAt": 1782807062947
3
+ "version": "1.1.33-beta.1",
4
+ "publishedAt": 1782810997774
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.32-beta.1'
12
+ $PKG_VERSION = '1.1.33-beta.1'
13
13
  $CLI_BIN = 'siluzan-tso'
14
14
  $SKILL_LABEL = 'Siluzan TSO'
15
15
  $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
@@ -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.32-beta.1"
12
+ readonly PKG_VERSION="1.1.33-beta.1"
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"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.32-beta.1",
3
+ "version": "1.1.33-beta.1",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "keywords": [
6
6
  "ad-account",