feat: Support subdirectories in generate and validator#59
Open
p0thi wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR
This PR adds full support for running CodeWiki and performing incremental updates inside subdirectories of Git monorepos.
Description
Previously, CodeWiki assumed the
.gitdirectory was located directly at the project root (repo_path), which caused issues and errors when attempting to run analysis and generation inside monorepo subdirectories.This pull request updates the CLI and utility methods to search parent directories for a Git repository, correctly align git-diff paths under sub-folders, and filter changes accordingly.
Key Changes:
repo_validator.py):_get_git_repothat usesgit.Repo(repo_path, search_parent_directories=True).is_git_repository,get_git_commit_hash, andget_git_branchto leverage this helper. This allows CodeWiki to recognize when it is running inside a Git repository subdirectory.generate.py):_detect_changed_filesto calculate the relative subdirectory prefix (e.g.,apps/my-app) relative to the git repository root.git diffto include only those within the active subdirectory.module_tree.jsonfor proper incremental generation.githelpers to prevent unexpected crashes (e.g., when running in detached HEAD states inside CI/CD environments).With these changes, developers can now seamlessly use CodeWiki on targeted microservices, modules, or application sub-folders within monorepos.