@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.*\\.sh$' && exit 1 || exit 0",
24
+ "description": "Verify no CRLF in shell scripts",
25
+ "expectExitCode": 0
26
+ },
27
+ "notes": "Go files should use LF for consistency. Mark *.go as text. Shell scripts (*.sh) must use eol=lf. Binary artifacts 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 handling."
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": "Go source files tolerate CRLF but shell scripts and Makefiles do not. Check .sh, Makefile, and go.mod for CRLF.",
59
+ "verification": "Run CRLF detection on shell scripts and Makefiles."
60
+ }
61
+ },
4
62
  {
5
63
  "ciHints": {
6
64
  "azure-devops": {
@@ -173,6 +231,28 @@
173
231
  "verification": "Trigger the release pipeline and confirm all artifacts share the same version number and tag."
174
232
  }
175
233
  },
234
+ {
235
+ "ciHints": {
236
+ "azure-devops": {
237
+ "notes": "Set HUSKY=0 or equivalent in release pipeline to disable hooks.",
238
+ "stage": "release"
239
+ }
240
+ },
241
+ "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.",
242
+ "id": "release-hook-bypass",
243
+ "label": "Release Hook Bypass",
244
+ "stack": {
245
+ "exampleConfigFiles": [
246
+ ".goreleaser.yml",
247
+ ".github/workflows/release.yml"
248
+ ],
249
+ "exampleTools": [
250
+ "goreleaser"
251
+ ],
252
+ "notes": "Goreleaser handles releases without invoking local hooks. Ensure any git operations use --no-verify.",
253
+ "verification": "Check release workflow for hook bypass configuration."
254
+ }
255
+ },
176
256
  {
177
257
  "ciHints": {
178
258
  "azure-devops": {
@@ -286,10 +366,11 @@
286
366
  {
287
367
  "ciHints": {
288
368
  "azure-devops": {
369
+ "notes": "Hooks and CI must invoke identical verification commands. Use npm run verify or equivalent.",
289
370
  "stage": "quality"
290
371
  }
291
372
  },
292
- "description": "Use git hooks to run linting, formatting, tests, and commit linting before changes are committed.",
373
+ "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).",
293
374
  "id": "pre-commit-hooks",
294
375
  "label": "Pre-Commit Hooks",
295
376
  "stack": {
@@ -301,8 +382,54 @@
301
382
  "pre-commit",
302
383
  "lefthook"
303
384
  ],
304
- "notes": "Use pre-commit with go hooks for gofmt, goimports, and golangci-lint on staged files.",
305
- "verification": "Inspect hooks configuration and confirm that go fmt and golangci-lint run before commits."
385
+ "notes": "Use pre-commit or lefthook with go hooks for 'gofmt -d' (check mode) and golangci-lint. Pin Go version in go.mod and .go-version for determinism.",
386
+ "verification": "Confirm hooks run format checks (not auto-fix) and golangci-lint before commits."
387
+ }
388
+ },
389
+ {
390
+ "ciHints": {
391
+ "azure-devops": {
392
+ "notes": "CI should call the same verify script that hooks use locally.",
393
+ "stage": "quality"
394
+ }
395
+ },
396
+ "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.",
397
+ "id": "hook-ci-parity",
398
+ "label": "Hook/CI Parity",
399
+ "stack": {
400
+ "exampleConfigFiles": [
401
+ "Makefile",
402
+ "magefile.go"
403
+ ],
404
+ "exampleTools": [
405
+ "make",
406
+ "mage"
407
+ ],
408
+ "notes": "Define a verify target (make verify) that runs go vet, golangci-lint, and go test. Both hooks and CI should use this target.",
409
+ "verification": "Compare hook commands with CI commands and confirm they invoke the same make targets."
410
+ }
411
+ },
412
+ {
413
+ "ciHints": {
414
+ "azure-devops": {
415
+ "notes": "Also run secret scanning in CI as a safety net for commits that bypassed hooks.",
416
+ "stage": "quality"
417
+ }
418
+ },
419
+ "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.",
420
+ "id": "secret-scanning-precommit",
421
+ "label": "Pre-commit Secret Scanning",
422
+ "stack": {
423
+ "exampleConfigFiles": [
424
+ ".gitleaks.toml",
425
+ ".pre-commit-config.yaml"
426
+ ],
427
+ "exampleTools": [
428
+ "gitleaks",
429
+ "trufflehog"
430
+ ],
431
+ "notes": "Add gitleaks to pre-commit hooks. Scan staged changes only for speed.",
432
+ "verification": "Run 'gitleaks protect --staged' and verify it catches test secrets."
306
433
  }
307
434
  },
308
435
  {
@@ -525,6 +652,71 @@
525
652
  ],
526
653
  "verification": "LICENSE file is present; CODE_OF_CONDUCT.md and CONTRIBUTING.md provide contribution guidance."
527
654
  }
655
+ },
656
+ {
657
+ "ciHints": {
658
+ "azure-devops": {
659
+ "notes": "CI should call the canonical verify command, not duplicate check logic.",
660
+ "stage": "quality"
661
+ }
662
+ },
663
+ "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.",
664
+ "id": "canonical-verify",
665
+ "label": "Canonical Verify Entrypoint",
666
+ "stack": {
667
+ "exampleConfigFiles": [
668
+ "Makefile",
669
+ "magefile.go"
670
+ ],
671
+ "exampleTools": [
672
+ "make",
673
+ "mage"
674
+ ],
675
+ "notes": "Define 'make verify' that runs go vet, golangci-lint, and go test. All stages use this single entrypoint.",
676
+ "verification": "Makefile contains a 'verify' target."
677
+ }
678
+ },
679
+ {
680
+ "ciHints": {
681
+ "azure-devops": {
682
+ "notes": "Ensure CI reads from authoritative configs, not duplicated settings.",
683
+ "stage": "quality"
684
+ }
685
+ },
686
+ "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.",
687
+ "id": "config-authority",
688
+ "label": "Config File Authority Rules",
689
+ "stack": {
690
+ "exampleConfigFiles": [
691
+ ".gitattributes",
692
+ "go.mod",
693
+ ".golangci.yml"
694
+ ],
695
+ "exampleTools": [],
696
+ "notes": "Authority mapping: .gitattributes for EOL, go.mod for module config and Go version, .golangci.yml for all linting rules. Keep lint config consolidated in one file.",
697
+ "verification": "Review configs and confirm .golangci.yml is the single source for lint rules."
698
+ }
699
+ },
700
+ {
701
+ "ciHints": {
702
+ "azure-devops": {
703
+ "notes": "CI should read skip paths from config files, not hardcode them in pipeline.",
704
+ "stage": "quality"
705
+ }
706
+ },
707
+ "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.",
708
+ "id": "explicit-skip-paths",
709
+ "label": "Explicit Skip Paths",
710
+ "stack": {
711
+ "exampleConfigFiles": [
712
+ ".golangci.yml"
713
+ ],
714
+ "exampleTools": [
715
+ "golangci-lint"
716
+ ],
717
+ "notes": "Define skip-dirs and skip-files in .golangci.yml. Use //nolint comments sparingly and always include justification (//nolint:errcheck // reason).",
718
+ "verification": "Review .golangci.yml and confirm skip paths are explicit and documented."
719
+ }
528
720
  }
529
721
  ],
