phantomit / docs

Installation

Phantomit is a global CLI tool. Install it once and use it in any git project on your machine.

bash
$ npm install -g phantomit-cli

Requires Node.js 18+. You'll also need a free Groq API key from console.groq.com — no credit card required.

Quick Start

Up and running in under a minute.

bash
# 1. go into any git project
$ cd your-project

# 2. setup phantomit
$ phantomit init
✓ .phantomit.json created

# 3. add your groq key
$ echo "GROQ_API_KEY=your_key" >> .env

# 4. start watching in background
$ phantomit watch --on-save --daemon
✓ phantomit daemon started (pid 12847)

That's it. Edit files, save them, and phantomit handles the rest silently in the background.

Commands

phantomit init
Create .phantomit.json config in current project
phantomit watch --every 30
Auto commit every 30 minutes if changes exist
phantomit watch --lines 20
Auto commit when 20+ lines have changed
phantomit watch --on-save
Commit 8s after your last file save
phantomit watch --on-save --daemon
Same but runs silently in background
phantomit push
Manually trigger an AI commit right now
phantomit push --mock
Test the flow without a Groq API key
phantomit stop
Stop the background daemon
phantomit status
Check if daemon is running + recent activity

Watch Modes

--on-save

Triggers a commit 8 seconds after your last file save. All saves within that window are batched into one commit — so editing 5 files quickly results in one clean commit, not five.

bash
phantomit watch --on-save # foreground
phantomit watch --on-save --daemon # background

--every <minutes>

Commits on a fixed time interval if there are uncommitted changes. Fully hands-off.

bash
phantomit watch --every 30 # every 30 minutes
phantomit watch --every 10 # every 10 minutes

--lines <count>

Commits when the accumulated diff exceeds a line count. Best for dense coding bursts.

bash
phantomit watch --lines 20 # every 20 lines

phantomit push

No automation — trigger AI commit generation manually whenever you're ready.

bash
phantomit push # commit now
phantomit push --mock # test without Groq key
--daemon flag — append to any watch command to run phantomit in the background. Logs go to .phantomit.log. Use phantomit status to check activity, phantomit stop to kill it.

The Prompt

In foreground mode, every commit trigger shows you the AI-generated message before doing anything. You are always in control.

phantomit
[9:14 AM] ✎ src/auth.ts, ✚ src/middleware.ts

✦ Commit message:
"feat(auth): add JWT validation middleware with token expiry handling"

[Y] commit & push [E] edit message [N] skip

y
✔ committed: feat(auth): add JWT validation middleware
✔ pushed to origin/main
  • YCommit and push with the generated message
  • EEdit the message before committing
  • NSkip this commit entirely

In daemon mode (--daemon), the prompt is skipped and commits happen automatically. All activity is logged to .phantomit.log.

Configuration

Running phantomit init creates a .phantomit.json in your project root. CLI flags always override config values.

json
{
  "mode": "interval",
  "interval": 30,
  "lines": 20,
  "debounce": 8,
  "autoPush": true,
  "watch": ["." ],
  "ignore": ["node_modules", ".git"],
  "branch": "main"
}
FieldDefaultDescription
mode"interval"Watch mode: interval, lines, on-save, manual
interval30Minutes between commits in interval mode
lines20Line threshold for lines mode
debounce8Seconds to wait after last save before triggering
autoPushtrueAuto push to remote after committing
watch["."]Directories to watch. Defaults to entire project.
ignore[...]Extra ignore patterns. Merged with .gitignore automatically.
branch"main"Branch to push to

API Keys

Phantomit reads your Groq key from .env. It supports unlimited keys for automatic rotation — useful for spreading rate limits across free accounts.

env
# single key — works fine
GROQ_API_KEY=your_key_here

# multiple keys — no limit, picked at random per commit
GROQ_API_KEY_1=first_key
GROQ_API_KEY_2=second_key
GROQ_API_KEY_3=third_key
# GROQ_API_KEY_4, _5, _10... all work

Any env variable matching GROQ_API_KEY_* is picked up automatically. Get free keys at console.groq.com.

Never commit your .env file. Make sure .env is in your .gitignore. Phantomit reads your gitignore automatically and won't watch or commit your .env.

.gitignore Integration

Phantomit automatically reads your .gitignore and uses it as the watcher's ignore list. You never have to duplicate your ignore patterns.

The ignore field in .phantomit.json is additive — it merges on top of your gitignore. So node_modules, dist, .env and anything else in gitignore is automatically excluded.

All standard gitignore syntax is supported — negations (!important.js), globs (**/*.log), trailing slashes (dist/). Powered by the ignore npm library.

How It Works

Four simple steps run on every trigger:

01
Detect

File changes are detected by chokidar and batched within the debounce window into a single event. All event types are tracked — creates, edits, deletes, and folder changes.

02
Diff

git add . stages everything, then git diff --staged captures the full diff. Git is the source of truth — no manual file snapshotting needed.

03
Generate

The diff is sent to Groq's llama-3.1-8b-instant with a strict conventional commits prompt. Max 60 tokens, 10-20 words, specific and professional.

04
Commit & Push

The message is shown for approval (or auto-committed in daemon mode). If approved, git commit then git push sends it to your remote.

If a commit is in progress when a new trigger fires, it's queued and runs immediately after — nothing is ever silently dropped.