Skip to content

Commit d14df5e

Browse files
author
SIN-Agent
committed
chore(bundle): ruff format the sibling repo dirs tracked in this repo
These directories are not git submodules — they are tracked file content that mirror their upstream OpenSIN-Code repos. CI's 'ruff check .' covers the whole tree, so they must be lint-clean too. ruff check . → 0 errors ruff format --check . → 102 files already formatted Affected (auto-formatted only): - SIN-Code-Architectural-Debt-Watchdogs/ - SIN-Code-Bundle/ (nested copy) - SIN-Code-Ephemeral-Full-Stack-Mocking-Orchestration/ - SIN-Code-Intent-Based-Diffing/ - SIN-Code-Proof-of-Correctness/ - SIN-Code-Semantic-Codebase-Knowledge-Graphs/ - SIN-Code-Verification-Oracle/
1 parent 5f3da60 commit d14df5e

50 files changed

Lines changed: 416 additions & 329 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/__init__.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""SIN-Code Architectural Debt Watchdog."""
2+
23
__version__ = "0.1.0"
34

5+
from .circuit_breaker import BreakerConfig, BreakerTripped, CircuitBreaker
46
from .complexity import ComplexityAnalyzer, FileReport
5-
from .cost_tracker import CostTracker, CostEntry
6-
from .circuit_breaker import CircuitBreaker, BreakerConfig, BreakerTripped
7+
from .cost_tracker import CostEntry, CostTracker
78
from .daemon import WatchdogDaemon
89

910
__all__ = [

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/circuit_breaker.py‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Circuit Breaker fuer Agent-Loops."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass
@@ -35,17 +36,11 @@ def check(
3536
if iteration is not None:
3637
self._iterations = iteration
3738
if self._iterations >= self.config.max_iterations:
38-
raise BreakerTripped(
39-
f"Max iterations {self.config.max_iterations} reached"
40-
)
39+
raise BreakerTripped(f"Max iterations {self.config.max_iterations} reached")
4140
if current_cost - self._start_cost >= self.config.max_cost_usd:
42-
raise BreakerTripped(
43-
f"Cost limit ${self.config.max_cost_usd} exceeded"
44-
)
41+
raise BreakerTripped(f"Cost limit ${self.config.max_cost_usd} exceeded")
4542
if current_debt - self._start_debt >= self.config.max_debt_increase:
46-
raise BreakerTripped(
47-
f"Debt increased by {self.config.max_debt_increase} points"
48-
)
43+
raise BreakerTripped(f"Debt increased by {self.config.max_debt_increase} points")
4944

5045
def reset(self, start_cost: float = 0.0, start_debt: float = 0.0) -> None:
5146
self._iterations = 0

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/cli.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""CLI fuer den Architectural Debt Watchdog."""
2+
23
from __future__ import annotations
34

45
import json
@@ -30,9 +31,7 @@ def scan(root: str = "."):
3031
{
3132
"debt": debt,
3233
"files_scanned": len(reports),
33-
"top_hotspots": sorted(
34-
hotspots, key=lambda x: -x["complexity"]
35-
)[:10],
34+
"top_hotspots": sorted(hotspots, key=lambda x: -x["complexity"])[:10],
3635
},
3736
indent=2,
3837
)

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/complexity.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Architektur- und Komplexitaets-Analyse via radon."""
2+
23
from __future__ import annotations
34

45
from dataclasses import dataclass, field

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/cost_tracker.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""Trackt API-Kosten von Agent-Runs."""
2+
23
from __future__ import annotations
34

45
import json
5-
from dataclasses import dataclass, asdict
6+
from dataclasses import asdict, dataclass
67
from datetime import datetime, timezone
78
from pathlib import Path
89

9-
1010
# Grobe Pricing (USD pro 1K tokens) - Stand 2026
1111
PRICING = {
1212
"gpt-4o": {"in": 0.0025, "out": 0.01},
@@ -46,9 +46,7 @@ def record(
4646
task: str = "",
4747
) -> CostEntry:
4848
price = PRICING.get(model, DEFAULT_PRICE)
49-
cost = (prompt_tokens / 1000) * price["in"] + (
50-
completion_tokens / 1000
51-
) * price["out"]
49+
cost = (prompt_tokens / 1000) * price["in"] + (completion_tokens / 1000) * price["out"]
5250
entry = CostEntry(
5351
timestamp=datetime.now(timezone.utc).isoformat(),
5452
model=model,

‎SIN-Code-Architectural-Debt-Watchdogs/src/sin_code_adw/daemon.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Background-Daemon, der alle Watchdogs vereint."""
2+
23
from __future__ import annotations
34

45
import json
@@ -40,14 +41,10 @@ def _loop(self) -> None:
4041
)
4142
while self._running:
4243
try:
43-
reports = self.analyzer.analyze(
44-
self.repo_root, exclude=self.DEFAULT_EXCLUDE
45-
)
44+
reports = self.analyzer.analyze(self.repo_root, exclude=self.DEFAULT_EXCLUDE)
4645
current = self.analyzer.debt_score(reports)
4746
total_cost = self.cost.total_for()["total_usd"]
48-
self.breaker.check(
49-
current_cost=total_cost, current_debt=current["score"]
50-
)
47+
self.breaker.check(current_cost=total_cost, current_debt=current["score"])
5148
if current["score"] > baseline["score"] + 20:
5249
self._alert("debt_spike", current)
5350
except BreakerTripped as exc:

‎SIN-Code-Architectural-Debt-Watchdogs/tests/test_complexity.py‎

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22
from pathlib import Path
33

44
import pytest
5-
6-
from sin_code_adw.complexity import ComplexityAnalyzer
7-
from sin_code_adw.cost_tracker import CostTracker
85
from sin_code_adw.circuit_breaker import (
96
BreakerConfig,
107
BreakerTripped,
118
CircuitBreaker,
129
)
10+
from sin_code_adw.complexity import ComplexityAnalyzer
11+
from sin_code_adw.cost_tracker import CostTracker
1312
from sin_code_adw.daemon import WatchdogDaemon
1413

1514

1615
def test_complexity_analyze_and_score():
1716
analyzer = ComplexityAnalyzer()
1817
with tempfile.TemporaryDirectory() as d:
19-
Path(d, "m.py").write_text(
20-
"def simple(x):\n return x + 1\n"
21-
)
18+
Path(d, "m.py").write_text("def simple(x):\n return x + 1\n")
2219
reports = analyzer.analyze(d)
2320
assert len(reports) == 1
2421
score = analyzer.debt_score(reports)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
"""SIN-Code Bundle - Unified SOTA Agent-Engineering Stack."""
2+
23
__version__ = "0.1.0"

‎SIN-Code-Bundle/src/sin_code_bundle/cli.py‎

Lines changed: 24 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Subsysteme werden lazy und defensiv importiert: fehlt eines, bleibt der Rest
44
nutzbar und es wird eine klare Meldung statt eines Importfehlers ausgegeben.
55
"""
6+
67
from __future__ import annotations
78

89
import json
@@ -12,19 +13,15 @@
1213

1314
app = typer.Typer(help="SIN-Code Bundle - Unified SOTA Agent-Engineering Stack")
1415

15-
gitnexus_app = typer.Typer(
16-
help="GitNexus bridge - mandatory graph context for coder agents."
17-
)
16+
gitnexus_app = typer.Typer(help="GitNexus bridge - mandatory graph context for coder agents.")
1817
app.add_typer(gitnexus_app, name="gitnexus")
1918

2019
markitdown_app = typer.Typer(
2120
help="MarkItDown bridge - document->Markdown context for coder agents."
2221
)
2322
app.add_typer(markitdown_app, name="markitdown")
2423

25-
rtk_app = typer.Typer(
26-
help="RTK bridge - token-saving command proxy for coder agents."
27-
)
24+
rtk_app = typer.Typer(help="RTK bridge - token-saving command proxy for coder agents.")
2825
app.add_typer(rtk_app, name="rtk")
2926

3027
_EXCLUDE = ["venv", ".venv", "node_modules", ".git", "__pycache__"]
@@ -37,10 +34,7 @@ def _require(module: str, hint: str):
3734
try:
3835
return importlib.import_module(module)
3936
except ImportError:
40-
typer.echo(
41-
f"[SIN-BUNDLE] Subsystem '{module}' not installed. "
42-
f"Install with: {hint}"
43-
)
37+
typer.echo(f"[SIN-BUNDLE] Subsystem '{module}' not installed. Install with: {hint}")
4438
raise typer.Exit(code=1)
4539

4640

@@ -68,9 +62,7 @@ def status():
6862
from sin_code_bundle import gitnexus, markitdown, rtk
6963

7064
report["GitNexus (graph context, external)"] = gitnexus.detect_env().available
71-
report["MarkItDown (doc->markdown, external)"] = (
72-
markitdown.detect_env().mcp_available
73-
)
65+
report["MarkItDown (doc->markdown, external)"] = markitdown.detect_env().mcp_available
7466
report["RTK (token-saving proxy, external)"] = rtk.detect_env().available
7567
typer.echo(json.dumps(report, indent=2))
7668

@@ -118,11 +110,7 @@ def review(file_a: Path, file_b: Path):
118110
changes = ASTDiff().diff_files(str(file_a), str(file_b))
119111
intents = IntentSummarizer().summarize(changes)
120112
risk = RiskScorer().score(changes)
121-
typer.echo(
122-
json.dumps(
123-
{"intents": [i.__dict__ for i in intents], "risk": risk}, indent=2
124-
)
125-
)
113+
typer.echo(json.dumps({"intents": [i.__dict__ for i in intents], "risk": risk}, indent=2))
126114

127115

128116
@app.command()
@@ -347,20 +335,14 @@ def rtk_gain():
347335
# --------------------------------------------------------------------------- #
348336
@app.command()
349337
def init(
350-
agent: str = typer.Argument(
351-
..., help="Target agent CLI: opencode | codex | hermes | all"
352-
),
353-
scope: str = typer.Option(
354-
"local", help="'local' (this repo) or 'global' (user home)."
355-
),
338+
agent: str = typer.Argument(..., help="Target agent CLI: opencode | codex | hermes | all"),
339+
scope: str = typer.Option("local", help="'local' (this repo) or 'global' (user home)."),
356340
with_agents_md: bool = typer.Option(
357341
True,
358342
"--agents-md/--no-agents-md",
359343
help="Also write AGENTS.md workflow doctrine.",
360344
),
361-
force: bool = typer.Option(
362-
False, "--force", help="Overwrite an existing AGENTS.md."
363-
),
345+
force: bool = typer.Option(False, "--force", help="Overwrite an existing AGENTS.md."),
364346
dry_run: bool = typer.Option(
365347
False, "--dry-run", help="Print what would be written, change nothing."
366348
),
@@ -400,8 +382,7 @@ def init(
400382
typer.echo(f"[SIN-BUNDLE] Wrote AGENTS.md -> {md_path}")
401383
else:
402384
typer.echo(
403-
f"[SIN-BUNDLE] AGENTS.md already exists at {md_path} "
404-
"(use --force to overwrite)."
385+
f"[SIN-BUNDLE] AGENTS.md already exists at {md_path} (use --force to overwrite)."
405386
)
406387

407388
typer.echo("[SIN-BUNDLE] init complete. Restart your agent to load the MCP server.")
@@ -426,17 +407,13 @@ def agents_md_cmd(
426407
if written:
427408
typer.echo(f"[SIN-BUNDLE] Wrote {path}")
428409
else:
429-
typer.echo(
430-
f"[SIN-BUNDLE] {path} already exists (use --force to overwrite)."
431-
)
410+
typer.echo(f"[SIN-BUNDLE] {path} already exists (use --force to overwrite).")
432411

433412

434413
@app.command()
435414
def preflight(
436415
root: str = typer.Argument(".", help="Repository root"),
437-
no_auto: bool = typer.Option(
438-
False, "--no-auto", help="Do not auto-index; only report."
439-
),
416+
no_auto: bool = typer.Option(False, "--no-auto", help="Do not auto-index; only report."),
440417
):
441418
"""Ensure agents are not coding blind: guarantee a fresh GitNexus index.
442419
@@ -473,7 +450,9 @@ def serve():
473450
try:
474451
from mcp.server.fastmcp import FastMCP
475452
except ImportError:
476-
typer.echo("[SIN-BUNDLE] mcp package required: pip install 'sin-code-bundle[mcp]'", err=True)
453+
typer.echo(
454+
"[SIN-BUNDLE] mcp package required: pip install 'sin-code-bundle[mcp]'", err=True
455+
)
477456
raise typer.Exit(code=1)
478457

479458
mcp = FastMCP("sin-code-bundle")
@@ -498,9 +477,7 @@ def semantic_diff(file_a: str, file_b: str) -> str:
498477
changes = ASTDiff().diff_files(file_a, file_b)
499478
intents = IntentSummarizer().summarize(changes)
500479
risk = RiskScorer().score(changes)
501-
return json.dumps(
502-
{"intents": [i.__dict__ for i in intents], "risk": risk}
503-
)
480+
return json.dumps({"intents": [i.__dict__ for i in intents], "risk": risk})
504481
except ImportError:
505482
pass
506483

@@ -516,7 +493,6 @@ def architectural_debt() -> str:
516493
except ImportError:
517494
pass
518495

519-
520496
try:
521497
from sin_code_oracle import VerificationOracle
522498

@@ -560,7 +536,7 @@ def mock_env(action: str = "up", port: int = 8888) -> str:
560536
pass
561537

562538
try:
563-
from sin_code_orchestration import Orchestrator, TaskSpec, Role
539+
from sin_code_orchestration import Orchestrator, Role, TaskSpec
564540

565541
@mcp.tool()
566542
def orchestrate(task_id: str, role: str, input_data: str) -> str:
@@ -593,11 +569,13 @@ def semantic_review(file_a: str, file_b: str) -> str:
593569
changes = ASTDiff().diff_files(file_a, file_b)
594570
intents = IntentSummarizer().summarize(changes)
595571
risk = RiskScorer().score(changes)
596-
return json.dumps({
597-
"intents": [i.__dict__ for i in intents],
598-
"risk": risk,
599-
"recommendation": "Approve" if risk["risk"] == "low" else "Review Manually"
600-
})
572+
return json.dumps(
573+
{
574+
"intents": [i.__dict__ for i in intents],
575+
"risk": risk,
576+
"recommendation": "Approve" if risk["risk"] == "low" else "Review Manually",
577+
}
578+
)
601579
except ImportError:
602580
pass
603581

‎SIN-Code-Bundle/src/sin_code_bundle/generators.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- codex -> .codex/config.toml ([mcp_servers.sin])
1010
- hermes -> .hermes/config.yaml (mcp_servers: {...})
1111
"""
12+
1213
from __future__ import annotations
1314

1415
import json
@@ -175,6 +176,7 @@ def _load(path: Path, fmt: str) -> dict:
175176
return yaml.safe_load(text) or {}
176177
if fmt == "toml":
177178
import tomllib # stdlib on Python 3.11+
179+
178180
return tomllib.loads(text)
179181
raise ValueError(f"unknown format: {fmt}")
180182

@@ -223,9 +225,7 @@ def render_agent_config(agent: Agent, scope: Scope = "local") -> tuple[Path, str
223225
"""Return ``(target_path, rendered_content)`` for an agent, merging existing."""
224226
targets = _targets()
225227
if agent not in targets:
226-
raise ValueError(
227-
f"unknown agent '{agent}'. Supported: {', '.join(targets)}"
228-
)
228+
raise ValueError(f"unknown agent '{agent}'. Supported: {', '.join(targets)}")
229229
target = targets[agent]
230230
path = target.path(scope)
231231
existing = _load(path, target.fmt)

0 commit comments

Comments
 (0)