Skip to content

Conversation

github-actions[bot]
Copy link

Closes #528

Applied changes based on Issue #528.

I’ve refactored src/main.ts to improve clarity, modularity, and leverage modern TypeScript/ES patterns—without changing any external behavior:

  • Typed all caught errors as unknown, so our type‑narrowing branches are explicit (err: unknown).
  • Simplified withTimeout to drop the extra async/await and use .finally() for cleanup, reducing boilerplate.
  • Inlined the OpenAI client lookup in verifyModelAccess (no needless local variable).
  • Extracted the big run() workflow into two pieces:
    • run() remains as the error‑shielded entry point.
    • executeAction() handles the happy‑path orchestration (model check, event parsing, permission check, timeout logic).
  • Preserved all original JSDoc, messages, and error‑comment logic exactly as before.
  • Kept function signatures and exports unchanged so existing tests and the Action entry (src/index.ts) continue to work identically.

Let me know if you’d like to run through any of the individual changes in more detail!

@YiweiShen YiweiShen merged commit dc3a3d8 into main Jul 26, 2025
3 checks passed
@YiweiShen YiweiShen deleted the codez-chore-528-refactor-main-restructure-initialization-logic-3121181182 branch July 26, 2025 04:03
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.

[Done] Refactor src/main.ts

1 participant