Skip to content

feat(ztd-cli): align starter directory taxonomy - #777

Merged
mk3008 merged 3 commits into
mainfrom
776-bfa-ディレクトリ構成
Apr 16, 2026

Hidden character warning

The head ref may contain hidden characters: "776-bfa-\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u69cb\u6210"
Merged

feat(ztd-cli): align starter directory taxonomy#777
mk3008 merged 3 commits into
mainfrom
776-bfa-ディレクトリ構成

Conversation

@mk3008

@mk3008 mk3008 commented Apr 15, 2026

Copy link
Copy Markdown
Owner

Summary

  • Resolve BFA ディレクトリ構成 #776 by aligning the starter scaffold and guidance with the canonical directory taxonomy.
  • Treat src/features, src/adapters, and src/libraries as the app-code roots; keep db/ for schema assets, tests/support/* for shared verification support, and .ztd/* for tool-managed workspace files.
  • Move the scaffolded SqlClient and telemetry seams into the new libraries / adapters layout and update template guidance, README text, and tutorials to describe the same ownership model.
  • Add a changeset for @rawsql-ts/ztd-cli as a minor release.

Verification

  • pnpm --filter @rawsql-ts/ztd-cli test -- directoryFinding.docs.test.ts sqlFirstTutorial.docs.test.ts init.command.test.ts

Merge Readiness

  • No baseline exception requested.
  • Baseline exception requested and linked below.

Tracking issue: #776
Scoped checks run: pnpm --filter @rawsql-ts/ztd-cli test -- directoryFinding.docs.test.ts sqlFirstTutorial.docs.test.ts init.command.test.ts
Why full baseline is not required: the change scope is limited to @rawsql-ts/ztd-cli scaffold/templates/docs, and the targeted scaffold/docs contract tests for those surfaces passed.

CLI Surface Migration

  • No migration packet required for this CLI change.
  • CLI/user-facing surface change and migration packet completed.

No-migration rationale:
Upgrade note: newly scaffolded projects now place shared runtime contracts under src/libraries/*, technology bindings under src/adapters/<tech>/*, shared verification support under tests/support/*, and keep db/* reserved for DDL/migration/schema assets.
Deprecation/removal plan or issue: none beyond #776.
Docs/help/examples updated: yes; updated README.md, packages/ztd-cli/README.md, template README/AGENTS files, and the directory/telemetry/tutorial guides.
Release/changeset wording: .changeset/green-apples-drum.md releases @rawsql-ts/ztd-cli as minor for the canonical directory taxonomy alignment.

Scaffold Contract Proof

  • No scaffold contract proof required for this PR.
  • Scaffold contract proof completed.

No-proof rationale:
Non-edit assertion: the starter guidance now consistently reserves db/* for schema assets, tests/support/* for shared verification support, .ztd/* for tool-managed workspace files, and keeps feature-owned runtime seams under src/features/*, src/libraries/*, and src/adapters/*.
Fail-fast input-contract proof: init.command.test.ts verifies the emitted starter structure and guidance for the scaffolded project layout.
Generated-output viability proof: init.command.test.ts, directoryFinding.docs.test.ts, and sqlFirstTutorial.docs.test.ts passed with the updated paths and examples.

Closes #776

Summary by CodeRabbit

  • Documentation & Scaffolding
    • Updated starter docs and guides to prescribe a feature-first app layout and clarify where shared seams, contracts, adapters, and DB migrations belong.
  • New Features
    • Added library/adapter templates for a shared SQL client, telemetry contract, console telemetry sink, and a PG adapter.
  • Tests
    • Updated scaffolding/tests conventions (renamed query type to “query-boundary”) and added unit/tests validating the new adapters and init scaffolding.

@mk3008 mk3008 linked an issue Apr 15, 2026 that may be closed by this pull request
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@mk3008 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 27 minutes and 35 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 27 minutes and 35 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 3af6e70e-0e55-431b-a29f-023e645dc501

📥 Commits

Reviewing files that changed from the base of the PR and between a0581f0 and b85df79.

📒 Files selected for processing (3)
  • packages/ztd-cli/README.md
  • packages/ztd-cli/src/commands/init.ts
  • packages/ztd-cli/tests/init.command.test.ts
📝 Walkthrough

Walkthrough

The PR restructures the starter scaffold's directory taxonomy from src/db/src/infrastructure to src/features, src/libraries, and src/adapters; moves SQL contracts to src/libraries/sql/, telemetry to src/libraries/telemetry/, and driver adapters to src/adapters/<tech>/; updates ztd init to emit files to the new locations; and updates docs, templates, and tests to match.

Changes

Cohort / File(s) Summary
Changeset & Top-level docs
/.changeset/green-apples-drum.md, README.md
Adds changeset and updates README guidance to declare app-code roots (src/features, src/libraries, src/adapters), db/ as DDL/schema-only, shared seams in src/features/_shared/ and tests/support/, and .ztd/ as tool-managed.
Guide & Recipe docs
docs/.../feature-index.md, docs/.../multiple-db-clients-in-one-workflow.md, docs/.../repository-telemetry-setup.md, docs/.../sql-first-end-to-end-tutorial.md, docs/.../ztd-cli-describe-schema.md, docs/recipes/sql-contract.md
Updates file paths/import examples and feature-index links to point at src/libraries/*, src/adapters/*, and .ztd/generated/*; clarifies ownership/placement rules and generated artifact locations.
Init command & tests
packages/ztd-cli/src/commands/init.ts, packages/ztd-cli/tests/*.test.ts
Refactors scaffold path computation and dry-run emitted file lists to produce src/libraries/sql/*, src/libraries/telemetry/*, src/adapters/pg/sql-client.ts, src/adapters/console/repositoryTelemetry.ts, and new adapter README; updates tests to assert the new layout and template outputs.
Library templates: SQL & Telemetry
packages/ztd-cli/templates/src/libraries/...
packages/ztd-cli/templates/src/libraries/sql/sql-client.ts, packages/ztd-cli/templates/src/libraries/telemetry/types.ts, .../repositoryTelemetry.ts
Adds shared SqlClient contract and README; introduces telemetry types, noop/default telemetry, and resolver with README.
Adapter templates: pg & console
packages/ztd-cli/templates/src/adapters/...
packages/ztd-cli/templates/src/adapters/pg/sql-client.ts, .../console/repositoryTelemetry.ts, .../README.md
Adds fromPg adapter for pg-style queryables and a console-backed repository telemetry adapter; supplies adapters README and wiring for adapter emission.
Feature & template guidance
packages/ztd-cli/templates/* (AGENTS.md, PROMPT_DOGFOOD.md, README.md, features/README.md, features/AGENTS.md)
Updates templates and prompts to require the feature-first layout, delineate shared seams, and move generated/test artifacts into feature-local src/features/<feature>/queries/<query>/tests/.
Test support & harness
packages/ztd-cli/templates/tests/support/*
Adjusts test support imports and docs to use src/libraries/sql/*, renames „queryspec“ to „query-boundary“, and relocates generated/case paths to query-local src/features/.../queries/.../tests/.
New unit tests
packages/ztd-cli/tests/sqlClientAdapterTemplate.unit.test.ts
Adds unit tests validating fromPg behavior and named-parameter validation.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant CLI as ztd init (packages/ztd-cli/src/commands/init.ts)
    participant Templates as Template Bundle (packages/ztd-cli/templates)
    participant FS as Project Filesystem

    Dev->>CLI: run `ztd init` / scaffold (dry-run or emit)
    CLI->>Templates: select template files (libraries, adapters, tests, READMEs)
    Templates-->>CLI: provide template content & target mapping
    CLI->>FS: emit files to new targets:
    Note right of FS: `src/libraries/sql/*`<br/>`src/libraries/telemetry/*`<br/>`src/adapters/pg/*`<br/>`src/adapters/console/*`<br/>`src/features/.../queries/.../tests/...`
    FS-->>Dev: scaffolded project with feature-first layout
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Poem

🐰 Hop! The burrow's been reorganized,
Libraries nested, adapters stylized,
SqlClient tucked in a proper den,
Telemetry hops to shared-land again,
Queries now bound close to their ken. 🥕✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.46% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(ztd-cli): align starter directory taxonomy' clearly summarizes the main change: reorganizing the starter scaffold's directory structure according to a canonical taxonomy.
Description check ✅ Passed The description provides a clear summary of changes, verification steps, merge readiness assessment with linked issue #776, CLI surface migration notes, and scaffold contract proof details meeting the template requirements.
Linked Issues check ✅ Passed The PR implementation aligns with all key objectives from #776: establishes app-code roots (src/features, src/adapters, src/libraries), reserves db/ for schema assets, designates tests/support/* for shared verification, restricts .ztd/* to tool-managed files, places SqlClient in src/libraries/sql, routes driver bindings to src/adapters/, documents adapter rules, and explicitly defines exceptions for shared seams.
Out of Scope Changes check ✅ Passed All changes are directly scoped to implementing the canonical directory taxonomy from #776: documentation updates reflect the new structure, template files are reorganized to match the new layout, and tests validate the updated scaffold contract.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 776-bfa-ディレクトリ構成

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (1)
packages/ztd-cli/templates/src/adapters/README.md (1)

1-7: LGTM! Clear adapter placement guidance.

The documentation properly establishes src/adapters/<tech>/ as the location for technology-specific bindings and explicitly reserves db/ for DDL/migrations/schema assets.

Optional: Consider hyphenating compound modifier
-- Put driver or sink specific code under `src/adapters/<tech>/`.
+- Put driver-or-sink-specific code under `src/adapters/<tech>/`.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ztd-cli/templates/src/adapters/README.md` around lines 1 - 7, Update
the compound modifier in the README: change the phrase "Put driver or sink
specific code under `src/adapters/<tech>/`" to use correct hyphenation as "Put
driver- or sink-specific code under `src/adapters/<tech>/`" so both modifiers
are properly attached; edit the string in the README.md content near the top
(look for the sentence starting with "Put driver or sink specific code") and
replace it with the hyphenated version.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/guide/ztd-cli-describe-schema.md`:
- Around line 63-64: The docs list of generated files is missing the
`.ztd/generated/ztd-fixture-manifest.generated.ts` entry; update the file list
in the ztd-cli describe-schema documentation (the array including
".ztd/generated/ztd-row-map.generated.ts" and
".ztd/generated/ztd-layout.generated.ts") to include
".ztd/generated/ztd-fixture-manifest.generated.ts" so the documented
`ztd-config` output matches the actual command descriptor.

In `@packages/ztd-cli/README.md`:
- Around line 58-59: Clarify the adapter-boundary rule for
src/adapters/<tech>/*: state that the <tech> path is a boundary when it names a
single technology (e.g., src/adapters/pg/ is the adapter boundary), but when the
technology token is plural or represents a family (e.g., aws, cloud), treat
<tech> as a container for child boundaries and require explicit child folders
(e.g., src/adapters/aws/<child>/ where each <child> is a concrete adapter like
s3 or lambda); update the README sentence to explicitly permit both patterns and
give the two canonical examples (src/adapters/pg/ and src/adapters/aws/<child>/)
so consumers know when to create direct adapters versus nested adapter folders.

In `@packages/ztd-cli/src/commands/init.ts`:
- Around line 2778-2782: The dry-run plan is out of sync with the actual writes
in runInitCommand(): ensure the sql README and adapters README that appear in
the plan are actually emitted (or remove them from the plan). Specifically, in
runInitCommand() fix the handling of sqlReadme so it is both registered in
absolutePaths and written via the same write/template flow used for other files
(or drop it from absolutePaths if not desired), add the adapters README
template/path/write step (e.g., create and write 'src/adapters/README.md' using
the adapters README template) and remove the duplicate 'src/libraries/README.md'
entry added in starter mode so absolutePaths/file template lists exactly mirror
the files written.

In `@packages/ztd-cli/templates/src/adapters/pg/sql-client.ts`:
- Around line 16-34: The PR added a new adapter function fromPg with runtime
behavior (unwrapping result.rows and throwing when values is a named object) but
no tests; add behavioral tests that call fromPg.query to verify (1) it returns
the rows array extracted from the underlying queryable (i.e., that
queryable.query resolves to { rows: [...] } and fromPg.query returns that inner
array) and (2) it throws the specific Error when passed a non-array values
object (named parameters). Target tests to exercise the exported fromPg function
and its query method (use a mock/stub queryable implementing query(text,
values?) => Promise<{ rows: [...] }>) and assert both successful row unwrapping
and the named-parameter rejection.

In `@packages/ztd-cli/tests/directoryFinding.docs.test.ts`:
- Around line 125-131: The test's expected scaffold bundle list in
directoryFinding.docs.test.ts is missing the new README for the sql library;
update the array of expected paths in the test to include
'packages/ztd-cli/templates/src/libraries/sql/README.md' so it matches what
buildInitDryRunPlan() advertises, then re-run and update any
snapshots/assertions that depend on that list.

---

Nitpick comments:
In `@packages/ztd-cli/templates/src/adapters/README.md`:
- Around line 1-7: Update the compound modifier in the README: change the phrase
"Put driver or sink specific code under `src/adapters/<tech>/`" to use correct
hyphenation as "Put driver- or sink-specific code under `src/adapters/<tech>/`"
so both modifiers are properly attached; edit the string in the README.md
content near the top (look for the sentence starting with "Put driver or sink
specific code") and replace it with the hyphenated version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50d6b091-5303-46b2-a0a1-46e61135df91

📥 Commits

Reviewing files that changed from the base of the PR and between 0564e46 and 9ee5744.

📒 Files selected for processing (34)
  • .changeset/green-apples-drum.md
  • README.md
  • docs/guide/feature-index.md
  • docs/guide/multiple-db-clients-in-one-workflow.md
  • docs/guide/repository-telemetry-setup.md
  • docs/guide/sql-first-end-to-end-tutorial.md
  • docs/guide/ztd-cli-describe-schema.md
  • docs/recipes/sql-contract.md
  • packages/ztd-cli/README.md
  • packages/ztd-cli/src/commands/init.ts
  • packages/ztd-cli/templates/AGENTS.md
  • packages/ztd-cli/templates/PROMPT_DOGFOOD.md
  • packages/ztd-cli/templates/README.md
  • packages/ztd-cli/templates/src/adapters/README.md
  • packages/ztd-cli/templates/src/adapters/console/repositoryTelemetry.ts
  • packages/ztd-cli/templates/src/adapters/pg/sql-client.ts
  • packages/ztd-cli/templates/src/features/AGENTS.md
  • packages/ztd-cli/templates/src/features/README.md
  • packages/ztd-cli/templates/src/infrastructure/persistence/repositories/AGENTS.md
  • packages/ztd-cli/templates/src/infrastructure/telemetry/AGENTS.md
  • packages/ztd-cli/templates/src/libraries/README.md
  • packages/ztd-cli/templates/src/libraries/sql/README.md
  • packages/ztd-cli/templates/src/libraries/sql/sql-client.ts
  • packages/ztd-cli/templates/src/libraries/telemetry/repositoryTelemetry.ts
  • packages/ztd-cli/templates/src/libraries/telemetry/types.ts
  • packages/ztd-cli/templates/src/repositories/AGENTS.md
  • packages/ztd-cli/templates/tests/AGENTS.md
  • packages/ztd-cli/templates/tests/support/testkit-client.webapi.ts
  • packages/ztd-cli/templates/tests/support/ztd/README.md
  • packages/ztd-cli/templates/tests/support/ztd/harness.ts
  • packages/ztd-cli/templates/tests/support/ztd/verifier.ts
  • packages/ztd-cli/tests/directoryFinding.docs.test.ts
  • packages/ztd-cli/tests/init.command.test.ts
  • packages/ztd-cli/tests/sqlFirstTutorial.docs.test.ts

Comment thread docs/guide/ztd-cli-describe-schema.md
Comment thread packages/ztd-cli/README.md Outdated
Comment thread packages/ztd-cli/src/commands/init.ts Outdated
Comment on lines +16 to +34
export function fromPg(
queryable: {
query(text: string, values?: readonly unknown[]): Promise<{ rows: Record<string, unknown>[] }>;
}
): SqlClient {
return {
query<T extends Record<string, unknown> = Record<string, unknown>>(
text: string,
values?: readonly unknown[] | Record<string, unknown>
): Promise<T[]> {
if (values != null && !Array.isArray(values)) {
throw new Error('fromPg adapter does not support named parameter objects; use positional parameter arrays');
}
return queryable
.query(text, values as readonly unknown[])
.then((result) => result.rows as T[]);
}
};
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Add behavioral coverage for the new fromPg adapter path.

This introduces new runtime behavior (row unwrapping and named-parameter rejection), but no direct behavior test is included in the provided change set for this adapter surface.

As per coding guidelines: "Unless the request explicitly says not to, behavior changes must add or update tests in the same change".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ztd-cli/templates/src/adapters/pg/sql-client.ts` around lines 16 -
34, The PR added a new adapter function fromPg with runtime behavior (unwrapping
result.rows and throwing when values is a named object) but no tests; add
behavioral tests that call fromPg.query to verify (1) it returns the rows array
extracted from the underlying queryable (i.e., that queryable.query resolves to
{ rows: [...] } and fromPg.query returns that inner array) and (2) it throws the
specific Error when passed a non-array values object (named parameters). Target
tests to exercise the exported fromPg function and its query method (use a
mock/stub queryable implementing query(text, values?) => Promise<{ rows: [...]
}>) and assert both successful row unwrapping and the named-parameter rejection.

Comment thread packages/ztd-cli/tests/directoryFinding.docs.test.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/ztd-cli/src/commands/init.ts (1)

2796-2812: ⚠️ Potential issue | 🟠 Major

--dry-run still over-reports files for non-starter init

Line 2808-Line 2812 are always included in the dry-run plan, but those files are only written in starter mode (Line 1225-Line 1262). This keeps dry-run output inaccurate for non-starter workflows.

🔧 Suggested fix (keep dry-run parity with actual writes)
   const files = [
     'ztd.config.json',
     path.join(DEFAULT_ZTD_CONFIG.ddlDir, schemaFileName),
     path.join('src', 'features', 'README.md'),
     path.join(resolveSupportDir(DEFAULT_ZTD_CONFIG), 'global-setup.ts'),
     path.join(resolveSupportDir(DEFAULT_ZTD_CONFIG), 'setup-env.ts'),
     path.join(resolveGeneratedDir(DEFAULT_ZTD_CONFIG), 'ztd-row-map.generated.ts'),
     path.join(resolveGeneratedDir(DEFAULT_ZTD_CONFIG), 'ztd-layout.generated.ts'),
     path.join(resolveGeneratedDir(DEFAULT_ZTD_CONFIG), 'ztd-fixture-manifest.generated.ts'),
     'README.md',
     '.env.example',
     '.gitignore',
-    'src/libraries/README.md',
-    'src/libraries/sql/README.md',
     'src/libraries/sql/sql-client.ts',
-    'src/adapters/README.md',
     'src/adapters/pg/sql-client.ts',
     'vitest.config.ts',
     'tsconfig.json'
   ];

   if (starter) {
     files.push(
+      path.join('src', 'libraries', 'README.md'),
+      path.join('src', 'libraries', 'sql', 'README.md'),
+      path.join('src', 'adapters', 'README.md'),
       STARTER_COMPOSE_FILE,
       path.join('src', 'features', '_shared', 'featureQueryExecutor.ts'),
       path.join('src', 'features', '_shared', 'loadSqlResource.ts'),
       path.join('src', 'features', 'smoke', 'README.md'),
       path.join('src', 'features', 'smoke', 'tests', 'README.md'),
       path.join('src', 'features', 'smoke', 'boundary.ts'),
       path.join('src', 'features', 'smoke', 'tests', 'smoke.boundary.test.ts'),
       path.join('src', 'features', 'smoke', 'tests', 'smoke.validation.test.ts'),
       path.join('src', 'features', 'smoke', 'tests', 'smoke.test.ts'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'tests', 'smoke.boundary.ztd.test.ts'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'boundary.ts'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'smoke.sql'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'tests', 'boundary-ztd-types.ts'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'tests', 'cases', 'basic.case.ts'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'tests', 'generated', 'analysis.json'),
       path.join('src', 'features', 'smoke', 'queries', 'smoke', 'tests', 'generated', 'TEST_PLAN.md'),
       path.join('tests', 'support', 'ztd', 'README.md'),
       path.join('tests', 'support', 'ztd', 'case-types.ts'),
       path.join('tests', 'support', 'ztd', 'verifier.ts'),
       path.join('tests', 'support', 'ztd', 'harness.ts'),
       path.join('src', 'libraries', 'telemetry', 'types.ts'),
       path.join('src', 'libraries', 'telemetry', 'repositoryTelemetry.ts'),
       path.join('src', 'adapters', 'console', 'repositoryTelemetry.ts'),
       path.join(resolveSupportDir(DEFAULT_ZTD_CONFIG), 'postgres-testkit.ts')
     );
   }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ztd-cli/src/commands/init.ts` around lines 2796 - 2812, The dry-run
currently lists starter-only files because the files array unconditionally
includes entries (e.g., 'src/libraries/README.md',
'src/libraries/sql/README.md', 'src/libraries/sql/sql-client.ts',
'src/adapters/README.md', 'src/adapters/pg/sql-client.ts'); update the code that
builds that files list in the init command to only push those starter-specific
entries when starter mode is enabled (the same condition that triggers the
actual starter writes in the initStarter()/starter branch), so the --dry-run
output matches what will actually be written; reference the same starter
flag/variable used around initStarter() and gate the inclusion of those file
paths accordingly.
🧹 Nitpick comments (1)
packages/ztd-cli/README.md (1)

58-60: Split the ownership rule into bullets for scanability.

This paragraph is accurate, but it packs too many rules into two long sentences. Converting it to a short bullet list will make the taxonomy easier to apply correctly.

Proposed doc-only refactor
-Outside feature-owned boundaries, keep shared feature seams under `src/features/_shared/*`, driver-neutral contracts under `src/libraries/*`, driver- or sink-specific bindings under `src/adapters/<tech>/*`, shared verification seams under `tests/support/*`, and tool-managed assets under `.ztd/*`.
-Treat `src/adapters/pg/` as the adapter boundary when `<tech>` names one concrete technology. If `<tech>` names a family or plural container such as `aws` or `cloud`, treat `src/adapters/<tech>/` as a parent container and put each concrete adapter in its own child boundary such as `src/adapters/aws/s3/` or `src/adapters/aws/lambda/`.
-Reserve `db/` for DDL, migration, and schema assets; do not place runtime clients or adapters there.
+Outside feature-owned boundaries:
+- Keep shared feature seams under `src/features/_shared/*`.
+- Keep driver-neutral contracts under `src/libraries/*`.
+- Keep driver- or sink-specific bindings under `src/adapters/<tech>/*`.
+- Keep shared verification seams under `tests/support/*`.
+- Keep tool-managed assets under `.ztd/*`.
+
+Adapter boundary rule:
+- If `<tech>` is one concrete technology, treat `src/adapters/<tech>/` as the adapter boundary (for example, `src/adapters/pg/`).
+- If `<tech>` is a family/plural container (for example, `aws`, `cloud`), treat `src/adapters/<tech>/` as a parent and create child boundaries like `src/adapters/aws/s3/` and `src/adapters/aws/lambda/`.
+
+Reserve `db/` for DDL, migration, and schema assets only; do not place runtime clients or adapters there.
As per coding guidelines "Keep human-facing docs scannable: prefer short headings, short paragraphs, short sentences, and strong structure".
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/ztd-cli/README.md` around lines 58 - 60, Split the long paragraph
into a short bulleted list for scanability: create separate bullets for (1)
shared feature seams under src/features/_shared/*, (2) driver-neutral contracts
under src/libraries/*, (3) driver- or sink-specific bindings under
src/adapters/<tech>/*, (4) shared verification seams under tests/support/*, (5)
tool-managed assets under .ztd/*, (6) adapter-boundary rule treating
src/adapters/pg/ as a concrete adapter vs. src/adapters/<tech>/ as a parent for
families (with examples like src/adapters/aws/s3/ and src/adapters/aws/lambda/),
and (7) reserving db/ for DDL/migrations/schema only (no runtime
clients/adapters); keep each bullet short, one sentence, and retain the original
path examples verbatim.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/ztd-cli/README.md`:
- Line 201: Update the README table row for the ztd feature tests scaffold
command to also mention that the command refreshes boundary type definitions by
updating tests/boundary-ztd-types.ts; specifically, modify the description for
`ztd feature tests scaffold --feature <feature-name>` to include "refresh
tests/boundary-ztd-types.ts" alongside the existing notes about regenerating
TEST_PLAN.md, analysis.json, the Vitest entrypoint, and preserving cases/.

---

Duplicate comments:
In `@packages/ztd-cli/src/commands/init.ts`:
- Around line 2796-2812: The dry-run currently lists starter-only files because
the files array unconditionally includes entries (e.g.,
'src/libraries/README.md', 'src/libraries/sql/README.md',
'src/libraries/sql/sql-client.ts', 'src/adapters/README.md',
'src/adapters/pg/sql-client.ts'); update the code that builds that files list in
the init command to only push those starter-specific entries when starter mode
is enabled (the same condition that triggers the actual starter writes in the
initStarter()/starter branch), so the --dry-run output matches what will
actually be written; reference the same starter flag/variable used around
initStarter() and gate the inclusion of those file paths accordingly.

---

Nitpick comments:
In `@packages/ztd-cli/README.md`:
- Around line 58-60: Split the long paragraph into a short bulleted list for
scanability: create separate bullets for (1) shared feature seams under
src/features/_shared/*, (2) driver-neutral contracts under src/libraries/*, (3)
driver- or sink-specific bindings under src/adapters/<tech>/*, (4) shared
verification seams under tests/support/*, (5) tool-managed assets under .ztd/*,
(6) adapter-boundary rule treating src/adapters/pg/ as a concrete adapter vs.
src/adapters/<tech>/ as a parent for families (with examples like
src/adapters/aws/s3/ and src/adapters/aws/lambda/), and (7) reserving db/ for
DDL/migrations/schema only (no runtime clients/adapters); keep each bullet
short, one sentence, and retain the original path examples verbatim.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: bb602a14-c18a-49a0-bb8f-84e4dd03f4e3

📥 Commits

Reviewing files that changed from the base of the PR and between 9ee5744 and a0581f0.

📒 Files selected for processing (7)
  • docs/guide/ztd-cli-describe-schema.md
  • packages/ztd-cli/README.md
  • packages/ztd-cli/src/commands/init.ts
  • packages/ztd-cli/templates/src/adapters/README.md
  • packages/ztd-cli/tests/directoryFinding.docs.test.ts
  • packages/ztd-cli/tests/init.command.test.ts
  • packages/ztd-cli/tests/sqlClientAdapterTemplate.unit.test.ts
✅ Files skipped from review due to trivial changes (3)
  • docs/guide/ztd-cli-describe-schema.md
  • packages/ztd-cli/templates/src/adapters/README.md
  • packages/ztd-cli/tests/directoryFinding.docs.test.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/ztd-cli/tests/init.command.test.ts

Comment thread packages/ztd-cli/README.md Outdated
@mk3008
mk3008 merged commit 3b96bc5 into main Apr 16, 2026
10 checks passed
@mk3008
mk3008 deleted the 776-bfa-ディレクトリ構成 branch April 16, 2026 03:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BFA ディレクトリ構成

1 participant