gitex 0.3.0__tar.gz → 0.3.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gitex-0.3.0 → gitex-0.3.2}/PKG-INFO +1 -1
- gitex-0.3.2/gitex/__init__.py +1 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/main.py +81 -31
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/PKG-INFO +1 -1
- gitex-0.3.0/gitex/__init__.py +0 -1
- {gitex-0.3.0 → gitex-0.3.2}/README.md +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/dependency_mapper.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/docstring_extractor.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/models.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/picker/__init__.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/picker/base.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/picker/questionary.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/picker/textuals.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/renderer.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex/utils.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/SOURCES.txt +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/dependency_links.txt +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/entry_points.txt +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/requires.txt +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/gitex.egg-info/top_level.txt +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/pyproject.toml +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/setup.cfg +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/tests/test_cli.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/tests/test_fences.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/tests/test_render.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/tests/test_skip_binaries.py +0 -0
- {gitex-0.3.0 → gitex-0.3.2}/tests/test_textual.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.3.2"
|
|
@@ -31,35 +31,71 @@ def _filter_nodes(nodes):
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
@click.command(context_settings=dict(help_option_names=["-h", "--help"]))
|
|
34
|
-
@click.argument("path", type=click.Path(exists=True), default=
|
|
34
|
+
@click.argument("path", type=click.Path(exists=True), default=".")
|
|
35
35
|
@click.version_option(version=None, message="%(prog)s version %(version)s")
|
|
36
|
-
@click.option("-i", "--interactive", is_flag=True,
|
|
37
|
-
|
|
38
|
-
@click.option("
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
36
|
+
@click.option("-i", "--interactive", is_flag=True, help="Launch interactive picker to choose files")
|
|
37
|
+
@click.option("--no-files", is_flag=True, help="Only render the directory tree without file contents.")
|
|
38
|
+
@click.option("-v", "--verbose", is_flag=True, help="Print output to terminal in addition to copying.")
|
|
39
|
+
@click.option(
|
|
40
|
+
"-d",
|
|
41
|
+
"--base-dir",
|
|
42
|
+
default=None,
|
|
43
|
+
help="Strip this prefix from file paths when rendering file contents.",
|
|
44
|
+
)
|
|
45
|
+
@click.option(
|
|
46
|
+
"-ds",
|
|
47
|
+
"--extract-docstrings",
|
|
48
|
+
"extract_symbol",
|
|
49
|
+
help="Extract docstrings for a specific symbol (e.g., gitex.renderer.Renderer) or all files if no symbol is provided.",
|
|
50
|
+
metavar="SYMBOL_PATH",
|
|
51
|
+
default=None,
|
|
52
|
+
is_flag=False,
|
|
53
|
+
flag_value="*",
|
|
54
|
+
)
|
|
55
|
+
@click.option(
|
|
56
|
+
"--include-empty-classes",
|
|
57
|
+
is_flag=True,
|
|
58
|
+
help="Include classes and functions without docstrings when using --extract-docstrings.",
|
|
59
|
+
)
|
|
60
|
+
@click.option(
|
|
61
|
+
"--map-dependencies",
|
|
62
|
+
"dependency_focus",
|
|
63
|
+
help="Analyze and map code dependencies and relationships. Options: 'imports', 'inheritance', 'calls', or omit for all.",
|
|
64
|
+
metavar="FOCUS",
|
|
65
|
+
default=None,
|
|
66
|
+
is_flag=False,
|
|
67
|
+
flag_value="all",
|
|
68
|
+
)
|
|
52
69
|
@click.option("-g", "--ignore-gitignore", is_flag=True, help="Include files normally ignored by .gitignore.")
|
|
53
70
|
@click.option("-a", "--all", "show_hidden", is_flag=True, help="Include hidden files (files starting with .).")
|
|
54
71
|
@click.option("--force", is_flag=True, help="Force execution on non-git directories (caution: may be slow).")
|
|
55
72
|
|
|
56
|
-
|
|
57
|
-
|
|
73
|
+
# ✅ NEW: internal wrapper mode (hidden)
|
|
74
|
+
@click.option(
|
|
75
|
+
"--emit",
|
|
76
|
+
is_flag=True,
|
|
77
|
+
hidden=True,
|
|
78
|
+
help="Internal: emit final output to stdout and skip clipboard/status (used by docker wrapper).",
|
|
79
|
+
)
|
|
80
|
+
def cli(
|
|
81
|
+
path,
|
|
82
|
+
interactive,
|
|
83
|
+
no_files,
|
|
84
|
+
verbose,
|
|
85
|
+
base_dir,
|
|
86
|
+
extract_symbol,
|
|
87
|
+
include_empty_classes,
|
|
88
|
+
dependency_focus,
|
|
89
|
+
ignore_gitignore,
|
|
90
|
+
show_hidden,
|
|
91
|
+
force,
|
|
92
|
+
emit, # ✅ NEW
|
|
93
|
+
):
|
|
58
94
|
"""
|
|
59
95
|
Renders a repository's file tree and optional file contents for LLM prompts.
|
|
60
96
|
|
|
61
97
|
You can choose files interactively, respect .gitignore, and exclude patterns.
|
|
62
|
-
|
|
98
|
+
|
|
63
99
|
Features:
|
|
64
100
|
- Extract docstrings and signatures from Python files
|
|
65
101
|
- Map dependencies and relationships between code components
|
|
@@ -67,7 +103,7 @@ def cli(path, interactive, no_files, verbose, base_dir, extract_symbol, include_
|
|
|
67
103
|
- Gitignore-aware filtering
|
|
68
104
|
"""
|
|
69
105
|
root = Path(path).resolve()
|
|
70
|
-
|
|
106
|
+
|
|
71
107
|
# Safety Check: Ensure we are in a git repository to prevent accidental massive scans (like ~)
|
|
72
108
|
# The --force flag allows bypassing this check for intentional non-git directory scanning.
|
|
73
109
|
try:
|
|
@@ -107,47 +143,61 @@ def cli(path, interactive, no_files, verbose, base_dir, extract_symbol, include_
|
|
|
107
143
|
# Handle dependency mapping (works independently of --no-files)
|
|
108
144
|
if dependency_focus:
|
|
109
145
|
out_parts.append("\n\n### Dependency & Relationship Map ###\n")
|
|
110
|
-
|
|
146
|
+
|
|
111
147
|
# Get Python files from the selected nodes
|
|
112
148
|
python_files = []
|
|
113
|
-
|
|
114
|
-
|
|
149
|
+
|
|
150
|
+
def collect_python_files(nodes_):
|
|
151
|
+
for node in nodes_:
|
|
115
152
|
if node.node_type == "file" and node.name.endswith(".py"):
|
|
116
153
|
python_files.append(node.path)
|
|
117
154
|
if node.children:
|
|
118
155
|
collect_python_files(node.children)
|
|
119
|
-
|
|
156
|
+
|
|
120
157
|
collect_python_files(nodes)
|
|
121
|
-
|
|
158
|
+
|
|
122
159
|
# Analyze dependencies
|
|
123
160
|
mapper = DependencyMapper(str(root))
|
|
124
161
|
analysis = mapper.analyze(python_files)
|
|
125
|
-
|
|
162
|
+
|
|
126
163
|
# Format and display results
|
|
127
164
|
focus_value = None if dependency_focus == "all" else dependency_focus
|
|
128
165
|
formatted_output = format_dependency_analysis(analysis, focus_value)
|
|
129
166
|
out_parts.append(formatted_output)
|
|
130
|
-
|
|
167
|
+
|
|
131
168
|
elif not no_files:
|
|
132
169
|
# Render file contents using the filtered nodes
|
|
133
170
|
if extract_symbol:
|
|
134
171
|
out_parts.append("\n\n### Extracted Docstrings and Signatures ###\n")
|
|
135
172
|
symbol_target = None if extract_symbol == "*" else extract_symbol
|
|
136
|
-
out_parts.append(
|
|
173
|
+
out_parts.append(
|
|
174
|
+
renderer.render_docstrings(base_dir or str(root), symbol_target, include_empty_classes)
|
|
175
|
+
)
|
|
137
176
|
else:
|
|
138
177
|
out_parts.append("\n\n### File Contents ###\n")
|
|
139
178
|
out_parts.append(renderer.render_files(base_dir or str(root)))
|
|
140
179
|
|
|
141
180
|
final_output = "".join(out_parts)
|
|
142
181
|
|
|
182
|
+
# ✅ NEW: wrapper mode: print only the output, no clipboard, no status lines
|
|
183
|
+
if emit:
|
|
184
|
+
click.echo(final_output)
|
|
185
|
+
return
|
|
186
|
+
|
|
187
|
+
# Normal behavior (pip install / normal execution)
|
|
143
188
|
ok = copy_to_clipboard(final_output)
|
|
144
189
|
if ok:
|
|
145
190
|
click.secho("[Copied to clipboard]", err=True)
|
|
146
191
|
if verbose:
|
|
147
192
|
click.echo(final_output)
|
|
148
193
|
else:
|
|
149
|
-
click.secho(
|
|
194
|
+
click.secho(
|
|
195
|
+
"[Failed to copy to clipboard – install wl-clipboard or xclip or xsel]",
|
|
196
|
+
fg="yellow",
|
|
197
|
+
err=True,
|
|
198
|
+
)
|
|
150
199
|
click.echo(final_output)
|
|
151
200
|
|
|
201
|
+
|
|
152
202
|
if __name__ == "__main__":
|
|
153
|
-
cli()
|
|
203
|
+
cli()
|
gitex-0.3.0/gitex/__init__.py
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.3.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|