Codexis Builder Modules Audit
This document lists all builder modules in the codebase as of the audit start. Update this list as new modules are discovered or added.
Standard Compliance Checklist for Builder Modules
To bring any builder module into compliance with Codexis core utility and path handling standards, perform the following steps:
- Replace All Direct File Operations
- Replace
File.mkdir_p!withFileManager.ensure_dir - Replace
File.exists?withFileManager.exists?(or equivalent) - Replace
File.statwithFileManager.stat(or equivalent) - Replace
File.read!/File.readwithFileManager.read_file - Replace
File.write!/File.writewithFileManager.write_file - Replace
File.lswithFileManager.list_dir(or equivalent) - Replace
File.cp,File.cp!,File.cp_rwithFileManager.copyorFileManager.copy_directory
- Replace
- Replace All Direct Path Operations
- Replace all uses of
Path,Path.join,Path.basename,Path.dirname,Path.wildcard, etc. withPathBuilderequivalents
- Replace all uses of
- Add TODOs for Missing Core Utility Equivalents
- For any file or path operation without a direct core utility equivalent, add a
TODOcomment and document in the audit
- For any file or path operation without a direct core utility equivalent, add a
- Update Error Handling and Logging
- Ensure all file/path operation errors are handled and logged via the Builder interface
- Use tagged tuples and user-friendly, color-coded messages as per error handling standards
- Refactor Tests to Use Patch
- Update all tests to use Patch for mocking file and path operations
- Update Audit and Documentation
- Update this audit document and any relevant developer documentation to reflect the current state after each refactor step
- Document any remaining TODOs or gaps in core utilities
- Verify and Run Tests
- Run the test suite to ensure all changes are covered and passing
Repeat this checklist for every builder module to ensure full compliance with Codexis standards.
Builder Modules
Codexis.Builders.MarkdownBuilderCodexis.Builders.HTMLBuilderCodexis.Builders.EPUBBuilderCodexis.Builders.PDFBuilderCodexis.Builders.WikiJSBuilderCodexis.Builders.RTFBuilderCodexis.Builders.DOCXBuilderCodexis.Builders.HtmlToMarkdownBuilderCodexis.Builders.LaTeXToHTMLConverter
Notes
- Update this list as new builder modules are added (e.g., LaTeXBuilder, AsciiDocBuilder, etc.).
- For each module, document all direct File and Path operations as part of the audit.
Audit: Codexis.Builders.MarkdownBuilder
Direct File operations:
- File.mkdir_p!(markdown_output_dir)
- File.mkdir_p!(html_dir)
- File.exists?(abs_output_path)
- File.stat(abs_output_path)
- File.read!(md_file)
- File.write!(md_file, updated_content)
- File.ls(input_dir)
- File.cp(temp_markdown_file, final_output_path)
- File.cp!(image_file, dest_file)
- File.write!(output_file_path, transformed_content)
- File.read(file_path)
- File.write(file_path, processed_content)
- File.exists?(assets_dir)
- File.ls(temp_images_dir)
- File.mkdir_p!(final_images_dir)
- File.cp_r(temp_images_dir, final_images_dir)
Direct Path operations:
- Path.join(output_dir, filename)
- Path.join(input_dir, file)
- Path.basename(file, ".md")
- Path.dirname(output_file_path)
- Path.basename(file_path, ".md")
- Path.join(dir, "**/*.md")
- Path.join(base_dir, "manuscript.toc")
PathBuilder usage:
- PathBuilder.join(...)
- PathBuilder.expand(...)
- PathBuilder.filename(...)
- PathBuilder.dirname(...)
- PathBuilder.sanitize_path(...)
- PathBuilder.ensure_dir(...)
- PathBuilder.safe_path?(...)
- PathBuilder.relative(...)
FileManager usage:
- (None found in this module)
Notes:
- Some legacy direct File and Path operations remain and should be refactored to use FileManager and PathBuilder exclusively.
- No FileManager usage found; all file operations should be migrated to FileManager equivalents.
- PathBuilder is used for some path operations, but not all.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.HTMLBuilder
Direct File operations:
- File.mkdir_p!(output_dir)
- File.read!(html_file)
- File.write!(html_file, updated)
- File.cp!(svg_path, dest_path)
- File.rm!(svg_path)
Direct Path operations:
- PathBuilder.join(...) (used for path construction)
PathBuilder usage:
- PathBuilder.join(...)
- PathBuilder.filename(...)
- PathBuilder.wildcard(...)
- PathBuilder.dirname(...)
FileManager usage:
- Codexis.Core.FileManager.ensure_dir(...)
Notes:
- Some direct File operations remain and should be refactored to use FileManager equivalents.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.EPUBBuilder
Direct File operations:
- File.exists?(epub_path)
- File.stat(epub_path)
- File.dir?(output_path)
- File.ls!(temp_dir)
- File.stat!(path)
- File.dir?(path)
- File.rm_rf!(path)
- File.rm!(path)
- File.exists?(cfg_path_in_build_dir)
- File.read!(cfg_path_in_build_dir)
- File.write!(PathBuilder.join(build_dir, "epub_build_debug.txt"), debug_info)
Direct Path operations:
- Path.join(temp_dir, filename)
- Path.join(base_dir, "manuscript.toc")
PathBuilder usage:
- PathBuilder.dirname(...)
- PathBuilder.join(...)
- PathBuilder.filename(...)
- PathBuilder.extname(...)
- PathBuilder.wildcard(...)
FileManager usage:
- Codexis.Core.FileManager.ensure_dir(...)
- Codexis.Core.FileManager.copy(...)
- Codexis.Core.FileManager.delete(...)
- Codexis.Core.FileManager.write_file(...)
Notes:
- Some direct File and Path operations remain and should be refactored to use FileManager and PathBuilder exclusively.
- FileManager is used for most file operations, but some legacy direct File usage remains.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.PDFBuilder
Direct File operations:
- File.exists?(pdf_output_file)
- File.stat(pdf_output_file)
Direct Path operations:
- (None found; all path operations appear to use PathBuilder)
PathBuilder usage:
- PathBuilder.dirname(...)
- PathBuilder.join(...)
- PathBuilder.filename(...)
- PathBuilder.rootname(...)
- PathBuilder.wildcard(...)
FileManager usage:
- Codexis.Core.FileManager.ensure_dir(...)
- Codexis.Core.FileManager.copy(...)
Notes:
- Most file and path operations use FileManager and PathBuilder, but some direct File usage remains for existence and stat checks.
- No legacy Path usage found; all path operations use PathBuilder.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.WikiJSBuilder
Direct File operations:
- File.mkdir_p!(wikijs_output_dir)
- File.mkdir_p!(markdown_output_dir)
- File.cwd!()
- File.exists?(Path.join(original_source_dir, "meta.yaml"))
- File.regular?(expanded_input_markdown_path)
- File.read(markdown_file)
- File.write(output_file, content)
- File.cp!(image_file, dest_path)
- File.cp!(scan_file, dest_file)
- File.exists?(ack_path)
- File.read!(ack_path)
- File.stat(abs_output_path)
Direct Path operations:
- Path.join(File.cwd!(), original_source_dir)
- Path.join(original_source_dir, "meta.yaml")
- Path.basename(pdf_file)
PathBuilder usage:
- PathBuilder.format_title_as_filename(book_title)
- PathBuilder.join(...)
- PathBuilder.dirname(...)
- PathBuilder.expand(...)
- PathBuilder.filename(...)
- PathBuilder.wildcard(...)
- PathBuilder.ensure_dir(...)
- PathBuilder.sanitize_path(...)
- PathBuilder.safe_path?(...)
- PathBuilder.contains?(...)
- PathBuilder.split(...)
FileManager usage:
- (None found in this module)
Notes:
- Some direct File and Path operations remain and should be refactored to use FileManager and PathBuilder exclusively.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- No FileManager usage found; consider migrating file operations to FileManager equivalents.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.RTFBuilder
Direct File operations:
- File.mkdir_p!(rtf_output_dir)
- File.cwd!()
- File.exists?(output_path)
- File.stat(output_path)
- File.read(output_path)
- File.read(tex_file_path)
- File.dir?(source_images_dir)
- File.ls(source_images_dir)
- File.cp(source, target)
Direct Path operations:
- Path.basename(main_tex_filename, ".tex")
- Path.dirname(output_path)
PathBuilder usage:
- PathBuilder.join(...)
- PathBuilder.dirname(...)
- PathBuilder.filename(...)
- PathBuilder.ensure_dir(...)
FileManager usage:
- (None found in this module)
Notes:
- Some direct File and Path operations remain and should be refactored to use FileManager and PathBuilder exclusively.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- No FileManager usage found; consider migrating file operations to FileManager equivalents.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.DOCXBuilder
Direct File operations:
- File.mkdir_p!(docx_output_dir)
- File.cwd!()
- File.exists?(reference_doc)
- File.cp(reference_doc, target_path)
- File.read(tex_file_path)
- File.write(metadata_file, metadata_content)
- File.exists?(output_path)
- File.stat(output_path)
- File.cp(temp_output_file, final_docx_path)
Direct Path operations:
- PathBuilder.join(...) (used for path construction)
- PathBuilder.dirname(...)
- PathBuilder.filename(...)
PathBuilder usage:
- PathBuilder.join(...)
- PathBuilder.dirname(...)
- PathBuilder.filename(...)
FileManager usage:
- (None found in this module)
Notes:
- Some direct File operations remain and should be refactored to use FileManager equivalents.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- No FileManager usage found; consider migrating file operations to FileManager equivalents.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.HtmlToMarkdownBuilder
Direct File operations:
- File.cwd()
- File.dir?(input_dir)
- File.dir?(abs_input_dir)
- File.read!(html_file)
- File.exists?(src_path)
- File.write!(markdown_output_file, final_markdown_content)
- File.write!(PathBuilder.join(output_base_dir, md_file), md)
- File.exists?(ncx_path)
- File.read!(ncx_path)
- File.write!(ncx_path, cleaned_content)
- File.exists?(PathBuilder.join(input_dir, filename))
- File.read(path)
- File.write!(path, ...)
Direct Path operations:
- PathBuilder.basename(images_dir)
- PathBuilder.filename(src)
- PathBuilder.dirname(html_file)
- PathBuilder.rootname(PathBuilder.filename(html_file))
PathBuilder usage:
- PathBuilder.expand(...)
- PathBuilder.join(...)
- PathBuilder.basename(...)
- PathBuilder.filename(...)
- PathBuilder.dirname(...)
- PathBuilder.rootname(...)
- PathBuilder.wildcard(...)
FileManager usage:
- FileManager.ensure_dir(images_dir)
- FileManager.copy(src_path, dest_path)
- FileManager.ensure_dir(output_base_dir)
Notes:
- Some direct File operations remain and should be refactored to use FileManager equivalents where possible.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- FileManager is used for directory creation and file copying, but ensure all file operations are migrated where appropriate.
- Update this section as refactoring progresses.
Audit: Codexis.Builders.LaTeXToHTMLConverter
Direct File operations:
- File.mkdir_p!(output_path)
- File.exists?(make4ht_config:config_file)
- File.cp!(make4ht_config:config_file, dest_cfg)
- File.cp!(html_file, dest_file)
- File.exists?(index_path)
- File.exists?(output_path)
- File.dir?(output_path)
- File.read!(file)
- File.write!(file, new_html_content)
- File.regular?(html_path)
- File.read!(html_path)
- File.exists?(abs_source_dir)
- File.dir?(abs_source_dir)
- File.exists?(parent_dir)
- File.dir?(parent_dir)
- File.exists?(abs_output_dir)
- File.dir?(abs_output_dir)
- :file.read_file_info(String.to_charlist(parent_dir))
- File.exists?(toc_file)
- File.read!(toc_file)
- File.exists?(src_dir_path)
- File.dir?(src_dir_path)
- File.mkdir_p!(dest_dir_path)
- File.mkdir_p!(PathBuilder.dirname(dest_path))
- File.cp!(file, dest_path)
- File.exists?(abs_styles_dir)
- File.dir?(abs_styles_dir)
- File.mkdir_p!(temp_styles_dir)
- File.cp!(file, dest_path)
- File.exists?(file)
- File.dir?(file)
- File.regular?(file)
- File.rm_rf(temp_build_dir)
Direct Path operations:
- PathBuilder.dirname(main_tex_file)
- PathBuilder.filename(main_tex_file)
- PathBuilder.join(...) (used for path construction)
- PathBuilder.extname(file)
- PathBuilder.relative_to(file, source_dir)
- PathBuilder.expand(styles_dir)
- PathBuilder.rootname(PathBuilder.filename(html_file))
PathBuilder usage:
- PathBuilder.dirname(...)
- PathBuilder.filename(...)
- PathBuilder.join(...)
- PathBuilder.extname(...)
- PathBuilder.relative_to(...)
- PathBuilder.expand(...)
- PathBuilder.rootname(...)
- PathBuilder.absolute?(...)
- PathBuilder.normalize(...)
- PathBuilder.wildcard(...)
FileManager usage:
- (None found in this module)
Notes:
- Many direct File operations remain and should be refactored to use FileManager equivalents where possible.
- PathBuilder is used for most path operations, but review for any missed legacy Path usage.
- No FileManager usage found; consider migrating file operations to FileManager equivalents.
- Update this section as refactoring progresses.