@ncukondo/slide-generation 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +56 -0
- package/LICENSE +21 -0
- package/README.md +248 -0
- package/README_ja.md +248 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +2994 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +999 -0
- package/dist/index.js +1469 -0
- package/dist/index.js.map +1 -0
- package/icons/custom/.gitkeep +3 -0
- package/icons/registry.yaml +77 -0
- package/package.json +84 -0
- package/templates/basic/bullet-list.yaml +39 -0
- package/templates/basic/numbered-list.yaml +39 -0
- package/templates/basic/section.yaml +26 -0
- package/templates/basic/title.yaml +46 -0
- package/templates/data/comparison-table.yaml +107 -0
- package/templates/data/table.yaml +94 -0
- package/templates/diagrams/cycle-diagram.yaml +71 -0
- package/templates/diagrams/flow-chart.yaml +141 -0
- package/templates/diagrams/hierarchy.yaml +117 -0
- package/templates/diagrams/matrix.yaml +163 -0
- package/templates/diagrams/timeline.yaml +167 -0
- package/templates/layouts/gallery.yaml +94 -0
- package/templates/layouts/image-text.yaml +105 -0
- package/templates/layouts/three-column.yaml +101 -0
- package/templates/layouts/two-column.yaml +85 -0
- package/templates/special/bibliography.yaml +132 -0
- package/templates/special/code-block.yaml +79 -0
- package/templates/special/custom.yaml +45 -0
- package/templates/special/quote.yaml +76 -0
- package/themes/default.css +122 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts","../../src/core/parser.ts","../../src/core/transformer.ts","../../src/core/renderer.ts","../../src/core/pipeline.ts","../../src/templates/engine.ts","../../src/templates/loader.ts","../../src/templates/validators.ts","../../src/icons/registry.ts","../../src/icons/schema.ts","../../src/icons/resolver.ts","../../src/references/manager.ts","../../src/references/extractor.ts","../../src/references/formatter.ts","../../src/index.ts","../../src/cli/commands/convert.ts","../../src/config/loader.ts","../../src/config/schema.ts","../../src/cli/commands/validate.ts","../../src/cli/commands/templates.ts","../../src/cli/commands/icons.ts","../../src/cli/commands/init.ts","../../src/cli/commands/watch.ts","../../src/cli/commands/preview.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from 'commander';\nimport { VERSION } from '../index.js';\nimport { createConvertCommand } from './commands/convert.js';\nimport { createValidateCommand } from './commands/validate.js';\nimport { createTemplatesCommand } from './commands/templates.js';\nimport { createIconsCommand } from './commands/icons.js';\nimport { createInitCommand } from './commands/init.js';\nimport { createWatchCommand } from './commands/watch.js';\nimport { createPreviewCommand } from './commands/preview.js';\n\nconst program = new Command();\n\nprogram\n .name('slide-gen')\n .description('Generate Marp-compatible Markdown from YAML source files')\n .version(VERSION);\n\n// Add convert command\nprogram.addCommand(createConvertCommand());\n\n// Add validate command\nprogram.addCommand(createValidateCommand());\n\n// Add templates command\nprogram.addCommand(createTemplatesCommand());\n\n// Add icons command\nprogram.addCommand(createIconsCommand());\n\n// Add init command\nprogram.addCommand(createInitCommand());\n\n// Add watch command\nprogram.addCommand(createWatchCommand());\n\n// Add preview command\nprogram.addCommand(createPreviewCommand());\n\nprogram.parse();\n","import { z } from 'zod';\nimport { parse as parseYaml } from 'yaml';\nimport { readFile } from 'fs/promises';\n\n// References config schema\nconst referencesConfigSchema = z.object({\n enabled: z.boolean().default(true),\n style: z.string().default('author-year-pmid'),\n});\n\n// Meta schema\nconst metaSchema = z.object({\n title: z.string(),\n author: z.string().optional(),\n date: z.string().optional(),\n theme: z.string().default('default'),\n references: referencesConfigSchema.optional(),\n});\n\n// Slide schema\nconst slideSchema = z.object({\n template: z.string(),\n content: z.record(z.unknown()).default({}),\n class: z.string().optional(),\n notes: z.string().optional(),\n raw: z.string().optional(),\n});\n\n// Presentation schema\nexport const presentationSchema = z.object({\n meta: metaSchema,\n slides: z.array(slideSchema).default([]),\n});\n\nexport type PresentationMeta = z.infer<typeof metaSchema>;\nexport type ParsedSlide = z.infer<typeof slideSchema>;\nexport type ParsedPresentation = z.infer<typeof presentationSchema>;\n\nexport class ParseError extends Error {\n constructor(\n message: string,\n public details?: unknown\n ) {\n super(message);\n this.name = 'ParseError';\n }\n}\n\nexport class ValidationError extends Error {\n constructor(\n message: string,\n public details?: unknown\n ) {\n super(message);\n this.name = 'ValidationError';\n }\n}\n\nexport class Parser {\n parse(yamlContent: string): ParsedPresentation {\n let rawData: unknown;\n\n try {\n rawData = parseYaml(yamlContent);\n } catch (error) {\n throw new ParseError('Failed to parse YAML', error);\n }\n\n const result = presentationSchema.safeParse(rawData);\n\n if (!result.success) {\n throw new ValidationError(\n 'Schema validation failed',\n result.error.format()\n );\n }\n\n return result.data;\n }\n\n async parseFile(filePath: string): Promise<ParsedPresentation> {\n let content: string;\n\n try {\n content = await readFile(filePath, 'utf-8');\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n throw new ParseError(`File not found: ${filePath}`);\n }\n throw new ParseError(`Failed to read file: ${filePath}`, error);\n }\n\n return this.parse(content);\n }\n}\n","import type { TemplateEngine, IconsHelper, RefsHelper } from '../templates/engine';\nimport type { TemplateLoader } from '../templates/loader';\nimport type { IconResolver } from '../icons/resolver';\nimport type { CitationFormatter } from '../references/formatter';\nimport type { ParsedSlide, ParsedPresentation, PresentationMeta } from './parser';\n\n// Placeholder patterns for async resolution\nconst ICON_PLACEHOLDER_PREFIX = '___ICON_PLACEHOLDER_';\nconst ICON_PLACEHOLDER_SUFFIX = '___';\nconst REFS_CITE_PLACEHOLDER_PREFIX = '___REFS_CITE_PLACEHOLDER_';\nconst REFS_CITE_PLACEHOLDER_SUFFIX = '___';\nconst REFS_EXPAND_PLACEHOLDER_PREFIX = '___REFS_EXPAND_PLACEHOLDER_';\nconst REFS_EXPAND_PLACEHOLDER_SUFFIX = '___';\n\n/**\n * Context passed to each slide transformation\n */\nexport interface TransformContext {\n meta: PresentationMeta;\n slideIndex: number;\n totalSlides: number;\n}\n\n/**\n * Error thrown when transformation fails\n */\nexport class TransformError extends Error {\n constructor(\n message: string,\n public slide?: ParsedSlide,\n public details?: unknown\n ) {\n super(message);\n this.name = 'TransformError';\n }\n}\n\n/**\n * Pending async operations collected during template rendering\n */\ninterface PendingOperations {\n icons: Map<string, { name: string; options: Record<string, unknown> | undefined }>;\n cites: Map<string, string>;\n expands: Map<string, string>;\n}\n\n/**\n * Transformer applies templates to slides and generates HTML content\n */\nexport class Transformer {\n constructor(\n private templateEngine: TemplateEngine,\n private templateLoader: TemplateLoader,\n private iconResolver: IconResolver,\n private citationFormatter: CitationFormatter\n ) {}\n\n /**\n * Transform a single slide using its template\n */\n async transform(slide: ParsedSlide, context: TransformContext): Promise<string> {\n // Handle raw template - return raw content directly\n if (slide.template === 'raw') {\n return slide.raw ?? '';\n }\n\n // Get the template definition\n const template = this.templateLoader.get(slide.template);\n if (!template) {\n throw new TransformError(\n `Template \"${slide.template}\" not found`,\n slide\n );\n }\n\n // Validate content against template schema\n const validationResult = this.templateLoader.validateContent(\n slide.template,\n slide.content\n );\n if (!validationResult.valid) {\n throw new TransformError(\n `Slide content validation failed: ${validationResult.errors?.join(', ')}`,\n slide,\n validationResult.errors\n );\n }\n\n // Build template context with helpers that use placeholders\n const pending: PendingOperations = {\n icons: new Map(),\n cites: new Map(),\n expands: new Map(),\n };\n const templateContext = this.buildTemplateContext(slide, context, pending);\n\n // Render the template (synchronous, with placeholders)\n let output = this.templateEngine.render(template.output, templateContext);\n\n // Resolve all async operations and replace placeholders\n output = await this.resolvePlaceholders(output, pending);\n\n // Add CSS class directive if specified\n if (slide.class) {\n output = `<!-- _class: ${slide.class} -->\\n${output}`;\n }\n\n return output.trim();\n }\n\n /**\n * Transform all slides in a presentation\n */\n async transformAll(presentation: ParsedPresentation): Promise<string[]> {\n const results: string[] = [];\n const totalSlides = presentation.slides.length;\n\n for (let i = 0; i < presentation.slides.length; i++) {\n const slide = presentation.slides[i]!;\n const context: TransformContext = {\n meta: presentation.meta,\n slideIndex: i,\n totalSlides,\n };\n\n const transformed = await this.transform(slide, context);\n results.push(transformed);\n }\n\n return results;\n }\n\n /**\n * Build the full template context with helpers that collect async operations\n */\n private buildTemplateContext(\n slide: ParsedSlide,\n context: TransformContext,\n pending: PendingOperations\n ): Record<string, unknown> {\n let iconCounter = 0;\n let citeCounter = 0;\n let expandCounter = 0;\n\n // Create icons helper that returns placeholders\n const icons: IconsHelper = {\n render: (name: string, options?: Record<string, unknown>) => {\n const id = `${iconCounter++}`;\n const placeholder = `${ICON_PLACEHOLDER_PREFIX}${id}${ICON_PLACEHOLDER_SUFFIX}`;\n pending.icons.set(id, { name, options });\n return placeholder;\n },\n };\n\n // Create refs helper that returns placeholders\n const refs: RefsHelper = {\n cite: (id: string) => {\n const counterId = `${citeCounter++}`;\n const placeholder = `${REFS_CITE_PLACEHOLDER_PREFIX}${counterId}${REFS_CITE_PLACEHOLDER_SUFFIX}`;\n pending.cites.set(counterId, id);\n return placeholder;\n },\n expand: (text: string) => {\n const counterId = `${expandCounter++}`;\n const placeholder = `${REFS_EXPAND_PLACEHOLDER_PREFIX}${counterId}${REFS_EXPAND_PLACEHOLDER_SUFFIX}`;\n pending.expands.set(counterId, text);\n return placeholder;\n },\n };\n\n return {\n content: slide.content,\n meta: {\n title: context.meta.title,\n author: context.meta.author,\n theme: context.meta.theme,\n },\n slide: {\n index: context.slideIndex,\n total: context.totalSlides,\n },\n icons,\n refs,\n };\n }\n\n /**\n * Resolve all placeholders by executing async operations\n */\n private async resolvePlaceholders(\n output: string,\n pending: PendingOperations\n ): Promise<string> {\n // Resolve icons\n const iconResults = new Map<string, string>();\n for (const [id, { name, options }] of pending.icons) {\n const rendered = await this.iconResolver.render(\n name,\n options as { size?: string; color?: string; class?: string } | undefined\n );\n iconResults.set(id, rendered);\n }\n\n // Resolve citations\n const citeResults = new Map<string, string>();\n for (const [counterId, id] of pending.cites) {\n const formatted = await this.citationFormatter.formatInline(id);\n citeResults.set(counterId, formatted);\n }\n\n // Resolve citation expansions\n const expandResults = new Map<string, string>();\n for (const [counterId, text] of pending.expands) {\n const expanded = await this.citationFormatter.expandCitations(text);\n expandResults.set(counterId, expanded);\n }\n\n // Replace all placeholders\n let result = output;\n\n for (const [id, rendered] of iconResults) {\n const placeholder = `${ICON_PLACEHOLDER_PREFIX}${id}${ICON_PLACEHOLDER_SUFFIX}`;\n result = result.replace(placeholder, rendered);\n }\n\n for (const [counterId, formatted] of citeResults) {\n const placeholder = `${REFS_CITE_PLACEHOLDER_PREFIX}${counterId}${REFS_CITE_PLACEHOLDER_SUFFIX}`;\n result = result.replace(placeholder, formatted);\n }\n\n for (const [counterId, expanded] of expandResults) {\n const placeholder = `${REFS_EXPAND_PLACEHOLDER_PREFIX}${counterId}${REFS_EXPAND_PLACEHOLDER_SUFFIX}`;\n result = result.replace(placeholder, expanded);\n }\n\n return result;\n }\n}\n","import type { PresentationMeta } from './parser';\n\n/**\n * Options for rendering the final Marp markdown\n */\nexport interface RenderOptions {\n /** Include theme in front matter (default: true) */\n includeTheme?: boolean;\n /** Speaker notes for each slide (indexed by slide position) */\n notes?: (string | undefined)[];\n /** Additional front matter properties */\n additionalFrontMatter?: Record<string, unknown>;\n}\n\n/**\n * Renderer combines transformed slides into Marp-compatible Markdown\n */\nexport class Renderer {\n /**\n * Render slides and metadata into final Marp markdown\n */\n render(\n slides: string[],\n meta: PresentationMeta,\n options?: RenderOptions\n ): string {\n const frontMatter = this.renderFrontMatter(meta, options);\n const slidesContent = this.joinSlides(slides, options?.notes);\n\n if (slides.length === 0) {\n return frontMatter;\n }\n\n return `${frontMatter}\\n\\n${slidesContent}`;\n }\n\n /**\n * Render the YAML front matter block\n */\n private renderFrontMatter(\n meta: PresentationMeta,\n options?: RenderOptions\n ): string {\n const lines: string[] = ['---', 'marp: true'];\n\n // Add title\n lines.push(`title: ${meta.title}`);\n\n // Add author if present\n if (meta.author) {\n lines.push(`author: ${meta.author}`);\n }\n\n // Add date if present\n if (meta.date) {\n lines.push(`date: ${meta.date}`);\n }\n\n // Add theme if enabled (default: true)\n const includeTheme = options?.includeTheme ?? true;\n if (includeTheme && meta.theme) {\n lines.push(`theme: ${meta.theme}`);\n }\n\n // Add additional front matter properties\n if (options?.additionalFrontMatter) {\n for (const [key, value] of Object.entries(options.additionalFrontMatter)) {\n lines.push(`${key}: ${this.formatFrontMatterValue(value)}`);\n }\n }\n\n lines.push('---');\n\n return lines.join('\\n');\n }\n\n /**\n * Format a front matter value for YAML\n */\n private formatFrontMatterValue(value: unknown): string {\n if (typeof value === 'boolean') {\n return value ? 'true' : 'false';\n }\n if (typeof value === 'number') {\n return String(value);\n }\n if (typeof value === 'string') {\n // Quote if contains special characters\n if (/[:#[\\]{}|>]/.test(value)) {\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`;\n }\n return value;\n }\n return String(value);\n }\n\n /**\n * Join slides with Marp slide separator\n */\n private joinSlides(\n slides: string[],\n notes?: (string | undefined)[]\n ): string {\n const parts: string[] = [];\n\n for (let i = 0; i < slides.length; i++) {\n let slideContent = slides[i]!;\n\n // Add speaker notes if present\n const note = notes?.[i];\n if (note && note.trim()) {\n slideContent = `${slideContent}\\n\\n${this.renderSpeakerNotes(note)}`;\n }\n\n parts.push(slideContent);\n }\n\n // Join with Marp slide separator (---)\n return parts.map(slide => `---\\n\\n${slide}`).join('\\n\\n');\n }\n\n /**\n * Render speaker notes as HTML comment\n */\n private renderSpeakerNotes(notes: string): string {\n return `<!--\\n${notes}\\n-->`;\n }\n}\n","import { writeFile } from 'fs/promises';\nimport { Parser, type ParsedPresentation } from './parser';\nimport { Transformer } from './transformer';\nimport { Renderer, type RenderOptions } from './renderer';\nimport { TemplateEngine } from '../templates/engine';\nimport { TemplateLoader } from '../templates/loader';\nimport { IconRegistryLoader } from '../icons/registry';\nimport { IconResolver } from '../icons/resolver';\nimport { ReferenceManager, type CSLItem } from '../references/manager';\nimport { CitationExtractor } from '../references/extractor';\nimport { CitationFormatter } from '../references/formatter';\nimport type { Config } from '../config/schema';\n\n/**\n * Options for the Pipeline\n */\nexport interface PipelineOptions {\n /** Custom config path override */\n configPath?: string;\n /** Output file path (if not specified, returns string only) */\n outputPath?: string;\n /** Enable verbose/progress output */\n verbose?: boolean;\n}\n\n/**\n * Result of a pipeline run\n */\nexport interface PipelineResult {\n /** Generated Marp markdown */\n output: string;\n /** Citation IDs found in the presentation */\n citations: string[];\n /** Warnings generated during processing */\n warnings: string[];\n /** Number of slides processed */\n slideCount: number;\n}\n\n/**\n * Error thrown when pipeline processing fails\n */\nexport class PipelineError extends Error {\n constructor(\n message: string,\n public stage: string,\n public details?: unknown\n ) {\n super(message);\n this.name = 'PipelineError';\n }\n}\n\n/**\n * Pipeline orchestrates the full YAML to Marp markdown conversion\n *\n * Stages:\n * 1. Parse Source - Load and validate YAML\n * 2. Collect Citations - Extract citation IDs from all slides\n * 3. Resolve References - Fetch bibliography data\n * 4. Transform Slides - Apply templates and resolve icons/citations\n * 5. Render Output - Generate final Marp markdown\n */\nexport class Pipeline {\n private parser: Parser;\n private templateEngine: TemplateEngine;\n private templateLoader: TemplateLoader;\n private iconRegistry: IconRegistryLoader;\n private iconResolver: IconResolver;\n private referenceManager: ReferenceManager;\n private citationExtractor: CitationExtractor;\n private citationFormatter: CitationFormatter;\n private transformer: Transformer;\n private renderer: Renderer;\n private warnings: string[] = [];\n\n constructor(private config: Config) {\n // Initialize all components\n this.parser = new Parser();\n this.templateEngine = new TemplateEngine();\n this.templateLoader = new TemplateLoader();\n this.iconRegistry = new IconRegistryLoader();\n this.iconResolver = new IconResolver(this.iconRegistry);\n this.referenceManager = new ReferenceManager(\n config.references.connection.command\n );\n this.citationExtractor = new CitationExtractor();\n this.citationFormatter = new CitationFormatter(\n this.referenceManager,\n {\n author: {\n maxAuthors: config.references.format.maxAuthors,\n etAl: config.references.format.etAl,\n etAlJa: config.references.format.etAlJa,\n },\n inline: {\n authorSep: config.references.format.authorSep,\n identifierSep: config.references.format.identifierSep,\n },\n }\n );\n this.transformer = new Transformer(\n this.templateEngine,\n this.templateLoader,\n this.iconResolver,\n this.citationFormatter\n );\n this.renderer = new Renderer();\n }\n\n /**\n * Run the full conversion pipeline\n */\n async run(inputPath: string, options?: PipelineOptions): Promise<string> {\n this.warnings = [];\n\n try {\n // Stage 1: Parse Source\n const presentation = await this.parseSource(inputPath);\n\n // Stage 2: Collect Citations\n const citationIds = this.collectCitations(presentation);\n\n // Stage 3: Resolve References\n await this.resolveReferences(citationIds);\n\n // Stage 4: Transform Slides\n const transformedSlides = await this.transformSlides(presentation);\n\n // Stage 5: Render Output\n const output = this.render(transformedSlides, presentation);\n\n // Write output file if specified\n if (options?.outputPath) {\n await writeFile(options.outputPath, output, 'utf-8');\n }\n\n return output;\n } catch (error) {\n if (error instanceof PipelineError) {\n throw error;\n }\n throw new PipelineError(\n error instanceof Error ? error.message : 'Unknown error',\n 'unknown',\n error\n );\n }\n }\n\n /**\n * Run the full pipeline with detailed result\n */\n async runWithResult(\n inputPath: string,\n options?: PipelineOptions\n ): Promise<PipelineResult> {\n this.warnings = [];\n\n try {\n // Stage 1: Parse Source\n const presentation = await this.parseSource(inputPath);\n\n // Stage 2: Collect Citations\n const citationIds = this.collectCitations(presentation);\n\n // Stage 3: Resolve References\n await this.resolveReferences(citationIds);\n\n // Stage 4: Transform Slides\n const transformedSlides = await this.transformSlides(presentation);\n\n // Stage 5: Render Output\n const output = this.render(transformedSlides, presentation);\n\n // Write output file if specified\n if (options?.outputPath) {\n await writeFile(options.outputPath, output, 'utf-8');\n }\n\n return {\n output,\n citations: citationIds,\n warnings: this.warnings,\n slideCount: presentation.slides.length,\n };\n } catch (error) {\n if (error instanceof PipelineError) {\n throw error;\n }\n throw new PipelineError(\n error instanceof Error ? error.message : 'Unknown error',\n 'unknown',\n error\n );\n }\n }\n\n /**\n * Initialize the pipeline by loading templates and icon registry\n */\n async initialize(): Promise<void> {\n try {\n // Load built-in templates\n await this.templateLoader.loadBuiltIn(this.config.templates.builtin);\n\n // Load custom templates if specified\n if (this.config.templates.custom) {\n await this.templateLoader.loadCustom(this.config.templates.custom);\n }\n\n // Load icon registry\n await this.iconRegistry.load(this.config.icons.registry);\n } catch (error) {\n throw new PipelineError(\n `Failed to initialize pipeline: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'initialize',\n error\n );\n }\n }\n\n /**\n * Get collected warnings\n */\n getWarnings(): string[] {\n return [...this.warnings];\n }\n\n // --- Private Stage Methods ---\n\n /**\n * Stage 1: Parse the YAML source file\n */\n private async parseSource(inputPath: string): Promise<ParsedPresentation> {\n try {\n return await this.parser.parseFile(inputPath);\n } catch (error) {\n throw new PipelineError(\n `Failed to parse source file: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'parse',\n error\n );\n }\n }\n\n /**\n * Stage 2: Collect all citation IDs from the presentation\n */\n private collectCitations(presentation: ParsedPresentation): string[] {\n const citations = this.citationExtractor.extractFromPresentation(presentation);\n return this.citationExtractor.getUniqueIds(citations);\n }\n\n /**\n * Stage 3: Resolve references from the reference manager\n */\n private async resolveReferences(ids: string[]): Promise<Map<string, CSLItem>> {\n if (!this.config.references.enabled || ids.length === 0) {\n return new Map();\n }\n\n try {\n const items = await this.referenceManager.getByIds(ids);\n\n // Warn about missing references\n for (const id of ids) {\n if (!items.has(id)) {\n this.warnings.push(`Reference not found: ${id}`);\n }\n }\n\n return items;\n } catch (error) {\n // Non-fatal: log warning and continue\n this.warnings.push(\n `Failed to resolve references: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n return new Map();\n }\n }\n\n /**\n * Stage 4: Transform all slides using templates\n */\n private async transformSlides(\n presentation: ParsedPresentation\n ): Promise<string[]> {\n try {\n return await this.transformer.transformAll(presentation);\n } catch (error) {\n throw new PipelineError(\n `Failed to transform slides: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'transform',\n error\n );\n }\n }\n\n /**\n * Stage 5: Render the final Marp markdown\n */\n private render(\n slides: string[],\n presentation: ParsedPresentation\n ): string {\n try {\n // Collect notes from slides\n const notes = presentation.slides.map((slide) => slide.notes);\n\n const renderOptions: RenderOptions = {\n includeTheme: true,\n notes,\n };\n\n return this.renderer.render(slides, presentation.meta, renderOptions);\n } catch (error) {\n throw new PipelineError(\n `Failed to render output: ${error instanceof Error ? error.message : 'Unknown error'}`,\n 'render',\n error\n );\n }\n }\n}\n","import nunjucks from \"nunjucks\";\n\n/**\n * Icons helper interface for template rendering\n */\nexport interface IconsHelper {\n render: (name: string, options?: Record<string, unknown>) => string;\n}\n\n/**\n * References helper interface for citation handling\n */\nexport interface RefsHelper {\n cite: (id: string) => string;\n expand: (text: string) => string;\n}\n\n/**\n * Slide context passed to templates\n */\nexport interface SlideContext {\n index: number;\n total: number;\n}\n\n/**\n * Meta context for presentation metadata\n */\nexport interface MetaContext {\n title: string;\n author?: string;\n theme: string;\n [key: string]: unknown;\n}\n\n/**\n * Full template context interface\n */\nexport interface TemplateContext {\n content: Record<string, unknown>;\n meta: MetaContext;\n slide: SlideContext;\n icons: IconsHelper;\n refs: RefsHelper;\n [key: string]: unknown;\n}\n\nexport class TemplateEngine {\n private env: nunjucks.Environment;\n\n constructor() {\n this.env = new nunjucks.Environment(null, {\n autoescape: false, // HTML output for Marp\n throwOnUndefined: false,\n });\n this.registerFilters();\n this.registerGlobals();\n }\n\n render(template: string, context: Record<string, unknown>): string {\n return this.env.renderString(template, context);\n }\n\n private registerFilters(): void {\n // Will be extended in later steps\n }\n\n private registerGlobals(): void {\n // Icon helper stub - will be replaced with real implementation\n const icons = {\n render: (name: string, options?: Record<string, unknown>): string => {\n const size = (options?.[\"size\"] as string) ?? \"24px\";\n const color = (options?.[\"color\"] as string) ?? \"currentColor\";\n return `<span class=\"icon icon-${name}\" style=\"font-size: ${size}; color: ${color};\">[${name}]</span>`;\n },\n };\n\n this.env.addGlobal(\"icons\", icons);\n\n // Reference helper stub - will be replaced with real implementation\n const refs = {\n cite: (id: string): string => {\n const cleanId = id.replace(\"@\", \"\");\n return `(${cleanId})`;\n },\n expand: (text: string): string => {\n // Simple stub - replace [@id] with (id)\n return text.replace(/\\[@(\\w+)\\]/g, \"($1)\");\n },\n };\n\n this.env.addGlobal(\"refs\", refs);\n }\n}\n","import { z } from \"zod\";\nimport * as yaml from \"yaml\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport {\n validateWithJsonSchema,\n type JsonSchema,\n type ValidationResult,\n} from \"./validators\";\n\n/**\n * JSON Schema-like structure for template content validation\n */\nconst jsonSchemaSchema = z.record(z.unknown());\n\n/**\n * Template definition schema - validates YAML template definition files\n */\nexport const templateDefSchema = z.object({\n name: z.string().min(1, \"Template name is required\"),\n description: z.string(),\n category: z.string(),\n schema: jsonSchemaSchema,\n example: z.record(z.unknown()).optional(),\n output: z.string().min(1, \"Template output is required\"),\n css: z.string().optional(),\n});\n\n/**\n * Template definition type derived from schema\n */\nexport type TemplateDefinition = z.infer<typeof templateDefSchema>;\n\n/**\n * Loads and manages template definitions from YAML files\n */\nexport class TemplateLoader {\n private templates: Map<string, TemplateDefinition>;\n\n constructor() {\n this.templates = new Map();\n }\n\n /**\n * Load a template from a YAML string\n */\n async loadFromString(yamlContent: string): Promise<void> {\n const parsed = yaml.parse(yamlContent);\n const result = templateDefSchema.safeParse(parsed);\n\n if (!result.success) {\n const errors = result.error.errors\n .map(e => `${e.path.join(\".\")}: ${e.message}`)\n .join(\", \");\n throw new Error(`Invalid template definition: ${errors}`);\n }\n\n this.templates.set(result.data.name, result.data);\n }\n\n /**\n * Load a template from a file\n */\n async loadFromFile(filePath: string): Promise<void> {\n const content = await fs.readFile(filePath, \"utf-8\");\n await this.loadFromString(content);\n }\n\n /**\n * Load all templates from a directory (recursively)\n */\n async loadBuiltIn(directory: string): Promise<void> {\n await this.loadDirectory(directory);\n }\n\n /**\n * Load custom templates from a directory (can override built-in)\n */\n async loadCustom(directory: string): Promise<void> {\n await this.loadDirectory(directory);\n }\n\n /**\n * Internal method to load templates from a directory\n */\n private async loadDirectory(directory: string): Promise<void> {\n const entries = await fs.readdir(directory, { withFileTypes: true });\n\n for (const entry of entries) {\n const fullPath = path.join(directory, entry.name);\n\n if (entry.isDirectory()) {\n await this.loadDirectory(fullPath);\n } else if (entry.isFile() && (entry.name.endsWith(\".yaml\") || entry.name.endsWith(\".yml\"))) {\n await this.loadFromFile(fullPath);\n }\n }\n }\n\n /**\n * Get a template by name\n */\n get(name: string): TemplateDefinition | undefined {\n return this.templates.get(name);\n }\n\n /**\n * List all loaded templates\n */\n list(): TemplateDefinition[] {\n return Array.from(this.templates.values());\n }\n\n /**\n * List templates filtered by category\n */\n listByCategory(category: string): TemplateDefinition[] {\n return this.list().filter(t => t.category === category);\n }\n\n /**\n * Validate content against a template's schema\n */\n validateContent(templateName: string, content: unknown): ValidationResult {\n const template = this.get(templateName);\n\n if (!template) {\n return {\n valid: false,\n errors: [`Template \"${templateName}\" not found`],\n };\n }\n\n return validateWithJsonSchema(template.schema as JsonSchema, content);\n }\n}\n\nexport type { ValidationResult };\n","import { z, type ZodTypeAny, type ZodIssue } from \"zod\";\n\n/**\n * JSON Schema type definition (subset used by templates)\n */\nexport interface JsonSchema {\n type?: string;\n required?: string[];\n properties?: Record<string, JsonSchema>;\n items?: JsonSchema;\n minItems?: number;\n maxItems?: number;\n pattern?: string;\n enum?: (string | number | boolean)[];\n default?: unknown;\n description?: string;\n oneOf?: JsonSchema[];\n}\n\n/**\n * Validation result for content against template schema\n */\nexport interface ValidationResult {\n valid: boolean;\n errors: string[];\n}\n\n/**\n * Convert a JSON Schema object to a Zod schema\n *\n * Supports a subset of JSON Schema used by template definitions:\n * - Basic types: string, number, boolean, array, object\n * - Required fields\n * - Nested objects and arrays\n * - Pattern validation for strings\n * - minItems/maxItems for arrays\n */\nexport function jsonSchemaToZod(schema: JsonSchema): ZodTypeAny {\n // Handle oneOf first (union type)\n if (schema.oneOf && schema.oneOf.length > 0) {\n const schemas = schema.oneOf.map((s) => jsonSchemaToZod(s));\n if (schemas.length === 1) {\n return schemas[0]!;\n }\n // z.union requires at least 2 schemas\n return z.union(schemas as [ZodTypeAny, ZodTypeAny, ...ZodTypeAny[]]);\n }\n\n const type = schema.type ?? \"object\";\n\n switch (type) {\n case \"string\": {\n // Handle enum first (enum values are always valid)\n if (schema.enum && schema.enum.length > 0) {\n const enumValues = schema.enum as [string, ...string[]];\n return z.enum(enumValues);\n }\n\n let zodSchema = z.string();\n if (schema.pattern) {\n zodSchema = zodSchema.regex(new RegExp(schema.pattern));\n }\n return zodSchema;\n }\n\n case \"number\":\n return z.number();\n\n case \"integer\":\n return z.number().int();\n\n case \"boolean\":\n return z.boolean();\n\n case \"array\": {\n const itemSchema = schema.items ? jsonSchemaToZod(schema.items) : z.unknown();\n let arraySchema = z.array(itemSchema);\n\n if (schema.minItems !== undefined) {\n arraySchema = arraySchema.min(schema.minItems);\n }\n if (schema.maxItems !== undefined) {\n arraySchema = arraySchema.max(schema.maxItems);\n }\n\n return arraySchema;\n }\n\n case \"object\": {\n if (!schema.properties) {\n return z.record(z.unknown());\n }\n\n const shape: Record<string, ZodTypeAny> = {};\n const required = new Set(schema.required ?? []);\n\n for (const [key, propSchema] of Object.entries(schema.properties)) {\n const propZod = jsonSchemaToZod(propSchema);\n shape[key] = required.has(key) ? propZod : propZod.optional();\n }\n\n return z.object(shape).passthrough();\n }\n\n default:\n return z.unknown();\n }\n}\n\n/**\n * Validate content against a JSON Schema\n */\nexport function validateWithJsonSchema(\n schema: JsonSchema,\n content: unknown\n): ValidationResult {\n const zodSchema = jsonSchemaToZod(schema);\n const result = zodSchema.safeParse(content);\n\n if (result.success) {\n return { valid: true, errors: [] };\n }\n\n const errors = result.error.errors.map((issue: ZodIssue) => {\n const path = issue.path.join(\".\");\n return path ? `${path}: ${issue.message}` : issue.message;\n });\n\n return { valid: false, errors };\n}\n","import * as fs from \"node:fs/promises\";\nimport { parse as parseYaml } from \"yaml\";\nimport {\n iconRegistrySchema,\n type IconRegistry,\n type IconSource,\n type IconDefaults,\n} from \"./schema.js\";\n\n/**\n * Parsed icon reference with prefix and name\n */\nexport interface ParsedIconReference {\n prefix: string;\n name: string;\n}\n\n/**\n * Icon Registry Loader - loads and manages icon registry configuration\n */\nexport class IconRegistryLoader {\n private registry: IconRegistry | null = null;\n private sourcesByPrefix: Map<string, IconSource> = new Map();\n private aliasMap: Map<string, string> = new Map();\n private colorMap: Map<string, string> = new Map();\n\n /**\n * Load registry from YAML file\n */\n async load(configPath: string): Promise<IconRegistry> {\n const content = await fs.readFile(configPath, \"utf-8\");\n const parsed = parseYaml(content);\n const validated = iconRegistrySchema.parse(parsed);\n\n this.registry = validated;\n this.buildMaps();\n\n return validated;\n }\n\n /**\n * Resolve an alias to its icon reference\n * @returns The resolved icon reference or the original name if not an alias\n */\n resolveAlias(nameOrAlias: string): string {\n return this.aliasMap.get(nameOrAlias) ?? nameOrAlias;\n }\n\n /**\n * Get icon source by prefix\n */\n getSource(prefix: string): IconSource | undefined {\n return this.sourcesByPrefix.get(prefix);\n }\n\n /**\n * Parse an icon reference string (e.g., \"mi:home\" or \"iconify:mdi:account\")\n * @returns Parsed reference or null if invalid format\n */\n parseIconReference(reference: string): ParsedIconReference | null {\n const colonIndex = reference.indexOf(\":\");\n if (colonIndex === -1) {\n return null;\n }\n\n const prefix = reference.substring(0, colonIndex);\n const name = reference.substring(colonIndex + 1);\n\n return { prefix, name };\n }\n\n /**\n * Get registry defaults\n */\n getDefaults(): IconDefaults {\n if (!this.registry) {\n return { size: \"24px\", color: \"currentColor\" };\n }\n return this.registry.defaults;\n }\n\n /**\n * Get color by name from color palette\n */\n getColor(name: string): string | undefined {\n return this.colorMap.get(name);\n }\n\n /**\n * Get all sources\n */\n getSources(): IconSource[] {\n return this.registry?.sources ?? [];\n }\n\n /**\n * Get all aliases\n */\n getAliases(): Record<string, string> {\n return this.registry?.aliases ?? {};\n }\n\n /**\n * Check if registry is loaded\n */\n isLoaded(): boolean {\n return this.registry !== null;\n }\n\n /**\n * Build internal lookup maps from registry\n */\n private buildMaps(): void {\n this.sourcesByPrefix.clear();\n this.aliasMap.clear();\n this.colorMap.clear();\n\n if (!this.registry) {\n return;\n }\n\n // Build sources map\n for (const source of this.registry.sources) {\n this.sourcesByPrefix.set(source.prefix, source);\n }\n\n // Build aliases map\n for (const [alias, target] of Object.entries(this.registry.aliases)) {\n this.aliasMap.set(alias, target);\n }\n\n // Build colors map\n if (this.registry.colors) {\n for (const [name, color] of Object.entries(this.registry.colors)) {\n this.colorMap.set(name, color);\n }\n }\n }\n}\n","import { z } from \"zod\";\n\n/**\n * Schema for icon source types\n */\nexport const iconSourceTypeSchema = z.enum([\n \"web-font\",\n \"svg-inline\",\n \"svg-sprite\",\n \"local-svg\",\n]);\n\nexport type IconSourceType = z.infer<typeof iconSourceTypeSchema>;\n\n/**\n * Schema for individual icon source definition\n */\nexport const iconSourceSchema = z.object({\n name: z.string(),\n type: iconSourceTypeSchema,\n prefix: z.string(),\n url: z.string().optional(),\n path: z.string().optional(),\n render: z.string().optional(),\n});\n\nexport type IconSource = z.infer<typeof iconSourceSchema>;\n\n/**\n * Schema for icon defaults\n */\nexport const iconDefaultsSchema = z.object({\n size: z.string().default(\"24px\"),\n color: z.string().default(\"currentColor\"),\n});\n\nexport type IconDefaults = z.infer<typeof iconDefaultsSchema>;\n\n/**\n * Schema for the full icon registry configuration\n */\nexport const iconRegistrySchema = z.object({\n sources: z.array(iconSourceSchema),\n aliases: z.record(z.string()).default({}),\n colors: z.record(z.string()).optional(),\n defaults: iconDefaultsSchema.default({}),\n});\n\nexport type IconRegistry = z.infer<typeof iconRegistrySchema>;\n","import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport nunjucks from \"nunjucks\";\nimport { IconRegistryLoader } from \"./registry.js\";\nimport type { IconSource } from \"./schema.js\";\n\n/**\n * Options for rendering an icon\n */\nexport interface IconOptions {\n size?: string;\n color?: string;\n class?: string;\n}\n\n/**\n * Icon Resolver - renders icons from various sources\n */\nexport class IconResolver {\n private nunjucksEnv: nunjucks.Environment;\n\n constructor(private registry: IconRegistryLoader) {\n this.nunjucksEnv = new nunjucks.Environment(null, {\n autoescape: false,\n });\n }\n\n /**\n * Render an icon by name or alias\n */\n async render(nameOrAlias: string, options?: IconOptions): Promise<string> {\n // Resolve alias if needed\n const resolved = this.registry.resolveAlias(nameOrAlias);\n\n // Parse the icon reference\n const parsed = this.registry.parseIconReference(resolved);\n if (!parsed) {\n throw new Error(\n `Invalid icon reference format: \"${resolved}\". Expected format: \"prefix:name\"`\n );\n }\n\n // Get the source for this prefix\n const source = this.registry.getSource(parsed.prefix);\n if (!source) {\n throw new Error(`Unknown icon source prefix: \"${parsed.prefix}\"`);\n }\n\n // Get defaults and merge options\n const defaults = this.registry.getDefaults();\n const mergedOptions: Required<Omit<IconOptions, \"class\">> & Pick<IconOptions, \"class\"> = {\n size: options?.size ?? defaults.size,\n color: options?.color ?? defaults.color,\n ...(options?.class !== undefined ? { class: options.class } : {}),\n };\n\n // Render based on source type\n switch (source.type) {\n case \"web-font\":\n return this.renderWebFont(source, parsed.name, mergedOptions);\n case \"local-svg\":\n return await this.renderLocalSvg(source, parsed.name, mergedOptions);\n case \"svg-inline\":\n return await this.renderSvgInline(source, parsed.name, mergedOptions);\n case \"svg-sprite\":\n return this.renderSvgSprite(source, parsed.name, mergedOptions);\n default:\n throw new Error(`Unsupported icon source type: \"${source.type}\"`);\n }\n }\n\n /**\n * Render a web-font icon\n */\n private renderWebFont(\n source: IconSource,\n name: string,\n options: IconOptions\n ): string {\n const style = this.buildStyle(options);\n const className = this.buildClassName(name, options);\n\n if (source.render) {\n // Use custom render template\n return this.nunjucksEnv.renderString(source.render, {\n name,\n style,\n class: className,\n size: options.size,\n color: options.color,\n });\n }\n\n // Default web-font render\n return `<span class=\"${className}\" style=\"${style}\">${name}</span>`;\n }\n\n /**\n * Render a local SVG icon\n */\n private async renderLocalSvg(\n source: IconSource,\n name: string,\n options: IconOptions\n ): Promise<string> {\n if (!source.path) {\n throw new Error(`Local SVG source \"${source.name}\" has no path defined`);\n }\n\n const svgPath = path.join(source.path, `${name}.svg`);\n\n try {\n const svgContent = await fs.readFile(svgPath, \"utf-8\");\n return this.processSvg(svgContent, name, options);\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === \"ENOENT\") {\n throw new Error(`Icon file not found: ${svgPath}`);\n }\n throw error;\n }\n }\n\n /**\n * Render an SVG from external URL (placeholder without cache)\n */\n private async renderSvgInline(\n source: IconSource,\n name: string,\n options: IconOptions\n ): Promise<string> {\n // Without cache implementation, return a placeholder\n // Cache will be integrated in Step 4\n const className = this.buildClassName(name, options);\n const style = this.buildStyle(options);\n\n return `<span class=\"${className}\" style=\"${style}\" data-icon-source=\"${source.name}\" data-icon-name=\"${name}\">[${name}]</span>`;\n }\n\n /**\n * Render an SVG sprite reference\n */\n private renderSvgSprite(\n source: IconSource,\n name: string,\n options: IconOptions\n ): string {\n const className = this.buildClassName(name, options);\n const size = options.size ?? \"24px\";\n const color = options.color ?? \"currentColor\";\n\n const spriteUrl = source.url ?? \"\";\n\n return `<svg class=\"${className}\" width=\"${size}\" height=\"${size}\" fill=\"${color}\">\n <use xlink:href=\"${spriteUrl}#${name}\"/>\n</svg>`;\n }\n\n /**\n * Process SVG content and apply options\n */\n private processSvg(\n svgContent: string,\n name: string,\n options: IconOptions\n ): string {\n const className = this.buildClassName(name, options);\n const size = options.size ?? \"24px\";\n const color = options.color ?? \"currentColor\";\n\n // Parse and modify SVG attributes\n let processed = svgContent.trim();\n\n // Add/replace class attribute\n if (processed.includes(\"class=\")) {\n processed = processed.replace(/class=\"[^\"]*\"/, `class=\"${className}\"`);\n } else {\n processed = processed.replace(\"<svg\", `<svg class=\"${className}\"`);\n }\n\n // Add/replace width and height\n if (processed.includes(\"width=\")) {\n processed = processed.replace(/width=\"[^\"]*\"/, `width=\"${size}\"`);\n } else {\n processed = processed.replace(\"<svg\", `<svg width=\"${size}\"`);\n }\n\n if (processed.includes(\"height=\")) {\n processed = processed.replace(/height=\"[^\"]*\"/, `height=\"${size}\"`);\n } else {\n processed = processed.replace(\"<svg\", `<svg height=\"${size}\"`);\n }\n\n // Replace fill=\"currentColor\" with actual color\n if (color !== \"currentColor\") {\n processed = processed.replace(/fill=\"currentColor\"/g, `fill=\"${color}\"`);\n }\n\n return processed;\n }\n\n /**\n * Build CSS style string\n */\n private buildStyle(options: IconOptions): string {\n const styles: string[] = [];\n\n if (options.size) {\n styles.push(`font-size: ${options.size}`);\n }\n\n if (options.color) {\n styles.push(`color: ${options.color}`);\n }\n\n return styles.join(\"; \");\n }\n\n /**\n * Build class name string\n */\n private buildClassName(name: string, options: IconOptions): string {\n const classes = [\"icon\", `icon-${name}`];\n\n if (options.class) {\n classes.push(options.class);\n }\n\n return classes.join(\" \");\n }\n}\n","import { exec } from 'child_process';\n\nexport interface CSLAuthor {\n family: string;\n given?: string;\n}\n\nexport interface CSLItem {\n id: string;\n author?: CSLAuthor[];\n issued?: { 'date-parts': number[][] };\n title?: string;\n DOI?: string;\n PMID?: string;\n 'container-title'?: string;\n volume?: string;\n issue?: string;\n page?: string;\n URL?: string;\n type?: string;\n}\n\nexport class ReferenceManagerError extends Error {\n constructor(\n message: string,\n public cause?: unknown\n ) {\n super(message);\n this.name = 'ReferenceManagerError';\n }\n}\n\n/**\n * Client for reference-manager CLI\n */\nexport class ReferenceManager {\n constructor(private command: string = 'ref') {}\n\n /**\n * Check if reference-manager CLI is available\n */\n async isAvailable(): Promise<boolean> {\n try {\n await this.execCommand(`${this.command} --version`);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Get all references from the library\n */\n async getAll(): Promise<CSLItem[]> {\n const result = await this.execCommand(`${this.command} list --format json`);\n return this.parseJSON(result);\n }\n\n /**\n * Get a single reference by ID\n */\n async getById(id: string): Promise<CSLItem | null> {\n const result = await this.execCommand(\n `${this.command} list --id ${id} --format json`\n );\n const items = this.parseJSON(result);\n return items[0] || null;\n }\n\n /**\n * Get multiple references by IDs\n */\n async getByIds(ids: string[]): Promise<Map<string, CSLItem>> {\n if (ids.length === 0) {\n return new Map();\n }\n\n const result = await this.execCommand(`${this.command} list --format json`);\n const allItems = this.parseJSON(result);\n\n const idSet = new Set(ids);\n const map = new Map<string, CSLItem>();\n\n for (const item of allItems) {\n if (idSet.has(item.id)) {\n map.set(item.id, item);\n }\n }\n\n return map;\n }\n\n private execCommand(cmd: string): Promise<string> {\n return new Promise((resolve, reject) => {\n exec(cmd, (error, stdout) => {\n if (error) {\n reject(\n new ReferenceManagerError(`Failed to execute: ${cmd}`, error)\n );\n return;\n }\n resolve(stdout.toString());\n });\n });\n }\n\n private parseJSON(data: string): CSLItem[] {\n try {\n return JSON.parse(data) as CSLItem[];\n } catch (error) {\n throw new ReferenceManagerError(\n 'Failed to parse reference-manager output as JSON',\n error\n );\n }\n }\n}\n","import type { ParsedSlide, ParsedPresentation } from '../core/parser';\n\nexport interface ExtractedCitation {\n id: string;\n locator?: string | undefined;\n position: { start: number; end: number };\n}\n\n// Pattern to match citations like [@id], [@id, p.42], [@id1; @id2]\n// Matches: [@word-chars] or [@word-chars, locator]\nconst SINGLE_CITATION_PATTERN = /@([\\w-]+)(?:,\\s*([^;\\]]+))?/g;\nconst CITATION_BRACKET_PATTERN = /\\[(@[\\w-]+(?:,\\s*[^;\\]]+)?(?:;\\s*@[\\w-]+(?:,\\s*[^;\\]]+)?)*)\\]/g;\n\n// Pattern to extract @id from source field in structured citations\nconst SOURCE_CITATION_PATTERN = /^@([\\w-]+)$/;\n\nexport class CitationExtractor {\n /**\n * Extract citations from a text string\n */\n extract(text: string): ExtractedCitation[] {\n const citations: ExtractedCitation[] = [];\n\n // Find all bracketed citation groups\n let bracketMatch: RegExpExecArray | null;\n CITATION_BRACKET_PATTERN.lastIndex = 0;\n\n while ((bracketMatch = CITATION_BRACKET_PATTERN.exec(text)) !== null) {\n const bracketStart = bracketMatch.index;\n const bracketContent = bracketMatch[1];\n\n // Parse individual citations within the bracket\n SINGLE_CITATION_PATTERN.lastIndex = 0;\n let singleMatch: RegExpExecArray | null;\n\n while ((singleMatch = SINGLE_CITATION_PATTERN.exec(bracketContent!)) !== null) {\n const id = singleMatch[1]!;\n const locator = singleMatch[2]?.trim();\n\n citations.push({\n id,\n locator: locator ?? undefined,\n position: {\n start: bracketStart,\n end: bracketStart + bracketMatch[0].length,\n },\n });\n }\n }\n\n return citations;\n }\n\n /**\n * Extract citations from a slide's content\n */\n extractFromSlide(slide: ParsedSlide): ExtractedCitation[] {\n const allCitations: ExtractedCitation[] = [];\n const seenIds = new Set<string>();\n\n // Extract from content recursively\n const extractFromValue = (value: unknown): void => {\n if (typeof value === 'string') {\n // Check for structured source citation (e.g., source: \"@smith2024\")\n const sourceMatch = SOURCE_CITATION_PATTERN.exec(value);\n if (sourceMatch && sourceMatch[1]) {\n const id = sourceMatch[1];\n if (!seenIds.has(id)) {\n seenIds.add(id);\n allCitations.push({\n id,\n locator: undefined,\n position: { start: 0, end: value.length },\n });\n }\n return;\n }\n\n // Regular citation extraction\n const citations = this.extract(value);\n for (const citation of citations) {\n if (!seenIds.has(citation.id)) {\n seenIds.add(citation.id);\n allCitations.push(citation);\n }\n }\n } else if (Array.isArray(value)) {\n for (const item of value) {\n extractFromValue(item);\n }\n } else if (value && typeof value === 'object') {\n for (const v of Object.values(value)) {\n extractFromValue(v);\n }\n }\n };\n\n // Extract from content\n extractFromValue(slide.content);\n\n // Extract from notes if present\n if (slide.notes) {\n const notesCitations = this.extract(slide.notes);\n for (const citation of notesCitations) {\n if (!seenIds.has(citation.id)) {\n seenIds.add(citation.id);\n allCitations.push(citation);\n }\n }\n }\n\n return allCitations;\n }\n\n /**\n * Extract citations from all slides in a presentation\n */\n extractFromPresentation(presentation: ParsedPresentation): ExtractedCitation[] {\n const allCitations: ExtractedCitation[] = [];\n const seenIds = new Set<string>();\n\n for (const slide of presentation.slides) {\n const slideCitations = this.extractFromSlide(slide);\n for (const citation of slideCitations) {\n if (!seenIds.has(citation.id)) {\n seenIds.add(citation.id);\n allCitations.push(citation);\n }\n }\n }\n\n return allCitations;\n }\n\n /**\n * Get unique citation IDs in order of first appearance\n */\n getUniqueIds(citations: ExtractedCitation[]): string[] {\n const seen = new Set<string>();\n const uniqueIds: string[] = [];\n\n for (const citation of citations) {\n if (!seen.has(citation.id)) {\n seen.add(citation.id);\n uniqueIds.push(citation.id);\n }\n }\n\n return uniqueIds;\n }\n}\n","import type { ReferenceManager, CSLItem, CSLAuthor } from './manager';\n\nexport interface FormatterConfig {\n author?: {\n maxAuthors?: number;\n etAl?: string;\n etAlJa?: string;\n separatorJa?: string;\n };\n inline?: {\n authorSep?: string;\n identifierSep?: string;\n multiSep?: string;\n };\n}\n\nconst DEFAULT_CONFIG: Required<FormatterConfig> = {\n author: {\n maxAuthors: 2,\n etAl: 'et al.',\n etAlJa: 'ほか',\n separatorJa: '・',\n },\n inline: {\n authorSep: ', ',\n identifierSep: '; ',\n multiSep: '), (',\n },\n};\n\n// Pattern to detect Japanese characters\nconst JAPANESE_PATTERN = /[\\u3040-\\u309F\\u30A0-\\u30FF\\u4E00-\\u9FAF]/;\n\n// Citation patterns for expansion\nconst CITATION_BRACKET_PATTERN =\n /\\[(@[\\w-]+(?:,\\s*[^;\\]]+)?(?:;\\s*@[\\w-]+(?:,\\s*[^;\\]]+)?)*)\\]/g;\nconst SINGLE_CITATION_PATTERN = /@([\\w-]+)(?:,\\s*([^;\\]]+))?/g;\n\n/**\n * Formats citations for inline display and bibliography generation\n */\nexport class CitationFormatter {\n private config: Required<FormatterConfig>;\n\n constructor(\n private manager: ReferenceManager,\n config?: FormatterConfig\n ) {\n this.config = {\n author: { ...DEFAULT_CONFIG.author, ...config?.author },\n inline: { ...DEFAULT_CONFIG.inline, ...config?.inline },\n };\n }\n\n /**\n * Format an inline citation\n * e.g., \"(Smith et al., 2024; PMID: 12345678)\"\n */\n async formatInline(id: string): Promise<string> {\n const item = await this.manager.getById(id);\n if (!item) {\n return `[${id}]`;\n }\n\n return this.formatInlineItem(item);\n }\n\n /**\n * Format a full bibliography citation\n */\n async formatFull(id: string): Promise<string> {\n const item = await this.manager.getById(id);\n if (!item) {\n return `[${id}]`;\n }\n\n return this.formatFullItem(item);\n }\n\n /**\n * Expand all citations in text\n * e.g., \"[@smith2024]\" -> \"(Smith et al., 2024; PMID: 12345678)\"\n */\n async expandCitations(text: string): Promise<string> {\n // First, collect all citation IDs\n const ids = new Set<string>();\n CITATION_BRACKET_PATTERN.lastIndex = 0;\n\n let match: RegExpExecArray | null;\n while ((match = CITATION_BRACKET_PATTERN.exec(text)) !== null) {\n const content = match[1];\n SINGLE_CITATION_PATTERN.lastIndex = 0;\n\n let singleMatch: RegExpExecArray | null;\n while ((singleMatch = SINGLE_CITATION_PATTERN.exec(content!)) !== null) {\n ids.add(singleMatch[1]!);\n }\n }\n\n // Fetch all items at once\n const items = await this.manager.getByIds([...ids]);\n\n // Replace citations\n CITATION_BRACKET_PATTERN.lastIndex = 0;\n let result = text;\n\n // Reset and iterate again for replacement\n const matches: Array<{\n start: number;\n end: number;\n replacement: string;\n }> = [];\n\n CITATION_BRACKET_PATTERN.lastIndex = 0;\n while ((match = CITATION_BRACKET_PATTERN.exec(text)) !== null) {\n const content = match[1];\n const replacements: string[] = [];\n\n SINGLE_CITATION_PATTERN.lastIndex = 0;\n let singleMatch: RegExpExecArray | null;\n while ((singleMatch = SINGLE_CITATION_PATTERN.exec(content!)) !== null) {\n const id = singleMatch[1]!;\n const item = items.get(id);\n if (item) {\n replacements.push(this.formatInlineItem(item));\n } else {\n replacements.push(`[${id}]`);\n }\n }\n\n matches.push({\n start: match.index,\n end: match.index + match[0].length,\n replacement: replacements.join(', '),\n });\n }\n\n // Apply replacements from end to start to maintain positions\n for (const m of [...matches].reverse()) {\n result = result.slice(0, m.start) + m.replacement + result.slice(m.end);\n }\n\n return result;\n }\n\n /**\n * Generate bibliography entries\n */\n async generateBibliography(\n ids: string[],\n sort: 'author' | 'year' | 'citation-order' = 'citation-order'\n ): Promise<string[]> {\n if (ids.length === 0) {\n return [];\n }\n\n const items = await this.manager.getByIds(ids);\n let sortedItems: CSLItem[];\n\n if (sort === 'citation-order') {\n // Keep order of ids, filtering out non-existent\n sortedItems = ids\n .map((id) => items.get(id))\n .filter((item): item is CSLItem => item !== undefined);\n } else if (sort === 'author') {\n sortedItems = [...items.values()].sort((a, b) => {\n const authorA = this.getFirstAuthorFamily(a);\n const authorB = this.getFirstAuthorFamily(b);\n return authorA.localeCompare(authorB);\n });\n } else {\n // sort by year\n sortedItems = [...items.values()].sort((a, b) => {\n const yearA = this.getYear(a);\n const yearB = this.getYear(b);\n return yearA - yearB;\n });\n }\n\n return sortedItems.map((item) => this.formatFullItem(item));\n }\n\n private formatInlineItem(item: CSLItem): string {\n const author = this.formatAuthorInline(item.author);\n const year = this.getYear(item);\n const identifier = this.getIdentifier(item);\n\n if (identifier) {\n return `(${author}, ${year}; ${identifier})`;\n }\n return `(${author}, ${year})`;\n }\n\n private formatFullItem(item: CSLItem): string {\n const parts: string[] = [];\n\n // Authors\n const isJapanese = this.isJapaneseAuthors(item.author);\n const authors = this.formatAuthorsFull(item.author, isJapanese);\n parts.push(authors);\n\n // Year\n const year = this.getYear(item);\n parts.push(`(${year}).`);\n\n // Title\n if (item.title) {\n parts.push(`${item.title}.`);\n }\n\n // Container (journal)\n if (item['container-title']) {\n const journal = isJapanese\n ? item['container-title']\n : `*${item['container-title']}*`;\n\n // Volume, issue, pages\n let location = '';\n if (item.volume) {\n location = item.issue\n ? `${item.volume}(${item.issue})`\n : item.volume;\n }\n if (item.page) {\n location = location ? `${location}, ${item.page}` : item.page;\n }\n\n parts.push(location ? `${journal}, ${location}.` : `${journal}.`);\n }\n\n // Identifier\n const identifier = this.getIdentifier(item);\n if (identifier) {\n parts.push(identifier);\n }\n\n return parts.join(' ');\n }\n\n private formatAuthorInline(authors: CSLAuthor[] | undefined): string {\n if (!authors || authors.length === 0) {\n return 'Unknown';\n }\n\n const isJapanese = this.isJapaneseAuthors(authors);\n const { etAl, etAlJa, separatorJa } = this.config.author;\n const firstAuthor = authors[0]!;\n\n if (authors.length === 1) {\n return firstAuthor.family;\n }\n\n if (authors.length === 2) {\n const separator = isJapanese ? separatorJa : ' & ';\n return `${firstAuthor.family}${separator}${authors[1]!.family}`;\n }\n\n // 3+ authors\n const suffix = isJapanese ? etAlJa : ` ${etAl}`;\n return `${firstAuthor.family}${suffix}`;\n }\n\n private formatAuthorsFull(\n authors: CSLAuthor[] | undefined,\n isJapanese: boolean\n ): string {\n if (!authors || authors.length === 0) {\n return 'Unknown';\n }\n\n if (isJapanese) {\n // Japanese: 田中太郎, 山田花子\n return authors.map((a) => `${a.family}${a.given || ''}`).join(', ');\n }\n\n // English: Smith, J., Johnson, A., & Williams, B.\n if (authors.length === 1) {\n const a = authors[0]!;\n const initial = a.given ? `${a.given.charAt(0)}.` : '';\n return `${a.family}, ${initial}`;\n }\n\n const formatted = authors.map((a, i) => {\n const initial = a.given ? `${a.given.charAt(0)}.` : '';\n if (i === authors.length - 1) {\n return `& ${a.family}, ${initial}`;\n }\n return `${a.family}, ${initial}`;\n });\n\n // Join with \", \" for 3+ authors, or \", \" for 2 authors\n return formatted.join(', ').replace(', &', ', &');\n }\n\n private isJapaneseAuthors(authors: CSLAuthor[] | undefined): boolean {\n if (!authors || authors.length === 0) {\n return false;\n }\n // Check first author's family name for Japanese characters\n return JAPANESE_PATTERN.test(authors[0]!.family);\n }\n\n private getFirstAuthorFamily(item: CSLItem): string {\n return item.author?.[0]?.family || '';\n }\n\n private getYear(item: CSLItem): number {\n const dateParts = item.issued?.['date-parts'];\n if (dateParts && dateParts[0] && dateParts[0][0]) {\n return dateParts[0][0];\n }\n return 0;\n }\n\n private getIdentifier(item: CSLItem): string | null {\n if (item.PMID) {\n return `PMID: ${item.PMID}`;\n }\n if (item.DOI) {\n return `DOI: ${item.DOI}`;\n }\n return null;\n }\n}\n","/**\n * slide-generation - A CLI tool to generate Marp-compatible Markdown from YAML source files\n */\n\nexport const VERSION = \"0.1.0\";\n\n// Core modules\nexport * from './core';\n// export * from './core/transformer';\n// export * from './core/renderer';\n// export * from './core/pipeline';\n\n// Template system\nexport * from './templates';\n","import { Command } from 'commander';\nimport { access } from 'fs/promises';\nimport { basename, dirname, join } from 'path';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { Pipeline, PipelineError } from '../../core/pipeline';\nimport { ConfigLoader } from '../../config/loader';\n\n/**\n * Exit codes for CLI commands\n */\nexport const ExitCode = {\n Success: 0,\n GeneralError: 1,\n ArgumentError: 2,\n FileReadError: 3,\n ValidationError: 4,\n ConversionError: 5,\n ReferenceError: 6,\n} as const;\n\ninterface ConvertOptions {\n output?: string;\n config?: string;\n theme?: string;\n references?: boolean;\n verbose?: boolean;\n}\n\n/**\n * Generate default output path from input path\n */\nfunction getDefaultOutputPath(inputPath: string): string {\n const dir = dirname(inputPath);\n const base = basename(inputPath, '.yaml');\n return join(dir, `${base}.md`);\n}\n\n/**\n * Create the convert command\n */\nexport function createConvertCommand(): Command {\n return new Command('convert')\n .description('Convert YAML source to Marp Markdown')\n .argument('<input>', 'Input YAML file')\n .option('-o, --output <path>', 'Output file path')\n .option('-c, --config <path>', 'Config file path')\n .option('-t, --theme <name>', 'Theme name')\n .option('--no-references', 'Disable reference processing')\n .option('-v, --verbose', 'Verbose output')\n .action(async (input: string, options: ConvertOptions) => {\n await executeConvert(input, options);\n });\n}\n\n/**\n * Execute the convert command\n */\nasync function executeConvert(\n inputPath: string,\n options: ConvertOptions\n): Promise<void> {\n const spinner = options.verbose ? null : ora();\n const verbose = options.verbose ?? false;\n\n const updateSpinner = (text: string) => {\n if (spinner) {\n spinner.text = text;\n }\n };\n\n try {\n // Validate input file exists\n spinner?.start(`Reading ${inputPath}...`);\n try {\n await access(inputPath);\n } catch {\n spinner?.fail(`File not found: ${inputPath}`);\n console.error(chalk.red(`Error: Input file not found: ${inputPath}`));\n process.exitCode = ExitCode.FileReadError;\n return;\n }\n\n // Determine output path\n const outputPath = options.output ?? getDefaultOutputPath(inputPath);\n\n // Load configuration\n updateSpinner('Loading configuration...');\n const configLoader = new ConfigLoader();\n let configPath = options.config;\n\n if (!configPath) {\n configPath = await configLoader.findConfig(dirname(inputPath));\n }\n\n const config = await configLoader.load(configPath);\n\n // Override references if specified\n if (options.references === false) {\n config.references.enabled = false;\n }\n\n // Override theme if specified\n if (options.theme) {\n config.output.theme = options.theme;\n }\n\n // Create and initialize pipeline\n updateSpinner('Initializing pipeline...');\n const pipeline = new Pipeline(config);\n\n try {\n await pipeline.initialize();\n } catch (error) {\n spinner?.fail('Failed to initialize pipeline');\n if (error instanceof PipelineError) {\n console.error(chalk.red(`Error: ${error.message}`));\n } else {\n console.error(\n chalk.red(\n `Error: ${error instanceof Error ? error.message : 'Unknown error'}`\n )\n );\n }\n process.exitCode = ExitCode.ConversionError;\n return;\n }\n\n // Run pipeline\n updateSpinner(`Converting ${inputPath}...`);\n const result = await pipeline.runWithResult(inputPath, { outputPath });\n\n // Success!\n spinner?.succeed(`Converted ${inputPath}`);\n\n // Show stats in verbose mode or after completion\n if (verbose) {\n console.log('');\n console.log(chalk.green(' ✓') + ` Parsed ${result.slideCount} slides`);\n if (result.citations.length > 0) {\n console.log(\n chalk.green(' ✓') + ` Resolved ${result.citations.length} references`\n );\n }\n console.log(chalk.green(' ✓') + ' Generated output');\n }\n\n // Show warnings\n for (const warning of result.warnings) {\n console.log(chalk.yellow(' ⚠') + ` ${warning}`);\n }\n\n // Show output path\n console.log('');\n console.log(`Output: ${chalk.cyan(outputPath)}`);\n } catch (error) {\n spinner?.fail('Conversion failed');\n\n if (error instanceof PipelineError) {\n console.error(chalk.red(`\\nError (${error.stage}): ${error.message}`));\n\n // Set appropriate exit code based on stage\n switch (error.stage) {\n case 'parse':\n process.exitCode = ExitCode.FileReadError;\n break;\n case 'transform':\n process.exitCode = ExitCode.ValidationError;\n break;\n case 'render':\n process.exitCode = ExitCode.ConversionError;\n break;\n default:\n process.exitCode = ExitCode.GeneralError;\n }\n } else {\n console.error(\n chalk.red(\n `\\nError: ${error instanceof Error ? error.message : 'Unknown error'}`\n )\n );\n process.exitCode = ExitCode.GeneralError;\n }\n }\n}\n","import { access, readFile } from 'fs/promises';\nimport { join } from 'path';\nimport { parse as parseYaml } from 'yaml';\nimport { configSchema, type Config } from './schema';\n\nconst CONFIG_NAMES = ['config.yaml', 'slide-gen.yaml'];\n\nexport class ConfigLoader {\n async load(configPath?: string): Promise<Config> {\n const fileConfig = await this.loadFile(configPath);\n return configSchema.parse(fileConfig);\n }\n\n async findConfig(directory: string): Promise<string | undefined> {\n for (const name of CONFIG_NAMES) {\n const path = join(directory, name);\n try {\n await access(path);\n return path;\n } catch {\n // Continue to next\n }\n }\n return undefined;\n }\n\n private async loadFile(configPath?: string): Promise<unknown> {\n if (!configPath) return {};\n\n try {\n const content = await readFile(configPath, 'utf-8');\n return parseYaml(content) ?? {};\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n return {};\n }\n throw error;\n }\n }\n}\n","import { z } from 'zod';\n\nexport const configSchema = z.object({\n templates: z\n .object({\n builtin: z.string().default('./templates'),\n custom: z.string().optional(),\n })\n .default({}),\n\n icons: z\n .object({\n registry: z.string().default('./icons/registry.yaml'),\n cache: z\n .object({\n enabled: z.boolean().default(true),\n directory: z.string().default('.cache/icons'),\n ttl: z.number().default(86400),\n })\n .default({}),\n })\n .default({}),\n\n references: z\n .object({\n enabled: z.boolean().default(true),\n connection: z\n .object({\n type: z.literal('cli').default('cli'),\n command: z.string().default('ref'),\n })\n .default({}),\n format: z\n .object({\n locale: z.string().default('ja-JP'),\n authorSep: z.string().default(', '),\n identifierSep: z.string().default('; '),\n maxAuthors: z.number().default(2),\n etAl: z.string().default('et al.'),\n etAlJa: z.string().default('ほか'),\n })\n .default({}),\n })\n .default({}),\n\n output: z\n .object({\n theme: z.string().default('default'),\n inlineStyles: z.boolean().default(false),\n })\n .default({}),\n});\n\nexport type Config = z.infer<typeof configSchema>;\n","import { Command } from 'commander';\nimport { access, readFile } from 'fs/promises';\nimport { dirname } from 'path';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { parse as parseYaml } from 'yaml';\nimport { Parser, ParseError, ValidationError } from '../../core/parser';\nimport { TemplateLoader } from '../../templates/loader';\nimport { IconRegistryLoader } from '../../icons/registry';\nimport { ConfigLoader } from '../../config/loader';\nimport { ExitCode } from './convert';\n\n/**\n * Validation result structure\n */\ninterface ValidationResult {\n valid: boolean;\n errors: string[];\n warnings: string[];\n stats: {\n yamlSyntax: boolean;\n metaValid: boolean;\n slideCount: number;\n templatesFound: boolean;\n iconsResolved: boolean;\n referencesCount: number;\n };\n}\n\ninterface ValidateOptions {\n config?: string;\n strict?: boolean;\n format?: 'text' | 'json';\n}\n\n/**\n * Create the validate command\n */\nexport function createValidateCommand(): Command {\n return new Command('validate')\n .description('Validate source file without conversion')\n .argument('<input>', 'Input YAML file')\n .option('-c, --config <path>', 'Config file path')\n .option('--strict', 'Treat warnings as errors')\n .option('--format <fmt>', 'Output format (text/json)', 'text')\n .action(async (input: string, options: ValidateOptions) => {\n await executeValidate(input, options);\n });\n}\n\n/**\n * Execute the validate command\n */\nasync function executeValidate(\n inputPath: string,\n options: ValidateOptions\n): Promise<void> {\n const isJsonFormat = options.format === 'json';\n const spinner = isJsonFormat ? null : ora();\n\n const result: ValidationResult = {\n valid: true,\n errors: [],\n warnings: [],\n stats: {\n yamlSyntax: false,\n metaValid: false,\n slideCount: 0,\n templatesFound: false,\n iconsResolved: false,\n referencesCount: 0,\n },\n };\n\n try {\n // Check file exists\n spinner?.start(`Validating ${inputPath}...`);\n try {\n await access(inputPath);\n } catch {\n spinner?.fail(`File not found: ${inputPath}`);\n result.errors.push(`File not found: ${inputPath}`);\n result.valid = false;\n outputResult(result, options);\n process.exitCode = ExitCode.FileReadError;\n return;\n }\n\n // Read file content\n const content = await readFile(inputPath, 'utf-8');\n\n // Step 1: YAML syntax check\n try {\n parseYaml(content);\n result.stats.yamlSyntax = true;\n } catch (error) {\n const message = error instanceof Error ? error.message : 'Unknown error';\n result.errors.push(`YAML syntax error: ${message}`);\n result.valid = false;\n spinner?.fail('YAML syntax invalid');\n outputResult(result, options);\n process.exitCode = ExitCode.ValidationError;\n return;\n }\n\n // Step 2: Schema validation\n const parser = new Parser();\n let presentation;\n try {\n presentation = parser.parse(content);\n result.stats.metaValid = true;\n result.stats.slideCount = presentation.slides.length;\n } catch (error) {\n if (error instanceof ParseError) {\n result.errors.push(`Parse error: ${error.message}`);\n } else if (error instanceof ValidationError) {\n result.errors.push(`Schema validation error: ${error.message}`);\n } else {\n const message = error instanceof Error ? error.message : 'Unknown error';\n result.errors.push(`Schema error: ${message}`);\n }\n result.valid = false;\n spinner?.fail('Schema validation failed');\n outputResult(result, options);\n process.exitCode = ExitCode.ValidationError;\n return;\n }\n\n // Load configuration\n const configLoader = new ConfigLoader();\n let configPath = options.config;\n\n if (!configPath) {\n configPath = await configLoader.findConfig(dirname(inputPath));\n }\n\n const config = await configLoader.load(configPath);\n\n // Step 3: Template validation\n const templateLoader = new TemplateLoader();\n try {\n await templateLoader.loadBuiltIn(config.templates.builtin);\n if (config.templates.custom) {\n try {\n await templateLoader.loadCustom(config.templates.custom);\n } catch {\n // Custom templates directory may not exist\n }\n }\n } catch (error) {\n result.warnings.push(\n `Could not load templates: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n // Check all templates exist\n const missingTemplates: string[] = [];\n for (let i = 0; i < presentation.slides.length; i++) {\n const slide = presentation.slides[i]!;\n const template = templateLoader.get(slide.template);\n if (!template) {\n missingTemplates.push(`Slide ${i + 1}: Template \"${slide.template}\" not found`);\n } else {\n // Validate slide content against template schema\n const validationResult = templateLoader.validateContent(\n slide.template,\n slide.content\n );\n if (!validationResult.valid) {\n for (const err of validationResult.errors) {\n result.errors.push(`Slide ${i + 1} (${slide.template}): ${err}`);\n }\n }\n }\n }\n\n if (missingTemplates.length > 0) {\n for (const msg of missingTemplates) {\n result.errors.push(msg);\n }\n result.valid = false;\n } else {\n result.stats.templatesFound = true;\n }\n\n // Step 4: Icon validation (check for icon references in content)\n const iconRegistry = new IconRegistryLoader();\n try {\n await iconRegistry.load(config.icons.registry);\n result.stats.iconsResolved = true;\n } catch (error) {\n result.warnings.push(\n `Could not load icon registry: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n }\n\n // Check icon references in slide content (simple pattern matching)\n const iconPattern = /icon\\(['\"]([^'\"]+)['\"]\\)/g;\n for (let i = 0; i < presentation.slides.length; i++) {\n const slide = presentation.slides[i]!;\n const contentStr = JSON.stringify(slide.content);\n let match;\n while ((match = iconPattern.exec(contentStr)) !== null) {\n const iconRef = match[1]!;\n // Try to resolve the icon\n const resolved = iconRegistry.resolveAlias(iconRef);\n const parsed = iconRegistry.parseIconReference(resolved);\n if (parsed) {\n const source = iconRegistry.getSource(parsed.prefix);\n if (!source) {\n result.warnings.push(\n `Slide ${i + 1}: Unknown icon source \"${parsed.prefix}\" in \"${iconRef}\"`\n );\n }\n } else if (!iconRegistry.resolveAlias(iconRef)) {\n result.warnings.push(`Slide ${i + 1}: Unknown icon \"${iconRef}\"`);\n }\n }\n }\n\n // Step 5: Reference validation\n const citationPattern = /@([a-zA-Z0-9_-]+)/g;\n const references: Set<string> = new Set();\n for (const slide of presentation.slides) {\n const contentStr = JSON.stringify(slide.content);\n let match;\n while ((match = citationPattern.exec(contentStr)) !== null) {\n references.add(match[1]!);\n }\n }\n result.stats.referencesCount = references.size;\n\n // Final validation result\n if (result.errors.length > 0) {\n result.valid = false;\n }\n\n // Strict mode: warnings become errors\n if (options.strict && result.warnings.length > 0) {\n result.valid = false;\n result.errors.push(...result.warnings);\n result.warnings = [];\n }\n\n // Output result\n if (result.valid) {\n spinner?.succeed(`Validated ${inputPath}`);\n } else {\n spinner?.fail(`Validation failed for ${inputPath}`);\n }\n\n outputResult(result, options);\n\n if (!result.valid) {\n process.exitCode = ExitCode.ValidationError;\n }\n } catch (error) {\n spinner?.fail('Validation failed');\n result.errors.push(\n `Unexpected error: ${error instanceof Error ? error.message : 'Unknown error'}`\n );\n result.valid = false;\n outputResult(result, options);\n process.exitCode = ExitCode.GeneralError;\n }\n}\n\n/**\n * Output validation result in the specified format\n */\nfunction outputResult(result: ValidationResult, options: ValidateOptions): void {\n if (options.format === 'json') {\n console.log(\n JSON.stringify(\n {\n valid: result.valid,\n errors: result.errors,\n warnings: result.warnings,\n stats: result.stats,\n },\n null,\n 2\n )\n );\n return;\n }\n\n // Text format output\n console.log('');\n\n // Stats\n if (result.stats.yamlSyntax) {\n console.log(chalk.green('✓') + ' YAML syntax valid');\n } else {\n console.log(chalk.red('✗') + ' YAML syntax invalid');\n }\n\n if (result.stats.metaValid) {\n console.log(chalk.green('✓') + ' Meta section valid');\n }\n\n if (result.stats.slideCount > 0) {\n console.log(chalk.green('✓') + ` ${result.stats.slideCount} slides validated`);\n }\n\n if (result.stats.templatesFound) {\n console.log(chalk.green('✓') + ' All templates found');\n }\n\n if (result.stats.iconsResolved) {\n console.log(chalk.green('✓') + ' All icons resolved');\n }\n\n if (result.stats.referencesCount > 0) {\n console.log(chalk.green('✓') + ` ${result.stats.referencesCount} references found`);\n }\n\n // Errors\n for (const error of result.errors) {\n console.log(chalk.red('✗') + ` ${error}`);\n }\n\n // Warnings\n for (const warning of result.warnings) {\n console.log(chalk.yellow('⚠') + ` ${warning}`);\n }\n\n // Summary\n console.log('');\n if (result.valid) {\n console.log(chalk.green('Validation passed!'));\n } else {\n const errorCount = result.errors.length;\n const warningCount = result.warnings.length;\n let summary = `Validation failed with ${errorCount} error${errorCount !== 1 ? 's' : ''}`;\n if (warningCount > 0) {\n summary += ` and ${warningCount} warning${warningCount !== 1 ? 's' : ''}`;\n }\n console.log(chalk.red(summary));\n }\n}\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport * as yaml from 'yaml';\nimport { TemplateLoader, type TemplateDefinition } from '../../templates';\nimport { ConfigLoader } from '../../config/loader';\nimport { ExitCode } from './convert';\n\ntype OutputFormat = 'table' | 'json' | 'llm';\ntype InfoFormat = 'text' | 'json' | 'llm';\n\ninterface ListOptions {\n category?: string;\n format?: OutputFormat;\n config?: string;\n}\n\ninterface InfoOptions {\n format?: InfoFormat;\n config?: string;\n}\n\ninterface ExampleOptions {\n config?: string;\n}\n\n/**\n * Format template list for table output\n */\nfunction formatTableList(templates: TemplateDefinition[]): string {\n const byCategory = new Map<string, TemplateDefinition[]>();\n\n for (const template of templates) {\n const cat = template.category;\n if (!byCategory.has(cat)) {\n byCategory.set(cat, []);\n }\n byCategory.get(cat)!.push(template);\n }\n\n const lines: string[] = ['Templates:', ''];\n\n // Sort categories alphabetically\n const sortedCategories = Array.from(byCategory.keys()).sort();\n\n for (const category of sortedCategories) {\n lines.push(`${category}/`);\n const categoryTemplates = byCategory.get(category)!;\n\n // Sort templates by name within category\n categoryTemplates.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const template of categoryTemplates) {\n // Pad name to align descriptions\n const paddedName = template.name.padEnd(16);\n lines.push(` ${paddedName}${template.description}`);\n }\n lines.push('');\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Format template list for JSON output\n */\nfunction formatJsonList(templates: TemplateDefinition[]): string {\n const output = templates.map((t) => ({\n name: t.name,\n description: t.description,\n category: t.category,\n }));\n return JSON.stringify(output, null, 2);\n}\n\n/**\n * Format template list for LLM output\n */\nfunction formatLlmList(templates: TemplateDefinition[]): string {\n const byCategory = new Map<string, TemplateDefinition[]>();\n\n for (const template of templates) {\n const cat = template.category;\n if (!byCategory.has(cat)) {\n byCategory.set(cat, []);\n }\n byCategory.get(cat)!.push(template);\n }\n\n const lines: string[] = [];\n\n // Sort categories alphabetically\n const sortedCategories = Array.from(byCategory.keys()).sort();\n\n for (const category of sortedCategories) {\n lines.push(`[${category}]`);\n const categoryTemplates = byCategory.get(category)!;\n\n // Sort templates by name within category\n categoryTemplates.sort((a, b) => a.name.localeCompare(b.name));\n\n for (const template of categoryTemplates) {\n lines.push(`${template.name}: ${template.description}`);\n }\n lines.push('');\n }\n\n return lines.join('\\n').trim();\n}\n\n/**\n * Format template list in the specified format\n */\nexport function formatTemplateList(\n templates: TemplateDefinition[],\n format: OutputFormat\n): string {\n switch (format) {\n case 'json':\n return formatJsonList(templates);\n case 'llm':\n return formatLlmList(templates);\n case 'table':\n default:\n return formatTableList(templates);\n }\n}\n\n/**\n * Format schema property for text output\n */\nfunction formatSchemaProperty(\n name: string,\n prop: Record<string, unknown>,\n required: boolean,\n indent: string\n): string[] {\n const lines: string[] = [];\n const type = (prop['type'] as string) ?? 'unknown';\n const requiredStr = required ? ', required' : '';\n const description = prop['description'] as string | undefined;\n\n lines.push(`${indent}${name} (${type}${requiredStr})`);\n if (description) {\n lines.push(`${indent} ${description}`);\n }\n\n // Handle nested objects\n if (type === 'object' && prop['properties']) {\n const nestedRequired = (prop['required'] as string[]) ?? [];\n const properties = prop['properties'] as Record<string, Record<string, unknown>>;\n for (const [propName, propDef] of Object.entries(properties)) {\n lines.push(\n ...formatSchemaProperty(propName, propDef, nestedRequired.includes(propName), indent + ' ')\n );\n }\n }\n\n // Handle array items\n if (type === 'array' && prop['items']) {\n const items = prop['items'] as Record<string, unknown>;\n if (items['type'] === 'object' && items['properties']) {\n const itemRequired = (items['required'] as string[]) ?? [];\n const itemProps = items['properties'] as Record<string, Record<string, unknown>>;\n lines.push(`${indent} Items:`);\n for (const [propName, propDef] of Object.entries(itemProps)) {\n lines.push(\n ...formatSchemaProperty(propName, propDef, itemRequired.includes(propName), indent + ' ')\n );\n }\n }\n }\n\n return lines;\n}\n\n/**\n * Format template info for text output\n */\nfunction formatTextInfo(template: TemplateDefinition): string {\n const lines: string[] = [\n `Template: ${template.name}`,\n `Description: ${template.description}`,\n `Category: ${template.category}`,\n '',\n 'Schema:',\n ];\n\n const schema = template.schema as {\n type?: string;\n required?: string[];\n properties?: Record<string, Record<string, unknown>>;\n };\n\n if (schema.properties) {\n const required = schema.required ?? [];\n for (const [name, prop] of Object.entries(schema.properties)) {\n lines.push(...formatSchemaProperty(name, prop, required.includes(name), ' '));\n }\n }\n\n if (template.example) {\n lines.push('', 'Example:');\n const exampleYaml = yaml.stringify(template.example, { indent: 2 });\n lines.push(\n ...exampleYaml\n .split('\\n')\n .filter((l) => l.trim())\n .map((l) => ` ${l}`)\n );\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Format template info for JSON output\n */\nfunction formatJsonInfo(template: TemplateDefinition): string {\n return JSON.stringify(\n {\n name: template.name,\n description: template.description,\n category: template.category,\n schema: template.schema,\n example: template.example,\n },\n null,\n 2\n );\n}\n\n/**\n * Format template info for LLM output\n */\nfunction formatLlmInfo(template: TemplateDefinition): string {\n const lines: string[] = [\n `Template: ${template.name}`,\n `Description: ${template.description}`,\n `Category: ${template.category}`,\n '',\n 'Schema:',\n ];\n\n const schema = template.schema as {\n type?: string;\n required?: string[];\n properties?: Record<string, Record<string, unknown>>;\n };\n\n if (schema.properties) {\n const required = schema.required ?? [];\n for (const [name, prop] of Object.entries(schema.properties)) {\n const type = (prop['type'] as string) ?? 'unknown';\n const reqStr = required.includes(name) ? ', required' : '';\n lines.push(` ${name} (${type}${reqStr})`);\n\n const description = prop['description'] as string | undefined;\n if (description) {\n lines.push(` ${description}`);\n }\n }\n }\n\n if (template.example) {\n lines.push('', 'Example:');\n const exampleYaml = yaml.stringify(\n { template: template.name, content: template.example },\n { indent: 2 }\n );\n lines.push(\n ...exampleYaml\n .split('\\n')\n .filter((l) => l.trim())\n .map((l) => ` ${l}`)\n );\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Format template info in the specified format\n */\nexport function formatTemplateInfo(\n template: TemplateDefinition,\n format: InfoFormat\n): string {\n switch (format) {\n case 'json':\n return formatJsonInfo(template);\n case 'llm':\n return formatLlmInfo(template);\n case 'text':\n default:\n return formatTextInfo(template);\n }\n}\n\n/**\n * Format template example as slide YAML\n */\nexport function formatTemplateExample(template: TemplateDefinition): string {\n const slideYaml = yaml.stringify(\n [{ template: template.name, content: template.example ?? {} }],\n { indent: 2 }\n );\n return slideYaml;\n}\n\n/**\n * Load templates from config\n */\nasync function loadTemplates(configPath?: string): Promise<TemplateLoader> {\n const configLoader = new ConfigLoader();\n\n if (!configPath) {\n configPath = await configLoader.findConfig(process.cwd());\n }\n\n const config = await configLoader.load(configPath);\n const templateLoader = new TemplateLoader();\n\n try {\n await templateLoader.loadBuiltIn(config.templates.builtin);\n } catch {\n // Built-in templates may not exist in some environments\n }\n\n if (config.templates.custom) {\n try {\n await templateLoader.loadCustom(config.templates.custom);\n } catch {\n // Custom templates directory may not exist\n }\n }\n\n return templateLoader;\n}\n\n/**\n * Create the templates list subcommand\n */\nfunction createListCommand(): Command {\n return new Command('list')\n .description('List available templates')\n .option('--category <cat>', 'Filter by category')\n .option('--format <fmt>', 'Output format (table/json/llm)', 'table')\n .option('-c, --config <path>', 'Config file path')\n .action(async (options: ListOptions) => {\n try {\n const templateLoader = await loadTemplates(options.config);\n\n let templates = templateLoader.list();\n\n if (options.category) {\n templates = templateLoader.listByCategory(options.category);\n }\n\n if (templates.length === 0) {\n if (options.format === 'json') {\n console.log('[]');\n } else {\n console.log('No templates found.');\n }\n return;\n }\n\n const format = (options.format ?? 'table') as OutputFormat;\n const output = formatTemplateList(templates, format);\n console.log(output);\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the templates info subcommand\n */\nfunction createInfoCommand(): Command {\n return new Command('info')\n .description('Show template details')\n .argument('<name>', 'Template name')\n .option('--format <fmt>', 'Output format (text/json/llm)', 'text')\n .option('-c, --config <path>', 'Config file path')\n .action(async (name: string, options: InfoOptions) => {\n try {\n const templateLoader = await loadTemplates(options.config);\n const template = templateLoader.get(name);\n\n if (!template) {\n console.error(chalk.red(`Error: Template \"${name}\" not found`));\n process.exitCode = ExitCode.GeneralError;\n return;\n }\n\n const format = (options.format ?? 'text') as InfoFormat;\n const output = formatTemplateInfo(template, format);\n console.log(output);\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the templates example subcommand\n */\nfunction createExampleCommand(): Command {\n return new Command('example')\n .description('Output example YAML for a template')\n .argument('<name>', 'Template name')\n .option('-c, --config <path>', 'Config file path')\n .action(async (name: string, options: ExampleOptions) => {\n try {\n const templateLoader = await loadTemplates(options.config);\n const template = templateLoader.get(name);\n\n if (!template) {\n console.error(chalk.red(`Error: Template \"${name}\" not found`));\n process.exitCode = ExitCode.GeneralError;\n return;\n }\n\n const output = formatTemplateExample(template);\n console.log(output);\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the templates command with subcommands\n */\nexport function createTemplatesCommand(): Command {\n const cmd = new Command('templates')\n .description('Manage and list templates');\n\n cmd.addCommand(createListCommand());\n cmd.addCommand(createInfoCommand());\n cmd.addCommand(createExampleCommand());\n\n return cmd;\n}\n","import { Command } from 'commander';\nimport chalk from 'chalk';\nimport { IconRegistryLoader } from '../../icons/registry.js';\nimport { IconResolver } from '../../icons/resolver.js';\nimport { ConfigLoader } from '../../config/loader.js';\nimport type { IconSource } from '../../icons/schema.js';\nimport { ExitCode } from './convert.js';\n\ntype OutputFormat = 'table' | 'json';\n\ninterface ListOptions {\n source?: string;\n aliases?: boolean;\n config?: string;\n format?: OutputFormat;\n}\n\ninterface SearchOptions {\n config?: string;\n format?: OutputFormat;\n}\n\ninterface PreviewOptions {\n format?: 'svg' | 'html';\n size?: string;\n color?: string;\n config?: string;\n}\n\ninterface SearchResult {\n query: string;\n aliases: Array<{ alias: string; target: string }>;\n sources: Array<{ name: string; prefix: string; type: string }>;\n}\n\n/**\n * Format icon sources for table output\n */\nfunction formatTableSourceList(sources: IconSource[]): string {\n const lines: string[] = ['Icon Sources:', ''];\n\n // Calculate column widths\n const maxNameLen = Math.max(...sources.map((s) => s.name.length), 4);\n const maxPrefixLen = Math.max(...sources.map((s) => s.prefix.length), 6);\n const maxTypeLen = Math.max(...sources.map((s) => s.type.length), 4);\n\n // Header\n const namePad = 'Name'.padEnd(maxNameLen);\n const prefixPad = 'Prefix'.padEnd(maxPrefixLen);\n const typePad = 'Type'.padEnd(maxTypeLen);\n lines.push(` ${namePad} ${prefixPad} ${typePad}`);\n lines.push(` ${'─'.repeat(maxNameLen)} ${'─'.repeat(maxPrefixLen)} ${'─'.repeat(maxTypeLen)}`);\n\n // Data rows\n for (const source of sources) {\n const name = source.name.padEnd(maxNameLen);\n const prefix = source.prefix.padEnd(maxPrefixLen);\n const type = source.type.padEnd(maxTypeLen);\n lines.push(` ${name} ${prefix} ${type}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Format icon sources for JSON output\n */\nfunction formatJsonSourceList(sources: IconSource[]): string {\n const output = sources.map((s) => ({\n name: s.name,\n type: s.type,\n prefix: s.prefix,\n ...(s.url ? { url: s.url } : {}),\n ...(s.path ? { path: s.path } : {}),\n }));\n return JSON.stringify(output, null, 2);\n}\n\n/**\n * Format icon source list in the specified format\n */\nexport function formatIconSourceList(\n sources: IconSource[],\n format: OutputFormat\n): string {\n switch (format) {\n case 'json':\n return formatJsonSourceList(sources);\n case 'table':\n default:\n return formatTableSourceList(sources);\n }\n}\n\n/**\n * Format aliases for table output\n */\nfunction formatTableAliases(aliases: Record<string, string>): string {\n const entries = Object.entries(aliases);\n\n if (entries.length === 0) {\n return 'No aliases defined.';\n }\n\n const lines: string[] = ['Icon Aliases:', ''];\n\n // Calculate column widths\n const maxAliasLen = Math.max(...entries.map(([a]) => a.length), 5);\n const maxTargetLen = Math.max(...entries.map(([, t]) => t.length), 6);\n\n // Header\n const aliasPad = 'Alias'.padEnd(maxAliasLen);\n const targetPad = 'Target'.padEnd(maxTargetLen);\n lines.push(` ${aliasPad} ${targetPad}`);\n lines.push(` ${'─'.repeat(maxAliasLen)} ${'─'.repeat(maxTargetLen)}`);\n\n // Sort alphabetically\n entries.sort((a, b) => a[0].localeCompare(b[0]));\n\n for (const [alias, target] of entries) {\n const aliasStr = alias.padEnd(maxAliasLen);\n lines.push(` ${aliasStr} ${target}`);\n }\n\n return lines.join('\\n');\n}\n\n/**\n * Format aliases for JSON output\n */\nfunction formatJsonAliases(aliases: Record<string, string>): string {\n return JSON.stringify(aliases, null, 2);\n}\n\n/**\n * Format aliases list in the specified format\n */\nexport function formatAliasesList(\n aliases: Record<string, string>,\n format: OutputFormat\n): string {\n switch (format) {\n case 'json':\n return formatJsonAliases(aliases);\n case 'table':\n default:\n return formatTableAliases(aliases);\n }\n}\n\n/**\n * Format search results for table output\n */\nfunction formatTableSearchResults(results: SearchResult): string {\n const lines: string[] = [`Search results for \"${results.query}\"`, ''];\n\n const hasResults = results.aliases.length > 0 || results.sources.length > 0;\n\n if (!hasResults) {\n lines.push('No results found.');\n return lines.join('\\n');\n }\n\n // Aliases section\n if (results.aliases.length > 0) {\n lines.push('Aliases:');\n for (const { alias, target } of results.aliases) {\n lines.push(` ${alias} → ${target}`);\n }\n lines.push('');\n }\n\n // Sources section\n if (results.sources.length > 0) {\n lines.push('Sources:');\n for (const source of results.sources) {\n lines.push(` ${source.name} (${source.prefix}:) [${source.type}]`);\n }\n }\n\n return lines.join('\\n').trim();\n}\n\n/**\n * Format search results for JSON output\n */\nfunction formatJsonSearchResults(results: SearchResult): string {\n return JSON.stringify(results, null, 2);\n}\n\n/**\n * Format search results in the specified format\n */\nexport function formatSearchResults(\n results: SearchResult,\n format: OutputFormat\n): string {\n switch (format) {\n case 'json':\n return formatJsonSearchResults(results);\n case 'table':\n default:\n return formatTableSearchResults(results);\n }\n}\n\n/**\n * Load icon registry from config\n */\nasync function loadRegistry(configPath?: string): Promise<IconRegistryLoader> {\n const configLoader = new ConfigLoader();\n\n if (!configPath) {\n configPath = await configLoader.findConfig(process.cwd());\n }\n\n const config = await configLoader.load(configPath);\n const registry = new IconRegistryLoader();\n\n if (config.icons?.registry) {\n await registry.load(config.icons.registry);\n }\n\n return registry;\n}\n\n/**\n * Search for icons matching query\n */\nfunction searchIcons(\n registry: IconRegistryLoader,\n query: string\n): SearchResult {\n const lowerQuery = query.toLowerCase();\n\n // Search aliases\n const aliases = Object.entries(registry.getAliases())\n .filter(\n ([alias, target]) =>\n alias.toLowerCase().includes(lowerQuery) ||\n target.toLowerCase().includes(lowerQuery)\n )\n .map(([alias, target]) => ({ alias, target }));\n\n // Search sources\n const sources = registry\n .getSources()\n .filter(\n (source) =>\n source.name.toLowerCase().includes(lowerQuery) ||\n source.prefix.toLowerCase().includes(lowerQuery)\n )\n .map((s) => ({ name: s.name, prefix: s.prefix, type: s.type }));\n\n return { query, aliases, sources };\n}\n\n/**\n * Create the icons list subcommand\n */\nfunction createListCommand(): Command {\n return new Command('list')\n .description('List icon sources and aliases')\n .option('--source <name>', 'Filter by source name')\n .option('--aliases', 'Show only aliases')\n .option('--format <fmt>', 'Output format (table/json)', 'table')\n .option('-c, --config <path>', 'Config file path')\n .action(async (options: ListOptions) => {\n try {\n const registry = await loadRegistry(options.config);\n\n if (!registry.isLoaded()) {\n console.log('No icon registry found.');\n return;\n }\n\n const format = (options.format ?? 'table') as OutputFormat;\n\n if (options.aliases) {\n // Show only aliases\n const aliases = registry.getAliases();\n const output = formatAliasesList(aliases, format);\n console.log(output);\n return;\n }\n\n if (options.source) {\n // Filter by source\n const sources = registry.getSources().filter(\n (s) => s.name === options.source || s.prefix === options.source\n );\n\n if (sources.length === 0) {\n console.error(chalk.yellow(`No source found matching \"${options.source}\"`));\n return;\n }\n\n const output = formatIconSourceList(sources, format);\n console.log(output);\n return;\n }\n\n // Show all sources\n const sources = registry.getSources();\n const output = formatIconSourceList(sources, format);\n console.log(output);\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the icons search subcommand\n */\nfunction createSearchCommand(): Command {\n return new Command('search')\n .description('Search for icons by name or keyword')\n .argument('<query>', 'Search query')\n .option('--format <fmt>', 'Output format (table/json)', 'table')\n .option('-c, --config <path>', 'Config file path')\n .action(async (query: string, options: SearchOptions) => {\n try {\n const registry = await loadRegistry(options.config);\n\n if (!registry.isLoaded()) {\n console.log('No icon registry found.');\n return;\n }\n\n const format = (options.format ?? 'table') as OutputFormat;\n const results = searchIcons(registry, query);\n const output = formatSearchResults(results, format);\n console.log(output);\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the icons preview subcommand\n */\nfunction createPreviewCommand(): Command {\n return new Command('preview')\n .description('Preview an icon')\n .argument('<name>', 'Icon name or alias')\n .option('--format <fmt>', 'Output format (svg/html)', 'html')\n .option('--size <size>', 'Icon size', '24px')\n .option('--color <color>', 'Icon color', 'currentColor')\n .option('-c, --config <path>', 'Config file path')\n .action(async (name: string, options: PreviewOptions) => {\n try {\n const registry = await loadRegistry(options.config);\n\n if (!registry.isLoaded()) {\n console.error(chalk.red('Error: No icon registry found'));\n process.exitCode = ExitCode.GeneralError;\n return;\n }\n\n const resolver = new IconResolver(registry);\n\n const iconOptions: { size?: string; color?: string } = {};\n if (options.size) {\n iconOptions.size = options.size;\n }\n if (options.color) {\n iconOptions.color = options.color;\n }\n\n const rendered = await resolver.render(name, iconOptions);\n\n if (options.format === 'svg') {\n // Output raw SVG if it's an SVG\n console.log(rendered);\n } else {\n // Wrap in HTML for preview\n const html = `<!DOCTYPE html>\n<html>\n<head>\n <meta charset=\"utf-8\">\n <title>Icon Preview: ${name}</title>\n <link href=\"https://fonts.googleapis.com/icon?family=Material+Icons\" rel=\"stylesheet\">\n <style>\n body {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: 100vh;\n margin: 0;\n font-family: system-ui, sans-serif;\n background: #f5f5f5;\n }\n .preview {\n padding: 2rem;\n background: white;\n border-radius: 8px;\n box-shadow: 0 2px 8px rgba(0,0,0,0.1);\n text-align: center;\n }\n .icon-container {\n margin-bottom: 1rem;\n }\n .icon-name {\n color: #666;\n font-size: 14px;\n }\n .material-icons {\n font-family: 'Material Icons';\n font-weight: normal;\n font-style: normal;\n display: inline-block;\n line-height: 1;\n text-transform: none;\n letter-spacing: normal;\n word-wrap: normal;\n white-space: nowrap;\n direction: ltr;\n -webkit-font-smoothing: antialiased;\n }\n </style>\n</head>\n<body>\n <div class=\"preview\">\n <div class=\"icon-container\">\n ${rendered}\n </div>\n <div class=\"icon-name\">${name}</div>\n </div>\n</body>\n</html>`;\n console.log(html);\n }\n } catch (error) {\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n });\n}\n\n/**\n * Create the icons command with subcommands\n */\nexport function createIconsCommand(): Command {\n const cmd = new Command('icons')\n .description('Manage and search icons');\n\n cmd.addCommand(createListCommand());\n cmd.addCommand(createSearchCommand());\n cmd.addCommand(createPreviewCommand());\n\n return cmd;\n}\n","import { Command } from 'commander';\nimport { mkdir, writeFile, access, readdir } from 'fs/promises';\nimport { join, resolve } from 'path';\nimport chalk from 'chalk';\nimport ora from 'ora';\nimport { ExitCode } from './convert';\n\nexport interface InitOptions {\n template?: string;\n examples?: boolean;\n}\n\n/**\n * Create the init command\n */\nexport function createInitCommand(): Command {\n return new Command('init')\n .description('Initialize a new project')\n .argument('[directory]', 'Target directory', '.')\n .option('--template <name>', 'Initial template')\n .option('--no-examples', 'Do not create sample files')\n .action(async (directory: string, options: InitOptions) => {\n await executeInit(directory, options);\n });\n}\n\n/**\n * Execute the init command\n */\nexport async function executeInit(\n directory: string,\n options: InitOptions\n): Promise<void> {\n const spinner = ora();\n const targetDir = resolve(directory);\n const includeExamples = options.examples !== false;\n\n try {\n spinner.start(`Initializing project in ${targetDir}...`);\n\n // Check if directory exists and has content\n try {\n await access(targetDir);\n const entries = await readdir(targetDir);\n if (entries.length > 0) {\n spinner.info(`Directory ${targetDir} already exists, adding files...`);\n }\n } catch {\n // Directory doesn't exist, will be created\n }\n\n // Create directory structure\n await mkdir(targetDir, { recursive: true });\n await mkdir(join(targetDir, 'themes'), { recursive: true });\n await mkdir(join(targetDir, 'icons', 'custom'), { recursive: true });\n\n // Create config.yaml\n const configContent = generateConfigContent();\n await writeFileIfNotExists(join(targetDir, 'config.yaml'), configContent);\n\n // Create themes/custom.css\n const customCssContent = generateCustomCssContent();\n await writeFileIfNotExists(join(targetDir, 'themes', 'custom.css'), customCssContent);\n\n // Create sample files if examples are enabled\n if (includeExamples) {\n const presentationContent = generatePresentationContent(options.template);\n await writeFileIfNotExists(join(targetDir, 'presentation.yaml'), presentationContent);\n }\n\n spinner.succeed(`Project initialized in ${targetDir}`);\n\n // Print summary\n console.log('');\n console.log(chalk.green('Created files:'));\n console.log(` ${chalk.cyan('config.yaml')} - Project configuration`);\n console.log(` ${chalk.cyan('themes/custom.css')} - Custom theme styles`);\n console.log(` ${chalk.cyan('icons/custom/')} - Custom icons directory`);\n if (includeExamples) {\n console.log(` ${chalk.cyan('presentation.yaml')} - Sample presentation`);\n }\n console.log('');\n console.log(chalk.blue('Next steps:'));\n console.log(` 1. Edit ${chalk.yellow('presentation.yaml')} to add your slides`);\n console.log(` 2. Run ${chalk.yellow('slide-gen convert presentation.yaml')} to generate markdown`);\n } catch (error) {\n spinner.fail('Failed to initialize project');\n console.error(\n chalk.red(`Error: ${error instanceof Error ? error.message : 'Unknown error'}`)\n );\n process.exitCode = ExitCode.GeneralError;\n }\n}\n\n/**\n * Write file only if it doesn't exist\n */\nasync function writeFileIfNotExists(filePath: string, content: string): Promise<void> {\n try {\n await access(filePath);\n // File exists, skip\n } catch {\n // File doesn't exist, create it\n await writeFile(filePath, content, 'utf-8');\n }\n}\n\n/**\n * Generate config.yaml content\n */\nfunction generateConfigContent(): string {\n return `# slide-gen configuration\n# See https://github.com/example/slide-generation for documentation\n\ntemplates:\n # Path to built-in templates (relative to project root)\n builtin: ./templates\n # Path to custom templates (optional)\n # custom: ./my-templates\n\nicons:\n # Path to icon registry file\n registry: ./icons/registry.yaml\n cache:\n enabled: true\n directory: .cache/icons\n ttl: 86400\n\nreferences:\n enabled: true\n connection:\n type: cli\n command: ref\n format:\n locale: ja-JP\n\noutput:\n theme: default\n inlineStyles: false\n`;\n}\n\n/**\n * Generate custom CSS content\n */\nfunction generateCustomCssContent(): string {\n return `/* Custom Marp theme styles */\n/* See https://marpit.marp.app/theme-css for documentation */\n\n/*\nsection {\n background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);\n color: #fff;\n}\n\nh1 {\n color: #fff;\n text-shadow: 2px 2px 4px rgba(0,0,0,0.3);\n}\n*/\n`;\n}\n\n/**\n * Generate sample presentation content\n */\nfunction generatePresentationContent(_template?: string): string {\n const baseContent = `# Sample Presentation\n# Generated by slide-gen init\n\nmeta:\n title: My Presentation\n author: Your Name\n date: \"${new Date().toISOString().split('T')[0]}\"\n theme: default\n\nslides:\n - template: title\n content:\n title: My Presentation\n subtitle: A sample slide deck\n author: Your Name\n\n - template: content\n content:\n title: Introduction\n body: |\n Welcome to this presentation!\n\n - Point one\n - Point two\n - Point three\n\n - template: section\n content:\n title: Section Title\n subtitle: Section description\n\n - template: content\n content:\n title: Main Content\n body: |\n Here's the main content of your presentation.\n\n You can use **markdown** formatting in the body text.\n\n - template: end\n content:\n title: Thank You\n subtitle: Questions?\n`;\n\n return baseContent;\n}\n","import { Command } from 'commander';\nimport { access } from 'fs/promises';\nimport { basename, dirname, join } from 'path';\nimport chalk from 'chalk';\nimport { watch as chokidarWatch, FSWatcher } from 'chokidar';\nimport { Pipeline, PipelineError } from '../../core/pipeline';\nimport { ConfigLoader } from '../../config/loader';\nimport { ExitCode } from './convert';\n\nexport interface WatchOptions {\n output?: string;\n config?: string;\n debounce?: number;\n verbose?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface WatchResult {\n success: boolean;\n conversionCount: number;\n errors: string[];\n}\n\n/**\n * State management for watch mode\n */\nexport class WatchState {\n private _isRunning = false;\n private _conversionCount = 0;\n private _lastError: Error | null = null;\n\n get isRunning(): boolean {\n return this._isRunning;\n }\n\n get conversionCount(): number {\n return this._conversionCount;\n }\n\n get lastError(): Error | null {\n return this._lastError;\n }\n\n start(): void {\n this._isRunning = true;\n }\n\n stop(): void {\n this._isRunning = false;\n }\n\n incrementConversion(): void {\n this._conversionCount++;\n }\n\n setError(error: Error): void {\n this._lastError = error;\n }\n\n clearError(): void {\n this._lastError = null;\n }\n}\n\n/**\n * Generate default output path from input path\n */\nexport function getDefaultOutputPath(inputPath: string): string {\n const dir = dirname(inputPath);\n const base = basename(inputPath, '.yaml');\n return join(dir, `${base}.md`);\n}\n\n/**\n * Format timestamp for log output\n */\nfunction formatTime(): string {\n const now = new Date();\n return `[${now.toLocaleTimeString('en-GB')}]`;\n}\n\n/**\n * Create the watch command\n */\nexport function createWatchCommand(): Command {\n return new Command('watch')\n .description('Watch source file and auto-convert on changes')\n .argument('<input>', 'Input YAML file to watch')\n .option('-o, --output <path>', 'Output file path')\n .option('-c, --config <path>', 'Config file path')\n .option('--debounce <ms>', 'Debounce delay in milliseconds', '300')\n .option('-v, --verbose', 'Verbose output')\n .action(async (input: string, options: WatchOptions) => {\n await executeWatch(input, options);\n });\n}\n\n/**\n * Execute a single conversion\n */\nasync function runConversion(\n inputPath: string,\n outputPath: string,\n pipeline: Pipeline,\n verbose: boolean\n): Promise<{ success: boolean; error?: string }> {\n try {\n const result = await pipeline.runWithResult(inputPath, { outputPath });\n\n console.log(\n `${formatTime()} ${chalk.green('✓')} Output: ${chalk.cyan(outputPath)}`\n );\n\n if (verbose) {\n console.log(` Parsed ${result.slideCount} slides`);\n if (result.warnings.length > 0) {\n for (const warning of result.warnings) {\n console.log(chalk.yellow(` ⚠ ${warning}`));\n }\n }\n }\n\n return { success: true };\n } catch (error) {\n const message =\n error instanceof PipelineError\n ? `${error.stage}: ${error.message}`\n : error instanceof Error\n ? error.message\n : 'Unknown error';\n\n console.log(\n `${formatTime()} ${chalk.red('✗')} Conversion failed: ${message}`\n );\n\n return { success: false, error: message };\n }\n}\n\n/**\n * Execute the watch command\n */\nexport async function executeWatch(\n inputPath: string,\n options: WatchOptions\n): Promise<WatchResult> {\n const state = new WatchState();\n const errors: string[] = [];\n const debounceMs = Number(options.debounce) || 300;\n const verbose = options.verbose ?? false;\n\n // Check if immediately aborted (for testing)\n if (options.signal?.aborted) {\n // Validate input file exists\n try {\n await access(inputPath);\n } catch {\n errors.push(`File not found: ${inputPath}`);\n return { success: false, conversionCount: 0, errors };\n }\n return { success: true, conversionCount: 0, errors };\n }\n\n // Validate input file exists\n try {\n await access(inputPath);\n } catch {\n console.error(chalk.red(`Error: File not found: ${inputPath}`));\n errors.push(`File not found: ${inputPath}`);\n process.exitCode = ExitCode.FileReadError;\n return { success: false, conversionCount: 0, errors };\n }\n\n // Determine output path\n const outputPath = options.output ?? getDefaultOutputPath(inputPath);\n\n // Load configuration\n const configLoader = new ConfigLoader();\n let configPath = options.config;\n\n if (!configPath) {\n configPath = await configLoader.findConfig(dirname(inputPath));\n }\n\n const config = await configLoader.load(configPath);\n\n // Create and initialize pipeline\n const pipeline = new Pipeline(config);\n\n try {\n await pipeline.initialize();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : 'Unknown initialization error';\n console.error(chalk.red(`Error: Failed to initialize pipeline: ${message}`));\n errors.push(message);\n process.exitCode = ExitCode.ConversionError;\n return { success: false, conversionCount: 0, errors };\n }\n\n console.log(`Watching ${chalk.cyan(inputPath)}...`);\n console.log(`Output: ${chalk.cyan(outputPath)}`);\n console.log('');\n\n // Initial conversion\n console.log(`${formatTime()} Initial conversion...`);\n const initialResult = await runConversion(inputPath, outputPath, pipeline, verbose);\n if (initialResult.success) {\n state.incrementConversion();\n } else if (initialResult.error) {\n errors.push(initialResult.error);\n }\n\n // Set up file watcher\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n let watcher: FSWatcher | null = null;\n\n const handleChange = () => {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n debounceTimer = setTimeout(async () => {\n console.log(`${formatTime()} Changed: ${inputPath}`);\n console.log(`${formatTime()} Converting...`);\n\n const result = await runConversion(inputPath, outputPath, pipeline, verbose);\n if (result.success) {\n state.incrementConversion();\n state.clearError();\n } else if (result.error) {\n errors.push(result.error);\n state.setError(new Error(result.error));\n }\n }, debounceMs);\n };\n\n state.start();\n\n watcher = chokidarWatch(inputPath, {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: {\n stabilityThreshold: 100,\n pollInterval: 50,\n },\n });\n\n watcher.on('change', handleChange);\n\n // Handle abort signal\n const cleanup = () => {\n state.stop();\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n watcher?.close();\n };\n\n if (options.signal) {\n options.signal.addEventListener('abort', cleanup);\n }\n\n // Handle process signals\n const signalHandler = () => {\n console.log('\\n' + chalk.yellow('Watch stopped.'));\n cleanup();\n process.exit(0);\n };\n\n process.on('SIGINT', signalHandler);\n process.on('SIGTERM', signalHandler);\n\n // Keep the process running\n await new Promise<void>((resolve) => {\n if (options.signal) {\n options.signal.addEventListener('abort', () => resolve());\n }\n });\n\n return {\n success: errors.length === 0,\n conversionCount: state.conversionCount,\n errors,\n };\n}\n","import { Command } from 'commander';\nimport { access, unlink } from 'fs/promises';\nimport { basename, dirname, join } from 'path';\nimport { tmpdir } from 'os';\nimport { spawn, execSync } from 'child_process';\nimport chalk from 'chalk';\nimport { watch as chokidarWatch, FSWatcher } from 'chokidar';\nimport { Pipeline, PipelineError } from '../../core/pipeline';\nimport { ConfigLoader } from '../../config/loader';\nimport { ExitCode } from './convert';\n\nexport interface PreviewOptions {\n port?: number;\n watch?: boolean;\n config?: string;\n verbose?: boolean;\n signal?: AbortSignal;\n}\n\nexport interface PreviewResult {\n success: boolean;\n errors: string[];\n}\n\n/**\n * Check if marp-cli is available in the system\n */\nexport async function checkMarpCliAvailable(): Promise<boolean> {\n try {\n execSync('npx marp --version', { stdio: 'ignore' });\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Generate temporary output path for markdown file\n */\nexport function getTempOutputPath(inputPath: string): string {\n const base = basename(inputPath, '.yaml');\n return join(tmpdir(), `slide-gen-preview-${base}-${Date.now()}.md`);\n}\n\n/**\n * Build marp-cli command for preview\n */\nexport function buildMarpCommand(\n markdownPath: string,\n options: PreviewOptions\n): string {\n const parts = ['npx', 'marp', '--preview'];\n\n if (options.port) {\n parts.push('-p', String(options.port));\n }\n\n if (options.watch) {\n parts.push('--watch');\n }\n\n parts.push(markdownPath);\n\n return parts.join(' ');\n}\n\n/**\n * Create the preview command\n */\nexport function createPreviewCommand(): Command {\n return new Command('preview')\n .description('Preview the generated slides in browser (requires Marp CLI)')\n .argument('<input>', 'Input YAML file')\n .option('-p, --port <number>', 'Preview server port', '8080')\n .option('-w, --watch', 'Watch for changes and auto-reload')\n .option('-c, --config <path>', 'Config file path')\n .option('-v, --verbose', 'Verbose output')\n .action(async (input: string, options: PreviewOptions) => {\n await executePreview(input, options);\n });\n}\n\n/**\n * Execute the preview command\n */\nexport async function executePreview(\n inputPath: string,\n options: PreviewOptions\n): Promise<PreviewResult> {\n const errors: string[] = [];\n const verbose = options.verbose ?? false;\n const port = Number(options.port) || 8080;\n\n // Check if immediately aborted (for testing)\n if (options.signal?.aborted) {\n try {\n await access(inputPath);\n } catch {\n errors.push(`File not found: ${inputPath}`);\n return { success: false, errors };\n }\n return { success: true, errors };\n }\n\n // Validate input file exists\n try {\n await access(inputPath);\n } catch {\n console.error(chalk.red(`Error: File not found: ${inputPath}`));\n errors.push(`File not found: ${inputPath}`);\n process.exitCode = ExitCode.FileReadError;\n return { success: false, errors };\n }\n\n // Check marp-cli availability\n console.log('Checking for Marp CLI...');\n const marpAvailable = await checkMarpCliAvailable();\n if (!marpAvailable) {\n console.error(\n chalk.red(\n 'Error: Marp CLI not found. Install it with: npm install -g @marp-team/marp-cli'\n )\n );\n errors.push('Marp CLI not available');\n process.exitCode = ExitCode.GeneralError;\n return { success: false, errors };\n }\n console.log(chalk.green('✓') + ' Marp CLI found');\n\n // Load configuration\n const configLoader = new ConfigLoader();\n let configPath = options.config;\n\n if (!configPath) {\n configPath = await configLoader.findConfig(dirname(inputPath));\n }\n\n const config = await configLoader.load(configPath);\n\n // Create and initialize pipeline\n console.log('Initializing pipeline...');\n const pipeline = new Pipeline(config);\n\n try {\n await pipeline.initialize();\n } catch (error) {\n const message =\n error instanceof Error ? error.message : 'Unknown initialization error';\n console.error(chalk.red(`Error: Failed to initialize pipeline: ${message}`));\n errors.push(message);\n process.exitCode = ExitCode.ConversionError;\n return { success: false, errors };\n }\n\n // Generate initial markdown\n const tempMarkdownPath = getTempOutputPath(inputPath);\n console.log(`Converting ${chalk.cyan(inputPath)}...`);\n\n try {\n await pipeline.runWithResult(inputPath, { outputPath: tempMarkdownPath });\n console.log(chalk.green('✓') + ' Initial conversion complete');\n } catch (error) {\n const message =\n error instanceof PipelineError\n ? `${error.stage}: ${error.message}`\n : error instanceof Error\n ? error.message\n : 'Unknown error';\n console.error(chalk.red(`Error: Conversion failed: ${message}`));\n errors.push(message);\n process.exitCode = ExitCode.ConversionError;\n return { success: false, errors };\n }\n\n // Start marp preview server\n console.log(`\\nStarting preview server on port ${chalk.cyan(port)}...`);\n\n const marpCommand = buildMarpCommand(tempMarkdownPath, {\n ...options,\n port,\n watch: false, // We handle watch ourselves if needed\n });\n\n if (verbose) {\n console.log(`Running: ${marpCommand}`);\n }\n\n const marpProcess = spawn('npx', ['marp', '--preview', '-p', String(port), tempMarkdownPath], {\n stdio: 'inherit',\n shell: true,\n });\n\n let watcher: FSWatcher | null = null;\n let debounceTimer: ReturnType<typeof setTimeout> | null = null;\n\n // Set up file watcher if watch mode enabled\n if (options.watch) {\n console.log(`\\nWatching ${chalk.cyan(inputPath)} for changes...`);\n\n watcher = chokidarWatch(inputPath, {\n persistent: true,\n ignoreInitial: true,\n awaitWriteFinish: {\n stabilityThreshold: 100,\n pollInterval: 50,\n },\n });\n\n watcher.on('change', () => {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n\n debounceTimer = setTimeout(async () => {\n console.log(`\\n[${new Date().toLocaleTimeString('en-GB')}] File changed, reconverting...`);\n\n try {\n await pipeline.runWithResult(inputPath, { outputPath: tempMarkdownPath });\n console.log(chalk.green('✓') + ' Reconversion complete');\n } catch (error) {\n const message =\n error instanceof PipelineError\n ? `${error.stage}: ${error.message}`\n : error instanceof Error\n ? error.message\n : 'Unknown error';\n console.error(chalk.red(`✗ Reconversion failed: ${message}`));\n }\n }, 300);\n });\n }\n\n // Cleanup function\n const cleanup = async () => {\n if (debounceTimer) {\n clearTimeout(debounceTimer);\n }\n watcher?.close();\n marpProcess.kill();\n\n // Clean up temp file\n try {\n await unlink(tempMarkdownPath);\n } catch {\n // Ignore cleanup errors\n }\n };\n\n // Handle abort signal\n if (options.signal) {\n options.signal.addEventListener('abort', () => {\n cleanup();\n });\n }\n\n // Handle process signals\n const signalHandler = async () => {\n console.log('\\n' + chalk.yellow('Preview stopped.'));\n await cleanup();\n process.exit(0);\n };\n\n process.on('SIGINT', signalHandler);\n process.on('SIGTERM', signalHandler);\n\n // Wait for marp process or abort signal\n await new Promise<void>((resolve) => {\n marpProcess.on('exit', () => {\n cleanup();\n resolve();\n });\n\n if (options.signal) {\n options.signal.addEventListener('abort', () => resolve());\n }\n });\n\n return {\n success: errors.length === 0,\n errors,\n };\n}\n"],"mappings":";;;AAEA,SAAS,WAAAA,gBAAe;;;ACFxB,SAAS,SAAS;AAClB,SAAS,SAAS,iBAAiB;AACnC,SAAS,gBAAgB;AAGzB,IAAM,yBAAyB,EAAE,OAAO;AAAA,EACtC,SAAS,EAAE,QAAQ,EAAE,QAAQ,IAAI;AAAA,EACjC,OAAO,EAAE,OAAO,EAAE,QAAQ,kBAAkB;AAC9C,CAAC;AAGD,IAAM,aAAa,EAAE,OAAO;AAAA,EAC1B,OAAO,EAAE,OAAO;AAAA,EAChB,QAAQ,EAAE,OAAO,EAAE,SAAS;AAAA,EAC5B,MAAM,EAAE,OAAO,EAAE,SAAS;AAAA,EAC1B,OAAO,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CAACG,aAAY;AACnC,gBAAY,GAAG,QAAQ,MAAM;AAC3B,cAAQ;AACR,MAAAA,SAAQ;AAAA,IACV,CAAC;AAED,QAAI,QAAQ,QAAQ;AAClB,cAAQ,OAAO,iBAAiB,SAAS,MAAMA,SAAQ,CAAC;AAAA,IAC1D;AAAA,EACF,CAAC;AAED,SAAO;AAAA,IACL,SAAS,OAAO,WAAW;AAAA,IAC3B;AAAA,EACF;AACF;;;AvB7QA,IAAM,UAAU,IAAIC,SAAQ;AAE5B,QACG,KAAK,WAAW,EAChB,YAAY,0DAA0D,EACtE,QAAQ,OAAO;AAGlB,QAAQ,WAAW,qBAAqB,CAAC;AAGzC,QAAQ,WAAW,sBAAsB,CAAC;AAG1C,QAAQ,WAAW,uBAAuB,CAAC;AAG3C,QAAQ,WAAW,mBAAmB,CAAC;AAGvC,QAAQ,WAAW,kBAAkB,CAAC;AAGtC,QAAQ,WAAW,mBAAmB,CAAC;AAGvC,QAAQ,WAAWC,sBAAqB,CAAC;AAEzC,QAAQ,MAAM;","names":["Command","z","z","path","z","fs","parseYaml","z","parseYaml","fs","path","nunjucks","resolve","CITATION_BRACKET_PATTERN","SINGLE_CITATION_PATTERN","access","join","readFile","join","parseYaml","z","path","join","readFile","parseYaml","join","access","Command","access","readFile","dirname","chalk","ora","parseYaml","Command","ora","access","readFile","parseYaml","dirname","chalk","Command","chalk","yaml","Command","chalk","Command","chalk","createListCommand","Command","output","sources","chalk","Command","writeFile","access","readdir","join","chalk","ora","Command","ora","access","readdir","join","chalk","writeFile","Command","access","basename","dirname","join","chalk","getDefaultOutputPath","dirname","basename","join","Command","chalk","access","resolve","Command","access","basename","dirname","join","chalk","chokidarWatch","basename","join","createPreviewCommand","Command","access","chalk","dirname","chokidarWatch","resolve","Command","createPreviewCommand"]}
|