Skip to content

fix: remove direct third-party imports from adapters#799

Closed
jackwener wants to merge 1 commit intomainfrom
fix/adapter-third-party-imports
Closed

fix: remove direct third-party imports from adapters#799
jackwener wants to merge 1 commit intomainfrom
fix/adapter-third-party-imports

Conversation

@jackwener
Copy link
Copy Markdown
Owner

Summary

  • Adapters in ~/.opencli/clis/ import chalk and turndown as bare specifiers, but Node.js module resolution can't find them outside the package tree
  • Replace chalk with log from @jackwener/opencli/logger in 11 yollomi adapters
  • Re-export TurndownService from @jackwener/opencli/utils for adapters that need HTML→Markdown
  • Replace turndown import in yuanbao/ask.ts with @jackwener/opencli/utils
  • Add regression test: non-test adapter files must not import runtime dependencies directly

Design decision

Option B from #792 discussion: adapters should only depend on opencli's public API (@jackwener/opencli/*), not on third-party packages directly. This is the principled fix — adapters work correctly regardless of where they're loaded from.

Test plan

  • npm run build passes
  • npm test — all 516 tests pass
  • New regression test catches bare third-party imports in adapter files
  • Test files (.test.ts) are excluded from the check since they run inside the package tree

Closes #792

Adapters in ~/.opencli/clis/ cannot resolve bare third-party packages
(chalk, turndown) because Node.js module resolution walks up from the
file location and never reaches the package's node_modules/.

- Replace chalk with log from @jackwener/opencli/logger in 11 yollomi adapters
- Re-export TurndownService from @jackwener/opencli/utils
- Replace turndown import in yuanbao/ask.ts with @jackwener/opencli/utils
- Add regression test: adapters must not import runtime dependencies directly

Closes #792
@jackwener jackwener closed this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [Windows]Failed to load module C:\Users\windows\.opencli\src

1 participant