Skip to content

Repo hygiene: docs/CLI accuracy, ruff config, trace-mining fail-open, sdk tree-shaking#83

Merged
yfxiao16 merged 8 commits into
mainfrom
adopt-82-hygiene
Jun 15, 2026
Merged

Repo hygiene: docs/CLI accuracy, ruff config, trace-mining fail-open, sdk tree-shaking#83
yfxiao16 merged 8 commits into
mainfrom
adopt-82-hygiene

Conversation

@yfxiao16

Copy link
Copy Markdown
Contributor

Summary

Adopts the well-scoped cleanup commits from #82 (with attribution), leaving the larger changes out of scope.

  • docs: fix CLAUDE.md repo map (duplicate packages/sdk line, stale scoring/ entry); sync docs/reference/cli.md with the real CLI surface (onboard/serve/daemon/cursor now documented).
  • build: add an explicit [tool.ruff] config so local lint matches CI.
  • fix(discovery): CodeAnalyzer imported TraceMiner unguarded, crashing sponsio scan --trace with ModuleNotFoundError in builds without the optional trace_mining extension. Now fails open to "no contracts mined", matching the other call sites.
  • fix(sdk): mark @sponsio/sdk sideEffects (narrowed to the CLI entry) so bundlers can tree-shake the Node-only YAML/config path out of edge bundles, complementing the createRequire deferral in 0.2.0a3.

Test plan

  • ruff check / ruff format --check (0.15.16): clean
  • pytest -q: 2337 passed, 2 skipped
  • (cd ts/packages/sdk && npm run build && npm test): build OK, all suites pass
  • sponsio demo --scenario freeze --fast: BLOCKED as expected

🤖 Generated with Claude Code

donalddellapietra and others added 8 commits June 14, 2026 19:47
The ts/ workspace has a single package (@sponsio/sdk); the second
'AST static scanner CLI' line described the same package as if it were
a separate one. Merge into one accurate entry.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
- Remove the 'sponsio refresh' section: no such command exists; the
  refresh workflow is driven via 'sponsio prompt refresh' (already
  documented) and the described --since/--apply flags were never real.
- Document 'sponsio onboard' (one-shot init+scan+doctor wire-up).
- Document 'sponsio serve' (placeholder stub in this distribution).
- Document the 'sponsio daemon' group (run/ping/status).
- Document the 'sponsio cursor' group (install-hooks/guard).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pin line-length, target-version, and the lint rule selection that CI's
pinned ruff relies on, instead of inheriting version-dependent defaults.
Codifies current behaviour (88-col, default E/F set) so the existing
tree stays clean; broadening the rule set is left to a follow-up.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sponsio/scoring/ was removed in bd9a80a (sto/scoring cleanup) but the
repo map still listed it. No such package exists.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add "sideEffects": false so bundlers can drop the yaml/config-loading
modules entirely for consumers that only use the deterministic engine
(e.g. inline-contract usage on Cloudflare Workers). Complements the
createRequire deferral landed in #78: that stops the eager
createRequire(undefined) throw, this lets the Node-only yaml path be
tree-shaken out of edge bundles rather than merely deferred.

No top-level side effects exist in the published source, so this is safe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
CodeAnalyzer.extract_trace_contracts imported TraceMiner unguarded,
before the try/except that fails open on trace-loading errors. In
builds that don't bundle the trace_mining extension (it's an optional
extension point — see discovery/extractors/__init__.py, which already
guards the same import), this raised ModuleNotFoundError and crashed
'sponsio scan --trace' / 'sponsio refresh' instead of degrading.

Guard the import with try/except ImportError and emit a skip line,
matching the established pattern at the package's other two call sites.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The CLI entry runs main() at module scope, so a blanket
"sideEffects": false was inaccurate. Narrow it to ./dist/cli/** so the
library exports stay tree-shakeable while the CLI keeps its side effect.
Also corrects a stale E:->G: short-key comment in the YAML emitter.

Co-Authored-By: Donald Della Pietra <Donald.della.pietra@gmail.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yfxiao16 yfxiao16 merged commit 15d2f4d into main Jun 15, 2026
10 checks passed
@yfxiao16 yfxiao16 deleted the adopt-82-hygiene branch June 15, 2026 04:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants