Skip to content

feat(typescript): migrate codebase to TypeScript - #9

Merged
samson910022 merged 3 commits into
mainfrom
feat/typescript-migration
Sep 9, 2026
Merged

samson910022 merged 3 commits into
mainfrom
feat/typescript-migration

Conversation

@samson910022

Copy link
Copy Markdown
Owner

全量 TS 遷移,P0-P5 分階段執行,每階段 review/fix 循環,最終 3 組全面 review 通過。

  • P0 工具鏈:tsconfig NodeNext、tsx/@swc/jest/@types、typecheck/build scripts
  • P1 葉節點:retry、contracts、anthropic → .ts
  • P2 中層:tool-runtime registry/policy/router/validator/parser → .ts
  • P3 拆分:proxy.js 3999→801,抽出 errors/config/backend/stream/routes
  • P4 核心:proxy/index + src/types → .ts
  • P5 收尾:start/Docker/CI 切 dist,文件同步

驗證:tsc --noEmit 0錯、npm run build 綠、npm test 7 suites/191 tests 綠、node dist smoke /health 200、docker build+run smoke 通過。

P0 baseline toolchain (tsconfig NodeNext, @swc/jest, typecheck/build scripts). P1 leaf modules (retry, contracts, anthropic). P2 tool-runtime middle layer. P3 split proxy.js 3999 lines into errors/config/backend/stream/routes. P4 core to TS with src/types. P5 switch start/Docker/CI to dist, sync docs. typecheck/build/test 191 green.
1. index.ts resolves config.json from dist sibling, project root, and cwd (prod dist/index.js could not find root config). 2. Remove dead isOperationalEndpointBypassed helper. 3. Drop 16 unused imports + void retention block in proxy.ts (6 used imports kept). 4. Restore || merge semantics for numeric config to match original JS.
parseToolAllowlist array branch back to || (drop 0/false entries). readFileNumber falls through on 0 like fileConfig.X || default. buildBackendAuthHeaders coerces truthy non-strings via String() as before. Document that Docker images do not bake local config.json.
@samson910022
samson910022 merged commit 5974728 into main Sep 9, 2026
3 checks passed
@samson910022
samson910022 deleted the feat/typescript-migration branch September 9, 2026 07:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant