eslint-plugin-traceability 1.0.3 → 1.0.5

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 (94) hide show
  1. package/.github/workflows/ci-cd.yml +41 -35
  2. package/.husky/pre-commit +1 -1
  3. package/.husky/pre-push +1 -1
  4. package/.prettierignore +5 -1
  5. package/.releaserc.json +15 -0
  6. package/.voder/history.md +138 -264
  7. package/.voder/implementation-progress.md +110 -112
  8. package/.voder/last-action.md +62 -204
  9. package/.voder/plan.md +10 -10
  10. package/.voder/progress-chart.png +0 -0
  11. package/.voder/progress-log-areas.csv +4 -0
  12. package/.voder/progress-log.csv +4 -0
  13. package/CHANGELOG.md +20 -1
  14. package/CONTRIBUTING.md +15 -13
  15. package/README.md +2 -2
  16. package/cli-integration.js +61 -115
  17. package/docs/cli-integration.md +3 -1
  18. package/docs/conventional-commits-guide.md +185 -0
  19. package/docs/decisions/004-automated-version-bumping-for-ci-cd.md +3 -1
  20. package/docs/decisions/005-github-actions-validation-tooling.accepted.md +144 -0
  21. package/docs/decisions/006-semantic-release-for-automated-publishing.accepted.md +227 -0
  22. package/eslint.config.js +4 -4
  23. package/package.json +7 -2
  24. package/tests/{basic.test.ts → plugin-setup.test.ts} +1 -1
  25. package/user-docs/migration-guide.md +71 -0
  26. package/lib/index.d.ts +0 -26
  27. package/lib/index.js +0 -11
  28. package/lib/src/index.d.ts +0 -80
  29. package/lib/src/index.js +0 -58
  30. package/lib/src/maintenance/batch.d.ts +0 -16
  31. package/lib/src/maintenance/batch.js +0 -28
  32. package/lib/src/maintenance/detect.d.ts +0 -6
  33. package/lib/src/maintenance/detect.js +0 -69
  34. package/lib/src/maintenance/index.d.ts +0 -14
  35. package/lib/src/maintenance/index.js +0 -22
  36. package/lib/src/maintenance/report.d.ts +0 -7
  37. package/lib/src/maintenance/report.js +0 -17
  38. package/lib/src/maintenance/update.d.ts +0 -6
  39. package/lib/src/maintenance/update.js +0 -67
  40. package/lib/src/maintenance/utils.d.ts +0 -6
  41. package/lib/src/maintenance/utils.js +0 -64
  42. package/lib/src/rules/require-branch-annotation.d.ts +0 -7
  43. package/lib/src/rules/require-branch-annotation.js +0 -111
  44. package/lib/src/rules/require-req-annotation.d.ts +0 -7
  45. package/lib/src/rules/require-req-annotation.js +0 -38
  46. package/lib/src/rules/require-story-annotation.d.ts +0 -7
  47. package/lib/src/rules/require-story-annotation.js +0 -50
  48. package/lib/src/rules/valid-annotation-format.d.ts +0 -10
  49. package/lib/src/rules/valid-annotation-format.js +0 -60
  50. package/lib/src/rules/valid-req-reference.d.ts +0 -3
  51. package/lib/src/rules/valid-req-reference.js +0 -104
  52. package/lib/src/rules/valid-story-reference.d.ts +0 -3
  53. package/lib/src/rules/valid-story-reference.js +0 -168
  54. package/lib/tests/basic.test.d.ts +0 -1
  55. package/lib/tests/basic.test.js +0 -51
  56. package/lib/tests/fixtures/stale/example.d.ts +0 -0
  57. package/lib/tests/fixtures/stale/example.js +0 -3
  58. package/lib/tests/fixtures/update/example.d.ts +0 -0
  59. package/lib/tests/fixtures/update/example.js +0 -3
  60. package/lib/tests/fixtures/valid-annotations/example.d.ts +0 -0
  61. package/lib/tests/fixtures/valid-annotations/example.js +0 -3
  62. package/lib/tests/index.test.d.ts +0 -1
  63. package/lib/tests/index.test.js +0 -72
  64. package/lib/tests/integration/file-validation.test.d.ts +0 -1
  65. package/lib/tests/integration/file-validation.test.js +0 -71
  66. package/lib/tests/integration/plugin-validation.test.d.ts +0 -1
  67. package/lib/tests/integration/plugin-validation.test.js +0 -83
  68. package/lib/tests/maintenance/batch.test.d.ts +0 -1
  69. package/lib/tests/maintenance/batch.test.js +0 -79
  70. package/lib/tests/maintenance/detect-isolated.test.d.ts +0 -1
  71. package/lib/tests/maintenance/detect-isolated.test.js +0 -95
  72. package/lib/tests/maintenance/detect.test.d.ts +0 -1
  73. package/lib/tests/maintenance/detect.test.js +0 -23
  74. package/lib/tests/maintenance/report.test.d.ts +0 -1
  75. package/lib/tests/maintenance/report.test.js +0 -67
  76. package/lib/tests/maintenance/update-isolated.test.d.ts +0 -1
  77. package/lib/tests/maintenance/update-isolated.test.js +0 -66
  78. package/lib/tests/maintenance/update.test.d.ts +0 -1
  79. package/lib/tests/maintenance/update.test.js +0 -26
  80. package/lib/tests/rules/require-branch-annotation.test.d.ts +0 -1
  81. package/lib/tests/rules/require-branch-annotation.test.js +0 -253
  82. package/lib/tests/rules/require-req-annotation.test.d.ts +0 -1
  83. package/lib/tests/rules/require-req-annotation.test.js +0 -41
  84. package/lib/tests/rules/require-story-annotation.test.d.ts +0 -1
  85. package/lib/tests/rules/require-story-annotation.test.js +0 -36
  86. package/lib/tests/rules/valid-annotation-format.test.d.ts +0 -1
  87. package/lib/tests/rules/valid-annotation-format.test.js +0 -58
  88. package/lib/tests/rules/valid-req-reference.test.d.ts +0 -1
  89. package/lib/tests/rules/valid-req-reference.test.js +0 -87
  90. package/lib/tests/rules/valid-story-reference.test.d.ts +0 -1
  91. package/lib/tests/rules/valid-story-reference.test.js +0 -69
  92. package/tests/integration/file-validation.test.ts +0 -78
  93. package/tests/integration/plugin-validation.test.ts +0 -84
  94. /package/tests/{index.test.ts → plugin-default-export-and-configs.test.ts} +0 -0
