@oddessentials/repo-standards 4.3.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.*\\.sh$' && exit 1 || exit 0",
24
+ "description": "Verify no CRLF in shell scripts",
25
+ "expectExitCode": 0
26
+ },
27
+ "notes": "Mark *.rs, *.toml as text with auto EOL handling. Mark shell scripts as eol=lf. Binary files (*.exe, *.dll) should be marked as binary.",
28
+ "optionalFiles": [
29
+ ".editorconfig"
30
+ ],
31
+ "requiredFiles": [
32
+ ".gitattributes"
33
+ ],
34
+ "verification": "Run 'git ls-files --eol' to verify EOL consistency."
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.*\\.(sh|bash)$' && exit 1 || exit 0",
55
+ "description": "Detect CRLF in shell scripts",
56
+ "expectExitCode": 0
57
+ },
58
+ "notes": "Rust build scripts (build.rs) and shell scripts must not have CRLF. Cargo tolerates CRLF in .rs files but shell invocations fail.",
59
+ "verification": "Run CRLF detection on shell and build scripts."
60
+ }
61
+ },
4
62
  {
5
63
  "ciHints": {
6
64
  "azure-devops": {
@@ -177,6 +235,27 @@
177
235
  "verification": "Trigger the release pipeline and confirm all artifacts share the same version number and tag."
178
236
  }
179
237
  },
238
+ {
239
+ "ciHints": {
240
+ "azure-devops": {
241
+ "notes": "Set HUSKY=0 or equivalent in release pipeline to disable hooks.",
242
+ "stage": "release"
243
+ }
244
+ },
245
+ "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.",
246
+ "id": "release-hook-bypass",
247
+ "label": "Release Hook Bypass",
248
+ "stack": {
249
+ "exampleConfigFiles": [
250
+ ".github/workflows/release.yml"
251
+ ],
252
+ "exampleTools": [
253
+ "cargo-release"
254
+ ],
255
+ "notes": "Use --no-verify with git commands in release scripts. If using pre-commit, set SKIP=all.",
256
+ "verification": "Check release workflow for hook bypass."
257
+ }
258
+ },
180
259
  {
181
260
  "ciHints": {
182
261
  "azure-devops": {
@@ -293,10 +372,11 @@
293
372
  {
294
373
  "ciHints": {
295
374
  "azure-devops": {
375
+ "notes": "Hooks and CI must invoke identical verification commands. Use npm run verify or equivalent.",
296
376
  "stage": "quality"
297
377
  }
298
378
  },
299
- "description": "Use git hooks to run linting, formatting, tests, and commit linting before changes are committed.",
379
+ "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).",
300
380
  "id": "pre-commit-hooks",
301
381
  "label": "Pre-Commit Hooks",
302
382
  "stack": {
@@ -307,8 +387,53 @@
307
387
  "pre-commit",
308
388
  "cargo-husky"
309
389
  ],
310
- "notes": "Use pre-commit with rust hooks for cargo fmt and cargo clippy on staged files. cargo-husky is an alternative.",
311
- "verification": "Inspect .pre-commit-config.yaml and confirm that hooks run cargo fmt --check and cargo clippy before commits."
390
+ "notes": "Use pre-commit with rust hooks for 'cargo fmt --check' and 'cargo clippy' on staged files. Pin rust-toolchain.toml for determinism across environments.",
391
+ "verification": "Confirm hooks run cargo fmt --check (not cargo fmt) and cargo clippy before commits."
392
+ }
393
+ },
394
+ {
395
+ "ciHints": {
396
+ "azure-devops": {
397
+ "notes": "CI should call the same verify script that hooks use locally.",
398
+ "stage": "quality"
399
+ }
400
+ },
401
+ "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.",
402
+ "id": "hook-ci-parity",
403
+ "label": "Hook/CI Parity",
404
+ "stack": {
405
+ "exampleConfigFiles": [
406
+ "Makefile",
407
+ "Cargo.toml"
408
+ ],
409
+ "exampleTools": [
410
+ "cargo",
411
+ "make"
412
+ ],
413
+ "notes": "Define a verify target (make verify or cargo make verify) that runs fmt --check, clippy, and test. Both hooks and CI should use this target.",
414
+ "verification": "Compare hook commands with CI commands and confirm they invoke the same cargo commands."
415
+ }
416
+ },
417
+ {
418
+ "ciHints": {
419
+ "azure-devops": {
420
+ "notes": "Also run secret scanning in CI as a safety net for commits that bypassed hooks.",
421
+ "stage": "quality"
422
+ }
423
+ },
424
+ "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.",
425
+ "id": "secret-scanning-precommit",
426
+ "label": "Pre-commit Secret Scanning",
427
+ "stack": {
428
+ "exampleConfigFiles": [
429
+ ".gitleaks.toml",
430
+ ".pre-commit-config.yaml"
431
+ ],
432
+ "exampleTools": [
433
+ "gitleaks"
434
+ ],
435
+ "notes": "Add gitleaks to pre-commit hooks. Configure Rust-specific patterns if needed.",
436
+ "verification": "Run 'gitleaks protect --staged' and verify it catches test secrets."
312
437
  }
313
438
  },
314
439
  {
@@ -532,6 +657,75 @@
532
657
  ],
533
658
  "verification": "LICENSE file is present; CODE_OF_CONDUCT.md and CONTRIBUTING.md provide contribution guidance."
534
659
  }
660
+ },
661
+ {
662
+ "ciHints": {
663
+ "azure-devops": {
664
+ "notes": "CI should call the canonical verify command, not duplicate check logic.",
665
+ "stage": "quality"
666
+ }
667
+ },
668
+ "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.",
669
+ "id": "canonical-verify",
670
+ "label": "Canonical Verify Entrypoint",
671
+ "stack": {
672
+ "exampleConfigFiles": [
673
+ "Makefile",
674
+ "Makefile.toml"
675
+ ],
676
+ "exampleTools": [
677
+ "cargo",
678
+ "make",
679
+ "cargo-make"
680
+ ],
681
+ "notes": "Define 'make verify' or 'cargo make verify' that runs fmt --check, clippy, and test. Both hooks and CI use this entrypoint.",
682
+ "verification": "Makefile or Makefile.toml contains a 'verify' task."
683
+ }
684
+ },
685
+ {
686
+ "ciHints": {
687
+ "azure-devops": {
688
+ "notes": "Ensure CI reads from authoritative configs, not duplicated settings.",
689
+ "stage": "quality"
690
+ }
691
+ },
692
+ "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.",
693
+ "id": "config-authority",
694
+ "label": "Config File Authority Rules",
695
+ "stack": {
696
+ "exampleConfigFiles": [
697
+ ".gitattributes",
698
+ "Cargo.toml",
699
+ "rustfmt.toml",
700
+ "clippy.toml"
701
+ ],
702
+ "exampleTools": [],
703
+ "notes": "Authority mapping: .gitattributes for EOL, Cargo.toml for project config, rustfmt.toml for formatting, clippy.toml for linting. Each concern has one file.",
704
+ "verification": "Review configs and confirm no rules are duplicated across files."
705
+ }
706
+ },
707
+ {
708
+ "ciHints": {
709
+ "azure-devops": {
710
+ "notes": "CI should read skip paths from config files, not hardcode them in pipeline.",
711
+ "stage": "quality"
712
+ }
713
+ },
714
+ "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.",
715
+ "id": "explicit-skip-paths",
716
+ "label": "Explicit Skip Paths",
717
+ "stack": {
718
+ "exampleConfigFiles": [
719
+ "rustfmt.toml",
720
+ ".clippy.toml"
721
+ ],
722
+ "exampleTools": [
723
+ "rustfmt",
724
+ "clippy"
725
+ ],
726
+ "notes": "Use #[rustfmt::skip] or #[allow(clippy::*)] sparingly and document why. For directory-level exclusions, use Cargo.toml workspace exclude.",
727
+ "verification": "Search for skip annotations and confirm each is documented."
728
+ }
535
729
  }
536
730
  ],
