Commit cea0edd
refactor: centralize PAT validation, streamline repo checks & misc cleanup (#349)
* refactor: centralize PAT validation, streamline repo checks & housekeeping
* `.venv*` to `.gitignore`
* `# type: ignore[attr-defined]` hints in `compat_typing.py` for IDE-agnostic imports
* Helpful PAT string in `InvalidGitHubTokenError` for easier debugging
* Bump **ruff-pre-commit** hook → `v0.12.1`
* CONTRIBUTING:
* Require **Python 3.9+**
* Recommend signed (`-S`) commits
* PAT validation now happens **only** in entry points
(`utils.auth.resolve_token` for CLI/lib, `server.process_query` for Web UI)
* Unified `_check_github_repo_exists` into `check_repo_exists`, replacing
`curl -I` with `curl --silent --location --write-out %{http_code} -o /dev/null`
* Broaden `_GITHUB_PAT_PATTERN`
* `create_git_auth_header` raises `ValueError` when hostname is missing
* Tests updated to expect raw HTTP-code output
* Superfluous “token can be set via `GITHUB_TOKEN`” notes in docstrings
* `.gitingestignore` & `.terraform` from `DEFAULT_IGNORE_PATTERNS`
* Token validation inside `create_git_command`
* Obsolete `test_create_git_command_invalid_token`
* Adjust `test_clone.py` and `test_git_utils.py` for new status-code handling
* Consolidate mocks after token-validation relocation
BREAKING CHANGE:
`create_git_command` no longer validates GitHub tokens; callers must ensure
tokens are valid (via `validate_github_token`) before invoking lower-level
git helpers.
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>1 parent 6fe62cc commit cea0eddCopy full SHA for cea0edd
File tree
Expand file treeCollapse file tree
5 files changed
+81
-39
lines changedOpen diff view settings
Filter options
- src
- gitingest/utils
- server
- tests
Expand file treeCollapse file tree
5 files changed
+81
-39
lines changedOpen diff view settings
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
151 | 151 | |
152 | 152 | |
153 | 153 | |
154 | | - |
| 154 | + |
Collapse file
+1-1Lines changed: 1 addition & 1 deletion
- Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
89 | 89 | |
90 | 90 | |
91 | 91 | |
92 | | - |
| 92 | + |
Collapse file
src/gitingest/utils/git_utils.py
Copy file name to clipboardExpand all lines: src/gitingest/utils/git_utils.py+45-30Lines changed: 45 additions & 30 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
4 | 4 | |
5 | 5 | |
6 | 6 | |
| 7 | + |
7 | 8 | |
8 | 9 | |
9 | 10 | |
| 11 | + |
10 | 12 | |
11 | 13 | |
12 | 14 | |
13 | 15 | |
14 | 16 | |
15 | 17 | |
| 18 | + |
| 19 | + |
| 20 | + |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | + |
| 27 | + |
16 | 28 | |
17 | 29 | |
18 | 30 | |
| ||
130 | 142 | |
131 | 143 | |
132 | 144 | |
133 | | - |
| 145 | + |
| 146 | + |
| 147 | + |
| 148 | + |
| 149 | + |
| 150 | + |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
| 155 | + |
134 | 156 | |
135 | 157 | |
136 | 158 | |
137 | 159 | |
138 | 160 | |
139 | 161 | |
140 | | - |
| 162 | + |
141 | 163 | |
142 | | - |
143 | | - |
144 | | - |
145 | | - |
146 | | - |
| 164 | + |
147 | 165 | |
148 | | - |
| 166 | + |
| 167 | + |
| 168 | + |
| 169 | + |
| 170 | + |
| 171 | + |
149 | 172 | |
150 | | - |
| 173 | + |
| 174 | + |
| 175 | + |
| 176 | + |
| 177 | + |
151 | 178 | |
152 | | - |
| 179 | + |
| 180 | + |
| 181 | + |
| 182 | + |
153 | 183 | |
154 | | - |
| 184 | + |
155 | 185 | |
156 | 186 | |
157 | 187 | |
| ||
183 | 213 | |
184 | 214 | |
185 | 215 | |
186 | | - |
| 216 | + |
187 | 217 | |
188 | 218 | |
189 | 219 | |
| ||
216 | 246 | |
217 | 247 | |
218 | 248 | |
219 | | - |
220 | | - |
221 | | - |
222 | | - |
223 | 249 | |
224 | 250 | |
225 | 251 | |
226 | 252 | |
227 | 253 | |
228 | 254 | |
229 | | - |
230 | | - |
231 | | - |
232 | | - |
233 | | - |
234 | | - |
235 | | - |
236 | | - |
237 | | - |
238 | | - |
239 | | - |
240 | | - |
| 255 | + |
241 | 256 | |
242 | 257 | |
243 | 258 | |
| ||
246 | 261 | |
247 | 262 | |
248 | 263 | |
249 | | - |
| 264 | + |
250 | 265 | |
251 | | - |
| 266 | + |
252 | 267 | |
253 | 268 | |
254 | 269 | |
|
Collapse file
src/server/query_processor.py
Copy file name to clipboardExpand all lines: src/server/query_processor.py+12-3Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
9 | 9 | |
10 | 10 | |
11 | 11 | |
12 | | - |
13 | | - |
| 12 | + |
| 13 | + |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
14 | 18 | |
15 | 19 | |
16 | 20 | |
| ||
63 | 67 | |
64 | 68 | |
65 | 69 | |
| 70 | + |
| 71 | + |
66 | 72 | |
67 | 73 | |
68 | 74 | |
| ||
99 | 105 | |
100 | 106 | |
101 | 107 | |
102 | | - |
| 108 | + |
| 109 | + |
| 110 | + |
| 111 | + |
103 | 112 | |
104 | 113 | |
105 | 114 | |
|
Collapse file
+22-4Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
91 | 91 | |
92 | 92 | |
93 | 93 | |
94 | | - |
95 | | - |
96 | | - |
97 | | - |
| 94 | + |
| 95 | + |
| 96 | + |
98 | 97 | |
99 | 98 | |
100 | 99 | |
| ||
209 | 208 | |
210 | 209 | |
211 | 210 | |
| 211 | + |
| 212 | + |
| 213 | + |
| 214 | + |
| 215 | + |
| 216 | + |
| 217 | + |
| 218 | + |
| 219 | + |
| 220 | + |
| 221 | + |
| 222 | + |
| 223 | + |
| 224 | + |
| 225 | + |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + |
212 | 230 | |
213 | 231 | |
214 | 232 | |
|
0 commit comments