@@ -0,0 +1,227 @@
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)
package/eslint.config.js CHANGED
@@ -73,9 +73,9 @@ module.exports = [
73
73
  rules: {
74
74
  complexity: "error",
75
75
  // Enforce maximum lines per function for maintainability
76
- "max-lines-per-function": ["error", { max: 90, skipBlankLines: true, skipComments: true }],
76
+ "max-lines-per-function": ["error", { max: 80, skipBlankLines: true, skipComments: true }],
77
77
  // Enforce maximum lines per file for maintainability
78
- "max-lines": ["error", { max: 400, skipBlankLines: true, skipComments: true }],
78
+ "max-lines": ["error", { max: 350, skipBlankLines: true, skipComments: true }],
79
79
  },
80
80
  },
81
81
  {
@@ -90,9 +90,9 @@ module.exports = [
90
90
  rules: {
91
91
  complexity: "error",
92
92
  // Enforce maximum lines per function for maintainability
93
- "max-lines-per-function": ["error", { max: 90, skipBlankLines: true, skipComments: true }],
93
+ "max-lines-per-function": ["error", { max: 80, skipBlankLines: true, skipComments: true }],
94
94
  // Enforce maximum lines per file for maintainability
95
- "max-lines": ["error", { max: 400, skipBlankLines: true, skipComments: true }],
95
+ "max-lines": ["error", { max: 350, skipBlankLines: true, skipComments: true }],
96
96
  },
97
97
  },
98
98
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-traceability",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -41,17 +41,22 @@
41
41
  "homepage": "https://github.com/voder-ai/eslint-plugin-traceability#readme",
42
42
  "devDependencies": {
43
43
  "@eslint/js": "^9.39.1",
44
+ "@semantic-release/changelog": "^6.0.3",
45
+ "@semantic-release/git": "^10.0.1",
46
+ "@semantic-release/github": "^12.0.2",
44
47
  "@types/eslint": "^9.6.1",
45
48
  "@types/jest": "^30.0.0",
46
49
  "@types/node": "^24.10.1",
47
50
  "@typescript-eslint/parser": "^8.46.4",
48
51
  "@typescript-eslint/utils": "^8.46.4",
52
+ "actionlint": "^2.0.6",
49
53
  "eslint": "^9.39.1",
50
54
  "husky": "^9.1.7",
51
55
  "jest": "^30.2.0",
52
56
  "jscpd": "^4.0.5",
53
57
  "lint-staged": "^16.2.6",
54
58
  "prettier": "^3.6.2",
59
+ "semantic-release": "^25.0.2",
55
60
  "ts-jest": "^29.4.5",
56
61
  "typescript": "^5.9.3"
57
62
  },
@@ -64,4 +69,4 @@
64
69
  "overrides": {
65
70
  "js-yaml": ">=4.1.1"
66
71
  }
67
- }
72
+ }
@@ -3,7 +3,7 @@
3
3
  * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
4
4
  * @req REQ-PLUGIN-STRUCTURE - plugin exports rules and configs
5
5
  */
6
- import plugin, { rules, configs } from "../lib/index";
6
+ import plugin, { rules, configs } from "../src/index";
7
7
 
8
8
  describe("Traceability ESLint Plugin (Story 001.0-DEV-PLUGIN-SETUP)", () => {
9
9
  it("[REQ-PLUGIN-STRUCTURE] plugin exports rules and configs", () => {
@@ -0,0 +1,71 @@
1
+ # Migration Guide from v0.x to v1.x
2
+
3
+ Created autonomously by [voder.ai](https://voder.ai)
4
+
5
+ This guide helps you migrate from versions 0.x of `eslint-plugin-traceability` to 1.x.
6
+
7
+ ## 1. Update Dependency
8
+
9
+ Update your development dependency to the latest 1.x release:
10
+
11
+ ```bash
12
+ npm install --save-dev eslint-plugin-traceability@^1.0.0
13
+ ```
14
+
15
+ Or with Yarn:
16
+
17
+ ```bash
18
+ yarn add --dev eslint-plugin-traceability@^1.0.0
19
+ ```
20
+
21
+ ## 2. ESLint Configuration Changes
22
+
23
+ - Version 1.x uses ESLint v9 flat config by default. If you currently use `.eslintrc.js`, you can continue using it, but consider migrating to the new flat config format for future upgrades.
24
+ - Update your ESLint config to load the plugin’s recommended settings:
25
+
26
+ ```js
27
+ // eslint.config.js (ESLint v9 flat config)
28
+ import traceability from "eslint-plugin-traceability";
29
+
30
+ export default [traceability.configs.recommended];
31
+ ```
32
+
33
+ ## 3. New and Updated Rules
34
+
35
+ - `valid-story-reference` now enforces `.story.md` extensions strictly.
36
+ - `valid-req-reference` rejects path traversal (`../`) and absolute paths (`/etc/passwd`).
37
+ - `valid-annotation-format` enforces correct JSDoc traceability annotation syntax (`@story` and `@req` tags).
38
+
39
+ Review and update your existing annotations accordingly:
40
+
41
+ ```diff
42
+ - /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.md */
43
+ + /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md */
44
+ ```
45
+
46
+ ## 4. CLI Integration Script
47
+
48
+ Version 1.x includes a new `cli-integration.js` script at the project root to run end-to-end CLI integration tests:
49
+
50
+ ```bash
51
+ node ./cli-integration.js
52
+ ```
53
+
54
+ ## 5. Test and Validate
55
+
56
+ Run your test suite and the new CLI integration script to confirm everything passes:
57
+
58
+ ```bash
59
+ npm test
60
+ npm run lint -- --max-warnings=0
61
+ npm run format:check
62
+ node ./cli-integration.js
63
+ ```
64
+
65
+ ## 6. Update Documentation
66
+
67
+ If you have custom documentation or examples that reference old rule names or file paths, update them to match the new conventions introduced in v1.x.
68
+
69
+ ---
70
+
71
+ If you encounter any issues during migration, please file an issue at https://github.com/voder-ai/eslint-plugin-traceability/issues.
package/lib/index.d.ts DELETED
@@ -1,26 +0,0 @@
1
- /**
2
- * ESLint Traceability Plugin
3
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
4
- * @req REQ-PLUGIN-STRUCTURE - Provide foundational plugin export and registration
5
- */
6
- export declare const rules: Record<string, unknown>;
7
- export declare const configs: {
8
- recommended: {
9
- rules: {};
10
- }[];
11
- strict: {
12
- rules: {};
13
- }[];
14
- };
15
- declare const _default: {
16
- rules: Record<string, unknown>;
17
- configs: {
18
- recommended: {
19
- rules: {};
20
- }[];
21
- strict: {
22
- rules: {};
23
- }[];
24
- };
25
- };
26
- export default _default;
package/lib/index.js DELETED
@@ -1,11 +0,0 @@
1
- "use strict";
2
- /**
3
- * ESLint Traceability Plugin
4
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
5
- * @req REQ-PLUGIN-STRUCTURE - Provide foundational plugin export and registration
6
- */
7
- const plugin = require("./src/index.js");
8
-
9
- module.exports = plugin;
10
- module.exports.rules = plugin.rules;
11
- module.exports.configs = plugin.configs;
@@ -1,80 +0,0 @@
1
- /**
2
- * ESLint Traceability Plugin
3
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
4
- * @req REQ-PLUGIN-STRUCTURE - Provide foundational plugin export and registration
5
- */
6
- export declare const rules: {
7
- "require-story-annotation": any;
8
- "require-req-annotation": any;
9
- "require-branch-annotation": any;
10
- "valid-annotation-format": any;
11
- "valid-story-reference": import("eslint").Rule.RuleModule;
12
- "valid-req-reference": import("eslint").Rule.RuleModule;
13
- };
14
- export declare const configs: {
15
- recommended: {
16
- plugins: {
17
- traceability: {};
18
- };
19
- rules: {
20
- "traceability/require-story-annotation": string;
21
- "traceability/require-req-annotation": string;
22
- "traceability/require-branch-annotation": string;
23
- "traceability/valid-annotation-format": string;
24
- "traceability/valid-story-reference": string;
25
- "traceability/valid-req-reference": string;
26
- };
27
- }[];
28
- strict: {
29
- plugins: {
30
- traceability: {};
31
- };
32
- rules: {
33
- "traceability/require-story-annotation": string;
34
- "traceability/require-req-annotation": string;
35
- "traceability/require-branch-annotation": string;
36
- "traceability/valid-annotation-format": string;
37
- "traceability/valid-story-reference": string;
38
- "traceability/valid-req-reference": string;
39
- };
40
- }[];
41
- };
42
- declare const _default: {
43
- rules: {
44
- "require-story-annotation": any;
45
- "require-req-annotation": any;
46
- "require-branch-annotation": any;
47
- "valid-annotation-format": any;
48
- "valid-story-reference": import("eslint").Rule.RuleModule;
49
- "valid-req-reference": import("eslint").Rule.RuleModule;
50
- };
51
- configs: {
52
- recommended: {
53
- plugins: {
54
- traceability: {};
55
- };
56
- rules: {
57
- "traceability/require-story-annotation": string;
58
- "traceability/require-req-annotation": string;
59
- "traceability/require-branch-annotation": string;
60
- "traceability/valid-annotation-format": string;
61
- "traceability/valid-story-reference": string;
62
- "traceability/valid-req-reference": string;
63
- };
64
- }[];
65
- strict: {
66
- plugins: {
67
- traceability: {};
68
- };
69
- rules: {
70
- "traceability/require-story-annotation": string;
71
- "traceability/require-req-annotation": string;
72
- "traceability/require-branch-annotation": string;
73
- "traceability/valid-annotation-format": string;
74
- "traceability/valid-story-reference": string;
75
- "traceability/valid-req-reference": string;
76
- };
77
- }[];
78
- };
79
- };
80
- export default _default;
package/lib/src/index.js DELETED
@@ -1,58 +0,0 @@
1
- "use strict";
2
- /**
3
- * ESLint Traceability Plugin
4
- * @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md
5
- * @req REQ-PLUGIN-STRUCTURE - Provide foundational plugin export and registration
6
- */
7
- var __importDefault = (this && this.__importDefault) || function (mod) {
8
- return (mod && mod.__esModule) ? mod : { "default": mod };
9
- };
10
- Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.configs = exports.rules = void 0;
12
- const require_story_annotation_1 = __importDefault(require("./rules/require-story-annotation"));
13
- const require_req_annotation_1 = __importDefault(require("./rules/require-req-annotation"));
14
- const require_branch_annotation_1 = __importDefault(require("./rules/require-branch-annotation"));
15
- const valid_annotation_format_1 = __importDefault(require("./rules/valid-annotation-format"));
16
- const valid_story_reference_1 = __importDefault(require("./rules/valid-story-reference"));
17
- const valid_req_reference_1 = __importDefault(require("./rules/valid-req-reference"));
18
- exports.rules = {
19
- "require-story-annotation": require_story_annotation_1.default,
20
- "require-req-annotation": require_req_annotation_1.default,
21
- "require-branch-annotation": require_branch_annotation_1.default,
22
- "valid-annotation-format": valid_annotation_format_1.default,
23
- "valid-story-reference": valid_story_reference_1.default,
24
- "valid-req-reference": valid_req_reference_1.default,
25
- };
26
- exports.configs = {
27
- recommended: [
28
- {
29
- plugins: {
30
- traceability: {},
31
- },
32
- rules: {
33
- "traceability/require-story-annotation": "error",
34
- "traceability/require-req-annotation": "error",
35
- "traceability/require-branch-annotation": "error",
36
- "traceability/valid-annotation-format": "error",
37
- "traceability/valid-story-reference": "error",
38
- "traceability/valid-req-reference": "error",
39
- },
40
- },
41
- ],
42
- strict: [
43
- {
44
- plugins: {
45
- traceability: {},
46
- },
47
- rules: {
48
- "traceability/require-story-annotation": "error",
49
- "traceability/require-req-annotation": "error",
50
- "traceability/require-branch-annotation": "error",
51
- "traceability/valid-annotation-format": "error",
52
- "traceability/valid-story-reference": "error",
53
- "traceability/valid-req-reference": "error",
54
- },
55
- },
56
- ],
57
- };
58
- exports.default = { rules: exports.rules, configs: exports.configs };
@@ -1,16 +0,0 @@
1
- /**
2
- * Batch update annotations and verify references
3
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
4
- * @req REQ-MAINT-BATCH - Perform batch updates
5
- * @req REQ-MAINT-VERIFY - Verify annotation references
6
- */
7
- export declare function batchUpdateAnnotations(codebasePath: string, mappings: {
8
- oldPath: string;
9
- newPath: string;
10
- }[]): number;
11
- /**
12
- * Verify annotation references in codebase after maintenance operations
13
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
14
- * @req REQ-MAINT-VERIFY - Verify annotation references
15
- */
16
- export declare function verifyAnnotations(codebasePath: string): boolean;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.batchUpdateAnnotations = batchUpdateAnnotations;
4
- exports.verifyAnnotations = verifyAnnotations;
5
- const update_1 = require("./update");
6
- const detect_1 = require("./detect");
7
- /**
8
- * Batch update annotations and verify references
9
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
10
- * @req REQ-MAINT-BATCH - Perform batch updates
11
- * @req REQ-MAINT-VERIFY - Verify annotation references
12
- */
13
- function batchUpdateAnnotations(codebasePath, mappings) {
14
- let totalUpdated = 0;
15
- for (const { oldPath, newPath } of mappings) {
16
- totalUpdated += (0, update_1.updateAnnotationReferences)(codebasePath, oldPath, newPath);
17
- }
18
- return totalUpdated;
19
- }
20
- /**
21
- * Verify annotation references in codebase after maintenance operations
22
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
23
- * @req REQ-MAINT-VERIFY - Verify annotation references
24
- */
25
- function verifyAnnotations(codebasePath) {
26
- const staleAnnotations = (0, detect_1.detectStaleAnnotations)(codebasePath);
27
- return staleAnnotations.length === 0;
28
- }
@@ -1,6 +0,0 @@
1
- /**
2
- * Detect stale annotation references that point to moved or deleted story files
3
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
4
- * @req REQ-MAINT-DETECT - Detect stale annotation references
5
- */
6
- export declare function detectStaleAnnotations(codebasePath: string): string[];
@@ -1,69 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.detectStaleAnnotations = detectStaleAnnotations;
37
- const fs = __importStar(require("fs"));
38
- const path = __importStar(require("path"));
39
- const utils_1 = require("./utils");
40
- /**
41
- * Detect stale annotation references that point to moved or deleted story files
42
- * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
43
- * @req REQ-MAINT-DETECT - Detect stale annotation references
44
- */
45
- function detectStaleAnnotations(codebasePath) {
46
- if (!fs.existsSync(codebasePath) ||
47
- !fs.statSync(codebasePath).isDirectory()) {
48
- return [];
49
- }
50
- const cwd = process.cwd();
51
- const baseDir = path.resolve(cwd, codebasePath);
52
- const stale = new Set();
53
- const files = (0, utils_1.getAllFiles)(codebasePath);
54
- for (const file of files) {
55
- const content = fs.readFileSync(file, "utf8");
56
- const regex = /@story\s+([^\s]+)/g;
57
- let match;
58
- while ((match = regex.exec(content)) !== null) {
59
- const storyPath = match[1];
60
- const storyProjectPath = path.resolve(cwd, storyPath);
61
- const storyCodebasePath = path.resolve(baseDir, storyPath);
62
- if (!fs.existsSync(storyProjectPath) &&
63
- !fs.existsSync(storyCodebasePath)) {
64
- stale.add(storyPath);
65
- }
66
- }
67
- }
68
- return Array.from(stale);
69
- }