537
731
  "optionalEnhancements": [
@@ -553,6 +747,48 @@
553
747
  "notes": "Use the tracing crate for structured logging with spans and events. Configure tracing-subscriber for output formatting.",
554
748
  "verification": "Confirm that tracing or log crate is configured with appropriate subscriber/logger and emits structured output."
555
749
  }
750
+ },
751
+ {
752
+ "ciHints": {
753
+ "azure-devops": {
754
+ "stage": "governance"
755
+ }
756
+ },
757
+ "description": "Define phase transition requirements in phase-gates.md for autonomous agent workflows with clear pre-conditions and approval gates.",
758
+ "id": "agent-phase-gates",
759
+ "label": "Agent Phase Gates",
760
+ "stack": {
761
+ "exampleConfigFiles": [
762
+ "phase-gates.md"
763
+ ],
764
+ "exampleTools": [],
765
+ "notes": "Document phase gates with Rust-specific verification (cargo test, cargo check, crates.io publishing) and sign-off requirements.",
766
+ "optionalFiles": [
767
+ "phase-gates.md"
768
+ ],
769
+ "verification": "phase-gates.md exists defining transition requirements."
770
+ }
771
+ },
772
+ {
773
+ "ciHints": {
774
+ "azure-devops": {
775
+ "stage": "governance"
776
+ }
777
+ },
778
+ "description": "Document milestone completion criteria in victory-gates.md defining 'done' for releases and major deliverables with evidence requirements.",
779
+ "id": "agent-victory-gates",
780
+ "label": "Agent Victory Gates",
781
+ "stack": {
782
+ "exampleConfigFiles": [
783
+ "victory-gates.md"
784
+ ],
785
+ "exampleTools": [],
786
+ "notes": "Define done criteria including Rust-specific conditions (crates.io publication, documentation hosting, security audits) with evidence requirements.",
787
+ "optionalFiles": [
788
+ "victory-gates.md"
789
+ ],
790
+ "verification": "victory-gates.md exists with milestone criteria."
791
+ }
556
792
  }
