fix(ztd-cli): align scaffold cross-root imports with root aliases#780
Conversation
📝 WalkthroughWalkthroughThis PR extends the CLI scaffolding to support root-alias imports for libraries and adapters alongside the existing features and tests aliases. Template configurations, source files, and verification tooling are updated to enforce consistent root-alias usage across project boundaries. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
#libraries/*and#adapters/*alongside the existing#features/*and#tests/*aliases acrosspackage.json,tsconfig.json, andvitest.config.ts.Verification
pnpm --filter @rawsql-ts/ztd-cli test -- init.command.test.ts directoryFinding.docs.test.tspnpm verify:generated-project-modeMerge Readiness
Tracking issue: #778
Scoped checks run:
pnpm --filter @rawsql-ts/ztd-cli test -- init.command.test.ts directoryFinding.docs.test.ts;pnpm verify:generated-project-modeWhy full baseline is not required: The pre-commit full baseline (
pnpm test) is currently failing in unchanged areas:packages/ztd-cli/tests/agentsPolicy.unit.test.ts,packages/ztd-cli/tests/commandTelemetry.unit.test.ts, andpackages/ztd-cli/tests/setupEnv.unit.test.ts. This PR does not modify the related source or test files, and the scoped checks above cover the changed scaffold contract.CLI Surface Migration
No-migration rationale: CLI commands and flags do not change. The user-visible change is limited to generated project configuration and scaffolded import paths.
Upgrade note: Newly generated projects will expose
#libraries/*and#adapters/*aliases and use them for cross-root imports.Deprecation/removal plan or issue: none
Docs/help/examples updated: Yes. Updated
packages/ztd-cli/README.mdandpackages/ztd-cli/templates/README.md.Release/changeset wording: Added
.changeset/ten-soft-camels-jump.mdfor@rawsql-ts/ztd-clias a patch release.Scaffold Contract Proof
No-proof rationale: none
Non-edit assertion: Same-root local imports remain relative; the change only standardizes imports that cross canonical roots.
Fail-fast input-contract proof:
packages/ztd-cli/tests/init.command.test.tsandpackages/ztd-cli/tests/directoryFinding.docs.test.tsnow assert alias definitions and generated cross-root imports for#libraries/*and#adapters/*.Generated-output viability proof:
pnpm verify:generated-project-modepassed after starter init, feature scaffold, and generated-project test execution with the new alias configuration.Issue
Customer Value
Outcome
ztd initnow emits#features/*,#libraries/*,#adapters/*, and#tests/*consistently across runtime and TypeScript resolution surfaces.Acceptance Criteria
#features/#testsbehavior stays aligned with the new aliases: doneVerification
pnpm --filter @rawsql-ts/ztd-cli test -- init.command.test.ts directoryFinding.docs.test.tspnpm verify:generated-project-modegit commithook attempted the full baseline viapnpm testand exposed unrelated existing failures in unchanged files.Repository Evidence
packages/ztd-cli/src/commands/init.tspackages/ztd-cli/templates/tsconfig.jsonpackages/ztd-cli/templates/vitest.config.tspackages/ztd-cli/templates/src/adapters/pg/sql-client.tspackages/ztd-cli/templates/src/adapters/console/repositoryTelemetry.tspackages/ztd-cli/templates/tests/support/testkit-client.webapi.tspackages/ztd-cli/tests/init.command.test.tspackages/ztd-cli/tests/directoryFinding.docs.test.tsscripts/verify-generated-project-mode.mjs.changeset/ten-soft-camels-jump.mdSupplementary Evidence
Open Questions
Merge Blockers