Skip to content

Add interactive generate command for .gitignore creation#19

Draft
Copilot wants to merge 1 commit intocopilot/fix-e1254a02-ee83-4d7b-854e-d9890266c615from
copilot/fix-68217154-0142-4f5c-8241-f51f60cfed89
Draft

Add interactive generate command for .gitignore creation#19
Copilot wants to merge 1 commit intocopilot/fix-e1254a02-ee83-4d7b-854e-d9890266c615from
copilot/fix-68217154-0142-4f5c-8241-f51f60cfed89

Conversation

Copy link
Copy Markdown

Copilot AI commented Sep 12, 2025

This PR implements a new interactive generate command that allows users to create .gitignore files through a user-friendly CLI interface.

Features

The new gitignoreio generate command provides:

  • Interactive template selection: Browse and select from all 571 available gitignore.io templates using a checkbox interface
  • Multi-select capability: Choose one or more templates (minimum one required)
  • Flexible output options: Save to a .gitignore file or display content in the console
  • Directory selection: Specify custom output directory with current directory as default
  • Rich user experience: Emoji-enhanced interface with clear progress indicators and error handling

Usage

# Interactive generate command
gitignoreio generate

# Shows help for the new command
gitignoreio help generate

The command guides users through:

  1. Template Selection - Interactive checkbox list of all available templates
  2. Output Choice - Save to file or print to console
  3. Directory Input - Custom path or current directory (default)
  4. Generation - Real-time .gitignore content creation via gitignore.io API

Implementation

  • Added @inquirer/prompts dependency for interactive CLI functionality
  • Created src/commands/generate.ts with full command implementation
  • Integrated with existing gitignoreio-sdk for content generation
  • Added comprehensive error handling for network and file system operations
  • Included unit tests and maintained code quality standards

Example Workflow

🔥 GitIgnore Generator

? Select one or more templates to include: 
❯◉ node
 ◉ python  
 ◯ java
 ◯ go
 
✅ Selected templates: node, python

? Do you want to save to a .gitignore file? Yes
? Enter the directory path: . 

🚀 Generating .gitignore content...
✅ .gitignore file created at: ./.gitignore

🎉 Done!

This enhancement makes the CLI more accessible for developers who prefer interactive workflows over command-line arguments, while maintaining backward compatibility with existing functionality.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.toptal.com
    • Triggering command: node test_generate_manually.js (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] now i want to add the generate command: it should be interactive. it should give the opportunity to create (so write the file) in a specified folder (currend as default) or it should just generate and print as plain output in the console. before gener... Add interactive generate command for .gitignore creation Sep 12, 2025
Copilot AI requested a review from kin0992 September 12, 2025 17:25
…put options

Co-authored-by: kin0992 <9998393+kin0992@users.noreply.github.com>
@kin0992 kin0992 force-pushed the copilot/fix-68217154-0142-4f5c-8241-f51f60cfed89 branch from a0112d7 to 4df87f8 Compare September 12, 2025 17:25
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