@oddessentials/repo-standards 4.4.0 → 5.0.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": {
@@ -184,6 +242,28 @@
184
242
  "verification": "Trigger the release pipeline and confirm all artifacts share the same version number and tag."
185
243
  }
186
244
  },
245
+ {
246
+ "ciHints": {
247
+ "azure-devops": {
248
+ "notes": "Set HUSKY=0 or equivalent in release pipeline to disable hooks.",
249
+ "stage": "release"
250
+ }
251
+ },
252
+ "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.",
253
+ "id": "release-hook-bypass",
254
+ "label": "Release Hook Bypass",
255
+ "stack": {
256
+ "exampleConfigFiles": [
257
+ ".github/workflows/release.yml"
258
+ ],
259
+ "exampleTools": [
260
+ "semantic-release",
261
+ "bumpversion"
262
+ ],
263
+ "notes": "Set PRE_COMMIT_ALLOW_NO_CONFIG=1 or SKIP=all to bypass pre-commit hooks in release automation. CI gates already validated.",
264
+ "verification": "Check release workflow for pre-commit bypass."
265
+ }
266
+ },
187
267
  {
188
268
  "ciHints": {
189
269
  "azure-devops": {
@@ -299,10 +379,11 @@
299
379
  {
300
380
  "ciHints": {
301
381
  "azure-devops": {
382
+ "notes": "Hooks and CI must invoke identical verification commands. Use npm run verify or equivalent.",
302
383
  "stage": "quality"
303
384
  }
304
385
  },
305
- "description": "Use git hooks to run linting, formatting, tests, and commit linting before changes are committed.",
386
+ "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
387
  "id": "pre-commit-hooks",
307
388
  "label": "Pre-Commit Hooks",
308
389
  "stack": {
@@ -312,8 +393,56 @@
312
393
  "exampleTools": [
313
394
  "pre-commit"
314
395
  ],
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."
396
+ "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.",
397
+ "verification": "Inspect .pre-commit-config.yaml and confirm hooks use check/verify flags, not auto-fix."
398
+ }
399
+ },
400
+ {
401
+ "ciHints": {
402
+ "azure-devops": {
403
+ "notes": "CI should call the same verify script that hooks use locally.",
404
+ "stage": "quality"
405
+ }
406
+ },
407
+ "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.",
408
+ "id": "hook-ci-parity",
409
+ "label": "Hook/CI Parity",
410
+ "stack": {
411
+ "exampleConfigFiles": [
412
+ "Makefile",
413
+ "tox.ini",
414
+ "noxfile.py"
415
+ ],
416
+ "exampleTools": [
417
+ "make",
418
+ "tox",
419
+ "nox"
420
+ ],
421
+ "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.",
422
+ "verification": "Compare hook commands with CI commands and confirm they invoke the same targets."
423
+ }
424
+ },
425
+ {
426
+ "ciHints": {
427
+ "azure-devops": {
428
+ "notes": "Also run secret scanning in CI as a safety net for commits that bypassed hooks.",
429
+ "stage": "quality"
430
+ }
431
+ },
432
+ "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.",
433
+ "id": "secret-scanning-precommit",
434
+ "label": "Pre-commit Secret Scanning",
435
+ "stack": {
436
+ "exampleConfigFiles": [
437
+ ".pre-commit-config.yaml",
438
+ ".secrets.baseline"
439
+ ],
440
+ "exampleTools": [
441
+ "detect-secrets",
442
+ "gitleaks"
443
+ ],
444
+ "notes": "Add detect-secrets or gitleaks to .pre-commit-config.yaml. Use detect-secrets audit to manage baselines.",
445
+ "verification": "Run 'detect-secrets scan' or 'gitleaks protect' and verify scanning works."
317
446
  }
318
447
  },
319
448
  {
@@ -553,6 +682,75 @@
553
682
  ],
554
683
  "verification": "LICENSE file is present in the repository root; CODE_OF_CONDUCT.md and CONTRIBUTING.md are present for contribution guidance."
555
684
  }
685
+ },
686
+ {
687
+ "ciHints": {
688
+ "azure-devops": {
689
+ "notes": "CI should call the canonical verify command, not duplicate check logic.",
690
+ "stage": "quality"
691
+ }
692
+ },
693
+ "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.",
694
+ "id": "canonical-verify",
695
+ "label": "Canonical Verify Entrypoint",
696
+ "stack": {
697
+ "exampleConfigFiles": [
698
+ "Makefile",
699
+ "tox.ini",
700
+ "noxfile.py"
701
+ ],
702
+ "exampleTools": [
703
+ "make",
704
+ "tox",
705
+ "nox"
706
+ ],
707
+ "notes": "Define 'make verify' or 'tox -e verify' that runs ruff, black --check, mypy, and pytest. All stages use this entrypoint.",
708
+ "verification": "Makefile or tox.ini contains a 'verify' target/environment."
709
+ }
710
+ },
711
+ {
712
+ "ciHints": {
713
+ "azure-devops": {
714
+ "notes": "Ensure CI reads from authoritative configs, not duplicated settings.",
715
+ "stage": "quality"
716
+ }
717
+ },
718
+ "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.",
719
+ "id": "config-authority",
720
+ "label": "Config File Authority Rules",
721
+ "stack": {
722
+ "exampleConfigFiles": [
723
+ ".gitattributes",
724
+ "pyproject.toml",
725
+ ".editorconfig"
726
+ ],
727
+ "exampleTools": [],
728
+ "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.",
729
+ "verification": "Review configs and confirm pyproject.toml is the single source for tool settings."
730
+ }
731
+ },
732
+ {
733
+ "ciHints": {
734
+ "azure-devops": {
735
+ "notes": "CI should read skip paths from config files, not hardcode them in pipeline.",
736
+ "stage": "quality"
737
+ }
738
+ },
739
+ "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.",
740
+ "id": "explicit-skip-paths",
741
+ "label": "Explicit Skip Paths",
742
+ "stack": {
743
+ "exampleConfigFiles": [
744
+ "pyproject.toml"
745
+ ],
746
+ "exampleTools": [
747
+ "ruff",
748
+ "black",
749
+ "mypy"
750
+ ],
751
+ "notes": "Define exclude patterns in pyproject.toml [tool.ruff], [tool.black], [tool.mypy] sections. Document why each path is excluded. Avoid runtime --exclude flags.",
752
+ "verification": "Review pyproject.toml and confirm all exclusions are defined there, not in scripts."
753
+ }
556
754
  }
557
755
  ],
