@llms-sdk/decorators-demo
v2.2.0
Published
Example app demonstrating LLMS SDK decorators usage
Readme
LLMS SDK Adorn Example
This example application demonstrates the various features of the @llms-sdk/decorators package.
Features Demonstrated
- Basic Documentation Generation - Parse code and comments to generate HTML documentation
- LLM-Powered Annotations - Use AI to add intelligent explanations to code
- Multiple File Documentation - Process multiple files and generate an index
- Literate Programming - Support for literate CoffeeScript style documentation
Setup
# Install dependencies
npm install
# Build the example
npm run buildRunning the Examples
# Run all examples
npm start
# Or run directly
node dist/index.jsWith LLM Annotations
To enable AI-powered annotations, set your Anthropic API key:
export ANTHROPIC_API_KEY="your-api-key"
npm startExample Output
The examples will generate several files:
factorial-docs.html- HTML documentation for a factorial functiondocs-index.html- Index page for multiple file documentation
Individual Examples
You can also import and run individual examples:
import { basicExample, annotationExample } from "@lennylmiller/adorn-example";
await basicExample();
await annotationExample();Use Cases
1. Static Documentation Generation
Generate beautiful HTML documentation from your source code:
const adorn = new Adorn({ layout: "parallel" });
const result = await adorn.document("myfile.js", sourceCode);
await writeFile("docs.html", result.html);2. Terminal Documentation
View documentation directly in your terminal:
const adorn = new Adorn({ layout: "terminal" });
const result = await adorn.document("myfile.py", sourceCode);
console.log(result.terminal);3. AI-Enhanced Documentation
Add intelligent annotations to your code:
const client = promptsync.anthropic({ apiKey: "your-key" });
const adorn = new Adorn();
const result = await adorn.annotate("complex.ts", complexCode, "Explain the performance characteristics");4. Integration with Build Tools
Integrate into your build process to generate documentation automatically:
{
"scripts": {
"docs": "node generate-docs.js"
}
}Next Steps
- Explore different layout options (parallel, linear, terminal)
- Customize syntax highlighting themes
- Add custom language definitions
- Integrate with your CI/CD pipeline
