llm-docs-sync
v1.0.4
Published
Functional documentation sync for LLM context in SvelteKit projects
Downloads
194
Maintainers
Readme
llm-docs-sync
A functional, Effect-based documentation sync tool for maintaining up-to-date LLM context in your SvelteKit projects.
Features
- 🚀 Functional & Type-Safe: Built with Effect library for robust error handling
- 📦 Bun-First: Optimized for Bun runtime
- 🔄 Auto-Sync: Keeps your LLM documentation context fresh
- ⚙️ Configurable: Customize sources, output directory, and project rules
- 🎯 SvelteKit Ready: Pre-configured for SvelteKit + Effect projects
- 📝 Auto-Generated AGENTS.md: Creates comprehensive agent configuration files
Installation
bun add -d llm-docs-sync
Usage
CLI
Add to your package.json scripts:
{
"scripts": {
"sync-docs": "llm-docs-sync"
}
}
Run:
bun run sync-docs
Programmatic API
import { syncDocs, type DocSource } from 'llm-docs-sync';
import { Effect } from 'effect';
import { DEFAULT_SOURCES, DEFAULT_PROJECT_RULES } from 'llm-docs-sync/defaults';
// Use defaults
Effect.runPromise(syncDocs());
// Custom configuration
Effect.runPromise(
syncDocs({
sources: [
...DEFAULT_SOURCES,
{ name: "Custom Lib", url: "https://example.com/llms.txt" }
],
outputDir: "./docs/context",
agentsFile: "AI_CONTEXT.md",
projectRules: [
"Use TypeScript strict mode",
"Follow Effect best practices"
]
})
);Default Sources
- Svelte 5:
https://svelte.dev/docs/svelte/llms.txt - SvelteKit:
https://svelte.dev/docs/kit/llms.txt - Effect:
https://effect.website/llms-full.txt - Vite:
https://vite.dev/llms.txt - Skeleton:
https://www.skeleton.dev/llms-svelte.txt - Dexie:
https://dexie.org/llms.txt
Default Project Rules
- Always use Bun for adding packages, running scripts, and testing.
- Svelte 5 Runes: Use
$state,$derived, and$effectas defined in local Svelte context. - Effect TS: Follow the patterns defined in the Effect full documentation file.
Configuration
type SyncConfig = {
sources?: DocSource[]; // Documentation sources to sync (default: DEFAULT_SOURCES)
outputDir?: string; // Output directory (default: ./.opencode/context)
agentsFile?: string; // AGENTS.md file path (default: AGENTS.md)
projectRules?: string[]; // Custom project rules (default: DEFAULT_PROJECT_RULES)
};
Example Workflow
- Install the package
- Add sync script to package.json
- Run before starting development or in CI/CD
- Your AGENTS.md and context files stay updated
{
"scripts": {
"predev": "bun run sync-docs",
"dev": "vite dev"
}
}
Generated AGENTS.md Format
The tool generates an AGENTS.md file with the following structure. If the file already exists, the new content is appended with a separator (\n\n---\n\n):
# OpenCode Agent Configuration
**Primary Runtime:** Bun (System-wide)
**Context Strategy:** Local Documentation First
## 📚 Local Documentation References
The following files contain the latest API specifications and standards.
Always consult these before attempting to write code for these libraries:
- **Svelte 5**: Refer to "./.opencode/context/svelte-5.md"
- **SvelteKit**: Refer to "./.opencode/context/sveltekit.md"
- **Effect**: Refer to "./.opencode/context/effect.md"
- **Vite**: Refer to "./.opencode/context/vite.md"
- **Skeleton**: Refer to "./.opencode/context/skeleton.md"
- **Dexie**: Refer to "./.opencode/context/dexie.md"
## 🛠 Project Rules
1. **Always use Bun** for adding packages, running scripts, and testing.
2. **Svelte 5 Runes:** Use `$state`, `$derived`, and `$effect` as defined in local Svelte context.
3. **Effect TS:** Follow the patterns defined in the Effect full documentation file.API Reference
Functions
syncDocs(config?: Partial<SyncConfig>): Effect.Effect<void, never>
Main sync function that fetches documentation from all sources and generates AGENTS.md.
runCLI(): void
Runs the sync process from command line.
toFileName(name: string): string
Converts a source name to a filename (lowercase, spaces to hyphens).
createManifest(results: readonly SyncResult[]): readonly string[]
Creates manifest entries for successful sync results.
Types
DocSource
interface DocSource {
readonly name: string;
readonly url: string;
}
SyncResult
interface SyncResult {
readonly name: string;
readonly filePath: string;
readonly status: "success" | "failed";
}
SyncConfig
interface SyncConfig {
readonly sources: readonly DocSource[];
readonly outputDir: string;
readonly agentsFile?: string;
readonly projectRules?: readonly string[];
}
Testing
bun test
Publishing
This package is published under:
- Brand: EduTherapy (a brand of Talim Shifa Studio)
- NPM Package: llm-docs-sync
- NPM Publisher: edutherapy
- Company Website: https://eduth.pro/
- Contact: [email protected]
License
MIT
