A comprehensive CLI toolkit for automating GitLab operations, AI-powered code review, build/deploy automation, MongoDB backup/restore, and developer productivity tools
npm install nitorA CLI utility toolkit for automating and managing build, deploy, and status operations for projects, AI code review, AI text refactor and related components.
- Build and deploy Gitlab project
- Check build and deployment status
- Utility functions for parameter parsing and object cleaning
- Extensible and scriptable for automation
- Create git branch
- AI Review merge request
- AI text refactoring
- Backup and restore MongoDB
- Merge git branches
- Cleanup local git branches
- Time entry management with Zoho integration
- GitLab activity tracking
- Task statistics with merge request details
- Extract Zoho task IDs from GitLab issue descriptions
- Merge request status tracking for active tasks
- Node.js >= 14.x
- npm >= 6.x
- A properly configured .env.nu file in your ~/Desktop directory with required tokens and URLs:
- CSRF_TOKEN - CSRF token for Gitlab (Copy from browser)
- COOKIE - Cookie for Gitlab (Copy from browser)
- GITLAB_URI - GitLab API URL, eg: https://gitlab.com/
- GITLAB_TOKEN - Gitlab token
- GITLAB_DEFAULT_PROJECT_ID - Default GitLab project ID for issue lookups
- MR_PROMPT - Merge request prompt
- MR_LANG - Merge request language
- AI_API_KEY - AI API key
- AI_MODEL - AI model
- BACKUP_CONFIG - Backup configuration
- RESTORE_CONFIG - Restore configuration
- ZOHO_COOKIE - Zoho cookie for authentication
- ZOHO_CUSTOMVIEW_ID - Zoho custom view ID
- ZOHO_DEFAULT_PROJECT_ID - Default Zoho project ID
- ZOHO_PORTAL_ID - Zoho portal ID
- ZOHO_PROJECTS - Zoho projects configuration
- ZOHO_SESSION_ID - Zoho session ID
- ZOHO_SOURCE - Zoho source
- ZOHO_TEAM - Zoho team ID
- ZOHO_TOKEN - Zoho CSRF token
- ZOHO_URI - Zoho API URL
- ZOHO_USERID - Zoho user ID
After installing the package globally, you can enable autocomplete:
``bash`
nitor completion
This will add autocomplete support to your shell. Restart your terminal or run:
`bash`
source ~/.bashrc # for bash
source ~/.zshrc # for zsh
You can use the CLI via the nitor command:
`bash`
nitor
Once enabled, you can use Tab to autocomplete:
- Commands (build, deploy, cleanup, etc.)
- Options (-project, -components, etc.)
- Values (portal, gateway, dev, qa, etc.)
- Build:
`bash`
nitor build -project
`
- Deploy:
bash`
nitor deploy -project
`
- Build & Deploy:
bash`
nitor build-deploy -project
`
- Create branch:
bash`
nitor create-branch -task
`
- Review:
bash`
nitor review -project
`
- Refactor Text:
bash`
nitor refactor
- MongoDB Backup & Restore:
`bash
# Backup from Kubernetes pods and restore to local MongoDB
nitor backup
# Backup specific projects only
nitor backup -project
# Restore to Docker container (default: local MongoDB)
nitor backup -docker
`
- Merge:
`bash`
nitor merge -source
`
- Cleanup:
bash`
nitor cleanup
`
- Time Entry - Initialize:
bash`
nitor time-init
`
- Time Entry - Add:
bash`
nitor time-add -project
`
- Time Entry - Update:
bash`
nitor time-update -id
`
- Time Entry - Delete:
bash`
nitor time-delete -id
`
- Time Entry - View Entries:
bash`
nitor time-entries -from
`
- Time Entry - View Stats:
bash`
nitor time-stats -from
`
- Time Entry - Sync to Zoho:
bash`
nitor time-zoho
`
- Time Entry - GitLab Activities:
bash`
nitor time-gitlab -from
`
- Time Entry - Merge Request Status:
bash`
nitor time-merge
`
- Time Entry - Switch Project:
bash`
nitor time-switch
`
- Task Stats:
bash`
nitor task-stats -task
`
- Get Task (Extract Zoho Task IDs):
bash`
nitor get-task -task
- build : Build specified componentsdeploy
- : Deploy specified componentsbuild-deploy
- : Build and then deployversion
- : Show version infohelp
- : Show helpinit
- : Initialize configurationcreate-branch
- : Create git branchreview
- : AI review specified merge requestrefactor
- : AI refactor specified textbackup
- : Backup MongoDB databases from Kubernetes pods and restore to local/Dockermerge
- : Merge source branch into target branchcleanup
- : Cleanup local git branches (checkout to master and delete all other branches)time-init
- : Initialize time entry configurationtime-add
- : Add time entry with support for multiple tagstime-update
- : Update existing time entrytime-delete
- : Delete time entrytime-entries
- : View time entries by date rangetime-stats
- : View daily statistics of time entriestime-zoho
- : Sync time entries to Zohotime-gitlab
- : Get GitLab activities for a date rangetime-merge
- : View merge request status for active taskstime-switch
- : Switch between default projectstask-stats
- : View task statistics with GitLab merge request detailsget-task
- : Extract Zoho task IDs from GitLab issue descriptions
The MongoDB backup service provides automated backup and restore functionality for MongoDB databases running in Kubernetes pods. It supports:
- ✅ Backup from Kubernetes pods using kubectl
- ✅ Restore to Docker containers or local MongoDB instances
- ✅ Cross-platform support (Windows, macOS, Linux)
- ✅ Multi-project configuration
- ✅ Automatic cleanup of temporary files
- ✅ Error handling with detailed logging
Configure your backup settings in the .env.nu file using JSON format:
#### BACKUP_CONFIG
Defines the source databases to backup from Kubernetes pods:
`json`
BACKUP_CONFIG={
"project1": [
{
"pod": "mongodb-pod-name",
"username": "admin",
"password": "password123",
"database": "mydb",
"backupPath": "/data/backup",
"localBackupPath": "~/backups/mongo"
}
],
"project2": [
{
"pod": "another-pod",
"username": "dbuser",
"password": "dbpass",
"database": "anotherdb"
}
]
}
Configuration Options:
- pod (required): Name of the Kubernetes podusername
- (required): MongoDB usernamepassword
- (required): MongoDB passworddatabase
- (required): Database namebackupPath
- (optional): Path inside pod for temporary backup (default: /data/backup)localBackupPath
- (optional): Local path to store backups (default: ~/backups/mongo)
#### RESTORE_CONFIG
Defines where to restore the backup:
`json`
RESTORE_CONFIG={
"mongoInDocker": false,
"containerName": "mongodb",
"localBackupPath": "~/backups/mongo",
"containerBackupPath": "/data/backup"
}
Configuration Options:
- mongoInDocker (optional): Set to true to restore to Docker container, false for local MongoDB (can be overridden with -docker flag)containerName
- (optional): Docker container name (default: mongodb)localBackupPath
- (optional): Path where backup is stored (default: ~/backups/mongo)containerBackupPath
- (optional): Path inside container for temporary files (default: /data/backup)
1. Backup Phase:
- Executes mongodump inside the Kubernetes podkubectl cp
- Copies backup files to your local machine using ~/backups/mongo/
- Cleans up temporary files from the pod
- Saves to by default
2. Restore Phase:
- Docker Mode (-docker flag):mongorestore --drop
- Copies backup from local machine to Docker container
- Executes inside the containermongorestore --drop
- Cleans up temporary files from container
- Local Mode (default):
- Executes directly on local machinemongodb://localhost:27017/
- Connects to
Backup all configured projects:
`bash`
nitor backup
Backup specific projects:
`bash`
nitor backup -project project1 project2
Backup and restore to Docker container:
`bash`
nitor backup -docker
- For Backup: kubectl configured with access to your Kubernetes clustermongodump
- For Restore (Docker): Docker running with MongoDB container
- For Restore (Local): MongoDB installed and running locally on port 27017
- MongoDB tools (, mongorestore) must be available in the pod/container
The backup service is designed to work on Windows, macOS, and Linux:
- Automatically detects the operating system
- Uses appropriate shell (cmd.exe on Windows, /bin/sh on Unix)-it
- Handles path normalization across platforms
- Adjusts command flags for Windows compatibility (e.g., removes flags)
- Non-zero exit codes from mongorestore are treated as warnings (common with duplicate keys)
- Detailed error messages with color-coded output
- Continues processing remaining projects even if one fails
- Cleanup operations run even if restore encounters errors
- -project or -p : Project name (portal, gateway, phr)-components
- or -c : Components (client, backend, etc.)-instance
- or -i : Instance/environment (dev, qa, pilot)-branch
- or -b : Git branch (optional)-task
- or -t : Task number-type
- or -ty : Type (feat, fix)-description
- or -d : Description-repository
- or -r : Repository name-mergeId
- or -mId : Merge ID-source
- or -so : Source branch name-target
- or -ta : Target branch name
#### Time Entry Options
- -project or -p : Project name-sprint
- or -s : Sprint name (e.g., "sprint 1")-task
- or -t : Task ID-date
- or -dt : Date in YYYY-MM-DD format-work
- or -w : Work description (supports multiple tags)-duration
- or -du : Duration in minutes-remarks
- or -r : Additional remarks-id
- or -i : Entry ID (for update/delete operations)-from
- or -f : Start date for filtering-to
- or -t` : End date for filtering
ISC
Nithin V (