Skip to content

Commit 6f72adc

Browse files
authored
Merge pull request #53 from BitConcepts/develop
release: v0.2.0 hotfix — CI lint/format fixes
2 parents 0beb815 + 0184f40 commit 6f72adc

17 files changed

Lines changed: 65 additions & 42 deletions

src/specsmith/auditor.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,14 @@ def check_governance_files(root: Path) -> list[AuditResult]:
125125
found = path.exists()
126126
# For architecture.md, also search subdirectories (e.g. docs/architecture/*.md)
127127
if not found and "architecture" in f:
128-
found = bool(
129-
list((root / "docs").glob("**/architecture*"))
130-
+ list((root / "docs").glob("**/ARCHITECTURE*"))
131-
) if (root / "docs").is_dir() else False
128+
found = (
129+
bool(
130+
list((root / "docs").glob("**/architecture*"))
131+
+ list((root / "docs").glob("**/ARCHITECTURE*"))
132+
)
133+
if (root / "docs").is_dir()
134+
else False
135+
)
132136
results.append(
133137
AuditResult(
134138
name=f"recommended:{f}",
@@ -580,8 +584,7 @@ def run_auto_fix(root: Path, report: AuditReport) -> list[str]:
580584
path = root / "docs" / "ARCHITECTURE.md"
581585
path.parent.mkdir(parents=True, exist_ok=True)
582586
path.write_text(
583-
f"# Architecture — {root.name}\n\n"
584-
"[Run `specsmith architect` to populate]\n",
587+
f"# Architecture — {root.name}\n\n[Run `specsmith architect` to populate]\n",
585588
encoding="utf-8",
586589
)
587590
fixed.append("Created stub docs/ARCHITECTURE.md")

src/specsmith/cli.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -703,9 +703,7 @@ def architect(project_dir: str, non_interactive: bool) -> None:
703703
f" [yellow]Note:[/yellow] Existing docs at {', '.join(existing)} "
704704
"are referenced but not merged. Review manually."
705705
)
706-
console.print(
707-
" [dim]Run \"specsmith audit --project-dir .\" to verify governance health.[/dim]"
708-
)
706+
console.print(' [dim]Run "specsmith audit --project-dir ." to verify governance health.[/dim]')
709707

710708

711709
# ---------------------------------------------------------------------------
@@ -1463,7 +1461,10 @@ def credits_analyze(project_dir: str) -> None:
14631461
"--watermarks", default=None, help="Comma-separated USD watermark alerts (e.g. 5,10,25,50)."
14641462
)
14651463
def credits_budget(
1466-
project_dir: str, cap: float | None, alert_pct: int | None, watermarks: str | None,
1464+
project_dir: str,
1465+
cap: float | None,
1466+
alert_pct: int | None,
1467+
watermarks: str | None,
14671468
) -> None:
14681469
"""View or set credit budget and alert thresholds."""
14691470
from specsmith.credits import load_budget, save_budget

