Skip to content

feat(cli)!: rename --cdktf-version in init#228

Open
gabegorelick wants to merge 1 commit into
open-constructs:mainfrom
gabegorelick:init-cdktn-version
Open

feat(cli)!: rename --cdktf-version in init#228
gabegorelick wants to merge 1 commit into
open-constructs:mainfrom
gabegorelick:init-cdktn-version

Conversation

@gabegorelick

@gabegorelick gabegorelick commented May 31, 2026

Copy link
Copy Markdown
Contributor

The init CLI command currently accepts a --cdktf-version option. This change renames it to --cdktn-version.

Related issue

Fixes #

Description

cdktn init --cdktf-version -> cdktn init --cdktn-version

This is a breaking change, but should hopefully not be too disruptive.

Checklist

  • I have updated the PR title to match CDKTN's style guide
  • I have run the linter on my code locally
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation if applicable
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works if applicable
  • New and existing unit tests pass locally with my changes

Comment thread packages/@cdktn/cli-core/src/lib/init.ts
@gabegorelick gabegorelick marked this pull request as ready for review June 1, 2026 01:49
@gabegorelick gabegorelick requested a review from a team as a code owner June 1, 2026 01:49

@jsteinich jsteinich left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you also prep a PR on https://github.com/open-constructs/cdk-terrain-docs about the change?

Likely going to hold this a bit since I think we'll have at least one more release before introducing breaking changes.

Comment on lines +371 to +374
if (
argv.fromTerraformProject &&
[".", process.cwd()].includes(argv.fromTerraformProject)
) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Won't this now ignore having an empty string set for fromTerraformProject while previously it would have errored?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The "" case was included in the .includes before, but it's now covered in the argv.fromTerraformProject conditional. The latter is needed for Typescript to discern that that field is defined.

@gabegorelick

Copy link
Copy Markdown
Contributor Author

Can you also prep a PR on https://github.com/open-constructs/cdk-terrain-docs about the change?

open-constructs/cdk-terrain-docs#13

Side note, it would be nice if the docs were merged into this repo so we didn't have split commits.

so0k pushed a commit to open-constructs/cdk-terrain-docs that referenced this pull request Jul 3, 2026
The `init` CLI command currently accepts a `--cdktf-version` option.
This change renames it to `--cdktn-version`.
@so0k so0k force-pushed the init-cdktn-version branch from 68b7105 to bc57cd0 Compare July 3, 2026 03:35
@so0k

so0k commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

oops, I merged the docs PR thinking this was already merged and part of the 0.23.4 release - I'll revert and re-open the PR on docs.

I think we are comfortable on CI/CD in this repo and can merge docs repo back in (will take some time for me to verify the mintlify configs for it and all..)

@so0k so0k dismissed jsteinich’s stale review July 3, 2026 03:36

docs PR was opened (I merged it accidentally too soon)

@sakul-learning

Copy link
Copy Markdown
Contributor

Thanks for the update. For this flag rename, I’d prefer we make it a two-release transition rather than removing the old spelling immediately:

  1. This release: introduce --cdktn-version, keep --cdktf-version as a deprecated alias, and emit a deprecation warning telling users to migrate.
  2. A future release: remove --cdktf-version once users have had a release window to update scripts/docs/automation.

Because init is a CLI entry point and the command builder is strict, removing --cdktf-version outright will make existing automation fail with an unknown option. A yargs-compatible shape would be something like:

.option("cdktn-version", {
  alias: "cdktf-version",
  type: "string",
  desc: "The cdktn version to use while creating a new project.",
  default: pkg.version,
})
.deprecateOption(
  "cdktf-version",
  "Use --cdktn-version instead. --cdktf-version will be removed in a future release.",
)

That keeps the new flag canonical while preserving backward compatibility for one release cycle.

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.

4 participants