Skip to content

feat(cli): add fern automations list preview subcommand#15141

Open
devin-ai-integration[bot] wants to merge 4 commits intomainfrom
devin/1776516832-automations-list-preview
Open

feat(cli): add fern automations list preview subcommand#15141
devin-ai-integration[bot] wants to merge 4 commits intomainfrom
devin/1776516832-automations-list-preview

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration bot commented Apr 18, 2026

Description

Refs fern-api/actions#8

Adds a new fern automations list preview CLI subcommand that discovers previewable generator groups and outputs structured JSON. This replaces the client-side YAML parsing in the fern-preview GitHub Action's detect-groups.ts with a single CLI call, making the CLI the single source of truth for which generators are previewable.

Also extracts the existing fern automations list generate inline logic into a matching testable module (listGenerateCommands.ts) for consistency.

Changes Made

New: fern automations list preview

  • Extracted listPreviewGroups() into packages/cli/cli/src/commands/automations/listPreviewGroups.ts
  • Uses Pick<AbstractAPIWorkspace<unknown>, ...> for type-safe workspace input
  • Reuses isNpmGenerator from sdk-preview/overrideOutputForPreview.ts (canonical set of supported TypeScript generators)
  • Filters generators by automation.preview and isNpmGenerator
  • Deduplicates to one entry per (groupName, apiName) pair (first matching generator wins)
  • Supports --json flag for machine-readable output, human-readable by default
  • Supports --group and --api filters (same as list generate)

Refactored: fern automations list generate

  • Extracted inline logic from cli.ts into listGenerateCommands.ts (matches listPreviewGroups pattern)

  • No behavioral changes — purely structural for consistency and testability

  • Updated README.md generator (if applicable) — N/A, hidden subcommand

Testing

  • Unit tests added/updated
    • listPreviewGroups.test.ts (21 tests): detection, filtering, deduplication, multi-API, edge cases
    • listGenerateCommands.test.ts (16 tests): command generation, skip logic, options, multi-API, edge cases
  • Manual testing completed — pnpm run check (biome lint) passes, all 37 tests pass

Usage

# Human-readable output (default)
fern automations list preview

# JSON output for GitHub Actions
fern automations list preview --json

# Filter to a specific group
fern automations list preview --json --group ts-sdk

# Filter to a specific API in multi-API repos
fern automations list preview --json --api payments

JSON output:

[
  { "groupName": "ts-sdk", "apiName": null, "generator": "fernapi/fern-typescript-sdk" }
]

Human-readable output:

ts-sdk — fernapi/fern-typescript-sdk
node (api: payments) — fernapi/fern-typescript-node-sdk

Link to Devin session: https://app.devin.ai/sessions/2db06cbb70d74a77a637d0067171f482

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>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

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.

devin-ai-integration bot and others added 3 commits April 18, 2026 13:08
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

0 participants