devibe
Version:
Intelligent repository cleanup with auto mode, AI learning, markdown consolidation, auto-consolidate workflow, context-aware classification, and cost optimization
123 lines • 3.19 kB
TypeScript
/**
* Scripts Index Generator
*
* Intelligently analyzes scripts folder and generates:
* 1. INDEX.md in scripts/ folder with categorized script documentation
* 2. AI-readable usage instructions
* 3. Auto-detected categories (build, deploy, test, utility, etc.)
* 4. Script descriptions and usage examples
* 5. Updates README with link to scripts/INDEX.md
*
* Philosophy:
* - Help AI understand what scripts do and how to use them
* - Categorize by purpose (build, deploy, test, setup, etc.)
* - Provide usage examples and parameter documentation
* - Keep index synchronized with actual scripts
*/
import type { ProjectConventions } from './project-convention-analyzer.js';
export interface ScriptFile {
path: string;
relativePath: string;
name: string;
category?: string;
title?: string;
description?: string;
language?: string;
isExecutable: boolean;
requiresArgs?: boolean;
lastModified: Date;
}
export interface ScriptCategory {
name: string;
displayName: string;
description?: string;
icon?: string;
scripts: ScriptFile[];
}
export interface ScriptsIndexResult {
indexPath: string;
categoriesFound: number;
scriptsIndexed: number;
readmeUpdated: boolean;
}
export declare class ScriptsIndexGenerator {
private aiAvailable;
initialize(): Promise<void>;
/**
* Generate or update scripts index
*/
generate(rootPath: string, conventions?: ProjectConventions, dryRun?: boolean): Promise<ScriptsIndexResult>;
/**
* Find scripts folder based on conventions
*/
private findScriptsFolder;
/**
* Scan scripts folder for script files
*/
private scanScriptsFolder;
/**
* Check if file is a script
*/
private isScriptFile;
/**
* Detect script language
*/
private detectLanguage;
/**
* Read script content safely
*/
private readScriptSafely;
/**
* Extract description from script comments
*/
private extractDescription;
/**
* Detect if script requires arguments
*/
private detectRequiredArgs;
/**
* Generate human-readable title from filename
*/
private generateTitle;
/**
* Categorize scripts by purpose
*/
private categorizeScripts;
/**
* Detect script category from name and content
*/
private detectCategory;
/**
* Format category name for display
*/
private formatCategoryName;
/**
* Get category description
*/
private getCategoryDescription;
/**
* Get category icon
*/
private getCategoryIcon;
/**
* Sort categories by priority
*/
private sortCategories;
/**
* Generate INDEX.md content
*/
private generateIndexContent;
/**
* Slugify text for anchor links
*/
private slugify;
/**
* Update README.md with unified index section
*/
private updateReadmeWithIndex;
/**
* Get a preview of what would be generated (for dry-run)
*/
preview(rootPath: string, conventions?: ProjectConventions): Promise<string>;
}
//# sourceMappingURL=scripts-index-generator.d.ts.map