Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as opaque submodule gitlinks on GitHub) into fully-tracked first-party content. AITM now merges its 7 vendored repos as first-party engines: - memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts - git: vendored C git (bundled binary) + gitnexus (in-process code intelligence) - agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess) Includes the full session's product build: Gitgram web/mobile/backend features, AITM website/CLI/MCP, the unified memory layer, engine build tooling (scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md), and extensive test suites. Build artifacts, node_modules, external/, and gemini-cli are gitignored. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
49 lines
1.7 KiB
Python
49 lines
1.7 KiB
Python
"""This module contains utility functions for the repo_to_text package."""
|
|
|
|
import shutil
|
|
import logging
|
|
from typing import List
|
|
|
|
def setup_logging(debug: bool = False) -> None:
|
|
"""Set up logging configuration.
|
|
|
|
Args:
|
|
debug: If True, sets logging level to DEBUG, otherwise INFO
|
|
"""
|
|
logging_level = logging.DEBUG if debug else logging.INFO
|
|
logging.basicConfig(level=logging_level, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
|
|
def check_tree_command() -> bool:
|
|
"""Check if the `tree` command is available, and suggest installation if not.
|
|
|
|
Returns:
|
|
bool: True if tree command is available, False otherwise
|
|
"""
|
|
if shutil.which('tree') is None:
|
|
print(
|
|
"The 'tree' command is not found. "
|
|
+ "Please install it using one of the following commands:"
|
|
)
|
|
print("For Debian-based systems (e.g., Ubuntu): sudo apt-get install tree")
|
|
print("For Red Hat-based systems (e.g., Fedora, CentOS): sudo yum install tree")
|
|
return False
|
|
return True
|
|
|
|
def is_ignored_path(file_path: str) -> bool:
|
|
"""Check if a file path should be ignored based on predefined rules.
|
|
|
|
Args:
|
|
file_path: Path to check
|
|
|
|
Returns:
|
|
bool: True if path should be ignored, False otherwise
|
|
"""
|
|
ignored_dirs: List[str] = ['.git']
|
|
ignored_files_prefix: List[str] = ['repo-to-text_']
|
|
is_ignored_dir = any(ignored in file_path for ignored in ignored_dirs)
|
|
is_ignored_file = any(file_path.startswith(prefix) for prefix in ignored_files_prefix)
|
|
result = is_ignored_dir or is_ignored_file
|
|
if result:
|
|
logging.debug('Path ignored: %s', file_path)
|
|
return result
|