eslint-plugin-traceability 1.1.0 → 1.1.2

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 (152) hide show
  1. package/lib/src/index.d.ts +80 -0
  2. package/lib/src/index.js +58 -0
  3. package/lib/src/maintenance/batch.d.ts +16 -0
  4. package/lib/src/maintenance/batch.js +28 -0
  5. package/lib/src/maintenance/detect.d.ts +6 -0
  6. package/lib/src/maintenance/detect.js +69 -0
  7. package/lib/src/maintenance/index.js +22 -0
  8. package/lib/src/maintenance/report.d.ts +7 -0
  9. package/lib/src/maintenance/report.js +17 -0
  10. package/lib/src/maintenance/update.d.ts +6 -0
  11. package/lib/src/maintenance/update.js +67 -0
  12. package/lib/src/maintenance/utils.d.ts +6 -0
  13. package/lib/src/maintenance/utils.js +64 -0
  14. package/lib/src/rules/require-branch-annotation.d.ts +7 -0
  15. package/lib/src/rules/require-branch-annotation.js +111 -0
  16. package/lib/src/rules/require-req-annotation.d.ts +7 -0
  17. package/lib/src/rules/require-req-annotation.js +38 -0
  18. package/lib/src/rules/require-story-annotation.d.ts +7 -0
  19. package/lib/src/rules/require-story-annotation.js +50 -0
  20. package/lib/src/rules/valid-annotation-format.d.ts +10 -0
  21. package/lib/src/rules/valid-annotation-format.js +60 -0
  22. package/lib/src/rules/valid-req-reference.d.ts +3 -0
  23. package/lib/src/rules/valid-req-reference.js +104 -0
  24. package/lib/src/rules/valid-story-reference.d.ts +3 -0
  25. package/lib/src/rules/valid-story-reference.js +168 -0
  26. package/lib/tests/fixtures/stale/example.d.ts +0 -0
  27. package/{tests/fixtures/stale/example.ts → lib/tests/fixtures/stale/example.js} +1 -0
  28. package/lib/tests/fixtures/update/example.d.ts +0 -0
  29. package/{tests/fixtures/update/example.ts → lib/tests/fixtures/update/example.js} +1 -0
  30. package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
  31. package/{tests/fixtures/valid-annotations/example.ts → lib/tests/fixtures/valid-annotations/example.js} +1 -0
  32. package/lib/tests/maintenance/batch.test.d.ts +1 -0
  33. package/lib/tests/maintenance/batch.test.js +79 -0
  34. package/lib/tests/maintenance/detect-isolated.test.d.ts +1 -0
  35. package/lib/tests/maintenance/detect-isolated.test.js +95 -0
  36. package/lib/tests/maintenance/detect.test.d.ts +1 -0
  37. package/lib/tests/maintenance/detect.test.js +23 -0
  38. package/lib/tests/maintenance/report.test.d.ts +1 -0
  39. package/lib/tests/maintenance/report.test.js +67 -0
  40. package/lib/tests/maintenance/update-isolated.test.d.ts +1 -0
  41. package/lib/tests/maintenance/update-isolated.test.js +66 -0
  42. package/lib/tests/maintenance/update.test.d.ts +1 -0
  43. package/lib/tests/maintenance/update.test.js +26 -0
  44. package/lib/tests/plugin-default-export-and-configs.test.d.ts +1 -0
  45. package/lib/tests/plugin-default-export-and-configs.test.js +72 -0
  46. package/lib/tests/plugin-setup.test.d.ts +1 -0
  47. package/lib/tests/plugin-setup.test.js +51 -0
  48. package/lib/tests/rules/require-branch-annotation.test.d.ts +1 -0
  49. package/lib/tests/rules/require-branch-annotation.test.js +253 -0
  50. package/lib/tests/rules/require-req-annotation.test.d.ts +1 -0
  51. package/lib/tests/rules/require-req-annotation.test.js +41 -0
  52. package/lib/tests/rules/require-story-annotation.test.d.ts +1 -0
  53. package/lib/tests/rules/require-story-annotation.test.js +36 -0
  54. package/lib/tests/rules/valid-annotation-format.test.d.ts +1 -0
  55. package/lib/tests/rules/valid-annotation-format.test.js +58 -0
  56. package/lib/tests/rules/valid-req-reference.test.d.ts +1 -0
  57. package/lib/tests/rules/valid-req-reference.test.js +87 -0
  58. package/lib/tests/rules/valid-story-reference.test.d.ts +1 -0
  59. package/lib/tests/rules/valid-story-reference.test.js +69 -0
  60. package/package.json +6 -1
  61. package/.env.example +0 -6
  62. package/.github/workflows/ci-cd.yml +0 -107
  63. package/.husky/pre-commit +0 -1
  64. package/.husky/pre-push +0 -1
  65. package/.prettierignore +0 -27
  66. package/.prettierrc +0 -4
  67. package/.releaserc.json +0 -15
  68. package/.voder/history.md +0 -162
  69. package/.voder/implementation-progress.md +0 -144
  70. package/.voder/last-action.md +0 -83
  71. package/.voder/plan.md +0 -12
  72. package/.voder/progress-chart.png +0 -0
  73. package/.voder/progress-log-areas.csv +0 -39
  74. package/.voder/progress-log.csv +0 -38
  75. package/.voder/traceability/docs-stories-001.0-DEV-PLUGIN-SETUP.story.xml +0 -17
  76. package/.voder/traceability/docs-stories-002.0-DEV-ESLINT-CONFIG.story.xml +0 -13
  77. package/.voder/traceability/docs-stories-003.0-DEV-FUNCTION-ANNOTATIONS.story.xml +0 -9
  78. package/.voder/traceability/docs-stories-004.0-DEV-BRANCH-ANNOTATIONS.story.xml +0 -9
  79. package/.voder/traceability/docs-stories-005.0-DEV-ANNOTATION-VALIDATION.story.xml +0 -9
  80. package/.voder/traceability/docs-stories-006.0-DEV-FILE-VALIDATION.story.xml +0 -9
  81. package/.voder/traceability/docs-stories-007.0-DEV-ERROR-REPORTING.story.xml +0 -9
  82. package/.voder/traceability/docs-stories-008.0-DEV-AUTO-FIX.story.xml +0 -9
  83. package/.voder/traceability/docs-stories-009.0-DEV-MAINTENANCE-TOOLS.story.xml +0 -16
  84. package/.voder/traceability/docs-stories-010.0-DEV-DEEP-VALIDATION.story.xml +0 -11
  85. package/CHANGELOG.md +0 -57
  86. package/CONTRIBUTING.md +0 -99
  87. package/cli-integration.js +0 -103
  88. package/docs/cli-integration.md +0 -105
  89. package/docs/config-presets.md +0 -38
  90. package/docs/conventional-commits-guide.md +0 -185
  91. package/docs/decisions/001-typescript-for-eslint-plugin.accepted.md +0 -111
  92. package/docs/decisions/002-jest-for-eslint-testing.accepted.md +0 -137
  93. package/docs/decisions/003-code-quality-ratcheting-plan.md +0 -48
  94. package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +0 -196
  95. package/docs/decisions/005-github-actions-validation-tooling.accepted.md +0 -144
  96. package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +0 -227
  97. package/docs/eslint-9-setup-guide.md +0 -517
  98. package/docs/eslint-plugin-development-guide.md +0 -483
  99. package/docs/jest-testing-guide.md +0 -100
  100. package/docs/rules/require-branch-annotation.md +0 -34
  101. package/docs/rules/require-req-annotation.md +0 -39
  102. package/docs/rules/require-story-annotation.md +0 -36
  103. package/docs/rules/valid-annotation-format.md +0 -52
  104. package/docs/rules/valid-req-reference.md +0 -58
  105. package/docs/rules/valid-story-reference.md +0 -47
  106. package/docs/security-incidents/unresolved-vulnerabilities.md +0 -11
  107. package/docs/stories/001.0-DEV-PLUGIN-SETUP.story.md +0 -82
  108. package/docs/stories/002.0-DEV-ESLINT-CONFIG.story.md +0 -82
  109. package/docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md +0 -85
  110. package/docs/stories/004.0-DEV-BRANCH-ANNOTATIONS.story.md +0 -107
  111. package/docs/stories/005.0-DEV-ANNOTATION-VALIDATION.story.md +0 -119
  112. package/docs/stories/006.0-DEV-FILE-VALIDATION.story.md +0 -127
  113. package/docs/stories/007.0-DEV-ERROR-REPORTING.story.md +0 -89
  114. package/docs/stories/008.0-DEV-AUTO-FIX.story.md +0 -104
  115. package/docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md +0 -104
  116. package/docs/stories/010.0-DEV-DEEP-VALIDATION.story.md +0 -110
  117. package/docs/stories/developer-story.map.md +0 -118
  118. package/eslint.config.js +0 -146
  119. package/jest.config.js +0 -21
  120. package/scripts/smoke-test.sh +0 -45
  121. package/src/index.ts +0 -56
  122. package/src/maintenance/batch.ts +0 -29
  123. package/src/maintenance/detect.ts +0 -42
  124. package/src/maintenance/report.ts +0 -15
  125. package/src/maintenance/update.ts +0 -40
  126. package/src/maintenance/utils.ts +0 -28
  127. package/src/rules/require-branch-annotation.ts +0 -114
  128. package/src/rules/require-req-annotation.ts +0 -36
  129. package/src/rules/require-story-annotation.ts +0 -52
  130. package/src/rules/valid-annotation-format.ts +0 -62
  131. package/src/rules/valid-req-reference.ts +0 -114
  132. package/src/rules/valid-story-reference.ts +0 -213
  133. package/tests/fixtures/story_bullet.md +0 -6
  134. package/tests/maintenance/batch.test.ts +0 -55
  135. package/tests/maintenance/detect-isolated.test.ts +0 -65
  136. package/tests/maintenance/detect.test.ts +0 -19
  137. package/tests/maintenance/report.test.ts +0 -37
  138. package/tests/maintenance/update-isolated.test.ts +0 -39
  139. package/tests/maintenance/update.test.ts +0 -21
  140. package/tests/plugin-default-export-and-configs.test.ts +0 -50
  141. package/tests/plugin-setup.test.ts +0 -17
  142. package/tests/rules/require-branch-annotation.test.ts +0 -250
  143. package/tests/rules/require-req-annotation.test.ts +0 -38
  144. package/tests/rules/require-story-annotation.test.ts +0 -33
  145. package/tests/rules/valid-annotation-format.test.ts +0 -55
  146. package/tests/rules/valid-req-reference.test.ts +0 -85
  147. package/tests/rules/valid-story-reference.test.ts +0 -66
  148. package/tsconfig.json +0 -15
  149. package/user-docs/api-reference.md +0 -135
  150. package/user-docs/examples.md +0 -73
  151. package/user-docs/migration-guide.md +0 -71
  152. /package/{src/maintenance/index.ts → lib/src/maintenance/index.d.ts} +0 -0
