Resolve workspace: protocol dependencies when using package_file#2775
Resolve workspace: protocol dependencies when using package_file#2775laura-mlg wants to merge 1 commit into
Conversation
When a plugin's package_file references a package.json that contains workspace:* dependencies (pnpm monorepo), resolve them to file: paths by locating the package on disk via pnpm-workspace.yaml. Fixes #2774 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
|
Analysis for project
|
| Tool | Category | Rule | Count | |
|---|---|---|---|---|
| rustfmt | Style | Incorrect formatting, autoformat by running qlty fmt. |
1 | ❌ |
| qlty | Structure | High total complexity (count = 90) | 1 | |
| qlty | Structure | Function with high complexity (count = 36): find_workspace_packages | 1 | |
| qlty | Structure | Deeply nested control flow (level = 5) | 1 |
@qltysh one-click actions:
- Auto-fix formatting (
qlty fmt && git push)
| } | ||
| } | ||
|
|
||
| Ok(packages) |
| if let Some(pkg_dir) = entry.path().to_str() { | ||
| packages.insert(name.to_string(), pkg_dir.to_string()); | ||
| } | ||
| } |
|
Coverage Impact - ubuntu-latest ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|
|
Coverage Impact - macos-15 ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (1)
🤖 Increase coverage with AI coding...🚦 See full report on Qlty Cloud » 🛟 Help
|

Summary
When a plugin's
package_filepoints to apackage.jsonin a pnpm monorepo, dependencies using theworkspace:*protocol were silently ignored — npm couldn't resolve them in the tool's sandbox, causing tools like knip to fail loading config files that import workspace packages.This fix detects
workspace:references inupdate_file_dependencies, locates the package on disk by walking up topnpm-workspace.yamland scanning the declared workspace directories, then replacesworkspace:*with an absolutefile:path npm can resolve.Closes qltysh/support#295
Test plan
test_update_package_file_based_dependencystill passes (file: protocol unaffected)test_update_workspace_protocol_dependencycovers pnpm workspace resolutionpnpm-workspace.yamlis absent (non-monorepo projects unaffected)