npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@deriv-com/shiftai-cli

v1.0.12

Published

A comprehensive AI code detection and analysis CLI tool for tracking AI-generated code in projects

Downloads

9,375

Readme

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.

npm version License: MIT

✨ Features

  • 🤖 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

🚀 Installation

For Project Setup (Team Lead/Admin)

Install ShiftAI in your project to track AI code usage:

# 1. Install the CLI globally
npm install -g @deriv-com/shiftai-cli

# 2. Navigate to your project directory
cd your-project

# 3. Setup ShiftAI in the project
shai install

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

For Local Development (Individual Developers)

If ShiftAI is already installed in your project, you just need to setup your GitHub token:

# Create a .env file in your project root
touch .env

Add your GitHub token to the .env file:

# 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 file

That'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:

JavaScript/TypeScript/Java/C/C++/C#/PHP/Go/Rust/Swift/Kotlin/Scala

// [AI]
function calculateTotal(items) {
  return items.reduce((sum, item) => sum + item.price, 0);
}
// [/AI]

Python/Shell/Ruby/PERL/R/YAML/TOML

# [AI]
def calculate_total(items):
    return sum(item.price for item in items)
# [/AI]

CSS/SCSS/Less

/* [AI] */
.button {
  background: linear-gradient(45deg, #007bff, #0056b3);
  border: none;
  border-radius: 4px;
}
/* [/AI] */

HTML/XML/Markdown

<!-- [AI] -->
<div class="card">
  <h2>AI Generated Component</h2>
  <p>This component was generated by AI</p>
</div>
<!-- [/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.

Quick Setup

# 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 marking

Reference 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

Why Use AI Rules?

  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

Commands

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

shai install

Sets up ShiftAI in your project with interactive configuration.

shai install [options]

Options:
  -t, --token <token>     GitHub personal access token
  -o, --org <org>         Organization name
  -r, --repo <repo>       Target repository for data storage
  -f, --force             Force reinstallation

shai status

Shows current installation and configuration status.

shai status

shai analytics

Views AI code usage analytics.

shai analytics [options]

Options:
  -d, --days <days>       Number of days to analyze (default: 30)
  -f, --format <format>   Output format: table|json|csv (default: table)

shai remote

Manage git remote selection for diff comparisons (for projects with multiple remotes).

shai remote              # Show current remote status
shai remote --list       # List all available remotes
shai remote --select     # Select/change the main remote

shai rules

Configure AI tools to automatically mark generated code with AI markers.

shai rules install       # Install AI rules configuration to project
shai rules uninstall     # Remove AI rules configuration from project  
shai rules status        # Show installation status

shai remove

Removes ShiftAI from your project.

shai remove [options]

Options:
  -f, --force             Force removal without confirmation

📋 Requirements

  • Node.js >= 14.0.0
  • npm >= 6.0.0
  • Git repository
  • GitHub personal access token (for uploads)