Don't load the provider SDKs when @chatcops/core is imported
Maintainer thường phản hồi trong vòng 1 ngày
Đá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
- Lĩnh vực
- backend, developer-experience
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ả
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.tsandpackages/core/src/providers/index.ts. - Make them importable from subpaths instead:
@chatcops/core/providers/claude,/openaiand/gemini. Add them toexportsinpackages/core/package.jsonwithtypesandimport, 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 staticimport ... from './x.js'statements (notimport()) throughdist, 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.jsonpnpm publint(in CI) checks the newexportsentries
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 -
createProviderworks as before for all three types -
pnpm publintpasses - Changeset for
@chatcops/core(minor, with the move noted) -
pnpm test:coverageandpnpm lintpass
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ờ 33 phút
- Pull request đã merge (30 ngày)
- 176
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của codercops/chatcops
-
Add startup checks that catch weak or leaked security settingsCó thể đã có người làm @varun-pahuja đã nhận 3 ngày trước. Đang mởenhancement good first issue hacktoberfest server
codercops/chatcops#231 · 3 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Type-check the TypeScript samples in the docsCó thể đã có người làm @An16og đã nhận 2 ngày trước. Đang mởdocumentation hacktoberfest help wanted testing
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 70/100
codercops/chatcops#201 · 7 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Hacktoberfest 2026: start hereĐang mởhacktoberfest
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Add built-in translations to the widgetCó thể đã có người làm @piyusshhjangid đã nhận 1 ngày trước. Đang mởhelp wanted widget
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
codercops/chatcops#55 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của codercops/chatcops
Issue tương tự
-
bug hacktoberfest help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
libredb/libredb-studio#1941 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
chore other
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
alastair-smith/card-games#308 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
paperclipai/paperclip#17379 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[good first issue, hacktoberfest] 🏯 Hacktoberfest Task - Add new Anime Quote 626 (good-first-issue)Đang mởcommunity first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
lingdojo/kana-dojo#33040 · 1 bình luận · 5 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug mobile ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày