Follow-up to #670. A Fallow duplication scan (fallow dupes --mode mild) shows the shipped client templates are maintained as hand-synced copies:
packages/plugin-axios/templates/serializers.ts and packages/plugin-fetch/templates/serializers.ts are 427 identical lines (the largest hand-written clone in the repo).
templates/standardSchema.ts exists three times, byte-identical: internals/client/templates/, packages/plugin-axios/templates/, packages/plugin-fetch/templates/.
There is no copy script or CI check keeping them in sync today; they are identical only by discipline. The copies have to keep shipping inside each published package (both list templates in files and expose ./templates/* in exports), so simply importing from @internals/client is not an option.
Goal
One source of truth per template. A fix to the query-string serializer or the standard-schema shim lands once and cannot drift between the axios and fetch clients.
Approach
- Treat
internals/client/templates/ as the source of truth and move serializers.ts there next to standardSchema.ts.
- Add a build or prepublish step (a small script wired into the turbo
build task) that copies internals/client/templates/* into each client plugin's templates/ directory.
- Add a CI check (or generate into a gitignored path) so a stale copy fails the build instead of shipping.
Acceptance
serializers.ts and standardSchema.ts each have exactly one hand-edited source.
- Published packages still ship
templates/serializers.ts and templates/standardSchema.ts at the same paths (no consumer-facing change).
- Editing a plugin-local copy directly fails CI or is impossible.
fallow dupes no longer reports the serializers or standardSchema clone groups.
🤖 Generated with Claude Code
https://claude.ai/code/session_014dHSbuoSN5pYaXowWwZj5B
Follow-up to #670. A Fallow duplication scan (
fallow dupes --mode mild) shows the shipped client templates are maintained as hand-synced copies:packages/plugin-axios/templates/serializers.tsandpackages/plugin-fetch/templates/serializers.tsare 427 identical lines (the largest hand-written clone in the repo).templates/standardSchema.tsexists three times, byte-identical:internals/client/templates/,packages/plugin-axios/templates/,packages/plugin-fetch/templates/.There is no copy script or CI check keeping them in sync today; they are identical only by discipline. The copies have to keep shipping inside each published package (both list
templatesinfilesand expose./templates/*inexports), so simply importing from@internals/clientis not an option.Goal
One source of truth per template. A fix to the query-string serializer or the standard-schema shim lands once and cannot drift between the axios and fetch clients.
Approach
internals/client/templates/as the source of truth and moveserializers.tsthere next tostandardSchema.ts.buildtask) that copiesinternals/client/templates/*into each client plugin'stemplates/directory.Acceptance
serializers.tsandstandardSchema.tseach have exactly one hand-edited source.templates/serializers.tsandtemplates/standardSchema.tsat the same paths (no consumer-facing change).fallow dupesno longer reports the serializers or standardSchema clone groups.🤖 Generated with Claude Code
https://claude.ai/code/session_014dHSbuoSN5pYaXowWwZj5B