557
793
  ],
558
794
  "recommended": [
@@ -688,6 +924,139 @@
688
924
  "notes": "For Rust web frameworks (Actix, Axum, Rocket), use headless browser-based accessibility tools to audit rendered HTML.",
689
925
  "verification": "For web-facing Rust apps, run accessibility audits against key routes using axe or pa11y."
690
926
  }
927
+ },
928
+ {
929
+ "ciHints": {
930
+ "azure-devops": {
931
+ "notes": "Run AI drift detection in a scheduled nightly pipeline separate from main CI.",
932
+ "stage": "nightly"
933
+ }
934
+ },
935
+ "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.",
936
+ "id": "ai-drift-detection",
937
+ "label": "AI Drift Detection",
938
+ "stack": {
939
+ "exampleConfigFiles": [
940
+ "snapshots/",
941
+ "ai-baselines/"
942
+ ],
943
+ "exampleTools": [
944
+ "insta",
945
+ "custom baseline tests"
946
+ ],
947
+ "notes": "Use insta for snapshot testing of AI outputs. Pin model versions and prompt templates. Run nightly to detect drift.",
948
+ "verification": "Run 'cargo insta test' and confirm AI outputs match baselines."
949
+ }
950
+ },
951
+ {
952
+ "ciHints": {
953
+ "azure-devops": {
954
+ "notes": "Run schema validation tests as part of quality gates.",
955
+ "stage": "quality"
956
+ }
957
+ },
958
+ "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.",
959
+ "id": "ai-schema-enforcement",
960
+ "label": "AI Output Schema Enforcement",
961
+ "stack": {
962
+ "exampleConfigFiles": [
963
+ "src/schemas/"
964
+ ],
965
+ "exampleTools": [
966
+ "serde",
967
+ "jsonschema",
968
+ "validator"
969
+ ],
970
+ "notes": "Use serde with #[serde(deny_unknown_fields)] for strict deserialization of AI outputs. Add validator derives for business rule validation.",
971
+ "verification": "Review AI integration code and confirm strict deserialization is enforced."
972
+ }
973
+ },
974
+ {
975
+ "ciHints": {
976
+ "azure-devops": {
977
+ "notes": "Run AI golden tests as part of the test stage.",
978
+ "stage": "test"
979
+ }
980
+ },
981
+ "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.",
982
+ "id": "ai-golden-tests",
983
+ "label": "AI Golden Contract Tests",
984
+ "stack": {
985
+ "exampleConfigFiles": [
986
+ "snapshots/"
987
+ ],
988
+ "exampleTools": [
989
+ "insta"
990
+ ],
991
+ "notes": "Use insta for snapshot testing AI-generated code and configs. Test format compliance and forbidden path restrictions.",
992
+ "verification": "Run 'cargo insta test' and confirm AI outputs match snapshots."
993
+ }
994
+ },
995
+ {
996
+ "ciHints": {
997
+ "azure-devops": {
998
+ "notes": "Run AI safety tests as part of security stage on main branch.",
999
+ "stage": "security"
1000
+ }
1001
+ },
1002
+ "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.",
1003
+ "id": "ai-safety-checks",
1004
+ "label": "AI Adversarial & Safety Testing",
1005
+ "stack": {
1006
+ "exampleConfigFiles": [
1007
+ "tests/ai_safety/"
1008
+ ],
1009
+ "exampleTools": [
1010
+ "proptest",
1011
+ "custom tests"
1012
+ ],
1013
+ "notes": "Use proptest for property-based testing of AI input validation. Test that malicious inputs don't escape sandboxing.",
1014
+ "verification": "Run AI safety tests with adversarial inputs."
1015
+ }
1016
+ },
1017
+ {
1018
+ "ciHints": {
1019
+ "azure-devops": {
1020
+ "notes": "Verify AI provenance logging is implemented in quality checks.",
1021
+ "stage": "quality"
1022
+ }
1023
+ },
1024
+ "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.",
1025
+ "id": "ai-provenance-tracking",
1026
+ "label": "AI Provenance & Audit Logging",
1027
+ "stack": {
1028
+ "exampleConfigFiles": [
1029
+ "src/ai/provenance.rs"
1030
+ ],
1031
+ "exampleTools": [
1032
+ "tracing",
1033
+ "OpenTelemetry"
1034
+ ],
1035
+ "notes": "Use tracing spans to capture AI call provenance. Include model version, prompt hash, and parameters as span attributes.",
1036
+ "verification": "Review AI integration and confirm provenance is logged."
1037
+ }
1038
+ },
1039
+ {
1040
+ "ciHints": {
1041
+ "azure-devops": {
1042
+ "notes": "Run invariant verification commands in a dedicated quality stage.",
1043
+ "stage": "quality"
1044
+ }
1045
+ },
1046
+ "description": "Maintain INVARIANTS.md defining repository-wide rules that must always hold true, with machine-readable verification commands for autonomous agents.",
1047
+ "id": "agent-invariants",
1048
+ "label": "Autonomous Agent Invariants",
1049
+ "stack": {
1050
+ "exampleConfigFiles": [
1051
+ "INVARIANTS.md"
1052
+ ],
1053
+ "exampleTools": [],
1054
+ "notes": "Document invariants with verification commands like 'cargo test', 'cargo clippy', 'cargo fmt --check' for deterministic validation.",
1055
+ "requiredFiles": [
1056
+ "INVARIANTS.md"
1057
+ ],
1058
+ "verification": "INVARIANTS.md exists with machine-readable verification commands."
1059
+ }
691
1060
  }
