Repository Management
The nanx repo commands provide Git-compatible repository management
with AI-powered enhancements for commits, releases, and custom workflows.
Worktree Mode Beta New in v0.4.0
Nanx supports git worktrees, allowing you to work on multiple branches simultaneously. Each branch gets its own directory, so you never have to stash or switch.
# Clone with worktree support
nanx r clone https://github.com/org/repo.git
# Create new branch (creates worktree automatically)
nanx r switch -c feature/new-feature
# Copy .env from specific branch
nanx r switch -c feature/new --copy-from develop See Worktree Workflow Guide for complete documentation.
Git Shortcuts Stable
The r command (alias for nanx repo) provides quick shortcuts for
common git operations. See the Shortcuts Reference for the
complete list.
# These are equivalent
nanx r s # shorthand
nanx repo s # full command
git status # equivalent git command AI-Powered Commits Beta
Generate Commit Messages
Nanx can automatically generate commit messages based on your staged changes using AI analysis of the diff:
# Stage changes and generate message
nanx r a .
nanx r c --generate-message
# Or use the shortcut flag
nanx r c --gm
# Or use composite command
nanx r cgm "additional context for AI" How It Works
- Nanx analyzes your staged changes (git diff)
- Sends the diff to your configured AI provider
- AI generates a commit message following your configured format
- You can review, edit, or accept the message
- Commit is created with the final message
Composite Commands
Common AI-powered commit workflows:
# Add + Commit with generated message
nanx r acgm "fix login bug"
# Commit with generated message
nanx r cgm
# Add + Commit + Push with generated message
nanx r acgmp "implement feature X" Configuration
Configure AI commit generation in your config.yaml:
repo:
commit:
generate_message:
enabled: true
provider: anthropic
model: claude-3-5-sonnet-20241022
format: accid # or conventional
max_tokens: 500
include_diff: true # Send full diff to AI
temperature: 0.3 # Lower = more deterministic Message Formats
| Format | Description | Example |
|---|---|---|
accid | Advanced commit format with URIs | #123 [auth] feat: add OAuth login |
conventional | Conventional Commits format | feat(auth): add OAuth login support |
simple | Simple descriptive messages | Add OAuth login support to auth module |
See ACCID Format Guide for details on the advanced format.
Changelog Management Beta New in v0.3.2
The nanx repo change-log command (alias: nanx r clog) provides
manual changelog generation, listing, viewing, and validation with AI support:
# Generate changelog for a project
nanx r change-log generate my-project
# List all changelogs
nanx r change-log list my-project
# Show specific changelog
nanx r change-log show my-project v1.2.0
# Validate changelog structure
nanx r change-log validate my-project
Supports multiple formats including detailed, keep-a-changelog,
conventional, and commits-only. Generates both internal/technical
and end-user changelogs.
See Changelog Command Reference for complete documentation.
Release Management Beta
Create versioned releases with automated tagging and changelog generation:
nanx repo release Interactive Release Flow
- Select version bump type (major, minor, patch)
- Review and edit release notes
- Create git tag with version
- Push tag to remote repository
- Optional: Trigger CI/CD pipeline
Version Bump Types
| Type | Example | When to use |
|---|---|---|
| major | 1.0.0 → 2.0.0 | Breaking changes |
| minor | 1.0.0 → 1.1.0 | New features (backward compatible) |
| patch | 1.0.0 → 1.0.1 | Bug fixes |
| prerelease | 1.0.0 → 1.0.1-alpha.0 | Pre-release versions |
Release Options
# Specify bump type
nanx repo release --bump minor
# Skip prompts
nanx repo release --bump patch --yes
# Custom tag format
nanx repo release --tag-format "v{version}"
# Don't push to remote
nanx repo release --no-push
# Generate changelog
nanx repo release --changelog Advanced Release Configuration
Configure in .repo.yml:
release:
bump_strategy: auto # auto, smart-auto, manual
changelog: true # Generate changelog
tag_format: "v{version}" # Tag format
pre_release_hook: ./scripts/pre-release.sh
post_release_hook: ./scripts/post-release.sh See Repository Config Reference and Release Workflow Guide for more details.
Custom Workflows Stable
run Command
Execute custom commands defined in .repo.yml. This works with any repository -
no build system required. If an Nx workspace is detected, nanx can also discover and run Nx targets.
nanx repo run <command>
# List available commands
nanx repo run --list Example .repo.yml:
commands:
test:
run: npm test
description: Run test suite
build:
run: npm run build
description: Build production bundle
deploy:
run: |
npm run build
scp -r dist/ server:/var/www/
description: Build and deploy to production Usage:
# Run custom commands from .repo.yml
nanx repo run test
nanx repo run build
nanx repo run deploy
# In Nx workspaces, you can also run targets directly
nanx repo run surkyl-server:build
nanx repo run crew-ui:serve Repository Statistics Beta
View repository statistics and insights:
nanx repo stats Shows:
- Total commits and contributors
- Lines of code by language
- Most active files
- Branch statistics
- Commit frequency over time
All Repository Commands
| Command | Description | Maturity |
|---|---|---|
nanx r s | Show repository status | 🟢 Stable |
nanx r a <files> | Stage files for commit | 🟢 Stable |
nanx r c "message" | Commit staged changes | 🟢 Stable |
nanx r c --gm | Commit with AI-generated message | 🟡 Beta |
nanx r cgm | Composite: commit with generated message | 🟡 Beta |
nanx r acgm | Composite: add all + commit with gen message | 🟡 Beta |
nanx r p | Push to remote | 🟢 Stable |
nanx r pl | Pull from remote | 🟢 Stable |
nanx r b | List branches | 🟢 Stable |
nanx r b <name> | Create/switch branch | 🟢 Stable |
nanx r d | Show diff | 🟢 Stable |
nanx r l | Show commit log | 🟢 Stable |
nanx r switch -c <branch> | Create branch (worktree in worktree mode) | 🟢 Stable |
nanx r switch --copy-from | Copy .env files from specified branch New in v0.4.0 | 🟡 Beta |
nanx repo release | Create a new release | 🟡 Beta |
nanx r change-log | Manage changelogs (generate, list, show, validate) | 🟡 Beta |
nanx repo run <cmd> | Run custom command from .repo.yml | 🟢 Stable |
nanx repo stats | Show repository statistics | 🟡 Beta |
Examples
Standard Git Workflow
# Using 'nanx r' shorthand (alias for 'nanx repo')
# Check status
nanx r s
# Stage changes
nanx r a .
# Commit with message
nanx r c "fix: resolve login bug"
# Push to remote
nanx r p AI-Powered Workflow
# Stage changes
nanx r a .
# Generate commit message with AI
nanx r c --gm
# Or use shortcut
nanx r cgm
# One-liner: stage + commit with AI + push
nanx r acgmp Release Workflow
# Ensure everything is committed
nanx r s
# Create a patch release
nanx repo release --bump patch
# Or interactive
nanx repo release