Skip to content

cleanOutput and @@meta('doc:ignore', true)#16

Open
lsmith77 wants to merge 5 commits intosheldonj:mainfrom
lsmith77:cleanOutput
Open

cleanOutput and @@meta('doc:ignore', true)#16
lsmith77 wants to merge 5 commits intosheldonj:mainfrom
lsmith77:cleanOutput

Conversation

@lsmith77
Copy link
Copy Markdown
Contributor

@lsmith77 lsmith77 commented Mar 27, 2026

fixes #10
fixes #15

Summary by CodeRabbit

  • New Features

    • Added optional cleanOutput flag to remove the output directory before generation (off by default).
    • Generation now refuses to operate if the configured output path resolves to the filesystem root.
  • Behavior Changes

    • Models annotated with doc:ignore are now excluded from output alongside previously ignored models.
  • Documentation

    • README updated to document cleanOutput and doc:ignore handling.
  • Tests

    • Added tests for cleaning behavior and improved snapshot timestamp redaction.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 27, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 59344eae-6648-4a9a-a697-f9d3d6b382b6

📥 Commits

Reviewing files that changed from the base of the PR and between 29cda91 and 3ed60fd.

⛔ Files ignored due to path filters (1)
  • test/generator/__snapshots__/snapshot.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (9)
  • .github/workflows/ci.yml
  • .github/workflows/publish.yml
  • .github/workflows/release-please.yml
  • README.md
  • src/extractors.ts
  • src/generator.ts
  • src/types.ts
  • test/generator/plugin-options.test.ts
  • test/generator/snapshot.test.ts
✅ Files skipped from review due to trivial changes (5)
  • .github/workflows/release-please.yml
  • .github/workflows/publish.yml
  • .github/workflows/ci.yml
  • src/types.ts
  • test/generator/plugin-options.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/generator.ts
  • test/generator/snapshot.test.ts

📝 Walkthrough

Walkthrough

Adds a new cleanOutput boolean plugin option and implements a pre-generation step that validates outputDir is not the filesystem root and, when enabled, removes the existing output directory before recreating it. Tests and README/docs were updated to cover and document the option and related behavior.

Changes

Cohort / File(s) Summary
Generator & Types
src/generator.ts, src/types.ts
Added cleanOutput?: boolean to PluginOptions. generate() now validates outputDir is not root and deletes it recursively when cleanOutput is true; resolvePluginOptions() parses the flag.
Model extraction
src/extractors.ts
isIgnoredModel extended to treat @@meta('doc:ignore', 'true') as an ignore marker in addition to @@ignore.
Tests — behavior
test/generator/plugin-options.test.ts
New tests: verify cleanOutput: true removes stale files before generation; verify includeInternalModels: false excludes models annotated via @@meta('doc:ignore', true).
Tests — snapshots
test/generator/snapshot.test.ts
stabilize() redaction updated to normalize an additional Generated: YYYY-MM-DD timestamp format for snapshot stability.
Docs
README.md
Documented new cleanOutput option (default false) and clarified includeInternalModels now respects @@meta('doc:ignore', true) alongside @@ignore.
CI workflows
.github/workflows/...
Bumped actions/checkout from v4 to v6 across CI/publish/release workflows (three workflow files).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through files with a gentle twitch,
Cleared the old burrow to make the path rich,
Root path guarded, no tumble or fright,
Fresh pages appear in the soft moonlight,
Happy rabbit—clean output, pure delight! ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 75.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title references two features (cleanOutput and @@meta('doc:ignore', true)) that are both implemented in the changeset, but is overly terse and doesn't clearly communicate the main intent or scope. Consider a more descriptive title like 'Add cleanOutput option and @@meta doc:ignore support' that clearly explains what features are being added.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/generator.ts`:
- Around line 47-61: The cleanOutput block around pluginOptions.cleanOutput
should be updated to satisfy ESLint: change the thrown Error message to use
single quotes in the Error constructor where the root check throws; insert a
blank line before the fs.existsSync(outputDir) check; reorder the fs.rmSync
options so that force comes before recursive; and rename the catch parameter
from err to error and update its usage in the thrown Error message that follows
(keep using outputDir and the same conditional error.message extraction). Refer
to pluginOptions.cleanOutput, outputDir, root, fs.existsSync, and fs.rmSync to
locate and adjust the code.
- Line 346: The object literal currently sets properties in the wrong
alphabetical order for the perfectionist/sort-objects rule: move the cleanOutput
property so it appears before the output property (i.e., ensure cleanOutput:
raw['cleanOutput'] === true is placed earlier than the output property in the
same object literal), keeping the existing expression and surrounding object
intact so only the property order changes.

In `@src/types.ts`:
- Around line 91-95: Reorder the object type properties so they satisfy
perfectionist/sort-object-types by moving the cleanOutput property to appear
alphabetically before title within the same type declaration (i.e., place
cleanOutput above title in the type that currently contains cleanOutput and
title); ensure no other property order is changed and run the linter to verify
the sort rule passes.

In `@test/generator/plugin-options.test.ts`:
- Around line 1-31: The test file has lint/format violations: reorder imports so
relative import "../utils" appears before the built-in "node:path" import,
convert all double quotes to single quotes across the file, and reorder the
pluginOptions object passed to plugin.generate so the cleanOutput property
appears before output (i.e., change pluginOptions: { cleanOutput: true, output:
tmpDir }), keeping references to loadSchema and plugin.generate intact.
🪄 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: 035a089e-1144-4a29-813a-8c5e50664786

📥 Commits

Reviewing files that changed from the base of the PR and between 2044d82 and 29cda91.

⛔ Files ignored due to path filters (1)
  • test/generator/__snapshots__/snapshot.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (4)
  • src/generator.ts
  • src/types.ts
  • test/generator/plugin-options.test.ts
  • test/generator/snapshot.test.ts

dependabot bot and others added 5 commits March 27, 2026 13:20
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@lsmith77 lsmith77 changed the title Clean output cleanOutput and @@meta('doc:ignore', true) Mar 27, 2026
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.

Expand flexibility of includeInternalModels Add configuration to clean the schema directory first

1 participant