Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Don't load the provider SDKs when @chatcops/core is imported

Đã đóng
#239 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@abelzach đang làm issue này rồi.

Từ ngày 21/10/2026.

  • #288 của @abelzach — đã merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
node.js, typescript

Hướng nghiên cứu

Read packages/core/src/index.ts, packages/core/src/providers/index.ts, and packages/core/package.json, then trace how the build emits package entry points and tests are run. Remove the provider classes from the main exports, add typed subpath exports and the regression test described in the issue, and update the changeset. Done when the main entry does not statically load provider SDKs, all three subpaths work, and the stated checks pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

core enhancement hacktoberfest help wanted

createProvider loads each provider's SDK with a dynamic import() (packages/core/src/providers/base.ts, lines 10 to 27), so only the one you use should load. But packages/core/src/index.ts, line 51, and packages/core/src/providers/index.ts, lines 12 to 14, also re-export ClaudeProvider, OpenAIProvider and GeminiProvider directly. That's a static import of all three SDKs, so importing anything from @chatcops/core (even FAQKnowledgeSource) loads @anthropic-ai/sdk, openai and @google/genai. That costs startup time on every serverless cold start.

What to do

  • Stop re-exporting the three provider classes from packages/core/src/index.ts and packages/core/src/providers/index.ts.
  • Make them importable from subpaths instead: @chatcops/core/providers/claude, /openai and /gemini. Add them to exports in packages/core/package.json with types and import, the same shape as ".".
  • Leave the SDKs in dependencies. Making them optional is a separate decision.
  • Add a test that fails if the main entry loads an SDK again. One way: after the build, read dist/index.js, follow its static import ... from './x.js' statements (not import()) through dist, and check that none of the reached files import one of the three SDK packages.
  • Mention the moved classes in the changeset. Nothing in our docs imports them, but someone's code might.

Where to look

  • packages/core/src/index.ts, packages/core/src/providers/index.ts, packages/core/package.json
  • pnpm publint (in CI) checks the new exports entries

Acceptance criteria

  • import { FAQKnowledgeSource } from '@chatcops/core' loads no provider SDK, and the new test proves it (and fails if you put the re-export back; say in the PR that you tried)
  • import { ClaudeProvider } from '@chatcops/core/providers/claude' works, with types
  • createProvider works as before for all three types
  • pnpm publint passes
  • Changeset for @chatcops/core (minor, with the move noted)
  • pnpm test:coverage and pnpm lint pass

Want to work on this? Comment below and I'll assign it to you. Please take one issue at a time, branch off dev, and open your PR against dev with Closes #<this issue number>. Setup notes (pnpm, build before test) are in CONTRIBUTING.md.

Ngôn ngữ chính
TypeScript
Star
13
Fork
7
Merge trung bình
3 giờ 41 phút
Pull request đã merge (30 ngày)
155

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của codercops/chatcops

Tất cả issue của codercops/chatcops

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.