context-loader 1.3.9__tar.gz → 1.3.10__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.
@@ -0,0 +1,221 @@
1
+ Metadata-Version: 2.4
2
+ Name: context-loader
3
+ Version: 1.3.10
4
+ Summary: Render deterministic local Git context for any executor
5
+ License-Expression: Apache-2.0
6
+ License-File: LICENSE
7
+ Requires-Python: >=3.12, <3.15
8
+ Project-URL: Repository, https://github.com/xuanheng-tech/context-loader
9
+ Project-URL: Issues, https://github.com/xuanheng-tech/context-loader/issues
10
+ Description-Content-Type: text/markdown
11
+
12
+ # Context Loader
13
+
14
+ Context Loader renders deterministic, bounded context for one local Git working tree.
15
+ The default CLI output remains Markdown; a stable JSON interface is also available for machine
16
+ callers. The tool reads repository state and a fixed set of root files without fetching, executing
17
+ repository code, network access, or writes to the target repository. Runtime code uses only the
18
+ Python standard library.
19
+
20
+ ## Open-source quick start
21
+
22
+ Current stable release: **1.3.10**. Local CLI for coding-agent workflows; renders deterministic Markdown or JSON.
23
+
24
+ ```bash
25
+ uv tool install 'context-loader==1.3.10'
26
+ ```
27
+
28
+ ```bash
29
+ pip install 'context-loader==1.3.10'
30
+ ```
31
+
32
+ ```bash
33
+ project-context --repo /path/to/repo
34
+ ```
35
+
36
+ ```bash
37
+ project-context --repo /path/to/repo --format json
38
+ ```
39
+
40
+ ## Install
41
+
42
+ Source version: `1.3.10`. Install its matching published release or an exact source commit.
43
+
44
+ Install via `uv`:
45
+
46
+ ```bash
47
+ uv tool install 'context-loader==1.3.10'
48
+ ```
49
+
50
+ Install via `pip`:
51
+
52
+ ```bash
53
+ pip install 'context-loader==1.3.10'
54
+ ```
55
+
56
+ For development or source-based installs tracking current repository (`1.3.10`):
57
+
58
+ ```bash
59
+ uv tool install git+https://github.com/xuanheng-tech/context-loader.git
60
+ ```
61
+
62
+ The repository also retains `./project-context` as a direct development entry point.
63
+
64
+ ### Distributions
65
+
66
+ The sole distribution is **`context-loader`**, containing the `context_loader` runtime
67
+ and the `project-context` console script. Version `1.0.0` broke the CLI name and Markdown
68
+ heading contract while leaving the then-current JSON schema unchanged. Terminal and any executor call this same
69
+ entry point with explicit repository and focus arguments; no provider adapter or private
70
+ session state is involved.
71
+
72
+ Previously published packages and historical release records remain unchanged. The new
73
+ release publishes no compatibility distribution or legacy executable alias.
74
+
75
+ The wheel installs the runtime package only. The source distribution additionally carries
76
+ `tool_cli_contract.json`, so a package-only consumer can pin the declared public CLI contract
77
+ without cloning. The test suite, `justfile` and lockfile stay in the Git repository and are not
78
+ part of either distribution; run them from a checkout of the matching tag.
79
+
80
+ ## Platform and Runtime Requirements
81
+
82
+ - **Python**: Python 3.12–3.14 (`>=3.12,<3.15`). Runtime code uses only the Python standard library with zero runtime dependencies.
83
+ - **Git**: Requires the standard `git` CLI at the fixed absolute path `/usr/bin/git`. The
84
+ executable is never resolved through `PATH`, so an installation elsewhere is not used and
85
+ every invocation fails with exit `1`. Git runs with a sanitized environment that ignores
86
+ system, global and per-command configuration, attributes, and hooks.
87
+ - **Operating System**: supported and locally tested on Ubuntu 24.04 LTS; CI also tests the
88
+ GitHub-hosted Ubuntu runner. Other Linux/POSIX systems are unverified, not a portability promise.
89
+ Windows is not supported.
90
+
91
+ Deterministic means byte-identical output for the same tool version, CLI arguments, canonical
92
+ repository path, readable file contents, directory entries, Git state/local refs, and relevant Git
93
+ configuration, with no concurrent changes. Different checkout paths, permissions, Git versions or
94
+ working-tree contents can change the output. The tool does not freeze a repository snapshot.
95
+
96
+ Output can contain sensitive information from the repository itself: README/instructions, declared
97
+ commands, paths, branch names and commit subjects. Fixed file selection and size limits are **not
98
+ automatic redaction**. Inspect the output before sharing it with a person or external service.
99
+
100
+ ## Usage
101
+
102
+ ```bash
103
+ project-context --version
104
+ project-context --repo /home/user/projects/example
105
+ project-context --repo /home/user/projects/example --format markdown
106
+ project-context --repo /home/user/projects/example --format json
107
+ project-context --repo /home/user/projects/example --format json-compact
108
+ project-context --repo /home/user/projects/example \
109
+ --focus "Authentication and session management" \
110
+ --path auth/session.py
111
+ ```
112
+
113
+ `--format` defaults to `markdown`. In Markdown mode, `--repo` retains the 0.1.1 contract: it must be
114
+ the absolute, canonical root of a non-bare Git working tree. In the `json` and `json-compact` modes,
115
+ an absolute existing directory inside the working tree is accepted; symlinks are normalized and the
116
+ discovered root is reported as `canonical_root`. Relative paths, non-Git directories, regular files,
117
+ and bare repositories are rejected in every mode.
118
+
119
+ `--focus` and `--path` are optional, bounded selection signals for the root `AGENTS.md`. `--path`
120
+ must be repository-relative. The collector does not retain either input in output or audit data.
121
+ Calls that omit both options remain valid and use the conservative fallback described in
122
+ [Supported Root Files](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md#supported-root-files).
123
+ Each value option (`--repo`, `--focus`, `--path`, `--format`) may be supplied once;
124
+ duplicates are rejected before collection rather than silently overriding an earlier value.
125
+
126
+ ## Markdown Output
127
+
128
+ Successful repository collection uses schema `context-loader/v0.1` and emits these sections in
129
+ order:
130
+
131
+ 1. `Git State`, including bounded working-tree changes
132
+ 2. `Development Instructions`
133
+ 3. `Project Overview`
134
+ 4. `Declared Commands`
135
+ 5. `Project Entry Files`
136
+ 6. `Recent Commits`
137
+ 7. `Directory Tree`
138
+
139
+ The output has no generated timestamp, AI summary, architecture inference, or diff body.
140
+ The Markdown CLI skips the nested-instruction presence scan, which contributes only to
141
+ the machine formats; this does not change Markdown content or its byte budgets.
142
+
143
+ ## JSON Output
144
+
145
+ `--format json` writes one sorted, separator-compact UTF-8 JSON document (`schema_version` 3);
146
+ `--format json-compact` writes the same document without `sources[*].content` (`schema_version`
147
+ 4). Field definitions, compact-consumption guidance and schema-version rules are in
148
+ [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md#json-output).
149
+
150
+ ## Authority Boundary
151
+
152
+ Context Loader is a bounded transport for repository-root context, not the authority for a
153
+ repository's instruction hierarchy. It reads the fixed root candidates listed below, renders them
154
+ under explicit limits, and stops there.
155
+
156
+ Resolving an instruction hierarchy stays with the calling agent harness. That includes any
157
+ shared or user-level instruction file outside the repository, nested or scoped `AGENTS.md` files
158
+ under subdirectories, and any include or import directive written inside an instruction file:
159
+ such a directive is transported as literal text and is never followed. `--path` selects sections
160
+ of the repository-root `AGENTS.md` only; it never changes which files are read. The JSON-only
161
+ `nested_context` field reports the existence of nested `AGENTS.md` paths without reading them;
162
+ deciding whether any of them applies stays with the calling agent harness exactly as before.
163
+
164
+ A successful run therefore proves that the bounded root context was collected and rendered. It
165
+ does not prove that every instruction applicable to a task has been loaded.
166
+
167
+ ## Inputs, limits and Git semantics
168
+
169
+ The exact root files read, every output and capture bound, and how Git state is derived are
170
+ documented in [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md).
171
+
172
+ ## Exit Codes
173
+
174
+ - `0`: context or version output completed successfully
175
+ - `1`: required Git collection or an internal operation failed
176
+ - `2`: command arguments or the repository path do not satisfy the contract
177
+
178
+ On nonzero exit, stdout is empty and a bounded diagnostic is written to stderr without a traceback
179
+ or candidate-file content.
180
+
181
+ ## Not Included
182
+
183
+ Version 1.3.10 does not provide AI summaries, project-type detection, loading or transport of
184
+ nested `AGENTS.md` contents (the JSON `nested_context` field reports bounded existence only),
185
+ Memory retrieval, semantic ranking, ignore-rule parsing, plugins, profiles, caches, databases,
186
+ network services, MCP, daemons, GUIs, CI/CD, telemetry, or automatic updates.
187
+
188
+ ## Development
189
+
190
+ Run the complete local check:
191
+
192
+ ```bash
193
+ just check
194
+ ```
195
+
196
+ The shared check also builds a wheel and installs it into a fresh virtual environment. Package
197
+ acceptance runs the installed CLI outside the source checkout, checking deterministic agreement
198
+ between all three formats, linked worktrees, long multi-module instructions with focus/path selection,
199
+ explicit truncation and nested-instruction presence, and safe failures. Build and installation run offline
200
+ using the backend cache populated by `uv run --frozen`; the tests use only disposable repositories.
201
+ Git deadline regressions verify that silent, streaming, and stdout-closed child processes are
202
+ terminated and reaped, that successful commands cannot reset the shared budget, and that process
203
+ creation consumes it. A timeout leaves CLI stdout empty in every output format.
204
+
205
+ The lockfile uses public PyPI artifact URLs; no organization mirror or local Renovate preset
206
+ is needed. Renovate keeps scheduled, rate-limited updates and manual merges using a public
207
+ recommended preset plus the repository's explicit settings. The GitHub quality gate runs on
208
+ Python 3.12.13, 3.13.13 and 3.14.5; the Gitea root-runner gate and release builds use 3.12.13.
209
+ Other interpreter/platform combinations require validation before widening the supported range.
210
+
211
+ Git test fixtures discard inherited `GIT_*` routing/configuration before creating repositories.
212
+ Permission-sensitive tests must run as a non-root user. Gitea uses `just ci-check`, which installs
213
+ Python 3.12.13 without user-level executable links and keeps its interpreter/cache under
214
+ `$RUNNER_TEMP/context-loader-ci` (or ignored `.ci-runtime/context-loader-ci` locally).
215
+ Non-root runners execute directly; root containers transfer ownership of that runtime and the
216
+ checkout, then use `runuser` with an existing account named by `CONTEXT_LOADER_CI_USER` (default
217
+ `ubuntu`). That account must be able to execute the installed `uv` and `just`; it does not need
218
+ access to `/root` or a root-owned Python/cache. No `sudo` dependency is required for this CI step.
219
+
220
+ Performance baselines, version maintenance and release closure/recovery procedures are in
221
+ [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md).
@@ -0,0 +1,210 @@
1
+ # Context Loader
2
+
3
+ Context Loader renders deterministic, bounded context for one local Git working tree.
4
+ The default CLI output remains Markdown; a stable JSON interface is also available for machine
5
+ callers. The tool reads repository state and a fixed set of root files without fetching, executing
6
+ repository code, network access, or writes to the target repository. Runtime code uses only the
7
+ Python standard library.
8
+
9
+ ## Open-source quick start
10
+
11
+ Current stable release: **1.3.10**. Local CLI for coding-agent workflows; renders deterministic Markdown or JSON.
12
+
13
+ ```bash
14
+ uv tool install 'context-loader==1.3.10'
15
+ ```
16
+
17
+ ```bash
18
+ pip install 'context-loader==1.3.10'
19
+ ```
20
+
21
+ ```bash
22
+ project-context --repo /path/to/repo
23
+ ```
24
+
25
+ ```bash
26
+ project-context --repo /path/to/repo --format json
27
+ ```
28
+
29
+ ## Install
30
+
31
+ Source version: `1.3.10`. Install its matching published release or an exact source commit.
32
+
33
+ Install via `uv`:
34
+
35
+ ```bash
36
+ uv tool install 'context-loader==1.3.10'
37
+ ```
38
+
39
+ Install via `pip`:
40
+
41
+ ```bash
42
+ pip install 'context-loader==1.3.10'
43
+ ```
44
+
45
+ For development or source-based installs tracking current repository (`1.3.10`):
46
+
47
+ ```bash
48
+ uv tool install git+https://github.com/xuanheng-tech/context-loader.git
49
+ ```
50
+
51
+ The repository also retains `./project-context` as a direct development entry point.
52
+
53
+ ### Distributions
54
+
55
+ The sole distribution is **`context-loader`**, containing the `context_loader` runtime
56
+ and the `project-context` console script. Version `1.0.0` broke the CLI name and Markdown
57
+ heading contract while leaving the then-current JSON schema unchanged. Terminal and any executor call this same
58
+ entry point with explicit repository and focus arguments; no provider adapter or private
59
+ session state is involved.
60
+
61
+ Previously published packages and historical release records remain unchanged. The new
62
+ release publishes no compatibility distribution or legacy executable alias.
63
+
64
+ The wheel installs the runtime package only. The source distribution additionally carries
65
+ `tool_cli_contract.json`, so a package-only consumer can pin the declared public CLI contract
66
+ without cloning. The test suite, `justfile` and lockfile stay in the Git repository and are not
67
+ part of either distribution; run them from a checkout of the matching tag.
68
+
69
+ ## Platform and Runtime Requirements
70
+
71
+ - **Python**: Python 3.12–3.14 (`>=3.12,<3.15`). Runtime code uses only the Python standard library with zero runtime dependencies.
72
+ - **Git**: Requires the standard `git` CLI at the fixed absolute path `/usr/bin/git`. The
73
+ executable is never resolved through `PATH`, so an installation elsewhere is not used and
74
+ every invocation fails with exit `1`. Git runs with a sanitized environment that ignores
75
+ system, global and per-command configuration, attributes, and hooks.
76
+ - **Operating System**: supported and locally tested on Ubuntu 24.04 LTS; CI also tests the
77
+ GitHub-hosted Ubuntu runner. Other Linux/POSIX systems are unverified, not a portability promise.
78
+ Windows is not supported.
79
+
80
+ Deterministic means byte-identical output for the same tool version, CLI arguments, canonical
81
+ repository path, readable file contents, directory entries, Git state/local refs, and relevant Git
82
+ configuration, with no concurrent changes. Different checkout paths, permissions, Git versions or
83
+ working-tree contents can change the output. The tool does not freeze a repository snapshot.
84
+
85
+ Output can contain sensitive information from the repository itself: README/instructions, declared
86
+ commands, paths, branch names and commit subjects. Fixed file selection and size limits are **not
87
+ automatic redaction**. Inspect the output before sharing it with a person or external service.
88
+
89
+ ## Usage
90
+
91
+ ```bash
92
+ project-context --version
93
+ project-context --repo /home/user/projects/example
94
+ project-context --repo /home/user/projects/example --format markdown
95
+ project-context --repo /home/user/projects/example --format json
96
+ project-context --repo /home/user/projects/example --format json-compact
97
+ project-context --repo /home/user/projects/example \
98
+ --focus "Authentication and session management" \
99
+ --path auth/session.py
100
+ ```
101
+
102
+ `--format` defaults to `markdown`. In Markdown mode, `--repo` retains the 0.1.1 contract: it must be
103
+ the absolute, canonical root of a non-bare Git working tree. In the `json` and `json-compact` modes,
104
+ an absolute existing directory inside the working tree is accepted; symlinks are normalized and the
105
+ discovered root is reported as `canonical_root`. Relative paths, non-Git directories, regular files,
106
+ and bare repositories are rejected in every mode.
107
+
108
+ `--focus` and `--path` are optional, bounded selection signals for the root `AGENTS.md`. `--path`
109
+ must be repository-relative. The collector does not retain either input in output or audit data.
110
+ Calls that omit both options remain valid and use the conservative fallback described in
111
+ [Supported Root Files](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md#supported-root-files).
112
+ Each value option (`--repo`, `--focus`, `--path`, `--format`) may be supplied once;
113
+ duplicates are rejected before collection rather than silently overriding an earlier value.
114
+
115
+ ## Markdown Output
116
+
117
+ Successful repository collection uses schema `context-loader/v0.1` and emits these sections in
118
+ order:
119
+
120
+ 1. `Git State`, including bounded working-tree changes
121
+ 2. `Development Instructions`
122
+ 3. `Project Overview`
123
+ 4. `Declared Commands`
124
+ 5. `Project Entry Files`
125
+ 6. `Recent Commits`
126
+ 7. `Directory Tree`
127
+
128
+ The output has no generated timestamp, AI summary, architecture inference, or diff body.
129
+ The Markdown CLI skips the nested-instruction presence scan, which contributes only to
130
+ the machine formats; this does not change Markdown content or its byte budgets.
131
+
132
+ ## JSON Output
133
+
134
+ `--format json` writes one sorted, separator-compact UTF-8 JSON document (`schema_version` 3);
135
+ `--format json-compact` writes the same document without `sources[*].content` (`schema_version`
136
+ 4). Field definitions, compact-consumption guidance and schema-version rules are in
137
+ [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md#json-output).
138
+
139
+ ## Authority Boundary
140
+
141
+ Context Loader is a bounded transport for repository-root context, not the authority for a
142
+ repository's instruction hierarchy. It reads the fixed root candidates listed below, renders them
143
+ under explicit limits, and stops there.
144
+
145
+ Resolving an instruction hierarchy stays with the calling agent harness. That includes any
146
+ shared or user-level instruction file outside the repository, nested or scoped `AGENTS.md` files
147
+ under subdirectories, and any include or import directive written inside an instruction file:
148
+ such a directive is transported as literal text and is never followed. `--path` selects sections
149
+ of the repository-root `AGENTS.md` only; it never changes which files are read. The JSON-only
150
+ `nested_context` field reports the existence of nested `AGENTS.md` paths without reading them;
151
+ deciding whether any of them applies stays with the calling agent harness exactly as before.
152
+
153
+ A successful run therefore proves that the bounded root context was collected and rendered. It
154
+ does not prove that every instruction applicable to a task has been loaded.
155
+
156
+ ## Inputs, limits and Git semantics
157
+
158
+ The exact root files read, every output and capture bound, and how Git state is derived are
159
+ documented in [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md).
160
+
161
+ ## Exit Codes
162
+
163
+ - `0`: context or version output completed successfully
164
+ - `1`: required Git collection or an internal operation failed
165
+ - `2`: command arguments or the repository path do not satisfy the contract
166
+
167
+ On nonzero exit, stdout is empty and a bounded diagnostic is written to stderr without a traceback
168
+ or candidate-file content.
169
+
170
+ ## Not Included
171
+
172
+ Version 1.3.10 does not provide AI summaries, project-type detection, loading or transport of
173
+ nested `AGENTS.md` contents (the JSON `nested_context` field reports bounded existence only),
174
+ Memory retrieval, semantic ranking, ignore-rule parsing, plugins, profiles, caches, databases,
175
+ network services, MCP, daemons, GUIs, CI/CD, telemetry, or automatic updates.
176
+
177
+ ## Development
178
+
179
+ Run the complete local check:
180
+
181
+ ```bash
182
+ just check
183
+ ```
184
+
185
+ The shared check also builds a wheel and installs it into a fresh virtual environment. Package
186
+ acceptance runs the installed CLI outside the source checkout, checking deterministic agreement
187
+ between all three formats, linked worktrees, long multi-module instructions with focus/path selection,
188
+ explicit truncation and nested-instruction presence, and safe failures. Build and installation run offline
189
+ using the backend cache populated by `uv run --frozen`; the tests use only disposable repositories.
190
+ Git deadline regressions verify that silent, streaming, and stdout-closed child processes are
191
+ terminated and reaped, that successful commands cannot reset the shared budget, and that process
192
+ creation consumes it. A timeout leaves CLI stdout empty in every output format.
193
+
194
+ The lockfile uses public PyPI artifact URLs; no organization mirror or local Renovate preset
195
+ is needed. Renovate keeps scheduled, rate-limited updates and manual merges using a public
196
+ recommended preset plus the repository's explicit settings. The GitHub quality gate runs on
197
+ Python 3.12.13, 3.13.13 and 3.14.5; the Gitea root-runner gate and release builds use 3.12.13.
198
+ Other interpreter/platform combinations require validation before widening the supported range.
199
+
200
+ Git test fixtures discard inherited `GIT_*` routing/configuration before creating repositories.
201
+ Permission-sensitive tests must run as a non-root user. Gitea uses `just ci-check`, which installs
202
+ Python 3.12.13 without user-level executable links and keeps its interpreter/cache under
203
+ `$RUNNER_TEMP/context-loader-ci` (or ignored `.ci-runtime/context-loader-ci` locally).
204
+ Non-root runners execute directly; root containers transfer ownership of that runtime and the
205
+ checkout, then use `runuser` with an existing account named by `CONTEXT_LOADER_CI_USER` (default
206
+ `ubuntu`). That account must be able to execute the installed `uv` and `just`; it does not need
207
+ access to `/root` or a root-owned Python/cache. No `sudo` dependency is required for this CI step.
208
+
209
+ Performance baselines, version maintenance and release closure/recovery procedures are in
210
+ [docs/reference.md](https://github.com/xuanheng-tech/context-loader/blob/HEAD/docs/reference.md).
@@ -1,3 +1,3 @@
1
1
  """Project Context Loader."""
2
2
 
3
- __version__ = "1.3.9"
3
+ __version__ = "1.3.10"
@@ -4,15 +4,14 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "context-loader"
7
- version = "1.3.9"
7
+ version = "1.3.10"
8
8
  description = "Render deterministic local Git context for any executor"
9
+ license = "Apache-2.0"
10
+ license-files = ["LICENSE"]
9
11
  readme = "README.md"
10
12
  requires-python = ">=3.12,<3.15"
11
13
  dependencies = []
12
14
 
13
- [project.license]
14
- file = "LICENSE"
15
-
16
15
  [project.scripts]
17
16
  project-context = "context_loader.cli:main"
18
17
 
@@ -4,9 +4,10 @@ build-backend = "uv_build"
4
4
 
5
5
  [project]
6
6
  name = "context-loader"
7
- version = "1.3.9"
7
+ version = "1.3.10"
8
8
  description = "Render deterministic local Git context for any executor"
9
- license = { file = "LICENSE" }
9
+ license = "Apache-2.0"
10
+ license-files = ["LICENSE"]
10
11
  readme = "README.md"
11
12
  requires-python = ">=3.12,<3.15"
12
13
  dependencies = []
@@ -46,5 +46,5 @@
46
46
  ],
47
47
  "schema_version": 1,
48
48
  "tool_name": "context-loader",
49
- "tool_version": "1.3.9"
49
+ "tool_version": "1.3.10"
50
50
  }