Skip to content

Withdrawn by author#834

Closed
tecnos-okazaki wants to merge 1 commit into
DeusData:mainfrom
tecnos-okazaki:feat/271-npm-workspaces-phase1
Closed

Withdrawn by author#834
tecnos-okazaki wants to merge 1 commit into
DeusData:mainfrom
tecnos-okazaki:feat/271-npm-workspaces-phase1

Conversation

@tecnos-okazaki

@tecnos-okazaki tecnos-okazaki commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

A Yarn/Lerna/npm monorepo references a sibling package by its declared
`name` (e.g. `@org/a`), but package.json `main`/`exports` often points at
a build artifact (dist/index.js) that is not indexed. pkgmap maps the name
to that dead entry QN, so the import resolves to no node and no
cross-package IMPORTS edge (and therefore no downstream CALLS edge) is
produced.

Phase 1 (npm `workspaces` only, per the maintainer's scoping in #271):

- Detect workspace roots and member manifests during the existing pkgmap
  manifest walk (cbm_workspace_try_detect) — no extra file IO. Roots
  declare `workspaces` as an array or {"packages":[...]}; member globs are
  compiled with the reused gitignore engine ('*', '**', '!' negation,
  charclasses). Brace {a,b} expansion is out of scope (debug-logged).
- Collect-then-finalize (cbm_workspaces_finalize) so a member can be parsed
  before its declaring root; maps each member NAME -> source DIR, first-wins
  on name collision.
- Resolver Strategy 1c (resolve_workspace_member) probes conventional source
  entry files (src/index, index, src/main, ...) and subpath targets
  (`@org/a/utils/helper` -> <dir>/src/utils/helper). Runs only after the
  existing pkgmap/sibling strategies miss, so healthy repos (entry points at
  a real indexed file) are byte-for-byte unchanged. The import-targetable
  label filter preserves the #767 Folder-phantom guard; self-imports are
  rejected.

Because the CALLS import-map is built from IMPORTS edges, fixing IMPORTS
here also improves cross-package call resolution without touching the
generic module resolver.

Tests: new tests/test_workspaces.c (11 unit cases — array/object detection,
single-star/doublestar/negation glob matching, first-wins, NULL-safety,
scan_repo end-to-end) plus two previously-RED contract tests in
test_lang_contract.c (unbuilt dist `main`, and subpath import) that now pass.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Signed-off-by: Hitoshi Okazaki <okazaki.hitoshi@tecnos.co.jp>
@tecnos-okazaki tecnos-okazaki force-pushed the feat/271-npm-workspaces-phase1 branch from a9a6e22 to f77cbf2 Compare July 4, 2026 05:46
@DeusData DeusData added enhancement New feature or request parsing/quality Graph extraction bugs, false positives, missing edges priority/normal Standard review queue; useful PR with ordinary maintainer urgency. labels Jul 4, 2026
@DeusData

DeusData commented Jul 4, 2026

Copy link
Copy Markdown
Owner

Thanks for the npm workspace import-resolution work. Triage: parsing/enhancement PR for #271 Phase 1.

Since this is a draft, we will wait for ready-for-review before going deep. Review should stay scoped to npm workspaces first: workspace glob parsing, package-name to source resolution, repo-bounded path handling, and tests that cross-package imports resolve without misattributing external packages.

@tecnos-okazaki tecnos-okazaki marked this pull request as ready for review July 4, 2026 08:09
@tecnos-okazaki tecnos-okazaki requested a review from DeusData as a code owner July 4, 2026 08:09
@tecnos-okazaki tecnos-okazaki changed the title feat(pipeline): resolve npm workspaces package imports (#271 Phase 1) Withdrawn by author Jul 4, 2026
@tecnos-okazaki tecnos-okazaki deleted the feat/271-npm-workspaces-phase1 branch July 4, 2026 08:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request parsing/quality Graph extraction bugs, false positives, missing edges priority/normal Standard review queue; useful PR with ordinary maintainer urgency.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants