Skip to content

Commit d6474dc

Browse files
committed
Apply suggestions from Copilot and Gemini review
1 parent f273946 commit d6474dc

File tree

5 files changed

+32
-52
lines changed

5 files changed

+32
-52
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323

2424
- name: Install dependencies
2525
run: npm ci
26+
- name: Install Python dependencies
27+
run: |
28+
python3 -m pip install --user gitingest
2629
- name: Build website
2730
run: npm run build
2831

.github/workflows/test-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,7 @@ jobs:
2323

2424
- name: Install dependencies
2525
run: npm ci
26+
- name: Install Python dependencies
27+
run: python3 -m pip install --user gitingest
2628
- name: Test build website
2729
run: npm run build

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"serve": "docusaurus serve",
1313
"write-translations": "docusaurus write-translations",
1414
"write-heading-ids": "docusaurus write-heading-ids",
15-
"generate-llms-full": "(.venv/bin/python scripts/generate-llms-full.py) || (python3 scripts/generate-llms-full.py) || (python scripts/generate-llms-full.py)"
15+
"generate-llms-full": "python3 scripts/generate-llms-full.py"
1616
},
1717
"dependencies": {
1818
"@docusaurus/core": "^3.7.0",

scripts/README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,21 @@ python scripts/generate-llms-full.py
3131
### Requirements
3232

3333
- Python 3.8+
34-
- gitingest package (automatically installed by using `pip` if not present)
34+
- gitingest package
35+
36+
> [!NOTE]
37+
>
38+
> For local development, install gitingest manually by using `pip install --user gitingest` or `pipx install gitingest`. For GitHub Actions, gitingest is automatically installed in the workflow for building and deploying the docs site at `.github/workflows/deploy.yml`.
3539
3640
### What the `generate-llms-full.py` script does
3741

3842
1. Uses gitingest to analyze the `docs` directory.
39-
2. Automatically installs gitingest if not already available.
40-
3. Includes only .mdx documentation files (`docs/*.mdx`, `docs/**/*.mdx`, and `src/components/en-us`).
41-
4. Focuses on the latest version of English documentation.
42-
5. Excludes build artifacts, node_modules, and other irrelevant files.
43-
6. Generates a comprehensive AI-friendly text digest.
44-
7. Adds a custom header for ScalarDB documentation context.
45-
8. Outputs to `build/llms-full.txt`.
43+
2. Includes only .mdx documentation files (`docs/*.mdx`, `docs/**/*.mdx`, and `src/components/en-us`).
44+
3. Focuses on the latest version of English documentation.
45+
4. Excludes build artifacts, node_modules, and other irrelevant files.
46+
5. Generates a comprehensive AI-friendly text digest.
47+
6. Adds a custom header for ScalarDB documentation context.
48+
7. Outputs to `build/llms-full.txt`.
4649

4750
### Configuration
4851

scripts/generate-llms-full.py

Lines changed: 15 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,20 @@
44
"""
55

66
import asyncio
7-
import os
8-
import subprocess
97
import sys
8+
import textwrap
109
from pathlib import Path
1110

12-
# Add the project root to the Python path.
13-
project_root = Path(__file__).parent.parent
14-
sys.path.insert(0, str(project_root))
15-
16-
def install_gitingest():
17-
"""Install gitingest package using pip."""
18-
try:
19-
print("📦 Installing gitingest...")
20-
subprocess.check_call([sys.executable, "-m", "pip", "install", "gitingest"])
21-
print("✅ gitingest installed successfully")
22-
return True
23-
except subprocess.CalledProcessError as e:
24-
print(f"❌ Failed to install gitingest: {e}")
25-
return False
26-
27-
# Try to import gitingest, install if not available
2811
try:
2912
from gitingest import ingest_async
3013
except ImportError:
31-
print("⚠️ gitingest not found, attempting to install...")
32-
if install_gitingest():
33-
try:
34-
from gitingest import ingest_async
35-
print("✅ gitingest imported successfully after installation")
36-
except ImportError:
37-
print("❌ Failed to import gitingest even after installation")
38-
print("Manual installation may be required:")
39-
print(" pip install gitingest")
40-
print(" # or")
41-
print(" pipx install gitingest")
42-
sys.exit(1)
43-
else:
44-
print("❌ gitingest installation failed")
45-
print("Manual installation required:")
46-
print(" pip install gitingest")
47-
print(" # or")
48-
print(" pipx install gitingest")
49-
sys.exit(1)
14+
print("❌ gitingest not found. Please install it first:")
15+
print(" pip install --user gitingest")
16+
print(" # or")
17+
print(" pipx install gitingest")
18+
print("")
19+
print("For GitHub Actions, this should be installed automatically in the workflow.")
20+
sys.exit(1)
5021

5122

5223
async def generate_llms_full():
@@ -72,19 +43,20 @@ async def generate_llms_full():
7243
# Generate content by using gitingest.
7344
summary, tree, content = await ingest_async(
7445
str(repo_path),
75-
max_file_size=102400, # 100KB max file size
46+
max_file_size=100000, # 100 KB max file size
7647
include_patterns=include_patterns,
7748
exclude_patterns=exclude_patterns,
7849
include_gitignored=False
7950
)
8051

8152
# Create a header that matches your current format.
82-
header = """# ScalarDB Documentation - Full Repository Context
83-
# Generated by using GitIngest for AI/LLM consumption
84-
# Cloud-native universal transaction manager
85-
# Website: https://scalardb.scalar-labs.com
53+
header = textwrap.dedent("""\
54+
# ScalarDB Documentation - Full Repository Context
55+
# Generated by using GitIngest for AI/LLM consumption
56+
# Cloud-native universal transaction manager
57+
# Website: https://scalardb.scalar-labs.com
8658
87-
"""
59+
""")
8860

8961
# Combine all sections.
9062
full_content = header + summary + "\n\n" + tree + "\n\n" + content

0 commit comments

Comments
 (0)