agent-code-guard 0.3.1__tar.gz → 0.4.0__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 (57) hide show
  1. {agent_code_guard-0.3.1/src/agent_code_guard.egg-info → agent_code_guard-0.4.0}/PKG-INFO +33 -22
  2. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/README.md +32 -21
  3. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/pyproject.toml +1 -1
  4. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/SKILL.md +20 -2
  5. agent_code_guard-0.4.0/skills/code-guard/references/markdown-size-policy.md +33 -0
  6. agent_code_guard-0.4.0/src/agent_code_guard/baseline_files.py +139 -0
  7. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/code_guard.py +58 -40
  8. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/markdown_document_size.py +20 -6
  9. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/human_output.py +8 -3
  10. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/loc_baseline.py +10 -112
  11. agent_code_guard-0.4.0/src/agent_code_guard/markdown_baseline.py +171 -0
  12. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/result_model.py +9 -1
  13. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0/src/agent_code_guard.egg-info}/PKG-INFO +33 -22
  14. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard.egg-info/SOURCES.txt +2 -0
  15. agent_code_guard-0.3.1/skills/code-guard/references/markdown-size-policy.md +0 -16
  16. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/LICENSE +0 -0
  17. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/MANIFEST.in +0 -0
  18. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/setup.cfg +0 -0
  19. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/LICENSE.txt +0 -0
  20. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/agents/openai.yaml +0 -0
  21. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/references/callable-size-policy.md +0 -0
  22. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/references/complexity-policy.md +0 -0
  23. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/references/loc-policy.md +0 -0
  24. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/skills/code-guard/references/nesting-policy.md +0 -0
  25. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/__init__.py +0 -0
  26. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/__init__.py +0 -0
  27. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/adapters.py +0 -0
  28. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/branch_normalization.py +0 -0
  29. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/callable_identity.py +0 -0
  30. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/csharp_compat.py +0 -0
  31. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/errors.py +0 -0
  32. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/facts.py +0 -0
  33. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/language_specs.py +0 -0
  34. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/pipeline.py +0 -0
  35. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/provider.py +0 -0
  36. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/regions.py +0 -0
  37. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/analysis/syntax_nodes.py +0 -0
  38. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/config_validation.py +0 -0
  39. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/doctor.py +0 -0
  40. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/file_selection.py +0 -0
  41. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/__init__.py +0 -0
  42. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/callable_size.py +0 -0
  43. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/complexity.py +0 -0
  44. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/loc.py +0 -0
  45. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/markdown_section_size.py +0 -0
  46. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/guards/nesting.py +0 -0
  47. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/invocation.py +0 -0
  48. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/markdown/__init__.py +0 -0
  49. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/markdown/facts.py +0 -0
  50. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/markdown/scanner.py +0 -0
  51. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/path_matching.py +0 -0
  52. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/reporting.py +0 -0
  53. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard/skill_distribution.py +0 -0
  54. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard.egg-info/dependency_links.txt +0 -0
  55. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard.egg-info/entry_points.txt +0 -0
  56. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard.egg-info/requires.txt +0 -0
  57. {agent_code_guard-0.3.1 → agent_code_guard-0.4.0}/src/agent_code_guard.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: agent-code-guard
3
- Version: 0.3.1
3
+ Version: 0.4.0
4
4
  Summary: Deterministic cross-language guardrails for agent-assisted development
5
5
  License-Expression: MIT
6
6
  Project-URL: Source, https://github.com/stef-k/agent-code-guard
@@ -21,9 +21,13 @@ Dynamic: license-file
21
21
  Deterministic maintainability guardrails for source code and Markdown changed by
22
22
  a human or coding agent.
23
23
 
