@wport/cli 0.9.0 → 0.9.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/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@
5
5
 
6
6
  ---
7
7
 
8
+ ## [0.9.1] — 2026-08-17
9
+
10
+ ### Changed
11
+
12
+ - **內部重構(pm_48 交付 B):轉 npm workspaces monorepo**——共用引擎抽出為 `@wport/core`
13
+ (typed REST client、typed errors、enterprise transport、concurrency、resume-schema),
14
+ CLI 改為其消費者。**對外行為零變更**:指令、exit code 契約(0/2/3/4/5)、
15
+ schema fingerprint(`839e8a891dfb`)均與 0.9.0 一致(669 tests + whole-branch review 驗證)。
16
+ - 新姊妹套件:`@wport/sdk`(程式化存取,同能力邊界)與 `@wport/core`(內部引擎)自本版起發布。
17
+ - npm 發布素材補齊:package 內 README/CHANGELOG/LICENSE(先前 `files` 指向 repo root 造成漏檔)。
18
+
8
19
  ## [0.9.0] — 2026-08-10
9
20
 
10
21
  ### Added
package/README.md CHANGED
@@ -16,6 +16,16 @@ npm install -g @wport/cli
16
16
 
17
17
  Requires Node.js >= 18.17.
18
18
 
19
+ ### dev channel(內部測試用)
20
+
21
+ `@wport/cli@dev` 是預設連 dev 後端(`https://developers.wport.me/v2`)的建置,供內部測試未上 prod 的後端改動:
22
+
23
+ npm i -g @wport/cli@dev # wport → dev 後端
24
+ wport login # 直接對 dev 後端做 device flow
25
+ npm i -g @wport/cli@latest # 換回 prod 版
26
+
27
+ dev 版憑證獨立存於 `credentials-dev.json`,與 prod 版的 `credentials.json` 互不干擾;`wport doctor` 會印出目前 channel。base URL 仍可用 `--api` / `WPORT_API_BASE` 覆寫。
28
+
19
29
  ## Quick start
20
30
 
21
31
  ```bash
@@ -295,24 +305,37 @@ The public job search endpoint is throttled to 1200 requests / minute / client I
295
305
  ## Development
296
306
 
297
307
  ```bash
298
- cd apps/cli
308
+ # from the repo root (npm workspaces monorepo)
299
309
  npm install
300
- npm run gen:openapi:prod # fetch + filter swagger from prod, produces src/generated/schema.d.ts
301
- npm run build
302
- npm link # so the wport command resolves to this build
310
+ npm run gen:openapi:prod -w @wport/core # fetch + filter swagger from prod, produces packages/core/src/generated/schema.d.ts
311
+ npm run build -w @wport/cli
312
+ npm link -w @wport/cli # so the wport command resolves to this build
303
313
 
304
314
  wport jobs search --keyword backend
305
315
  ```
306
316
 
307
- Three codegen variants — pick whichever matches your setup:
317
+ Three codegen scripts live in `packages/core/package.json` run each with `-w @wport/core`, pick whichever matches your setup:
318
+
319
+ | Script | Source | Output | When to use |
320
+ |---|---|---|---|
321
+ | `npm run gen:openapi:prod -w @wport/core` | `https://api.wport.me/api/api-doc-json` | `packages/core/src/generated/schema.d.ts` (jobs line) | Default; works from a fresh checkout, no local backend needed |
322
+ | `npm run gen:openapi -w @wport/core` | `http://localhost:3000/api/api-doc-json` | `packages/core/src/generated/schema.d.ts` (jobs line) | When you're hacking on the backend locally |
323
+ | `npm run gen:openapi:personal -w @wport/core` | repo's frozen `docs/handoff/swagger-wport-personal-api-v1.json` | `packages/core/src/generated/personal-schema.d.ts` (personal line) | Regenerating personal-line types after the frozen spec changes; deterministic, no network needed, and CI enforces this one stays in sync |
324
+
325
+ All three go through `packages/core/scripts/gen-from-remote.cjs`, which filters the upstream spec down to the endpoints this CLI uses (it ignores unrelated `$ref` breakage elsewhere in the spec). When the CLI starts using a new endpoint, add it to `KEEP_PATHS` (jobs line) or `--keep-prefix` (personal line) in that script.
326
+
327
+ #### 發 dev channel 到 npm
328
+
329
+ npm version prerelease --preid=dev --no-git-tag-version # 0.9.0 → 0.9.1-dev.0(prerelease 會先進 patch)
330
+ npm run build:dev # 選用:發布前先在本地確認 dev build 行為正常
331
+ # 發布必須帶 WPORT_BUILD_CHANNEL=dev:否則 npm publish 的 prepublishOnly hook 會跑 `npm run build`(prod),
332
+ # 把 dist 覆寫回 prod 產物,結果 @wport/cli@dev 底下發成 prod build(靜默、不報錯)。
333
+ WPORT_BUILD_CHANNEL=dev npm publish --tag dev --otp <code> # 必須顯式帶 --tag dev
334
+ npm view @wport/cli dist-tags # 斷言 latest 未被動到
308
335
 
309
- | Script | Source | When to use |
310
- |---|---|---|
311
- | `npm run gen:openapi:prod` | `https://api.wport.me/api/api-doc-json` | Default; works from a fresh checkout, no local backend needed |
312
- | `npm run gen:openapi:remote` | `http://localhost:3000/api/api-doc-json` | When you're hacking on the backend locally |
313
- | `npm run gen:openapi` | `../../docs/swagger/swagger-dev.json` | When you've already exported the spec via root's `npm run export:swagger:json` |
336
+ ⚠️ npm 預設 tag `latest`,即使版號是 prerelease;漏掉 `--tag dev` 會把 `latest` 指到 dev 版,污染所有 `npm i @wport/cli`。發布後務必用 `npm view dist-tags` 確認 `latest` 沒變。
314
337
 
315
- The `:prod` / `:remote` variants go through `scripts/gen-from-remote.cjs`, which filters the upstream spec down to the endpoints this CLI uses (it ignores unrelated `$ref` breakage elsewhere in the spec). When the CLI starts using a new endpoint, add it to `KEEP_PATHS` in that script.
338
+ ⚠️ `package.json` `prepublishOnly` 會在 `npm publish` 時自動重跑 `npm run build`(prod build,無 dev channel),覆寫掉上一步 `build:dev` 產出的 dist。真正決定 channel 的是 publish 指令本身的 `WPORT_BUILD_CHANNEL=dev` 前綴 —— env 會被 npm 傳進 prepublishOnly 的子行程,讓重跑的 `npm run build` 也讀到 dev channel。漏掉這個前綴,`@wport/cli@dev` 就會靜默發成連 `api.wport.me` prod build。
316
339
 
317
340
  ## Support
318
341