kwik-e-gate 0.4.0__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.
- kwik_e_gate/__init__.py +3 -0
- kwik_e_gate/adapters.py +325 -0
- kwik_e_gate/binding.py +112 -0
- kwik_e_gate/classification.py +36 -0
- kwik_e_gate/claude_review.py +149 -0
- kwik_e_gate/cli.py +179 -0
- kwik_e_gate/codex_install.py +212 -0
- kwik_e_gate/command_detection.py +208 -0
- kwik_e_gate/config.py +231 -0
- kwik_e_gate/delegate_judge.py +211 -0
- kwik_e_gate/doctor.py +147 -0
- kwik_e_gate/engine.py +807 -0
- kwik_e_gate/execution.py +101 -0
- kwik_e_gate/gate_result.py +141 -0
- kwik_e_gate/gitstate.py +244 -0
- kwik_e_gate/hooks.py +207 -0
- kwik_e_gate/init_repo.py +646 -0
- kwik_e_gate/providers.py +194 -0
- kwik_e_gate/receipts.py +115 -0
- kwik_e_gate/repo_runner.py +451 -0
- kwik_e_gate/routing.py +77 -0
- kwik_e_gate/schemas/__init__.py +1 -0
- kwik_e_gate/schemas/gate-result-v1.schema.json +184 -0
- kwik_e_gate/status.py +24 -0
- kwik_e_gate/workflow.py +183 -0
- kwik_e_gate-0.4.0.dist-info/METADATA +163 -0
- kwik_e_gate-0.4.0.dist-info/RECORD +31 -0
- kwik_e_gate-0.4.0.dist-info/WHEEL +5 -0
- kwik_e_gate-0.4.0.dist-info/entry_points.txt +4 -0
- kwik_e_gate-0.4.0.dist-info/licenses/LICENSE +190 -0
- kwik_e_gate-0.4.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"title": "Gate Result v1",
|
|
4
|
+
"description": "Portable result contract shared by HermesGate, PyGate, and QuickGate.js.",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"additionalProperties": true,
|
|
7
|
+
"required": [
|
|
8
|
+
"schema",
|
|
9
|
+
"status",
|
|
10
|
+
"snapshot_digest",
|
|
11
|
+
"checked_paths",
|
|
12
|
+
"checks",
|
|
13
|
+
"findings",
|
|
14
|
+
"command_versions",
|
|
15
|
+
"elapsed_ms",
|
|
16
|
+
"output_truncated",
|
|
17
|
+
"errors"
|
|
18
|
+
],
|
|
19
|
+
"properties": {
|
|
20
|
+
"schema": {
|
|
21
|
+
"const": "gate-result/v1"
|
|
22
|
+
},
|
|
23
|
+
"version": {
|
|
24
|
+
"type": "string",
|
|
25
|
+
"const": "gate-result/v1",
|
|
26
|
+
"deprecated": true,
|
|
27
|
+
"description": "Compatibility discriminator retained for one release. New consumers must use schema."
|
|
28
|
+
},
|
|
29
|
+
"status": {
|
|
30
|
+
"enum": [
|
|
31
|
+
"pass",
|
|
32
|
+
"fail",
|
|
33
|
+
"timeout",
|
|
34
|
+
"error"
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
"snapshot_digest": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"minLength": 1
|
|
40
|
+
},
|
|
41
|
+
"snapshot_digest_after": {
|
|
42
|
+
"type": [
|
|
43
|
+
"string",
|
|
44
|
+
"null"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
"snapshot_changed": {
|
|
48
|
+
"type": "boolean"
|
|
49
|
+
},
|
|
50
|
+
"checked_paths": {
|
|
51
|
+
"type": "array",
|
|
52
|
+
"items": {
|
|
53
|
+
"type": "string"
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"checks": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"items": {
|
|
59
|
+
"$ref": "#/$defs/check"
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"findings": {
|
|
63
|
+
"type": "array"
|
|
64
|
+
},
|
|
65
|
+
"command_versions": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"additionalProperties": {
|
|
68
|
+
"oneOf": [
|
|
69
|
+
{
|
|
70
|
+
"type": "string"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "object"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"elapsed_ms": {
|
|
79
|
+
"type": "integer",
|
|
80
|
+
"minimum": 0
|
|
81
|
+
},
|
|
82
|
+
"output_truncated": {
|
|
83
|
+
"type": "boolean"
|
|
84
|
+
},
|
|
85
|
+
"errors": {
|
|
86
|
+
"type": "array",
|
|
87
|
+
"items": {
|
|
88
|
+
"oneOf": [
|
|
89
|
+
{"type": "string"},
|
|
90
|
+
{"type": "object"}
|
|
91
|
+
]
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
"diagnostics": {
|
|
95
|
+
"type": "array",
|
|
96
|
+
"items": {
|
|
97
|
+
"oneOf": [
|
|
98
|
+
{"type": "string"},
|
|
99
|
+
{"type": "object"}
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
"config_identity": {
|
|
104
|
+
"type": [
|
|
105
|
+
"string",
|
|
106
|
+
"object"
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
"config_digest": {
|
|
110
|
+
"type": "string"
|
|
111
|
+
},
|
|
112
|
+
"config_version": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
},
|
|
115
|
+
"package_version": {
|
|
116
|
+
"type": "string"
|
|
117
|
+
},
|
|
118
|
+
"state_dir": {
|
|
119
|
+
"type": [
|
|
120
|
+
"string",
|
|
121
|
+
"null"
|
|
122
|
+
]
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
"$defs": {
|
|
126
|
+
"check": {
|
|
127
|
+
"type": "object",
|
|
128
|
+
"additionalProperties": true,
|
|
129
|
+
"required": [
|
|
130
|
+
"name",
|
|
131
|
+
"status",
|
|
132
|
+
"argv",
|
|
133
|
+
"elapsed_ms",
|
|
134
|
+
"timed_out",
|
|
135
|
+
"output_truncated"
|
|
136
|
+
],
|
|
137
|
+
"properties": {
|
|
138
|
+
"name": {
|
|
139
|
+
"type": "string",
|
|
140
|
+
"minLength": 1
|
|
141
|
+
},
|
|
142
|
+
"status": {
|
|
143
|
+
"enum": [
|
|
144
|
+
"pass",
|
|
145
|
+
"fail",
|
|
146
|
+
"timeout",
|
|
147
|
+
"missing",
|
|
148
|
+
"error",
|
|
149
|
+
"skipped"
|
|
150
|
+
]
|
|
151
|
+
},
|
|
152
|
+
"argv": {
|
|
153
|
+
"type": "array",
|
|
154
|
+
"items": {
|
|
155
|
+
"type": "string"
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
"elapsed_ms": {
|
|
159
|
+
"type": "integer",
|
|
160
|
+
"minimum": 0
|
|
161
|
+
},
|
|
162
|
+
"exit_code": {
|
|
163
|
+
"type": [
|
|
164
|
+
"integer",
|
|
165
|
+
"null"
|
|
166
|
+
]
|
|
167
|
+
},
|
|
168
|
+
"signal": {
|
|
169
|
+
"type": [
|
|
170
|
+
"integer",
|
|
171
|
+
"string",
|
|
172
|
+
"null"
|
|
173
|
+
]
|
|
174
|
+
},
|
|
175
|
+
"timed_out": {
|
|
176
|
+
"type": "boolean"
|
|
177
|
+
},
|
|
178
|
+
"output_truncated": {
|
|
179
|
+
"type": "boolean"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
kwik_e_gate/status.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from enum import StrEnum
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Status(StrEnum):
|
|
7
|
+
PASS = "PASS"
|
|
8
|
+
FAIL = "FAIL"
|
|
9
|
+
NOT_APPLICABLE = "NOT_APPLICABLE"
|
|
10
|
+
NOT_CONFIGURED = "NOT_CONFIGURED"
|
|
11
|
+
REVIEW_UNAVAILABLE = "REVIEW_UNAVAILABLE"
|
|
12
|
+
PARKED = "PARKED"
|
|
13
|
+
ERROR = "ERROR"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
EXIT_CODES = {
|
|
17
|
+
Status.PASS: 0,
|
|
18
|
+
Status.NOT_APPLICABLE: 0,
|
|
19
|
+
Status.FAIL: 1,
|
|
20
|
+
Status.NOT_CONFIGURED: 2,
|
|
21
|
+
Status.ERROR: 2,
|
|
22
|
+
Status.REVIEW_UNAVAILABLE: 3,
|
|
23
|
+
Status.PARKED: 3,
|
|
24
|
+
}
|
kwik_e_gate/workflow.py
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"""The local run / receipt / verify workflow. No repair or reviewer calls."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
import time
|
|
8
|
+
import uuid
|
|
9
|
+
from datetime import UTC, datetime
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
from typing import Any
|
|
12
|
+
|
|
13
|
+
from .config import load_config
|
|
14
|
+
from .engine import fast, full
|
|
15
|
+
from .gitstate import ContentReadError, GitError, diff_digest, repo_identity, repo_root, scope
|
|
16
|
+
from .receipts import SCHEMA, _atomic_json, read_receipt, receipt_matches, receipt_path
|
|
17
|
+
from .routing import select
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def plan(start: Path, *, mode: str = "auto", base: str | None = None) -> dict[str, Any]:
|
|
21
|
+
"""Read-only selection preview. PLANNED is not a checked PASS."""
|
|
22
|
+
try:
|
|
23
|
+
root = repo_root(start)
|
|
24
|
+
if root is None:
|
|
25
|
+
raise ValueError("not a Git repository")
|
|
26
|
+
paths, scope_base = scope(root, base=base)
|
|
27
|
+
route = select(load_config(root), paths, requested=mode)
|
|
28
|
+
return {"schema": "kwik-gate/plan-v1", "status": "PLANNED",
|
|
29
|
+
"routing": route, "checked_paths": paths, "scope_base": scope_base}
|
|
30
|
+
except (OSError, GitError, ValueError, TypeError) as exc:
|
|
31
|
+
return {"schema": "kwik-gate/plan-v1", "status": "ERROR", "reason": str(exc)}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def run(
|
|
35
|
+
start: Path, *, mode: str = "auto", base: str | None = None, output: Path | None = None
|
|
36
|
+
) -> dict[str, Any]:
|
|
37
|
+
"""Run declared checks and persist a receipt for every terminal outcome.
|
|
38
|
+
|
|
39
|
+
stdout contains the receipt even if storage is unavailable. A persistence
|
|
40
|
+
failure cannot be returned as PASS. Help/argument-parser errors are not runs.
|
|
41
|
+
"""
|
|
42
|
+
began = time.monotonic()
|
|
43
|
+
root = None
|
|
44
|
+
kind = mode if mode in {"fast", "full"} else "fast"
|
|
45
|
+
destination = None
|
|
46
|
+
exported = False
|
|
47
|
+
export_allowed = False
|
|
48
|
+
route = None
|
|
49
|
+
if output is not None:
|
|
50
|
+
output = output.expanduser().resolve()
|
|
51
|
+
export_allowed = not output.is_relative_to(root or start.resolve())
|
|
52
|
+
try:
|
|
53
|
+
root = repo_root(start)
|
|
54
|
+
if root is None:
|
|
55
|
+
raise ValueError("not a Git repository")
|
|
56
|
+
if mode not in {"auto", "fast", "full"}:
|
|
57
|
+
raise ValueError("mode must be auto, fast or full")
|
|
58
|
+
if output is not None:
|
|
59
|
+
if output.is_relative_to(root):
|
|
60
|
+
export_allowed = False
|
|
61
|
+
raise ValueError("receipt export must be outside the repository")
|
|
62
|
+
export_allowed = True
|
|
63
|
+
paths, _ = scope(root, base=base)
|
|
64
|
+
route = select(load_config(root), paths, requested=mode)
|
|
65
|
+
kind = route["mode"]
|
|
66
|
+
outcome = fast(root, base=base) if kind == "fast" else full(root, base=base)
|
|
67
|
+
checked = outcome.get("receipt", {}).get("checked_paths")
|
|
68
|
+
if isinstance(checked, list):
|
|
69
|
+
route = select(load_config(root), checked, requested=mode)
|
|
70
|
+
if route["mode"] != kind:
|
|
71
|
+
outcome.update(status="ERROR", reason="gate decision changed before execution; rerun")
|
|
72
|
+
except (OSError, GitError, ValueError, TypeError) as exc:
|
|
73
|
+
outcome = {"status": "ERROR", "reason": str(exc)}
|
|
74
|
+
except Exception as exc: # noqa: BLE001 -- every failed run must still issue a receipt
|
|
75
|
+
outcome = {"status": "ERROR", "reason": f"internal execution error ({type(exc).__name__})"}
|
|
76
|
+
payload = outcome.get("receipt")
|
|
77
|
+
if not isinstance(payload, dict):
|
|
78
|
+
payload = {
|
|
79
|
+
"schema": SCHEMA,
|
|
80
|
+
"kind": kind,
|
|
81
|
+
"created_at": datetime.now(UTC).isoformat(),
|
|
82
|
+
"repository": _repository(root or start, is_git=root is not None),
|
|
83
|
+
"diff_sha256": "0" * 64,
|
|
84
|
+
"elapsed_ms": round((time.monotonic() - began) * 1000),
|
|
85
|
+
"command_versions": {},
|
|
86
|
+
"checks": [],
|
|
87
|
+
"findings": [],
|
|
88
|
+
}
|
|
89
|
+
payload = dict(payload)
|
|
90
|
+
if route is not None:
|
|
91
|
+
payload["routing"] = route
|
|
92
|
+
checks = payload.get("checks", [])
|
|
93
|
+
passed = outcome.get("status") == "PASS" and any(
|
|
94
|
+
check.get("status") in {"PASS", "pass"} for check in checks
|
|
95
|
+
)
|
|
96
|
+
payload.update({
|
|
97
|
+
"status": "PASS" if passed else "FAIL",
|
|
98
|
+
"issued_at": datetime.now(UTC).isoformat(),
|
|
99
|
+
"reason_code": outcome.get("status", "ERROR"),
|
|
100
|
+
"reason": outcome.get("reason", ""),
|
|
101
|
+
})
|
|
102
|
+
if outcome.get("status") == "PASS" and not passed:
|
|
103
|
+
payload.update(reason_code="NO_CHECKS_EXECUTED", reason="no checks executed")
|
|
104
|
+
try:
|
|
105
|
+
destination = receipt_path(root, kind) if root else _failure_path()
|
|
106
|
+
_atomic_json(destination, payload)
|
|
107
|
+
if output is not None and export_allowed:
|
|
108
|
+
_atomic_json(output, payload)
|
|
109
|
+
exported = True
|
|
110
|
+
except (OSError, GitError) as exc:
|
|
111
|
+
payload.update(status="FAIL", reason_code="RECEIPT_WRITE_ERROR", reason=str(exc))
|
|
112
|
+
# The JSON result remains a receipt even if both destinations are unwritable.
|
|
113
|
+
if destination is not None:
|
|
114
|
+
try:
|
|
115
|
+
_atomic_json(destination, payload)
|
|
116
|
+
except OSError:
|
|
117
|
+
destination = None
|
|
118
|
+
return {
|
|
119
|
+
"schema": "hermes-gate/result-v1",
|
|
120
|
+
"command": "run",
|
|
121
|
+
"status": payload["status"],
|
|
122
|
+
"reason": payload["reason"],
|
|
123
|
+
"receipt": payload,
|
|
124
|
+
"receipt_path": str(destination) if destination is not None else None,
|
|
125
|
+
"export_path": str(output) if exported else None,
|
|
126
|
+
"cached": bool(outcome.get("cached")),
|
|
127
|
+
"routing": route,
|
|
128
|
+
"elapsed_ms": round((time.monotonic() - began) * 1000),
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
def verify(start: Path, *, path: Path | None = None, kind: str = "auto") -> dict[str, Any]:
|
|
133
|
+
"""Read-only verification; uses recorded scope and current complete workload."""
|
|
134
|
+
began = time.monotonic()
|
|
135
|
+
passed = False
|
|
136
|
+
try:
|
|
137
|
+
root = repo_root(start)
|
|
138
|
+
raw = json.loads(path.read_text()) if path else read_receipt(root, kind) if (
|
|
139
|
+
root and kind != "auto"
|
|
140
|
+
) else None
|
|
141
|
+
if root and path is None and kind == "auto":
|
|
142
|
+
candidates = [(receipt_path(root, item), item) for item in ("fast", "full")]
|
|
143
|
+
candidates = [(p.stat().st_mtime_ns, item) for p, item in candidates if p.exists()]
|
|
144
|
+
latest = max(candidates, default=None)
|
|
145
|
+
raw = read_receipt(root, latest[1]) if latest else None
|
|
146
|
+
if root is not None and isinstance(raw, dict):
|
|
147
|
+
recorded_kind = raw.get("kind")
|
|
148
|
+
paths = raw.get("checked_paths")
|
|
149
|
+
base = raw.get("scope_base")
|
|
150
|
+
if (
|
|
151
|
+
recorded_kind in {"fast", "full"}
|
|
152
|
+
and isinstance(paths, list)
|
|
153
|
+
and all(
|
|
154
|
+
isinstance(item, str) and not Path(item).is_absolute()
|
|
155
|
+
and ".." not in Path(item).parts for item in paths
|
|
156
|
+
)
|
|
157
|
+
and isinstance(base, str)
|
|
158
|
+
):
|
|
159
|
+
digest = diff_digest(root, paths, base=base)
|
|
160
|
+
passed = receipt_matches(root, raw, recorded_kind, digest)
|
|
161
|
+
except (OSError, GitError, ContentReadError, ValueError, TypeError):
|
|
162
|
+
pass
|
|
163
|
+
return {
|
|
164
|
+
"schema": "hermes-gate/result-v1",
|
|
165
|
+
"command": "verify",
|
|
166
|
+
"status": "PASS" if passed else "FAIL",
|
|
167
|
+
"reason": "" if passed else "receipt is missing, failed, stale, or incomplete; run kwik-gate run",
|
|
168
|
+
"elapsed_ms": round((time.monotonic() - began) * 1000),
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
def _failure_path() -> Path:
|
|
173
|
+
cache = Path(os.environ.get("XDG_CACHE_HOME", str(Path.home() / ".cache")))
|
|
174
|
+
return cache / "kwik-gate" / "receipts" / f"failure-{uuid.uuid4().hex}.json"
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
def _repository(root: Path, *, is_git: bool) -> dict[str, str]:
|
|
178
|
+
if is_git:
|
|
179
|
+
try:
|
|
180
|
+
return repo_identity(root)
|
|
181
|
+
except (OSError, GitError):
|
|
182
|
+
pass
|
|
183
|
+
return {"root": str(root.resolve()), "head": "NONE", "remote": "NONE"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kwik-e-gate
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: KWIK-E-GATE: fast local checks and content-bound receipts for coding agents
|
|
5
|
+
Author-email: Hermes Labs <roli@hermes-labs.ai>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://hermes-labs.ai/open-source
|
|
8
|
+
Project-URL: Documentation, https://github.com/hermes-labs-ai/kwik-e-gate#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/hermes-labs-ai/kwik-e-gate
|
|
10
|
+
Project-URL: Issues, https://github.com/hermes-labs-ai/kwik-e-gate/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/hermes-labs-ai/kwik-e-gate/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: ai-agents,coding-agent,completion-gate,ci,developer-tools,hermes-labs,quality-assurance,receipts,reproducibility
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
23
|
+
Classifier: Topic :: Software Development :: Testing
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Provides-Extra: test
|
|
28
|
+
Requires-Dist: pytest==9.1.1; extra == "test"
|
|
29
|
+
Requires-Dist: ruff==0.16.8; extra == "test"
|
|
30
|
+
Requires-Dist: build==1.6.1; extra == "test"
|
|
31
|
+
Requires-Dist: PyYAML==6.0.3; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
<h1 align="center">Kwik-E-Gate</h1>
|
|
35
|
+
|
|
36
|
+
> **Experimental / work in progress:** Kwik-E-Gate is under active development. Interfaces and behavior may change; evaluate it on your own repositories before relying on it.
|
|
37
|
+
|
|
38
|
+
<p align="center">
|
|
39
|
+
<img src="docs/assets/kwik-e-gate-header.jpg" alt="Kwik-E-Gate — don't forget the receipt">
|
|
40
|
+
</p>
|
|
41
|
+
|
|
42
|
+
<p align="center"><strong>Run the checks. Get PASS or FAIL. Keep the receipt.</strong></p>
|
|
43
|
+
|
|
44
|
+
<p align="center">
|
|
45
|
+
<a href="#quickstart">Quickstart</a> · <a href="#how-it-works">How it works</a> · <a href="#real-example">Real example</a> · <a href="#github-action">GitHub Action</a>
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
Use Kwik-E-Gate to choose fast or full checks from the changed files and run
|
|
49
|
+
the commands **your repository declares**. It produces a PASS/FAIL receipt you
|
|
50
|
+
can verify later. Local checks require Git and Python. Use
|
|
51
|
+
[Hermes Gate](https://github.com/hermes-labs-ai/hermes-gate) for a repository
|
|
52
|
+
that uses its explicit completion and Git boundary checks. The two Python
|
|
53
|
+
packages can share an environment. Choose one tool to manage a repository's
|
|
54
|
+
`.hermes/gate.toml`. [Migration and release](docs/MIGRATION.md)
|
|
55
|
+
|
|
56
|
+
## Quickstart
|
|
57
|
+
|
|
58
|
+
### Install
|
|
59
|
+
|
|
60
|
+
Requires Python 3.11+ and Git. The standalone 0.4.0 candidate is staged locally.
|
|
61
|
+
From the reviewed candidate checkout, install it into a virtual environment.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
python3 -m venv .venv
|
|
65
|
+
. .venv/bin/activate
|
|
66
|
+
python -m pip install .
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The PyPI install command will be `python -m pip install kwik-e-gate` once the
|
|
70
|
+
standalone package is published.
|
|
71
|
+
|
|
72
|
+
### Run a local check
|
|
73
|
+
|
|
74
|
+
Try this in a disposable Git repository. `init` detects the Python project and
|
|
75
|
+
writes a profile, runner, and workflow.
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
demo=$(mktemp -d)
|
|
79
|
+
cd "$demo"
|
|
80
|
+
git init -q
|
|
81
|
+
touch requirements.txt
|
|
82
|
+
printf 'answer = 42\n' > app.py
|
|
83
|
+
kwik-e-gate init
|
|
84
|
+
kwik-e-gate run --mode fast
|
|
85
|
+
kwik-e-gate verify
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
In the local replay, `python-parse` and `diff-check` passed. The `run` and
|
|
89
|
+
`verify` JSON each reported `"status": "PASS"`. Editing `app.py` made the
|
|
90
|
+
receipt stale. Run the checks again to verify the new bytes.
|
|
91
|
+
|
|
92
|
+
In your own repository, review `.hermes/gate.toml`, install the tools your
|
|
93
|
+
checks use, and use `kwik-e-gate plan` to preview the selected checks. To keep
|
|
94
|
+
a receipt outside the checkout, use `run --output <path>` and
|
|
95
|
+
`verify --receipt <path>`.
|
|
96
|
+
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
1. **You choose the checks.** `.hermes/gate.toml` names the project's commands and the paths they cover. Kwik-E-Gate never installs ESLint, pytest, or other project tools for you.
|
|
100
|
+
2. **It picks a route.** Ordinary source edits use matching fast checks. Changes to tests, dependencies, CI, gate configuration, auth, schemas, or migrations escalate to full. `kwik-e-gate plan` shows the choice and why; `--mode fast` or `--mode full` selects one explicitly.
|
|
101
|
+
3. **It runs and receipts.** The result records checks, selected paths, outputs, tool versions, and an input/contract binding. Changing included code or gate configuration makes an earlier receipt stale. Run again to get fresh evidence.
|
|
102
|
+
|
|
103
|
+
The routing decision is local and deterministic. It does not read the code to infer intent or call an LLM. The actual check time depends on the commands your project declares. [`review`](docs/CONFIGURATION.md) is an optional separate step, not a prerequisite for local PASS/FAIL.
|
|
104
|
+
|
|
105
|
+
[Configuration reference](docs/CONFIGURATION.md) covers profiles, file globs, adapters, exclusions, and review policy.
|
|
106
|
+
|
|
107
|
+
## Real example
|
|
108
|
+
|
|
109
|
+
While building Kwik-E-Gate, we caught a scanner-scope bug in its own fast gate. The profile selected LintLang for `AGENTS.md`, but the old runner also sent `app.py` and `notes/SKILL.md` to that scanner. An out-of-scope warning failed the run. The fix passed only `AGENTS.md` to LintLang; the same changed inputs and diff digest then passed. Both runs produced receipts.
|
|
110
|
+
|
|
111
|
+
| | Before | After |
|
|
112
|
+
| --- | --- | --- |
|
|
113
|
+
| LintLang received | `AGENTS.md`, `app.py`, `notes/SKILL.md` | `AGENTS.md` |
|
|
114
|
+
| Gate result | **FAIL** | **PASS** |
|
|
115
|
+
| Input diff | `af58fb3b62b5…` | Same digest |
|
|
116
|
+
|
|
117
|
+
[Read the replay and both saved receipt payloads](docs/demo/SCANNER-SCOPE-BUG.md). This was a gate-wiring bug, not a defect in `app.py`; the before/after makes that distinction visible.
|
|
118
|
+
|
|
119
|
+
## GitHub Action
|
|
120
|
+
|
|
121
|
+
### Basic pull request example
|
|
122
|
+
|
|
123
|
+
Use this in a `pull_request` job after preparing the tools named in
|
|
124
|
+
`.hermes/gate.toml`. The example uses the existing public Action pin. The
|
|
125
|
+
Action executes the source at its pin. Use a candidate pin in release staging
|
|
126
|
+
only after its exact reviewed commit is publicly reachable.
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
|
|
130
|
+
with:
|
|
131
|
+
fetch-depth: 0
|
|
132
|
+
persist-credentials: false
|
|
133
|
+
- uses: hermes-labs-ai/kwik-e-gate/.github/actions/kwik-e-gate@266898a2b72a2bf92aa4608a6123999eb00b7f6b
|
|
134
|
+
id: gate
|
|
135
|
+
with:
|
|
136
|
+
mode: full
|
|
137
|
+
base: ${{ github.event.pull_request.base.sha }}
|
|
138
|
+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
|
|
139
|
+
if: always() && steps.gate.outputs.receipt-path != ''
|
|
140
|
+
with:
|
|
141
|
+
name: kwik-e-gate-receipt
|
|
142
|
+
path: ${{ steps.gate.outputs.receipt-path }}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The Action reports `status` and `receipt-path`. The upload step preserves the
|
|
146
|
+
receipt after passing or failing checks when the runner exported one.
|
|
147
|
+
|
|
148
|
+
| Input | Default | Set it when |
|
|
149
|
+
| --- | --- | --- |
|
|
150
|
+
| `mode` | `auto` | Select `fast` or `full` explicitly. |
|
|
151
|
+
| `working-directory` | `.` | The checkout containing the gate profile is elsewhere. |
|
|
152
|
+
| `base` | Empty | Supply the comparison commit for a pull request or a detached merge checkout. |
|
|
153
|
+
| `python-version` | `3.11` | Choose a different Python version, 3.11 or newer. |
|
|
154
|
+
|
|
155
|
+
`kwik-e-gate init` generates a workflow with a public source pin. It uses the
|
|
156
|
+
PR base or previous push revision and falls back to the first parent on manual
|
|
157
|
+
runs or new branches. [CI examples](docs/CI-ADMISSION.md)
|
|
158
|
+
|
|
159
|
+
## What a receipt means
|
|
160
|
+
|
|
161
|
+
A PASS says the **declared checks** ran successfully on the bound local inputs. It is not a claim that the code is correct or that every dependency and external service was captured. Receipts are unsigned and local to the checkout; `verify` refuses missing, failed, stale, or incomplete evidence. If the code changes, run the gate again. If a repository also requires semantic review, run that separately.
|
|
162
|
+
|
|
163
|
+
Built by [Hermes Labs](https://hermes-labs.ai). [Contributing](CONTRIBUTING.md) · [Security](SECURITY.md) · [License](LICENSE) · [Changelog](CHANGELOG.md)
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
kwik_e_gate/__init__.py,sha256=KO_y8FDli5fpc3Lc3rbjURzb40GrWWnFDsDnrF-LX4Q,65
|
|
2
|
+
kwik_e_gate/adapters.py,sha256=Efw_puNbsDx-G3E0KUhbVI9CKNkBwhi6jKqs23FpB20,12696
|
|
3
|
+
kwik_e_gate/binding.py,sha256=HUgHzpDbiEp-CBrf2ygosjIiv4h2wO6XZl4VhDcfMHk,4563
|
|
4
|
+
kwik_e_gate/classification.py,sha256=JLg4KyA-u_v-uROx7E9PRpeRIS3PsUvF40d6hZrwXmc,579
|
|
5
|
+
kwik_e_gate/claude_review.py,sha256=MFT4IZJ1AowOHvd1dynO2cm9wd0xMqq6FM6GR73KWm8,6808
|
|
6
|
+
kwik_e_gate/cli.py,sha256=dgCgp37qB8gRcquKeMYmbPj9tgTjmWlDirHGTo8bJQA,7751
|
|
7
|
+
kwik_e_gate/codex_install.py,sha256=5h0p9vX9sITZ5t2ytIVEjjBoLFsJkTpbFYOhHAE_jmI,7851
|
|
8
|
+
kwik_e_gate/command_detection.py,sha256=102mxgajh90RtleKNHzcdA5Vwe8WvvhprGEfvZQNDhw,7127
|
|
9
|
+
kwik_e_gate/config.py,sha256=K4a9k9HtVYDkFa2HOecCRJy400JXXmt06a4ZMf3SVZQ,8617
|
|
10
|
+
kwik_e_gate/delegate_judge.py,sha256=O4CoLI84DN72UGV8PatDs3hEedPj7eBLlBoBuAONqvA,8721
|
|
11
|
+
kwik_e_gate/doctor.py,sha256=VR0htdjcakFD73AGd9PV8VZIqriIjUmHOdnoPSSQANg,5700
|
|
12
|
+
kwik_e_gate/engine.py,sha256=fgIknPeSBdkZk5RlTonBEzAS1RWw5tF28ygtGQWZUK0,31672
|
|
13
|
+
kwik_e_gate/execution.py,sha256=2QKhdh-ygX54Veq6aFlS744m77vslXnf1EX0PuUbxrk,2689
|
|
14
|
+
kwik_e_gate/gate_result.py,sha256=nmVziM5x9zfbgtz4djOumZgWFogqJjAT1cjjGXgCFNo,6613
|
|
15
|
+
kwik_e_gate/gitstate.py,sha256=0k9tW8ddww0HF0AyYknnu_OHCkm3aOgTZhVzW1nQGt8,9494
|
|
16
|
+
kwik_e_gate/hooks.py,sha256=3-saDvxK6O6BM9U3Lk22eA0hzGSw_-YekIbPq_LTJZ8,7887
|
|
17
|
+
kwik_e_gate/init_repo.py,sha256=op4ox5goEzo04oV_BHBYJv5kn_YkLNl7xhe1KpkVBko,27954
|
|
18
|
+
kwik_e_gate/providers.py,sha256=yIvpCOzjqHuu8xntbxPI7ETV9BIMj2yj4ne_maQSzP0,7300
|
|
19
|
+
kwik_e_gate/receipts.py,sha256=74g1zTlQJH5SqnhCpNvbgyvmuj8ZFeA6uGsWjKdNEPI,3838
|
|
20
|
+
kwik_e_gate/repo_runner.py,sha256=zpswZwyg4J25bG6credVYsh_g-eN2lA452UtuhkHadg,17739
|
|
21
|
+
kwik_e_gate/routing.py,sha256=5peqdJLmMMGd6w9m_74E9CIYn2DTBAejF5embFhjO3c,3825
|
|
22
|
+
kwik_e_gate/status.py,sha256=aJcu8ezleHIRZsTv3-CgCBl_847qMepCT59gmQHhdOs,482
|
|
23
|
+
kwik_e_gate/workflow.py,sha256=CpodUd96Nd0ueNWfY2KjOTiyF1GVJIV42IRcY0QsB0Q,7740
|
|
24
|
+
kwik_e_gate/schemas/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
25
|
+
kwik_e_gate/schemas/gate-result-v1.schema.json,sha256=VuG72G08HXwb_am-M-1MwRUI-SWOEfRmDWIMbAEasDY,3470
|
|
26
|
+
kwik_e_gate-0.4.0.dist-info/licenses/LICENSE,sha256=DcChZjBrqt7ARXx3ih7FndWD_mmZhA-Uss2-_cg2IVM,10762
|
|
27
|
+
kwik_e_gate-0.4.0.dist-info/METADATA,sha256=KdZZHtqaEeuze4pB8qQMmybUIYuwadF9cDcWoxUY2TI,7964
|
|
28
|
+
kwik_e_gate-0.4.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
29
|
+
kwik_e_gate-0.4.0.dist-info/entry_points.txt,sha256=huh3LQt8-3R6krE928HjNKCI6CiGWg_T8qa3kULFpfM,157
|
|
30
|
+
kwik_e_gate-0.4.0.dist-info/top_level.txt,sha256=1wSqIdm0PAlvBtrfFDS9xC31rMQWYqjtxVgJzYM5kro,12
|
|
31
|
+
kwik_e_gate-0.4.0.dist-info/RECORD,,
|