@@ -1,48 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-16
4
- decision-makers: [Development Team]
5
- consulted: [Implementation Plan, ESLint Documentation]
6
- informed: [All Contributors]
7
- ---
8
-
9
- # 003-Code Quality Ratcheting Plan
10
-
11
- ## Context and Decision Drivers
12
-
13
- The project currently enforces maintainability through ESLint `max-lines-per-function` and `max-lines` rules with thresholds set to 200 lines/function and 1000 lines/file. These loose thresholds present technical debt and allow overly large functions and files, which can hinder readability, maintainability, and increase complexity over time.
14
-
15
- ## Considered Options
16
-
17
- 1. Adopt strict industry-standard thresholds immediately (e.g., 100 lines/function, 500 lines/file).
18
- 2. Maintain the current loose thresholds indefinitely.
19
- 3. Implement an incremental ratcheting plan to gradually reduce thresholds over multiple sprints.
20
-
21
- ## Decision Outcome
22
-
23
- We will implement option 3: an incremental ratcheting plan to gradually reduce the ESLint thresholds:
24
-
25
- - **Sprint 0 (Now)**: Reduce `max-lines-per-function` to 150 and `max-lines` to 800.
26
- - **Sprint 2 (Completed 2025-11-16)**: Reduce `max-lines-per-function` to 120 and `max-lines` to 600.
27
- - **Sprint 4**: Reduce `max-lines-per-function` to 100 and `max-lines` to 500.
28
-
29
- Automation:
30
-
31
- - Update the ESLint configuration to enforce the new thresholds immediately.
32
- - Configure the CI pipeline to fail on any new violations of these rules.
33
- - Document the ratcheting schedule in this ADR and revisit the plan at each milestone.
34
-
35
- ## Consequences
36
-
37
- - Ensures maintainability improves in manageable increments, reducing developer overhead per sprint.
38
- - Provides clear visibility into the schedule and expectations for code size reductions.
39
- - Allows refactoring efforts to be planned and executed incrementally, avoiding large-scale rewrites.
40
- - Guarantees continuous improvement by automating enforcement in CI.
41
-
42
- ## Future Review
43
-
44
- At the end of each milestone sprint, the team will:
45
-
46
- - Review existing violations.
47
- - Refactor code to comply with the new thresholds.
48
- - Update this ADR if any adjustments to the schedule are required.
@@ -1,196 +0,0 @@
1
- ---
2
- status: "superseded"
3
- date: 2025-11-17
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- npm Documentation,
8
- GitHub Actions Best Practices,
9
- Semantic Versioning Specification,
10
- ]
11
- informed: [Project Stakeholders, CI/CD Pipeline Maintainers]
12
- superseded-by: "006-semantic-release-for-automated-publishing"
13
- superseded-date: "2025-11-17"
14
- ---
15
-
16
- # Automated Version Bumping for CI/CD Publishing
17
-
18
- ## Context and Problem Statement
19
-
20
- The current CI/CD pipeline attempts to publish the package to npm on every push to the main branch, but lacks any mechanism to automatically increment the package version. This causes publish failures when the same version number already exists on npm, as npm does not allow republishing the same version. The pipeline fails with errors like "You cannot publish over the previously published versions" or similar npm publish conflicts.
21
-
22
- Currently, version bumping requires manual intervention through direct package.json edits, which is error-prone, interrupts the automated delivery flow, and creates a disconnect between the continuous integration process and package publishing. This breaks the principle of continuous delivery and creates friction in the development workflow.
23
-
24
- ## Decision Drivers
25
-
26
- - Need for reliable automated publishing without manual intervention
27
- - Prevention of npm publish failures due to version conflicts
28
- - Alignment with semantic versioning principles for clear change communication
29
- - Integration with existing CI/CD pipeline and GitHub workflow
30
- - Maintainability of version history and changelog automation
31
- - Support for different types of releases (patch, minor, major)
32
- - Traceability of version changes to specific commits or pull requests
33
- - Minimal friction for developers while maintaining version discipline
34
-
35
- ## Considered Options
36
-
37
- - npm version command with automated execution in CI/CD
38
- - Semantic Release with automated version detection
39
- - Manual version bumping with CI/CD workflow triggers
40
- - Version bumping through GitHub Actions with npm version
41
-
42
- ## Decision Outcome
43
-
44
- Chosen option: "Version Increment Without Git Commits", because it eliminates CI/CD loop complexity, requires no git write permissions, solves the immediate npm publish failures, and provides the simplest implementation while maintaining full automation.
45
-
46
- ### Implementation Strategy
47
-
48
- The CI/CD pipeline will use in-memory version increments without git write-back:
49
-
50
- 1. **Pre-publish Version Check**: Before attempting to publish, check if the current package.json version already exists on npm using `npm view eslint-plugin-traceability@<version>`
51
- 2. **In-Memory Version Increment**: If the version exists on npm, increment the patch version in the pipeline workspace using `npm version patch --no-git-tag-version`
52
- 3. **Immediate Publish**: Proceed with npm publish using the incremented version without any git operations
53
- 4. **Pipeline Logging**: Log the version increment action for visibility and debugging
54
- 5. **No Git Write-Back**: The incremented version exists only in the pipeline workspace and is never committed back to the repository
55
-
56
- ### Primary Approach Considered
57
-
58
- **Git Write-Back with Version Commits**: Increment version in pipeline, publish to npm, then commit version changes and create git tags with `[skip ci]` to prevent recursion. This approach was rejected due to complexity concerns including git write permissions, infinite loop prevention, post-publish failure handling, and potential race conditions in concurrent pipeline runs.
59
-
60
- ### Consequences
61
-
62
- - Good, because prevents all npm publish failures due to version conflicts
63
- - Good, because maintains fully automated delivery without any manual intervention
64
- - Good, because eliminates infinite CI/CD loop risks entirely
65
- - Good, because requires no git write permissions or credentials in CI/CD
66
- - Good, because uses standard npm tooling that developers understand
67
- - Good, because simplest possible implementation with minimal failure modes
68
- - Good, because each pipeline run is completely independent
69
- - Good, because immediate resolution to publish failures with no complexity overhead
70
- - Neutral, because package.json version may lag behind published npm version
71
- - Neutral, because developers can check published version via `npm view eslint-plugin-traceability version`
72
- - Bad, because does not automatically determine semantic version type (major/minor/patch)
73
- - Bad, because no automatic git tags or version history created
74
-
75
- ### Confirmation
76
-
77
- Implementation compliance will be confirmed through:
78
-
79
- - CI/CD pipeline successfully publishes without version conflicts
80
- - No npm publish failures due to existing version numbers
81
- - No git write operations or credentials required in CI/CD
82
- - No infinite pipeline loops or `[skip ci]` complexity needed
83
- - Pipeline logs clearly show when version increments occur
84
- - Published npm versions can be verified via `npm view eslint-plugin-traceability versions`
85
- - No manual intervention required for routine publishing
86
-
87
- ## Pros and Cons of the Options
88
-
89
- ### Version Increment Without Git Commits
90
-
91
- In-memory version increments during pipeline execution without any git write-back operations.
92
-
93
- - Good, because eliminates all CI/CD loop complexity and infinite recursion risks
94
- - Good, because requires no git write permissions or credentials in CI/CD environment
95
- - Good, because simplest possible implementation with minimal failure modes
96
- - Good, because each pipeline run is completely independent with no race conditions
97
- - Good, because immediate resolution to npm publish failures
98
- - Good, because uses standard npm version tooling familiar to developers
99
- - Good, because no complex error handling for git operations required
100
- - Neutral, because package.json version may not reflect latest published version
101
- - Neutral, because published version always discoverable via npm registry
102
- - Bad, because no automatic git tags created for release tracking
103
- - Bad, because requires manual version management for major/minor releases
104
- - Bad, because no automated version commit history
105
-
106
- ### Git Write-Back with Version Commits
107
-
108
- Increment version in pipeline, publish to npm, then commit version changes and create git tags.
109
-
110
- - Good, because creates proper git tags and version commits automatically
111
- - Good, because maintains package.json synchronization with published versions
112
- - Good, because provides complete version history in git repository
113
- - Good, because allows for automated CHANGELOG.md updates
114
- - Good, because follows traditional npm ecosystem patterns
115
- - Neutral, because requires configuration of git credentials in CI/CD
116
- - Neutral, because creates automated commits with CI skip directives
117
- - Bad, because requires complex infinite loop prevention with `[skip ci]`
118
- - Bad, because potential for git write failures after successful npm publish
119
- - Bad, because introduces race conditions in concurrent pipeline runs
120
- - Bad, because requires git write permissions and credential management
121
- - Bad, because adds multiple failure modes beyond the core publish operation
122
-
123
- ### Semantic Release with automated version detection
124
-
125
- Automated semantic versioning based on commit message analysis and release automation.
126
-
127
- - Good, because fully automated semantic version determination
128
- - Good, because analyzes commit messages for version type
129
- - Good, because comprehensive release note generation
130
- - Good, because follows semantic versioning specification strictly
131
- - Good, because popular in open source ecosystem
132
- - Neutral, because requires standardized commit message format
133
- - Bad, because adds significant complexity to CI/CD pipeline
134
- - Bad, because requires team discipline for commit message formatting
135
- - Bad, because may be overkill for the current project size
136
- - Bad, because introduces external dependency on semantic-release tool
137
- - Bad, because harder to override for exceptional cases
138
-
139
- ### Manual version bumping with CI/CD workflow triggers
140
-
141
- Requiring manual version increments before publishing with workflow validation.
142
-
143
- - Good, because provides full developer control over versioning
144
- - Good, because ensures deliberate version decisions
145
- - Good, because no automated commits or git history noise
146
- - Good, because simple to understand and implement
147
- - Neutral, because requires developer discipline for version management
148
- - Bad, because breaks continuous delivery principle
149
- - Bad, because requires manual intervention for every release
150
- - Bad, because prone to human error and forgotten version bumps
151
- - Bad, because does not solve the original npm publish failure problem
152
- - Bad, because creates friction in development workflow
153
-
154
- ## More Information
155
-
156
- This decision addresses the immediate CI/CD publish failures with the simplest possible solution that eliminates complexity while maintaining full automation. The in-memory version increment approach provides immediate relief from npm publish conflicts without introducing git write-back complexity.
157
-
158
- Key implementation details:
159
-
160
- ```yaml
161
- - name: Prepare version for publish
162
- run: |
163
- CURRENT_VERSION=$(node -p "require('./package.json').version")
164
- echo "Current package.json version: $CURRENT_VERSION"
165
-
166
- # Check if this version exists on npm
167
- if npm view eslint-plugin-traceability@$CURRENT_VERSION version >/dev/null 2>&1; then
168
- echo "Version $CURRENT_VERSION already exists on npm, incrementing..."
169
- npm version patch --no-git-tag-version
170
- NEW_VERSION=$(node -p "require('./package.json').version")
171
- echo "Bumped version to: $NEW_VERSION"
172
- else
173
- echo "Version $CURRENT_VERSION is available, proceeding with publish"
174
- fi
175
-
176
- - name: Publish package
177
- run: npm publish --access public
178
- ```
179
-
180
- Implementation considerations:
181
-
182
- - No git credentials or write permissions required in CI/CD
183
- - Version increments are logged for visibility and debugging
184
- - Each pipeline run operates independently with no side effects
185
- - Published versions remain discoverable via `npm view eslint-plugin-traceability versions`
186
- - Manual version bumps for major/minor releases can still be done via git commits
187
- - Future migration to git write-back approach remains possible if needed
188
-
189
- This decision should be re-evaluated if:
190
-
191
- - Package.json/npm version drift becomes problematic for development workflow
192
- - Automatic git tagging becomes a requirement for release management
193
- - The team adopts semantic versioning discipline requiring commit message analysis
194
- - Integration with automated changelog generation becomes necessary
195
-
196
- The simplicity of this approach allows for easy migration to more complex solutions later while solving the immediate problem with minimal risk and complexity.
@@ -1,144 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-17
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- GitHub Actions Documentation,
8
- Super-Linter Community,
9
- actionlint Documentation,
10
- ]
11
- informed: [Project Contributors, CI/CD Pipeline Maintainers]
12
- ---
13
-
14
- # GitHub Actions Validation Tooling Selection
15
-
16
- ## Context and Problem Statement
17
-
18
- The project uses GitHub Actions for CI/CD workflows defined in `.github/workflows/`. To prevent broken GitHub Actions files from being pushed to the repository, we need to implement pre-commit validation for GitHub Actions YAML files. This validation should catch syntax errors, invalid action references, and misconfigured job dependencies before they are committed, as broken workflow files could prevent CI/CD from running at all.
19
-
20
- ## Decision Drivers
21
-
22
- - Need for pre-commit validation to prevent broken GitHub Actions files from being pushed
23
- - Performance requirements for fast local development workflows
24
- - Prevention of workflow files that would break CI/CD execution
25
- - Integration with existing development tools and pre-commit hooks
26
- - Maintainability and configuration simplicity
27
- - Resource efficiency for local development environments
28
-
29
- ## Considered Options
30
-
31
- - actionlint for pre-commit hooks only
32
- - actionlint for both pre-commit and CI/CD
33
- - Super-Linter for pre-commit hooks
34
- - GitHub's built-in validation only
35
-
36
- ## Decision Outcome
37
-
38
- Chosen option: "actionlint for pre-commit hooks only", because it prevents broken GitHub Actions files from being pushed while maintaining fast local development workflow. Once files reach CI/CD, if the workflow runs successfully, the files are valid by definition.
39
-
40
- ### Consequences
41
-
42
- - Good, because actionlint provides fast pre-commit validation without container overhead
43
- - Good, because prevents broken GitHub Actions files from being pushed
44
- - Good, because specifically designed for GitHub Actions validation
45
- - Good, because simple configuration and maintenance
46
- - Good, because no Docker dependencies for local development
47
- - Good, because excellent performance for pre-commit hooks
48
- - Good, because integrates seamlessly with existing Husky-based pre-commit hooks
49
- - Neutral, because CI/CD validation is unnecessary if workflows execute successfully
50
- - Bad, because limited to GitHub Actions validation only
51
- - Bad, because no security vulnerability detection in pre-commit phase
52
-
53
- ### Confirmation
54
-
55
- Implementation compliance will be confirmed through:
56
-
57
- - actionlint added to Husky pre-commit hook in `.husky/pre-commit`
58
- - Pre-commit hook blocks commits with GitHub Actions validation errors
59
- - actionlint configured to validate files in `.github/workflows/`
60
- - Documentation updated to explain Husky-based pre-commit validation approach
61
-
62
- ### Implementation Approach
63
-
64
- actionlint will be integrated into existing Husky-based pre-commit hooks by:
65
-
66
- - Installing actionlint as a development dependency
67
- - Adding actionlint validation to `.husky/pre-commit` hook
68
- - Configuring actionlint to check `.github/workflows/*.yml` files
69
- - Documenting the validation process for contributors
70
-
71
- ## Pros and Cons of the Options
72
-
73
- ### actionlint for pre-commit hooks only
74
-
75
- Lightweight, focused pre-commit validation to prevent broken GitHub Actions files.
76
-
77
- - Good, because fast execution without container overhead
78
- - Good, because specifically designed for GitHub Actions validation
79
- - Good, because no Docker dependencies for local development
80
- - Good, because simple configuration and maintenance
81
- - Good, because excellent performance for pre-commit hooks
82
- - Good, because prevents broken workflow files from being pushed
83
- - Good, because minimal tooling - only runs where validation is needed
84
- - Neutral, because focused scope reduces complexity
85
- - Neutral, because CI/CD validation unnecessary if workflows execute successfully
86
- - Bad, because limited to GitHub Actions validation only
87
- - Bad, because no security vulnerability detection in pre-commit phase
88
-
89
- ### actionlint for both pre-commit and CI/CD
90
-
91
- Validation in both development and CI/CD environments.
92
-
93
- - Good, because fast execution in all environments
94
- - Good, because specifically designed for GitHub Actions
95
- - Good, because consistent validation across environments
96
- - Neutral, because focused scope reduces complexity
97
- - Bad, because unnecessary duplication - CI/CD execution validates workflow correctness
98
- - Bad, because adds CI/CD overhead for validation that's already proven by execution
99
- - Bad, because limited to GitHub Actions validation only
100
-
101
- ### Super-Linter for pre-commit hooks
102
-
103
- Comprehensive linting solution for pre-commit validation.
104
-
105
- - Good, because comprehensive validation including security checks
106
- - Good, because validates multiple file types beyond GitHub Actions
107
- - Neutral, because well-maintained and widely adopted
108
- - Bad, because container overhead makes pre-commit hooks slow
109
- - Bad, because heavy resource usage for simple syntax checking
110
- - Bad, because Docker dependency required for local development
111
- - Bad, because not optimized for frequent pre-commit execution
112
- - Bad, because overkill for the specific problem of preventing broken workflow files
113
-
114
- ### GitHub's built-in validation only
115
-
116
- Rely solely on GitHub's native workflow validation.
117
-
118
- - Good, because no additional tooling or configuration required
119
- - Good, because automatically available in GitHub interface
120
- - Good, because validated by the same system that executes workflows
121
- - Neutral, because basic validation is always performed
122
- - Bad, because no pre-commit validation for early error detection
123
- - Bad, because broken files can be pushed, preventing CI/CD execution
124
- - Bad, because errors only discovered after push to repository
125
- - Bad, because no local development feedback
126
-
127
- ## More Information
128
-
129
- This decision focuses on solving the specific problem of preventing broken GitHub Actions files from being pushed to the repository. If CI/CD workflows execute successfully, the files are validated by definition - there's no need for redundant validation in the CI/CD pipeline itself.
130
-
131
- actionlint configuration should be added to the existing Husky pre-commit hook in `.husky/pre-commit`, targeting `.github/workflows/*.yml` files to catch syntax and configuration errors before commit.
132
-
133
- The decision should be re-evaluated if:
134
-
135
- - Security vulnerability detection becomes a requirement for pre-commit validation
136
- - Comprehensive multi-language linting becomes necessary for pre-commit
137
- - Alternative tools with better GitHub Actions-specific features emerge
138
- - The problem scope expands beyond preventing broken workflow files
139
-
140
- Related resources:
141
-
142
- - [actionlint Documentation](https://github.com/rhymond/actionlint)
143
- - [GitHub Actions Workflow Syntax](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions)
144
- - [Husky Documentation](https://typicode.github.io/husky/)
@@ -1,227 +0,0 @@
1
- ---
2
- status: "accepted"
3
- date: 2025-11-17
4
- decision-makers: [Development Team]
5
- consulted:
6
- [
7
- semantic-release Documentation,
8
- Conventional Commits Specification,
9
- GitHub Actions Best Practices,
10
- npm Publishing Guidelines,
11
- ]
12
- informed: [Project Stakeholders, CI/CD Pipeline Maintainers]
13
- ---
14
-
15
- # Semantic Release for Automated Publishing
16
-
17
- ## Context and Problem Statement
18
-
19
- The current automated version bumping strategy (ADR 004) has several limitations that impact maintainability and developer experience:
20
-
21
- 1. **Single Increment Logic**: The CI/CD pipeline only increments the version once, requiring complex loop logic to handle cases where multiple increments are needed (e.g., when both 1.0.3 and 1.0.4 already exist on npm)
22
-
23
- 2. **No Semantic Version Determination**: The system only performs patch increments and cannot automatically determine when minor or major version bumps are appropriate based on the nature of changes
24
-
25
- 3. **Missing Release Management**: No automatic git tagging, release notes, or CHANGELOG.md generation, reducing traceability and release visibility
26
-
27
- 4. **Workflow Complexity**: The custom version increment logic in GitHub Actions is becoming complex and error-prone, potentially violating workflow validation best practices established in ADR 005
28
-
29
- 5. **Package.json/npm Version Drift**: The package.json version in the repository can lag behind the published npm version, creating confusion about the actual release state
30
-
31
- The current approach was designed as a temporary solution to prevent npm publish failures, but its limitations suggest that a more comprehensive release automation strategy is needed.
32
-
33
- ## Decision Drivers
34
-
35
- - Need for proper semantic version determination based on change significance
36
- - Automatic generation of release notes and changelog maintenance
37
- - Git tag creation for release tracking and traceability
38
- - Elimination of complex custom version increment logic in CI/CD workflows
39
- - Integration with conventional commit standards for automated version type detection
40
- - Prevention of unnecessary publishing when no changes warrant a release
41
- - Alignment with npm ecosystem best practices for release management
42
- - Simplification of GitHub Actions workflow to improve maintainability and validation compliance
43
-
44
- ## Considered Options
45
-
46
- - Enhance current in-memory version increment approach with loop logic
47
- - Implement semantic-release with conventional commits
48
- - Switch to git write-back approach with automated tagging
49
- - Implement manual release workflow with GitHub releases
50
-
51
- ## Decision Outcome
52
-
53
- Chosen option: "semantic-release with conventional commits", because it provides comprehensive release automation, proper semantic versioning, automated changelog generation, and eliminates the need for complex custom version logic while following industry standards.
54
-
55
- ### Implementation Strategy
56
-
57
- 1. **Install and Configure semantic-release**:
58
- - Add `semantic-release` and related plugins as development dependencies
59
- - Configure semantic-release with conventional commits preset
60
- - Set up plugins for npm publishing, git tagging, and changelog generation
61
-
62
- 2. **Establish Conventional Commit Standards**:
63
- - Adopt conventional commit message format for semantic version determination
64
- - Configure semantic-release to analyze commit messages for version impact
65
- - Document commit message guidelines for contributors
66
-
67
- 3. **Update CI/CD Pipeline**:
68
- - Replace custom version increment logic with semantic-release execution
69
- - Configure semantic-release to run on main branch pushes
70
- - Set up proper npm registry authentication and git permissions
71
-
72
- 4. **Configure Release Automation**:
73
- - Automatic CHANGELOG.md generation and maintenance
74
- - Git tag creation for each release
75
- - GitHub release creation with release notes
76
- - Conditional publishing (only when changes warrant a release)
77
-
78
- ### Consequences
79
-
80
- - Good, because eliminates complex custom version increment logic from CI/CD workflows
81
- - Good, because provides proper semantic version determination based on commit analysis
82
- - Good, because automatically generates and maintains CHANGELOG.md with release notes
83
- - Good, because creates proper git tags and GitHub releases for traceability
84
- - Good, because follows conventional commits standard adopted widely in open source
85
- - Good, because only publishes when changes actually warrant a new release
86
- - Good, because avoids package.json version drift by using git tags as source of truth
87
- - Good, because simplifies GitHub Actions workflow, improving validation compliance
88
- - Good, because provides comprehensive release management with minimal configuration
89
- - Good, because prevents infinite CI loops from version commits
90
- - Neutral, because requires team adoption of conventional commit message format
91
- - Neutral, because package.json version in repository may lag behind published version (git tags are source of truth)
92
- - Bad, because introduces dependency on semantic-release tool and its ecosystem
93
- - Bad, because may require learning curve for conventional commit message format
94
-
95
- ### Confirmation
96
-
97
- Implementation compliance will be confirmed through:
98
-
99
- - semantic-release successfully analyzes commits and determines appropriate version increments
100
- - Automatic CHANGELOG.md generation and git tag creation on releases
101
- - CI/CD pipeline publishes to npm only when semantic-release determines a release is warranted
102
- - No npm publish failures due to version conflicts or unnecessary publishing attempts
103
- - Package.json version remains synchronized with published npm version
104
- - GitHub Actions workflow simplified and validates successfully with actionlint (ADR 005)
105
- - Conventional commit message format adopted and documented for contributors
106
-
107
- ## Pros and Cons of the Options
108
-
109
- ### semantic-release with conventional commits
110
-
111
- Comprehensive automated release management based on commit message analysis.
112
-
113
- - Good, because industry standard tool with extensive ecosystem
114
- - Good, because proper semantic version determination based on commit analysis
115
- - Good, because automatic CHANGELOG.md and release notes generation
116
- - Good, because creates git tags and GitHub releases automatically
117
- - Good, because only publishes when changes warrant a release
118
- - Good, because eliminates custom version increment logic complexity
119
- - Good, because maintains git history and package.json synchronization
120
- - Good, because follows conventional commits standard
121
- - Good, because comprehensive documentation and community support
122
- - Neutral, because requires conventional commit message discipline
123
- - Neutral, because adds dependency on semantic-release ecosystem
124
- - Bad, because requires git write permissions in CI/CD
125
- - Bad, because learning curve for commit message conventions
126
-
127
- ### Enhanced in-memory version increment with loop logic
128
-
129
- Improve the current approach with better version conflict resolution.
130
-
131
- - Good, because builds on existing working foundation
132
- - Good, because no external dependencies or new tooling
133
- - Good, because maintains current simplicity of git read-only CI/CD
134
- - Neutral, because addresses immediate technical limitation
135
- - Bad, because still provides only patch-level version increments
136
- - Bad, because no semantic version determination capability
137
- - Bad, because no automatic changelog or git tag generation
138
- - Bad, because increases complexity of custom GitHub Actions logic
139
- - Bad, because doesn't address package.json/npm version synchronization
140
- - Bad, because potential for workflow validation issues with complex logic
141
-
142
- ### Git write-back approach with automated tagging
143
-
144
- Custom solution with git operations for version commits and tagging.
145
-
146
- - Good, because provides git tag creation and version history
147
- - Good, because maintains package.json synchronization
148
- - Good, because can be customized for specific project needs
149
- - Neutral, because requires git write permissions
150
- - Bad, because requires complex infinite loop prevention logic
151
- - Bad, because no semantic version determination
152
- - Bad, because no automated changelog generation
153
- - Bad, because potential race conditions in CI/CD
154
- - Bad, because increased failure modes with git operations
155
- - Bad, because custom implementation maintenance burden
156
-
157
- ### Manual release workflow with GitHub releases
158
-
159
- Manual release creation through GitHub interface with automated publishing.
160
-
161
- - Good, because provides full control over release timing and messaging
162
- - Good, because natural integration with GitHub releases interface
163
- - Good, because allows for manual changelog and release notes
164
- - Good, because no automated commit message requirements
165
- - Neutral, because requires manual intervention for releases
166
- - Bad, because breaks continuous delivery principle
167
- - Bad, because prone to human error and forgotten releases
168
- - Bad, because no automation of version determination
169
- - Bad, because workflow friction for regular development
170
- - Bad, because doesn't solve original npm publish failure problem
171
-
172
- ## More Information
173
-
174
- This decision supersedes ADR 004 "Automated Version Bumping for CI/CD Publishing", which served as a temporary solution to prevent npm publish failures but has reached its limitations in terms of semantic versioning and release management.
175
-
176
- semantic-release configuration will include:
177
-
178
- ```json
179
- {
180
- "branches": ["main"],
181
- "plugins": [
182
- "@semantic-release/commit-analyzer",
183
- "@semantic-release/release-notes-generator",
184
- "@semantic-release/changelog",
185
- "@semantic-release/npm",
186
- "@semantic-release/github"
187
- ]
188
- }
189
- ```
190
-
191
- **Note**: The `@semantic-release/git` plugin is intentionally excluded. semantic-release will manage versions through git tags only, without committing version changes back to package.json. This approach:
192
-
193
- - Prevents infinite CI loops from version commits
194
- - Follows npm ecosystem best practices where tags are the source of truth
195
- - Keeps the repository history clean of automated version bump commits
196
- - Aligns with how other projects in the ecosystem use semantic-release
197
-
198
- The published npm package will have the correct version, but package.json in the repository may not reflect the latest published version. Git tags serve as the authoritative version record.
199
-
200
- Conventional commit format examples:
201
-
202
- - `feat: add new validation rule` → minor version increment
203
- - `fix: resolve annotation parsing issue` → patch version increment
204
- - `feat!: change API interface` → major version increment
205
- - `docs: update README` → no version increment
206
-
207
- GitHub Actions workflow simplification:
208
-
209
- - Remove custom version increment logic
210
- - Replace with single `npx semantic-release` command
211
- - Configure necessary permissions (contents:write, issues:write, pull-requests:write, id-token:write)
212
- - Set HUSKY=0 environment variable to disable git hooks during release
213
- - Maintain existing quality checks and security audits
214
- - Add smoke test for published package verification
215
-
216
- This decision should be re-evaluated if:
217
-
218
- - Conventional commit discipline becomes difficult to maintain
219
- - semantic-release ecosystem introduces breaking changes or maintenance issues
220
- - Project requirements change to need custom release logic not supported by semantic-release
221
- - Team prefers different commit message standards incompatible with conventional commits
222
-
223
- Related resources:
224
-
225
- - [semantic-release Documentation](https://semantic-release.gitbook.io/)
226
- - [Conventional Commits Specification](https://www.conventionalcommits.org/)
227
- - [GitHub Actions with semantic-release](https://github.com/semantic-release/semantic-release/blob/master/docs/recipes/github-actions.md)