- Use the uv-managed environment at
.venv; install dev dependencies withuv sync --group dev. - Prefer
uv run ...for Python tooling. - Dependency groups live in
pyproject.toml; updateuv.lockwhen dependencies change.
- Run the full test suite with
uv run pytest. - Run the full hook stack with
pre-commit run --all-files. tests/test_performance.pyis timing-sensitive and can fail on slower machines.tests/test_type_inference.pyexercises import resolution from a temp directory; keep it independent of editable installs.- The hook stack may rewrite
uv.lockor.pre-commit-config.yaml; if hook-managed files change during commit flows, restage the resulting updates instead of repeatedly restoring them.
- Project version lives in
pyproject.tomlunder[project].version; use semantic versioning, with patch bumps for bug fixes. - Keep
CITATION.cffaligned with the released version metadata inpyproject.toml. - Keep
MANIFEST.inpruningtestsso test modules are not shipped in the sdist. - In
[tool.setuptools.package-data], use the real package keyjson_repairsopy.typedremains included. - Run
uvx twine check dist/*after building and before publishing.
- Keep
README.zh.mdaligned withREADME.mdwhen behavior or contributor guidance changes. README.mdis the PyPI long description viapyproject.toml; avoid relative file or image links there.- For local docs demo validation, follow
.agents/skills/docs-demo-local-test/SKILL.md. - Keep docs demo share state in the URL hash, not query params.
- API and CLI entry points:
src/json_repair/json_repair.py,src/json_repair/__init__.py,src/json_repair/__main__.py. - Parser orchestration:
src/json_repair/json_parser.py. - Repair primitives:
src/json_repair/parse_*.py,src/json_repair/parse_string_helpers/*. - Schema logic:
src/json_repair/schema_repair.py. - Demo API/UI:
docs/app.py,docs/index.js,docs/index*.html,docs/styles.css.
- Keep valid-JSON fast paths on the standard library path;
strict=Truemust not second-guess inputs thatjson.loadsalready accepts. - Treat
skip_json_loads=Trueas an explicit opt-out for inputs already known to be invalid; do not assume behavior must match the stdlib-preserving path for valid JSON. load(fd)should behave likejson.load(fd)and repair from the descriptor's current position.- When adding repair heuristics, keep
strict=Trueconservative and emit parser logs for automatic corrections. - When a schema is provided, apply schema repair and validation for both valid and invalid JSON inputs.
- Keep schema-guided dispatch centralized in
JSONParser.parse_json(schema, path). patternPropertiesmatching is intentionally limited to a safe subset; do not execute user-supplied regexes.- Preserve schema dict identity in
SchemaRepairer.resolve_schemawhenever possible so validator caching remains effective. schema_repair_modesupports onlystandardand opt-insalvage;salvageshould remain best-effort structural recovery, not broad silent coercion.
- In
repair_json, keep a single shared output-finalization path for logging,return_objects, empty-string handling, andjson.dumps. - Parser refactors are sensitive to context lifetimes and heuristic branch ordering; preserve malformed-input behavior when restructuring
parse_stringorparse_object. - Normalize top-level
RecursionErrorintoValueError.