feat(cli): polish fern config migrate with docs.yml $ref pointer, drop group/defaultGroup, and workflow migration#14515
Conversation
🤖 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:
|
549a1f0 to
026a8cf
Compare
fern config migrate with docs.yml $ref resolution, drop group/defaultGroup, and workflow migrationfern config migrate with docs.yml $ref pointer, drop group/defaultGroup, and workflow migration
8b41090 to
e4e5f2a
Compare
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.
5ed5b6a to
57f70a8
Compare
…up/defaultGroup, workflow migration
57f70a8 to
d6f16d7
Compare
…sing migration - Add 6 new test files covering GeneratorsYmlMigrator, FernConfigJsonMigrator, Migrator (end-to-end), convertApiSpecs, convertGitOutput, and convertSettings - Fix convertSdkTargets to migrate generator-level metadata fields (license → output.git.license, author/email → metadata.authors, package-description → metadata.description) and warn on unsupported reference-url and smart-casing - Add 5 new tests to convertSdkTargets.test.ts covering metadata and smart-casing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Minor formatting changes across migrator tests and convertSdkTargets: condense multiline writeFile calls, inline arrays/objects and imports, and compact license/author assignment expressions into single-line forms for consistency and readability. No functional behavior changed; only whitespace/line-wrapping adjustments in: - packages/cli/cli-v2/src/migrator/__test__/FernConfigJsonMigrator.test.ts - packages/cli/cli-v2/src/migrator/__test__/GeneratorsYmlMigrator.test.ts - packages/cli/cli-v2/src/migrator/__test__/convertApiSpecs.test.ts - packages/cli/cli-v2/src/migrator/converters/convertSdkTargets.ts
- Add makeLogger() helper to Migrator.test.ts with all required Logger fields (disable, enable, trace, log) instead of partial inline objects - Use toMatchObject for repository access in convertGitOutput.test.ts to avoid accessing a property on a discriminated union without narrowing - Use toHaveProperty for messageNaming in convertSettings.test.ts since the field is on AsyncApiSettingsSchema, not OpenApiSettingsSchema Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| @@ -1,5 +1,17 @@ | |||
| # yaml-language-server: $schema=../../../fern-versions-yml.schema.json | |||
|
|
|||
| - version: 4.65.0 | |||
There was a problem hiding this comment.
We should use the new unreleased versioning system
There was a problem hiding this comment.
Done — removed the 4.65.0 entry from versions.yml and created packages/cli/cli/changes/unreleased/polish-fern-config-migrate.yml instead, using the new unreleased versioning system. This should also eliminate the recurring merge conflicts on this file.
Description
Closes FER-8911
Polishes the
fern config migratecommand with several improvements to handle real-world migration edge cases.Changes Made
1. Drop
defaultGroupandgroupfrom migration outputdefaultGrouppropagation inMigrator.ts(multi-API path) and bothconvertSdkTargets/convertSdkTargetsFromRawinconvertSdkTargets.tstarget.group = [groupName]assignment fromconvertGeneratorToTargetandconvertRawGeneratorToTargetSdksSchema,SdkTargetSchema) are left unchanged for backward-compat reading2.
docs.yml$refpointermigrateDocsYmlfunction checks ifdocs.ymlexists in thefern/directory and, if so, returns a{ $ref: "./docs.yml" }pointerfern.ymlsimply points itsdocskey at the existingdocs.ymlfile via$refsyntax — no inlining or recursive resolutiondocs.ymlis not added tomigratedFiles(it must remain on disk since fern.yml now references it)3. GitHub Actions workflow migration
migrateGithubWorkflowsfunction scans.github/workflows/*.ymland.yamlfilesfern generate→fern sdk generate--group→--target(only on lines containingfern generate)4. Generator metadata and smart-casing migration
metadatafields:package-description→description,author/email→authors,license→output.git.licenseunsupportedwarning formetadata.reference-url(no fern.yml equivalent)unsupportedwarning forsmart-casing(not supported in fern.yml)5. Settings key alias
title-as-schema-nameas an alias fortitleAsSchemaNamein the settings migration key map6. Changelog entry (unreleased versioning system)
packages/cli/cli/changes/unreleased/polish-fern-config-migrate.ymlusing the new unreleased changelog system (no directversions.ymlentry)7. Comprehensive test suite
migrateDocsYml.test.ts— 5 tests: missing file, $ref pointer creation, empty file, complex content, no inliningmigrateGithubWorkflows.test.ts— 9 tests: missing dir, empty dir, command rewriting,--group→--target,fern-apivariant, no-op, multiple files, non-yaml ignored, multi-commandconvertSdkTargets.test.ts— 13 tests: empty groups, basic conversion, group/defaultGroup exclusion, multi-group, deduplication, unknown generators, config preservation, npm publish, apiName, raw format, image field, missing name, git outputFernConfigJsonMigrator.test.ts— 9 tests: detect/migrate for fern.config.jsonGeneratorsYmlMigrator.test.ts— real-world xai REST/gRPC configs, metadata migration, smart-casing warnings, multi-group, openapi settings, authMigrator.test.ts— end-to-end integration tests for single-API and multi-API workspacesconvertApiSpecs.test.ts— API spec conversion edge casesconvertGitOutput.test.ts— git output configuration conversionconvertSettings.test.ts— settings key mapping includingtitle-as-schema-namealiasHuman review checklist
docsfield type cast —docsRefis cast viaas unknown as schemas.FernYmlSchema["docs"]since{ $ref: string }doesn't match theDocsSchemazod type. This works at runtime (YAML serializer sees a plain object) but bypasses compile-time type checking.generator.metadataandsmart-casingare accessed viaascasts (e.g.(generator as { "smart-casing"?: boolean })). These bypass compile-time checks; verify the underlying types actually carry these fields at runtime.target.metadata/ license →output.git.licenseblock is duplicated betweenconvertGeneratorToTargetandconvertRawGeneratorToTarget. Consider extracting a shared helper if this grows.--group → --targetreplacement is scoped to lines matchingfern generate, but could still transform echo/comment lines that happen to contain that pattern.Testing
pnpm run check) passespnpm format) passesLink to Devin session: https://app.devin.ai/sessions/9a72485c90c3405a98a3885f0fb90ebb
Requested by: @iamnamananand996