docs(cli): remove tables/views scaffold guidance#616
Conversation
📝 WalkthroughWalkthroughThis PR marks a major release for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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)
📝 Coding Plan
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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/ztd-cli/tests/directoryFinding.docs.test.ts (1)
31-54: Consider extracting file contents to reduce redundant reads.The same files are read multiple times (once in the loop at line 39, then again at lines 45, 48, and 51). While this is fine for test clarity and the overhead is negligible, you could cache the reads for cleaner code.
♻️ Optional: Cache file contents
test('repository guidance centers the single SQL source location', () => { - const files = [ - 'packages/ztd-cli/templates/src/repositories/AGENTS.md', - 'packages/ztd-cli/templates/src/infrastructure/persistence/AGENTS.md', - 'packages/ztd-cli/templates/src/infrastructure/persistence/repositories/AGENTS.md' - ]; - - for (const file of files) { - const contents = readNormalizedFile(file); + const repoAgents = readNormalizedFile('packages/ztd-cli/templates/src/repositories/AGENTS.md'); + const persistenceAgents = readNormalizedFile('packages/ztd-cli/templates/src/infrastructure/persistence/AGENTS.md'); + const persistenceRepoAgents = readNormalizedFile('packages/ztd-cli/templates/src/infrastructure/persistence/repositories/AGENTS.md'); + + for (const contents of [repoAgents, persistenceAgents, persistenceRepoAgents]) { expect(contents).toContain('1 SQL file / 1 QuerySpec / 1 repository entrypoint / 1 DTO'); expect(contents).toContain('src/sql'); expect(contents).not.toContain('tables/views'); } - expect(readNormalizedFile('packages/ztd-cli/templates/src/repositories/AGENTS.md')).toContain( + expect(repoAgents).toContain( 'Repositories MUST load SQL assets from `src/sql` through shared loader infrastructure.', ); - expect(readNormalizedFile('packages/ztd-cli/templates/src/infrastructure/persistence/AGENTS.md')).toContain( + expect(persistenceAgents).toContain( 'ZTD-specific workflow rules apply here and in the related `src/sql`, `src/catalog`, and `ztd` assets.', ); - expect(readNormalizedFile('packages/ztd-cli/templates/src/infrastructure/persistence/repositories/AGENTS.md')).toContain( + expect(persistenceRepoAgents).toContain( 'Repositories MUST load SQL assets from `src/sql` through shared loader infrastructure.', ); });🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/ztd-cli/tests/directoryFinding.docs.test.ts` around lines 31 - 54, The test 'repository guidance centers the single SQL source location' reads the same files multiple times; cache the results by mapping each path in the files array to its contents once (use the existing files array and readNormalizedFile) and then assert against the cached contents instead of calling readNormalizedFile repeatedly for the same paths to reduce redundant reads and clarify intent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/ztd-cli/tests/directoryFinding.docs.test.ts`:
- Around line 31-54: The test 'repository guidance centers the single SQL source
location' reads the same files multiple times; cache the results by mapping each
path in the files array to its contents once (use the existing files array and
readNormalizedFile) and then assert against the cached contents instead of
calling readNormalizedFile repeatedly for the same paths to reduce redundant
reads and clarify intent.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4cd1dea0-c6ef-48a9-9029-6f73397040e0
⛔ Files ignored due to path filters (1)
packages/ztd-cli/tests/__snapshots__/init.command.test.ts.snapis excluded by!**/*.snap
📒 Files selected for processing (20)
.changeset/quiet-badgers-smile.mdREADME.mdpackages/ztd-cli/src/commands/init.tspackages/ztd-cli/src/utils/agents.tspackages/ztd-cli/templates/README.mdpackages/ztd-cli/templates/README.webapi.mdpackages/ztd-cli/templates/src/catalog/AGENTS.mdpackages/ztd-cli/templates/src/infrastructure/persistence/AGENTS.mdpackages/ztd-cli/templates/src/infrastructure/persistence/repositories/AGENTS.mdpackages/ztd-cli/templates/src/infrastructure/persistence/repositories/tables/AGENTS.mdpackages/ztd-cli/templates/src/infrastructure/persistence/repositories/tables/README.mdpackages/ztd-cli/templates/src/infrastructure/persistence/repositories/views/AGENTS.mdpackages/ztd-cli/templates/src/infrastructure/persistence/repositories/views/README.mdpackages/ztd-cli/templates/src/repositories/AGENTS.mdpackages/ztd-cli/templates/src/repositories/tables/AGENTS.mdpackages/ztd-cli/templates/src/repositories/tables/README.mdpackages/ztd-cli/templates/src/repositories/views/AGENTS.mdpackages/ztd-cli/templates/src/repositories/views/README.mdpackages/ztd-cli/tests/directoryFinding.docs.test.tspackages/ztd-cli/tests/init.command.test.ts
💤 Files with no reviewable changes (10)
- packages/ztd-cli/templates/src/infrastructure/persistence/repositories/views/AGENTS.md
- packages/ztd-cli/templates/src/repositories/tables/README.md
- packages/ztd-cli/templates/src/infrastructure/persistence/repositories/tables/README.md
- packages/ztd-cli/templates/src/repositories/tables/AGENTS.md
- packages/ztd-cli/templates/src/infrastructure/persistence/repositories/tables/AGENTS.md
- packages/ztd-cli/src/utils/agents.ts
- packages/ztd-cli/templates/src/infrastructure/persistence/repositories/views/README.md
- packages/ztd-cli/templates/src/repositories/views/AGENTS.md
- packages/ztd-cli/src/commands/init.ts
- packages/ztd-cli/templates/src/repositories/views/README.md
This PR is the clean #601 cut of the tables/views removal work.
It removes the tables/views scaffold guidance, keeps SQL assets under a single obvious location, and updates docs/tests/snapshots to match the new query-unit policy.
It intentionally excludes the unrelated join-direction lint work that was mixed into PR #614.
Summary by CodeRabbit
Release Notes
Refactor
tables/andviews/directoriesDocumentation
Tests