{"id":16893,"library":"repofence","title":"Repofence CLI","description":"Repofence is a command-line interface (CLI) tool designed to streamline the process of preparing software repositories for AI agents. It enables developers to generate structured specifications and AI-specific rules directly from their codebase, ensuring AI tools operate within defined boundaries. The current stable version is 0.2.2, indicating it's an early-stage but actively developed tool. Its key differentiators include local-first operation for codebase scanning (`repofence reverse`), explicit support for various AI assistants like Cursor and Claude, and a focus on creating documentation artifacts (`spec/*.md`) that guide both human developers and AI agents. It aims to prevent AI agents from \"guessing\" and instead work with clear, auto-generated boundaries.","status":"active","version":"0.2.2","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","sdd","spec-driven","cli","documentation","typescript"],"install":[{"cmd":"npm install repofence","lang":"bash","label":"npm"},{"cmd":"yarn add repofence","lang":"bash","label":"yarn"},{"cmd":"pnpm add repofence","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is primarily a global CLI tool. Functionality is accessed via the `repofence` command in the terminal after global installation. Direct programmatic import as a library is not the intended primary use, despite shipping TypeScript types.","wrong":"import { repofence } from 'repofence'","symbol":"repofence command","correct":"npm install -g repofence"},{"note":"While the package ships TypeScript types, its main interaction is via the CLI. If any configuration interfaces (e.g., for internal scripting or advanced integration) are exposed, they would typically be imported as types. The exact names may vary as the API is not publicly documented.","wrong":"import { RepofenceConfig } from 'repofence'","symbol":"Repofence configuration types","correct":"import type { RepofenceConfig } from 'repofence'"},{"note":"For specific CLI commands like `init` or `reverse`, corresponding TypeScript interfaces for their options (e.g., `InitOptions`, `ReverseOptions`) might be exported for advanced use cases or internal tooling. Developers should consult the type declarations if programmatic interaction is attempted beyond the CLI.","wrong":"import { InitOptions } from 'repofence'","symbol":"Command-specific options types","correct":"import type { InitOptions } from 'repofence'"}],"quickstart":{"code":"npm install -g repofence\n\n# 1. Purchase a license and get your token\nrepofence auth --web\n\n# 2. Initialize spec files + install assistant assets (Cursor by default)\nrepofence init\n\n# 3. Auto-populate specs from your codebase\nrepofence reverse\n","lang":"bash","description":"Demonstrates global installation and the core workflow: authentication, project initialization, and auto-population of specifications."},"warnings":[{"fix":"Review `--dry-run` output before using `--force` to understand changes. Backup important `spec/*.md` files.","message":"The `--force` flag on `repofence init` and `repofence reverse` can overwrite existing spec files, potentially losing customized documentation. Use with caution, especially in established projects.","severity":"breaking","affected_versions":">=0.2.2"},{"fix":"Run `repofence auth --web` in your terminal and follow the instructions to obtain and save your authentication token.","message":"Most `repofence` commands (e.g., `init`) require prior authentication with a valid license token. Attempting to use them without `repofence auth` will result in errors.","severity":"gotcha","affected_versions":">=0.2.2"},{"fix":"Execute `repofence reverse` as an early step in the workflow for brownfield projects.","message":"For brownfield (existing) projects, it is strongly recommended to run `repofence reverse` immediately after `repofence init`. This populates the generated spec files with information derived from your existing codebase, ensuring the specs accurately reflect the current state before any AI-driven modifications.","severity":"gotcha","affected_versions":">=0.2.2"},{"fix":"Specify `repofence init cursor` or `repofence init claude` to install the appropriate assets for your AI assistant. Verify installation paths like `~/.cursor/commands/`.","message":"Repofence integrates with specific AI assistants like Cursor and Claude. The `repofence init [ide]` command installs assistant-specific files and configurations which are crucial for the AI integration to function correctly. Ensure you specify the correct IDE for your workflow.","severity":"gotcha","affected_versions":">=0.2.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Run `repofence auth --web` in your terminal and follow the instructions to obtain and save your authentication token.","cause":"Attempting to run `repofence init` or other commands before successfully authenticating with a Repofence license.","error":"Error: Not Authenticated. Please run 'repofence auth --web' to get a license."},{"fix":"Ensure you install the package globally using `npm install -g repofence`. If the problem persists, verify your PATH environment variable includes the npm global bin directory.","cause":"The `repofence` CLI was not installed globally, or the global npm bin directory is not in your system's PATH.","error":"command not found: repofence"},{"fix":"Upgrade your Node.js installation to version 18.0.0 or higher. Consider using `nvm` (Node Version Manager) for easy switching between Node.js versions.","cause":"The system's installed Node.js version is older than the minimum requirement specified in the package's engines field.","error":"Node.js version mismatch. Repofence requires Node.js >=18.0.0."}],"ecosystem":"npm","meta_description":null}