Docs exports: JSON llms.txt llms-full.txt Agent Files

class Shards::AIDocsInstaller

Overview

Detects, installs, and manages AI documentation from shard dependencies.

When dependencies are installed or updated, AIDocsInstaller scans each package for AI-relevant files (skills, agents, commands, CLAUDE.md, etc.) and copies them into the project's .claude/ directory with shard-namespaced paths to avoid conflicts.

It also handles MCP server configuration merging from .mcp.json files shipped by dependencies into a project-level .mcp-shards.json.

Auto-detected locations

The following paths are scanned in each dependency:

Namespacing

Files are namespaced by shard name to prevent conflicts:

Conflict detection

Uses AIDocsInfo to track dual checksums per file. User-modified files are preserved during updates, with an .upstream copy saved for comparison.

Defined in:

ai_docs.cr

Constant Summary

SECURITY_SKIP_FILES = [".claude/settings.json", ".claude/settings.local.json"]

Settings files that are never distributed for security reasons.

Constructors

Instance Method Summary

Constructor Detail

def self.new(project_path : String) #

[View source]

Instance Method Detail

def has_ai_docs?(package : Package) : Bool #

Returns true if the package contains any auto-detectable AI docs or has explicit ai_docs.include entries in its spec.


[View source]
def install(packages : Array(Package)) #

Installs AI documentation from the given packages into the project's .claude/ directory. Skips packages without AI docs and respects the --skip-ai-docs flag.


[View source]
def install_mcp_config(package : Package, mcp_json_path : String) #

Installs MCP server configuration from a shard's .mcp.json into the project's .mcp-shards.json. Server names are namespaced as <shard>/<server_name> and relative command/args paths are rewritten to point into lib/<shard>/.


[View source]
def project_path : String #

Root path of the project receiving AI docs.


[View source]
def prune(removed_shard_names : Array(String)) #

Removes all AI documentation files for the given shard names. Cleans up skills, agents, commands, .upstream files, and MCP server entries.


[View source]