DEV Community

Cover image for CodePoet: Transform Your Git History Into Epic Poetry with GitHub Copilot CLI 🎭
code crinkly
code crinkly

Posted on

CodePoet: Transform Your Git History Into Epic Poetry with GitHub Copilot CLI 🎭

GitHub Copilot CLI Challenge Submission

This is a submission for the GitHub Copilot CLI Challenge

What I Built

CodePoet 🎭 - A delightfully creative CLI tool that transforms your code into poetry, epic tales, and legendary narratives using GitHub Copilot CLI.
Ever looked at your git history and thought "this could be so much more dramatic"? CodePoet turns boring commit logs into epic fantasy sagas, transforms code files into beautiful haiku, and generates poetic commit messages that your team will actually remember.

It's not just a fun experiment - it's a tool that brings joy to retrospectives, creates shareable content for your team, and makes celebrating project milestones genuinely entertaining.

Key Features

  • 📜 Epic Sagas: Your git history becomes a legendary tale of heroes, battles, and glorious victories
  • 🌸 Code Haiku: Any code file can become an elegant 5-7-5 syllable poem
  • 🎭 Poetic Commits: Generate commit messages as haiku, limericks, or Shakespearean verse
  • ⚔️ Developer Stats: View your coding journey as an RPG character sheet with achievements and levels

Tech Stack

  • TypeScript for robust, type-safe code
  • Commander.js for CLI parsing
  • Simple-git for repository analysis
  • Chalk & Ora for beautiful terminal output
  • GitHub Copilot CLI for AI-powered creative generation

Demo

Installation

git clone https://github.com/pealmasa/codepoet.git
cd codepoet
npm install
npm run build
npm link
Enter fullscreen mode Exit fullscreen mode

Epic Saga Command

Transform your git history into an epic narrative:

codepoet saga
Enter fullscreen mode Exit fullscreen mode

Example Output:

🎭 THE SAGA OF CODEPOET 📜
═══════════════════════════════════════════════════════

In the ancient realm of TypeScript, a brave developer 
embarked upon a legendary quest...

Chapter I: The Initialization
  The hero forged the sacred package.json, binding the 
  project's fate to the Node.js kingdom...

Chapter II: The Battle of Dependencies
  Armed with Commander, Chalk, and the mystical Simple-git,
  our champion assembled a fellowship of libraries...

Chapter III: The Refactoring Trials
  Through treacherous bugs and tortuous logic, the hero
  persevered, transforming chaos into elegant beauty...
Enter fullscreen mode Exit fullscreen mode

Code Haiku

Turn any file into poetry:

codepoet haiku src/index.ts
Enter fullscreen mode Exit fullscreen mode

Example Output:

Commands await here,
Through typed paths they guide the way,
Poetry takes flight.
Enter fullscreen mode Exit fullscreen mode

Poetic Commits

git add .
codepoet commit --style limerick
Enter fullscreen mode Exit fullscreen mode

Example Output:

There once was a bug in the code,
That caused the whole system to load,
  Fixed it with grace,
  In just one place,
Now smoothly the data has flowed!
Enter fullscreen mode Exit fullscreen mode

Developer Stats

codepoet stats
Enter fullscreen mode Exit fullscreen mode

Example Output:

╔════════════════════════════════════╗
║      DEVELOPER CHARACTER SHEET      ║
╚════════════════════════════════════╝

Name: Pedro Marques Santos
Class: TypeScript Wizard
Level: 42

Stats:
⚔️  STR (Code Quality): 85/100
🛡️  DEF (Bug Fixes): 92/100
✨  INT (Features): 88/100
🏃  AGI (Commits): 156 commits

Achievements Unlocked:
🏆 First Commit
🔥 Bug Slayer (10+ fixes)
⭐ Feature Forger
📜 Documentation Hero
Enter fullscreen mode Exit fullscreen mode

My Experience with GitHub Copilot CLI

