A comprehensive AI code detection and analysis CLI tool for tracking AI-generated code in projects
npm install @deriv-com/shiftai-cli> AI Code Tracking and Productivity Analytics CLI for Development Teams
>
> Track and analyze AI-generated code usage in your development workspace to measure productivity impact and optimize team workflows.


- 🤖 AI Code Detection - Automatically detects AI-wrapped code in multiple languages
- 🎯 AI Rules Configuration - Auto-configure AI tools to consistently mark generated code
- 🔄 Git Integration - Seamless pre-commit hooks with automated processing
- 🌐 GitHub Sync - Automatic upload to compliance repository
- 🎨 Beautiful CLI - Professional interface with colors, progress bars, and spinners
- ⚙️ Flexible Configuration - Multiple configuration methods and options
Install ShiftAI in your project to track AI code usage:
``bash1. Install the CLI globally
npm install -g @deriv-com/shiftai-cli
Follow the interactive prompts to configure GitHub integration and organization settings.
What this does:
- Installs pre-commit hooks
- Creates project configuration
- Sets up automatic AI code tracking
$3
If ShiftAI is already installed in your project, you just need to setup your GitHub token:
`bash
Create a .env file in your project root
touch .env
`Add your GitHub token to the
.env file:`bash
GitHub Personal Access Token (required for uploads)
GITHUB_TOKEN=your_github_token_here
`Create a Personal Access Token:
1. Go to GitHub → Settings → Developer settings → Personal access tokens → Tokens (classic)
2. Click Generate new token → Generate new token (classic)
3. Token details:
- Name:
shiftai-token
- Expiration: No expiration (safe for local use)
- Scopes:
- ✅ repo → Needed to push branches & create PRs
- ✅ workflow → Needed if PR triggers GitHub Actions
- (optional) read:org → If you need organization info
4. Authorize for your organization:
- Generate token and copy it immediately — you won't be able to see it again
- Click on the Configure SSO dropdown and select the org that should be accessible with this token
5. Add the token to your .env fileThat's it! The pre-commit hook will now automatically:
1. Scan staged files for AI markers
2. Extract AI code for productivity analytics
3. Upload data to your configured repository
4. Strip AI markers from source files
5. Re-stage cleaned files for commit
📖 AI Code Markers
ShiftAI supports multiple AI marker formats across different languages:
$3
`javascript
// [AI]
function calculateTotal(items) {
return items.reduce((sum, item) => sum + item.price, 0);
}
// [/AI]
`$3
`python
[AI]
def calculate_total(items):
return sum(item.price for item in items)
[/AI]
`$3
`css
/ [AI] /
.button {
background: linear-gradient(45deg, #007bff, #0056b3);
border: none;
border-radius: 4px;
}
/ [/AI] /
`$3
`html
AI Generated Component
This component was generated by AI
`🎯 AI Rules Configuration
Ensure all AI tools consistently wrap generated code with markers!
ShiftAI can automatically configure your AI development tools to always mark generated code with the appropriate
[AI] tags.$3
`bash
Install AI rules configuration for your project
shai rules install
`This creates configuration files that instruct AI tools to automatically wrap all generated code with markers:
Automatic Configuration (IDE-based tools):
- ✅ Cursor (
.cursorrules) - Automatic AI code marking
- ✅ Cline (.clinerules + cline_instructions.md) - Automatic AI code marking
- ✅ VS Code AI Extensions (.vscode/settings.json) - Works with Cline, Continue, CodeGPT, etc.
- ✅ Roo AI (.roo_config.md) - Automatic AI code markingReference Files (manual copy/paste):
- 📋 ChatGPT (
.chatgpt-instructions.md) - Copy/paste at start of conversations
- 📋 Claude (.claude-instructions.md) - Copy/paste or attach file
- 📋 Other AI tools (.ai-instructions.md) - General instructions$3
1. Consistent Tracking - Ensures all team members mark AI code the same way
2. No Manual Work - AI tools automatically add markers, no need to remember
3. Team Standards - Enforces consistent AI code marking across your project
4. Analytics Ready - All AI code gets tracked for productivity analysis
$3
`bash
shai rules install # Install AI rules to your project
shai rules status # Show what's currently configured
shai rules uninstall # Remove AI rules from your project
`All configuration files are automatically added to
.gitignore so they don't interfere with your repository.🛠️ Commands
$3
Sets up ShiftAI in your project with interactive configuration.`bash
shai install [options]Options:
-t, --token GitHub personal access token
-o, --org Organization name
-r, --repo Target repository for data storage
-f, --force Force reinstallation
`$3
Shows current installation and configuration status.`bash
shai status
`$3
Views AI code usage analytics.`bash
shai analytics [options]Options:
-d, --days Number of days to analyze (default: 30)
-f, --format Output format: table|json|csv (default: table)
`$3
Manage git remote selection for diff comparisons (for projects with multiple remotes).`bash
shai remote # Show current remote status
shai remote --list # List all available remotes
shai remote --select # Select/change the main remote
`$3
Configure AI tools to automatically mark generated code with AI markers.`bash
shai rules install # Install AI rules configuration to project
shai rules uninstall # Remove AI rules configuration from project
shai rules status # Show installation status
`$3
Removes ShiftAI from your project.`bash
shai remove [options]Options:
-f, --force Force removal without confirmation
``- Node.js >= 14.0.0
- npm >= 6.0.0
- Git repository
- GitHub personal access token (for uploads)
---