apache / apache/maka

@ai-sdk/provider is imported but never declared, and knip does not cover the workspace it lives in

Open
#4,368 1 comment 0 reactions 1 assignee Claimed by @adibmbrk View on GitHub
bug help wanted
Dominant language
TypeScript
Stars
5.4k
Forks
502
Avg merge
1d 2h
Merged PRs (30d)
716

Description

## What happened

`packages/runtime/src/model-factory.ts:36` imports from `@ai-sdk/provider`. No `package.json` in the repository declares it. It resolves today only because it is a transitive dependency of the `@ai-sdk/*` packages and npm hoists it to the root. Fourteen test files under `packages/runtime/src/__tests__/` import it as well.

If any of those SDK packages stops depending on it, `packages/runtime` stops compiling, and nothing in the diff will explain why.

knip would have caught this, but `.github/workflows/ci.yml:215` and `:219` run it only against `apps/desktop` and `packages/ui`. `packages/runtime` is never scanned.

## How to reproduce

Install without hoisting and run `tsc` in `packages/runtime`: `TS2307: Cannot find module '@ai-sdk/provider'` at `src/model-factory.ts:36`. Or run `npx knip --dependencies` from the repo root and read the "Unlisted dependencies" section.

## Environment

macOS arm64, Node 24, npm 11.19.0, TypeScript 7.0.2.

## Additional context

I think the fix is two parts:

1. Declare `@ai-sdk/provider@4.0.7` in `packages/runtime` — the version `ai@7.0.70` already resolves to.
2. Widen the knip lanes so every workspace is covered.

Part 2 needs care: a repo-wide run also reports four unlisted imports under `scripts/` and one false positive — `patch-package`, which `scripts/apply-dependency-patches.mjs` resolves dynamically. Those need triaging before a wider gate can be trusted, and a gate that lands red is worse than none.

_Analysis produced with Claude Code._

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.