Building CodePoet was a fantastic journey into creative AI applications, and GitHub Copilot CLI was absolutely essential to making it work.

How I Used Copilot CLI

1. Core Creative Engine

The heart of CodePoet is the CopilotService class that wraps GitHub Copilot CLI's gh copilot suggest command. Instead of using Copilot for code completion, I used it as a creative text generation engine:

async ask(prompt: string, options: CopilotOptions = {}): Promise<string> {
  const command = `gh copilot suggest "${fullPrompt}"`;
  const { stdout } = await execAsync(command);
  return this.cleanCopilotOutput(stdout);
}
Enter fullscreen mode Exit fullscreen mode

2. Context-Aware Poetry Generation

I crafted specific prompts that give Copilot CLI rich context about what to create:

For Epic Sagas, I feed it git history and ask it to:

  • Transform commits into heroic deeds
  • Turn bug fixes into battles against darkness
  • Make features into legendary artifacts
  • Convert merges into alliances between kingdoms

For Code Haiku, I provide the actual code and ask for:

  • Traditional 5-7-5 syllable structure
  • Capture the essence of what the code does
  • Maintain poetic beauty while being technically accurate

3. Multiple Creative Styles

I implemented style instructions that guide Copilot's creative direction:

getStyleInstructions(style: string): string {
  const styles = {
    'epic': 'Write in dramatic, fantasy-epic style with grand language',
    'haiku': 'Create traditional Japanese haiku with exactly 5-7-5 syllables',
    'limerick': 'Write a funny limerick with AABBA rhyme scheme',
    'shakespearean': 'Write in Shakespearean style with iambic pentameter'
  };
  return styles[style];
}
Enter fullscreen mode Exit fullscreen mode

Impact on Development

Speed: Without Copilot CLI, I would have needed to integrate a full LLM API (OpenAI, Anthropic, etc.), handle API keys, manage rate limits, and deal with response parsing. Copilot CLI gave me instant, context-aware AI with zero configuration.

Quality: The creative outputs are consistently good because Copilot CLI understands both coding context AND natural language generation. It can look at fix: authentication bug and understand enough about authentication to write a meaningful poetic metaphor.

Iteration: I could rapidly prototype different prompt styles and immediately see results. The tight feedback loop made it easy to tune prompts for better poetry.

Developer Experience: The gh copilot suggest command is already familiar to developers who use GitHub Copilot, so CodePoet feels like a natural extension of their workflow.

Why This Matters

CodePoet demonstrates that GitHub Copilot CLI isn't just for suggesting shell commands - it's a powerful creative AI tool that can:

  • Generate natural language content with rich context
  • Understand technical concepts and translate them creatively
  • Provide consistent, quality outputs with minimal setup
  • Integrate seamlessly into developer workflows

This opens up possibilities for many creative CLI tools: commit message generators, code documentation poets, PR description writers, and more!

Future Ideas with Copilot CLI

  • Code reviews as movie reviews: "A masterpiece of refactoring! ⭐⭐⭐⭐⭐"
  • PR descriptions as epic tales: Turn diffs into adventure stories
  • Release notes as song lyrics: "🎵 Version 2.0, here we go! 🎵"
  • Architecture docs as fantasy maps: "In the land of Microservices..."

Try It Yourself!

  1. Clone and install:
   git clone https://github.com/pealmasa/codepoet.git
   cd codepoet
   npm install
   npm run build
   npm link
Enter fullscreen mode Exit fullscreen mode
  1. Generate an epic saga in any git repository:
   cd your-project
   codepoet saga
Enter fullscreen mode Exit fullscreen mode
  1. Share your favorite outputs with #CodePoet on social media!

Repository

🔗 GitHub: github.com/pealmasa/codepoet

📖 Quick Start Guide: See QUICKSTART.md


"The best code tells a story. CodePoet tells it epically!" 🎭📜✨

Top comments (0)