{"id":25121,"library":"context-compiler","title":"Context Compiler","description":"Agentic context compiler for AI-assisted development in TypeScript/JavaScript projects. Version 0.1.15 scans package.json, tsconfig.json, ESLint config, and CONTEXT.md, then uses an LLM via OpenRouter to resolve conflicts and generate a single Cursor rules file (.mdc). It bundles skill files for Angular, React, Node.js, TypeScript, etc., prioritized by project config. Requires Node >=22.0.0. Differentiators: automated detection of project technologies and ESLint/TSConfig constraints; priority hierarchy where CONTEXT.md overrides all; single OpenRouter call for synthesis; dry-run mode. Release cadence: early stage, frequent updates.","status":"active","version":"0.1.15","language":"javascript","source_language":"en","source_url":"https://github.com/AlekseyVY/context-compiler","tags":["javascript","ai","agent","cursor","context","typescript","angular","react","llm"],"install":[{"cmd":"npm install context-compiler","lang":"bash","label":"npm"},{"cmd":"yarn add context-compiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add context-compiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used to call OpenRouter API via OpenAI-compatible client","package":"openai","optional":false},{"reason":"Glob patterns to scan project files","package":"globby","optional":false},{"reason":"Terminal output styling","package":"chalk","optional":false}],"imports":[{"note":"ESM-only; no CommonJS support as of v0.1.x. compile is a named export, not default.","wrong":"const compile = require('context-compiler')","symbol":"compile","correct":"import { compile } from 'context-compiler'"},{"note":"init is a named export. Default import is undefined.","wrong":"import contextCompiler from 'context-compiler'","symbol":"init","correct":"import { init } from 'context-compiler'"},{"note":"scanProject is exported from internal module for advanced use; not part of main public API.","wrong":"import { scanProject } from 'context-compiler'","symbol":"scanProject","correct":"import { scanProject } from 'context-compiler/internal'"}],"quickstart":{"code":"import { compile, init } from 'context-compiler';\nimport { config } from 'openai';\n\n// Initialize: prompts for API key if not set\nawait init();\n\n// Compile context\nconst result = await compile({\n  openRouterApiKey: process.env.OPENROUTER_API_KEY ?? '',\n  dryRun: true, // Preview without writing\n  skills: ['react', 'typescript'], // Override auto-detection\n});\n\nconsole.log(result); // Generated .mdc content","lang":"typescript","description":"Shows how to programmatically initialize and compile context using the library's named exports."},"warnings":[{"fix":"Upgrade Node to v22 or later.","message":"Requires Node >=22.0.0; will throw on older versions.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Replace `skills` with `customSkills` in compile() call.","message":"The 'skills' option in compile() is deprecated; use 'customSkills' instead.","severity":"deprecated","affected_versions":">=0.1.10"},{"fix":"Set OPENROUTER_API_KEY environment variable or call init() first.","message":"OpenRouter API key is required; if not provided via env or init, the compile will fail with a non-descriptive error.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Create the directory manually or run init() which creates it.","message":"The compile function writes to .cursor/rules/auto-context.mdc. Ensure .cursor/rules/ directory exists prior to calling compile without dryRun.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Use import statements and ensure package.json has \"type\": \"module\".","message":"ESM-only; using require() will cause a runtime error.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Explicitly set model in compile options to avoid unexpected changes.","message":"In v0.1.12, the default model changed from 'gpt-4' to 'anthropic/claude-3.5-sonnet'. Existing code may use deprecated model.","severity":"breaking","affected_versions":">=0.1.12"},{"fix":"Avoid using internal exports; rely on public API.","message":"scanProject() from 'context-compiler/internal' is not stable; its output format may change without major version bump.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import syntax; add \"type\": \"module\" to package.json or use .mjs extension.","cause":"Package is ESM-only; CommonJS require is not supported.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Use `import { init } from 'context-compiler'`.","cause":"Using default import instead of named import for init.","error":"TypeError: init is not a function"},{"fix":"Run `npx context-compiler init` or set process.env.OPENROUTER_API_KEY.","cause":"Missing API key for OpenRouter.","error":"OpenRouter API key not found. Set OPENROUTER_API_KEY env or run init."},{"fix":"Create directory: `mkdir -p .cursor/rules` or run init first.","cause":"Directory .cursor/rules does not exist and compile() tries to write without --dry-run.","error":"ENOENT: no such file or directory, mkdir '.cursor/rules'"},{"fix":"Upgrade Node to >=22 and use ESM imports.","cause":"Running Node <22 or using CommonJS import/require mismatch.","error":"SyntaxError: Unexpected token 'export'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}