558
756
  "optionalEnhancements": [
@@ -758,6 +956,122 @@
758
956
  "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
957
  }
760
958
  },
959
+ {
960
+ "ciHints": {
961
+ "azure-devops": {
962
+ "notes": "Run AI drift detection in a scheduled nightly pipeline separate from main CI.",
963
+ "stage": "nightly"
964
+ }
965
+ },
966
+ "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.",
967
+ "id": "ai-drift-detection",
968
+ "label": "AI Drift Detection",
969
+ "stack": {
970
+ "exampleConfigFiles": [
971
+ "tests/ai_baselines/",
972
+ "pytest.ini"
973
+ ],
974
+ "exampleTools": [
975
+ "pytest",
976
+ "deepdiff",
977
+ "great_expectations"
978
+ ],
979
+ "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.",
980
+ "verification": "Run AI baseline tests nightly and confirm outputs match or drift is documented."
981
+ }
982
+ },
983
+ {
984
+ "ciHints": {
985
+ "azure-devops": {
986
+ "notes": "Run schema validation tests as part of quality gates.",
987
+ "stage": "quality"
988
+ }
989
+ },
990
+ "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.",
991
+ "id": "ai-schema-enforcement",
992
+ "label": "AI Output Schema Enforcement",
993
+ "stack": {
994
+ "exampleConfigFiles": [
995
+ "schemas/",
996
+ "models.py"
997
+ ],
998
+ "exampleTools": [
999
+ "pydantic",
1000
+ "jsonschema",
1001
+ "marshmallow"
1002
+ ],
1003
+ "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.",
1004
+ "verification": "Review AI integration code and confirm Pydantic or equivalent validation is in place."
1005
+ }
1006
+ },
1007
+ {
1008
+ "ciHints": {
1009
+ "azure-devops": {
1010
+ "notes": "Run AI golden tests as part of the test stage.",
1011
+ "stage": "test"
1012
+ }
1013
+ },
1014
+ "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.",
1015
+ "id": "ai-golden-tests",
1016
+ "label": "AI Golden Contract Tests",
1017
+ "stack": {
1018
+ "exampleConfigFiles": [
1019
+ "tests/fixtures/",
1020
+ "__snapshots__/"
1021
+ ],
1022
+ "exampleTools": [
1023
+ "pytest",
1024
+ "syrupy"
1025
+ ],
1026
+ "notes": "Use pytest with syrupy for snapshot testing AI outputs. Test that generated code follows project conventions and respects forbidden paths.",
1027
+ "verification": "Run snapshot tests and confirm AI outputs match golden fixtures."
1028
+ }
1029
+ },
1030
+ {
1031
+ "ciHints": {
1032
+ "azure-devops": {
1033
+ "notes": "Run AI safety tests as part of security stage on main branch.",
1034
+ "stage": "security"
1035
+ }
1036
+ },
1037
+ "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.",
1038
+ "id": "ai-safety-checks",
1039
+ "label": "AI Adversarial & Safety Testing",
1040
+ "stack": {
1041
+ "exampleConfigFiles": [
1042
+ "tests/ai_safety/"
1043
+ ],
1044
+ "exampleTools": [
1045
+ "pytest",
1046
+ "hypothesis"
1047
+ ],
1048
+ "notes": "Use hypothesis for property-based testing of AI input handling. Test prompt injection, output sanitization, and data boundary enforcement.",
1049
+ "verification": "Run AI safety tests including adversarial cases."
1050
+ }
1051
+ },
1052
+ {
1053
+ "ciHints": {
1054
+ "azure-devops": {
1055
+ "notes": "Verify AI provenance logging is implemented in quality checks.",
1056
+ "stage": "quality"
1057
+ }
1058
+ },
1059
+ "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.",
1060
+ "id": "ai-provenance-tracking",
1061
+ "label": "AI Provenance & Audit Logging",
1062
+ "stack": {
1063
+ "exampleConfigFiles": [
1064
+ "ai/provenance.py"
1065
+ ],
1066
+ "exampleTools": [
1067
+ "structlog",
1068
+ "OpenTelemetry",
1069
+ "MLflow"
1070
+ ],
1071
+ "notes": "Log AI provenance using structlog or MLflow tracking. For ML models, also track training data version and model artifact hash.",
1072
+ "verification": "Review AI integration and confirm provenance is tracked."
1073
+ }
1074
+ },
761
1075
  {
762
1076
  "ciHints": {
763
1077
  "azure-devops": {
@@ -834,27 +1148,41 @@
834
1148
  },
835
1149
  "migrationGuide": [
836
1150
  {
837
- "description": "Start by adding pre-commit hooks and core formatting/linting so developers get fast feedback without touching CI.",
1151
+ "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.",
1152
+ "focusIds": [
1153
+ "gitattributes-eol",
1154
+ "canonical-verify",
1155
+ "hook-ci-parity",
1156
+ "config-authority"
1157
+ ],
1158
+ "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.",
1159
+ "step": 0,
1160
+ "title": "Foundation: Line Endings and Hook Entry Point"
1161
+ },
1162
+ {
1163
+ "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
1164
  "focusIds": [
839
1165
  "pre-commit-hooks",
1166
+ "secret-scanning-precommit",
840
1167
  "linting",
841
1168
  "code-formatter"
842
1169
  ],
843
- "notes": "Keep hooks fast and focused on changed files to avoid slowing down day-to-day work.",
1170
+ "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
1171
  "step": 1,
845
1172
  "title": "Establish Local Safety Nets First"
846
1173
  },
847
1174
  {
848
- "description": "Introduce CI quality gates that mirror local checks, but treat existing violations as warnings wherever possible.",
1175
+ "description": "Introduce CI quality gates that mirror local hooks exactly. Add CRLF detection early in pipeline. Treat existing violations as warnings where possible.",
849
1176
  "focusIds": [
1177
+ "crlf-detection",
850
1178
  "ci-quality-gates",
851
1179
  "linting",
852
1180
  "code-formatter",
853
1181
  "commit-linting"
854
1182
  ],
855
- "notes": "Use diff-based tools or baselines so only new violations break builds; legacy issues remain visible but non-blocking.",
1183
+ "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
1184
  "step": 2,
857
- "title": "Mirror Local Checks in CI (Soft-Fail on Legacy)"
1185
+ "title": "Mirror Local Checks in CI with CRLF Detection"
858
1186
  },
859
1187
  {
860
1188
  "description": "Enable type-checking, coverage thresholds, and dependency/vulnerability scanning with gradual enforcement.",
@@ -879,9 +1207,22 @@
879
1207
  "complexity-analysis",
880
1208
  "accessibility-auditing"
881
1209
  ],
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.",
1210
+ "notes": "Tackle recommended items in order of business value; backend-only repos can skip web-focused checks like accessibility.",
883
1211
  "step": 4,
884
1212
  "title": "Layer in Docs, Governance, and Recommended Checks"
1213
+ },
1214
+ {
1215
+ "description": "For repos using or building with generative AI, add drift detection, schema enforcement, golden contract tests, safety testing, and provenance tracking.",
1216
+ "focusIds": [
1217
+ "ai-drift-detection",
1218
+ "ai-schema-enforcement",
1219
+ "ai-golden-tests",
1220
+ "ai-safety-checks",
1221
+ "ai-provenance-tracking"
1222
+ ],
1223
+ "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?'",
1224
+ "step": 5,
1225
+ "title": "AI/ML Governance (If Applicable)"
885
1226
  }
886
1227
  ],
887
1228
  "qualityGatePolicy": {