New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

codecanon

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

codecanon

CLI tool that downloads documentation from 3rd party libraries, converts them to Markdown, and optimizes for LLMs

latest
Source
npmnpm
Version
0.0.3
Version published
Maintainers
1
Created
Source

CodeCanon

Stop copy-pasting docs. Start getting answers.

CodeCanon transforms your AI coding assistant from a general-purpose tool into a project-aware expert by automatically building a local, optimized knowledge base from your dependencies' documentation.

The Problem: The AI "Context Gap"

Modern AI assistants like GitHub Copilot, ChatGPT, and Claude are incredibly powerful, but they have a critical weakness: they work best with rich, relevant context. Without proper context, they're prone to "hallucinations"—generating plausible but incorrect code.

Currently, developers bridge this gap manually by:

  • 📋 Copy-pasting documentation into chat interfaces
  • ✍️ Writing detailed prompts with library-specific context
  • 📁 Creating ad-hoc instruction files like copilot-instructions.md

This manual process is time-consuming, error-prone, and doesn't scale across teams.

The Solution: Context-as-Code

CodeCanon automates the entire Retrieval-Augmented Generation (RAG) pipeline for your project dependencies. With a single command, it transforms scattered web documentation into a local, queryable knowledge base that makes your AI assistants dramatically more effective.

Key Features

  • 🤖 AI-First Design: Specifically optimized for AI coding assistants (GitHub Copilot, ChatGPT, Claude)
  • Multi-Source Intelligence: Automatically discovers and fetches documentation from npm, GitHub, and official docs
  • 🎯 Smart Processing: Converts and chunks documentation for optimal LLM comprehension
  • 💾 Local-First: All processed documentation stays in your project (.canon/ directory)
  • 🔍 Semantic Search: Query your dependencies using natural language
  • 👥 Team-Ready: Share context configurations across your development team
  • CLI-Native: Integrate seamlessly into your existing development workflow

The "Git" Model for Context

CodeCanon follows the proven "Git model" for managing project state. Just like .git/ manages your version control, .canon/ manages your AI context:

.canon/
├── settings.json          # Project configuration
├── cache/                 # Raw and processed documentation
│   └── <package>/
│       └── <version>/
│           ├── raw/       # Original scraped content
│           └── chunks/    # Semantic chunks for AI
├── context/
│   ├── llms.txt          # Context index (llms.txt standard)
│   └── llms-full.txt     # Full concatenated context
└── db/                   # Vector database

Quick Start

Installation

npm install -g codecanon

Initialize Your Project

# Create .canon workspace in your project
canon init

# Add documentation for your dependencies
canon add react
canon add express
canon add zod

# Generate context files for AI assistants
canon context

Use with Your AI Assistant

Once you've run canon context, you can use the generated context with any AI assistant:

GitHub Copilot Chat:

Based on the context in #file:.canon/context/llms-full.txt, show me how to create a form with validation using react-hook-form and zod.

ChatGPT/Claude:

Upload or reference .canon/context/llms-full.txt in your conversation for accurate, project-specific assistance.

Commands

Core Commands (Free)

  • canon init [--model <model>] - Initialize workspace with optional default LLM model
  • canon add <package>[@version] - Fetch and process package documentation
  • canon sync - Auto-sync all dependencies from package.json
  • canon context - Generate final context files for AI assistants
  • canon query "<question>" - Interactive Q&A with your documentation
  • canon login - Authenticate with codecanon.ai

Why CodeCanon?

For Individual Developers

"Stop copy-pasting docs and start getting answers. CodeCanon makes your AI assistant an expert on the libraries you actually use, directly in your project."

For Development Teams

"Ensure your entire team's AI assistants are working from the same, up-to-date set of documentation and best practices. Improve code consistency and accelerate onboarding."

Development & Contributing

Setup

# Install dependencies
pnpm install

# Run in development mode
pnpm dev

# Build for production
pnpm build

Project Structure

  • cli/ - Command implementations (init, add, query, etc.)
  • lib/ - Core library functions (workspace, package handling, query engine)
  • .canon/ - Generated workspace directory (created by canon init)

Contributing

We welcome contributions! Please see our Contributing Guide for details.

  • Fork the repository
  • Create your feature branch (git checkout -b feat/amazing-feature)
  • Commit your changes (git commit -m 'feat: add some amazing feature')
  • Push to the branch (git push origin feat/amazing-feature)
  • Open a Pull Request

Roadmap

Phase 1: Core Foundation ✅

  • CLI framework with Commander.js
  • Workspace initialization (.canon/ directory)
  • Package metadata fetching from npm
  • Basic documentation scraping and processing
  • Context file generation (llms.txt standard)

Phase 2: Enhanced Processing 🚧

  • Intelligent documentation discovery (homepage, GitHub, docs sites)
  • Advanced semantic chunking algorithms
  • Support for multiple documentation formats
  • Caching and incremental updates

Phase 3: Vector Database 📋

  • Vector embeddings and similarity search
  • canon query interactive Q&A
  • Private npm registry support
  • codecanon.ai authentication and billing

Phase 4: Team & Enterprise 🎯

  • Shared workspace configurations
  • Private repository documentation scraping
  • VS Code extension
  • Additional language ecosystems (PyPI, Cargo, etc.)

Community & Support

License

This project is licensed under the Apache License 2.0 - see the LICENSE file for details.

Built with ❤️ for the developer community

Making AI assistants smarter, one dependency at a time.

Keywords

cli

FAQs

Package last updated on 28 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts