mikeian 0.1.2__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.
- mikeian/__init__.py +2 -0
- mikeian/__main__.py +2 -0
- mikeian/_build.py +3 -0
- mikeian/automation.py +107 -0
- mikeian/cli.py +908 -0
- mikeian/compat/__init__.py +1 -0
- mikeian/compat/stringdb/__init__.py +1 -0
- mikeian/compat/stringdb/acceptance.py +31 -0
- mikeian/compat/stringdb/policy.py +41 -0
- mikeian/compat/stringdb/red.py +81 -0
- mikeian/compat/stringdb/review_checks.py +111 -0
- mikeian/config.py +149 -0
- mikeian/decisions.py +87 -0
- mikeian/defaults/orchestrator.json +125 -0
- mikeian/defaults/pricing.json +73 -0
- mikeian/defaults/routing/balanced.json +34 -0
- mikeian/defaults/routing/claude-only.json +29 -0
- mikeian/defaults/routing/deepseek-only.json +29 -0
- mikeian/defaults/routing/economy.json +29 -0
- mikeian/defaults/routing/quality.json +39 -0
- mikeian/doctor.py +52 -0
- mikeian/engine.py +949 -0
- mikeian/failures.py +108 -0
- mikeian/github.py +271 -0
- mikeian/gitops.py +336 -0
- mikeian/helpers/agent +5 -0
- mikeian/isolation.py +135 -0
- mikeian/ledger.py +120 -0
- mikeian/paths.py +77 -0
- mikeian/plan_proposal.py +583 -0
- mikeian/pricing.py +206 -0
- mikeian/probes.py +145 -0
- mikeian/procid.py +84 -0
- mikeian/project.py +215 -0
- mikeian/prompts/acceptance-test.md +4 -0
- mikeian/prompts/architect.md +4 -0
- mikeian/prompts/ci-diagnosis.md +4 -0
- mikeian/prompts/implementation.md +4 -0
- mikeian/prompts/integration.md +4 -0
- mikeian/prompts/milestone-review.md +4 -0
- mikeian/prompts/planner.md +4 -0
- mikeian/prompts/repair.md +4 -0
- mikeian/prompts/reviewer.md +4 -0
- mikeian/prompts/specification.md +4 -0
- mikeian/prompts.py +38 -0
- mikeian/providers.py +298 -0
- mikeian/red.py +2 -0
- mikeian/report.py +173 -0
- mikeian/review.py +344 -0
- mikeian/review_checks.py +86 -0
- mikeian/scheduler.py +136 -0
- mikeian/schemas/project.schema.json +344 -0
- mikeian/security.py +53 -0
- mikeian/specs.py +100 -0
- mikeian/staged.py +164 -0
- mikeian/state.py +714 -0
- mikeian/tasks.py +203 -0
- mikeian/templates/minimal-migration/.gitignore +2 -0
- mikeian/templates/minimal-migration/AGENTS.md +3 -0
- mikeian/templates/minimal-migration/checks/verify.py +27 -0
- mikeian/templates/minimal-migration/demo.py +115 -0
- mikeian/templates/minimal-migration/docs/architecture.md +3 -0
- mikeian/templates/minimal-migration/docs/strategy.md +3 -0
- mikeian/templates/minimal-migration/legacy/greet.sh +2 -0
- mikeian/templates/minimal-migration/mikeian.toml +40 -0
- mikeian/templates/minimal-migration/plan/config/decisions.json +1 -0
- mikeian/templates/minimal-migration/plan/config/orchestrator.json +126 -0
- mikeian/templates/minimal-migration/plan/config/pricing.json +73 -0
- mikeian/templates/minimal-migration/plan/config/routing.json +29 -0
- mikeian/templates/minimal-migration/plan/contracts/greeting.md +3 -0
- mikeian/templates/minimal-migration/plan/conventions.md +3 -0
- mikeian/templates/minimal-migration/plan/jobs/api.md +12 -0
- mikeian/templates/minimal-migration/plan/jobs/cli.md +12 -0
- mikeian/templates/minimal-migration/plan/jobs/guide.md +12 -0
- mikeian/templates/minimal-migration/plan/prompts/acceptance-test.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/architect.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/ci-diagnosis.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/implementation.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/integration.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/milestone-review.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/planner.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/repair.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/reviewer.md +4 -0
- mikeian/templates/minimal-migration/plan/prompts/specification.md +4 -0
- mikeian/ui.py +92 -0
- mikeian/verify.py +180 -0
- mikeian-0.1.2.dist-info/METADATA +155 -0
- mikeian-0.1.2.dist-info/RECORD +93 -0
- mikeian-0.1.2.dist-info/WHEEL +5 -0
- mikeian-0.1.2.dist-info/entry_points.txt +3 -0
- mikeian-0.1.2.dist-info/licenses/LICENSE +7 -0
- mikeian-0.1.2.dist-info/licenses/NOTICE +4 -0
- mikeian-0.1.2.dist-info/top_level.txt +1 -0
mikeian/__init__.py
ADDED
mikeian/__main__.py
ADDED
mikeian/_build.py
ADDED
mikeian/automation.py
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Small opt-in bridge from the existing reviewed workflow to a human-mergeable PR.
|
|
2
|
+
|
|
3
|
+
The human authorizes one fixed plan. Independent review supplies routine signoff; architecture,
|
|
4
|
+
protected scopes, evidence checks, budget accounting and GitHub merge protections remain unchanged.
|
|
5
|
+
"""
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import json
|
|
10
|
+
import time
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from .security import redact, truncate
|
|
14
|
+
from .state import StateError
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def prepare(orch, spec, selected):
|
|
18
|
+
"""A confirmed start against a newer approved spec replaces separate reject/spec-change/verify commands."""
|
|
19
|
+
for tid in selected:
|
|
20
|
+
row = orch.store.task(tid)
|
|
21
|
+
if not row or row["status"] not in ("VERIFYING", "APPROVED") or not row["verified_commit"] or row["verified_spec_commit"] == spec.commit:
|
|
22
|
+
continue
|
|
23
|
+
orch.store.reopen(tid, "human-plan", "Confirmed run against updated trusted specification " + spec.commit, "specification")
|
|
24
|
+
task = spec.tasks[tid]
|
|
25
|
+
orch.store.add_approval(tid, "spec-change:" + task.spec_hash, "human-plan",
|
|
26
|
+
note="Acknowledged by the explicit start-plan confirmation")
|
|
27
|
+
orch.store.update_task(tid, spec_hash=task.spec_hash)
|
|
28
|
+
orch.verify_only(spec, tid)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def signoff(orch, spec, tid):
|
|
32
|
+
from .cli import cmd_approve
|
|
33
|
+
st = orch.store
|
|
34
|
+
st.require_review(tid, spec.commit)
|
|
35
|
+
row, review = st.task(tid), st.independent_review(tid)
|
|
36
|
+
if row["status"] in ("APPROVED", "ACCEPTANCE_FROZEN"):
|
|
37
|
+
return
|
|
38
|
+
coverage = json.loads(review["coverage"])
|
|
39
|
+
items = ["review:" + e["check_id"] for e in st.verification(tid, row["verified_commit"])
|
|
40
|
+
if e["kind"] == "HUMAN_REVIEW"]
|
|
41
|
+
if any(coverage.get(item, {}).get("status") != "PASS" for item in items):
|
|
42
|
+
raise StateError("independent review must explicitly cover every manual check; reopen, verify and review again")
|
|
43
|
+
task = spec.tasks[tid]
|
|
44
|
+
if task.is_acceptance:
|
|
45
|
+
items.append("acceptance-review")
|
|
46
|
+
args = argparse.Namespace(task_id=tid, by="ai-review:" + review["id"], item=items,
|
|
47
|
+
spec_change=False, final=not task.is_acceptance, freeze=task.is_acceptance,
|
|
48
|
+
rebind_frozen=False, recover_freeze=False, _actor="ai-review")
|
|
49
|
+
# Reuse every final/freeze gate; this grants no architectural or activation prerequisite.
|
|
50
|
+
if cmd_approve(args, orch, None) != 0:
|
|
51
|
+
raise StateError("independent AI signoff did not satisfy existing approval gates")
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
def comment(orch, spec, tid, github, pr):
|
|
55
|
+
orch.store.require_review(tid, spec.commit)
|
|
56
|
+
review = orch.store.independent_review(tid)
|
|
57
|
+
identity = str(pr["number"]) + ":" + review["id"]
|
|
58
|
+
if orch.store.q1("SELECT 1 FROM events WHERE task_id=? AND kind='ai-review-comment' AND detail=?", (tid, identity)):
|
|
59
|
+
return
|
|
60
|
+
report = Path(review["report_path"]).read_text()
|
|
61
|
+
body = (f"<!-- stringdb-ai-review:{identity} -->\n"
|
|
62
|
+
f"Independent AI review: **{review['verdict']}**\n\n"
|
|
63
|
+
f"Implementation: `{review['commit_sha']}`\nTrusted specification: `{review['spec_commit']}`\n"
|
|
64
|
+
f"Report SHA256: `{review['report_digest']}`\n\n" + report +
|
|
65
|
+
"\n\n_AI analysis and delegated local signoff. GitHub approval/merge remains a human action._")
|
|
66
|
+
github.gh.call("pr", "comment", str(pr["number"]), "--body-file", "-", input_=truncate(redact(body), 60000))
|
|
67
|
+
orch.store.event("ai-review", "ai-review-comment", tid, identity)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def complete(orch, spec, tid, github, budget, cancel):
|
|
71
|
+
"""Publish, analyze CI, repair implementation once if necessary; no merge or daemon."""
|
|
72
|
+
for repair in range(2):
|
|
73
|
+
if cancel.is_set():
|
|
74
|
+
return False
|
|
75
|
+
row = orch.store.task(tid)
|
|
76
|
+
review = orch.store.independent_review(tid)
|
|
77
|
+
if not review or review["verdict"] != "APPROVE":
|
|
78
|
+
print(f"{tid}: stopped at {review['verdict'] if review else row['status']}; no PR published")
|
|
79
|
+
return False
|
|
80
|
+
signoff(orch, spec, tid)
|
|
81
|
+
if spec.tasks[tid].is_acceptance:
|
|
82
|
+
print(f"{tid}: independently reviewed and frozen; it will be published with its implementation partner")
|
|
83
|
+
return True
|
|
84
|
+
pr = github.publish(spec, tid)
|
|
85
|
+
comment(orch, spec, tid, github, pr)
|
|
86
|
+
print(f"{tid}: AI-reviewed PR {pr['url']}; checking CI (human merge only)")
|
|
87
|
+
deadline = time.monotonic() + orch.settings.orch["verification_timeout_seconds"]
|
|
88
|
+
while not cancel.is_set():
|
|
89
|
+
ci = github.ci(tid)
|
|
90
|
+
if ci["status"] != "PENDING":
|
|
91
|
+
break
|
|
92
|
+
if time.monotonic() >= deadline:
|
|
93
|
+
print(f"{tid}: CI still pending; rerun the same command to resume")
|
|
94
|
+
return False
|
|
95
|
+
cancel.wait(10)
|
|
96
|
+
if cancel.is_set():
|
|
97
|
+
return False
|
|
98
|
+
if ci["status"] == "PASSED":
|
|
99
|
+
print(f"{tid}: CI passed; ready for human merge: {pr['url']}")
|
|
100
|
+
return True
|
|
101
|
+
if ci["status"] != "FAILED" or repair or github.classify_failure(ci["log"]) != "implementation":
|
|
102
|
+
print(f"{tid}: CI {ci['status']}; automatic repair stopped (infrastructure/unknown failure or repair limit)")
|
|
103
|
+
return False
|
|
104
|
+
# ci() already reopened the failed revision and retained its findings. Existing workflow
|
|
105
|
+
# corrects, verifies and independently reviews it using the same authorized budget/ladder.
|
|
106
|
+
orch.workflow(spec, 1, budget, cancel, tid, [tid])
|
|
107
|
+
return False
|