refactor(host-kit): split atomic-file by concern
Merged
TH
8d ago+713+713+012345678901234567890123456789-682-682-012345678901234567890123456789
Summary
atomic-file.ts (950 lines) mixed three concerns. This splits it by concern, move-only, in 19 files:
atomic-publish.ts: generic publication.process-lock.tsandowned-process-record.tsimport only this.script-destination.ts: the destination walk, exposure rules, level creation,publishScriptFileSync, Windows creation.script-destination-refusal.ts: exposure wording, hints, typed reasons. The walk and the name rules both use it, so it is its own module to avoid an import cycle.entry-name.ts: entry-name rules andresolveScriptDestination(moved frompath-resolution.ts).
hostPathRules moves to path-resolution.ts, which now imports none of the script modules. The @agent-device/host-kit/file surface is unchanged. Tests move beside their owners: 116 cases before and after.
A parallel PR deletes judgeScriptDestination. Whichever lands second rebases; here it moved unchanged into script-destination.ts.
Validation
At a7f803d73f (rebased onto 83328f1d8a; only the two cross-package comment pointers #4742 moved conflicted):
- Diff review: every function body is byte-identical (sorted-line diff of old vs new modules differs only in imports and
exportkeywords), so checks and their order are unchanged. - Eager closure:
eager-closure-budgets.test.tsgreen, no budget change.owned-process-record.ts5 files / 96 KB ā 4 files / 32 KB,process-lock.ts220 KB ā 188 KB. - host-kit, remote, capture-kit recording unit suites: 1203 passed. Daemon unit suite, typecheck, lint,
check:layering(staged),check:production-exports,fallow audit --base origin/main: pass. a7f803d73fonly repoints the ADR 0016 path reference toentry-name.ts.- CI validates the pushed head.
š¤ Generated with Claude Code