530
722
  "optionalEnhancements": [
@@ -721,6 +913,117 @@
721
913
  "verification": "For web-facing Go apps, run accessibility audits against key routes using axe or pa11y."
722
914
  }
723
915
  },
916
+ {
917
+ "ciHints": {
918
+ "azure-devops": {
919
+ "notes": "Run AI drift detection in a scheduled nightly pipeline separate from main CI.",
920
+ "stage": "nightly"
921
+ }
922
+ },
923
+ "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.",
924
+ "id": "ai-drift-detection",
925
+ "label": "AI Drift Detection",
926
+ "stack": {
927
+ "exampleConfigFiles": [
928
+ "testdata/golden/",
929
+ "ai-baselines/"
930
+ ],
931
+ "exampleTools": [
932
+ "go test",
933
+ "golden files"
934
+ ],
935
+ "notes": "Use golden file testing pattern for AI outputs. Compare current output against pinned baselines nightly.",
936
+ "verification": "Run golden tests and confirm AI outputs match baselines."
937
+ }
938
+ },
939
+ {
940
+ "ciHints": {
941
+ "azure-devops": {
942
+ "notes": "Run schema validation tests as part of quality gates.",
943
+ "stage": "quality"
944
+ }
945
+ },
946
+ "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.",
947
+ "id": "ai-schema-enforcement",
948
+ "label": "AI Output Schema Enforcement",
949
+ "stack": {
950
+ "exampleConfigFiles": [
951
+ "schemas/"
952
+ ],
953
+ "exampleTools": [
954
+ "go-playground/validator",
955
+ "gojsonschema"
956
+ ],
957
+ "notes": "Define struct tags for JSON unmarshaling and use validator for additional constraints. Reject AI outputs that don't match expected schema.",
958
+ "verification": "Review AI integration code and confirm schema validation is in place."
959
+ }
960
+ },
961
+ {
962
+ "ciHints": {
963
+ "azure-devops": {
964
+ "notes": "Run AI golden tests as part of the test stage.",
965
+ "stage": "test"
966
+ }
967
+ },
968
+ "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.",
969
+ "id": "ai-golden-tests",
970
+ "label": "AI Golden Contract Tests",
971
+ "stack": {
972
+ "exampleConfigFiles": [
973
+ "testdata/"
974
+ ],
975
+ "exampleTools": [
976
+ "go test",
977
+ "golden files"
978
+ ],
979
+ "notes": "Use golden file pattern for AI output testing. Verify generated code follows Go conventions and doesn't modify vendor/ or other protected paths.",
980
+ "verification": "Run golden tests and confirm AI outputs match expected files."
981
+ }
982
+ },
983
+ {
984
+ "ciHints": {
985
+ "azure-devops": {
986
+ "notes": "Run AI safety tests as part of security stage on main branch.",
987
+ "stage": "security"
988
+ }
989
+ },
990
+ "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.",
991
+ "id": "ai-safety-checks",
992
+ "label": "AI Adversarial & Safety Testing",
993
+ "stack": {
994
+ "exampleConfigFiles": [
995
+ "ai_safety_test.go"
996
+ ],
997
+ "exampleTools": [
998
+ "go test",
999
+ "go-fuzz"
1000
+ ],
1001
+ "notes": "Create adversarial test cases for AI integrations. Use fuzzing to discover input handling edge cases.",
1002
+ "verification": "Run AI safety tests and fuzz tests."
1003
+ }
1004
+ },
1005
+ {
1006
+ "ciHints": {
1007
+ "azure-devops": {
1008
+ "notes": "Verify AI provenance logging is implemented in quality checks.",
1009
+ "stage": "quality"
1010
+ }
1011
+ },
1012
+ "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.",
1013
+ "id": "ai-provenance-tracking",
1014
+ "label": "AI Provenance & Audit Logging",
1015
+ "stack": {
1016
+ "exampleConfigFiles": [
1017
+ "ai/provenance.go"
1018
+ ],
1019
+ "exampleTools": [
1020
+ "slog",
1021
+ "OpenTelemetry"
1022
+ ],
1023
+ "notes": "Use structured logging (slog) to capture AI provenance. Include model, prompt version, and parameters in log context.",
1024
+ "verification": "Review AI integration and confirm provenance logging is implemented."
1025
+ }
1026
+ },
724
1027
  {
725
1028
  "ciHints": {
726
1029
  "azure-devops": {
@@ -797,27 +1100,41 @@
797
1100
  },
798
1101
  "migrationGuide": [
799
1102
  {
800
- "description": "Start by adding pre-commit hooks and core formatting/linting so developers get fast feedback without touching CI.",
1103
+ "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.",
1104
+ "focusIds": [
1105
+ "gitattributes-eol",
1106
+ "canonical-verify",
1107
+ "hook-ci-parity",
1108
+ "config-authority"
1109
+ ],
1110
+ "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.",
1111
+ "step": 0,
1112
+ "title": "Foundation: Line Endings and Hook Entry Point"
1113
+ },
1114
+ {
1115
+ "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.",
801
1116
  "focusIds": [
802
1117
  "pre-commit-hooks",
1118
+ "secret-scanning-precommit",
803
1119
  "linting",
804
1120
  "code-formatter"
805
1121
  ],
806
- "notes": "Keep hooks fast and focused on changed files to avoid slowing down day-to-day work.",
1122
+ "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.",
807
1123
  "step": 1,
808
1124
  "title": "Establish Local Safety Nets First"
809
1125
  },
810
1126
  {
811
- "description": "Introduce CI quality gates that mirror local checks, but treat existing violations as warnings wherever possible.",
1127
+ "description": "Introduce CI quality gates that mirror local hooks exactly. Add CRLF detection early in pipeline. Treat existing violations as warnings where possible.",
812
1128
  "focusIds": [
1129
+ "crlf-detection",
813
1130
  "ci-quality-gates",
814
1131
  "linting",
815
1132
  "code-formatter",
816
1133
  "commit-linting"
817
1134
  ],
818
- "notes": "Use diff-based tools or baselines so only new violations break builds; legacy issues remain visible but non-blocking.",
1135
+ "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.",
819
1136
  "step": 2,
820
- "title": "Mirror Local Checks in CI (Soft-Fail on Legacy)"
1137
+ "title": "Mirror Local Checks in CI with CRLF Detection"
821
1138
  },
822
1139
  {
823
1140
  "description": "Enable type-checking, coverage thresholds, and dependency/vulnerability scanning with gradual enforcement.",
@@ -842,9 +1159,22 @@
842
1159
  "complexity-analysis",
843
1160
  "accessibility-auditing"
844
1161
  ],
845
- "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.",
1162
+ "notes": "Tackle recommended items in order of business value; backend-only repos can skip web-focused checks like accessibility.",
846
1163
  "step": 4,
847
1164
  "title": "Layer in Docs, Governance, and Recommended Checks"
1165
+ },
1166
+ {
1167
+ "description": "For repos using or building with generative AI, add drift detection, schema enforcement, golden contract tests, safety testing, and provenance tracking.",
1168
+ "focusIds": [
1169
+ "ai-drift-detection",
1170
+ "ai-schema-enforcement",
1171
+ "ai-golden-tests",
1172
+ "ai-safety-checks",
1173
+ "ai-provenance-tracking"
1174
+ ],
1175
+ "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?'",
1176
+ "step": 5,
1177
+ "title": "AI/ML Governance (If Applicable)"
848
1178
  }
849
1179
  ],
850
1180
  "qualityGatePolicy": {