src/specsmith/credit_analyzer.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ def analyze_spend(root: Path) -> AnalysisReport:
4343
severity="info",
4444
message="No credit data yet.",
4545
recommendation=(
46-
"Record usage with `specsmith credits record` "
47-
"or integrate with your AI agent."
46+
"Record usage with `specsmith credits record` or integrate with your AI agent."
4847
),
4948
)
5049
)
@@ -112,8 +111,7 @@ def analyze_spend(root: Path) -> AnalysisReport:
112111
category="governance",
113112
severity="info",
114113
message=(
115-
f"Governance files total {total_gov_lines} lines "
116-
f"across {len(gov_files)} files."
114+
f"Governance files total {total_gov_lines} lines across {len(gov_files)} files."
117115
),
118116
recommendation=(
119117
"Ensure agents lazy-load governance files. Only rules.md + workflow.md "

src/specsmith/credits.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,9 @@ def record_usage(
167167
provider=provider,
168168
tokens_in=tokens_in,
169169
tokens_out=tokens_out,
170-
estimated_cost_usd=cost_usd if cost_usd is not None else estimate_cost(
171-
model, tokens_in, tokens_out
172-
),
170+
estimated_cost_usd=cost_usd
171+
if cost_usd is not None
172+
else estimate_cost(model, tokens_in, tokens_out),
173173
task=task,
174174
duration_seconds=duration_seconds,
175175
)
@@ -180,7 +180,10 @@ def record_usage(
180180

181181

182182
def get_summary(
183-
root: Path, *, since: str = "", month: str = "",
183+
root: Path,
184+
*,
185+
since: str = "",
186+
month: str = "",
184187
) -> CreditSummary:
185188
"""Get aggregate credit summary with budget alerts."""
186189
entries = _load_entries(root)
@@ -222,8 +225,7 @@ def get_summary(
222225
pct = (month_cost / budget.monthly_cap_usd) * 100 if budget.monthly_cap_usd else 0
223226
if pct >= 100:
224227
summary.alerts.append(
225-
f"BUDGET EXCEEDED: ${month_cost:.2f} / ${budget.monthly_cap_usd:.2f} "
226-
f"({pct:.0f}%)"
228+
f"BUDGET EXCEEDED: ${month_cost:.2f} / ${budget.monthly_cap_usd:.2f} ({pct:.0f}%)"
227229
)
228230
elif pct >= budget.alert_threshold_pct:
229231
summary.alerts.append(

src/specsmith/importer.py

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -790,15 +790,31 @@ def _extract_governance_sections(root: Path) -> dict[str, str]:
790790
# Body-level content keywords for secondary classification.
791791
# Used when heading doesn't match — scan body text for strong signals.
792792
_BODY_ARCHITECTURE_KW = [
793-
"register map", "address offset", "0x0", "register name",
794-
"block diagram", "data flow", "interface spec",
795-
"directory layout", "src/", "repository structure",
796-
"milestone", "roadmap", "completion", "phase 2 target",
793+
"register map",
794+
"address offset",
795+
"0x0",
796+
"register name",
797+
"block diagram",
798+
"data flow",
799+
"interface spec",
800+
"directory layout",
801+
"src/",
802+
"repository structure",
803+
"milestone",
804+
"roadmap",
805+
"completion",
806+
"phase 2 target",
797807
]
798808
_BODY_DRIFT_KW = [
799-
"subst v:", "path-length", "one-time setup", "per-machine",
800-
"environment variable", "install once", "bootstrap",
801-
"windows path", "ntfs",
809+
"subst v:",
810+
"path-length",
811+
"one-time setup",
812+
"per-machine",
813+
"environment variable",
814+
"install once",
815+
"bootstrap",
816+
"windows path",
817+
"ntfs",
802818
]
803819

804820
for heading, body in sections.items():

src/specsmith/scaffolder.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,7 @@ def _build_community_files(config: ProjectConfig) -> list[tuple[str, str]]:
406406
files.append(("community/code_of_conduct.md.j2", "CODE_OF_CONDUCT.md"))
407407

408408
if "pr-template" in cf and config.vcs_platform == "github":
409-
files.append(
410-
("community/pull_request_template.md.j2", ".github/PULL_REQUEST_TEMPLATE.md")
411-
)
409+
files.append(("community/pull_request_template.md.j2", ".github/PULL_REQUEST_TEMPLATE.md"))
412410

413411
if "issue-templates" in cf and config.vcs_platform == "github":
414412
files.extend(

src/specsmith/session.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,7 @@ def run_session_end(root: Path) -> SessionReport:
138138
name="credits",
139139
status="ok",
140140
message=(
141-
f"Credits: ${cs.total_cost_usd:.4f} total, "
142-
f"{cs.session_count} session(s)"
141+
f"Credits: ${cs.total_cost_usd:.4f} total, {cs.session_count} session(s)"
143142
),
144143
)
145144
)

src/specsmith/updater.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ def get_update_channel() -> str:
1919

2020

2121
def check_latest_version(
22-
*, channel: str = "",
22+
*,
23+
channel: str = "",
2324
) -> tuple[str, str, str]:
2425
"""Check PyPI for the latest specsmith version.
2526
@@ -60,7 +61,9 @@ def is_outdated() -> bool:
6061

6162

6263
def run_self_update(
63-
*, channel: str = "", target_version: str = "",
64+
*,
65+
channel: str = "",
66+
target_version: str = "",
6467
) -> tuple[bool, str]:
6568
"""Update specsmith via pip.
6669

tests/sandbox/test_sandbox_import.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import yaml
1515
from click.testing import CliRunner
16+
1617
from specsmith.cli import main
1718

1819

@@ -337,14 +338,10 @@ def test_import_force_overwrites_existing_docs(self, tmp_path: Path) -> None:
337338

338339
docs = root / "docs"
339340
docs.mkdir(exist_ok=True)
340-
(docs / "REQUIREMENTS.md").write_text(
341-
"# Existing Requirements\n", encoding="utf-8"
342-
)
341+
(docs / "REQUIREMENTS.md").write_text("# Existing Requirements\n", encoding="utf-8")
343342

344343
runner = CliRunner()
345-
result = runner.invoke(
346-
main, ["import", "--project-dir", str(root), "--force"], input="y\n"
347-
)
344+
result = runner.invoke(main, ["import", "--project-dir", str(root), "--force"], input="y\n")
348345
assert result.exit_code == 0
349346

350347
reqs = (docs / "REQUIREMENTS.md").read_text(encoding="utf-8")

tests/sandbox/test_sandbox_new.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
import yaml
1414
from click.testing import CliRunner
15+
1516
from specsmith.cli import main
1617

1718

0 commit comments

Comments
 (0)