codmap 0.0.42__tar.gz → 0.0.44__tar.gz
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.
- {codmap-0.0.42 → codmap-0.0.44}/PKG-INFO +2 -2
- {codmap-0.0.42 → codmap-0.0.44}/README.md +1 -1
- {codmap-0.0.42 → codmap-0.0.44}/codemap/arch.py +101 -9
- {codmap-0.0.42 → codmap-0.0.44}/codemap/cli.py +62 -8
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/__init__.py +15 -2
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/artifacts.py +10 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/hooks.py +5 -1
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/install.py +118 -26
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/ratchet.py +118 -1
- codmap-0.0.44/codemap/devkit/templates/agents_block.ru.md +47 -0
- codmap-0.0.44/codemap/devkit/templates/cycles_region.toml +8 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/behavior.py +71 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/roots.py +5 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/model.py +10 -1
- {codmap-0.0.42 → codmap-0.0.44}/codemap/query.py +54 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/audit.py +48 -2
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/check.py +32 -4
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/PKG-INFO +2 -2
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/SOURCES.txt +8 -0
- {codmap-0.0.42 → codmap-0.0.44}/pyproject.toml +1 -1
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c108_devkit.py +4 -2
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c110_advise.py +1 -1
- codmap-0.0.44/tests/test_r1c114_devkit_graph.py +160 -0
- codmap-0.0.44/tests/test_r1c115_agents_block.py +92 -0
- codmap-0.0.44/tests/test_r1c116_known_cycles.py +158 -0
- codmap-0.0.44/tests/test_r1c118_dead_code.py +119 -0
- codmap-0.0.44/tests/test_r1c119_first_build.py +47 -0
- codmap-0.0.44/tests/test_r1c120_dispatch_absorbed.py +104 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c13_grep_vs_graph.py +12 -8
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c39_edge_resolution.py +27 -2
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c49_type_only_cycles.py +3 -1
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c60_nested_definitions.py +3 -2
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c63_answer_format.py +1 -1
- {codmap-0.0.42 → codmap-0.0.44}/LICENSE +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/__init__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/__main__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/advise/__init__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/advise/data/feed.json +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/advise/data/matrix.toml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/advise/refresh.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/advise/render.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/apidiff.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/state.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/agents_block.md +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/brief.txt +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/claude_hooks.json +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/codex_region.toml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/contract_head.toml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/github-workflow.yml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/gitlab-ci.yml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/mcp_claude.args +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/post-commit.sh +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/templates/ratchet_region.toml +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/devkit/usage.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/diagnostics.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/__init__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/attrflow.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/dataflow.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/dispatch.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/griffe_extractor.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/gsource.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/probe.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/extract/union.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/freshness.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/incremental.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/__init__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/base.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/cocoindex.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/gate.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/gitnexus.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/registry.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/integrations/transport.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/provenance.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/scope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/__init__.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/_scip_pb2.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/api_surface.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/apidiff.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/architecture.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/ctags.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/currency.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/impact.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/limits.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/livingdocs.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/mcp_server.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/mermaid.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/pack.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/rag.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/review.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/scip.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/semantic.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/server.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/session.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/subsystems.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/serve/vault.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/store.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/tomlio.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codemap/watch.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/dependency_links.txt +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/entry_points.txt +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/requires.txt +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/codmap.egg-info/top_level.txt +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/setup.cfg +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_epistemic.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_gitnexus_router.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_impact_depth.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_integrations.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_issue3_serve_freshness.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_livingdocs.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m0_api_surface.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m11_argcontract.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m12_dataflow.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m15_review.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m16_architecture.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m17_mcp.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m18_freshness.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m1_5_semantics.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m1_query.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m2_views.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m32_watch.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m3_serve.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m4_behavior.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m5_deep.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m6_repo_scope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m7_dispatch.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_m9_family.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_pack_honesty.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c109_namespace_source.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c111_recipe.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c13_callgraph_accuracy.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c16_semantic.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c20_attribute_edges.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c21_flat_layout.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c22_source_visible_refs.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c23_hard_python.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c24_test_mapping.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c25_provenance.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c26_deep_union.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c27_config_honesty.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c28_limit_envelope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c29_lazy_imports.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c2_ctags.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c30_local_import_calls.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c30f1_reexport_calls.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c30f2_check_scope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c31_path_origin.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c32_report_json.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c33_query_signature.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c34_signature_kinds.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c35_contract_location.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c36_target_resolution.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c37_rule_mutation.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c38_tool_drift.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c3_arch_contract.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c3_dogfood.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c40_flow_reach.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c41_scope_membership.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c42_deep_tier_stability.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c43_incremental_splice.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c44_absent_answers.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c45_repeat_union.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c46_shadowed_definitions.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c47_incremental_resample.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c48_type_checking_imports.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c4_complexity.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c50_flow_entry_points.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c53_narrowing_declared.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c54_deterministic_rendering.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c55_override_grade.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c56_stub_files.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c57_facade_package.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c58_cycle_tangles.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c59_completeness_drop.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c5_apidiff.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c62_phantom_rules.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c64_dependency_probe.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c66_pack_direction.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c68_dotted_imports.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c69_contract_validation.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c6_pack.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c70_check_graph_currency.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c71_attribute_chain_calls.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c72_flat_inference_in_packages.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c73_cli_version.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c74_call_site_conservation.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c75_reexported_class_calls.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c76_contract_table_typo.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c77_gate_probe_battery.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c78_forbidden_chains.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c7_edge_vocab.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c80_tests_through_helpers.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c81_protocol_dispatch.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c82_review_changed_lines.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c83_foreign_graph_paths.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c84_missing_roots.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c85_mcp_graph_currency.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c86_incremental_repo_scope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c87_review_path_base.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c89_review_docs.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c8_deadcode.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c90_currency_without_recipe.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c91_route_vocabulary.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c92_sidecar_pair.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c94_root_builds.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c95_r1c96_foreign_trees.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_r1c9_incremental.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_scip_export.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_scope.py +0 -0
- {codmap-0.0.42 → codmap-0.0.44}/tests/test_subsystems.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codmap
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.44
|
|
4
4
|
Summary: Static analyzer that turns a package's source into a queryable code graph.
|
|
5
5
|
Author-email: kogriv <kogriv@gmail.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -54,7 +54,7 @@ without a release.
|
|
|
54
54
|
|
|
55
55
|
[](https://github.com/kogriv/codemap/actions/workflows/ci.yml)
|
|
56
56
|
|
|
57
|
-
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **
|
|
57
|
+
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **1421 tests with no failures on
|
|
58
58
|
Python 3.11–3.14** ([in CI](docs/ci.md): the full suite including the dogfood pass, a determinism check, a
|
|
59
59
|
wheel smoke test, and ctags/SCIP interop against the real CLIs), warm serve surface with 32 ops (29 exposed
|
|
60
60
|
as MCP tools), and SCIP export. See **[DESIGN.md](DESIGN.md)** (product design &
|
|
@@ -18,7 +18,7 @@ without a release.
|
|
|
18
18
|
|
|
19
19
|
[](https://github.com/kogriv/codemap/actions/workflows/ci.yml)
|
|
20
20
|
|
|
21
|
-
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **
|
|
21
|
+
**Status:** 🟢 M0–M20 implemented + research track (R1/R2) — schema 0.13, **1421 tests with no failures on
|
|
22
22
|
Python 3.11–3.14** ([in CI](docs/ci.md): the full suite including the dogfood pass, a determinism check, a
|
|
23
23
|
wheel smoke test, and ctags/SCIP interop against the real CLIs), warm serve surface with 32 ops (29 exposed
|
|
24
24
|
as MCP tools), and SCIP export. See **[DESIGN.md](DESIGN.md)** (product design &
|
|
@@ -73,6 +73,10 @@ class ArchitectureContract:
|
|
|
73
73
|
# R1-C108 (design ``devkit.md`` D3): the ratchet. ``None`` = not declared; ``()`` = declared
|
|
74
74
|
# empty, which allows no cross-layer import at all. The two must stay apart.
|
|
75
75
|
allowed: tuple[tuple[str, str], ...] | None = None
|
|
76
|
+
# R1-C116: the cycle ratchet. ``None`` = not declared. A declared list turns its gate on; a tangle whose
|
|
77
|
+
# modules all sit inside one listed group is known and passes, any other tangle breaks the rule.
|
|
78
|
+
known_lazy_cycles: tuple[frozenset[str], ...] | None = None
|
|
79
|
+
known_type_only_cycles: tuple[frozenset[str], ...] | None = None
|
|
76
80
|
error: str | None = None
|
|
77
81
|
# R1-C35: the file this contract was looked for in. "No contract found" is only
|
|
78
82
|
# actionable next to *where* we looked — a reader in the wrong directory cannot tell
|
|
@@ -139,7 +143,8 @@ def _near_miss_tables(data: dict) -> str | None:
|
|
|
139
143
|
|
|
140
144
|
#: R1-C69: the closed schema of ``[architecture]``. A key outside it is an error, not a skip.
|
|
141
145
|
_FLAGS = ("no_cycles", "no_lazy_cycles", "no_type_only_cycles", "exhaustive", "no_phantom_rules")
|
|
142
|
-
|
|
146
|
+
_KNOWN_CYCLES = ("known_lazy_cycles", "known_type_only_cycles")
|
|
147
|
+
_KNOWN_KEYS = ("layers", "independent", "forbidden", "allowed") + _FLAGS + _KNOWN_CYCLES
|
|
143
148
|
|
|
144
149
|
|
|
145
150
|
def _is_str_list(v) -> bool:
|
|
@@ -222,6 +227,9 @@ def contract_problems(section) -> list[str]:
|
|
|
222
227
|
problems.append(f"`forbidden[{i}]`: `from` and `to` are both `{item['from']}`")
|
|
223
228
|
if "allowed" in section:
|
|
224
229
|
problems.extend(_allowed_problems(section["allowed"]))
|
|
230
|
+
for key in _KNOWN_CYCLES:
|
|
231
|
+
if key in section:
|
|
232
|
+
problems.extend(_known_cycles_problems(key, section[key]))
|
|
225
233
|
for flag in _FLAGS:
|
|
226
234
|
if flag in section and not isinstance(section[flag], bool):
|
|
227
235
|
problems.append(f"`{flag}` must be true or false, got {type(section[flag]).__name__} "
|
|
@@ -262,6 +270,28 @@ def _allowed_problems(items) -> list[str]:
|
|
|
262
270
|
return problems
|
|
263
271
|
|
|
264
272
|
|
|
273
|
+
def _known_cycles_problems(key: str, groups) -> list[str]:
|
|
274
|
+
"""Schema of a known-cycles list (R1-C116): groups of at least two distinct module names, no group twice."""
|
|
275
|
+
if not isinstance(groups, list):
|
|
276
|
+
return [f"`{key}` must be a list of lists of module names"]
|
|
277
|
+
problems: list[str] = []
|
|
278
|
+
seen: set[frozenset[str]] = set()
|
|
279
|
+
for i, grp in enumerate(groups):
|
|
280
|
+
if not _is_str_list(grp) or len(set(grp)) < 2:
|
|
281
|
+
problems.append(f"`{key}[{i}]` must be a list of at least 2 different module names")
|
|
282
|
+
continue
|
|
283
|
+
for name in _repeated(grp):
|
|
284
|
+
problems.append(f"`{key}[{i}]` repeats `{name}`")
|
|
285
|
+
if frozenset(grp) in seen:
|
|
286
|
+
problems.append(f"`{key}[{i}]` repeats an earlier group")
|
|
287
|
+
seen.add(frozenset(grp))
|
|
288
|
+
return problems
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def _known(section: dict, key: str) -> tuple[frozenset[str], ...] | None:
|
|
292
|
+
return None if key not in section else tuple(frozenset(g) for g in section[key])
|
|
293
|
+
|
|
294
|
+
|
|
265
295
|
def parse_contract(section: dict) -> ArchitectureContract:
|
|
266
296
|
"""Build a contract from the parsed ``[architecture]`` table.
|
|
267
297
|
|
|
@@ -291,12 +321,15 @@ def parse_contract(section: dict) -> ArchitectureContract:
|
|
|
291
321
|
forbidden=tuple(forbidden),
|
|
292
322
|
forbidden_indirect=tuple(indirect),
|
|
293
323
|
no_cycles=bool(section.get("no_cycles", False)),
|
|
294
|
-
no_lazy_cycles=bool(section.get("no_lazy_cycles", False)),
|
|
295
|
-
no_type_only_cycles=bool(section.get("no_type_only_cycles", False))
|
|
324
|
+
no_lazy_cycles=bool(section.get("no_lazy_cycles", False)) or "known_lazy_cycles" in section,
|
|
325
|
+
no_type_only_cycles=(bool(section.get("no_type_only_cycles", False))
|
|
326
|
+
or "known_type_only_cycles" in section),
|
|
296
327
|
exhaustive=bool(section.get("exhaustive", False)),
|
|
297
328
|
no_phantom_rules=bool(section.get("no_phantom_rules", False)),
|
|
298
329
|
allowed=(None if "allowed" not in section
|
|
299
330
|
else tuple((str(i["from"]), str(i["to"])) for i in section["allowed"])),
|
|
331
|
+
known_lazy_cycles=_known(section, "known_lazy_cycles"),
|
|
332
|
+
known_type_only_cycles=_known(section, "known_type_only_cycles"),
|
|
300
333
|
)
|
|
301
334
|
|
|
302
335
|
|
|
@@ -379,6 +412,62 @@ def allowed_unused(query, contract: ArchitectureContract) -> list[tuple[str, str
|
|
|
379
412
|
return [p for p in contract.allowed if p not in used]
|
|
380
413
|
|
|
381
414
|
|
|
415
|
+
def split_known(tangles: list[dict], known: tuple[frozenset[str], ...] | None) -> tuple[list[dict], list[dict]]:
|
|
416
|
+
"""``(new, known)`` tangles (R1-C116): a tangle inside one listed group is known — it may have split or
|
|
417
|
+
shrunk, never grown. With no list declared every tangle is new, as before."""
|
|
418
|
+
if not known:
|
|
419
|
+
return list(tangles), []
|
|
420
|
+
new, old = [], []
|
|
421
|
+
for t in tangles:
|
|
422
|
+
(old if any(set(t["modules"]) <= k for k in known) else new).append(t)
|
|
423
|
+
return new, old
|
|
424
|
+
|
|
425
|
+
|
|
426
|
+
def known_stale(query, contract: ArchitectureContract) -> dict[str, list[frozenset[str]]]:
|
|
427
|
+
"""Listed groups that hold no tangle any more, per key — a cycle ratchet that can tighten (R1-C116).
|
|
428
|
+
|
|
429
|
+
Reported, never a violation, like `allowed_unused`: breaking a cycle must not turn the gate red.
|
|
430
|
+
"""
|
|
431
|
+
out: dict[str, list[frozenset[str]]] = {}
|
|
432
|
+
for key, known, tangles in (("known_lazy_cycles", contract.known_lazy_cycles, query.lazy_import_tangles),
|
|
433
|
+
("known_type_only_cycles", contract.known_type_only_cycles,
|
|
434
|
+
query.type_only_import_tangles)):
|
|
435
|
+
if known:
|
|
436
|
+
now = [set(t["modules"]) for t in tangles()]
|
|
437
|
+
stale = [k for k in known if not any(m <= k for m in now) and not _absorbing(k, now)]
|
|
438
|
+
if stale:
|
|
439
|
+
out[key] = stale
|
|
440
|
+
return out
|
|
441
|
+
|
|
442
|
+
|
|
443
|
+
def _absorbing(group: frozenset[str], now: list[set[str]]) -> set[str] | None:
|
|
444
|
+
"""A current tangle that holds ≥2 of ``group``'s modules without fitting inside it (R1-C120): the known
|
|
445
|
+
cycle is alive, inside a larger new one — not gone."""
|
|
446
|
+
return next((m for m in now if len(m & group) >= 2 and not m <= group), None)
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
def known_absorbed(query, contract: ArchitectureContract) -> dict[str, list[tuple[frozenset[str], list[str]]]]:
|
|
450
|
+
"""Listed groups now inside a larger tangle, with that tangle (R1-C120). Never a tighten candidate."""
|
|
451
|
+
out: dict[str, list[tuple[frozenset[str], list[str]]]] = {}
|
|
452
|
+
for key, known, tangles in (("known_lazy_cycles", contract.known_lazy_cycles, query.lazy_import_tangles),
|
|
453
|
+
("known_type_only_cycles", contract.known_type_only_cycles,
|
|
454
|
+
query.type_only_import_tangles)):
|
|
455
|
+
if known:
|
|
456
|
+
now = [set(t["modules"]) for t in tangles()]
|
|
457
|
+
rows = [(k, sorted(m)) for k in known
|
|
458
|
+
if not any(n <= k for n in now) for m in [_absorbing(k, now)] if m]
|
|
459
|
+
if rows:
|
|
460
|
+
out[key] = rows
|
|
461
|
+
return out
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
def _grew(tangle: dict, known: tuple[frozenset[str], ...] | None) -> str:
|
|
465
|
+
overlap = [k for k in known or () if k & set(tangle["modules"])]
|
|
466
|
+
if not overlap:
|
|
467
|
+
return ""
|
|
468
|
+
return " — grew from the known " + "; ".join("(" + ", ".join(sorted(k)) + ")" for k in overlap)
|
|
469
|
+
|
|
470
|
+
|
|
382
471
|
def _tangle_line(tangle: dict) -> str:
|
|
383
472
|
"""One gate line per tangle: the example cycle, then the members (R1-C58).
|
|
384
473
|
|
|
@@ -555,13 +644,14 @@ def check_contract(query, contract: ArchitectureContract) -> list[Violation]:
|
|
|
555
644
|
# not a gate, and a lazy import is the accepted way to break an import cycle — so this
|
|
556
645
|
# is the contract owner's call to state, not a default to pick on their behalf.
|
|
557
646
|
if contract.no_lazy_cycles:
|
|
558
|
-
lazy = query.lazy_import_tangles()
|
|
647
|
+
lazy, _ = split_known(query.lazy_import_tangles(), contract.known_lazy_cycles)
|
|
559
648
|
if lazy:
|
|
560
649
|
violations.append(Violation(
|
|
561
650
|
"no_lazy_cycles",
|
|
562
|
-
f"{len(lazy)}
|
|
651
|
+
f"{len(lazy)} {'new ' if contract.known_lazy_cycles is not None else ''}"
|
|
652
|
+
f"tangle(s) closed only by a function-local import, "
|
|
563
653
|
f"{sum(t['size'] for t in lazy)} module(s)",
|
|
564
|
-
modules=tuple(_tangle_line(t) for t in lazy),
|
|
654
|
+
modules=tuple(_tangle_line(t) + _grew(t, contract.known_lazy_cycles) for t in lazy),
|
|
565
655
|
))
|
|
566
656
|
|
|
567
657
|
# -- no_type_only_cycles: the third kind, and the one with no runtime dependency ----
|
|
@@ -572,14 +662,16 @@ def check_contract(query, contract: ArchitectureContract) -> list[Violation]:
|
|
|
572
662
|
# against lazy imports used as a way around `no_cycles`, and the standard typing
|
|
573
663
|
# idiom is not that.
|
|
574
664
|
if contract.no_type_only_cycles:
|
|
575
|
-
type_only = query.type_only_import_tangles()
|
|
665
|
+
type_only, _ = split_known(query.type_only_import_tangles(), contract.known_type_only_cycles)
|
|
576
666
|
if type_only:
|
|
577
667
|
violations.append(Violation(
|
|
578
668
|
"no_type_only_cycles",
|
|
579
|
-
f"{len(type_only)}
|
|
669
|
+
f"{len(type_only)} {'new ' if contract.known_type_only_cycles is not None else ''}"
|
|
670
|
+
f"tangle(s) closed only by an import that never runs "
|
|
580
671
|
f"(`if TYPE_CHECKING:` or a `.pyi`), "
|
|
581
672
|
f"{sum(t['size'] for t in type_only)} module(s)",
|
|
582
|
-
modules=tuple(_tangle_line(t)
|
|
673
|
+
modules=tuple(_tangle_line(t) + _grew(t, contract.known_type_only_cycles)
|
|
674
|
+
for t in type_only),
|
|
583
675
|
))
|
|
584
676
|
|
|
585
677
|
# -- exhaustive: every core module's layer must be declared -----------------
|
|
@@ -96,6 +96,10 @@ def _graph_from(args):
|
|
|
96
96
|
if getattr(args, "build", None):
|
|
97
97
|
return extract(args.build, deep=getattr(args, "deep", False))
|
|
98
98
|
if getattr(args, "graph", None):
|
|
99
|
+
if not os.path.exists(args.graph):
|
|
100
|
+
# R1-C119: said before any work, with the command that makes one.
|
|
101
|
+
raise SystemExit(f"error: no graph at {args.graph} — build it first: "
|
|
102
|
+
f"`codemap build <package> -o {args.graph}`")
|
|
99
103
|
graph = store.load(args.graph)
|
|
100
104
|
if getattr(args, "func", None) not in (_cmd_check, _cmd_serve):
|
|
101
105
|
_warn_if_behind(args.graph, graph, args)
|
|
@@ -163,6 +167,14 @@ def _cmd_build(args) -> int:
|
|
|
163
167
|
return 2
|
|
164
168
|
if _refuse_bad_roots(args):
|
|
165
169
|
return 2
|
|
170
|
+
if args.out:
|
|
171
|
+
# R1-C119: the parent directory exists before the parse, not after it — a fresh clone has no
|
|
172
|
+
# `.codemap/`, and the whole extraction used to run and then fail on writing.
|
|
173
|
+
try:
|
|
174
|
+
Path(args.out).resolve().parent.mkdir(parents=True, exist_ok=True)
|
|
175
|
+
except OSError as exc:
|
|
176
|
+
print(f"error: cannot create the directory for {args.out}: {exc.strerror}", file=sys.stderr)
|
|
177
|
+
return 2
|
|
166
178
|
if args.consumer or args.docs:
|
|
167
179
|
core_graph = None
|
|
168
180
|
if getattr(args, "incremental", False) and args.out:
|
|
@@ -751,7 +763,7 @@ def _cmd_report(args) -> int:
|
|
|
751
763
|
_emit_answer(render_dead_code(Query(graph),
|
|
752
764
|
whitelist=whitelist,
|
|
753
765
|
min_confidence=args.min_confidence,
|
|
754
|
-
whitelist_error=wl_error))
|
|
766
|
+
whitelist_error=wl_error, public=args.public))
|
|
755
767
|
return 0
|
|
756
768
|
renderer = _REPORTS[args.kind]
|
|
757
769
|
payload = renderer(graph) if args.kind == "api-surface" else renderer(Query(graph))
|
|
@@ -796,7 +808,7 @@ def _report_json(graph, args) -> dict:
|
|
|
796
808
|
whitelist, wl_error = load_dead_code_whitelist(root)
|
|
797
809
|
return build_dead_code(Query(graph), whitelist=whitelist,
|
|
798
810
|
min_confidence=args.min_confidence,
|
|
799
|
-
whitelist_error=wl_error)
|
|
811
|
+
whitelist_error=wl_error, public=args.public)
|
|
800
812
|
if args.kind == "api-surface":
|
|
801
813
|
from codemap.serve.api_surface import build_api_surface
|
|
802
814
|
return build_api_surface(graph)
|
|
@@ -881,9 +893,10 @@ def _cmd_refresh(args) -> int:
|
|
|
881
893
|
from codemap.freshness import read_meta
|
|
882
894
|
meta = read_meta(args.graph)
|
|
883
895
|
if not meta or not meta.get("argv"):
|
|
896
|
+
what = "no graph" if not os.path.exists(args.graph) else "no rebuild recipe"
|
|
884
897
|
raise SystemExit(
|
|
885
|
-
f"error:
|
|
886
|
-
"
|
|
898
|
+
f"error: {what} at {args.graph} — `refresh` repeats a recorded build; make the first one with "
|
|
899
|
+
f"`codemap build <package> -o {args.graph}`")
|
|
887
900
|
cwd = meta.get("cwd")
|
|
888
901
|
if cwd and os.path.isdir(cwd):
|
|
889
902
|
os.chdir(cwd) # recorded argv may use paths relative to the build cwd
|
|
@@ -1077,10 +1090,11 @@ def _cmd_devkit(args) -> int:
|
|
|
1077
1090
|
return init(root, package=args.package, consumers=args.consumer, docs=args.docs,
|
|
1078
1091
|
agents_file=args.agents_file, claude_hooks=args.claude_hooks, codex=args.codex,
|
|
1079
1092
|
ci=args.ci, hook=args.hook, build=args.build, ratchet=args.ratchet,
|
|
1080
|
-
dry_run=args.dry_run, force=args.force)
|
|
1093
|
+
dry_run=args.dry_run, force=args.force, agents_lang=args.agents_lang)
|
|
1081
1094
|
if cmd == "update":
|
|
1082
1095
|
from codemap.devkit.install import update
|
|
1083
|
-
return update(root, force=args.force, repin=args.repin, dry_run=args.dry_run
|
|
1096
|
+
return update(root, force=args.force, repin=args.repin, dry_run=args.dry_run,
|
|
1097
|
+
agents_file=args.agents_file, agents_lang=args.agents_lang)
|
|
1084
1098
|
if cmd == "status":
|
|
1085
1099
|
from codemap.devkit.install import status
|
|
1086
1100
|
return status(root, args.format)
|
|
@@ -1112,6 +1126,11 @@ def _devkit_ratchet(root, args) -> int:
|
|
|
1112
1126
|
from codemap.devkit.state import load_state
|
|
1113
1127
|
st = load_state(root) or {}
|
|
1114
1128
|
graph = args.graph or str(root / st.get("graph", ".codemap/graph.json"))
|
|
1129
|
+
from codemap.devkit.install import graph_unfit
|
|
1130
|
+
unfit = graph_unfit(root, Path(graph))
|
|
1131
|
+
if unfit:
|
|
1132
|
+
print(f"error: {unfit}; rebuild it with the pinned codemap, then run this again", file=sys.stderr)
|
|
1133
|
+
return 2
|
|
1115
1134
|
q = Query(store.load(graph))
|
|
1116
1135
|
used = sorted(layer_pairs(q))
|
|
1117
1136
|
try:
|
|
@@ -1119,6 +1138,26 @@ def _devkit_ratchet(root, args) -> int:
|
|
|
1119
1138
|
except RatchetError as exc:
|
|
1120
1139
|
print(f"error: {exc}", file=sys.stderr)
|
|
1121
1140
|
return 2
|
|
1141
|
+
from codemap.devkit.ratchet import edit_cycles_region, has_cycles_region, tangles_now
|
|
1142
|
+
if getattr(args, "cycles", False) or has_cycles_region(root):
|
|
1143
|
+
try:
|
|
1144
|
+
cres = edit_cycles_region(root, tangles_now(q), tighten=args.tighten, dry_run=args.dry_run)
|
|
1145
|
+
except RatchetError as exc:
|
|
1146
|
+
print(f"error: {exc}", file=sys.stderr)
|
|
1147
|
+
return 2
|
|
1148
|
+
verb_c = "would change" if args.dry_run else "changed"
|
|
1149
|
+
if cres.created_region:
|
|
1150
|
+
n = sum(len(v) for v in cres.added.values())
|
|
1151
|
+
print(f"codemap.toml {verb_c}: known-cycles region written — {n} cycle group(s) known as of this graph.")
|
|
1152
|
+
for key, groups in cres.removed.items():
|
|
1153
|
+
for g in groups:
|
|
1154
|
+
print(f" - {key}: ({', '.join(sorted(g))}) (no cycle inside it any more)")
|
|
1155
|
+
if not cres.created_region:
|
|
1156
|
+
for key, groups in cres.added.items():
|
|
1157
|
+
for g in groups:
|
|
1158
|
+
print(f" + {key}: ({', '.join(sorted(g))})")
|
|
1159
|
+
if cres.added:
|
|
1160
|
+
print(" Adding a cycle group accepts that coupling: say why in a comment, or break the cycle.")
|
|
1122
1161
|
verb = "would change" if args.dry_run else "changed"
|
|
1123
1162
|
if not res.added and not res.removed:
|
|
1124
1163
|
print(f"codemap.toml: the `allowed` region already matches the graph ({len(used)} pair(s) used).")
|
|
@@ -1387,6 +1426,9 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1387
1426
|
"the symbol (default 5, same as `report flows`).")
|
|
1388
1427
|
r.add_argument("--min-confidence", choices=["low", "medium", "high"], default=None,
|
|
1389
1428
|
help="report dead-code: only show candidates at/above this confidence.")
|
|
1429
|
+
r.add_argument("--public", action="store_true",
|
|
1430
|
+
help="report dead-code: also list public module-level functions with no inbound edge "
|
|
1431
|
+
"(dead in an application; in a library they may be external API).")
|
|
1390
1432
|
r.add_argument("--format", choices=["markdown", "json"], default="markdown")
|
|
1391
1433
|
r.add_argument("--source-root", metavar="DIR",
|
|
1392
1434
|
help="Where codemap.toml is read for `dead-code` (default: current dir).")
|
|
@@ -1533,13 +1575,16 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1533
1575
|
di.add_argument("--docs", action="append", default=[], help="Docs root (*.md). Repeatable.")
|
|
1534
1576
|
di.add_argument("--agents-file", default=None,
|
|
1535
1577
|
help="File for the agent rules block (default: AGENTS.md, or CLAUDE.md when only it exists).")
|
|
1578
|
+
di.add_argument("--agents-lang", choices=["en", "ru"], default=None,
|
|
1579
|
+
help="Language of the agent rules block (default: en).")
|
|
1536
1580
|
di.add_argument("--claude-hooks", action="store_true",
|
|
1537
1581
|
help="Also install Claude Code hooks (SessionStart brief, PostToolUse touched).")
|
|
1538
1582
|
di.add_argument("--codex", action="store_true", help="Also write the MCP entry in .codex/config.toml.")
|
|
1539
1583
|
di.add_argument("--ci", choices=["github", "gitlab"], default=None, help="Also write a CI gate.")
|
|
1540
1584
|
di.add_argument("--no-hook", dest="hook", action="store_false", help="Do not install the post-commit hook.")
|
|
1541
1585
|
di.add_argument("--no-build", dest="build", action="store_false",
|
|
1542
|
-
help="Do not build
|
|
1586
|
+
help="Do not build a graph now. The contract is written from an existing graph, if it was "
|
|
1587
|
+
"built by this codemap and is not behind its tree; otherwise it is not written.")
|
|
1543
1588
|
di.add_argument("--ratchet", action="store_true",
|
|
1544
1589
|
help="Add the `allowed` region to an existing `[architecture]` contract.")
|
|
1545
1590
|
di.add_argument("--dry-run", action="store_true", help="Report what would change; write nothing.")
|
|
@@ -1549,6 +1594,10 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1549
1594
|
du.add_argument("--root", default=".")
|
|
1550
1595
|
du.add_argument("--force", action="store_true")
|
|
1551
1596
|
du.add_argument("--repin", action="store_true", help="Move the pin to the codemap running this command.")
|
|
1597
|
+
du.add_argument("--agents-file", default=None,
|
|
1598
|
+
help="Move the agent rules block to this file (an untouched old block is removed).")
|
|
1599
|
+
du.add_argument("--agents-lang", choices=["en", "ru"], default=None,
|
|
1600
|
+
help="Language of the agent rules block.")
|
|
1552
1601
|
du.add_argument("--dry-run", action="store_true")
|
|
1553
1602
|
dst = dks.add_parser("status", help="What is current, outdated, edited by hand or missing (exit 1 if any).")
|
|
1554
1603
|
dst.add_argument("--root", default=".")
|
|
@@ -1557,7 +1606,12 @@ def build_parser() -> argparse.ArgumentParser:
|
|
|
1557
1606
|
"or remove pairs nothing uses (--tighten).")
|
|
1558
1607
|
dr_.add_argument("--root", default=".")
|
|
1559
1608
|
dr_.add_argument("--graph", default=None, help="Graph to read (default: the devkit's, .codemap/graph.json).")
|
|
1560
|
-
dr_.add_argument("--tighten", action="store_true",
|
|
1609
|
+
dr_.add_argument("--tighten", action="store_true",
|
|
1610
|
+
help="Remove allowed pairs no import uses any more, and known cycle groups with no cycle.")
|
|
1611
|
+
dr_.add_argument("--cycles", action="store_true",
|
|
1612
|
+
help="Also write the known-cycles region (known_lazy_cycles, known_type_only_cycles): "
|
|
1613
|
+
"the cycles of today pass, a new or grown one fails check. Once written, every "
|
|
1614
|
+
"ratchet run updates it.")
|
|
1561
1615
|
dr_.add_argument("--dry-run", action="store_true")
|
|
1562
1616
|
db = dks.add_parser("brief", help="SessionStart hook: graph currency and the rule, as plain text.")
|
|
1563
1617
|
db.add_argument("--root", default=".")
|
|
@@ -16,11 +16,11 @@ import hashlib
|
|
|
16
16
|
from pathlib import Path
|
|
17
17
|
|
|
18
18
|
#: Raised whenever a template changes; adopting projects see "outdated" in `codemap devkit status`.
|
|
19
|
-
DEVKIT_VERSION =
|
|
19
|
+
DEVKIT_VERSION = 5
|
|
20
20
|
|
|
21
21
|
#: sha256 over the templates (name + content, sorted). The suite recomputes it: a template edited without
|
|
22
22
|
#: bumping DEVKIT_VERSION and updating this value fails there, in the same commit (D7).
|
|
23
|
-
TEMPLATES_SHA256 = "
|
|
23
|
+
TEMPLATES_SHA256 = "22364b9f3ba0d4a2ffb81d888184481817dcf131f31accfbbbd7881dd247c72a"
|
|
24
24
|
|
|
25
25
|
TEMPLATES_DIR = Path(__file__).parent / "templates"
|
|
26
26
|
|
|
@@ -55,3 +55,16 @@ def render(text: str, ctx: dict[str, object]) -> str:
|
|
|
55
55
|
|
|
56
56
|
def sha(text: str) -> str:
|
|
57
57
|
return hashlib.sha256(text.encode("utf-8")).hexdigest()
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def build_args(st: dict) -> str:
|
|
61
|
+
"""The roots part of the devkit's build command (`--consumer`, `--docs`, `--mode full`)."""
|
|
62
|
+
import shlex
|
|
63
|
+
parts: list[str] = []
|
|
64
|
+
for c in st.get("consumers", []):
|
|
65
|
+
parts += ["--consumer", c]
|
|
66
|
+
for d in st.get("docs", []):
|
|
67
|
+
parts += ["--docs", d]
|
|
68
|
+
if st.get("consumers"):
|
|
69
|
+
parts += ["--mode", "full"]
|
|
70
|
+
return shlex.join(parts)
|
|
@@ -101,6 +101,16 @@ class MarkdownRegion(Artifact):
|
|
|
101
101
|
_write(self.path, text + sep + block + "\n")
|
|
102
102
|
|
|
103
103
|
|
|
104
|
+
def remove_region(art: "MarkdownRegion") -> None:
|
|
105
|
+
"""Take the block out of its file (R1-C115), folding the blank lines it leaves; the file stays."""
|
|
106
|
+
text = _read(art.path)
|
|
107
|
+
span = art._span(text) if text is not None else None
|
|
108
|
+
if not span:
|
|
109
|
+
return
|
|
110
|
+
head, tail = text[:span[0]].rstrip("\n"), text[span[1]:].lstrip("\n")
|
|
111
|
+
_write(art.path, (head + "\n\n" + tail if head and tail else head + "\n" if head else tail))
|
|
112
|
+
|
|
113
|
+
|
|
104
114
|
class TomlRegion(Artifact):
|
|
105
115
|
"""The Codex MCP entry in .codex/config.toml: between `# >>> codemap-devkit` and `# <<<`."""
|
|
106
116
|
|
|
@@ -48,7 +48,11 @@ def currency_line(root: Path, st: dict) -> str:
|
|
|
48
48
|
gp = _graph_path(root, st)
|
|
49
49
|
rel = os.path.relpath(gp, root)
|
|
50
50
|
if not gp.is_file():
|
|
51
|
-
|
|
51
|
+
# R1-C119: a fresh clone has no graph and `refresh` has no recipe to repeat — give the first build.
|
|
52
|
+
from codemap.devkit import build_args
|
|
53
|
+
cmd = " ".join(x for x in ("codemap build", st.get("package", "<package>"), build_args(st), "-o", rel) if x)
|
|
54
|
+
return (f"absent ({rel} does not exist; build it once: `{cmd}` — after that the post-commit hook "
|
|
55
|
+
"keeps it)")
|
|
52
56
|
meta = read_meta(str(gp)) or {}
|
|
53
57
|
built = meta.get("built_at")
|
|
54
58
|
when = f", built {_ago(built)}" if isinstance(built, (int, float)) else ""
|