Skip to content

twinity1/puzzle

Repository files navigation

Puzzle 🧩 - AI powered scaffolding

Puzzle showcase

A flexible CLI tool for code generation and scaffolding that integrates with aider-chat to help automate common development tasks.


🤔 Why to use this tool?

Large Language Models (LLMs) are powerful tools for code generation, but they require proper context to be effective. Without clear examples and relevant files, LLMs often make incorrect assumptions, leading to extensive code rewrites.

This tool solves these challenges by providing a structured framework for creating templates for common development tasks like endpoint generation, test creation, CRUD generation, documentation, etc..

With well-designed templates, software development can become a puzzle made up of individual pieces.


📋 Prerequisites

  • Node.js (v20+)
  • aider-chat (python -m pip install aider-install && aider-install) aider installation
  • git

💾 Installation

npm install -g puzzle-ai

cd /your/project/path

puzzle [aider args]

#example
puzzle --model sonnet --cache-prompts

✨ Features


🚀 Usage

Follow this guide to create your first template and start scaffolding

or check out the example project for a complete demonstration of puzzle templates and usage.


🎮 Commands and Parameters

Command Aliases Description Arguments
puzzle Runs scaffolding. [optional aider args], [custom flags for setup.mjs]
puzzle create-piece Launches an interactive wizard to create a new puzzle piece template.
puzzle init Creates and initializes the configuration file without running the main application.
puzzle-aider For JetBrains IDE Integration. [optional aider args], [custom flags for setup.mjs]
puzzle-batch Process multiple files with a single instruction. See Batch Mode. <pattern> --msg "instruction"
Example: puzzle-batch "src/**/*.js" --msg "add JSDoc comments"

Note 1): Puzzle and Puzzle-aider commands also accept extra arguments that are passed directly to aider (see all arguments in aider --help). For example, puzzle-aider --architect or puzzle --model openrouter/anthropic/claude-3.5-sonnet.

Note 2): the puzzle/common setup will be also included automatically when you run puzzle-aider. See Shared Configuration for details.

puzzle command parameters

Parameter Aliases Description
--chat Enables aider chat mode for interactive conversations with the LLM.
--history -H Uses command history to re-run previous actions. Shows last 10 runs and allows reusing variables.
--no-update-check Skips version and dependency update checks.
--help -h Shows help information.
--version -v Shows the version number.

⚙️ Configuration

Configuration file .puzzle.json is located in root of your repository

default config looks like this:

{
   "puzzleDir": "puzzle",
   "aiderArgs": {
      "no-auto-commit": true,
      "no-auto-lint": true
   }
}

aiderArgs will be passed to aider command, check aider --help for more

For example you can set model like this:

{
   "aiderArgs": {
      "model": "openrouter/anthropic/claude-3.5-sonnet",
   }
}

Or override the default config:

{
  "aiderArgs": {
    "no-auto-commit": null, // null values are ignored
    "auto-commit": true
  }
}

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors