@oddessentials/repo-standards 4.4.0 → 5.1.0

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.
@@ -1,6 +1,64 @@
1
1
  {
2
2
  "checklist": {
3
3
  "core": [
4
+ {
5
+ "ciHints": {
6
+ "azure-devops": {
7
+ "notes": "Run CRLF detection early in pipeline before other checks.",
8
+ "stage": "quality"
9
+ }
10
+ },
11
+ "description": "Enforce line endings at the Git layer using .gitattributes. Mark text files with appropriate EOL handling (eol=lf for shell scripts, eol=auto for most files) and binary files as binary to prevent corruption. This prevents 'works locally, fails in CI' issues caused by CRLF/LF mismatches.",
12
+ "id": "gitattributes-eol",
13
+ "label": "Git Attributes (Line Endings)",
14
+ "stack": {
15
+ "exampleConfigFiles": [
16
+ ".gitattributes",
17
+ ".editorconfig"
18
+ ],
19
+ "exampleTools": [
20
+ "git"
21
+ ],
22
+ "machineCheck": {
23
+ "command": "git ls-files --eol | grep -E 'w/crlf.*\\.py$' && exit 1 || exit 0",
24
+ "description": "Verify no CRLF in Python files",
25
+ "expectExitCode": 0
26
+ },
27
+ "notes": "Python files should use LF endings for cross-platform compatibility. Mark *.py as eol=lf in .gitattributes. Shebang scripts fail with CRLF.",
28
+ "optionalFiles": [
29
+ ".editorconfig"
30
+ ],
31
+ "requiredFiles": [
32
+ ".gitattributes"
33
+ ],
34
+ "verification": "Run 'git ls-files --eol' and verify Python files use LF."
35
+ }
36
+ },
37
+ {
38
+ "ciHints": {
39
+ "azure-devops": {
40
+ "notes": "Run CRLF detection as the first quality check before linting or testing.",
41
+ "stage": "quality"
42
+ }
43
+ },
44
+ "description": "Fail CI early for Linux-executed files containing CRLF line endings. Shell scripts, Python files, and other interpreted files fail silently or with cryptic errors when they contain \\r characters. Detect this before running deeper CI steps.",
45
+ "id": "crlf-detection",
46
+ "label": "CRLF Detection in CI",
47
+ "stack": {
48
+ "exampleConfigFiles": [],
49
+ "exampleTools": [
50
+ "file",
51
+ "grep"
52
+ ],
53
+ "machineCheck": {
54
+ "command": "git ls-files --eol | grep -E 'w/crlf.*\\.(py|sh)$' && exit 1 || exit 0",
55
+ "description": "Detect CRLF in Python/shell files",
56
+ "expectExitCode": 0
57
+ },
58
+ "notes": "Python shebang scripts fail with CRLF. Check all .py and .sh files for CRLF before running pytest or other Python tools.",
59
+ "verification": "Run CRLF detection on Python and shell files."
60
+ }
61
+ },
4
62
  {
5
63
  "ciHints": {
6
64
  "azure-devops": {
@@ -153,6 +211,38 @@
153
211
  "verification": "Check that the canonical version in pyproject.toml or VERSION follows SemVer and verify that the configured tool (for example, setuptools_scm or bumpversion) computes or bumps the version and generates changelog entries from commit history or fragments."
154
212
  }
155
213
  },
214
+ {
215
+ "ciHints": {
216
+ "azure-devops": {
217
+ "notes": "Run the version guard in PR validation jobs before merge.",
218
+ "stage": "quality"
219
+ }
220
+ },
221
+ "description": "If semantic-release or automated versioning is enabled, block manual edits to canonical version fields in pull requests. Enforce a CI guard (and optional pre-push hook) that fails when version lines change outside the release workflow.",
222
+ "id": "version-guard",
223
+ "label": "Version Guard (Automated Releases)",
224
+ "stack": {
225
+ "exampleConfigFiles": [
226
+ "scripts/check-version-unchanged.sh",
227
+ ".github/workflows/ci.yml",
228
+ "azure-pipelines.yml"
229
+ ],
230
+ "exampleTools": [
231
+ "semantic-release",
232
+ "git"
233
+ ],
234
+ "notes": "Block manual edits to version fields in pyproject.toml or setup.cfg when automated release tooling computes versions from commit history.",
235
+ "optionalFiles": [
236
+ "setup.cfg",
237
+ "setup.py",
238
+ "VERSION"
239
+ ],
240
+ "requiredFiles": [
241
+ "pyproject.toml"
242
+ ],
243
+ "verification": "Run the guard and confirm it fails when version lines change in pyproject.toml or setup.cfg."
244
+ }
245
+ },
156
246
  {
157
247
  "ciHints": {
158
248
  "azure-devops": {
@@ -184,6 +274,28 @@
184
274
  "verification": "Trigger the release pipeline and confirm all artifacts share the same version number and tag."
185
275
  }
186
276
  },
277
+ {
278
+ "ciHints": {
279
+ "azure-devops": {
280
+ "notes": "Set HUSKY=0 or equivalent in release pipeline to disable hooks.",
281
+ "stage": "release"
282
+ }
283
+ },
284
+ "description": "Release automation must bypass local developer hooks (HUSKY=0, --no-verify) and rely solely on CI gates for validation. This ensures idempotent, reproducible releases that don't fail due to hook environment differences.",
285
+ "id": "release-hook-bypass",
286
+ "label": "Release Hook Bypass",
287
+ "stack": {
288
+ "exampleConfigFiles": [
289
+ ".github/workflows/release.yml"
290
+ ],
291
+ "exampleTools": [
292
+ "semantic-release",
293
+ "bumpversion"
294
+ ],
295
+ "notes": "Set PRE_COMMIT_ALLOW_NO_CONFIG=1 or SKIP=all to bypass pre-commit hooks in release automation. CI gates already validated.",
296
+ "verification": "Check release workflow for pre-commit bypass."
297
+ }
298
+ },
187
299
  {
188
300
  "ciHints": {
189
301
  "azure-devops": {
@@ -299,10 +411,11 @@
299
411
  {
300
412
  "ciHints": {
301
413
  "azure-devops": {
414
+ "notes": "Hooks and CI must invoke identical verification commands. Use npm run verify or equivalent.",
302
415
  "stage": "quality"
303
416
  }
304
417
  },
305
- "description": "Use git hooks to run linting, formatting, tests, and commit linting before changes are committed.",
418
+ "description": "Use git hooks to run linting, formatting, and commit linting before changes are committed. Hooks should CHECK by default (not auto-fix), be fast, and scope to changed files only. Use a single entry hook mechanism (e.g., Husky as entry point calling pre-commit or lint-staged).",
306
419
  "id": "pre-commit-hooks",
307
420
  "label": "Pre-Commit Hooks",
308
421
  "stack": {
@@ -312,8 +425,56 @@
312
425
  "exampleTools": [
313
426
  "pre-commit"
314
427
  ],
315
- "notes": "Use pre-commit to run ruff, black, and optionally mypy on staged files before committing.",
316
- "verification": "Inspect .pre-commit-config.yaml and confirm that hooks for linting, formatting, and optionally type checking are enabled and run on changed files before commits."
428
+ "notes": "Use pre-commit framework as both entry and executor. Pin hook versions in .pre-commit-config.yaml for determinism. Hooks should run checks (ruff check, black --check) not auto-fix. Run pre-commit install to set up hooks.",
429
+ "verification": "Inspect .pre-commit-config.yaml and confirm hooks use check/verify flags, not auto-fix."
430
+ }
431
+ },
432
+ {
433
+ "ciHints": {
434
+ "azure-devops": {
435
+ "notes": "CI should call the same verify script that hooks use locally.",
436
+ "stage": "quality"
437
+ }
438
+ },
439
+ "description": "Local hooks and CI must invoke identical verification commands to prevent 'works locally, fails in CI' issues. Use a single canonical verify entrypoint (e.g., npm run verify) that both hooks and CI call.",
440
+ "id": "hook-ci-parity",
441
+ "label": "Hook/CI Parity",
442
+ "stack": {
443
+ "exampleConfigFiles": [
444
+ "Makefile",
445
+ "tox.ini",
446
+ "noxfile.py"
447
+ ],
448
+ "exampleTools": [
449
+ "make",
450
+ "tox",
451
+ "nox"
452
+ ],
453
+ "notes": "Define a verify target (make verify, tox -e lint, or nox -s lint) that both pre-commit and CI invoke. Pin tool versions in pyproject.toml.",
454
+ "verification": "Compare hook commands with CI commands and confirm they invoke the same targets."
455
+ }
456
+ },
457
+ {
458
+ "ciHints": {
459
+ "azure-devops": {
460
+ "notes": "Also run secret scanning in CI as a safety net for commits that bypassed hooks.",
461
+ "stage": "quality"
462
+ }
463
+ },
464
+ "description": "Scan staged diffs for credentials, API keys, and secrets before they reach the remote repository. Catch secrets at commit time rather than after they're pushed.",
465
+ "id": "secret-scanning-precommit",
466
+ "label": "Pre-commit Secret Scanning",
467
+ "stack": {
468
+ "exampleConfigFiles": [
469
+ ".pre-commit-config.yaml",
470
+ ".secrets.baseline"
471
+ ],
472
+ "exampleTools": [
473
+ "detect-secrets",
474
+ "gitleaks"
475
+ ],
476
+ "notes": "Add detect-secrets or gitleaks to .pre-commit-config.yaml. Use detect-secrets audit to manage baselines.",
477
+ "verification": "Run 'detect-secrets scan' or 'gitleaks protect' and verify scanning works."
317
478
  }
318
479
  },
319
480
  {
@@ -553,6 +714,75 @@
553
714
  ],
554
715
  "verification": "LICENSE file is present in the repository root; CODE_OF_CONDUCT.md and CONTRIBUTING.md are present for contribution guidance."
555
716
  }
717
+ },
718
+ {
719
+ "ciHints": {
720
+ "azure-devops": {
721
+ "notes": "CI should call the canonical verify command, not duplicate check logic.",
722
+ "stage": "quality"
723
+ }
724
+ },
725
+ "description": "Provide one canonical 'verify' command per repository/stack that all stages call with appropriate flags. This prevents duplication, drift, and ensures consistency between local development and CI.",
726
+ "id": "canonical-verify",
727
+ "label": "Canonical Verify Entrypoint",
728
+ "stack": {
729
+ "exampleConfigFiles": [
730
+ "Makefile",
731
+ "tox.ini",
732
+ "noxfile.py"
733
+ ],
734
+ "exampleTools": [
735
+ "make",
736
+ "tox",
737
+ "nox"
738
+ ],
739
+ "notes": "Define 'make verify' or 'tox -e verify' that runs ruff, black --check, mypy, and pytest. All stages use this entrypoint.",
740
+ "verification": "Makefile or tox.ini contains a 'verify' target/environment."
741
+ }
742
+ },
743
+ {
744
+ "ciHints": {
745
+ "azure-devops": {
746
+ "notes": "Ensure CI reads from authoritative configs, not duplicated settings.",
747
+ "stage": "quality"
748
+ }
749
+ },
750
+ "description": "Each configuration rule must live in exactly one authoritative config file. Avoid duplication across .editorconfig, linter configs, and CI definitions. Document which file is authoritative for each concern.",
751
+ "id": "config-authority",
752
+ "label": "Config File Authority Rules",
753
+ "stack": {
754
+ "exampleConfigFiles": [
755
+ ".gitattributes",
756
+ "pyproject.toml",
757
+ ".editorconfig"
758
+ ],
759
+ "exampleTools": [],
760
+ "notes": "Authority mapping: .gitattributes for EOL, pyproject.toml for all tool configs (ruff, black, mypy, pytest). Avoid separate tool configs (.flake8, setup.cfg) when pyproject.toml can hold them.",
761
+ "verification": "Review configs and confirm pyproject.toml is the single source for tool settings."
762
+ }
763
+ },
764
+ {
765
+ "ciHints": {
766
+ "azure-devops": {
767
+ "notes": "CI should read skip paths from config files, not hardcode them in pipeline.",
768
+ "stage": "quality"
769
+ }
770
+ },
771
+ "description": "Encode path exclusions and skip rules deterministically in config files, not through ad-hoc human judgment. Make it clear which paths are excluded from checks and why.",
772
+ "id": "explicit-skip-paths",
773
+ "label": "Explicit Skip Paths",
774
+ "stack": {
775
+ "exampleConfigFiles": [
776
+ "pyproject.toml"
777
+ ],
778
+ "exampleTools": [
779
+ "ruff",
780
+ "black",
781
+ "mypy"
782
+ ],
783
+ "notes": "Define exclude patterns in pyproject.toml [tool.ruff], [tool.black], [tool.mypy] sections. Document why each path is excluded. Avoid runtime --exclude flags.",
784
+ "verification": "Review pyproject.toml and confirm all exclusions are defined there, not in scripts."
785
+ }
556
786
  }
557
787
  ],
558
788
  "optionalEnhancements": [
@@ -758,6 +988,122 @@
758
988
  "verification": "For Python-backed web UIs, run the configured accessibility tooling (for example, pa11y or axe via a headless browser) against key routes and verify that critical issues are fixed or tracked."
759
989
  }
760
990
  },
991
+ {
992
+ "ciHints": {
993
+ "azure-devops": {
994
+ "notes": "Run AI drift detection in a scheduled nightly pipeline separate from main CI.",
995
+ "stage": "nightly"
996
+ }
997
+ },
998
+ "description": "Run nightly or scheduled checks comparing AI-generated outputs against pinned baselines to detect model drift, prompt drift, or code changes affecting AI behavior. Attribute regressions to code changes vs model updates vs prompt changes.",
999
+ "id": "ai-drift-detection",
1000
+ "label": "AI Drift Detection",
1001
+ "stack": {
1002
+ "exampleConfigFiles": [
1003
+ "tests/ai_baselines/",
1004
+ "pytest.ini"
1005
+ ],
1006
+ "exampleTools": [
1007
+ "pytest",
1008
+ "deepdiff",
1009
+ "great_expectations"
1010
+ ],
1011
+ "notes": "Create golden output tests for AI-generated content. Use deepdiff for structured comparison. For ML models, also track metrics drift (accuracy, latency) not just output drift.",
1012
+ "verification": "Run AI baseline tests nightly and confirm outputs match or drift is documented."
1013
+ }
1014
+ },
1015
+ {
1016
+ "ciHints": {
1017
+ "azure-devops": {
1018
+ "notes": "Run schema validation tests as part of quality gates.",
1019
+ "stage": "quality"
1020
+ }
1021
+ },
1022
+ "description": "Validate all AI-generated outputs against strict JSON schemas or type definitions at system boundaries. Reject invalid outputs early rather than letting malformed data propagate through the system.",
1023
+ "id": "ai-schema-enforcement",
1024
+ "label": "AI Output Schema Enforcement",
1025
+ "stack": {
1026
+ "exampleConfigFiles": [
1027
+ "schemas/",
1028
+ "models.py"
1029
+ ],
1030
+ "exampleTools": [
1031
+ "pydantic",
1032
+ "jsonschema",
1033
+ "marshmallow"
1034
+ ],
1035
+ "notes": "Use Pydantic models for AI output validation. Enable strict mode to reject extra fields. Define clear schemas at system boundaries where AI outputs enter the codebase.",
1036
+ "verification": "Review AI integration code and confirm Pydantic or equivalent validation is in place."
1037
+ }
1038
+ },
1039
+ {
1040
+ "ciHints": {
1041
+ "azure-devops": {
1042
+ "notes": "Run AI golden tests as part of the test stage.",
1043
+ "stage": "test"
1044
+ }
1045
+ },
1046
+ "description": "Validate AI tool-generated patches, configs, and code against exact expected formats. Test that AI outputs respect forbidden paths, file patterns, and format constraints through golden contract tests.",
1047
+ "id": "ai-golden-tests",
1048
+ "label": "AI Golden Contract Tests",
1049
+ "stack": {
1050
+ "exampleConfigFiles": [
1051
+ "tests/fixtures/",
1052
+ "__snapshots__/"
1053
+ ],
1054
+ "exampleTools": [
1055
+ "pytest",
1056
+ "syrupy"
1057
+ ],
1058
+ "notes": "Use pytest with syrupy for snapshot testing AI outputs. Test that generated code follows project conventions and respects forbidden paths.",
1059
+ "verification": "Run snapshot tests and confirm AI outputs match golden fixtures."
1060
+ }
1061
+ },
1062
+ {
1063
+ "ciHints": {
1064
+ "azure-devops": {
1065
+ "notes": "Run AI safety tests as part of security stage on main branch.",
1066
+ "stage": "security"
1067
+ }
1068
+ },
1069
+ "description": "Test AI integrations for prompt injection resistance, input sanitization, output filtering, and data exfiltration prevention. Include adversarial test cases that attempt to manipulate AI behavior.",
1070
+ "id": "ai-safety-checks",
1071
+ "label": "AI Adversarial & Safety Testing",
1072
+ "stack": {
1073
+ "exampleConfigFiles": [
1074
+ "tests/ai_safety/"
1075
+ ],
1076
+ "exampleTools": [
1077
+ "pytest",
1078
+ "hypothesis"
1079
+ ],
1080
+ "notes": "Use hypothesis for property-based testing of AI input handling. Test prompt injection, output sanitization, and data boundary enforcement.",
1081
+ "verification": "Run AI safety tests including adversarial cases."
1082
+ }
1083
+ },
1084
+ {
1085
+ "ciHints": {
1086
+ "azure-devops": {
1087
+ "notes": "Verify AI provenance logging is implemented in quality checks.",
1088
+ "stage": "quality"
1089
+ }
1090
+ },
1091
+ "description": "Log AI provider, model version, prompt template version, parameters, and tool versions for all AI operations. Enable attribution of outputs to specific model+prompt combinations for debugging and compliance.",
1092
+ "id": "ai-provenance-tracking",
1093
+ "label": "AI Provenance & Audit Logging",
1094
+ "stack": {
1095
+ "exampleConfigFiles": [
1096
+ "ai/provenance.py"
1097
+ ],
1098
+ "exampleTools": [
1099
+ "structlog",
1100
+ "OpenTelemetry",
1101
+ "MLflow"
1102
+ ],
1103
+ "notes": "Log AI provenance using structlog or MLflow tracking. For ML models, also track training data version and model artifact hash.",
1104
+ "verification": "Review AI integration and confirm provenance is tracked."
1105
+ }
1106
+ },
761
1107
  {
762
1108
  "ciHints": {
763
1109
  "azure-devops": {
@@ -834,27 +1180,41 @@
834
1180
  },
835
1181
  "migrationGuide": [
836
1182
  {
837
- "description": "Start by adding pre-commit hooks and core formatting/linting so developers get fast feedback without touching CI.",
1183
+ "description": "Configure .gitattributes for cross-platform line ending correctness and establish the canonical verify entrypoint before adding any checks. This prevents 'works locally, fails in CI' issues from day one.",
1184
+ "focusIds": [
1185
+ "gitattributes-eol",
1186
+ "canonical-verify",
1187
+ "hook-ci-parity",
1188
+ "config-authority"
1189
+ ],
1190
+ "notes": "Start here to avoid debugging cryptic CRLF failures later. Use .gitattributes as the authority for EOL (not .editorconfig). Run 'git add --renormalize .' after adding .gitattributes to fix existing files.",
1191
+ "step": 0,
1192
+ "title": "Foundation: Line Endings and Hook Entry Point"
1193
+ },
1194
+ {
1195
+ "description": "Add pre-commit hooks with secret scanning, formatting, and linting. Hooks should CHECK (not auto-fix) and scope to changed files only for speed.",
838
1196
  "focusIds": [
839
1197
  "pre-commit-hooks",
1198
+ "secret-scanning-precommit",
840
1199
  "linting",
841
1200
  "code-formatter"
842
1201
  ],
843
- "notes": "Keep hooks fast and focused on changed files to avoid slowing down day-to-day work.",
1202
+ "notes": "Keep hooks fast by scoping to staged files. Use Husky as entry point calling lint-staged or pre-commit. Hooks should check, not fix, to keep developers aware of issues.",
844
1203
  "step": 1,
845
1204
  "title": "Establish Local Safety Nets First"
846
1205
  },
847
1206
  {
848
- "description": "Introduce CI quality gates that mirror local checks, but treat existing violations as warnings wherever possible.",
1207
+ "description": "Introduce CI quality gates that mirror local hooks exactly. Add CRLF detection early in pipeline. Treat existing violations as warnings where possible.",
849
1208
  "focusIds": [
1209
+ "crlf-detection",
850
1210
  "ci-quality-gates",
851
1211
  "linting",
852
1212
  "code-formatter",
853
1213
  "commit-linting"
854
1214
  ],
855
- "notes": "Use diff-based tools or baselines so only new violations break builds; legacy issues remain visible but non-blocking.",
1215
+ "notes": "CI must call the same verify scripts that hooks use. Add CRLF detection before other checks to fail fast on line ending issues. Use diff-based tools so only new violations break builds.",
856
1216
  "step": 2,
857
- "title": "Mirror Local Checks in CI (Soft-Fail on Legacy)"
1217
+ "title": "Mirror Local Checks in CI with CRLF Detection"
858
1218
  },
859
1219
  {
860
1220
  "description": "Enable type-checking, coverage thresholds, and dependency/vulnerability scanning with gradual enforcement.",
@@ -879,9 +1239,22 @@
879
1239
  "complexity-analysis",
880
1240
  "accessibility-auditing"
881
1241
  ],
882
- "notes": "Tackle recommended items in order of business value; backend-only repos can skip web-focused checks like accessibility. For AI/ML-heavy Python teams, consider extending containerization with data versioning (DVC) and unit tests with data quality checks (e.g., Great Expectations) as part of this step.",
1242
+ "notes": "Tackle recommended items in order of business value; backend-only repos can skip web-focused checks like accessibility.",
883
1243
  "step": 4,
884
1244
  "title": "Layer in Docs, Governance, and Recommended Checks"
1245
+ },
1246
+ {
1247
+ "description": "For repos using or building with generative AI, add drift detection, schema enforcement, golden contract tests, safety testing, and provenance tracking.",
1248
+ "focusIds": [
1249
+ "ai-drift-detection",
1250
+ "ai-schema-enforcement",
1251
+ "ai-golden-tests",
1252
+ "ai-safety-checks",
1253
+ "ai-provenance-tracking"
1254
+ ],
1255
+ "notes": "Skip this step if your repo has no AI/ML components. For AI-heavy repos: add nightly drift detection to catch model changes, enforce strict schemas at AI output boundaries, and log provenance for debugging 'why did AI do X?'",
1256
+ "step": 5,
1257
+ "title": "AI/ML Governance (If Applicable)"
885
1258
  }
886
1259
  ],
887
1260
  "qualityGatePolicy": {
@@ -891,5 +1264,5 @@
891
1264
  },
892
1265
  "stack": "python",
893
1266
  "stackLabel": "Python",
894
- "version": 4
1267
+ "version": 5
895
1268
  }