pact edit
Edit pact files locally or in the web editor
pact edit
Edit your pact configuration files locally or open the web editor.
Usage
pact edit [path]Arguments
| Argument | Description |
|---|---|
| (none) | Opens pact.json in your $EDITOR |
web | Opens the web editor in your browser |
<path> | Opens the specified path relative to .pact/ |
Examples
Edit pact.json
pact editOpens .pact/pact.json in your default editor.
Edit a specific file
pact edit shell/zshrc # Edit shell config
pact edit editor/nvim/init.lua # Edit nvim config
pact edit prompts/default.md # Edit AI promptOpen web editor
pact edit webOpens the Pact web editor in your browser, where you can:
- Browse all your config files
- Edit with syntax highlighting
- Visual JSON editing for
pact.json - Push changes directly to GitHub
Editor Selection
Pact selects an editor in this order:
$EDITORenvironment variable$VISUALenvironment variablevim(if available)nano(if available)vi(fallback)
Set your preferred editor
# In your shell config (.zshrc, .bashrc, etc.)
export EDITOR="code --wait" # VS Code
export EDITOR="nvim" # Neovim
export EDITOR="cursor --wait" # Cursor
export EDITOR="nano" # NanoFor VS Code or Cursor, use the --wait flag so pact knows when you're done editing.
Web Editor
The web editor provides:
- File browser: Navigate your entire pact repo
- Syntax highlighting: JSON, YAML, Markdown, and more
- Live validation: Catch JSON errors before saving
- Section navigation: Jump to specific modules in pact.json
- One-click push: Commit and push without leaving the browser
- AI integration: Open configs in Claude, ChatGPT, or other AI assistants
Environment Variable
You can change the web editor URL:
export PACT_WEB_URL="https://your-custom-pact-web.com"Default: https://pact-ckn.pages.dev
Workflow: Local Editing
# Edit your shell config
pact edit shell/zshrc
# Make your changes in the editor...
# Push changes to GitHub
pact push -m "Update shell aliases"
# On another machine, pull the changes
pact sync shellWorkflow: Web Editing
# Open web editor
pact edit web
# Make changes in the browser...
# Click "Push to GitHub"
# On your machine, sync the changes
pact syncCreating New Files
To create a new file, you can either:
- Create manually: Add the file to
.pact/then updatepact.json - Web editor: Use the web interface to create new files
# Create a new prompt file
touch .pact/prompts/code-review.md
pact edit prompts/code-review.md
# Update pact.json to reference it
pact editTroubleshooting
"EDITOR not set"
Set the EDITOR environment variable in your shell config:
export EDITOR="nvim"Web editor doesn't open
Make sure you have a default browser configured. On Linux, you may need to set $BROWSER:
export BROWSER="firefox"File not found
Make sure the path is relative to .pact/:
# Correct
pact edit shell/zshrc
# Incorrect
pact edit .pact/shell/zshrc
pact edit ~/.pact/shell/zshrc