Skip to content

Rewrite init CLI command with optique and refactor#435

Merged
dahlia merged 58 commits intofedify-dev:nextfrom
2chanhaeng:optique/init
Sep 21, 2025
Merged

Rewrite init CLI command with optique and refactor#435
dahlia merged 58 commits intofedify-dev:nextfrom
2chanhaeng:optique/init

Conversation

@2chanhaeng
Copy link
Contributor

@2chanhaeng 2chanhaeng commented Sep 16, 2025

Summary

Rewrite init CLI command with optique.

Related Issue

Changes

  • Some files in packages/cli
  • packages/cli/src/init

Benefits

Now CLI users can use init.

Checklist

  • Did you add a changelog entry to the CHANGES.md?
  • Did you write some relevant docs about this change (if it's a new feature)?
  • Did you write a regression test to reproduce the bug (if it's a bug fix)?
  • Did you write some tests for this change (if it's a new feature)?
  • Did you run deno task test-all on your machine?

Additional Notes

Compare with the original code

I refactored the code, but I'm not sure if it looks better. It's quite different from the style of the previous code. I spent a long time thinking about how to make it even slightly more readable, but I decided it would be better to move forward by getting others to review it rather than holding onto this single issue for too long. So I went ahead and created a PR. Please feel free to point out any parts that need fixing.

@issues-auto-labeler issues-auto-labeler bot added breaking change Breaking change component/cli CLI tools related difficulty/intermediate Intermediate level labels Sep 16, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @2chanhaeng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a comprehensive overhaul of the init CLI command, transforming it into a powerful and interactive tool for bootstrapping new Fedify projects. The rewrite leverages the optique library to provide a guided setup experience, allowing users to effortlessly configure their project with their preferred web framework, package manager, and data storage solutions. This significant refactoring aims to improve modularity, maintainability, and overall user experience for new project creation.

Highlights

  • CLI Command Rewrite: The init CLI command has been completely rewritten using the optique library, enhancing its structure and functionality for a more robust and maintainable implementation.
  • Interactive Project Setup: The command now features interactive prompts to guide users through selecting a web framework, package manager, key-value store, and message queue for their new Fedify project.
  • Multi-Framework & Package Manager Support: New project initialization supports Hono, Express, Nitro, and Next.js web frameworks, and Deno, pnpm, Bun, yarn, and npm package managers, offering broad compatibility.
  • Automated Configuration Generation: The init command automatically generates essential configuration files like deno.json, tsconfig.json, package.json, .env, VSCode settings, and Biome configuration based on user choices.
  • Dependency Management: Dependencies and development dependencies are automatically installed during the initialization process, streamlining project setup and reducing manual configuration steps.
  • Dry-Run Mode: A new --dry-run option allows users to preview all generated files and commands without making any actual changes to the filesystem, aiding in verification and planning.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This is a significant and well-executed rewrite of the init command. The new structure is much more modular, leveraging a functional style that improves maintainability. The interactive setup flow is a great enhancement to the user experience. I've identified a critical bug in dependency resolution that affects non-Deno projects, along with a few other issues related to file content patching, code clarity, and dead code. My review includes suggestions to address these points. Overall, this is a fantastic improvement, and thank you for the detailed work!

@issues-auto-labeler issues-auto-labeler bot added the examples Example code related label Sep 16, 2025
Copy link
Member

@dahlia dahlia left a comment

Choose a reason for hiding this comment

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

Sorry for the late review. First of all, trivial nitpicks here.

@2chanhaeng
Copy link
Contributor Author

Reverted the files. I know it sounds like an excuse, but sometimes when I run pnpm install, the package files get changed on their own. But still, it's my fault for commiting without checking. 😂

@github-actions
Copy link
Contributor

github-actions bot commented Sep 21, 2025

The docs for this pull request have been published:

https://e540665b.fedify.pages.dev

dahlia
dahlia previously approved these changes Sep 21, 2025
@github-actions
Copy link
Contributor

The latest push to this pull request has been published to JSR and npm as a pre-release:

Package Version JSR npm
@fedify/fedify 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/cli 2.0.0-pr.435.1673+515e9f9e JSR
@fedify/amqp 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/cfworkers 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/denokv 2.0.0-pr.435.1673+515e9f9e JSR
@fedify/elysia 2.0.0-pr.435.1673+515e9f9e npm
@fedify/express 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/h3 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/hono 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/nestjs 2.0.0-pr.435.1673+515e9f9e npm
@fedify/next 2.0.0-pr.435.1673+515e9f9e npm
@fedify/postgres 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/redis 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/sqlite 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/sveltekit 2.0.0-pr.435.1673+515e9f9e JSR npm
@fedify/testing 2.0.0-pr.435.1673+515e9f9e JSR npm

@dahlia dahlia merged commit ccbefd9 into fedify-dev:next Sep 21, 2025
34 of 37 checks passed
@2chanhaeng 2chanhaeng deleted the optique/init branch December 18, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Breaking change component/cli CLI tools related difficulty/intermediate Intermediate level examples Example code related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants