Skip to content

Commit e5c1e5a

Browse files
thymikeeclaude
andcommitted
refactor: trim the ad-script façade to real consumers, lock the one-export boundary
- packages/ad-script/src/index.ts: drop parseReplaySeriesFlags, formatTargetAnnotationCommentLine, parseTargetAnnotationCommentLine, TargetAnnotationLineParseResult, and TargetRect from the public façade — none has a consumer outside the package (re-swept every remaining export by grep; everything else kept has at least one real external importer). The functions/types stay exported from their declaring internal modules for the package's own internal use (script.ts, script-formatting.ts). - scripts/layering/package-boundaries.test.ts: add the parallel R11 assertions "the real tree parses, declares, and passes R11" already makes for maestro/provider-webdriver/provider-limrun/xml — ad-script exports exactly `.`, depends on exactly contracts+kernel, and is declared in root package.json — plus ad-script entries in the deep-resolution rejection coverage. Verified the lock catches a regression: temporarily added a fake `./codec` export to packages/ad-script/package.json and confirmed both the export-key-list assertion and the deep-resolution-rejection assertion fail; removed the plant and reconfirmed green. Refs #1478 Co-Authored-By: Claude <[email protected]>
1 parent b6761a8 commit e5c1e5a

2 files changed

Lines changed: 18 additions & 5 deletions

File tree

‎packages/ad-script/src/index.ts‎

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ export {
2929
formatScriptStringLiteral,
3030
isClickLikeCommand,
3131
isTouchTargetCommand,
32-
parseReplaySeriesFlags,
3332
stripRecordedRefGeneration,
3433
} from './internal/script-utils.ts';
3534

@@ -39,11 +38,9 @@ export {
3938
} from './internal/script-formatting.ts';
4039

4140
export {
42-
formatTargetAnnotationCommentLine,
4341
normalizeIdentifierField,
4442
normalizeLabelField,
4543
normalizeRoleField,
46-
parseTargetAnnotationCommentLine,
4744
parseTargetAnnotationV1Payload,
4845
serializeTargetAnnotationV1,
4946
truncateToUtf8Bytes,
@@ -54,9 +51,7 @@ export {
5451
} from './internal/target-annotation-serde.ts';
5552
export type {
5653
TargetAncestryEntry,
57-
TargetAnnotationLineParseResult,
5854
TargetAnnotationV1,
59-
TargetRect,
6055
TargetScrollRegion,
6156
TargetVerification,
6257
} from './internal/target-annotation-serde.ts';

‎scripts/layering/package-boundaries.test.ts‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,15 @@ test('the real tree parses, declares, and passes R11', () => {
219219
'@agent-device/contracts',
220220
'@agent-device/kernel',
221221
]);
222+
const adScriptPackage = packages.find((pkg) => pkg.name === '@agent-device/ad-script');
223+
assert.ok(adScriptPackage, 'ad-script package must exist');
224+
// Locks the "exports only `.`" boundary: a future `/codec` (or any other)
225+
// subpath widens this key list and fails the assertion (#1478 P5 dossier).
226+
assert.deepEqual([...adScriptPackage.exportTargets.keys()], ['@agent-device/ad-script']);
227+
assert.deepEqual([...adScriptPackage.workspaceDependencies].sort(), [
228+
'@agent-device/contracts',
229+
'@agent-device/kernel',
230+
]);
222231
const providerWebDriverPackage = packages.find(
223232
(pkg) => pkg.name === '@agent-device/provider-webdriver',
224233
);
@@ -270,6 +279,10 @@ test('the real tree parses, declares, and passes R11', () => {
270279
rootWorkspaceDependencyNames(repoRoot).has('@agent-device/maestro'),
271280
'root must declare the maestro workspace dependency',
272281
);
282+
assert.ok(
283+
rootWorkspaceDependencyNames(repoRoot).has('@agent-device/ad-script'),
284+
'root must declare the ad-script workspace dependency',
285+
);
273286
assert.ok(
274287
rootWorkspaceDependencyNames(repoRoot).has('@agent-device/provider-webdriver'),
275288
'root must declare the provider-webdriver workspace dependency',
@@ -304,6 +317,9 @@ test('Node resolution enforces the exports map at runtime', () => {
304317
'@agent-device/provider-limrun/src/runtime.ts',
305318
'@agent-device/xml/internal/parser',
306319
'@agent-device/xml/src/index.ts',
320+
'@agent-device/ad-script/codec',
321+
'@agent-device/ad-script/internal/script.ts',
322+
'@agent-device/ad-script/src/index.ts',
307323
]) {
308324
assert.throws(
309325
() => import.meta.resolve(deep),
@@ -329,4 +345,6 @@ test('Node resolution enforces the exports map at runtime', () => {
329345
);
330346
const xmlResolved = import.meta.resolve('@agent-device/xml');
331347
assert.ok(xmlResolved.endsWith('packages/xml/src/index.ts'), xmlResolved);
348+
const adScriptResolved = import.meta.resolve('@agent-device/ad-script');
349+
assert.ok(adScriptResolved.endsWith('packages/ad-script/src/index.ts'), adScriptResolved);
332350
});

0 commit comments

Comments
 (0)