Skip to content

Commit 8d79694

Browse files
committed
Add allow_external flag
1 parent d7af589 commit 8d79694

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/codegen/configs/models/codebase.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, prefix: str = "CODEBASE", *args, **kwargs) -> None:
2121
import_resolution_paths: list[str] = Field(default_factory=lambda: [])
2222
import_resolution_overrides: dict[str, str] = Field(default_factory=lambda: {})
2323
py_resolve_syspath: bool = False
24+
allow_external: bool = False
2425
ts_dependency_manager: bool = False
2526
ts_language_engine: bool = False
2627
v8_ts_engine: bool = False

src/codegen/sdk/codebase/codebase_context.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ def get_directory(self, directory_path: PathLike, create_on_missing: bool = Fals
381381
"""
382382
# If not part of repo path, return None
383383
absolute_path = self.to_absolute(directory_path)
384-
if not self.is_subdir(absolute_path):
384+
if not self.is_subdir(absolute_path) and not self.config.allow_external:
385385
assert False, f"Directory {absolute_path} is not part of repo path {self.repo_path}"
386386
return None
387387

@@ -611,7 +611,7 @@ def get_edges(self) -> list[tuple[NodeId, NodeId, EdgeType, Usage | None]]:
611611
def get_file(self, file_path: os.PathLike, ignore_case: bool = False) -> SourceFile | None:
612612
# If not part of repo path, return None
613613
absolute_path = self.to_absolute(file_path)
614-
if not self.is_subdir(absolute_path):
614+
if not self.is_subdir(absolute_path) and not self.config.allow_external:
615615
assert False, f"File {file_path} is not part of the repository path"
616616

617617
# Check if file exists in graph

0 commit comments

Comments
 (0)