Move the package's public entry points into a dedicated src/sdk/ folder so the
public surface lives in one clearly-owned place, per plans/perfect-shape.md §5.5
("sdk/ = re-export barrels only") and the §3 target DAG. Follows the #951/#960
pattern (behaviorless path codemod; rslib entry KEYS unchanged so dist output
paths — and therefore package.json `exports` — stay byte-identical).
Barrel structure (all 11 public subpaths now resolve through src/sdk/):
- 9 already-thin barrels moved verbatim (git rename, internal import paths
re-depthed by one ../): index, artifacts, metro, batch, remote-config,
install-source, android-adb, contracts, selectors.
- io and finders keep their implementation at src root (real logic + internal
importers); src/sdk/io.ts and src/sdk/finders.ts re-export them (export *).
package.json exports/main/types: UNCHANGED. Each rslib entry key is preserved
(index, io, ...), so dist output stays dist/src/<name>.{js,d.ts} and the
published subpaths + files do not move. No exports rewrite was needed.
Repoints:
- rslib.config.ts: 11 entry sources -> src/sdk/*.ts (keys unchanged).
- 7 public *-test imports -> src/sdk/*.
- 3 internal src importers of the selectors barrel (find.ts, selector-read.ts,
resolution.ts) split to import impl directly (utils/selectors-parse.ts +
daemon/selectors.ts) — removes internal dependence on the public barrel.
- .fallowrc.json entrypoints + vitest coverage exclude (src/sdk/** glob).
Published-surface verification (npm pack --dry-run before/after):
- exports map identical; 146 packed files identical EXCEPT one internal
code-split chunk renumbered (dist/src/9836.js -> 893.js, byte-identical
content).
- All 11 public .d.ts byte-identical; 10/11 public .js byte-identical;
selectors.js differs only by that internal chunk reference. Same symbols.
Gates: tsc 0 · rslib build 0 · oxfmt/oxlint clean · fallow audit (31 files) clean
· vitest unit 2883 pass.
What
Consolidates the package's public entry points into a dedicated
src/sdk/folder so the public surface lives in one clearly-owned place, perplans/perfect-shape.md§5.5 ("sdk/ = re-export barrels only") and the §3 target DAG. This is the next Phase-5 layering item afterremote/(#951) andclient/(#960), and follows the same behaviorless path-codemod pattern.The published npm surface is byte-identical — this is pure internal reorganization behind the same public contract.
Barrel structure
All 11 public subpaths (
.,./io,./artifacts,./metro,./batch,./remote-config,./install-source,./android-adb,./contracts,./selectors,./finders) now resolve throughsrc/sdk/:../):index, artifacts, metro, batch, remote-config, install-source, android-adb, contracts, selectors.ioandfinderskeep their implementation atsrc/root (they contain real logic + have internal importers).src/sdk/io.tsandsrc/sdk/finders.tsre-export them (export *), sosrc/sdk/stays barrels-only.package.jsonexportsdiffNone — unchanged. Because each rslib entry key is preserved (
index,io, …), dist output staysdist/src/<name>.{js,d.ts}. The published subpaths and files do not move, so noexports/main/typesrewrite was needed (same technique #960 used forinternal/companion-tunnel). This is the safest possible outcome: the exports map is provably identical.npm pack --dry-runbefore / after (proving identical public surface)package.jsonexports/main/types.d.ts(all 11).js(11)selectors.jsdiffers only by 1 internal chunk refThe only delta in the entire tarball: one internal code-split chunk was renumbered
dist/src/9836.js -> dist/src/893.js(byte-identical content; a deterministic rspack chunk-id shift from the module-graph move). Every chunk that imports it just updates that one./9836.js->./893.jsreference. No public subpath, symbol, or.d.tschanged.Repoints (all internal / test — no public change)
rslib.config.ts: 11 entry sources ->src/sdk/*.ts(keys unchanged).*-testimports ->src/sdk/*.srcimporters of theselectorsbarrel (daemon/handlers/find.ts,commands/interaction/runtime/{selector-read,resolution}.ts) split to import impl directly (utils/selectors-parse.ts+daemon/selectors.ts) — removes internal dependence on the public barrel..fallowrc.jsonentrypoints +vitest.config.tscoverage exclude (src/sdk/**glob).Package-subpath consumers (
agent-device/io, websiteclient-api.md,installed-package-metro.test.ts) reference the unchanged subpaths — untouched.Verification
tsc -p tsconfig.json --noEmit-> 0rslib build-> 0; dist entry list identical (98 files), all 22 public entry files presentnpm pack --dry-run-> file list + exports identical (see above)oxfmt+oxlint --deny-warnings-> cleanfallow audit --base origin/main-> no issues in 31 changed filesvitest run --project unit-> 2883 passedscripts/layering/check.tsnot present in repo)