tripo-cli 0.3.0 → 0.3.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
@@ -104,6 +104,8 @@ tripo batch run assets.yaml --concurrency 2
104
104
  | `HTTPS_PROXY` / `HTTP_PROXY` / `NO_PROXY` | standard proxy variables, honored for all CLI traffic (plain Node fetch ignores them) |
105
105
  | `TRIPO_LLM_BASE_URL` / `TRIPO_LLM_API_KEY` / `TRIPO_LLM_MODEL` | optional OpenAI-compatible LLM for `tripo ai` conversation mode |
106
106
 
107
+ Setting `TRIPO_API_KEY` per shell — bash/zsh: `export TRIPO_API_KEY=tsk_...` · PowerShell: `$env:TRIPO_API_KEY = "tsk_..."` (persist for future sessions with `setx TRIPO_API_KEY "tsk_..."`) · CMD: `set TRIPO_API_KEY=tsk_...`
108
+
107
109
  ## Development
108
110
 
109
111
  ```bash
@@ -35,7 +35,10 @@ export function registerDoctorCommand(program) {
35
35
  : 'missing — run "tripo login"',
36
36
  critical: true,
37
37
  });
38
- if (configFileExists()) {
38
+ // Skipped on Windows: Node fakes POSIX mode bits there (a writable file
39
+ // always reads 0666), so the comparison can never pass — the file is
40
+ // protected by the user profile's NTFS ACLs instead.
41
+ if (configFileExists() && process.platform !== 'win32') {
39
42
  try {
40
43
  const mode = statSync(join(tripoHome(), 'config.json')).mode & 0o777;
41
44
  checks.push({
@@ -391,8 +391,8 @@ function safeTimeZone() {
391
391
  async function keyFromConsole(region, openBrowser) {
392
392
  // The console SPA nests every page under a locale segment (/:lang/keys);
393
393
  // a bare /keys is swallowed by the ":lang" route and lands on the home
394
- // page. Both regions' backends use /en in their canonical URLs.
395
- const keysUrl = `${platformUrlFor(region)}/en/keys`;
394
+ // page. cn opens the Chinese console, ov the English one.
395
+ const keysUrl = `${platformUrlFor(region)}/${REGION_DEFAULTS[region].lang}/keys`;
396
396
  if (openBrowser && shouldOpen()) {
397
397
  openExternal(keysUrl);
398
398
  log(t({ zh: `已打开控制台 API Keys 页面(未弹出请手动访问):\n ${keysUrl}`, en: `opened the console API Keys page (visit manually if it didn't open):\n ${keysUrl}` }));
@@ -495,9 +495,12 @@ function finishSave(key, region, balance, profile) {
495
495
  // account I am using" — no second command needed for the common case.
496
496
  updateProfile(profile, { api_key: key, region });
497
497
  const where = profile === DEFAULT_PROFILE ? '~/.tripo/config.json' : `~/.tripo/config.json · profile "${profile}"`;
498
+ // "mode 0600" is only true where POSIX modes exist; on Windows the file
499
+ // relies on the user profile's NTFS ACLs, so the claim would be wrong.
500
+ const mode = process.platform === 'win32' ? '' : t({ zh: ',权限 0600', en: ', mode 0600' });
498
501
  success(t({
499
- zh: `Key 验证通过(region=${region}),当前余额 ${balance} 积分(已保存到 ${where},权限 0600)`,
500
- en: `key verified (region=${region}); balance ${balance} credits (saved to ${where}, mode 0600)`,
502
+ zh: `Key 验证通过(region=${region}),当前余额 ${balance} 积分(已保存到 ${where}${mode})`,
503
+ en: `key verified (region=${region}); balance ${balance} credits (saved to ${where}${mode})`,
501
504
  }));
502
505
  if (Number(balance) === 0) {
503
506
  warn(t({
@@ -31,17 +31,22 @@ export const DEFAULT_PROFILE = 'default';
31
31
  * is why this is one CLI with a `region` field and not two CLIs. A key is
32
32
  * valid in exactly one region, so region is *detected* from the key at login
33
33
  * time, never asked when a key is already in hand.
34
+ *
35
+ * `lang` is the console's locale segment (/:lang/...) the CLI opens pages
36
+ * under: the cn console in Chinese, the ov console in English.
34
37
  */
35
38
  export const REGION_DEFAULTS = {
36
39
  ov: {
37
40
  api: 'https://openapi.tripo3d.ai',
38
41
  platform: 'https://developers.tripo3d.ai',
39
42
  consoleApi: 'https://apiplatform.tripo3d.ai',
43
+ lang: 'en',
40
44
  },
41
45
  cn: {
42
46
  api: 'https://openapi.tripo3d.com',
43
47
  platform: 'https://developers.tripo3d.com',
44
48
  consoleApi: 'https://apiplatform.tripo3d.com',
49
+ lang: 'zh',
45
50
  },
46
51
  };
47
52
  export function tripoHome() {
@@ -89,10 +89,19 @@ export async function requestDeviceCode(region, profile) {
89
89
  }
90
90
  return {
91
91
  ...grant,
92
+ verification_url_complete: localizeConsoleUrl(grant.verification_url_complete, region),
92
93
  expires_in: grant.expires_in > 0 ? grant.expires_in : 900,
93
94
  interval: grant.interval > 0 ? grant.interval : 5,
94
95
  };
95
96
  }
97
+ /**
98
+ * The console SPA nests every page under a locale segment (/:lang/...) and
99
+ * the backend hardcodes /en in the URLs it issues — which drops cn users on
100
+ * the English authorization page. Swap in the region's console locale.
101
+ */
102
+ function localizeConsoleUrl(url, region) {
103
+ return url.replace(/^(https?:\/\/[^/]+)\/en(?=[/?#]|$)/, `$1/${REGION_DEFAULTS[region].lang}`);
104
+ }
96
105
  export async function pollDeviceToken(region, deviceCode) {
97
106
  const body = await post(`${consoleApiBaseUrl(region)}/cli/device/token`, { device_code: deviceCode });
98
107
  if (body.code === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tripo-cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Tripo 3D intelligent CLI — turn a prompt or an image into engine-ready 3D assets from your terminal (Tripo V3 API)",
5
5
  "keywords": [
6
6
  "tripo",
package/skill/SKILL.md CHANGED
@@ -8,6 +8,7 @@ One command turns a text prompt or an image into local files: a 3D model (glb/fb
8
8
  ```bash
9
9
  npm install -g tripo-cli # or: npx tripo-cli ...
10
10
  export TRIPO_API_KEY=tsk_... # highest-priority auth; no interaction needed
11
+ # (PowerShell: $env:TRIPO_API_KEY = "tsk_...")
11
12
  tripo doctor # verify key, network, balance
12
13
  ```
13
14
 
@@ -4,6 +4,7 @@
4
4
 
5
5
  ```bash
6
6
  export TRIPO_API_KEY=tsk_... # zero interaction when a key is already provisioned
7
+ # (PowerShell: $env:TRIPO_API_KEY = "tsk_...")
7
8
  tripo login # humans in a terminal: interactive browser flow
8
9
  tripo login --region ov|cn # agents/CI without a key: headless device flow — prints a
9
10
  # verification URL + one-time code on stderr, waits for the