context-loader 0.1.8__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.
- context_loader/__init__.py +3 -0
- context_loader/application.py +197 -0
- context_loader/cli.py +75 -0
- context_loader/collect.py +993 -0
- context_loader/git.py +348 -0
- context_loader/render.py +377 -0
- context_loader-0.1.8.dist-info/METADATA +555 -0
- context_loader-0.1.8.dist-info/RECORD +10 -0
- context_loader-0.1.8.dist-info/WHEEL +4 -0
- context_loader-0.1.8.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: context-loader
|
|
3
|
+
Version: 0.1.8
|
|
4
|
+
Summary: Render deterministic local Git context for Codex
|
|
5
|
+
License: Apache License
|
|
6
|
+
Version 2.0, January 2004
|
|
7
|
+
http://www.apache.org/licenses/
|
|
8
|
+
|
|
9
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
10
|
+
|
|
11
|
+
1. Definitions.
|
|
12
|
+
|
|
13
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
14
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
15
|
+
|
|
16
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
17
|
+
the copyright owner that is granting the License.
|
|
18
|
+
|
|
19
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
20
|
+
other entities that control, are controlled by, or are under common
|
|
21
|
+
control with that entity. For the purposes of this definition,
|
|
22
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
23
|
+
direction or management of such entity, whether by contract or
|
|
24
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
25
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
26
|
+
|
|
27
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
28
|
+
exercising permissions granted by this License.
|
|
29
|
+
|
|
30
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
31
|
+
including but not limited to source code, documentation source, and
|
|
32
|
+
configuration files.
|
|
33
|
+
|
|
34
|
+
"Object" form shall mean any form resulting from mechanical
|
|
35
|
+
transformation or translation of a Source form, including but
|
|
36
|
+
not limited to compiled object code, generated documentation,
|
|
37
|
+
and conversions to other media types.
|
|
38
|
+
|
|
39
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
40
|
+
Object form, made available under the License, as indicated by a
|
|
41
|
+
copyright notice that is included in or attached to the work
|
|
42
|
+
(an example is provided in the Appendix below).
|
|
43
|
+
|
|
44
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
45
|
+
form, that is based on (or derived from) the Work and for which the
|
|
46
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
47
|
+
represent, as a whole, an original work of authorship. For the
|
|
48
|
+
purposes of this License, Derivative Works shall not include works
|
|
49
|
+
that remain separable from, or merely link (or bind by name) to the
|
|
50
|
+
interfaces of, the Work and Derivative Works thereof.
|
|
51
|
+
|
|
52
|
+
"Contribution" shall mean any work of authorship, including
|
|
53
|
+
the original version of the Work and any modifications or additions
|
|
54
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
55
|
+
submitted to Licensor for inclusion in the Work by the copyright
|
|
56
|
+
owner or by an individual or Legal Entity authorized to submit on
|
|
57
|
+
behalf of the copyright owner. For the purposes of this definition,
|
|
58
|
+
"submitted" means any form of electronic, verbal, or written
|
|
59
|
+
communication sent to the Licensor or its representatives, including
|
|
60
|
+
but not limited to communication on electronic mailing lists, source
|
|
61
|
+
code control systems, and issue tracking systems that are managed by,
|
|
62
|
+
or on behalf of, the Licensor for the purpose of discussing and
|
|
63
|
+
improving the Work, but excluding communication that is conspicuously
|
|
64
|
+
marked or otherwise designated in writing by the copyright owner as
|
|
65
|
+
"Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and do
|
|
122
|
+
not modify the License. You may add Your own attribution notices
|
|
123
|
+
within Derivative Works that you distribute, alongside or as an
|
|
124
|
+
addendum to the NOTICE text from the Work, provided that such
|
|
125
|
+
additional attribution notices cannot be construed as modifying
|
|
126
|
+
the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT
|
|
151
|
+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
|
|
152
|
+
including, without limitation, any warranties or conditions of
|
|
153
|
+
TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor has
|
|
168
|
+
been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf of
|
|
176
|
+
any other Contributor, and only if You agree to indemnify, defend,
|
|
177
|
+
and hold each Contributor harmless for any liability incurred by,
|
|
178
|
+
or claims asserted against, such Contributor by reason of your
|
|
179
|
+
accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a file
|
|
190
|
+
or class name and description of purpose be included on the same
|
|
191
|
+
"printed page" as the copyright notice for easier identification.
|
|
192
|
+
|
|
193
|
+
Copyright [yyyy] [name of copyright owner]
|
|
194
|
+
|
|
195
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
196
|
+
you may not use this file except in compliance with the License.
|
|
197
|
+
You may obtain a copy of the License at
|
|
198
|
+
|
|
199
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
200
|
+
|
|
201
|
+
Unless required by applicable law or agreed to in writing, software
|
|
202
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
203
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
204
|
+
See the License for the specific language governing permissions and
|
|
205
|
+
limitations under the License.
|
|
206
|
+
|
|
207
|
+
Requires-Python: >=3.12, <3.13
|
|
208
|
+
Project-URL: Repository, https://github.com/xuanheng-tech/context-loader
|
|
209
|
+
Project-URL: Issues, https://github.com/xuanheng-tech/context-loader/issues
|
|
210
|
+
Description-Content-Type: text/markdown
|
|
211
|
+
|
|
212
|
+
# Context Loader
|
|
213
|
+
|
|
214
|
+
Context Loader renders deterministic, bounded context for one local Git working tree.
|
|
215
|
+
The default CLI output remains Markdown; a stable JSON interface is also available for machine
|
|
216
|
+
callers. The tool reads repository state and a fixed set of root files without fetching, executing
|
|
217
|
+
repository code, network access, or writes to the target repository. Runtime code uses only the
|
|
218
|
+
Python standard library.
|
|
219
|
+
|
|
220
|
+
## Open-source quick start
|
|
221
|
+
|
|
222
|
+
Context Loader is a local CLI that exports repository context deterministically for coding-agent workflows,
|
|
223
|
+
rendering stable Markdown or JSON output.
|
|
224
|
+
|
|
225
|
+
```bash
|
|
226
|
+
uv tool install context-loader
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pip install context-loader
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
codex-project-context --repo /path/to/repo
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
```bash
|
|
238
|
+
codex-project-context --repo /path/to/repo --format json
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Install
|
|
242
|
+
|
|
243
|
+
Public stable release on PyPI: `0.1.8`.
|
|
244
|
+
|
|
245
|
+
Install via `uv`:
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
uv tool install context-loader
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Install via `pip`:
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
pip install context-loader
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
For development or source-based installs tracking current repository (`0.1.8`):
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
uv tool install git+https://github.com/xuanheng-tech/context-loader.git
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
The repository also retains `./codex-project-context` as a direct development entry point.
|
|
264
|
+
|
|
265
|
+
### Distributions
|
|
266
|
+
|
|
267
|
+
From `0.1.8` the canonical PyPI distribution is **`context-loader`**. It carries the
|
|
268
|
+
`context_loader` runtime and installs the `codex-project-context` console script; the CLI name,
|
|
269
|
+
the JSON schema version and the public contract are unchanged by the rename.
|
|
270
|
+
|
|
271
|
+
**`codex-project-context-loader`** remains published as a compatibility distribution. From
|
|
272
|
+
`0.1.8` it contains no runtime and no console script and only depends on `context-loader==0.1.8`,
|
|
273
|
+
so installing either name yields exactly one implementation and one CLI. Existing pins keep
|
|
274
|
+
working, and releases `0.1.5`-`0.1.7` of the old name are unchanged. New integrations should
|
|
275
|
+
depend on `context-loader`.
|
|
276
|
+
|
|
277
|
+
The wheel installs the runtime package only. The source distribution additionally carries
|
|
278
|
+
`tool_cli_contract.json`, so a package-only consumer can pin the declared public CLI contract
|
|
279
|
+
without cloning. The test suite, `justfile` and lockfile stay in the Git repository and are not
|
|
280
|
+
part of either distribution; run them from a checkout of the matching tag.
|
|
281
|
+
|
|
282
|
+
## Platform and Runtime Requirements
|
|
283
|
+
|
|
284
|
+
- **Python**: Python 3.12 (`>=3.12,<3.13`). Runtime code uses only the Python standard library with zero runtime dependencies.
|
|
285
|
+
- **Git**: Requires the standard `git` CLI at the fixed absolute path `/usr/bin/git`. The
|
|
286
|
+
executable is never resolved through `PATH`, so an installation elsewhere is not used and
|
|
287
|
+
every invocation fails with exit `1`. Git runs with a sanitized environment that ignores
|
|
288
|
+
system, global and per-command configuration, attributes, and hooks.
|
|
289
|
+
- **Operating System**: supported and locally tested on Ubuntu 24.04 LTS; CI also tests the
|
|
290
|
+
GitHub-hosted Ubuntu runner. Other Linux/POSIX systems are unverified, not a portability promise.
|
|
291
|
+
Windows is not supported.
|
|
292
|
+
|
|
293
|
+
Deterministic means byte-identical output for the same tool version, CLI arguments, canonical
|
|
294
|
+
repository path, readable file contents, directory entries, Git state/local refs, and relevant Git
|
|
295
|
+
configuration, with no concurrent changes. Different checkout paths, permissions, Git versions or
|
|
296
|
+
working-tree contents can change the output. The tool does not freeze a repository snapshot.
|
|
297
|
+
|
|
298
|
+
Output can contain sensitive information from the repository itself: README/instructions, declared
|
|
299
|
+
commands, paths, branch names and commit subjects. Fixed file selection and size limits are **not
|
|
300
|
+
automatic redaction**. Inspect the output before sharing it with a person or external service.
|
|
301
|
+
|
|
302
|
+
## Usage
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
codex-project-context --version
|
|
306
|
+
codex-project-context --repo /home/user/projects/example
|
|
307
|
+
codex-project-context --repo /home/user/projects/example --format markdown
|
|
308
|
+
codex-project-context --repo /home/user/projects/example --format json
|
|
309
|
+
codex-project-context --repo /home/user/projects/example \
|
|
310
|
+
--focus "Authentication and session management" \
|
|
311
|
+
--path auth/session.py
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
`--format` defaults to `markdown`. In Markdown mode, `--repo` retains the 0.1.1 contract: it must be
|
|
315
|
+
the absolute, canonical root of a non-bare Git working tree. In JSON mode, an absolute existing
|
|
316
|
+
directory inside the working tree is accepted; symlinks are normalized and the discovered root is
|
|
317
|
+
reported as `canonical_root`. Relative paths, non-Git directories, regular files, and bare
|
|
318
|
+
repositories are rejected in both modes.
|
|
319
|
+
|
|
320
|
+
`--focus` and `--path` are optional, bounded selection signals for the root `AGENTS.md`. `--path`
|
|
321
|
+
must be repository-relative. The collector does not retain either input in output or audit data.
|
|
322
|
+
Calls that omit both options remain valid and use the conservative fallback described below.
|
|
323
|
+
|
|
324
|
+
## Markdown Output
|
|
325
|
+
|
|
326
|
+
Successful repository collection uses schema `context-loader/v0.1` and emits these sections in
|
|
327
|
+
order:
|
|
328
|
+
|
|
329
|
+
1. `Git State`, including bounded working-tree changes
|
|
330
|
+
2. `Development Instructions`
|
|
331
|
+
3. `Project Overview`
|
|
332
|
+
4. `Declared Commands`
|
|
333
|
+
5. `Project Entry Files`
|
|
334
|
+
6. `Recent Commits`
|
|
335
|
+
7. `Directory Tree`
|
|
336
|
+
|
|
337
|
+
The output has no generated timestamp, AI summary, architecture inference, or diff body.
|
|
338
|
+
|
|
339
|
+
## JSON Output
|
|
340
|
+
|
|
341
|
+
`--format json` writes exactly one compact UTF-8 JSON document plus one trailing newline to stdout.
|
|
342
|
+
Keys are serialized in sorted order with `ensure_ascii=False`. The declared contract is:
|
|
343
|
+
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"schema_version": 1,
|
|
347
|
+
"tool": {
|
|
348
|
+
"name": "context-loader",
|
|
349
|
+
"version": "0.1.8"
|
|
350
|
+
},
|
|
351
|
+
"repository": {
|
|
352
|
+
"requested_path": "/canonical/requested/path",
|
|
353
|
+
"canonical_root": "/canonical/worktree/root"
|
|
354
|
+
},
|
|
355
|
+
"sources": [
|
|
356
|
+
{
|
|
357
|
+
"ordinal": 0,
|
|
358
|
+
"kind": "agents",
|
|
359
|
+
"scope": "repository",
|
|
360
|
+
"path": "/canonical/worktree/root/AGENTS.md",
|
|
361
|
+
"content_sha256": "sha256-hex",
|
|
362
|
+
"content": "actual selected source text",
|
|
363
|
+
"selection": {
|
|
364
|
+
"source": "AGENTS.md",
|
|
365
|
+
"selected_sections": [],
|
|
366
|
+
"indexed_only_sections": [],
|
|
367
|
+
"chars_selected": 0,
|
|
368
|
+
"chars_omitted": 0,
|
|
369
|
+
"truncated": false,
|
|
370
|
+
"parse_fallback": false,
|
|
371
|
+
"source_scan_truncated": false,
|
|
372
|
+
"index_truncated": false
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"context": "the same assembled Markdown context",
|
|
377
|
+
"context_sha256": "sha256-hex",
|
|
378
|
+
"warnings": []
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
`context_sha256` hashes the UTF-8 bytes of `context`; each `content_sha256` does the same for that
|
|
383
|
+
source's `content`. `sources` contains only file bodies that actually enter the final context, in
|
|
384
|
+
assembly order, after the existing newline normalization and truncation rules. `scope` distinguishes
|
|
385
|
+
`repository` from `global`; version 0.1.8's fixed root-file selection currently emits only
|
|
386
|
+
`repository` sources and does not add any global-file discovery.
|
|
387
|
+
|
|
388
|
+
The optional `selection` object is present only on a rendered `AGENTS.md` source. Its section entries
|
|
389
|
+
contain heading, heading level, and fixed selection reasons; it never contains the original focus or
|
|
390
|
+
target path. Existing source fields and schema version 1 remain unchanged.
|
|
391
|
+
|
|
392
|
+
The JSON schema version and package version are independent: `schema_version` is currently the
|
|
393
|
+
integer `1`, while `tool.version` is `0.1.8`. Callers must depend only on fields declared above.
|
|
394
|
+
The document contains no generated time or random identifier, so unchanged input produces identical
|
|
395
|
+
JSON bytes. On failure, stdout remains empty and stderr contains only a short diagnostic.
|
|
396
|
+
|
|
397
|
+
## Authority Boundary
|
|
398
|
+
|
|
399
|
+
Context Loader is a bounded transport for repository-root context, not the authority for a
|
|
400
|
+
repository's instruction hierarchy. It reads the fixed root candidates listed below, renders them
|
|
401
|
+
under explicit limits, and stops there.
|
|
402
|
+
|
|
403
|
+
Resolving an instruction hierarchy stays with the calling agent harness. That includes any
|
|
404
|
+
shared or user-level instruction file outside the repository, nested or scoped `AGENTS.md` files
|
|
405
|
+
under subdirectories, and any include or import directive written inside an instruction file:
|
|
406
|
+
such a directive is transported as literal text and is never followed. `--path` selects sections
|
|
407
|
+
of the repository-root `AGENTS.md` only; it never changes which files are read.
|
|
408
|
+
|
|
409
|
+
A successful run therefore proves that the bounded root context was collected and rendered. It
|
|
410
|
+
does not prove that every instruction applicable to a task has been loaded.
|
|
411
|
+
|
|
412
|
+
## Supported Root Files
|
|
413
|
+
|
|
414
|
+
Only these exact files directly under the Git root are eligible:
|
|
415
|
+
|
|
416
|
+
- Development instructions: `AGENTS.md`
|
|
417
|
+
- Project overview: `README.md`
|
|
418
|
+
- Entry files, in fixed order: `pyproject.toml`, `justfile` or `Justfile`, `package.json`,
|
|
419
|
+
`Makefile`, `Cargo.toml`, and `go.mod`
|
|
420
|
+
|
|
421
|
+
Lowercase `justfile` takes precedence over `Justfile`. Nested files, lockfiles, CI configuration,
|
|
422
|
+
`.env`, and glob-discovered files are not read.
|
|
423
|
+
|
|
424
|
+
A leading UTF-8 byte order mark is removed from the root `AGENTS.md` before parsing, so a
|
|
425
|
+
heading on the first line is still recognized as a heading.
|
|
426
|
+
|
|
427
|
+
The root `AGENTS.md` is split at Markdown headings outside fenced code blocks. The output always
|
|
428
|
+
starts with complete early sections fitting a 4-KiB head, then adds complete relevant sections in
|
|
429
|
+
source order using exact normalized focus/path tokens and their parent context. Remaining headings
|
|
430
|
+
appear in an explicit index whose body text is not loaded. With no selection signals, only the small
|
|
431
|
+
head and index are emitted. Unsafe heading parsing falls back to a bounded head and an explicit
|
|
432
|
+
manual-recovery notice. A head whose own headings would not fit the budget falls back to the same
|
|
433
|
+
bounded head without a section index; a single instruction file never fails the whole collection.
|
|
434
|
+
|
|
435
|
+
`Omitted source characters` is measured against the whole normalized source, so a bounded source
|
|
436
|
+
scan that ends before EOF still reports the characters it could not select.
|
|
437
|
+
|
|
438
|
+
## Limits
|
|
439
|
+
|
|
440
|
+
- Final stdout: 98,304 bytes
|
|
441
|
+
- `AGENTS.md`: 256-KiB bounded source scan; selected source plus selection audit remains at most
|
|
442
|
+
16 KiB, including a 4-KiB maximum small head
|
|
443
|
+
- `README.md`: 16 KiB
|
|
444
|
+
- Each entry file: 8 KiB
|
|
445
|
+
- All entry-file bodies: 24 KiB
|
|
446
|
+
- Declared commands: 8 KiB
|
|
447
|
+
- Directory tree: 12 KiB, 300 entries, and depth 2
|
|
448
|
+
- Working-tree changes: 100 paths and 4 KiB
|
|
449
|
+
- Recent commits: 8
|
|
450
|
+
|
|
451
|
+
Truncation occurs only at complete UTF-8 and line boundaries and is marked explicitly.
|
|
452
|
+
These are output/capture limits. Eligible regular files are still streamed to EOF to validate UTF-8
|
|
453
|
+
and reject NUL bytes, including beyond the captured prefix; a large file can therefore take longer
|
|
454
|
+
to read. Symlinked candidate files are skipped, and directory symlinks are not traversed.
|
|
455
|
+
|
|
456
|
+
## Git State Semantics
|
|
457
|
+
|
|
458
|
+
Git state is derived only from the working tree and local refs. The command does not fetch or query
|
|
459
|
+
the remote.
|
|
460
|
+
|
|
461
|
+
- An unborn working tree reports its symbolic branch name, such as `Branch: main`, and
|
|
462
|
+
`HEAD: unborn`.
|
|
463
|
+
- A detached HEAD reports `Branch: detached` and the resolved commit object ID.
|
|
464
|
+
- `Upstream` is the current branch's configured tracking target. Without one,
|
|
465
|
+
`Upstream: not configured` is used.
|
|
466
|
+
- A configured target such as `origin/main` may be shown before its commit is resolvable locally;
|
|
467
|
+
this is normal after cloning an empty remote.
|
|
468
|
+
- `Ahead / behind: not available` means the commit relationship cannot currently be computed.
|
|
469
|
+
Counts are reported only when the configured upstream commit is available locally.
|
|
470
|
+
|
|
471
|
+
## Exit Codes
|
|
472
|
+
|
|
473
|
+
- `0`: context or version output completed successfully
|
|
474
|
+
- `1`: required Git collection or an internal operation failed
|
|
475
|
+
- `2`: command arguments or the repository path do not satisfy the contract
|
|
476
|
+
|
|
477
|
+
On nonzero exit, stdout is empty and a bounded diagnostic is written to stderr without a traceback
|
|
478
|
+
or candidate-file content.
|
|
479
|
+
|
|
480
|
+
## Not Included
|
|
481
|
+
|
|
482
|
+
Version 0.1.8 does not provide AI summaries, project-type detection, nested `AGENTS.md` handling,
|
|
483
|
+
Memory retrieval, semantic ranking, ignore-rule parsing, plugins, profiles, caches, databases,
|
|
484
|
+
network services, MCP, daemons, GUIs, CI/CD, telemetry, or automatic updates.
|
|
485
|
+
|
|
486
|
+
## Development
|
|
487
|
+
|
|
488
|
+
Run the complete local check:
|
|
489
|
+
|
|
490
|
+
```bash
|
|
491
|
+
just check
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
## Version maintenance
|
|
495
|
+
|
|
496
|
+
The versions in `pyproject.toml` and `context_loader/__init__.py`, the matching `CHANGELOG.md`
|
|
497
|
+
section, and required tests must change in the same release-preparation batch. `CHANGELOG.md` is the
|
|
498
|
+
authoritative version-change record. Merging to `master` is not a release; formal publication
|
|
499
|
+
still requires a separately created and pushed tag.
|
|
500
|
+
|
|
501
|
+
## Release closure and retries
|
|
502
|
+
|
|
503
|
+
GitHub `ci` and Gitea `quality` both use `just check`. GitHub `publish-pypi.yml` is the only
|
|
504
|
+
package build/upload authority, using the `pypi` environment and OIDC Trusted Publishing.
|
|
505
|
+
GitHub `release-record` closes the GitHub Release after package publication. Gitea `release`
|
|
506
|
+
only verifies the public release, mirrors its exact formal tag object if missing, and closes
|
|
507
|
+
the Gitea Release record. It builds no package and has no PyPI publishing credentials.
|
|
508
|
+
No private endpoint or credential is needed on GitHub.
|
|
509
|
+
|
|
510
|
+
Release checks use Python 3.12, Git, and the runner's existing OpenSSL CLI. They compare downloaded
|
|
511
|
+
PyPI file bytes, metadata and SHA-256, plus the publisher/tag/commit claims in PyPI's HTTPS-served
|
|
512
|
+
provenance. This is an identity check, not an independent cryptographic Sigstore verifier.
|
|
513
|
+
|
|
514
|
+
- Tag/version or expected-commit mismatch and `just check` failure stop before build/upload.
|
|
515
|
+
- The build refuses to run unless `dist/` is empty, and refuses any produced file set other than
|
|
516
|
+
the current version's wheel and sdist. A leftover artifact can carry a release filename while
|
|
517
|
+
holding different bytes, so it is never treated as the current release.
|
|
518
|
+
- A complete matching PyPI version skips both build and upload. Missing/conflicting provenance,
|
|
519
|
+
unexpected files or differing hashes stop; existing files are never overwritten.
|
|
520
|
+
- Release closure runs right after publication, so `record`, `verify` and the Gitea sync poll the
|
|
521
|
+
PyPI index and integrity endpoints for a bounded period before treating a version as missing.
|
|
522
|
+
Build and upload selection never poll: there, an absent version still means "not yet published".
|
|
523
|
+
- A refused release API call reports the bounded server message alongside its status code. A
|
|
524
|
+
GitHub Release is created against the release commit, so that commit must already be reachable
|
|
525
|
+
from the public branch; pushing the release commit to the public branch precedes record closure.
|
|
526
|
+
- If an upload stopped after one file, rerun the **original failed publish job** while its original
|
|
527
|
+
`dist` artifact is available. It compares the original bytes and selects only missing files.
|
|
528
|
+
A full rebuild is refused for an incomplete PyPI file set. If the original artifact is gone,
|
|
529
|
+
stop for recovery; do not substitute a fresh build.
|
|
530
|
+
- If PyPI succeeded but a Release failed, rerun `release-record` on GitHub (manual input: tag)
|
|
531
|
+
and `release` on Gitea. Existing matching records pass; a missing record is created once;
|
|
532
|
+
a draft, differing recorded identity or tag conflict stops without overwriting it.
|
|
533
|
+
- Gitea also retries the current project version on `master` pushes, only after that version has
|
|
534
|
+
a public tag, verified PyPI files and GitHub Release. An unpublished version reports `SKIP`.
|
|
535
|
+
Use the **built-in Actions job token** for exact missing-tag synchronization: Gitea suppresses
|
|
536
|
+
recursive workflows for that actor, including old tag workflows. Never use a PAT for this step.
|
|
537
|
+
- Keep historical/private tags and archive refs private. Never mirror all refs or push all tags.
|
|
538
|
+
|
|
539
|
+
Release verification reads the public GitHub API with `PUBLIC_GITHUB_TOKEN` when it is set, as CI
|
|
540
|
+
does. A local caller without that variable falls back to the credential an authenticated
|
|
541
|
+
[GitHub CLI](https://cli.github.com/) already holds, keeping verification authenticated and clear
|
|
542
|
+
of the unauthenticated rate limit without this repository storing a token. With neither available
|
|
543
|
+
the calls stay unauthenticated and may be rate limited; the reported API message names that cause.
|
|
544
|
+
|
|
545
|
+
For each formal version, verify both platforms separately (the Gitea API URL and `RELEASE_TOKEN`
|
|
546
|
+
come from the caller's private environment):
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
python scripts/release.py verify vX.Y.Z
|
|
550
|
+
python scripts/release.py verify vX.Y.Z --platform gitea \
|
|
551
|
+
--api-url "$GITEA_API_URL" --repository "$GITEA_REPOSITORY"
|
|
552
|
+
```
|
|
553
|
+
|
|
554
|
+
Each check reports tag commit, PyPI file identities and the selected Release ID. Git Finalizer's
|
|
555
|
+
`remote_verified` describes branch publication only; report package/release verification separately.
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
context_loader/__init__.py,sha256=Hu-WxbNvWsgVxYe2MSDJaNDhCRyy3ovq2TmNSJEXkvc,59
|
|
2
|
+
context_loader/application.py,sha256=la-541-ueFTr3fxvc81ye5LuUH_3mYrgKrP8jMcAP7Q,6048
|
|
3
|
+
context_loader/cli.py,sha256=LtBBLf8c9S_ALFfw7fwKu3ckbFiJRAfEtur782Y-Dic,2327
|
|
4
|
+
context_loader/collect.py,sha256=KD4S5uXf5TV3CmKh95MA_pCSug-cENXpTD9FtmacoHM,34687
|
|
5
|
+
context_loader/git.py,sha256=uaf5Y7teI9mSm_ItT5OROSP_aNS_Ye-0X24Cu9k5Igo,11558
|
|
6
|
+
context_loader/render.py,sha256=3Ia3TgMh43Ps89iHNba4_yjK_wH-Q5z6z6JIwtqtrDY,13143
|
|
7
|
+
context_loader-0.1.8.dist-info/WHEEL,sha256=4OL6Foqnnp3xRY5wMkjgc25_i5YJC6dKsC6LPcjqEoU,80
|
|
8
|
+
context_loader-0.1.8.dist-info/entry_points.txt,sha256=YbEA5apTKBenAc3VzguUmPpFAQuZcQk03HgzqpH4Y3I,67
|
|
9
|
+
context_loader-0.1.8.dist-info/METADATA,sha256=aVxe2_4VMVZIO8CZUwNabnRQI_0rsjeaxkXEQPjGIuc,29915
|
|
10
|
+
context_loader-0.1.8.dist-info/RECORD,,
|