Don't load the provider SDKs when @chatcops/core is imported
Les mainteneurs répondent en général sous 1 jour
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 75/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- node.js, typescript
- Domaine
- backend, developer-experience
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 13
- Forks
- 7
- Merge moyen
- 3 h 28 min
- PR mergées (30 j)
- 182
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de codercops/chatcops
-
Type-check the TypeScript samples in the docsPeut-être pris @An16og l’a pris il y a 2 jours. Ouvertedocumentation hacktoberfest help wanted testing
Difficulté 4/5 3-5 jours Accessibilité débutants 70/100
codercops/chatcops#201 · 7 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 1 jour
-
Hacktoberfest 2026: start hereOuvertehacktoberfest
Difficulté 1/5 Moins d'une heure Accessibilité débutants 35/100
Les mainteneurs répondent en général sous 1 jour
-
Add built-in translations to the widgetPeut-être pris @piyusshhjangid l’a pris il y a 1 jour. Ouvertehelp wanted widget
Difficulté 4/5 3-5 jours Accessibilité débutants 52/100
codercops/chatcops#55 · 3 commentaires ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de codercops/chatcops
Issues similaires
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
openclaw/openclaw#182077 · 1 commentaire · 1 réaction ·
Les mainteneurs répondent en général sous 1 jour
-
aikido high security
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
dequelabs/axe-linter-action#161 ·
-
[Feature Request] Update the DimCode agent icon to the 45:32 brand markPeut-être pris @eric8810 l’a pris aujourd’hui. Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
Les mainteneurs répondent en général sous 1 jour
-
[Feature]: 建议导入源后,自动切换到新导入的源Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
lyswhut/lx-music-desktop#3026 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100
abhigyanpatwari/GitNexus#3704 ·
Les mainteneurs répondent en général sous 1 jour