markmv
Version:
TypeScript CLI for markdown file operations with intelligent link refactoring
122 lines • 4.02 kB
TypeScript
/**
* Configuration options for index generation operations.
*
* Controls how documentation indexes are created, including content type, organization strategy,
* and output locations.
*
* @category Commands
*/
export interface IndexOptions {
/** Type of index content to generate */
type: 'links' | 'import' | 'embed' | 'hybrid';
/** Strategy for organizing files in the index */
strategy: 'directory' | 'metadata' | 'manual';
/** Where to place generated index files */
location: 'all' | 'root' | 'branch' | 'existing';
/** Name for generated index files */
name: string;
/** Style for embedded content (Obsidian or standard markdown) */
embedStyle: 'obsidian' | 'markdown';
/** Path to custom template file */
template?: string;
/** Perform a dry run without making actual changes */
dryRun: boolean;
/** Enable verbose output with detailed progress information */
verbose: boolean;
/** Maximum depth to traverse subdirectories */
maxDepth?: number;
/** Prevent traversing up from the specified directory */
noTraverseUp: boolean;
/** Explicit boundary path to limit scanning scope */
boundary?: string;
}
/**
* Metadata extracted from markdown file frontmatter.
*
* Used for organizing and presenting files in generated indexes.
*
* @category Commands
*/
export interface FileMetadata {
/** Document title from frontmatter */
title?: string;
/** Document description from frontmatter */
description?: string;
/** Category for grouping documents */
category?: string;
/** Numeric order for sorting within groups */
order?: number;
/** Tags associated with the document */
tags?: string[];
}
/**
* Represents a markdown file that can be included in an index.
*
* Contains file path information, extracted metadata, and content for use in index generation.
*
* @category Commands
*/
export interface IndexableFile {
/** Absolute path to the file */
path: string;
/** Path relative to the index generation root */
relativePath: string;
/** Extracted frontmatter metadata */
metadata: FileMetadata;
/** Full file content */
content: string;
}
/**
* Execute the index command to generate documentation indexes.
*
* This is the main entry point for the index command functionality. It processes CLI options and
* delegates to the core index generation logic.
*
* @category Commands
*
* @param directory - Target directory for index generation (defaults to current directory)
* @param cliOptions - Raw CLI options object
*
* @internal This is a CLI wrapper - use generateIndexFiles for programmatic access
*/
/** CLI options interface for the index command */
interface IndexCliOptions {
type?: 'links' | 'import' | 'embed' | 'hybrid';
strategy?: 'directory' | 'metadata' | 'manual';
location?: 'all' | 'root' | 'branch' | 'existing';
name?: string;
embedStyle?: 'obsidian' | 'markdown';
template?: string;
dryRun?: boolean;
verbose?: boolean;
json?: boolean;
maxDepth?: number;
noTraverseUp?: boolean;
boundary?: string;
}
/**
* CLI command handler for generating documentation indexes.
*
* Creates organized documentation indexes from markdown files using various strategies. Supports
* multiple index types including links, imports, embeds, and hybrid modes.
*
* @example
* ```bash
* # Generate a links-based index
* markmv index --type links --strategy directory
*
* # Generate with custom template
* markmv index docs/ --type hybrid --template custom.md
*
* # Dry run with verbose output
* markmv index --dry-run --verbose
* ```;
*
* @param directory - Target directory for index generation
* @param cliOptions - Command options specifying index parameters
*
* @group Commands
*/
export declare function indexCommand(directory: string | undefined, cliOptions: IndexCliOptions): Promise<void>;
export {};
//# sourceMappingURL=index.d.ts.map