gitex 0.3.1__py3-none-any.whl → 0.3.2__py3-none-any.whl

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/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.3.1"
1
+ __version__ = "0.3.2"
gitex/main.py CHANGED
@@ -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
- help="Launch interactive picker to choose files")
38
- @click.option("--no-files", is_flag=True,
39
- help="Only render the directory tree without file contents.")
40
- @click.option("-v", "--verbose", is_flag=True,
41
- help="Print output to terminal in addition to copying.")
42
- @click.option("-d", "--base-dir", default=None,
43
- help="Strip this prefix from file paths when rendering file contents.")
44
- @click.option("-ds", "--extract-docstrings", "extract_symbol",
45
- help="Extract docstrings for a specific symbol (e.g., gitex.renderer.Renderer) or all files if no symbol is provided.",
46
- metavar="SYMBOL_PATH", default=None, is_flag=False, flag_value="*")
47
- @click.option("--include-empty-classes", is_flag=True,
48
- help="Include classes and functions without docstrings when using --extract-docstrings.")
49
- @click.option("--map-dependencies", "dependency_focus",
50
- help="Analyze and map code dependencies and relationships. Options: 'imports', 'inheritance', 'calls', or omit for all.",
51
- metavar="FOCUS", default=None, is_flag=False, flag_value="all")
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
- def cli(path, interactive, no_files, verbose, base_dir, extract_symbol, include_empty_classes, dependency_focus, ignore_gitignore, show_hidden, force):
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
- def collect_python_files(nodes):
114
- for node in nodes:
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(renderer.render_docstrings(base_dir or str(root), symbol_target, include_empty_classes))
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("[Failed to copy to clipboard – install wl-clipboard or xclip or xsel]", fg="yellow", err=True)
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()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gitex
3
- Version: 0.3.1
3
+ Version: 0.3.2
4
4
  Summary: Terminal tool to prep codebases for LLMs
5
5
  Author-email: zozaai <info@zozaai.com>
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- gitex/__init__.py,sha256=r4xAFihOf72W9TD-lpMi6ntWSTKTP2SlzKP1ytkjRbI,22
1
+ gitex/__init__.py,sha256=vNiWJ14r_cw5t_7UDqDQIVZvladKFGyHH2avsLpN7Vg,22
2
2
  gitex/dependency_mapper.py,sha256=alQ_3Bua-VCI-CtwMZH9vJYrLjlLFrYxbuYrydGFiMI,18236
3
3
  gitex/docstring_extractor.py,sha256=glqS3aihTP_FWBS76uB9TAojkH-8Qv9Rgflp75mWzXs,5037
4
- gitex/main.py,sha256=dvPKfUvQ7rqta9-UDZw265aRzKOhrT4hdIVFmo-aLkQ,6576
4
+ gitex/main.py,sha256=tf42oGP75HXw4q3jC6eMbKE48VovZ1PjszcRJvSAblk,7064
5
5
  gitex/models.py,sha256=5saGOUkWz608Q65c0gUrXv3NESzCL1GXftJgDpjQSNc,532
6
6
  gitex/renderer.py,sha256=PPORG5HmGY-OXtGM7c9mswNXvB-OGAXAGEn3Q73GXVc,7196
7
7
  gitex/utils.py,sha256=ivweFCUly8QEqNWV3NtF2fCTEaz3ukjYYt40ROKxkvE,2181
@@ -14,8 +14,8 @@ tests/test_fences.py,sha256=00tzli0cG8yNxzAUobOj797SBJtTVAwVpbL7b5_nRIM,4313
14
14
  tests/test_render.py,sha256=DaRMPRDfqSteVO4Z6BIkF777V1cpXwnaGYSqbBUU3mk,7223
15
15
  tests/test_skip_binaries.py,sha256=r9izOgpb284y8bN7p_M9-5VixokW0WFA2npmAmxdMLk,1905
16
16
  tests/test_textual.py,sha256=EPH5hOaAM7N4eJN6aTz5rqFvRoDd0OyjIrhfoMNzaFY,9897
17
- gitex-0.3.1.dist-info/METADATA,sha256=MMG4wxPmDrUV198cHYgWDX37FuI3ghRDfRrS7l_YvVQ,5083
18
- gitex-0.3.1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
19
- gitex-0.3.1.dist-info/entry_points.txt,sha256=YVGHi9Ock94uICcjGxm_eHtwBv3_RCiwpBKwIkMJhGI,41
20
- gitex-0.3.1.dist-info/top_level.txt,sha256=N-r2BJX8y5Wlkh3VtRSBC8jagKMDxFDP9iOwpN1H2do,12
21
- gitex-0.3.1.dist-info/RECORD,,
17
+ gitex-0.3.2.dist-info/METADATA,sha256=4LJeUpa9LoY2-Bhb5mrroshNX2Q5XlrNSw3TfWYZksI,5083
18
+ gitex-0.3.2.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
19
+ gitex-0.3.2.dist-info/entry_points.txt,sha256=YVGHi9Ock94uICcjGxm_eHtwBv3_RCiwpBKwIkMJhGI,41
20
+ gitex-0.3.2.dist-info/top_level.txt,sha256=N-r2BJX8y5Wlkh3VtRSBC8jagKMDxFDP9iOwpN1H2do,12
21
+ gitex-0.3.2.dist-info/RECORD,,
File without changes