Linked feedback: ADX-007
Problem
packages/adf/src/bundler.ts currently combines manifest parsing, trigger resolution,
AST merge/transformation, token estimation, and orchestration/file loading concerns.
This raises cognitive load and couples pure transformation behavior to orchestration paths.
Evidence:
- Manifest parsing in bundler:
packages/adf/src/bundler.ts:29
- Trigger resolution in bundler:
packages/adf/src/bundler.ts:160
- Merge and token estimation in bundler:
packages/adf/src/bundler.ts:331
Scope
- Extract manifest parsing/trigger resolution to
packages/adf/src/manifest.ts.
- Extract pure merge/token-estimation functions to
packages/adf/src/merger.ts.
- Keep
bundler.ts as orchestration shell only:
- load manifest
- resolve module paths
- read content
- parse docs
- call pure merger/evaluator
Acceptance Criteria
- Merge utilities are pure and independently unit-tested without filesystem mocks.
bundler.ts no longer defines merge/token estimation internals.
- CLI behavior for
adf bundle is unchanged for existing fixtures/tests.
- Existing bundle tests pass; add focused tests for extracted
merger.ts.
Test Plan
pnpm run test --filter @stackbilt/adf
- Add unit tests for:
- duplicate-section merge behavior across content types
- weight promotion rules
- token estimate parity against current behavior
Linked feedback: ADX-007
Problem
packages/adf/src/bundler.tscurrently combines manifest parsing, trigger resolution,AST merge/transformation, token estimation, and orchestration/file loading concerns.
This raises cognitive load and couples pure transformation behavior to orchestration paths.
Evidence:
packages/adf/src/bundler.ts:29packages/adf/src/bundler.ts:160packages/adf/src/bundler.ts:331Scope
packages/adf/src/manifest.ts.packages/adf/src/merger.ts.bundler.tsas orchestration shell only:Acceptance Criteria
bundler.tsno longer defines merge/token estimation internals.adf bundleis unchanged for existing fixtures/tests.merger.ts.Test Plan
pnpm run test --filter @stackbilt/adf