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

@0ct0s3c/cursor-to-opencode

v1.0.6

Published

Use Cursor .cursor/rules in OpenCode with dynamic rule injection, diagnostics, and stats.

Downloads

96

Readme

Cursor-to-OpenCode: Cursor Rules for OpenCode

npm version npm package license: MIT

Use Cursor .cursor/rules in OpenCode. This OpenCode plugin discovers Cursor rule files, validates frontmatter, dynamically injects matching rules into chat context, and provides /cursor-to-opencode diagnostics for loaded, inactive, skipped, and rejected rules.

Features

  • Loads Cursor rules from .cursor/rules/**/*.md and .cursor/rules/**/*.mdc.
  • Supports alwaysApply, globs, description, manual rule mentions, @file references, optional .cursorrules, and AGENTS.md detection.
  • Dynamically injects only the relevant Cursor rules for the current OpenCode session.
  • Reports invalid or unsupported Cursor rules with clear diagnostics.
  • Provides /cursor-to-opencode and /cursor-to-opencode stats commands.
  • Stores stats outside the project by default so your repo does not get noisy changed files.

Keywords

OpenCode plugin, Cursor rules, .cursor/rules, .cursorrules, Cursor-to-OpenCode, AI coding rules, system prompt injection, OpenCode AI, Cursor AI, developer tools.

Install

Add the npm package to opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@0ct0s3c/cursor-to-opencode@latest"]
}

Pin a release if you want reproducible behavior:

{
  "plugin": ["@0ct0s3c/[email protected]"]
}

Test Locally Before Publishing

You do not need to publish to npm to test this plugin on your computer. OpenCode supports local path plugins.

Build the package:

npm install
npm run build

Then add the local package directory to the OpenCode config for the project you want to test:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "C:/path/to/Cursor-to-OpenCode"
  ]
}

You can also point directly at the built server file:

{
  "plugin": [
    "file:///C:/path/to/Cursor-to-OpenCode/dist/index.js"
  ]
}

Restart OpenCode after changing opencode.json. Create a test rule such as .cursor/rules/test.mdc in the project being tested:

---
alwaysApply: true
---

Reply with "Cursor rule plugin is active" when asked to verify rules.

Then ask OpenCode to verify the rule. To inspect diagnostics, ask it to call the cursor_to_opencode, cursor_to_opencode_status, or cursor_to_opencode_stats tool.

The plugin intercepts /cursor-to-opencode through OpenCode's command.execute.before hook, the same pattern used by plugins like DCP. Restart OpenCode after changing plugin config, then run:

/cursor-to-opencode

Project injection stats are available with:

/cursor-to-opencode stats

Stats are stored outside the project by default under OpenCode's config directory, so /cursor-to-opencode stats does not create changed files in your repo. Set statsPath only if you explicitly want project-local stats.

If your OpenCode build does not dispatch unknown slash commands to plugin hooks, create .opencode/commands/cursor-to-opencode.md in the project where you are testing:

---
description: Show Cursor rules loaded in this OpenCode session
---

Call the `cursor_to_opencode` tool. Show which Cursor rules were loaded, matched, skipped, or rejected for this session. Include validation warnings and rejection reasons.

Alternatively, define /cursor-to-opencode directly in opencode.json:

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": [
    "file:///C:/path/to/Cursor-to-OpenCode/dist/index.js"
  ],
  "command": {
    "cursor-to-opencode": {
      "description": "Show Cursor rules loaded in this OpenCode session",
      "template": "If the first argument is `stats`, call the `cursor_to_opencode_stats` tool. Otherwise call the `cursor_to_opencode` tool. Show Cursor rule diagnostics clearly."
    }
  }
}

With this config, /cursor-to-opencode is an OpenCode custom command even if hook-dispatched unknown commands are disabled. The plugin still provides the underlying tools.

To debug plugin loading, start OpenCode with:

opencode --print-logs --log-level DEBUG

On Windows, log files are normally under %USERPROFILE%\.local\share\opencode\log.

For release-like testing, run:

npm run ci
npm pack

npm pack verifies the exact tarball that would be published. OpenCode's easiest pre-release path is still the local directory or file:///.../dist/index.js plugin config; use the tarball mainly to inspect package contents.

Manual npm Deploy

GitHub Releases are the preferred publish path, but you can deploy from this machine too.

Create a local .env file that is never committed:

NPM_TOKEN=npm_your_fresh_automation_token

Then run:

npm run deploy

The deploy script:

  • loads NPM_TOKEN from .env
  • validates package.json uses strict x.y.z semver
  • fails if that package version already exists on npm
  • runs full CI
  • writes a temporary npm config outside the repo
  • publishes @0ct0s3c/cursor-to-opencode publicly
  • deletes the temporary npm config afterward

Supported Cursor Rule Formats

  • .cursor/rules/**/*.md
  • .cursor/rules/**/*.mdc
  • nested .cursor/rules folders
  • .cursor/rules/imported/**
  • alwaysApply
  • description
  • globs
  • manual @rule mentions
  • @file references for diagnostics
  • optional legacy .cursorrules
  • AGENTS.md detection for status parity

Cursor User Rules and Team Rules are settings/dashboard data, not normal repo files. The plugin reports those as unsupported external surfaces unless a future option provides an explicit import path.

Dynamic Rule Matching

  • alwaysApply: true rules are injected every turn.
  • globs rules are injected when a tracked active file matches.
  • description-only rules use lightweight prompt/file relevance scoring.
  • manual-only rules inject only when mentioned.
  • invalid rules are rejected with reason-coded diagnostics.

Commands And Tools

The plugin exposes these OpenCode tools:

  • cursor_to_opencode
  • cursor_to_opencode_status
  • cursor_to_opencode_stats

The plugin also intercepts these slash commands directly through command.execute.before:

  • /cursor-to-opencode
  • /cursor-to-opencode stats

If your OpenCode build does not dispatch unknown slash commands to plugins, add a command file:

---
description: Show Cursor rules loaded in this OpenCode session
---

Call the `cursor_to_opencode` tool and summarize which Cursor rules loaded, matched, skipped, or failed validation.

Save that as .opencode/commands/cursor-to-opencode.md, then run /cursor-to-opencode.

Options

{
  "plugin": [
    ["@0ct0s3c/cursor-to-opencode@latest", {
      "legacyCursorrules": true,
      "strict": false,
      "maxRulesPerTurn": 20,
      "maxRuleBytes": 120000,
      "intelligentMatching": true,
      "statusCommand": true,
      "includeAgentsMd": false,
      "allowExternalRulePaths": false,
      "statsEnabled": true,
      "statsPath": ""
    }]
  ]
}

By default, statsPath: "" stores stats globally per workspace. If you want the old repo-local behavior, set statsPath to .opencode/cursor-to-opencode-stats.json.

Validation

Known Cursor frontmatter fields are alwaysApply, description, and globs.

The validator rejects invalid YAML, invalid known-field types, empty rule bodies, unreadable rules, and unsafe paths. It warns for unknown fields, ignored fields under alwaysApply: true, oversized rules, unresolved @file references, and YAML-array globs in non-strict mode.

Development

npm install
npm run typecheck
npm run test
npm run build
npm run pack:dry

Publish with the release workflow or npm publish --provenance --access public.