Docsgene

raw JSON →
1.0.0 verified Sat Apr 25 auth: no javascript

Docsgene (v1.0.0) is an AI-focused tool that bundles codebase context into a single file optimized for LLM ingestion. It scans project files, intelligently selects relevant code, and outputs a compact representation that preserves dependencies and structure, reducing token overhead. Released as initial stable version; no established release cadence yet. Key differentiator: purpose-built for LLM context windows, unlike generic bundlers.

error TypeError: docsgene_1.bundleCodebase is not a function
cause Using CommonJS require() on an ESM-only package, getting the module's default export object instead of named export.
fix
Use import { bundleCodebase } from 'docsgene' or const { bundleCodebase } = await import('docsgene').
error SyntaxError: Cannot use import statement outside a module
cause Running in a non-module context (e.g., plain .js file without type: module).
fix
Add "type": "module" to package.json, rename file to .mjs, or use dynamic import().
error Module not found: Can't resolve 'docsgene' in 'C:\project'
cause Package not installed or typo in package name.
fix
Run 'npm install docsgene' and ensure correct import path.
breaking ESM-only: package does not support CommonJS require().
fix Use import syntax. If using Node.js, set "type": "module" in package.json or use .mjs extension.
gotcha Default ignore patterns may not exclude large directories like .git or build outputs; can cause token overflow.
fix Explicitly pass ignorePatterns for all non-essential directories.
gotcha maxTokens setting does not strictly enforce token limit; it's a guideline for chunking.
fix Monitor tokenCount in result and adjust maxTokens or ignorePatterns accordingly.
npm install docsgene
yarn add docsgene
pnpm add docsgene

Shows how to import and use the main bundleCodebase function to generate an LLM-friendly context file from a source directory.

import { bundleCodebase } from 'docsgene';

const result = await bundleCodebase({
  sourceDir: './src',
  outputFile: './context.txt',
  ignorePatterns: ['node_modules', 'dist'],
  maxTokens: 8000,
  includeComments: false,
});

console.log('Bundled context written to', result.outputPath);
console.log('Token count:', result.tokenCount);