T-ZAZO-intersect-fs-layer
Status: closed/done · Impact: medium · Complexity: medium
Implement intersect/fs — filesInScope and resolveIntersection — wrapping a
filesystem globber and filtering with the pure path API, as a subpath entry so
the core stays dependency-free.
The fs surface and its fixtures exist as stubs from T-FGMJ; the path API used
to filter enumerated files is implemented by T-IRYT.
| Location | Role today |
|---|---|
plugin/lib/intersect/fs.ts | fs surface — throwing stubs. |
plugin/lib/intersect/index.ts | The path API used to filter enumerated files. |
plugin/lib/intersect/fixtures/fs.cases.json | fs spec, all pending. |
package.json | Root manifest; new runtime deps for the workspace land here. |
Proposed
Section titled “Proposed”intersect/fs is implemented over a chosen globber; filesInScope(patterns, {cwd,…})
enumerates on-disk files matching the scope, resolveIntersection(a, b, …) returns
the files matching both; the core entries (intersect, intersect/segments) still
pull zero runtime deps. fs fixtures run as integration tests over a temp tree.
Approach
Section titled “Approach”- Choose the globber (fast-glob or tinyglobby) and add it as a dependency used
only by
fs.ts. filesInScope(patterns, opts): glob the tree undercwdhonoringignore/onlyFiles/absolute; post-filter the results through the path API’smatchesso fs semantics are identical to the pure layer.resolveIntersection(a, b, opts):filesInScope(a, opts)then keep those that alsomatches(_, b).- Convert the fs fixtures to an integration harness: each case declares a file list to materialize under a temp dir, the op + args, and the expected relative paths; the harness builds the tree, runs the op, asserts, and cleans up.
- Assert the core entries do not transitively load the globber.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/lib/intersect/fs.ts | modify | Implement filesInScope / resolveIntersection. |
plugin/lib/intersect/tests/fs.test.ts | new | Temp-tree integration harness for the fs cases. |
plugin/lib/intersect/fixtures/fs.cases.json | modify | Activate as integration cases (temp-dir file lists). |
package.json | modify | Add the chosen globber to dependencies. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: The
fs.cases.jsonintegration cases pass against materialized temp trees. - AC-2:
filesInScope(["a/**"], { cwd })returns exactly the files undera/in the fixture tree;resolveIntersectionreturns their intersection with the second scope. - AC-3: A test asserts that importing
intersectorintersect/segmentsdoes not load the globber (dependency-isolation check). - AC-4:
bunx tsc --noEmitpasses.
Out of scope
Section titled “Out of scope”- Package
exportsfinalization and extraction —T-9XXD. - Watch mode / streaming enumeration.
Dependencies
Section titled “Dependencies”- Requires the implemented path API from
T-IRYT.
Discovery context
Section titled “Discovery context”- The L2 section of
D-4FRD-intersect-apilayered-api.md; serves DR-0011 (context assembly).
Depends on
Section titled “Depends on”T-IRYT