Skip to content

feat(cli): add non-interactive mode for init command #1619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 19, 2025

Conversation

amirabbas-gh
Copy link
Collaborator

@amirabbas-gh amirabbas-gh commented Jul 17, 2025

📚 Description

This PR introduces support for a non-interactive mode in the init command of the CLI. This enables users to initialize projects programmatically or in CI/CD pipelines without manual input.
This enhancement will significantly improve automation and scripting capabilities for users of the Codemod CLI.
example commands:

codemod init --no-interactive --author=amirabbas08dev@gmail.com --project-type=ast-grep-js --description=lorem --license=MIT --package-manager=pnpm --language=Python ./test233
codemod init --no-interactive --author=amirabbas08dev@gmail.com --project-type=ast-grep-yaml --description=lorem --license=MIT --language=rust ./yamlcodemod

🧪 Test Plan

  • Ran codemod init --non-interactive with all required flags and verified successful initialization.
  • Manually tested error handling when required options are missing.
  • Confirmed interactive mode behavior remains unchanged.

@amirabbas-gh amirabbas-gh requested a review from mohebifar July 17, 2025 22:59
Copy link

vercel bot commented Jul 17, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
codemod ⬜️ Ignored (Inspect) Visit Preview Jul 19, 2025 5:31am

Copy link

pkg-pr-new bot commented Jul 17, 2025

Open in StackBlitz

npm i https://pkg.pr.new/codemod@1619

commit: f3b2973

@mohebifar mohebifar requested a review from Copilot July 19, 2025 05:29
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds non-interactive mode support to the CLI init command, enabling automated project initialization for CI/CD pipelines and scripting scenarios. The changes introduce validation for required parameters in non-interactive mode and ensure proper error handling when mandatory options are missing.

  • Adds --package-manager parameter and makes all required options mandatory in non-interactive mode
  • Improves error handling with proper validation and informative error messages
  • Updates the project configuration structure and initialization flow to support both interactive and non-interactive modes

@mohebifar mohebifar merged commit 7b392cd into main Jul 19, 2025
13 checks passed
@mohebifar mohebifar deleted the non_interactive_ready_commands branch July 19, 2025 06:07
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.

2 participants