Rewrite init CLI command with optique and refactor#435
Rewrite init CLI command with optique and refactor#435dahlia merged 58 commits intofedify-dev:nextfrom
init CLI command with optique and refactor#435Conversation
There was a problem hiding this comment.
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
initCLI command has been completely rewritten using theoptiquelibrary, 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
initcommand automatically generates essential configuration files likedeno.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-runoption 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
-
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. ↩
There was a problem hiding this comment.
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!
dahlia
left a comment
There was a problem hiding this comment.
Sorry for the late review. First of all, trivial nitpicks here.
|
Reverted the files. I know it sounds like an excuse, but sometimes when I run |
8998264 to
4d1c463
Compare
|
The docs for this pull request have been published: |
"@std/dotenv/stringify"
|
The latest push to this pull request has been published to JSR and npm as a pre-release:
|
Summary
Rewrite
initCLI command with optique.Related Issue
initcommand using Optique #397Changes
packages/clipackages/cli/src/initBenefits
Now CLI users can use
init.Checklist
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)?deno task test-allon 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.