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ờ 41 phút
- Pull request đã merge (30 ngày)
- 155
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
-
Document the pre-chat formCó thể đã có người làm @masyarakatai đã nhận 6 ngày trước. Đang mởdocumentation good first issue hacktoberfest widget
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
codercops/chatcops#70 · 5 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: update the providers page for openai-compatible, registerProvider and provider importsCó thể đã có người làm @prakashNalla đã nhận 1 ngày trước. Đang mởdocumentation good first issue hacktoberfest website
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
codercops/chatcops#291 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: add a protocol reference page for custom clientsCó thể đã có người làm @kachamsiddarth đã nhận 1 ngày trước. Đang mởdocumentation good first issue hacktoberfest website
codercops/chatcops#286 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Create @chatcops/store-cloudflare (D1, KV and a Durable Object counter)Có thể đã có người làm @bhushan4work đã nhận 1 ngày trước. Đang mởenhancement hacktoberfest help wanted server
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
codercops/chatcops#249 · 2 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Create @chatcops/store-sqlite, a store for single-server setupsCó thể đã có người làm @srikar-naidu đã nhận 1 ngày trước. Đang mởenhancement hacktoberfest help wanted server
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
codercops/chatcops#247 · 3 bình luận · 1 người được giao ·
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ự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
cursor/community-plugins#465 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
vetro-protocol/vetro-monorepo#978 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-generated bug category:security effort:s priority:p3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
LanternOps/breeze#9697 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
maniator/verticopolis#1303 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
components-web-app/docs#297 ·