Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 31, 2026

Replaces meow + Ink/React with Commander.js and direct terminal output (figlet/chalk/inquirer). Adds AI provider abstraction layer for GitHub Copilot SDK integration with OpenAI fallback.

Architecture Changes

CLI: meow → Commander.js

  • Command-based structure: auth, commit, config subcommands
  • Legacy flags (-s, -d) preserved with deprecation warnings

UI: Ink/React → figlet + chalk + inquirer

  • Removes React ecosystem (13 dependencies)
  • ASCII banners, color-coded output, interactive prompts
  • No React overhead, faster startup

Provider Abstraction: New AIProvider class

  • Unified interface: GitHub Copilot (token-based) + OpenAI (functional)
  • Clean Commit prompt template integration
  • Automatic fallback chain

File Structure

source/
├── commands/
│   ├── auth.js       # copilot|openai|status|logout
│   ├── commit.js     # interactive, --all, --file workflows
│   └── config.js     # --show, --reset
├── providers/
│   └── ai-provider.js   # Copilot + OpenAI abstraction
└── utils/
    ├── config-manager.js  # Conf wrapper
    ├── git.js            # Stage/commit/diff ops
    └── ui.js             # Figlet/inquirer/chalk

Removed: app.js, utils/{commit,openai}.js

Command Structure

# New commands
magicc commit [--all|--file <path>|--model <model>]
magicc auth copilot [--token <token>]
magicc auth openai <key>
magicc config --show

# Legacy (with warnings)
magicc -s <key>  # → use auth openai
magicc -d        # → use auth logout

Notes

  • GitHub Copilot: Token auth structure in place, OAuth flow deferred (throws to OpenAI fallback)
  • Dependencies: -13 packages (React stack), +5 packages (CLI/terminal)
  • Version: 0.2.6 → 0.3.0
  • Config format unchanged for backward compatibility

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:

  • api.openai.com
    • Triggering command: /usr/local/bin/node node dist/cli.js commit --file test-doc.md (dns block)

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

Original prompt

Magic Commit v0.3.0 - Complete Migration

Objective

Modernize Magic Commit by migrating from meow + Ink to Commander.js + GitHub Copilot SDK with a simplified terminal UI using figlet and chalk.

Requirements

1. Replace CLI Framework

  • Remove: meow package
  • Add: commander (^12.0.0)
  • Update: source/cli.js to use Commander.js
  • Structure: Implement command-based architecture

2. Simplify UI/TUI

  • Remove: ink, ink-big-text, ink-gradient, ink-select-input, react from dependencies
  • Add: figlet (^1.7.0) for ASCII art banners
  • Add: inquirer (^9.2.0) for interactive prompts
  • Move: chalk from devDependencies to dependencies
  • Update: Replace all Ink/React components with simple terminal output

3. Integrate GitHub Copilot SDK

  • Add: @github/copilot-sdk (^1.0.0 or latest available)
  • Create: source/providers/ai-provider.js - Abstraction layer for Copilot + OpenAI
  • Priority: GitHub Copilot as primary, OpenAI as legacy fallback
  • Authentication: Browser OAuth + token support

4. New Command Structure

Commands to implement:

magicc                              # Default: runs commit command
magicc commit                       # Generate and commit (file-by-file)
magicc commit --all                 # Process all files at once
magicc commit --file <path>         # Process specific file
magicc commit --model <model>       # Specify AI model
magicc auth copilot                 # Authenticate with GitHub Copilot
magicc auth copilot --token <token> # Auth with token
magicc auth openai <key>            # Set OpenAI key (legacy)
magicc auth status                  # Show auth status
magicc auth logout                  # Clear credentials
magicc config --show                # Show configuration

Legacy flags (with deprecation warnings):

magicc -s=<key>  # Show warning: Use 'magicc auth openai <key>'
magicc -d        # Show warning: Use 'magicc auth logout'

5. File Structure

Create new files:

source/cli.js (update existing)

  • Use Commander.js
  • Define all commands
  • Handle legacy flags with warnings
  • Show figlet banner on start

source/commands/auth.js

  • authenticateWithCopilot(token) - GitHub Copilot auth
  • authenticateWithOpenAI(key) - OpenAI auth (legacy)
  • showAuthStatus() - Display current auth status
  • logout() - Clear all credentials

source/commands/commit.js

  • commitCommand(options) - Main commit logic
  • processAllFiles(aiProvider, options) - Process all files
  • processFilesInteractively(aiProvider, options) - One-by-one
  • processFile(filePath, aiProvider, options) - Single file

source/commands/config.js

  • showConfig() - Display current config
  • resetConfig() - Reset to defaults

source/providers/ai-provider.js

  • class AIProvider - Abstraction for AI providers
  • generateCommitMessage(diff, filePath, options) - Main method
  • generateWithCopilot(diff, filePath, options) - Copilot implementation
  • generateWithOpenAI(diff, filePath, options) - OpenAI implementation (existing logic)
  • buildCleanCommitPrompt(diff, filePath) - Prompt template for Clean Commit format

source/utils/ui.js

  • showBanner() - Figlet ASCII art + chalk colors
  • showCommitPreview(message, options) - Show generated message
  • confirmCommit(message) - Inquirer prompt for confirmation
  • promptModelSelection() - Let user choose model
  • showSuccess(message) - Success output
  • showError(message) - Error output

source/utils/git.js

  • getChangedFiles() - List changed files
  • stageFile(filePath) - Stage specific file
  • stageAll() - Stage all changes
  • getDiff(filePath) - Get diff for file
  • commit(message) - Execute git commit
  • isGitRepository() - Check if in git repo

source/utils/config-manager.js

  • Wrapper around conf package
  • setAuthMode(mode) - Set auth mode (copilot/openai)
  • getAuthMode() - Get current auth mode
  • setToken(provider, token) - Store token
  • getToken(provider) - Retrieve token
  • clearAll() - Clear all config

6. Clean Commit Prompt

The AI provider must use this prompt template for generating commits:

You are an expert at writing git commit messages following the "Clean Commit" format.

**Clean Commit Format:**
<emoji> <type>: <description>
<emoji> <type> (<scope>): <description>

**The 9 Types:**
| Emoji | Type      | What it covers |
|-------|-----------|----------------|
| 📦    | new       | Adding new features, files, or capabilities |
| 🔧    | update    | Changing existing code, refactoring, improvements |
| 🗑️    | remove    | Removing code, files, features, or dependencies |
| 🔒    | security  | Security fixes, patches, vulnerability resolutions |
| ⚙️    | setup     | Project configs, CI/CD, tooling, build systems |
| ☕    | chore     | Maintenance tasks, dependency updates, housekeeping |
| 🧪    | test      | Adding, updating, or fixing tests |
| 📖    | docs ...

</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

*This pull request was created from Copilot chat.*
>

<!-- START COPILOT CODING AGENT TIPS -->
---

✨ Let Copilot coding agent [set things up for you](https://github.com/warengonzaga/magic-commit/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits January 31, 2026 08:10
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Copilot AI changed the title [WIP] Migrate Magic Commit to Commander.js and GitHub Copilot SDK Migrate to Commander.js and simplify terminal UI Jan 31, 2026
Copilot AI requested a review from warengonzaga January 31, 2026 08:23
@warengonzaga warengonzaga marked this pull request as ready for review January 31, 2026 08:29
@coderabbitai
Copy link

coderabbitai bot commented Jan 31, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • 🔍 Trigger a full review

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI and others added 3 commits January 31, 2026 08:33
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
Co-authored-by: warengonzaga <15052701+warengonzaga@users.noreply.github.com>
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