sourcepack 1.10.0a0__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.
@@ -0,0 +1,311 @@
1
+ Metadata-Version: 2.4
2
+ Name: sourcepack
3
+ Version: 1.10.0a0
4
+ Summary: Local-first guardrail for unsupported AI repository assumptions before commit.
5
+ License-Expression: MIT
6
+ Keywords: ai,git,developer-tools,guardrails,local-first
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.11
12
+ Classifier: Topic :: Software Development :: Quality Assurance
13
+ Requires-Python: >=3.11
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Dynamic: license-file
17
+
18
+ <img width="1800" height="620" alt="sourcepack-hero" src="https://github.com/user-attachments/assets/9b4af0df-1cfc-4aa8-8eb1-f673e6eb2e52" />
19
+
20
+ AI coding tools can edit files, add imports, invent commands, or assume project structure that is not actually present. SourcePack checks AI-generated repo changes against trusted local repo evidence before commit.
21
+
22
+ ## Badges
23
+
24
+ ![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)
25
+ ![Package: local editable](https://img.shields.io/badge/package-local%20editable-blue)
26
+
27
+ ## Quick demo
28
+
29
+ A small RED case: an AI change imports `fastapi`, but the repository does not declare `fastapi` in its dependency files.
30
+
31
+ ```bash
32
+ $ sourcepack init . --auto
33
+ $ printf 'from fastapi import FastAPI\n' > app.py
34
+ $ git add app.py
35
+ $ git commit -m "add API"
36
+ RED LIGHT: commit blocked
37
+ unsupported_dependency: app.py imports fastapi, but fastapi is not declared.
38
+
39
+ Fix:
40
+ - add fastapi intentionally to pyproject.toml
41
+ - or remove the import
42
+ - run sourcepack report open for details
43
+ ```
44
+
45
+ Then inspect the human report:
46
+
47
+ ```bash
48
+ sourcepack report open
49
+ ```
50
+
51
+ ## Product screenshot section
52
+
53
+ Screenshot assets are generated from deterministic golden demo outputs and should be committed at these paths when refreshed:
54
+
55
+ - `docs/assets/sourcepack-terminal-red.png` — terminal output from `fail-unsupported-dependency`.
56
+ - `docs/assets/sourcepack-red-report.png` — HTML report from `fail-unsupported-dependency`.
57
+ - `docs/assets/sourcepack-warn-report.png` — HTML report from `warn-new-file`.
58
+ - `docs/assets/sourcepack-pass-report.png` — HTML report from `pass-clean`.
59
+
60
+ See [`docs/assets/README.md`](docs/assets/README.md) for exact capture instructions. If these image files are absent, the paths above are expected screenshot targets, not claimed live screenshots.
61
+
62
+ ## Install
63
+
64
+ Current local editable install:
65
+
66
+ ```bash
67
+ python -m pip install -e .
68
+ ```
69
+
70
+ SourcePack is not documented here as a published PyPI package. Planned package install commands such as `pipx install sourcepack`, `uv tool install sourcepack`, or `pip install sourcepack` should only be advertised after publication is true from release metadata.
71
+
72
+ ## Quick start
73
+
74
+ ```bash
75
+ sourcepack init . --auto
76
+ # make or receive AI changes
77
+ sourcepack diff .
78
+ sourcepack report open
79
+ # if accepted, continue with normal git commit
80
+ git commit -m "your change"
81
+ ```
82
+
83
+ Local policy:
84
+
85
+ - PASS exits `0`.
86
+ - WARN exits `0` locally.
87
+ - WARN exits nonzero with `--strict` or `--ci`.
88
+ - FAIL exits nonzero.
89
+
90
+ ## How SourcePack works
91
+
92
+ SourcePack keeps trusted repo evidence separate from AI guidance:
93
+
94
+ - Baseline = the last trusted repo state.
95
+ - Prompt context = AI guidance only.
96
+ - Prompt context never becomes trust.
97
+ - `sourcepack diff` checks actual repo changes against the baseline.
98
+
99
+ Without baseline/prompt separation:
100
+
101
+ - AI prompt context says `deploy.sh` exists and uses port `8080`.
102
+ - That claim gets treated as trusted evidence.
103
+ - AI edits against a fake deploy script.
104
+ - The guardrail launders an AI claim into repo truth.
105
+
106
+ With SourcePack:
107
+
108
+ - Prompt context is only guidance.
109
+ - `.sourcepack/baseline/` is enforcement trust.
110
+ - If `deploy.sh` is not in the trusted baseline, the edit fails.
111
+ - AI-generated context cannot bless its own assumptions.
112
+
113
+
114
+ ## Baseline lifecycle
115
+
116
+ SourcePack enforcement depends on a reviewed `.sourcepack/baseline/`, while `.sourcepack/prompt/` remains AI guidance only. CI should consume committed baseline state and must not create or update trusted baseline state automatically. See [`docs/baseline-lifecycle.md`](docs/baseline-lifecycle.md) for safe local and PR flows.
117
+
118
+ ## Public-alpha readiness
119
+
120
+ Public-alpha readiness is tracked in [`docs/public-alpha-readiness.md`](docs/public-alpha-readiness.md). SourcePack is a local evidence guardrail; it does not prove code correctness, security, dependency safety, runtime success, semantic validity, external API truth, or user intent.
121
+
122
+ ## What SourcePack catches
123
+
124
+ | Case | Local result | Reason code |
125
+ | --- | --- | --- |
126
+ | Missing/fake file edits | FAIL | `missing_file` |
127
+ | New file review | WARN | `new_file` |
128
+ | Deleted file review | WARN | `deleted_file` |
129
+ | Undeclared imports/dependencies | FAIL | `unsupported_dependency` |
130
+ | Same-patch dependency additions | WARN | `declared_dependency` |
131
+ | Unsupported commands | FAIL | `unsupported_command` |
132
+ | Unsupported ecosystems | WARN | `unsupported_ecosystem` |
133
+ | Protected `.sourcepack/` edits | FAIL | `protected_artifact` |
134
+ | `.git/` path edits | FAIL | `git_path_modification` |
135
+ | Unsafe paths | FAIL | `unsafe_path` |
136
+ | Binary diffs | WARN or FAIL for high-risk paths | `binary_diff` |
137
+ | Malformed diffs | FAIL | `malformed_diff` |
138
+ | Missing/stale/corrupt baseline | FAIL or WARN depending on state and mode | `baseline_missing`, `baseline_stale`, `baseline_corrupt` |
139
+
140
+ See [`docs/reason-codes.md`](docs/reason-codes.md) for reason-code behavior and fixes.
141
+
142
+ ## What SourcePack does not claim
143
+
144
+ - Does not prove code correctness.
145
+ - Does not prove security.
146
+ - Does not replace tests.
147
+ - Does not understand full program semantics.
148
+ - Does not require cloud access.
149
+ - Does not upload repo contents.
150
+
151
+ ## Commands
152
+
153
+ Documented user-facing commands that exist in the current CLI:
154
+
155
+ ```bash
156
+ sourcepack init . --auto
157
+ sourcepack diff .
158
+ sourcepack diff . --json
159
+ sourcepack diff . --strict
160
+ sourcepack diff . --ci
161
+ sourcepack prompt . "task" --copy
162
+ sourcepack baseline .
163
+ sourcepack baseline . --refresh
164
+ sourcepack report path
165
+ sourcepack report open
166
+ sourcepack status .
167
+ sourcepack exec -- pytest
168
+ sourcepack evidence list
169
+ sourcepack evidence show <entry-id>
170
+ sourcepack evidence clear
171
+ sourcepack doctor
172
+ sourcepack doctor --strict
173
+ sourcepack demo
174
+ ```
175
+
176
+ Hook management commands also exist for explicit maintenance:
177
+
178
+ ```bash
179
+ sourcepack install-hook .
180
+ sourcepack uninstall-hook .
181
+ ```
182
+
183
+ ## Local execution evidence
184
+
185
+ `sourcepack exec -- <command...>` runs a local command and records bounded evidence under `.sourcepack/evidence/ledger.jsonl`. Ledger entries store command metadata, exit code, stdout/stderr SHA-256 hashes, short excerpts, git head, dirty-worktree state before and after execution, duration, and a small environment summary. They do not store full logs by default and are local-only. Command output can still contain sensitive information, so review `.sourcepack/evidence/` before sharing it.
186
+
187
+ Use:
188
+
189
+ ```bash
190
+ sourcepack exec -- pytest
191
+ sourcepack evidence list
192
+ sourcepack evidence show <entry-id>
193
+ sourcepack evidence clear
194
+ sourcepack evidence export --json
195
+ ```
196
+
197
+ Execution evidence only supports bounded claims that a command was run locally. It does not prove code correctness, security, or external API behavior. Prompt context in `.sourcepack/prompt/` remains advisory and cannot satisfy execution evidence.
198
+
199
+ ## Local reports
200
+
201
+ `sourcepack diff .` writes local report artifacts under `.sourcepack/reports/`:
202
+
203
+ - `.sourcepack/reports/latest.html`
204
+ - `.sourcepack/reports/latest.json`
205
+ - `.sourcepack/reports/latest.md`
206
+
207
+ Use:
208
+
209
+ ```bash
210
+ sourcepack report path
211
+ sourcepack report open
212
+ ```
213
+
214
+ HTML is for humans. JSON is for automation and remains JSON-only on stdout when `sourcepack diff . --json` is used.
215
+
216
+ ## Git hooks
217
+
218
+ `sourcepack init . --auto` installs hooks when possible in a Git repository.
219
+
220
+ - The pre-commit hook checks staged changes with `sourcepack diff . --staged`.
221
+ - The post-commit hook refreshes the baseline only after clean commits.
222
+ - If the working tree is dirty after a commit, SourcePack marks the baseline stale instead of silently trusting it.
223
+ - To uninstall hooks, run `sourcepack uninstall-hook .`.
224
+
225
+ ## CI
226
+
227
+ The included GitHub Actions workflow installs SourcePack in editable mode, runs unit and pytest gates, runs the behavior matrix, and checks `sourcepack doctor` plus `sourcepack demo`.
228
+
229
+ Safe CI usage for projects that intentionally manage a trusted baseline:
230
+
231
+ ```yaml
232
+ - uses: actions/checkout@v4
233
+ - run: python -m pip install -e .
234
+ - run: sourcepack diff . --ci
235
+ ```
236
+
237
+ `sourcepack diff . --ci` implies strict JSON output and exits nonzero for WARN or FAIL. CI must not establish trust automatically: if no trusted baseline exists, CI fails until a baseline strategy is intentionally created outside CI.
238
+
239
+ ## Validation
240
+
241
+ Current validation is local and deterministic. `sourcepack doctor --strict` performs a production-readiness health check and fails on missing runtime prerequisites or packaged assets:
242
+
243
+ - Hosted GitHub Actions workflow is the source of truth for hosted checks.
244
+ - The behavior matrix covers canonical repo-state transitions.
245
+ - The simulation harness validates local workflow transitions.
246
+ - Gauntlet and smoke tests cover CLI and report behavior.
247
+ - The optional real-corpus harness is available in `tools/real_corpus_validation.py` for caller-provided repositories.
248
+
249
+ The primary proof unit is a repo-state transition, not a random repository.
250
+
251
+ ## Status
252
+
253
+ v1.10.0-alpha: local-first alpha. Core judgment behavior is validated. Packaging, reports, demos, and UX polish are active areas.
254
+
255
+ ## Public-alpha checklist
256
+
257
+ Before public alpha, verify:
258
+
259
+ - Install works from a clean environment.
260
+ - `sourcepack --version` works.
261
+ - `sourcepack doctor` works.
262
+ - `sourcepack demo` works.
263
+ - `sourcepack init . --auto` works.
264
+ - `sourcepack diff .` works.
265
+ - `sourcepack report open` or `sourcepack report path` works.
266
+ - Behavior matrix passes.
267
+ - Golden demos pass.
268
+ - Known limitations are documented.
269
+ - Do not claim PyPI publication unless SourcePack is actually published there.
270
+
271
+
272
+ ## CI and editor planning
273
+
274
+ See `docs/ci.md` for CI usage and `docs/vscode-extension-plan.md` for the VS Code extension plan.
275
+
276
+ ## GitHub Action
277
+
278
+ SourcePack includes a composite GitHub Action that runs the existing `sourcepack` CLI in CI. It packages the CLI behavior; it does not create a second implementation of SourcePack judgment logic.
279
+
280
+ Minimal workflow:
281
+
282
+ ```yaml
283
+ name: SourcePack
284
+
285
+ on:
286
+ pull_request:
287
+
288
+ jobs:
289
+ sourcepack:
290
+ runs-on: ubuntu-latest
291
+ steps:
292
+ - uses: actions/checkout@v4
293
+ - uses: ./
294
+ with:
295
+ mode: ci
296
+ # fail-on-warn: 'true'
297
+ ```
298
+
299
+ Baseline trust rule: CI consumes `.sourcepack/baseline/`. CI does not create, refresh, bless, or update trusted baseline state automatically. If the baseline is missing, the Action fails closed with `SourcePack baseline not found` and explains that CI will not create or update trusted baseline state automatically. Maintainers should create or refresh baselines locally or in a separate trusted maintainer-controlled setup workflow before relying on PR checks.
300
+
301
+ The Action writes report artifacts to `sourcepack-report` by default, including `sourcepack.json`, `sourcepack.md`, `sourcepack.stderr.txt`, `sourcepack.stdout.txt`, and `sourcepack-command.txt` when available. `RED`/`FAIL` exits nonzero. `WARN` follows the selected CLI mode: `ci` and `strict` fail on WARN, while `local` does not unless `fail-on-warn: 'true'` is set.
302
+
303
+ Before pushing, run SourcePack locally with:
304
+
305
+ ```bash
306
+ sourcepack --version
307
+ sourcepack doctor
308
+ sourcepack diff . --json
309
+ ```
310
+
311
+ Current limitations: PR commenting is future work and is not implemented by this Action. Unsupported ecosystems remain YELLOW/WARN unless SourcePack core supports them.
@@ -0,0 +1,33 @@
1
+ sourcepack/__init__.py,sha256=Jmc0IHAtjgUKTH5ShgokAK02cCnNXfFdF4IqQS0UBWM,649
2
+ sourcepack/baseline.py,sha256=7QDQ7GJnuWnbVCk1EEJ06ZdOSjcl-Do94DUq_Tq3ATs,14995
3
+ sourcepack/cli.py,sha256=zJKyuFlVJiimbK_BBXw8KBeWXwZAaZfnBx5wCjlfkxY,160404
4
+ sourcepack/commands.py,sha256=NEgtYNiiz_DB2tlxXuBS0UrX9obou5tJygFQ72vtnNI,8103
5
+ sourcepack/dependencies.py,sha256=zD9a9alXkLH036U_I9Y9vLAG2GY3fySZFWPyoLNDU-E,5856
6
+ sourcepack/diff_parser.py,sha256=Vu4_VcSk9CBoLceij2T41Nuz4v7NQD2vatcdnOdt1VQ,4811
7
+ sourcepack/errors.py,sha256=Z8DH3NzdiYg8OK1Nn5zIQCPeps2U6ppTd8m8shOzPiM,400
8
+ sourcepack/evidence.py,sha256=ANF5wXr4PpMzMYamXMvAcCK-dKQp2cp2GCY_iytspMA,4444
9
+ sourcepack/execution_ledger.py,sha256=mi3bGSB9G77peUXAkpO8r85aViGB6mTxJL3KM9m0pRQ,9214
10
+ sourcepack/git.py,sha256=Jg59PZWOxjuXBaun7UfABnmrUMpvnSdtlTMjIOL0rNM,2048
11
+ sourcepack/judgment.py,sha256=VB44Sa6kgNyvVUYE7X4sDRigLurVJTfadom8jmBJVPM,98003
12
+ sourcepack/packet.py,sha256=wW5Z9LHsN5G8cWp-0gpDHhupa_A9wVX_UfoaLR-slrQ,39133
13
+ sourcepack/paths.py,sha256=bCVD5fv48Zss8B7cJ2778XOm-5IFy1Olu5DG-wZ_6tI,2733
14
+ sourcepack/policy.py,sha256=JFi2ibM2wbnLVzzOEkFlicjrCju_vbs2FcLdAY6BTPM,1020
15
+ sourcepack/reason_codes.py,sha256=W__-HTbopfaV6qUIONFH1Yxb2JQ4-VJKaP0GY-AYGZQ,2713
16
+ sourcepack/schemas.py,sha256=FLXup-kieIGNl8YBA9bprtH8oSo9_TlZjkE6X0PtbU0,1479
17
+ sourcepack/assets/__init__.py,sha256=TIJmnRgSvjDUJVM38klGMggQqJGnzUOEwM_LB2NFRXA,43
18
+ sourcepack/assets/audit_template.md,sha256=NjpLJMcZaG3c3m9N3RLhOyU3MBw8hfbDp-EmYRuDwRY,335
19
+ sourcepack/assets/packet_instructions.md,sha256=_ntT3OFq_VRaZLdHlGOVV7tavVcOjidQaCpSdeq1ffw,288
20
+ sourcepack/ecosystems/__init__.py,sha256=ZYn95RhNEsRk_b1xicULGCuC_0W3F8IipE-G-9unVCY,71
21
+ sourcepack/ecosystems/generic.py,sha256=tfBpa2l3ximW2q8lE-O8xgSRdGhtcHGvafM9Kt23a70,344
22
+ sourcepack/ecosystems/node.py,sha256=yjfCgQ77We38ljUhEX6grxJ2jEFDaiwKPfHjltrk9qM,90
23
+ sourcepack/ecosystems/python.py,sha256=Q2fZtZOFHlDMGuoKGmVa6dND_LkWQTG2TzJO5siR2GA,293
24
+ sourcepack/reports/__init__.py,sha256=X4hizw17oJyf2N7Dusq8XoShowF9GCrT99b1sBHLrkA,259
25
+ sourcepack/reports/html.py,sha256=dCyrwynsHIkwSBWBZ6T8uZsre6YCqTzOAW6T1b7YZrk,6852
26
+ sourcepack/reports/json.py,sha256=bxnxgQVr7J05S-bbRFRKu4NNDvI8VBl3yZFxl3rBBVI,9442
27
+ sourcepack/reports/markdown.py,sha256=HRu45o0MwKCin3E3lbGxtST0LBf8agXzgcm-LSZn_sc,3627
28
+ sourcepack-1.10.0a0.dist-info/licenses/LICENSE,sha256=onMK1r_z5gNQRZAsMfScIB8EVnAp11rQEUt5OdVsnbs,1080
29
+ sourcepack-1.10.0a0.dist-info/METADATA,sha256=YoeE7DSxpv7WQhi26Y2RVUQOWzleo-6aLCoaNFYiQf4,11725
30
+ sourcepack-1.10.0a0.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
31
+ sourcepack-1.10.0a0.dist-info/entry_points.txt,sha256=FOJmWOs2xu6JBJRQWyi09Dq92hwLw1HMVgLOmxEmXq4,51
32
+ sourcepack-1.10.0a0.dist-info/top_level.txt,sha256=lGcDKMPyHycZWRx91uPWnAz5idNX8q3gU_tqhugWPg0,11
33
+ sourcepack-1.10.0a0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (82.0.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ sourcepack = sourcepack.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SourcePack contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ sourcepack