[feat] アプリケーションの機能強化とdocsのデザイン更新
Browse filesapp.py に新しい機能として最大探索深度の設定を追加。ユーザーインターフェースに最大探索深度を設定するためのテキストボックスをサイドバーに追加。docs/page_front.md に HTML の追加装飾を実装し、ドキュメントのフロントページを視覚的に魅力的に。
[style] .CodeLumiaignore のフォーマット更新
.CodeLumiaignore に新たに追加された拡張子(.sqlite, .jpg)および requirements.txt を除外リストに追加。ファイル末尾の改行も修正。
[refactor] file_operations.py および markdown_operations.py のリファクタリング
modules ディレクトリ内の file_operations.py と markdown_operations.py に最大探索深度を考慮するロジックを追加。この変更により、指定された深度を超えたディレクトリの探索をスキップする機能が実装された。
[docs] SourceSageDocs.md のコマンド更新
docs/SourceSageDocs.md に記載されたコマンドラインに --ignore オプションを追加。これにより、特定のファイルを無視する設定が反映されるように文書が更新された。
[chore] Binary file demo.gif の更新
docs/demo.gif が更新されたことを記録。バイナリファイルの差異は明示されないが、ファイルが変更されている。
- .CodeLumiaignore +4 -1
- OSWorld.md +0 -0
- app.py +6 -2
- docs/SourceSageDocs.md +1 -1
- docs/page_front.md +3 -0
- modules/file_operations.py +10 -2
- modules/markdown_operations.py +2 -2
.CodeLumiaignore
CHANGED
@@ -167,4 +167,7 @@ SourceSageAssets
|
|
167 |
.gitignore
|
168 |
LICENSE
|
169 |
.github
|
170 |
-
*.png
|
|
|
|
|
|
|
|
167 |
.gitignore
|
168 |
LICENSE
|
169 |
.github
|
170 |
+
*.png
|
171 |
+
*.sqlite
|
172 |
+
*.jpg
|
173 |
+
requirements.txt
|
OSWorld.md
ADDED
The diff for this file is too large to render.
See raw diff
|
|
app.py
CHANGED
@@ -25,17 +25,21 @@ st.markdown("---")
|
|
25 |
# リポジトリのURLを入力するテキストボックス
|
26 |
repo_url = st.text_input("リポジトリのURL:")
|
27 |
st.markdown("---")
|
|
|
28 |
|
29 |
# .gitignoreのパターンを編集するサイドバー
|
30 |
st.sidebar.title(".gitignore Patterns")
|
31 |
ignore_patterns = st.sidebar.text_area("Enter patterns (one per line):", value="\n".join(ignore_patterns), height=600).split("\n")
|
|
|
|
|
|
|
32 |
|
33 |
if repo_url:
|
34 |
repo_name = repo_url.split("/")[-1].split(".")[0]
|
35 |
repo_path = clone_repository(repo_url, repo_name)
|
36 |
|
37 |
-
file_tree = get_file_tree(repo_path, ignore_patterns)
|
38 |
-
markdown_content = create_markdown_content(repo_name, file_tree, repo_path, ignore_patterns)
|
39 |
|
40 |
# マークダウンファイルを保存
|
41 |
save_markdown_file(repo_name, markdown_content)
|
|
|
25 |
# リポジトリのURLを入力するテキストボックス
|
26 |
repo_url = st.text_input("リポジトリのURL:")
|
27 |
st.markdown("---")
|
28 |
+
st.markdown("[Full Text](#full-text)")
|
29 |
|
30 |
# .gitignoreのパターンを編集するサイドバー
|
31 |
st.sidebar.title(".gitignore Patterns")
|
32 |
ignore_patterns = st.sidebar.text_area("Enter patterns (one per line):", value="\n".join(ignore_patterns), height=600).split("\n")
|
33 |
+
# 探索の最大深度を入力するテキストボックス
|
34 |
+
max_depth = st.sidebar.number_input("探索の最大深度:", min_value=1, value=2, step=1)
|
35 |
+
|
36 |
|
37 |
if repo_url:
|
38 |
repo_name = repo_url.split("/")[-1].split(".")[0]
|
39 |
repo_path = clone_repository(repo_url, repo_name)
|
40 |
|
41 |
+
file_tree = get_file_tree(repo_path, ignore_patterns, max_depth)
|
42 |
+
markdown_content = create_markdown_content(repo_name, file_tree, repo_path, ignore_patterns, max_depth)
|
43 |
|
44 |
# マークダウンファイルを保存
|
45 |
save_markdown_file(repo_name, markdown_content)
|
docs/SourceSageDocs.md
CHANGED
@@ -2,5 +2,5 @@
|
|
2 |
|
3 |
```bash
|
4 |
|
5 |
-
sourcesage --repository CodeLumia --owner Sunwood-ai-labs
|
6 |
```
|
|
|
2 |
|
3 |
```bash
|
4 |
|
5 |
+
sourcesage --repository CodeLumia --owner Sunwood-ai-labs --ignore .SourceSageignore
|
6 |
```
|
docs/page_front.md
CHANGED
@@ -10,3 +10,6 @@
|
|
10 |
</h3>
|
11 |
|
12 |
</p>
|
|
|
|
|
|
|
|
10 |
</h3>
|
11 |
|
12 |
</p>
|
13 |
+
|
14 |
+
|
15 |
+
|
modules/file_operations.py
CHANGED
@@ -1,13 +1,16 @@
|
|
1 |
import os
|
2 |
import fnmatch
|
3 |
|
4 |
-
def get_file_tree(repo_path, ignore_patterns):
|
5 |
file_tree = ""
|
6 |
for root, dirs, files in os.walk(repo_path):
|
7 |
# .gitignoreに一致するディレクトリを無視
|
8 |
dirs[:] = [d for d in dirs if not any(fnmatch.fnmatch(d, pattern) for pattern in ignore_patterns)]
|
9 |
|
10 |
level = root.replace(repo_path, "").count(os.sep)
|
|
|
|
|
|
|
11 |
indent = " " * 4 * (level)
|
12 |
file_tree += f"{indent}{os.path.basename(root)}/\n"
|
13 |
subindent = " " * 4 * (level + 1)
|
@@ -17,11 +20,16 @@ def get_file_tree(repo_path, ignore_patterns):
|
|
17 |
file_tree += f"{subindent}{f}\n"
|
18 |
return file_tree
|
19 |
|
20 |
-
def process_files(repo_path, ignore_patterns):
|
21 |
file_contents = []
|
22 |
for root, dirs, files in os.walk(repo_path):
|
23 |
# .gitignoreに一致するディレクトリを無視
|
24 |
dirs[:] = [d for d in dirs if not any(fnmatch.fnmatch(d, pattern) for pattern in ignore_patterns)]
|
|
|
|
|
|
|
|
|
|
|
25 |
for file in files:
|
26 |
# .gitignoreに一致するファイルを無視
|
27 |
if not any(fnmatch.fnmatch(file, pattern) for pattern in ignore_patterns):
|
|
|
1 |
import os
|
2 |
import fnmatch
|
3 |
|
4 |
+
def get_file_tree(repo_path, ignore_patterns, max_depth):
|
5 |
file_tree = ""
|
6 |
for root, dirs, files in os.walk(repo_path):
|
7 |
# .gitignoreに一致するディレクトリを無視
|
8 |
dirs[:] = [d for d in dirs if not any(fnmatch.fnmatch(d, pattern) for pattern in ignore_patterns)]
|
9 |
|
10 |
level = root.replace(repo_path, "").count(os.sep)
|
11 |
+
if level > max_depth:
|
12 |
+
continue
|
13 |
+
|
14 |
indent = " " * 4 * (level)
|
15 |
file_tree += f"{indent}{os.path.basename(root)}/\n"
|
16 |
subindent = " " * 4 * (level + 1)
|
|
|
20 |
file_tree += f"{subindent}{f}\n"
|
21 |
return file_tree
|
22 |
|
23 |
+
def process_files(repo_path, ignore_patterns, max_depth):
|
24 |
file_contents = []
|
25 |
for root, dirs, files in os.walk(repo_path):
|
26 |
# .gitignoreに一致するディレクトリを無視
|
27 |
dirs[:] = [d for d in dirs if not any(fnmatch.fnmatch(d, pattern) for pattern in ignore_patterns)]
|
28 |
+
|
29 |
+
level = root.replace(repo_path, "").count(os.sep)
|
30 |
+
if level > max_depth:
|
31 |
+
continue
|
32 |
+
|
33 |
for file in files:
|
34 |
# .gitignoreに一致するファイルを無視
|
35 |
if not any(fnmatch.fnmatch(file, pattern) for pattern in ignore_patterns):
|
modules/markdown_operations.py
CHANGED
@@ -2,14 +2,14 @@ import json
|
|
2 |
from modules.file_operations import get_file_tree, process_files
|
3 |
import os
|
4 |
|
5 |
-
def create_markdown_content(repo_name, file_tree, repo_path, ignore_patterns):
|
6 |
markdown_content = f"# << {repo_name}>> \n## {repo_name} File Tree\n\n```\n{file_tree}\n```\n\n"
|
7 |
|
8 |
# 拡張子と言語のマッピングを読み込む
|
9 |
with open("docs/language_map.json", "r") as f:
|
10 |
language_map = json.load(f)
|
11 |
|
12 |
-
file_contents = process_files(repo_path, ignore_patterns)
|
13 |
for file_path, content in file_contents:
|
14 |
_, file_extension = os.path.splitext(file_path)
|
15 |
language = language_map.get(file_extension, "")
|
|
|
2 |
from modules.file_operations import get_file_tree, process_files
|
3 |
import os
|
4 |
|
5 |
+
def create_markdown_content(repo_name, file_tree, repo_path, ignore_patterns, max_depth):
|
6 |
markdown_content = f"# << {repo_name}>> \n## {repo_name} File Tree\n\n```\n{file_tree}\n```\n\n"
|
7 |
|
8 |
# 拡張子と言語のマッピングを読み込む
|
9 |
with open("docs/language_map.json", "r") as f:
|
10 |
language_map = json.load(f)
|
11 |
|
12 |
+
file_contents = process_files(repo_path, ignore_patterns, max_depth)
|
13 |
for file_path, content in file_contents:
|
14 |
_, file_extension = os.path.splitext(file_path)
|
15 |
language = language_map.get(file_extension, "")
|