Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

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

Aberta
#239 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
3/5
Tempo estimado
1-2 dias
Facilidade para iniciantes
75/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
node.js, typescript

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
TypeScript
Estrelas
13
Forks
7
Merge médio
4h 11min
PRs com merge (30d)
122

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de codercops/chatcops

Todas as issues de codercops/chatcops

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.