692
1061
  ]
693
1062
  },
@@ -743,27 +1112,41 @@
743
1112
  },
744
1113
  "migrationGuide": [
745
1114
  {
746
- "description": "Start by adding pre-commit hooks and core formatting/linting so developers get fast feedback without touching CI.",
1115
+ "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.",
1116
+ "focusIds": [
1117
+ "gitattributes-eol",
1118
+ "canonical-verify",
1119
+ "hook-ci-parity",
1120
+ "config-authority"
1121
+ ],
1122
+ "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.",
1123
+ "step": 0,
1124
+ "title": "Foundation: Line Endings and Hook Entry Point"
1125
+ },
1126
+ {
1127
+ "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.",
747
1128
  "focusIds": [
748
1129
  "pre-commit-hooks",
1130
+ "secret-scanning-precommit",
749
1131
  "linting",
750
1132
  "code-formatter"
751
1133
  ],
752
- "notes": "Keep hooks fast and focused on changed files to avoid slowing down day-to-day work.",
1134
+ "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.",
753
1135
  "step": 1,
754
1136
  "title": "Establish Local Safety Nets First"
755
1137
  },
756
1138
  {
757
- "description": "Introduce CI quality gates that mirror local checks, but treat existing violations as warnings wherever possible.",
1139
+ "description": "Introduce CI quality gates that mirror local hooks exactly. Add CRLF detection early in pipeline. Treat existing violations as warnings where possible.",
758
1140
  "focusIds": [
1141
+ "crlf-detection",
759
1142
  "ci-quality-gates",
760
1143
  "linting",
761
1144
  "code-formatter",
762
1145
  "commit-linting"
763
1146
  ],
764
- "notes": "Use diff-based tools or baselines so only new violations break builds; legacy issues remain visible but non-blocking.",
1147
+ "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.",
765
1148
  "step": 2,
766
- "title": "Mirror Local Checks in CI (Soft-Fail on Legacy)"
1149
+ "title": "Mirror Local Checks in CI with CRLF Detection"
767
1150
  },
768
1151
  {
769
1152
  "description": "Enable type-checking, coverage thresholds, and dependency/vulnerability scanning with gradual enforcement.",
@@ -788,9 +1171,22 @@
788
1171
  "complexity-analysis",
789
1172
  "accessibility-auditing"
790
1173
  ],
791
- "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.",
1174
+ "notes": "Tackle recommended items in order of business value; backend-only repos can skip web-focused checks like accessibility.",
792
1175
  "step": 4,
793
1176
  "title": "Layer in Docs, Governance, and Recommended Checks"
1177
+ },
1178
+ {
1179
+ "description": "For repos using or building with generative AI, add drift detection, schema enforcement, golden contract tests, safety testing, and provenance tracking.",
1180
+ "focusIds": [
1181
+ "ai-drift-detection",
1182
+ "ai-schema-enforcement",
1183
+ "ai-golden-tests",
1184
+ "ai-safety-checks",
1185
+ "ai-provenance-tracking"
1186
+ ],
1187
+ "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?'",
1188
+ "step": 5,
1189
+ "title": "AI/ML Governance (If Applicable)"
794
1190
  }
795
1191
  ],
796
1192
  "qualityGatePolicy": {