@autodoc-ai/sdk
v0.9.0
Published
Node.js SDK for Autodoc - AI-powered code intelligence
Maintainers
Readme
Autodoc Node.js SDK
Node.js/TypeScript SDK for Autodoc - AI-powered code intelligence.
Prerequisites
Autodoc must be installed via pip:
pip install ai-code-autodocInstallation
npm install @autodoc-ai/sdkQuick Start
import { Autodoc } from '@autodoc-ai/sdk';
// Initialize with your repo path
const autodoc = new Autodoc('/path/to/your/repo');
// Analyze the codebase
await autodoc.analyze();
// Search with natural language
const results = await autodoc.search('user authentication flow');
console.log(results);
// List context packs
const packs = await autodoc.listPacks();
// Analyze impact of changes
const impact = await autodoc.analyzeImpact(['src/auth/login.ts']);
if (impact.criticalPacks.length > 0) {
console.warn('Critical packs affected:', impact.criticalPacks);
}API Reference
new Autodoc(options)
Create a new Autodoc instance.
// Simple usage
const autodoc = new Autodoc('/path/to/repo');
// With options
const autodoc = new Autodoc({
path: '/path/to/repo',
quiet: true,
pythonPath: '/usr/bin/python3',
});autodoc.analyze(options?)
Analyze the codebase.
const result = await autodoc.analyze({
incremental: true, // Only analyze changed files
excludePatterns: ['*.test.ts'],
save: true, // Save to cache
});autodoc.search(query, options?)
Search with natural language.
const results = await autodoc.search('authentication', {
limit: 10,
typeFilter: 'function',
});
// Returns: SearchResult[]
// {
// name: string;
// type: string;
// filePath: string;
// lineNumber: number;
// similarity: number;
// }autodoc.listPacks(options?)
List all context packs.
const packs = await autodoc.listPacks({
tag: 'security',
securityLevel: 'critical',
});autodoc.getPack(name)
Get a specific pack by name.
const authPack = await autodoc.getPack('auth');autodoc.analyzeImpact(changedFiles)
Analyze impact of file changes.
const impact = await autodoc.analyzeImpact([
'src/auth/login.ts',
'src/auth/session.ts',
]);
console.log('Affected packs:', impact.affectedPacks);
console.log('Critical packs:', impact.criticalPacks);
console.log('Security implications:', impact.securityImplications);autodoc.queryPack(packName, query, options?)
Search within a specific pack.
const results = await autodoc.queryPack('auth', 'token validation', {
limit: 5,
});autodoc.buildPack(name, options?)
Build a pack's index.
await autodoc.buildPack('auth', {
withEmbeddings: true,
withSummary: true, // Requires LLM API key
dryRun: false,
});
// Build all packs
await autodoc.buildPack('all');autodoc.getPackDependencies(name, options?)
Get pack dependencies.
const deps = await autodoc.getPackDependencies('payments', {
transitive: true, // Include transitive dependencies
});isAutodocInstalled(pythonPath?)
Check if autodoc is available.
import { isAutodocInstalled } from 'autodoc-sdk';
if (!isAutodocInstalled()) {
console.error('Please install autodoc: pip install ai-code-autodoc');
}TypeScript Support
Full TypeScript support with exported types:
import {
Autodoc,
SearchResult,
AnalysisResult,
ImpactResult,
Pack,
AutodocOptions,
} from '@autodoc-ai/sdk';License
MIT