24
+ [Documentation](https://stef-k.github.io/agent-code-guard/) ·
25
+ [Get started](https://stef-k.github.io/agent-code-guard/#get-started) ·
26
+ [Releases](https://github.com/stef-k/agent-code-guard/releases)
27
+
24
28
  [![Production Analysis](https://github.com/stef-k/agent-code-guard/actions/workflows/analysis.yml/badge.svg)](https://github.com/stef-k/agent-code-guard/actions/workflows/analysis.yml)
25
29
  [![PyPI](https://img.shields.io/pypi/v/agent-code-guard?logo=pypi&logoColor=white)](https://pypi.org/project/agent-code-guard/)
26
- [![Python 3.10–3.14](https://img.shields.io/badge/Python-3.10%E2%80%933.14-3776AB?logo=python&logoColor=white)](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md)
30
+ [![Python 3.10–3.14](https://img.shields.io/badge/Python-3.10%E2%80%933.14-3776AB?logo=python&logoColor=white)](https://stef-k.github.io/agent-code-guard/platform-support.html)
27
31
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/stef-k/agent-code-guard/blob/main/LICENSE)
28
32
 
29
33
  Agent Code Guard measures file size, callable size, structural nesting,
@@ -75,7 +79,7 @@ code-guard doctor
75
79
  ```
76
80
 
77
81
  `--version` confirms the installed distribution identity. `doctor` checks the
78
- active installation's health. See the [usage guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md) for virtual
82
+ active installation's health. See the [usage guide](https://stef-k.github.io/agent-code-guard/usage.html) for virtual
79
83
  environment, uv, and developer alternatives.
80
84
 
81
85
  ### Ask your agent to adopt it
@@ -89,13 +93,13 @@ Copy this prompt to a coding agent:
89
93
  > activating or exporting its installed, version-matched skill for the current
90
94
  > agent environment. Verify `code-guard --version` and run `code-guard doctor`,
91
95
  > then locate the skill with `code-guard --skill-path`. Follow the
92
- > [skill activation guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md):
96
+ > [skill activation guide](https://stef-k.github.io/agent-code-guard/skill-distribution.html):
93
97
  > activate that installed path when the platform supports it, or export it with
94
98
  > `code-guard --export-skill <target-directory>` to the platform's documented
95
99
  > skill directory. Do not guess a target or overwrite an existing export; verify
96
100
  > that `.agent-code-guard-version` matches the installed distribution. Follow the
97
- > [agent workflow](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md)
98
- > without creating a LOC baseline. After meaningful source or Markdown edits, run
101
+ > [agent workflow](https://stef-k.github.io/agent-code-guard/agent-workflow.html)
102
+ > without creating an adoption baseline. After meaningful source or Markdown edits, run
99
103
  > `code-guard . --changed-only --json --json-mode compact`; outside Git, pass the
100
104
  > exact edited files. Inspect REVIEW and FAIL findings, make only genuine
101
105
  > improvements, rerun the check, and report the result. Never weaken thresholds,
@@ -118,7 +122,7 @@ No configuration is needed. A REVIEW asks for inspection and judgment, not an
118
122
  automatic refactor. Outside Git, pass the exact edited files instead, such as
119
123
  `code-guard src/app.py docs/guide.md`.
120
124
 
121
- See the [agent workflow guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md) for repeated human and
125
+ See the [agent workflow guide](https://stef-k.github.io/agent-code-guard/agent-workflow.html) for repeated human and
122
126
  agent use.
123
127
 
124
128
  ## Recommended workflow
@@ -140,7 +144,7 @@ report the result before completion
140
144
  Use `code-guard . --changed-only --json --json-mode compact` for a structured,
141
145
  low-noise manual agent check. Hooks are optional, platform-owned, and require
142
146
  user authorization; Code Guard does not install them. The
143
- [workflow guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md) owns the complete manual and
147
+ [workflow guide](https://stef-k.github.io/agent-code-guard/agent-workflow.html) owns the complete manual and
144
148
  hook-assisted process.
145
149
 
146
150
  ## Interpreting results
@@ -177,7 +181,7 @@ measurement. A REVIEW is not proof of a defect or a mandatory refactor.
177
181
  Comparisons are strictly greater-than, so equality passes. All guards except
178
182
  file LOC are REVIEW-only; only file LOC can FAIL. A new guard must provide
179
183
  distinct, deterministic value rather than duplicate conventional tooling. See
180
- [Guard admission](https://github.com/stef-k/agent-code-guard/blob/main/docs/guard-admission.md).
184
+ [Guard admission](https://stef-k.github.io/agent-code-guard/guard-admission.html).
181
185
 
182
186
  ### Result and JSON reference
183
187
 
@@ -186,7 +190,7 @@ all-guard-excluded file counts. Bare `--json` is the compatible full output;
186
190
  `--json-mode debug` is byte-identical for the same completed invocation, while
187
191
  `--json-mode compact` removes only normalized `pass` findings and retains the
188
192
  result, scope, required policies, guards, ordering, and actionable findings.
189
- Named modes require `--json`. See [Usage](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md) for the schema and
193
+ Named modes require `--json`. See [Usage](https://stef-k.github.io/agent-code-guard/usage.html) for the schema and
190
194
  option contract.
191
195
 
192
196
  Known per-file syntax or provider failures instead produce `overall:
@@ -221,7 +225,7 @@ Generic `.h` files are not syntax-dispatched; `.markdown` is not enabled; Vue
221
225
  template and style regions are not executable syntax input; and unsupported
222
226
  artifacts are inapplicable. Malformed applicable syntax or a required provider
223
227
  failure is unavailable evidence, distinct from both an inapplicable file and a
224
- completed FAIL finding. See [Language support](https://github.com/stef-k/agent-code-guard/blob/main/docs/language-support.md).
228
+ completed FAIL finding. See [Language support](https://stef-k.github.io/agent-code-guard/language-support.html).
225
229
 
226
230
  ### Skill integration
227
231
 
@@ -233,38 +237,45 @@ code-guard --export-skill <target-directory>
233
237
  ```
234
238
 
235
239
  Skill activation is platform-specific and is not performed by pipx or Code
236
- Guard. See [Skill distribution](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md). The checkout
240
+ Guard. See [Skill distribution](https://stef-k.github.io/agent-code-guard/skill-distribution.html). The checkout
237
241
  compatibility runner is for repository development, not normal installation.
238
242
 
239
243
  ### Configuration
240
244
 
241
245
  Built-in defaults require no configuration. Configure a project only for a
242
- concrete policy reason; see the [configuration guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/configuration.md).
246
+ concrete policy reason; see the [configuration guide](https://stef-k.github.io/agent-code-guard/configuration.html).
243
247
  The LOC baseline is an explicit adoption tool for established legacy
244
248
  repositories, not an ordinary-use requirement or a way to silence findings.
245
249
  Its default `ratchetAt: "fail"` policy freezes files above `failAt`; choose
246
250
  `ratchetAt: "review"` only when every established file above `warnAt` must be
247
251
  non-increasing while ordinary findings in that range remain REVIEW.
248
252
 
253
+ Reviewed oversized Markdown documents have a separate, explicit
254
+ [document-size ratchet](https://stef-k.github.io/agent-code-guard/usage.html#reviewed-markdown-document-ratchet).
255
+ `--create-markdown-baseline` records accepted physical-line counts;
256
+ `--update-markdown-baseline` only lowers or prunes them. Documents within their
257
+ allowance pass the document-size guard; growth produces REVIEW. Section
258
+ findings remain active, and ordinary analysis never writes either baseline.
259
+
249
260
  ## Trust, CI, and platform support
250
261
 
251
262
  CI installs Agent Code Guard and analyzes its own real checkout. REVIEW findings
252
263
  remain visible but non-blocking, while FAIL findings and tool errors block the
253
- workflow; the repository intentionally uses no LOC baseline.
264
+ workflow; the repository intentionally uses no adoption baseline.
254
265
 
255
266
  The maintained interpreter range is **CPython 3.10–3.14**. See
256
- [Platform support](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md) for supported binary platforms and
267
+ [Platform support](https://stef-k.github.io/agent-code-guard/platform-support.html) for supported binary platforms and
257
268
  source-build boundaries.
258
269
 
259
270
  ## Documentation
260
271
 
261
- - [Documentation index](https://github.com/stef-k/agent-code-guard/blob/main/docs/README.md)
262
- - [Agent workflow](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md)
263
- - [Usage and CLI reference](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md)
264
- - [Configuration](https://github.com/stef-k/agent-code-guard/blob/main/docs/configuration.md)
265
- - [Language support](https://github.com/stef-k/agent-code-guard/blob/main/docs/language-support.md)
266
- - [Platform support](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md)
267
- - [Skill distribution](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md)
272
+ - [Documentation index](https://stef-k.github.io/agent-code-guard/)
273
+ - [Agent workflow](https://stef-k.github.io/agent-code-guard/agent-workflow.html)
274
+ - [Usage and CLI reference](https://stef-k.github.io/agent-code-guard/usage.html)
275
+ - [Configuration](https://stef-k.github.io/agent-code-guard/configuration.html)
276
+ - [Language support](https://stef-k.github.io/agent-code-guard/language-support.html)
277
+ - [Platform support](https://stef-k.github.io/agent-code-guard/platform-support.html)
278
+ - [Skill distribution](https://stef-k.github.io/agent-code-guard/skill-distribution.html)
268
279
 
269
280
  ## Feedback, security, and license
270
281
 
@@ -7,9 +7,13 @@
7
7
  Deterministic maintainability guardrails for source code and Markdown changed by
8
8
  a human or coding agent.
9
9
 
10
+ [Documentation](https://stef-k.github.io/agent-code-guard/) ·
11
+ [Get started](https://stef-k.github.io/agent-code-guard/#get-started) ·
12
+ [Releases](https://github.com/stef-k/agent-code-guard/releases)
13
+
10
14
  [![Production Analysis](https://github.com/stef-k/agent-code-guard/actions/workflows/analysis.yml/badge.svg)](https://github.com/stef-k/agent-code-guard/actions/workflows/analysis.yml)
11
15
  [![PyPI](https://img.shields.io/pypi/v/agent-code-guard?logo=pypi&logoColor=white)](https://pypi.org/project/agent-code-guard/)
12
- [![Python 3.10–3.14](https://img.shields.io/badge/Python-3.10%E2%80%933.14-3776AB?logo=python&logoColor=white)](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md)
16
+ [![Python 3.10–3.14](https://img.shields.io/badge/Python-3.10%E2%80%933.14-3776AB?logo=python&logoColor=white)](https://stef-k.github.io/agent-code-guard/platform-support.html)
13
17
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/stef-k/agent-code-guard/blob/main/LICENSE)
14
18
 
15
19
  Agent Code Guard measures file size, callable size, structural nesting,
@@ -61,7 +65,7 @@ code-guard doctor
61
65
  ```
62
66
 
63
67
  `--version` confirms the installed distribution identity. `doctor` checks the
64
- active installation's health. See the [usage guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md) for virtual
68
+ active installation's health. See the [usage guide](https://stef-k.github.io/agent-code-guard/usage.html) for virtual
65
69
  environment, uv, and developer alternatives.
66
70
 
67
71
  ### Ask your agent to adopt it
@@ -75,13 +79,13 @@ Copy this prompt to a coding agent:
75
79
  > activating or exporting its installed, version-matched skill for the current
76
80
  > agent environment. Verify `code-guard --version` and run `code-guard doctor`,
77
81
  > then locate the skill with `code-guard --skill-path`. Follow the
78
- > [skill activation guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md):
82
+ > [skill activation guide](https://stef-k.github.io/agent-code-guard/skill-distribution.html):
79
83
  > activate that installed path when the platform supports it, or export it with
80
84
  > `code-guard --export-skill <target-directory>` to the platform's documented
81
85
  > skill directory. Do not guess a target or overwrite an existing export; verify
82
86
  > that `.agent-code-guard-version` matches the installed distribution. Follow the
83
- > [agent workflow](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md)
84
- > without creating a LOC baseline. After meaningful source or Markdown edits, run
87
+ > [agent workflow](https://stef-k.github.io/agent-code-guard/agent-workflow.html)
88
+ > without creating an adoption baseline. After meaningful source or Markdown edits, run
85
89
  > `code-guard . --changed-only --json --json-mode compact`; outside Git, pass the
86
90
  > exact edited files. Inspect REVIEW and FAIL findings, make only genuine
87
91
  > improvements, rerun the check, and report the result. Never weaken thresholds,
@@ -104,7 +108,7 @@ No configuration is needed. A REVIEW asks for inspection and judgment, not an
104
108
  automatic refactor. Outside Git, pass the exact edited files instead, such as
105
109
  `code-guard src/app.py docs/guide.md`.
106
110
 
107
- See the [agent workflow guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md) for repeated human and
111
+ See the [agent workflow guide](https://stef-k.github.io/agent-code-guard/agent-workflow.html) for repeated human and
108
112
  agent use.
109
113
 
110
114
  ## Recommended workflow
@@ -126,7 +130,7 @@ report the result before completion
126
130
  Use `code-guard . --changed-only --json --json-mode compact` for a structured,
127
131
  low-noise manual agent check. Hooks are optional, platform-owned, and require
128
132
  user authorization; Code Guard does not install them. The
129
- [workflow guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md) owns the complete manual and
133
+ [workflow guide](https://stef-k.github.io/agent-code-guard/agent-workflow.html) owns the complete manual and
130
134
  hook-assisted process.
131
135
 
132
136
  ## Interpreting results
@@ -163,7 +167,7 @@ measurement. A REVIEW is not proof of a defect or a mandatory refactor.
163
167
  Comparisons are strictly greater-than, so equality passes. All guards except
164
168
  file LOC are REVIEW-only; only file LOC can FAIL. A new guard must provide
165
169
  distinct, deterministic value rather than duplicate conventional tooling. See
166
- [Guard admission](https://github.com/stef-k/agent-code-guard/blob/main/docs/guard-admission.md).
170
+ [Guard admission](https://stef-k.github.io/agent-code-guard/guard-admission.html).
167
171
 
168
172
  ### Result and JSON reference
169
173
 
@@ -172,7 +176,7 @@ all-guard-excluded file counts. Bare `--json` is the compatible full output;
172
176
  `--json-mode debug` is byte-identical for the same completed invocation, while
173
177
  `--json-mode compact` removes only normalized `pass` findings and retains the
174
178
  result, scope, required policies, guards, ordering, and actionable findings.
175
- Named modes require `--json`. See [Usage](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md) for the schema and
179
+ Named modes require `--json`. See [Usage](https://stef-k.github.io/agent-code-guard/usage.html) for the schema and
176
180
  option contract.
177
181
 
178
182
  Known per-file syntax or provider failures instead produce `overall:
@@ -207,7 +211,7 @@ Generic `.h` files are not syntax-dispatched; `.markdown` is not enabled; Vue
207
211
  template and style regions are not executable syntax input; and unsupported
208
212
  artifacts are inapplicable. Malformed applicable syntax or a required provider
209
213
  failure is unavailable evidence, distinct from both an inapplicable file and a
210
- completed FAIL finding. See [Language support](https://github.com/stef-k/agent-code-guard/blob/main/docs/language-support.md).
214
+ completed FAIL finding. See [Language support](https://stef-k.github.io/agent-code-guard/language-support.html).
211
215
 
212
216
  ### Skill integration
213
217
 
@@ -219,38 +223,45 @@ code-guard --export-skill <target-directory>
219
223
  ```
220
224
 
221
225
  Skill activation is platform-specific and is not performed by pipx or Code
222
- Guard. See [Skill distribution](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md). The checkout
226
+ Guard. See [Skill distribution](https://stef-k.github.io/agent-code-guard/skill-distribution.html). The checkout
223
227
  compatibility runner is for repository development, not normal installation.
224
228
 
225
229
  ### Configuration
226
230
 
227
231
  Built-in defaults require no configuration. Configure a project only for a
228
- concrete policy reason; see the [configuration guide](https://github.com/stef-k/agent-code-guard/blob/main/docs/configuration.md).
232
+ concrete policy reason; see the [configuration guide](https://stef-k.github.io/agent-code-guard/configuration.html).
229
233
  The LOC baseline is an explicit adoption tool for established legacy
230
234
  repositories, not an ordinary-use requirement or a way to silence findings.
231
235
  Its default `ratchetAt: "fail"` policy freezes files above `failAt`; choose
232
236
  `ratchetAt: "review"` only when every established file above `warnAt` must be
233
237
  non-increasing while ordinary findings in that range remain REVIEW.
234
238
 
239
+ Reviewed oversized Markdown documents have a separate, explicit
240
+ [document-size ratchet](https://stef-k.github.io/agent-code-guard/usage.html#reviewed-markdown-document-ratchet).
241
+ `--create-markdown-baseline` records accepted physical-line counts;
242
+ `--update-markdown-baseline` only lowers or prunes them. Documents within their
243
+ allowance pass the document-size guard; growth produces REVIEW. Section
244
+ findings remain active, and ordinary analysis never writes either baseline.
245
+
235
246
  ## Trust, CI, and platform support
236
247
 
237
248
  CI installs Agent Code Guard and analyzes its own real checkout. REVIEW findings
238
249
  remain visible but non-blocking, while FAIL findings and tool errors block the
239
- workflow; the repository intentionally uses no LOC baseline.
250
+ workflow; the repository intentionally uses no adoption baseline.
240
251
 
241
252
  The maintained interpreter range is **CPython 3.10–3.14**. See
242
- [Platform support](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md) for supported binary platforms and
253
+ [Platform support](https://stef-k.github.io/agent-code-guard/platform-support.html) for supported binary platforms and
243
254
  source-build boundaries.
244
255
 
245
256
  ## Documentation
246
257
 
247
- - [Documentation index](https://github.com/stef-k/agent-code-guard/blob/main/docs/README.md)
248
- - [Agent workflow](https://github.com/stef-k/agent-code-guard/blob/main/docs/agent-workflow.md)
249
- - [Usage and CLI reference](https://github.com/stef-k/agent-code-guard/blob/main/docs/usage.md)
250
- - [Configuration](https://github.com/stef-k/agent-code-guard/blob/main/docs/configuration.md)
251
- - [Language support](https://github.com/stef-k/agent-code-guard/blob/main/docs/language-support.md)
252
- - [Platform support](https://github.com/stef-k/agent-code-guard/blob/main/docs/platform-support.md)
253
- - [Skill distribution](https://github.com/stef-k/agent-code-guard/blob/main/docs/skill-distribution.md)
258
+ - [Documentation index](https://stef-k.github.io/agent-code-guard/)
259
+ - [Agent workflow](https://stef-k.github.io/agent-code-guard/agent-workflow.html)
260
+ - [Usage and CLI reference](https://stef-k.github.io/agent-code-guard/usage.html)
261
+ - [Configuration](https://stef-k.github.io/agent-code-guard/configuration.html)
262
+ - [Language support](https://stef-k.github.io/agent-code-guard/language-support.html)
263
+ - [Platform support](https://stef-k.github.io/agent-code-guard/platform-support.html)
264
+ - [Skill distribution](https://stef-k.github.io/agent-code-guard/skill-distribution.html)
254
265
 
255
266
  ## Feedback, security, and license
256
267
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "agent-code-guard"
7
- version = "0.3.1"
7
+ version = "0.4.0"
8
8
  description = "Deterministic cross-language guardrails for agent-assisted development"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -148,8 +148,9 @@ reviews and never fails. Load `references/complexity-policy.md` only when
148
148
 
149
149
  Markdown document and direct-section size count all physical lines. Sections
150
150
  run from a supported heading through the line before the next heading of any
151
- level, or EOF. Exact effective thresholds pass; greater measurements review and
152
- never fail. Load `references/markdown-size-policy.md` when either
151
+ level, or EOF. Exact effective thresholds pass; greater measurements normally
152
+ review and never fail. A document measurement within an explicitly accepted
153
+ Markdown document baseline passes the document-size guard. Load `references/markdown-size-policy.md` when either
153
154
  `markdownDocumentSize` or `markdownSectionSize` appears in `requiredPolicies`.
154
155
  Review navigation and responsibility without mechanically splitting coherent
155
156
  specifications or gaming headings/formatting.
@@ -161,3 +162,20 @@ REVIEW requires inspection and justification, not mandatory refactoring.
161
162
  Agent Code Guard is the canonical LOC implementation. Agent LOC Guard is the completed prototype/reference whose mature behavior was migrated from commit `75ab39d261dbc65f78815836fac90add16d265d1`.
162
163
 
163
164
  Project-specific architecture rules, framework-specific checks, arbitrary style preferences, security scanners, and dependency auditing are outside the universal core.
165
+
166
+ ## Reviewed Markdown document baselines
167
+
168
+ After explicit acceptance of a cohesive oversized document, use
169
+ `code-guard docs/architecture.md --create-markdown-baseline` to record its current
170
+ physical-line count in `.agent-tools/code-guard.markdown-baseline.json` at the
171
+ analysis root. Normal analysis reads this file without writing. Unchanged or
172
+ smaller accepted documents pass `markdownDocumentSize`; growth above both the
173
+ allowance and effective threshold returns REVIEW. `markdownSectionSize` remains
174
+ independent and has no baseline support.
175
+
176
+ `--update-markdown-baseline` only lowers or prunes existing allowances within
177
+ positional bounds; it never adds or increases one. Neither write command is
178
+ part of routine checks. Do not create, replace, remove, or increase allowances
179
+ merely to silence findings. Review and commit explicit acceptance decisions.
180
+ Human/full JSON output retains acceptance context; compact omits accepted PASS
181
+ findings. Load the Markdown policy for actionable document or section reviews.
@@ -0,0 +1,33 @@
1
+ # Markdown Size Review Policy
2
+
3
+ Use this policy when `markdownDocumentSize` or `markdownSectionSize` appears in
4
+ `requiredPolicies`.
5
+
6
+ A Markdown size REVIEW is an instruction to inspect navigation and
7
+ responsibility, not an automatic instruction to split the document or section.
8
+ `reviewed; coherent; keep` is a valid outcome for cohesive specifications,
9
+ reference material, tables, procedures, and code-heavy sections.
10
+
11
+ Improve navigation or responsibility boundaries only when the result is
12
+ genuinely clearer. Do not add meaningless headings to lower section size,
13
+ mechanically split coherent material, compress formatting or remove useful
14
+ blank lines, or hide content in fenced code. Agents must not raise thresholds or
15
+ disable either guard merely to silence a finding; project or user authority is
16
+ required for configuration changes.
17
+
18
+ ## Explicit document acceptance
19
+
20
+ An explicitly reviewed, cohesive oversized document may use a source-controlled
21
+ allowance created with `--create-markdown-baseline`. The separate
22
+ `.agent-tools/code-guard.markdown-baseline.json` records exact root-relative paths
23
+ and current physical-line counts. Within that allowance the document finding
24
+ passes; growth above both the allowance and effective threshold is REVIEW,
25
+ never FAIL. At or below the ordinary threshold, an allowance is no longer needed.
26
+
27
+ This applies only to `markdownDocumentSize`. Inspect section REVIEW findings
28
+ independently; document acceptance does not exempt sections. Normal analysis
29
+ never changes a baseline. After reductions or deletions,
30
+ `--update-markdown-baseline` can explicitly lower or prune existing entries but
31
+ cannot add or increase allowances. Agents must not create or replace baselines,
32
+ remove allowances, raise thresholds, or add exclusions merely to silence growth.
33
+ Baseline acceptance requires explicit authority and source-control review.
@@ -0,0 +1,139 @@
1
+ """Filesystem safety shared by explicit source-controlled baseline workflows."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ import tempfile
7
+ from pathlib import Path
8
+
9
+ from .file_selection import is_within
10
+
11
+
12
+ def validate_paths(root: Path, entries: dict[str, int], label: str = "LOC") -> None:
13
+ for relative in entries:
14
+ candidate = root / Path(relative)
15
+ resolved = candidate.resolve(strict=False)
16
+ if not is_within(resolved, root):
17
+ raise ValueError(f"{label} baseline path escapes analysis root: {relative}")
18
+ current = root
19
+ for part in Path(relative).parts:
20
+ current = current / part
21
+ if current.is_symlink():
22
+ raise ValueError(f"{label} baseline path traverses a symlink: {relative}")
23
+
24
+
25
+ def validate_explicit_scope(
26
+ values: list[str], invocation: Path, root: Path, selected_files: tuple[Path, ...],
27
+ ) -> set[Path]:
28
+ """Validate raw bounds before resolution erases empty directories and file-link identity."""
29
+ linked_targets: set[Path] = set()
30
+ directly_reached: set[Path] = set()
31
+ for value in values or ["."]:
32
+ path = Path(value) if Path(value).is_absolute() else invocation / value
33
+ resolved = path.resolve()
34
+ if not is_within(resolved, root):
35
+ raise ValueError(f"baseline scope is outside analysis root: {value}")
36
+ if path.is_symlink() and path.is_file():
37
+ linked_targets.add(resolved)
38
+ elif path.is_file():
39
+ directly_reached.add(resolved)
40
+ elif path.is_dir():
41
+ directly_reached.update(
42
+ selected.resolve() for selected in selected_files if is_within(selected, resolved)
43
+ )
44
+ return linked_targets - directly_reached
45
+
46
+
47
+ def atomic_replace(target: Path, content: bytes) -> None:
48
+ temporary = _write_temporary(target, content)
49
+ try:
50
+ os.replace(temporary, target)
51
+ finally:
52
+ try:
53
+ temporary.unlink()
54
+ except FileNotFoundError:
55
+ pass
56
+
57
+
58
+ def atomic_create(target: Path, content: bytes, label: str = "LOC") -> None:
59
+ temporary = _write_temporary(target, content)
60
+ try:
61
+ os.link(temporary, target)
62
+ except FileExistsError as exc:
63
+ raise ValueError(f"{label} baseline already exists: {target.parent.name}/{target.name}") from exc
64
+ finally:
65
+ try:
66
+ temporary.unlink()
67
+ except FileNotFoundError:
68
+ pass
69
+
70
+
71
+ def _write_temporary(target: Path, content: bytes) -> Path:
72
+ descriptor, temporary_name = tempfile.mkstemp(prefix=f".{target.name}.", dir=target.parent)
73
+ temporary = Path(temporary_name)
74
+ try:
75
+ with os.fdopen(descriptor, "wb") as handle:
76
+ handle.write(content)
77
+ handle.flush()
78
+ os.fsync(handle.fileno())
79
+ return temporary
80
+ except Exception:
81
+ temporary.unlink(missing_ok=True)
82
+ raise
83
+
84
+
85
+ def resolve_bounds(values: list[str], invocation: Path, root: Path) -> list[tuple[Path, bool]]:
86
+ bounds = []
87
+ for value in values or ["."]:
88
+ path = Path(value) if Path(value).is_absolute() else invocation / value
89
+ if not path.exists():
90
+ raise FileNotFoundError(f"explicit path does not exist: {value}")
91
+ if path.is_symlink():
92
+ raise ValueError(f"baseline bounds may not be symlinks: {value}")
93
+ resolved = path.resolve()
94
+ if not is_within(resolved, root):
95
+ raise ValueError(f"baseline scope is outside analysis root: {value}")
96
+ bounds.append((resolved, path.is_dir()))
97
+ return bounds
98
+
99
+
100
+ def in_bounds(relative: str, bounds: list[tuple[Path, bool]], root: Path) -> bool:
101
+ candidate = (root / Path(relative)).resolve(strict=False)
102
+ return any(
103
+ is_within(candidate, bound) if is_directory else candidate == bound
104
+ for bound, is_directory in bounds
105
+ )
106
+
107
+
108
+ def require_regular_inside(path: Path, root: Path) -> None:
109
+ if path.is_symlink() or not path.is_file() or not is_within(path, root):
110
+ raise ValueError(f"baseline scope contains an unsafe or outside-root path: {path}")
111
+
112
+
113
+ def canonical_path(value: str) -> bool:
114
+ if not value or "\\" in value or value.endswith("/") or "//" in value:
115
+ return False
116
+ path = Path(value)
117
+ if path.is_absolute() or path.drive or value.startswith("//"):
118
+ return False
119
+ return all(part not in {"", ".", ".."} for part in value.split("/"))
120
+
121
+
122
+ def validate_analysis_scope(root: Path, files: tuple[Path, ...]) -> None:
123
+ """Recheck physical containment before applying any persisted allowance."""
124
+ error = "baseline analysis scope is outside analysis root"
125
+ try:
126
+ current_root = root.resolve(strict=True)
127
+ except OSError as exc:
128
+ raise ValueError(f"{error}: {root}") from exc
129
+ for path in files:
130
+ try:
131
+ current_path = path.resolve(strict=True)
132
+ valid = (
133
+ not path.is_symlink() and current_path.is_file()
134
+ and current_path.is_relative_to(current_root)
135
+ )
136
+ except OSError:
137
+ valid = False
138
+ if not valid:
139
+ raise ValueError(f"{error}: {path}")