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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@codesenseai/codesense

v1.0.1

Published

CLI for CodeSense AI quality gate — submit diffs, get scores, fail CI on poor code.

Downloads

191

Readme

codesense

AI-powered code quality gate CLI for CI/CD pipelines.

Submit a git diff to CodeSense AI, get an AI + static analysis score, and automatically pass or fail your build — all in one command.

npx @codesenseai/codesense check --api-key cs_xxx --diff changes.diff --threshold 70

Installation

No installation needed. Use directly with npx:

npx @codesenseai/codesense@latest check ...

Or install globally:

npm install -g @codesenseai/codesense

Prerequisites

  • Node.js 18 or later
  • A CodeSense pipeline API key — get one at codesense.online → Pipeline → API Keys

Usage

codesense check --api-key <key> --diff <file> [options]

Options

| Flag | Description | Default | |------|-------------|---------| | --api-key | Your CodeSense pipeline API key | (required) | | --diff | Path to a diff file, or - to read from stdin | (required) | | --threshold | Minimum score to pass the quality gate | 70 | | --host | Custom API host (self-hosted installs) | https://api.codesense.online | | --json | Print the full JSON result instead of formatted output | false |

Exit codes

| Code | Meaning | |------|---------| | 0 | Quality gate passed | | 1 | Quality gate failed, or an error occurred |


Examples

Pipe diff from stdin

git diff origin/main...HEAD | npx @codesenseai/codesense check --api-key cs_xxx --diff -

From a diff file

git diff origin/main...HEAD > changes.diff
npx @codesenseai/codesense check --api-key cs_xxx --diff changes.diff --threshold 80

Output raw JSON (for custom scripts)

npx @codesenseai/codesense check --api-key cs_xxx --diff - --json < changes.diff

CI/CD Integration

GitHub Actions

name: CodeSense Quality Gate
on: [pull_request]

jobs:
  quality-gate:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Generate diff
        run: git diff origin/${{ github.base_ref }}...HEAD > changes.diff

      - name: Run CodeSense check
        run: |
          npx @codesenseai/codesense@latest check \
            --api-key ${{ secrets.CODESENSE_API_KEY }} \
            --diff changes.diff \
            --threshold 70

Add CODESENSE_API_KEY in your repo → Settings → Secrets and variables → Actions.


GitLab CI

quality-gate:
  stage: pre-build
  image: node:20-alpine
  script:
    - git diff origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME...HEAD > changes.diff
    - npx @codesenseai/codesense@latest check --api-key $CODESENSE_API_KEY --diff changes.diff
  rules:
    - if: $CI_MERGE_REQUEST_ID

Add CODESENSE_API_KEY in Settings → CI/CD → Variables.


Bitbucket Pipelines

pipelines:
  pull-requests:
    '**':
      - step:
          name: CodeSense Quality Gate
          image: node:20-alpine
          script:
            - git diff origin/main...HEAD > changes.diff
            - npx @codesenseai/codesense@latest check --api-key $CODESENSE_API_KEY --diff changes.diff

Add CODESENSE_API_KEY in Repository settings → Repository variables.


curl / Manual API

If you'd rather call the API directly without the CLI:

# 1. Submit diff
DIFF=$(git diff HEAD~1)
JOB=$(curl -s -X POST https://api.codesense.online/api/pipeline/analyze \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"diff\": \"$DIFF\", \"threshold\": 70}")

JOB_ID=$(echo $JOB | jq -r '.jobId')

# 2. Poll result
curl -s https://api.codesense.online/api/pipeline/result/$JOB_ID \
  -H "x-api-key: YOUR_API_KEY" | jq '.status,.score'

How it works

  1. Submits your diff to the CodeSense API
  2. Waits while the engine runs AI analysis + Semgrep static analysis
  3. Scores the code across Security, Performance, Best Practice, and Style
  4. Prints a colour-coded summary of issues
  5. Exits 0 (pass) or 1 (fail) so your CI pipeline reacts automatically

Any high-severity security issue causes an immediate fail regardless of score.


Security

  • Store your API key as a CI/CD secret — never commit it to your repository.
  • API keys can be revoked at any time from the CodeSense dashboard.
  • Each key has a configurable rate limit (requests per minute).

License

MIT © Muthukumar