feat(cli): add fern automations list preview subcommand#15141
Open
devin-ai-integration[bot] wants to merge 4 commits intomainfrom
Open
feat(cli): add fern automations list preview subcommand#15141devin-ai-integration[bot] wants to merge 4 commits intomainfrom
fern automations list preview subcommand#15141devin-ai-integration[bot] wants to merge 4 commits intomainfrom
Conversation
Adds a new hidden subcommand that discovers previewable generator groups and outputs a JSON array of objects with groupName, apiName, and generator. A generator is previewable when: - It is a supported TypeScript/npm generator - automation.preview is not false in generators.yml Designed for consumption by the fern-preview GitHub Action to replace client-side YAML parsing of generators.yml with a single CLI call. Co-Authored-By: barry.zou <barry.zou@buildwithfern.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Extracts core filtering logic from the inline command handler into a standalone listPreviewGroups() function for testability. Adds 20 tests covering: - Basic detection of all 3 TypeScript generator variants - Exclusion of non-TypeScript generators (Python, Java, Go) - automation.preview flag filtering - Mixed-language groups - Multi-API workspace support with apiName - Group name filtering - Edge cases (empty workspaces, null config, empty groups) Co-Authored-By: barry.zou <barry.zou@buildwithfern.com>
- Extract list generate logic into listGenerateCommands.ts (matches list preview pattern, fixes inconsistency #2) - Use Pick<AbstractAPIWorkspace> instead of manual WorkspaceGeneratorsInfo interface (#3) - Add --json flag to list preview command (#5) - Deduplicate to one entry per (groupName, apiName) pair (Concern #2) - Add 16 unit tests for listGenerateCommands - Update listPreviewGroups tests for deduplication behavior (21 tests) Co-Authored-By: barry.zou <barry.zou@buildwithfern.com>
Co-Authored-By: barry.zou <barry.zou@buildwithfern.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refs fern-api/actions#8
Adds a new
fern automations list previewCLI subcommand that discovers previewable generator groups and outputs structured JSON. This replaces the client-side YAML parsing in thefern-previewGitHub Action'sdetect-groups.tswith a single CLI call, making the CLI the single source of truth for which generators are previewable.Also extracts the existing
fern automations list generateinline logic into a matching testable module (listGenerateCommands.ts) for consistency.Changes Made
New:
fern automations list previewlistPreviewGroups()intopackages/cli/cli/src/commands/automations/listPreviewGroups.tsPick<AbstractAPIWorkspace<unknown>, ...>for type-safe workspace inputisNpmGeneratorfromsdk-preview/overrideOutputForPreview.ts(canonical set of supported TypeScript generators)automation.previewandisNpmGenerator(groupName, apiName)pair (first matching generator wins)--jsonflag for machine-readable output, human-readable by default--groupand--apifilters (same aslist generate)Refactored:
fern automations list generateExtracted inline logic from
cli.tsintolistGenerateCommands.ts(matcheslistPreviewGroupspattern)No behavioral changes — purely structural for consistency and testability
Updated README.md generator (if applicable) — N/A, hidden subcommand
Testing
listPreviewGroups.test.ts(21 tests): detection, filtering, deduplication, multi-API, edge caseslistGenerateCommands.test.ts(16 tests): command generation, skip logic, options, multi-API, edge casespnpm run check(biome lint) passes, all 37 tests passUsage
JSON output:
[ { "groupName": "ts-sdk", "apiName": null, "generator": "fernapi/fern-typescript-sdk" } ]Human-readable output:
Link to Devin session: https://app.devin.ai/sessions/2db06cbb70d74a77a637d0067171f482