scar-cli 0.27.1__tar.gz → 0.27.2__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.
Files changed (170) hide show
  1. scar_cli-0.27.2/.release-please-manifest.json +3 -0
  2. scar_cli-0.27.2/.scars/candidates/slug-and-display-cleaning-are-different-jobs.md +34 -0
  3. {scar_cli-0.27.1 → scar_cli-0.27.2}/CHANGELOG.md +9 -0
  4. {scar_cli-0.27.1 → scar_cli-0.27.2}/PKG-INFO +1 -1
  5. {scar_cli-0.27.1 → scar_cli-0.27.2}/plugin/plugin.json +1 -1
  6. {scar_cli-0.27.1 → scar_cli-0.27.2}/pyproject.toml +1 -1
  7. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/cli.py +41 -16
  8. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/store.py +21 -7
  9. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_cli.py +8 -0
  10. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_mcp.py +12 -0
  11. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_review_queue.py +104 -6
  12. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_store.py +37 -0
  13. {scar_cli-0.27.1 → scar_cli-0.27.2}/uv.lock +1 -1
  14. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docs/agents.md +2 -2
  15. scar_cli-0.27.1/.release-please-manifest.json +0 -3
  16. {scar_cli-0.27.1 → scar_cli-0.27.2}/.claude-plugin/marketplace.json +0 -0
  17. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
  18. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/ISSUE_TEMPLATE/config.yml +0 -0
  19. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/ISSUE_TEMPLATE/feature_request.yml +0 -0
  20. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  21. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/workflows/ci.yml +0 -0
  22. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/workflows/docs.yml +0 -0
  23. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/workflows/pr-validation.yml +0 -0
  24. {scar_cli-0.27.1 → scar_cli-0.27.2}/.github/workflows/release.yml +0 -0
  25. {scar_cli-0.27.1 → scar_cli-0.27.2}/.gitignore +0 -0
  26. {scar_cli-0.27.1 → scar_cli-0.27.2}/.pre-commit-config.yaml +0 -0
  27. {scar_cli-0.27.1 → scar_cli-0.27.2}/.pre-commit-hooks.yaml +0 -0
  28. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0001-git-grep-ere-pitfalls.landmine.md +0 -0
  29. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0002-agent-direct-hook-install.deadend.md +0 -0
  30. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0003-installer-binds-to-active-venv-scar.landmine.md +0 -0
  31. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0004-promote-roundtrip-drops-expires-evidence.landmine.md +0 -0
  32. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0005-history-rewrite-orphans-commit-evidence.landmine.md +0 -0
  33. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0006-yaml-pattern-anchor-over-escaping.landmine.md +0 -0
  34. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0007-release-please-config-change-skips-open-pr.landmine.md +0 -0
  35. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0008-rich-output-nontty-must-bypass-rich.landmine.md +0 -0
  36. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0009-anchor-survival-harness-measures-symbol-not-path-anchors.deadend.md +0 -0
  37. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0010-git-returncode-128-vs-empty-tracked-set.landmine.md +0 -0
  38. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0011-lint-compile-check-lets-redos-anchors-hang-hotpath.landmine.md +0 -0
  39. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0012-firing-log-readers-need-blanket-guards.landmine.md +0 -0
  40. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0013-docusaurus-future-v4-requires-faster-dep.landmine.md +0 -0
  41. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0014-inject-flag-dest-collides-with-subcommand-dispatch.landmine.md +0 -0
  42. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0015-zero-checkruns-means-approval-gate-not-workflow-bug.deadend.md +0 -0
  43. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0016-hook-ownership-must-be-kind-scoped.landmine.md +0 -0
  44. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0017-codex-pretool-context-can-replay-apply-patch.landmine.md +0 -0
  45. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0018-cli-subparsers-register-through-_add-wrapper.landmine.md +0 -0
  46. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0019-token-in-scar-body-cannot-prove-hook-delivery.deadend.md +0 -0
  47. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0020-one-directional-health-check-leaves-flattering-direction-unwatched.landmine.md +0 -0
  48. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0021-posttool-fix-in-hooks-does-not-reach-codex-or-cascade.landmine.md +0 -0
  49. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0022-codex-hook-delivery-needs-user-file-and-trust.landmine.md +0 -0
  50. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0023-cascade-block-exit-collides-with-argparse.fence.md +0 -0
  51. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0024-host-detection-must-not-read-the-process-home.deadend.md +0 -0
  52. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0025-one-plugin-hook-manifest-two-hosts-two-root-variables.landmine.md +0 -0
  53. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/0026-path-anchor-breadth-drives-the-review-due-threshold.landmine.md +0 -0
  54. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/README.md +0 -0
  55. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/candidates/violation-evidence-must-not-persist-raw-edits.md +0 -0
  56. {scar_cli-0.27.1 → scar_cli-0.27.2}/.scars/template.md +0 -0
  57. {scar_cli-0.27.1 → scar_cli-0.27.2}/AGENTS.md +0 -0
  58. {scar_cli-0.27.1 → scar_cli-0.27.2}/CONTRIBUTING.md +0 -0
  59. {scar_cli-0.27.1 → scar_cli-0.27.2}/IDEA.md +0 -0
  60. {scar_cli-0.27.1 → scar_cli-0.27.2}/LICENSE +0 -0
  61. {scar_cli-0.27.1 → scar_cli-0.27.2}/README.md +0 -0
  62. {scar_cli-0.27.1 → scar_cli-0.27.2}/ROADMAP.md +0 -0
  63. {scar_cli-0.27.1 → scar_cli-0.27.2}/SCAR-FORMAT.md +0 -0
  64. {scar_cli-0.27.1 → scar_cli-0.27.2}/SPEC.md +0 -0
  65. {scar_cli-0.27.1 → scar_cli-0.27.2}/STRESS-TEST.md +0 -0
  66. {scar_cli-0.27.1 → scar_cli-0.27.2}/action.yml +0 -0
  67. {scar_cli-0.27.1 → scar_cli-0.27.2}/codecov.yml +0 -0
  68. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/PROTOCOL.md +0 -0
  69. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/RESULTS.md +0 -0
  70. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/long_replay.py +0 -0
  71. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/replay.py +0 -0
  72. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/replay_shipped.py +0 -0
  73. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/anchor-survival/test_replay_shipped.py +0 -0
  74. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/auto-authorship/FINDINGS.md +0 -0
  75. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/auto-authorship/PROTOCOL.md +0 -0
  76. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/.gitignore +0 -0
  77. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/PROTOCOL.md +0 -0
  78. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/RESULTS.md +0 -0
  79. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/.scars/0001-vendor-retry-window.fence.md +0 -0
  80. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/.scars/0002-evicting-session-store.deadend.md +0 -0
  81. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/.scars/0003-export-column-order.landmine.md +0 -0
  82. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/README.md +0 -0
  83. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/payments/retry.py +0 -0
  84. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/reports/export.py +0 -0
  85. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/fixture/services/sessions.py +0 -0
  86. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/fence-honor/grade.py +0 -0
  87. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/harvest/PROTOCOL.md +0 -0
  88. {scar_cli-0.27.1 → scar_cli-0.27.2}/experiments/harvest/harvest.py +0 -0
  89. {scar_cli-0.27.1 → scar_cli-0.27.2}/hook/scar-hooks.py +0 -0
  90. {scar_cli-0.27.1 → scar_cli-0.27.2}/plugin/hooks/run.sh +0 -0
  91. {scar_cli-0.27.1 → scar_cli-0.27.2}/plugin/skills/scar-authoring/SKILL.md +0 -0
  92. {scar_cli-0.27.1 → scar_cli-0.27.2}/plugin/skills/scar-authoring/assets/template.md +0 -0
  93. {scar_cli-0.27.1 → scar_cli-0.27.2}/release-please-config.json +0 -0
  94. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/__init__.py +0 -0
  95. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/agent.py +0 -0
  96. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/cascade.py +0 -0
  97. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/codex.py +0 -0
  98. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/draftcheck.py +0 -0
  99. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/evidence.py +0 -0
  100. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/firing_log.py +0 -0
  101. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/gc.py +0 -0
  102. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/harvest.py +0 -0
  103. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/hooks.py +0 -0
  104. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/hosts.py +0 -0
  105. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/installer.py +0 -0
  106. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/lint.py +0 -0
  107. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/match.py +0 -0
  108. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/mcp.py +0 -0
  109. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/model.py +0 -0
  110. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/orphan.py +0 -0
  111. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/output.py +0 -0
  112. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/reanchor.py +0 -0
  113. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/renames.py +0 -0
  114. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/render.py +0 -0
  115. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/review.py +0 -0
  116. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/skills/scar-authoring/SKILL.md +0 -0
  117. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/skills/scar-authoring/assets/template.md +0 -0
  118. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/symbols.py +0 -0
  119. {scar_cli-0.27.1 → scar_cli-0.27.2}/src/scar/violation_evidence.py +0 -0
  120. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/conftest.py +0 -0
  121. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_action_yml.py +0 -0
  122. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_anchor_kind.py +0 -0
  123. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_block_capability.py +0 -0
  124. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_cascade.py +0 -0
  125. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_codex.py +0 -0
  126. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_context_size.py +0 -0
  127. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_docs.py +0 -0
  128. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_draftcheck.py +0 -0
  129. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_evidence.py +0 -0
  130. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_firing_log.py +0 -0
  131. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_gc.py +0 -0
  132. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_git_hook.py +0 -0
  133. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_harvest.py +0 -0
  134. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_hooks.py +0 -0
  135. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_hosts.py +0 -0
  136. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_installer.py +0 -0
  137. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_json_contract.py +0 -0
  138. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_lifecycle.py +0 -0
  139. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_lint.py +0 -0
  140. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_match.py +0 -0
  141. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_matched_by.py +0 -0
  142. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_model.py +0 -0
  143. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_orphan.py +0 -0
  144. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_output.py +0 -0
  145. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_plugin.py +0 -0
  146. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_precommit_hooks.py +0 -0
  147. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_reanchor.py +0 -0
  148. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_renames.py +0 -0
  149. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_render.py +0 -0
  150. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_review.py +0 -0
  151. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_skill.py +0 -0
  152. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_sweep.py +0 -0
  153. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_symbols.py +0 -0
  154. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_verdict_observability.py +0 -0
  155. {scar_cli-0.27.1 → scar_cli-0.27.2}/tests/test_violation_evidence.py +0 -0
  156. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/.gitignore +0 -0
  157. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docs/concepts.md +0 -0
  158. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docs/index.md +0 -0
  159. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docs/methodology.md +0 -0
  160. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docs/quickstart.md +0 -0
  161. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/docusaurus.config.ts +0 -0
  162. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/package-lock.json +0 -0
  163. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/package.json +0 -0
  164. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/scripts/sync-changelog.mjs +0 -0
  165. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/sidebars.ts +0 -0
  166. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/src/css/custom.css +0 -0
  167. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/static/img/favicon.svg +0 -0
  168. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/static/img/social-card.png +0 -0
  169. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/static/llms.txt +0 -0
  170. {scar_cli-0.27.1 → scar_cli-0.27.2}/website/tsconfig.json +0 -0
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.27.2"
3
+ }
@@ -0,0 +1,34 @@
1
+ ---
2
+ id: 0
3
+ type: landmine
4
+ title: sanitize_signal_text is display cleaning, not a filename rule; slugify must not call it
5
+ severity: medium
6
+ confidence: 0.8
7
+ created: 2026-11-06
8
+ authors: ["claude-code"]
9
+ anchors:
10
+ - symbol: src/scar/store.py::slugify
11
+ - path: src/scar/store.py
12
+ violation: "(?<!def )sanitize_signal_text\("
13
+ evidence:
14
+ - issue: 365
15
+ - issue: 159
16
+ - issue: 352
17
+ expires:
18
+ condition: "slugify and sanitize_signal_text stop sharing any code, or harvested titles stop being cleaned"
19
+ review_after: 2027-11-06
20
+ status: candidate
21
+ ---
22
+
23
+ `sanitize_signal_text` (#159) cleans mined git text for a human to read, so it
24
+ deletes `_`, `*` and backticks (markdown emphasis markers). #356 made `slugify`
25
+ call it, and every filename writer inherited that: `my_file_name` became
26
+ `myfilename`, and accented letters were dropped by the `[a-z0-9]` filter
27
+ instead of transliterated (#365).
28
+
29
+ A filename needs the opposite rule: those characters separate words. Only the
30
+ link-target and bare-URL removal is shared, via `_strip_link_targets`. Do not
31
+ route `slugify` back through `sanitize_signal_text` to "reuse the cleaner".
32
+
33
+ Known sibling left alone on purpose: harvested titles still lose `_` inside
34
+ words (`retry_count` becomes `retrycount`). That is display text, not a path.
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.27.2](https://github.com/Daily-Nerd/Scar/compare/v0.27.1...v0.27.2) (2026-11-07)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **lint:** render scar text in the review queue as inert code spans ([#363](https://github.com/Daily-Nerd/Scar/issues/363)) ([8e6588d](https://github.com/Daily-Nerd/Scar/commit/8e6588da3bf667d4f17347ddbefe0349d59f6c82))
9
+ * **store:** keep word separators and transliterate accents in slugify ([3d5579a](https://github.com/Daily-Nerd/Scar/commit/3d5579a3e2c0ebabc256b1b168e91c62046ddc8a))
10
+ * **store:** keep word separators and transliterate accents in slugify ([134463e](https://github.com/Daily-Nerd/Scar/commit/134463e2252733704875a739baa3a13d81a9a279))
11
+
3
12
  ## [0.27.1](https://github.com/Daily-Nerd/Scar/compare/v0.27.0...v0.27.1) (2026-11-07)
4
13
 
5
14
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: scar-cli
3
- Version: 0.27.1
3
+ Version: 0.27.2
4
4
  Summary: SCAR — version control for negative knowledge (deadends, fences, landmines)
5
5
  License: MIT
6
6
  License-File: LICENSE
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scar",
3
- "version": "0.27.1",
3
+ "version": "0.27.2",
4
4
  "description": "SCAR — version control for negative knowledge (deadends, fences, landmines)",
5
5
  "hooks": {
6
6
  "PreToolUse": [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "scar-cli"
3
- version = "0.27.1"
3
+ version = "0.27.2"
4
4
  description = "SCAR — version control for negative knowledge (deadends, fences, landmines)"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -10,6 +10,7 @@ from __future__ import annotations
10
10
  import argparse
11
11
  import json
12
12
  import os
13
+ import re
13
14
  import sys
14
15
  import time
15
16
  from datetime import datetime
@@ -557,13 +558,33 @@ def _review_due_json(due: list[Scar]) -> list[dict]:
557
558
  return [{"type": s.type, "id": s.id, "review_after": s.review_after} for s in due]
558
559
 
559
560
 
561
+ def _md_code(text: str) -> str:
562
+ """Render `text` as one inert markdown code span.
563
+
564
+ The queue is posted as a GitHub issue body, and text read from a scar file
565
+ is untrusted there: `@user` pings, `#7` autolinks, links and HTML render.
566
+ Backslash and entity escapes do not stop mentions or issue links, so a code
567
+ span is the only inert form. Whitespace runs (newlines included) collapse
568
+ to one space so a value cannot break its row; the fence is one backtick
569
+ longer than the longest run inside; a backtick at either edge gets one
570
+ padding space (CommonMark strips one from each side)."""
571
+ t = " ".join(str(text).split()) or "(empty)"
572
+ longest = max((len(m) for m in re.findall(r"`+", t)), default=0)
573
+ fence = "`" * (longest + 1)
574
+ if t.startswith("`") or t.endswith("`"):
575
+ t = f" {t} "
576
+ return f"{fence}{t}{fence}"
577
+
578
+
560
579
  def _review_queue_markdown(store, data: dict) -> str:
561
580
  """Markdown checklist of scars a human should look at, built from the SAME
562
581
  dict `lint --json` emits (#354). One row per scar, states merged. Only
563
582
  CI-usable signals: the firing log is machine-local and empty on a fresh
564
583
  checkout, so firing_review and never_fired are deliberately absent.
565
584
 
566
- Only the id, title, a path and fixed state wording are printed. The
585
+ Every value read from a scar file goes through `_md_code` (#362); the
586
+ wording scar writes itself stays plain and never autolinks (`scar 7`, not
587
+ `#7`). Only the id, title, a path and fixed state wording are printed. The
567
588
  `reason` strings in `data` embed anchor text and violation hints, so they
568
589
  are never used here, and the body and evidence are never read."""
569
590
  by_id: dict[int, tuple[Path, Scar]] = {}
@@ -572,27 +593,29 @@ def _review_queue_markdown(store, data: dict) -> str:
572
593
  by_id.setdefault(s.id, (f, s))
573
594
 
574
595
  states: dict[int, list[str]] = {}
575
- cmds: dict[int, list[str]] = {}
596
+ # (command text, plain tail). The command is rendered as a code span at
597
+ # row-build time so an untrusted path is never spliced into a prebuilt span.
598
+ cmds: dict[int, list[tuple[str, str]]] = {}
576
599
 
577
- def add(scar_id: int, state: str, cmd: str) -> None:
600
+ def add(scar_id: int, state: str, cmd: str, tail: str = "") -> None:
578
601
  if state not in states.setdefault(scar_id, []):
579
602
  states[scar_id].append(state)
580
- if cmd not in cmds.setdefault(scar_id, []):
581
- cmds[scar_id].append(cmd)
603
+ if (cmd, tail) not in cmds.setdefault(scar_id, []):
604
+ cmds[scar_id].append((cmd, tail))
582
605
 
583
606
  for o in data["orphans"]:
584
- add(o["scar_id"], "orphan (all anchors dead)", "`scar reanchor`")
607
+ add(o["scar_id"], "orphan (all anchors dead)", "scar reanchor")
585
608
  for pr in data["partial_rot"]:
586
- add(pr["scar_id"], "partial rot (dead anchor among live ones)", "`scar reanchor`")
609
+ add(pr["scar_id"], "partial rot (dead anchor among live ones)", "scar reanchor")
587
610
  for d in data["symbol_drift"]:
588
- add(d["scar_id"], "symbol drift", "`scar why <path>`")
611
+ add(d["scar_id"], "symbol drift", "scar why <path>")
589
612
  for ue in data["unreachable_evidence"]:
590
- add(ue["scar_id"], "evidence commit unreachable", "`scar why <path>`")
613
+ add(ue["scar_id"], "evidence commit unreachable", "scar why <path>")
591
614
  for r in data["revivals"]:
592
- add(r["scar_id"], "archived but revives_if matches again", "`scar why <path>`")
615
+ add(r["scar_id"], "archived but revives_if matches again", "scar why <path>")
593
616
  for rd in data["review_due"]:
594
617
  add(rd["id"], f"review_after {rd['review_after']} passed",
595
- f"`scar archive {rd['id']} --reason \"...\"` or bump review_after")
618
+ f"scar archive {rd['id']} --reason \"...\"", " or bump review_after")
596
619
 
597
620
  if not states and not data["failed_files"]:
598
621
  return ""
@@ -602,18 +625,20 @@ def _review_queue_markdown(store, data: dict) -> str:
602
625
  # broken file may have no usable id or title). Only
603
626
  # the path and fixed wording are printed, never lint messages or the body.
604
627
  for rel in sorted(data["failed_files"]):
605
- lines.append(f"- [ ] `{rel}`: file has lint errors. "
628
+ lines.append(f"- [ ] {_md_code(rel)}: file has lint errors. "
606
629
  "Suggested: run `scar lint` locally and fix them")
607
630
  for scar_id in sorted(states):
608
631
  found = by_id.get(scar_id)
609
632
  if found:
610
633
  f, s = found
611
634
  where = s.path_anchors[0] if s.path_anchors else f.name
612
- title = s.title
635
+ title_md, where_md = _md_code(s.title), f"({_md_code(where)})"
613
636
  else:
614
- where, title = "unknown file", "(scar not found)"
615
- cmd = "; ".join(cmds[scar_id]).replace("<path>", where)
616
- lines.append(f"- [ ] #{scar_id} {title} ({where}): "
637
+ where = ""
638
+ title_md, where_md = "(scar not found)", "(unknown file)"
639
+ cmd = "; ".join(
640
+ _md_code(c.replace("<path>", where)) + tail for c, tail in cmds[scar_id])
641
+ lines.append(f"- [ ] scar {scar_id} {title_md} {where_md}: "
617
642
  f"{'; '.join(states[scar_id])}. Suggested: {cmd}")
618
643
  tail = ["", "Firing-log signals (firing review, never fired) are not included: "
619
644
  "the firing log is machine-local and empty in CI."]
@@ -7,6 +7,7 @@ embedded so `scar init` works from a bare install with no data files.
7
7
  from __future__ import annotations
8
8
 
9
9
  import re
10
+ import unicodedata
10
11
  from dataclasses import dataclass
11
12
  from pathlib import Path
12
13
 
@@ -17,22 +18,35 @@ SLUG_MAX = 60
17
18
  _TYPE_EXT_CHAIN = re.compile(r"(?:\.(?:%s))+$" % "|".join(TYPES))
18
19
 
19
20
 
21
+ def _strip_link_targets(s: str) -> str:
22
+ """Drop markdown link targets and bare URLs. Shared by display-text cleaning
23
+ and slug building: in both, a URL must not eat the text or the 60-char slug
24
+ budget (#159)."""
25
+ s = re.sub(r"\[([^\]]*)\]\([^)]*\)", r"\1", s) # [text](url) -> text
26
+ return re.sub(r"https?://\S+", "", s)
27
+
28
+
20
29
  def sanitize_signal_text(s: str) -> str:
21
30
  """Mined git text (revert subjects, squash-merge subjects) can carry
22
31
  markdown links, emphasis markers, and bare URLs; leaked into a candidate
23
- they make the title unreadable and a URL eats the whole slug budget (#159)."""
24
- s = re.sub(r"\[([^\]]*)\]\([^)]*\)", r"\1", s) # [text](url) -> text
25
- s = re.sub(r"https?://\S+", "", s)
26
- s = re.sub(r"[*_`]+", "", s)
32
+ they make the title unreadable and a URL eats the whole slug budget (#159).
33
+ This is DISPLAY text: `_*` and backticks are emphasis markers and are
34
+ deleted. A filename must not reuse that rule, see `slugify` (#365)."""
35
+ s = re.sub(r"[*_`]+", "", _strip_link_targets(s))
27
36
  return " ".join(s.split())
28
37
 
29
38
 
30
39
  def slugify(text: str, fallback: str = "scar") -> str:
31
40
  """The one slug normaliser (#352): every writer of a scar filename (promote,
32
41
  the MCP draft tool, harvest --write) goes through here so the rules cannot
33
- drift apart. Sanitise (#159), lowercase, collapse non-alnum to '-', cap at
34
- SLUG_MAX without leaving a sliced-mid-token fragment."""
35
- s = re.sub(r"[^a-z0-9]+", "-", sanitize_signal_text(text).lower()).strip("-")
42
+ drift apart. Drop link targets/URLs, transliterate accents to ASCII (NFKD,
43
+ combining marks dropped), lowercase, turn every other non-alnum run
44
+ (including `_`, `*`, backticks) into one '-', cap at SLUG_MAX without
45
+ leaving a sliced-mid-token fragment. Output stays ASCII on purpose:
46
+ non-ASCII names can be stored in different normal forms per filesystem."""
47
+ s = unicodedata.normalize("NFKD", _strip_link_targets(text))
48
+ s = "".join(c for c in s if not unicodedata.combining(c))
49
+ s = re.sub(r"[^a-z0-9]+", "-", s.lower()).strip("-")
36
50
  if len(s) > SLUG_MAX:
37
51
  cut = s[:SLUG_MAX]
38
52
  if s[SLUG_MAX] != "-" and "-" in cut:
@@ -1496,6 +1496,14 @@ def test_write_slug_truncates_at_word_boundary():
1496
1496
  assert _write_slug("x" * 80) == "x" * 60 # no boundary — keep the raw cut
1497
1497
 
1498
1498
 
1499
+ def test_write_slug_keeps_underscores_and_transliterates():
1500
+ """harvest --write goes through the shared filename slugifier (#365)."""
1501
+ from scar.cli import _write_slug
1502
+ assert _write_slug("my_file_name_landmine") == "my-file-name-landmine"
1503
+ assert _write_slug("Ordem de importação") == "ordem-de-importacao"
1504
+ assert _write_slug("日本語") == "signal"
1505
+
1506
+
1499
1507
  def test_harvest_precision_reads_fall_back_to_old_path_when_new_absent(harvest_repo, capsys):
1500
1508
  # An existing local label set at the pre-#106 location must not be
1501
1509
  # silently orphaned by the path move — reads fall back to it.
@@ -174,3 +174,15 @@ def test_scar_draft_slug_passthrough_uses_shared_normaliser(tmp_path):
174
174
  })
175
175
  data = json.loads(_text(result))
176
176
  assert data["candidate"].endswith(slugify(raw, fallback="scar-candidate") + ".md")
177
+
178
+
179
+ def test_scar_draft_underscored_slug_keeps_word_separators(tmp_path):
180
+ init_scars(tmp_path)
181
+ result = _handle("tools/call", {
182
+ "name": "scar_draft",
183
+ "arguments": {"repo": str(tmp_path), "type": "landmine", "title": "t",
184
+ "slug": "my_file_name_landmine",
185
+ "anchors": [{"pattern": "redis"}], "body": "b"},
186
+ })
187
+ data = json.loads(_text(result))
188
+ assert data["candidate"].endswith("my-file-name-landmine.md")
@@ -1,9 +1,10 @@
1
1
  """Review queue (#354): lint --json carries review_due, and
2
2
  `lint --review-queue` renders the CI-usable review signals as markdown."""
3
3
  import json
4
+ import re
4
5
  import subprocess
5
6
 
6
- from scar.cli import main
7
+ from scar.cli import _md_code, main
7
8
  from scar.store import init_scars
8
9
 
9
10
  SCAR = """\
@@ -101,8 +102,8 @@ def test_review_queue_one_row_per_flagged_scar(tmp_path, monkeypatch, capsys):
101
102
  assert rc == 0
102
103
  rows = [ln for ln in out.splitlines() if ln.startswith("- [ ] ")]
103
104
  assert len(rows) == 2
104
- due = next(r for r in rows if "#1 " in r)
105
- rot = next(r for r in rows if "#2 " in r)
105
+ due = next(r for r in rows if "scar 1 " in r)
106
+ rot = next(r for r in rows if "scar 2 " in r)
106
107
  assert "Due scar" in due and "src/live/" in due
107
108
  assert "review_after 2020-01-01" in due
108
109
  assert "Suggested:" in due and "scar archive 1" in due
@@ -116,7 +117,7 @@ def test_review_queue_merges_states_into_one_row(tmp_path, monkeypatch, capsys):
116
117
  anchors=["src/live/", "src/gone/"], extra="review_after: 2020-01-01\n")
117
118
  _commit(tmp_path)
118
119
  _, out = _queue(capsys)
119
- rows = [ln for ln in out.splitlines() if "#3 " in ln]
120
+ rows = [ln for ln in out.splitlines() if "scar 3 " in ln]
120
121
  assert len(rows) == 1
121
122
  assert "partial rot" in rows[0] and "review_after 2020-01-01" in rows[0]
122
123
 
@@ -129,7 +130,7 @@ def test_review_queue_never_prints_body_or_violation(tmp_path, monkeypatch, caps
129
130
  body="SECRET-BODY-TEXT")
130
131
  _commit(tmp_path)
131
132
  _, out = _queue(capsys)
132
- assert "#4" in out
133
+ assert "scar 4 " in out
133
134
  assert "SECRET-BODY-TEXT" not in out
134
135
  assert "LEAKY_REGEX" not in out
135
136
  assert "evidence" not in out.lower()
@@ -157,7 +158,7 @@ def test_review_queue_plain_even_on_tty(tmp_path, monkeypatch, capsys):
157
158
  monkeypatch.setattr(output, "is_tty", lambda: True)
158
159
  _, out = _queue(capsys)
159
160
  assert "\x1b[" not in out
160
- assert "- [ ] #1 " in out
161
+ assert "- [ ] scar 1 " in out
161
162
 
162
163
 
163
164
  def test_review_queue_does_not_change_exit_codes(tmp_path, monkeypatch, capsys):
@@ -241,3 +242,100 @@ def test_review_queue_lists_duplicate_id_scars_that_parse(tmp_path, monkeypatch,
241
242
  assert "`.scars/0001-a.landmine.md`: file has lint errors." in out
242
243
  assert "`.scars/0002-b.landmine.md`: file has lint errors." in out
243
244
  assert "duplicate id" not in out
245
+
246
+
247
+ # --- inert rendering (#362) ---
248
+
249
+ # CommonMark code span: N backticks, content with no run of exactly N, N backticks.
250
+ _SPAN = re.compile(r"(?<!`)(`+)(?!`)(.+?)(?<!`)\1(?!`)")
251
+
252
+
253
+ def _outside_spans(text):
254
+ return _SPAN.sub("", text)
255
+
256
+
257
+ def test_md_code_plain_and_empty():
258
+ assert _md_code("abc") == "`abc`"
259
+ assert _md_code("") == "`(empty)`"
260
+ assert _md_code(" \n\t ") == "`(empty)`"
261
+
262
+
263
+ def test_md_code_collapses_whitespace_and_newlines():
264
+ assert _md_code("a\n\n b\r\nc") == "`a b c`"
265
+
266
+
267
+ def test_md_code_fences_longer_than_longest_backtick_run():
268
+ assert _md_code("a`b") == "``a`b``"
269
+ assert _md_code("a``b`c") == "```a``b`c```"
270
+
271
+
272
+ def test_md_code_pads_when_edge_is_backtick():
273
+ assert _md_code("`a") == "`` `a ``"
274
+ assert _md_code("a`") == "`` a` ``"
275
+ assert _md_code("`") == "`` ` ``"
276
+
277
+
278
+ def test_md_code_round_trips_through_span_regex():
279
+ for v in ["x", "a`b", "``", "`a``b`", "@octocat", "a b\nc"]:
280
+ out = _md_code(v)
281
+ assert _outside_spans(out) == "", out
282
+
283
+
284
+
285
+ def _hostile_title():
286
+ # A scar title is one line, so the newline case lives in the _md_code tests.
287
+ return "Ping @octocat see #7 [x](https://e.com) https://e.com <b>h</b> tick`here"
288
+
289
+
290
+ def test_review_queue_title_is_inert(tmp_path, monkeypatch, capsys):
291
+ _repo(tmp_path, monkeypatch)
292
+ _write(tmp_path, "0005-h.landmine.md", id=5, title=_hostile_title(),
293
+ anchors=["src/live/", "src/gone/"])
294
+ _commit(tmp_path)
295
+ _, out = _queue(capsys)
296
+ rows = [r for r in out.splitlines() if r.startswith("- [ ] scar 5 ")]
297
+ assert len(rows) == 1
298
+ row = rows[0]
299
+ assert "``Ping @octocat see #7 [x](https://e.com) https://e.com <b>h</b> tick`here``" in row
300
+ rest = _outside_spans(row[len("- [ ] "):])
301
+ assert not re.search(r"@|#\d|http|<|\[", rest), rest
302
+
303
+
304
+ def test_review_queue_no_hash_digit_outside_code_in_any_row(tmp_path, monkeypatch, capsys):
305
+ _due_and_rot(tmp_path, monkeypatch)
306
+ _, out = _queue(capsys)
307
+ for line in out.splitlines():
308
+ assert not re.search(r"#\d", _outside_spans(line)), line
309
+ assert "scar 1 " in out and "scar 2 " in out
310
+
311
+
312
+ def test_review_queue_backtick_path_cannot_close_span(tmp_path, monkeypatch, capsys):
313
+ _repo(tmp_path, monkeypatch)
314
+ _write(tmp_path, "0006-p.landmine.md", id=6, title="Backtick path",
315
+ anchors=["src/gone`@octocat`x/", "src/live/"])
316
+ _commit(tmp_path)
317
+ _, out = _queue(capsys)
318
+ row = next(r for r in out.splitlines() if r.startswith("- [ ] scar 6 "))
319
+ assert "``src/gone`@octocat`x/``" in row
320
+ assert not re.search(r"@|#\d", _outside_spans(row[len("- [ ] "):]))
321
+
322
+
323
+ def test_review_queue_suggested_command_path_is_one_span(tmp_path, monkeypatch, capsys):
324
+ _repo(tmp_path, monkeypatch)
325
+ _write(tmp_path, "0007-w.landmine.md", id=7, title="Why path",
326
+ anchors=["src/live/`@octocat"], extra="review_after: 2020-01-01\n")
327
+ (tmp_path / "src" / "live" / "`@octocat").write_text("x\n")
328
+ _commit(tmp_path)
329
+ _, out = _queue(capsys)
330
+ row = next(r for r in out.splitlines() if r.startswith("- [ ] scar 7 "))
331
+ assert "``src/live/`@octocat``" in row
332
+ assert not re.search(r"@|#\d", _outside_spans(row[len("- [ ] "):]))
333
+
334
+
335
+ def test_review_queue_failed_file_path_is_inert(tmp_path, monkeypatch, capsys):
336
+ _repo(tmp_path, monkeypatch)
337
+ _broken(tmp_path, "0009-a`@octocat.landmine.md")
338
+ _, out = _queue(capsys)
339
+ row = next(r for r in out.splitlines() if r.startswith("- [ ]"))
340
+ rest = _outside_spans(row[len("- [ ] "):])
341
+ assert not re.search(r"@|#\d", rest), rest
@@ -372,3 +372,40 @@ def test_shared_slugify_is_the_harvest_and_mcp_normaliser():
372
372
  assert slugify("Redis *failed* [here](http://x.io)", fallback="f") == "redis-failed-here"
373
373
  assert slugify("", fallback="signal") == "signal"
374
374
  assert len(slugify("word " * 40, fallback="f")) <= 60
375
+
376
+
377
+ @pytest.mark.parametrize("raw,expected", [
378
+ ("my_file_name_landmine", "my-file-name-landmine"),
379
+ ("ünï-cödé", "uni-code"),
380
+ ("Ordem de importação", "ordem-de-importacao"),
381
+ ("retry *wrapper* in `foo_bar`", "retry-wrapper-in-foo-bar"),
382
+ ("See [my_doc](http://x.io/a_b) now", "see-my-doc-now"),
383
+ ("https://example.com/a_b/c plain_word", "plain-word"),
384
+ ])
385
+ def test_slugify_keeps_separators_and_transliterates(raw, expected):
386
+ """A filename slug treats `_`, `*` and backticks as word separators and
387
+ maps accented letters to their ASCII base (#365)."""
388
+ from scar.store import slugify
389
+ assert slugify(raw, fallback="f") == expected
390
+
391
+
392
+ def test_slugify_falls_back_when_nothing_decomposes_to_ascii():
393
+ from scar.store import slugify
394
+ assert slugify("日本語のタイトル", fallback="fb") == "fb"
395
+
396
+
397
+ def test_sanitize_signal_text_is_unchanged_by_the_slug_fix():
398
+ """The display-text cleaner keeps deleting emphasis markers (its own job,
399
+ #159). `retry_count` -> `retrycount` is a known sibling of #365, left alone
400
+ on purpose: it is a title, not a filename."""
401
+ from scar.store import sanitize_signal_text
402
+ assert sanitize_signal_text("retry_count failed") == "retrycount failed"
403
+ assert sanitize_signal_text("Redis *failed* [here](http://x.io)") == "Redis failed here"
404
+ assert sanitize_signal_text("see https://x.io/a_b `code`") == "see code"
405
+ assert sanitize_signal_text("ünï") == "ünï"
406
+
407
+
408
+ def test_promote_keeps_underscores_as_separators(repo):
409
+ out = ScarStore.discover(repo).promote(
410
+ _cand(repo, "my_file_name.landmine.md"), reviewer="k")
411
+ assert out.name == "0001-my-file-name.landmine.md"
@@ -297,7 +297,7 @@ wheels = [
297
297
 
298
298
  [[package]]
299
299
  name = "scar-cli"
300
- version = "0.27.1"
300
+ version = "0.27.2"
301
301
  source = { editable = "." }
302
302
  dependencies = [
303
303
  { name = "rich" },
@@ -189,10 +189,10 @@ Orphans, partial rot, symbol drift, unreachable evidence, revivals and passed `r
189
189
 
190
190
  ```bash
191
191
  scar lint --review-queue
192
- # - [ ] #7 One anchor alive, one rotted (src/live/): partial rot (dead anchor among live ones). Suggested: `scar reanchor`
192
+ # - [ ] scar 7 `One anchor alive, one rotted` (`src/live/`): partial rot (dead anchor among live ones). Suggested: `scar reanchor`
193
193
  ```
194
194
 
195
- The output is plain text with no scar bodies, evidence or violation patterns: only id, title, path, state and a suggested command. When nothing needs review it prints nothing and exits 0. Scar files with lint errors are listed too, by path, with no lint message text. Exit codes are unchanged: lint still exits 1 when any file has an error, and `--fail-orphans` and friends still apply. The output is capped below GitHub's issue body limit, with a final line saying how many rows were omitted. The firing-log signals (firing review, never fired) are left out on purpose: that log lives on each developer's machine and is empty on a CI checkout.
195
+ The output is plain text with no scar bodies, evidence or violation patterns: only id, title, path, state and a suggested command. Every value taken from a scar file (title, path, file name) is wrapped in a code span, so a crafted title cannot ping a user, link an issue or inject HTML when the queue is posted to GitHub; the row prefix is `scar 7`, not `#7`, so it never autolinks. When nothing needs review it prints nothing and exits 0. Scar files with lint errors are listed too, by path, with no lint message text. Exit codes are unchanged: lint still exits 1 when any file has an error, and `--fail-orphans` and friends still apply. The output is capped below GitHub's issue body limit, with a final line saying how many rows were omitted. The firing-log signals (firing review, never fired) are left out on purpose: that log lives on each developer's machine and is empty on a CI checkout.
196
196
 
197
197
  ```yaml
198
198
  # .github/workflows/scar-review-queue.yml
@@ -1,3 +0,0 @@
1
- {
2
- ".": "0.27.1"
3
- }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes