weftgate 0.1.0__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.
- weftgate-0.1.0/.env.example +9 -0
- weftgate-0.1.0/.gitignore +17 -0
- weftgate-0.1.0/.pre-commit-hooks.yaml +25 -0
- weftgate-0.1.0/AGENTS.md +183 -0
- weftgate-0.1.0/CHANGELOG.md +57 -0
- weftgate-0.1.0/CONTRIBUTING.md +28 -0
- weftgate-0.1.0/LICENSE +201 -0
- weftgate-0.1.0/NOTICE +4 -0
- weftgate-0.1.0/PKG-INFO +213 -0
- weftgate-0.1.0/README.md +171 -0
- weftgate-0.1.0/SECURITY.md +30 -0
- weftgate-0.1.0/action.yml +51 -0
- weftgate-0.1.0/docs/ADDENDUM-context-and-memory.md +79 -0
- weftgate-0.1.0/docs/DEMO.md +32 -0
- weftgate-0.1.0/docs/DESIGN.md +231 -0
- weftgate-0.1.0/docs/FIELD-RESULTS.md +138 -0
- weftgate-0.1.0/docs/LAUNCH.md +126 -0
- weftgate-0.1.0/docs/MEMORY.md +77 -0
- weftgate-0.1.0/docs/ORACLES.md +124 -0
- weftgate-0.1.0/docs/assets/demo-evidence.json +364 -0
- weftgate-0.1.0/docs/assets/demo-findings.png +0 -0
- weftgate-0.1.0/docs/assets/demo-poster.png +0 -0
- weftgate-0.1.0/docs/assets/demo.vtt +19 -0
- weftgate-0.1.0/pyproject.toml +95 -0
- weftgate-0.1.0/scripts/action_runner.py +113 -0
- weftgate-0.1.0/scripts/bootstrap.sh +26 -0
- weftgate-0.1.0/scripts/dev-hooks.sh +17 -0
- weftgate-0.1.0/scripts/install-hooks.sh +22 -0
- weftgate-0.1.0/scripts/launch_metrics.py +48 -0
- weftgate-0.1.0/scripts/make_demo.py +402 -0
- weftgate-0.1.0/scripts/new-oracle.py +246 -0
- weftgate-0.1.0/scripts/release_notes.py +20 -0
- weftgate-0.1.0/scripts/rename.py +58 -0
- weftgate-0.1.0/scripts/rename.sh +4 -0
- weftgate-0.1.0/tests/conftest.py +89 -0
- weftgate-0.1.0/tests/plugins/__init__.py +0 -0
- weftgate-0.1.0/tests/plugins/dummy_oracle.py +43 -0
- weftgate-0.1.0/tests/test_action.py +110 -0
- weftgate-0.1.0/tests/test_change.py +135 -0
- weftgate-0.1.0/tests/test_cli_mcp_parity.py +260 -0
- weftgate-0.1.0/tests/test_config.py +87 -0
- weftgate-0.1.0/tests/test_core_is_stdlib.py +71 -0
- weftgate-0.1.0/tests/test_doctor_ledger.py +95 -0
- weftgate-0.1.0/tests/test_env_vars.py +234 -0
- weftgate-0.1.0/tests/test_eval.py +89 -0
- weftgate-0.1.0/tests/test_gate.py +200 -0
- weftgate-0.1.0/tests/test_hardening.py +427 -0
- weftgate-0.1.0/tests/test_honesty.py +273 -0
- weftgate-0.1.0/tests/test_imports_lockfile.py +274 -0
- weftgate-0.1.0/tests/test_memory.py +184 -0
- weftgate-0.1.0/tests/test_perf.py +55 -0
- weftgate-0.1.0/tests/test_registry.py +80 -0
- weftgate-0.1.0/tests/test_release_regressions.py +295 -0
- weftgate-0.1.0/tests/test_routes_fastapi.py +333 -0
- weftgate-0.1.0/tests/test_scaffold.py +73 -0
- weftgate-0.1.0/tests/test_selftest.py +9 -0
- weftgate-0.1.0/tests/test_setup.py +178 -0
- weftgate-0.1.0/tests/test_store.py +184 -0
- weftgate-0.1.0/tests/test_types.py +59 -0
- weftgate-0.1.0/weftgate/__init__.py +3 -0
- weftgate-0.1.0/weftgate/__main__.py +5 -0
- weftgate-0.1.0/weftgate/change.py +231 -0
- weftgate-0.1.0/weftgate/cli.py +523 -0
- weftgate-0.1.0/weftgate/config.py +401 -0
- weftgate-0.1.0/weftgate/doctor.py +164 -0
- weftgate-0.1.0/weftgate/eval/__init__.py +1 -0
- weftgate-0.1.0/weftgate/eval/audit.py +173 -0
- weftgate-0.1.0/weftgate/eval/fixture.py +84 -0
- weftgate-0.1.0/weftgate/eval/mutate.py +489 -0
- weftgate-0.1.0/weftgate/gate.py +535 -0
- weftgate-0.1.0/weftgate/honesty.py +553 -0
- weftgate-0.1.0/weftgate/ledger.py +130 -0
- weftgate-0.1.0/weftgate/mcp_server.py +371 -0
- weftgate-0.1.0/weftgate/memory.py +452 -0
- weftgate-0.1.0/weftgate/oracle.py +231 -0
- weftgate-0.1.0/weftgate/oracles/__init__.py +11 -0
- weftgate-0.1.0/weftgate/oracles/env_vars.py +640 -0
- weftgate-0.1.0/weftgate/oracles/imports_lockfile.py +1338 -0
- weftgate-0.1.0/weftgate/oracles/routes_fastapi.py +909 -0
- weftgate-0.1.0/weftgate/registry.py +80 -0
- weftgate-0.1.0/weftgate/selftest.py +312 -0
- weftgate-0.1.0/weftgate/setup.py +368 -0
- weftgate-0.1.0/weftgate/store.py +557 -0
- weftgate-0.1.0/weftgate/suggest.py +78 -0
- weftgate-0.1.0/weftgate/types.py +177 -0
- weftgate-0.1.0/weftgate.toml +8 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Environment variables weftgate itself reads (documented here so `weftgate audit` on this
|
|
2
|
+
# repo has a declaration source; every value is optional).
|
|
3
|
+
WEFTGATE_CACHE= # index directory (default: ~/.cache/weftgate)
|
|
4
|
+
WEFTGATE_ORACLES= # comma-separated oracle names, overrides weftgate.toml
|
|
5
|
+
WEFTGATE_BLOCK_ON= # reject | review | never
|
|
6
|
+
WEFTGATE_ENV_DECLARED_IN= # comma-separated extra env declaration files
|
|
7
|
+
WEFTGATE_STACK= # pin the detected stack, e.g. python,fastapi
|
|
8
|
+
WEFTGATE_USER_CONFIG= # explicit user config path
|
|
9
|
+
WEFTGATE_LEDGER= # 0 disables the blocked-changes ledger
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Use with https://pre-commit.com:
|
|
2
|
+
#
|
|
3
|
+
# repos:
|
|
4
|
+
# - repo: https://github.com/Avinash-Amudala/weftgate
|
|
5
|
+
# rev: v0.1.0
|
|
6
|
+
# hooks:
|
|
7
|
+
# - id: weftgate-check
|
|
8
|
+
#
|
|
9
|
+
# The hook blocks a commit only on a REJECT verdict (a proven broken wire).
|
|
10
|
+
- id: weftgate-check
|
|
11
|
+
name: weftgate check (env vars, imports, routes resolve)
|
|
12
|
+
description: Verify that the files being committed reference things that exist.
|
|
13
|
+
entry: weftgate check --format=github
|
|
14
|
+
language: python
|
|
15
|
+
types: [text]
|
|
16
|
+
pass_filenames: true
|
|
17
|
+
require_serial: true
|
|
18
|
+
- id: weftgate-audit
|
|
19
|
+
name: weftgate audit (whole repo)
|
|
20
|
+
description: Sweep the repository for latent broken wires.
|
|
21
|
+
entry: weftgate audit --format=github
|
|
22
|
+
language: python
|
|
23
|
+
pass_filenames: false
|
|
24
|
+
always_run: true
|
|
25
|
+
stages: [manual]
|
weftgate-0.1.0/AGENTS.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# AGENTS.md: how to build weftgate
|
|
2
|
+
|
|
3
|
+
This file is the contract for any coding agent (Claude Code, Codex, Cursor, Antigravity) implementing this repo. Read it fully before writing code. The complete design is in `docs/DESIGN.md`; this file is the how, that file is the what and why. `docs/ADDENDUM-context-and-memory.md` defines the later phases (the grounded-context surface and verified memory); read it too, but do not build those yet.
|
|
4
|
+
|
|
5
|
+
Scope for now is v0.1: the verification gate only. The context and recall consumers in the addendum are v0.2 and v0.3 and must not be started until v0.1 is complete and green.
|
|
6
|
+
|
|
7
|
+
## 0. First action: set up the environment
|
|
8
|
+
|
|
9
|
+
Run this once before anything else. It creates a virtual environment and installs the tool plus all dev and optional dependencies, so you have a working build immediately.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bash scripts/bootstrap.sh
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If `bootstrap.sh` is missing or fails, do the equivalent by hand:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
python3 -m venv .venv && . .venv/bin/activate
|
|
19
|
+
pip install -e ".[all,dev]"
|
|
20
|
+
python -m weftgate.selftest
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Everything you need is declared in `pyproject.toml` and `requirements-dev.txt`. If you find you need another open-source library while building, add it to the correct group in `pyproject.toml` (core stays minimal, heavy things go under an optional extra) and to `requirements-dev.txt` if it is only for development, then re-run the install. Do not add a dependency to the core group unless the tool cannot run without it.
|
|
24
|
+
|
|
25
|
+
## 1. What you are building, in one sentence
|
|
26
|
+
|
|
27
|
+
A verification gate that checks whether the code an agent produced connects correctly to the project's own relationships and contracts, delivered as an MCP server, an identical CLI, and hooks, extensible through an oracle plugin interface.
|
|
28
|
+
|
|
29
|
+
## 2. The one invariant you must never break
|
|
30
|
+
|
|
31
|
+
**Block only on a positive, machine-checkable falsehood.** Everything else is `REVIEW` or `UNVERIFIABLE`, never `REJECT`. A missing index, an unresolvable dynamic reference, an optional extra that is not installed, a claim derived from prose: all of these soften, they never block. A gate that false-blocks is uninstalled the same day. When you are unsure whether something should reject or review, it reviews.
|
|
32
|
+
|
|
33
|
+
## 3. Coding standards
|
|
34
|
+
|
|
35
|
+
- Python 3.10 or newer. Use `match`, modern typing (`list[str]`, `X | None`), and dataclasses.
|
|
36
|
+
- Standard library first. The core (`types`, `config`, `registry`, `oracle`, `store`, `gate`, `change`, `suggest`, `honesty`, `cli`, `mcp_server`) must import nothing outside the standard library. Optional capability goes behind extras (`weftgate[treesitter]`, `weftgate[lsp]`, `weftgate[yaml]`) and must degrade to `UNVERIFIABLE` when the extra is absent, tested with the extra uninstalled.
|
|
37
|
+
- No network calls in the core. Oracles that need the network are opt-in and clearly marked, and are never on the default path.
|
|
38
|
+
- Deterministic. Same repo state and same input give the same findings, in a stable order. The eval harness depends on this.
|
|
39
|
+
- Fully type-annotated. `mypy` and `ruff` must pass clean; they run in CI and in the pre-push check.
|
|
40
|
+
- Every oracle ships with tests, including at least one true positive (a real broken edge it catches and rejects), one true negative (correct code it accepts), and one soft case (a dynamic reference it reviews rather than rejects).
|
|
41
|
+
|
|
42
|
+
## 4. Repo layout
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
weftgate/
|
|
46
|
+
__init__.py
|
|
47
|
+
types.py # Claim, Finding, GateResult, Change, Context, enums. The shared vocabulary.
|
|
48
|
+
config.py # precedence load, stack detection, cache/db path resolution
|
|
49
|
+
store.py # SQLite index: connect, meta, per-oracle namespaces, incremental sync
|
|
50
|
+
registry.py # OracleAPI, discovery from entry points + config dotted paths
|
|
51
|
+
oracle.py # the Oracle protocol and the base helpers
|
|
52
|
+
change.py # parse file / patch / git diff into a Change
|
|
53
|
+
gate.py # run oracles, collect findings, compute verdict
|
|
54
|
+
suggest.py # bounded-Levenshtein + token did-you-mean, budget-capped
|
|
55
|
+
honesty.py # claim-mode outcome verdicts (PROVEN/PLAUSIBLE/NOT_OBSERVED/CONTRADICTED)
|
|
56
|
+
cli.py # the plain CLI; identical output to the MCP server
|
|
57
|
+
mcp_server.py # stdio MCP server; thin wrapper over the same gate calls as the CLI
|
|
58
|
+
selftest.py # offline end-to-end self-test, no external services
|
|
59
|
+
oracles/
|
|
60
|
+
__init__.py
|
|
61
|
+
env_vars.py # Tier 0 reference oracle, fully implemented
|
|
62
|
+
imports_lockfile.py # Tier 0 slopsquatting/import oracle
|
|
63
|
+
routes_fastapi.py # Tier 0 first edge oracle (FastAPI)
|
|
64
|
+
eval/
|
|
65
|
+
__init__.py
|
|
66
|
+
mutate.py # mutation harness
|
|
67
|
+
audit.py # audit sweep over an existing repo
|
|
68
|
+
tests/
|
|
69
|
+
scripts/
|
|
70
|
+
bootstrap.sh
|
|
71
|
+
install-hooks.sh # writes the Claude Code PreToolUse hook + git pre-commit
|
|
72
|
+
.github/workflows/ci.yml
|
|
73
|
+
docs/DESIGN.md
|
|
74
|
+
weftgate.toml # example config
|
|
75
|
+
pyproject.toml
|
|
76
|
+
requirements-dev.txt
|
|
77
|
+
README.md
|
|
78
|
+
LICENSE
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## 5. The shared vocabulary (implement `types.py` first)
|
|
82
|
+
|
|
83
|
+
Everything else depends on these. Get them stable before writing oracles.
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
class Level(StrEnum): # verdict level for one claim
|
|
87
|
+
ACCEPT = "accept"
|
|
88
|
+
REVIEW = "review"
|
|
89
|
+
REJECT = "reject"
|
|
90
|
+
UNVERIFIABLE = "unverifiable"
|
|
91
|
+
|
|
92
|
+
@dataclass(frozen=True)
|
|
93
|
+
class Location:
|
|
94
|
+
file: str
|
|
95
|
+
line: int = 0
|
|
96
|
+
col: int = 0
|
|
97
|
+
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class Claim:
|
|
100
|
+
kind: str # e.g. "env_var", "route_handler", "import"
|
|
101
|
+
subject: str # the referenced thing, e.g. "DATABASE_URL"
|
|
102
|
+
location: Location
|
|
103
|
+
attrs: dict = field(default_factory=dict) # oracle-specific structured payload
|
|
104
|
+
hard: bool = True # hard claims may REJECT; soft claims cap at REVIEW
|
|
105
|
+
source: str = "code" # "code" (diff mode) or "assertion" (claim mode)
|
|
106
|
+
|
|
107
|
+
@dataclass(frozen=True)
|
|
108
|
+
class Finding:
|
|
109
|
+
claim: Claim
|
|
110
|
+
level: Level
|
|
111
|
+
reason: str
|
|
112
|
+
oracle: str
|
|
113
|
+
suggestions: tuple[str, ...] = ()
|
|
114
|
+
|
|
115
|
+
@dataclass(frozen=True)
|
|
116
|
+
class GateResult:
|
|
117
|
+
verdict: Level # worst blocking-eligible level; UNVERIFIABLE never raises it
|
|
118
|
+
findings: tuple[Finding, ...]
|
|
119
|
+
stats: dict
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`GateResult.verdict` is computed by `gate.py`: `REJECT` if any finding is `REJECT`, else `REVIEW` if any is `REVIEW`, else `ACCEPT`. `UNVERIFIABLE` findings are reported in `findings` and counted in `stats` but never change `verdict`.
|
|
123
|
+
|
|
124
|
+
## 6. The oracle contract (how to add any oracle)
|
|
125
|
+
|
|
126
|
+
An oracle is an object with `name`, `kinds`, `extract`, `check`, and optionally `build`, `sync`, `suggest`. See `oracle.py` for the protocol and `oracles/env_vars.py` for the fully worked reference. The checklist for a correct oracle:
|
|
127
|
+
|
|
128
|
+
1. `check` returns `UNVERIFIABLE` (never `REJECT`) when its index is absent or its optional extra is not installed.
|
|
129
|
+
2. `check` returns `REJECT` only on a proven absence, and attaches suggestions when it can.
|
|
130
|
+
3. Dynamic, computed, or indirect references return `REVIEW`, not `REJECT`.
|
|
131
|
+
4. `extract` returns `[]` cleanly when the change has nothing for this oracle.
|
|
132
|
+
5. `build`/`sync` preserve valid index state across rebuilds and never leave a half-written index (write to a temp table or transaction, then swap).
|
|
133
|
+
6. Ships with the three required tests (true positive, true negative, soft case).
|
|
134
|
+
|
|
135
|
+
Register it in `oracles/__init__.py` and expose a `register(api)` if it is a distributable plugin.
|
|
136
|
+
|
|
137
|
+
## 7. Definition of done, per component
|
|
138
|
+
|
|
139
|
+
- `types.py`: dataclasses and enums exist, are frozen where shown, and are imported by everything else.
|
|
140
|
+
- `store.py`: opens a per-repo SQLite db at the resolved cache path, holds a `meta` table with schema version and build commit, gives each oracle a namespaced place to write, and syncs incrementally against the recorded commit plus the working-tree diff. A no-op sync is under a second.
|
|
141
|
+
- `registry.py`: discovers oracles from installed entry points and from config dotted paths, holds the enabled set, exposes `OracleAPI.register_oracle`.
|
|
142
|
+
- `gate.py`: given a `Change` (diff mode) or a list of `Claim` (claim mode) and a `Context`, runs the enabled oracles, collects findings, computes the verdict, and returns a `GateResult`. Runs `sync` before checking.
|
|
143
|
+
- The three oracles: each passes its three tests and the mutation harness detects its injected breakage.
|
|
144
|
+
- `cli.py` and `mcp_server.py`: both call the same gate functions and produce the same findings for the same input. A test asserts their outputs match.
|
|
145
|
+
- `honesty.py`: grades outcome claims; never returns `PROVEN` without a matching machine-checkable signal; a test proves it withholds `PROVEN` when evidence is absent.
|
|
146
|
+
- `eval/mutate.py`: injects known breakage, is deterministic by seed, reports detected and blocked separately, counts no-suggestion as a miss.
|
|
147
|
+
- `eval/audit.py`: sweeps a repo and reports latent broken edges, reusing the same oracle `check` paths as the gate.
|
|
148
|
+
- `selftest.py`: runs the whole pipeline offline on a tiny fixture repo it creates in a temp dir, and exits non-zero on any regression.
|
|
149
|
+
|
|
150
|
+
## 8. Build order (each phase is shippable and testable on its own)
|
|
151
|
+
|
|
152
|
+
1. `types.py`, then `config.py`, then `store.py`. Prove `store` builds and syncs on a fixture repo.
|
|
153
|
+
2. `oracle.py` and `registry.py`. Prove an oracle can register and be discovered.
|
|
154
|
+
3. `oracles/env_vars.py` end to end, with its tests. This is the vertical slice that proves the whole spine works: extract from a change, check against an index, produce a finding with a suggestion.
|
|
155
|
+
4. `change.py` and `gate.py`. Now a real diff produces a `GateResult`.
|
|
156
|
+
5. `cli.py`, then `mcp_server.py` as a thin wrapper, with the output-parity test.
|
|
157
|
+
6. `oracles/imports_lockfile.py` and `oracles/routes_fastapi.py` with their tests.
|
|
158
|
+
7. `honesty.py` and claim mode wiring.
|
|
159
|
+
8. `eval/mutate.py` and `eval/audit.py`.
|
|
160
|
+
9. `selftest.py`, `scripts/install-hooks.sh`, the setup command, and the CI workflow.
|
|
161
|
+
|
|
162
|
+
Do not start a phase until the previous phase's tests pass.
|
|
163
|
+
|
|
164
|
+
## 9. How to run things
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
python -m weftgate.selftest # offline end-to-end check, run this often
|
|
168
|
+
python -m pytest -q # unit tests
|
|
169
|
+
ruff check . && mypy weftgate # lint and types, must be clean
|
|
170
|
+
weftgate check path/to/changed_file.py # diff-mode check of a file
|
|
171
|
+
weftgate audit # sweep the current repo for latent broken edges
|
|
172
|
+
weftgate eval mutate --seed 13 # mutation harness, reproducible
|
|
173
|
+
python -m weftgate.mcp_server # start the stdio MCP server
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 10. Guardrails, restated because they are load-bearing
|
|
177
|
+
|
|
178
|
+
- Never block on anything but a proven falsehood. Re-read section 2.
|
|
179
|
+
- Never return `PROVEN` for an outcome claim without machine-checkable evidence you could re-derive.
|
|
180
|
+
- The CLI and the MCP server must never diverge in what they find. They call the same functions.
|
|
181
|
+
- Incremental sync must never throw away still-valid index state, and must never leave a partially written index on failure.
|
|
182
|
+
- Keep the core standard-library-only. Anything heavier is an optional extra that degrades to `UNVERIFIABLE`.
|
|
183
|
+
- Determinism is not optional; the eval harness and CI depend on it.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to weftgate are recorded here. The format follows
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow SemVer.
|
|
5
|
+
|
|
6
|
+
## [Unreleased]
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2026-09-12
|
|
9
|
+
|
|
10
|
+
The verification gate.
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- Verified memory (the recall consumer, addendum A5) as an integration with mnemo: a
|
|
14
|
+
changed-node ledger every sync appends to, anchors with content hashes and the
|
|
15
|
+
grounding commit, re-checks that yield valid/stale/invalid, and weftgate's oracles as a
|
|
16
|
+
mnemo verification plugin. `weftgate memory anchor|check|changes` and the
|
|
17
|
+
`memory_anchor`, `memory_check`, `memory_changes` MCP tools. See docs/MEMORY.md.
|
|
18
|
+
- Three Tier 0 oracles, standard library only: `env_vars` (reads vs declarations across
|
|
19
|
+
dotenv files, settings schemas, Dockerfile/compose, code defaults), `imports_lockfile`
|
|
20
|
+
(imports vs lockfiles and manifests for Python and Node, with import-name aliases,
|
|
21
|
+
tsconfig path aliases, monorepo and nested project roots), `routes_fastapi` (routes
|
|
22
|
+
vs handlers and `include_router` wiring, built statically with `ast`).
|
|
23
|
+
- Diff mode (file, new content, unified diff, git working tree or staged) and claim
|
|
24
|
+
mode (structured claims, including route existence and outcome claims).
|
|
25
|
+
- The honesty gate: outcome claims graded PROVEN / PLAUSIBLE / NOT_OBSERVED /
|
|
26
|
+
CONTRADICTED; never PROVEN without machine-checkable evidence; re-runs and probes
|
|
27
|
+
are opt-in and allowlisted.
|
|
28
|
+
- Per-repo SQLite index with atomic per-oracle tables and incremental sync (git diff
|
|
29
|
+
plus untracked files, fingerprint fallback without git).
|
|
30
|
+
- A CLI and a standard-library stdio MCP server with an output-parity test; a Claude
|
|
31
|
+
Code PreToolUse hook adapter; `weftgate setup` writing config, index, git pre-commit
|
|
32
|
+
hook, and MCP config for Claude Code, Cursor, and VS Code; a GitHub Action;
|
|
33
|
+
pre-commit hooks.
|
|
34
|
+
- Measurement: a seeded mutation harness that reports detected, blocked, and
|
|
35
|
+
correctly suggested separately; an audit sweep; an offline self-test; field
|
|
36
|
+
results on six open-source repositories.
|
|
37
|
+
- An oracle-authoring guide and a scaffold script.
|
|
38
|
+
|
|
39
|
+
### Release hardening
|
|
40
|
+
- Refresh reused sessions, detect worktree reverts, preserve indexes on failed rebuilds,
|
|
41
|
+
and isolate nested transactions with savepoints.
|
|
42
|
+
- Review incomplete dependency metadata and dynamic route evidence; never use installed
|
|
43
|
+
dependency percentages as proof of absence.
|
|
44
|
+
- Preserve original memory hashes, invalidate changed symbols and declarations, and
|
|
45
|
+
return a safe pagination cursor for the changed-node ledger.
|
|
46
|
+
- Validate structured claims, escape GitHub annotation properties, count nested JUnit
|
|
47
|
+
failures, and prevent opt-in URL probes from following redirects.
|
|
48
|
+
- Preserve existing hooks and refuse malformed agent configuration.
|
|
49
|
+
- Pass Action inputs as process arguments; gate trusted PyPI publishing on the full CI
|
|
50
|
+
matrix and extract release notes without dropping their final line.
|
|
51
|
+
- Add a reproducible captioned demo, release documentation, and an organic launch plan.
|
|
52
|
+
|
|
53
|
+
### Verdict rules worth knowing
|
|
54
|
+
- A verdict blocks only on a positive, machine-checkable falsehood. A missing index,
|
|
55
|
+
an uninstalled extra, a dynamic reference, a documentation snippet, a repo with no
|
|
56
|
+
declaration source, or a name absent from a manifest without a lockfile all soften
|
|
57
|
+
to review or unverifiable.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
The fastest way to help is to write an oracle for a stack weftgate does not cover yet.
|
|
4
|
+
An oracle is one file. Scaffold it with `python scripts/new-oracle.py <name> --kind <kind>`
|
|
5
|
+
(it writes the oracle and its four tests), read `docs/ORACLES.md`, use
|
|
6
|
+
`weftgate/oracles/env_vars.py` as the worked reference, and follow the checklist in
|
|
7
|
+
`AGENTS.md` section 6. Install the repo's own pre-push check once with
|
|
8
|
+
`bash scripts/dev-hooks.sh`.
|
|
9
|
+
|
|
10
|
+
## The rule that gets a PR merged or rejected
|
|
11
|
+
|
|
12
|
+
An oracle blocks (`REJECT`) only on a proven, machine-checkable absence. Anything
|
|
13
|
+
it cannot resolve (dynamic names, missing index, uninstalled extra) returns
|
|
14
|
+
`REVIEW` or `UNVERIFIABLE`. A false block is the one bug we will not merge.
|
|
15
|
+
|
|
16
|
+
## Every oracle ships with three tests
|
|
17
|
+
|
|
18
|
+
- true positive: a real broken edge it catches and rejects
|
|
19
|
+
- true negative: correct code it accepts
|
|
20
|
+
- soft case: a dynamic reference it reviews rather than rejects
|
|
21
|
+
|
|
22
|
+
See `tests/test_env_vars.py`.
|
|
23
|
+
|
|
24
|
+
## Before you push
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
ruff check . && ruff format --check . && mypy weftgate && python -m weftgate.selftest && pytest -q
|
|
28
|
+
```
|
weftgate-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Avinash Amudala
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
weftgate-0.1.0/NOTICE
ADDED