eslint-plugin-traceability 1.8.1 → 1.8.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 (44) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/README.md +4 -4
  3. package/SECURITY.md +40 -37
  4. package/lib/src/maintenance/cli.js +12 -16
  5. package/lib/src/maintenance/detect.js +28 -1
  6. package/lib/src/rules/helpers/require-story-io.d.ts +2 -2
  7. package/lib/src/rules/helpers/require-story-io.js +13 -13
  8. package/lib/src/rules/helpers/valid-annotation-format-internal.d.ts +2 -2
  9. package/lib/src/rules/helpers/valid-annotation-format-internal.js +3 -3
  10. package/lib/src/rules/helpers/valid-annotation-utils.d.ts +5 -0
  11. package/lib/src/rules/helpers/valid-annotation-utils.js +43 -5
  12. package/lib/src/rules/helpers/valid-implements-utils.d.ts +11 -11
  13. package/lib/src/rules/helpers/valid-implements-utils.js +11 -11
  14. package/lib/src/rules/helpers/valid-story-reference-helpers.js +19 -0
  15. package/lib/src/rules/prefer-implements-annotation.d.ts +7 -7
  16. package/lib/src/rules/prefer-implements-annotation.js +21 -21
  17. package/lib/src/rules/valid-annotation-format.js +50 -24
  18. package/lib/src/rules/valid-req-reference.js +9 -9
  19. package/lib/src/utils/annotation-checker.js +3 -1
  20. package/lib/src/utils/reqAnnotationDetection.d.ts +2 -2
  21. package/lib/src/utils/reqAnnotationDetection.js +28 -28
  22. package/lib/tests/maintenance/batch.test.js +11 -11
  23. package/lib/tests/maintenance/cli.test.js +34 -27
  24. package/lib/tests/maintenance/report.test.js +7 -7
  25. package/lib/tests/rules/prefer-implements-annotation.test.js +27 -22
  26. package/lib/tests/rules/require-branch-annotation.test.js +15 -36
  27. package/lib/tests/rules/require-req-annotation.test.js +31 -104
  28. package/lib/tests/rules/require-story-annotation.test.js +3 -3
  29. package/lib/tests/rules/require-story-io-behavior.test.js +2 -7
  30. package/lib/tests/rules/require-story-io.edgecases.test.js +2 -7
  31. package/lib/tests/rules/require-story-visitors-edgecases.test.js +8 -8
  32. package/lib/tests/rules/valid-annotation-format.test.js +23 -23
  33. package/lib/tests/rules/valid-req-reference.test.js +9 -9
  34. package/lib/tests/rules/valid-story-reference.test.js +4 -43
  35. package/lib/tests/utils/annotation-checker.test.js +2 -6
  36. package/lib/tests/utils/fsTestHelpers.d.ts +7 -0
  37. package/lib/tests/utils/fsTestHelpers.js +26 -0
  38. package/lib/tests/utils/ioTestHelpers.d.ts +7 -0
  39. package/lib/tests/utils/ioTestHelpers.js +24 -0
  40. package/lib/tests/utils/temp-dir-helpers.d.ts +14 -0
  41. package/lib/tests/utils/temp-dir-helpers.js +61 -0
  42. package/package.json +3 -2
  43. package/user-docs/api-reference.md +12 -15
  44. package/user-docs/migration-guide.md +21 -21
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runFallbackTextBeforeHasStoryDetectsStoryTest = runFallbackTextBeforeHasStoryDetectsStoryTest;
4
+ /**
5
+ * Shared IO helper tests for require-story-io behavior.
6
+ *
7
+ * @story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md
8
+ * @req REQ-TEST-UTILS-IO - Provide reusable helpers for IO-related edge case tests
9
+ */
10
+ function runFallbackTextBeforeHasStoryDetectsStoryTest(storyAnnotationOrFallbackFn = "@story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md", maybeFallbackFn) {
11
+ const isFirstArgFn = typeof storyAnnotationOrFallbackFn === "function";
12
+ const storyAnnotation = isFirstArgFn
13
+ ? "@story docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md"
14
+ : storyAnnotationOrFallbackFn;
15
+ const fallbackFn = isFirstArgFn
16
+ ? storyAnnotationOrFallbackFn
17
+ : maybeFallbackFn;
18
+ const pre = `/* ${storyAnnotation} */\n`;
19
+ const rest = "function y() {}";
20
+ const full = pre + rest;
21
+ const fakeSource = { getText: () => full };
22
+ const node = { range: [full.indexOf("function"), full.length] };
23
+ expect(fallbackFn(fakeSource, node)).toBe(true);
24
+ }
@@ -0,0 +1,14 @@
1
+ export interface TempDirHandle {
2
+ /** The absolute path to the created temporary directory. */
3
+ readonly dir: string;
4
+ /** Remove the directory recursively; safe to call multiple times. */
5
+ cleanup(): void;
6
+ }
7
+ /**
8
+ * Create a temporary directory under the OS temp root with a common prefix.
9
+ *
10
+ * This helper centralizes the mkdtemp + rmSync pattern that appears in
11
+ * multiple maintenance tests so those tests can focus on behavior instead
12
+ * of filesystem plumbing.
13
+ */
14
+ export declare function createTempDir(prefix: string): TempDirHandle;
@@ -0,0 +1,61 @@
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.createTempDir = createTempDir;
37
+ /**
38
+ * Shared temp directory helpers for maintenance tests.
39
+ * @story docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md
40
+ * @req REQ-MAINT-TEMP-HELPERS - Provide reusable OS tempdir setup/cleanup utilities for tests
41
+ */
42
+ const fs = __importStar(require("fs"));
43
+ const os = __importStar(require("os"));
44
+ const path = __importStar(require("path"));
45
+ /**
46
+ * Create a temporary directory under the OS temp root with a common prefix.
47
+ *
48
+ * This helper centralizes the mkdtemp + rmSync pattern that appears in
49
+ * multiple maintenance tests so those tests can focus on behavior instead
50
+ * of filesystem plumbing.
51
+ */
52
+ function createTempDir(prefix) {
53
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
54
+ return {
55
+ dir,
56
+ cleanup() {
57
+ // @implements docs/stories/009.0-DEV-MAINTENANCE-TOOLS.story.md REQ-MAINT-SAFE
58
+ fs.rmSync(dir, { recursive: true, force: true });
59
+ },
60
+ };
61
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eslint-plugin-traceability",
3
- "version": "1.8.1",
3
+ "version": "1.8.2",
4
4
  "description": "A customizable ESLint plugin that enforces traceability annotations in your code, ensuring each implementation is linked to its requirement or test case.",
5
5
  "main": "lib/src/index.js",
6
6
  "types": "lib/src/index.d.ts",
@@ -20,7 +20,8 @@
20
20
  },
21
21
  "scripts": {
22
22
  "build": "tsc -p tsconfig.json",
23
- "prepare": "husky install",
23
+ "prepare": "",
24
+ "postinstall": "husky",
24
25
  "type-check": "tsc --noEmit -p tsconfig.json",
25
26
  "check:traceability": "node scripts/traceability-check.js",
26
27
  "lint-plugin-check": "node scripts/lint-plugin-check.js",
@@ -11,15 +11,15 @@ Security and dependency hygiene for the published package are enforced by the sa
11
11
 
12
12
  Each rule enforces traceability conventions in your code. Below is a summary of each rule exposed by this plugin.
13
13
 
14
- In addition to the core `@story` and `@req` annotations, the plugin also understands `@implements` for code that fulfills requirements from multiple stories—for example:
15
- `@implements docs/stories/010.0-PAYMENTS.story.md#REQ-PAYMENTS-REFUND`.
16
- For a detailed explanation of `@implements` behavior and validation, see [Migration Guide](migration-guide.md) (section **3.1 Multi-story @implements annotations**) and the corresponding `valid-annotation-format` and `valid-req-reference` rule documentation in the plugin's internal docs.
14
+ In addition to the core `@story` and `@req` annotations, the plugin also understands `@supports` for code that fulfills requirements from multiple stories—for example, a consuming project might use a path like
15
+ `@supports docs/stories/010.0-PAYMENTS.story.md#REQ-PAYMENTS-REFUND`
16
+ to indicate that a given function supports a particular requirement from a payments story document within that project’s own `docs/stories` tree. For a detailed explanation of `@supports` behavior and validation, see [Migration Guide](migration-guide.md) (section **3.1 Multi-story @supports annotations**). Additional background on multi-story semantics is available in the project’s internal rule documentation, which is intended for maintainers rather than end users.
17
17
 
18
- The `prefer-implements-annotation` rule is an **opt-in migration helper** that is disabled by default and **not** part of any built-in preset. It can be enabled and given a severity like `"warn"` or `"error"` using normal ESLint rule configuration when you want to gradually encourage multi-story `@implements` usage. For rule details and migration guidance, see `docs/rules/prefer-implements-annotation.md`.
18
+ The `prefer-implements-annotation` rule is an **opt-in migration helper** that is disabled by default and **not** part of any built-in preset. It can be enabled and given a severity like `"warn"` or `"error"` using normal ESLint rule configuration when you want to gradually encourage multi-story `@supports` usage. Detailed behavior and migration guidance are documented in the project’s internal rule documentation, which is targeted at maintainers; typical end users can rely on the high-level guidance in this API reference and the [Migration Guide](migration-guide.md).
19
19
 
20
20
  ### traceability/require-story-annotation
21
21
 
22
- Description: Ensures every function declaration has a JSDoc comment with an `@story` annotation referencing the related user story. When you adopt multi-story `@implements` annotations as described in `docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md` and `REQ-REQUIRE-ACCEPTS-IMPLEMENTS`, this rule also accepts `@implements` as an alternative way to prove story coverage, so either `@story` or at least one `@implements` tag will satisfy the presence check. When run with `--fix`, the rule inserts a single-line placeholder JSDoc `@story` annotation above missing functions, methods, TypeScript declare functions, and interface method signatures using a built-in template aligned with Story 008.0. This template is currently fixed but structured for future configurability, and fixes are strictly limited to adding this placeholder annotation without altering the function body or changing any runtime behavior. Selective enabling of different auto-fix behaviors (such as applying fixes only to certain scopes or node types) is planned for a future version.
22
+ Description: Ensures every function declaration has a JSDoc comment with an `@story` annotation referencing the related user story. When you adopt multi-story `@supports` annotations, this rule also accepts `@supports` as an alternative way to prove story coverage, so either `@story` or at least one `@supports` tag will satisfy the presence check. When run with `--fix`, the rule inserts a single-line placeholder JSDoc `@story` annotation above missing functions, methods, TypeScript declare functions, and interface method signatures using a built-in template aligned with Story 008.0. This template is currently fixed but structured for future configurability, and fixes are strictly limited to adding this placeholder annotation without altering the function body or changing any runtime behavior. Selective enabling of different auto-fix behaviors (such as applying fixes only to certain scopes or node types) is planned for a future version.
23
23
 
24
24
  Options:
25
25
 
@@ -41,7 +41,7 @@ function initAuth() {
41
41
 
42
42
  ### traceability/require-req-annotation
43
43
 
44
- Description: Ensures that function-like constructs consistently declare their linked requirement using an `@req` annotation in JSDoc. The rule targets the same function-like node types as `traceability/require-story-annotation` (standard function declarations, non-arrow function expressions used as callbacks or assignments, class/object methods, TypeScript declare functions, and interface method signatures), and enforces that each of them has at least one `@req` tag in the nearest associated JSDoc comment. When you adopt multi-story `@implements` annotations as described in `docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md` and `REQ-REQUIRE-ACCEPTS-IMPLEMENTS`, this rule also treats `@implements story-path REQ-ID...` tags as satisfying the requirement coverage check, although deep verification of requirement IDs continues to be handled by `traceability/valid-req-reference`. Arrow functions (`ArrowFunctionExpression`) are not currently checked by this rule.
44
+ Description: Ensures that function-like constructs consistently declare their linked requirement using an `@req` annotation in JSDoc. The rule targets the same function-like node types as `traceability/require-story-annotation` (standard function declarations, non-arrow function expressions used as callbacks or assignments, class/object methods, TypeScript declare functions, and interface method signatures), and enforces that each of them has at least one `@req` tag in the nearest associated JSDoc comment. When you adopt multi-story `@supports` annotations, this rule also treats `@supports story-path REQ-ID...` tags as satisfying the requirement coverage check, although deep verification of requirement IDs continues to be handled by `traceability/valid-req-reference`. Arrow functions (`ArrowFunctionExpression`) are not currently checked by this rule.
45
45
 
46
46
  This rule is typically used alongside `traceability/require-story-annotation` so that each function-level traceability block includes both an `@story` and an `@req` annotation, but it can also be enabled independently if you only want to enforce requirement linkage. Unlike `traceability/require-story-annotation`, this rule does not currently provide an auto-fix mode for inserting placeholder `@req` annotations; it only reports missing or malformed requirement annotations on the configured scopes.
47
47
 
@@ -90,11 +90,11 @@ Options:
90
90
  This rule accepts an optional configuration object. The primary configuration shape is **nested**:
91
91
 
92
92
  - `story` (object, optional) – Configuration for `@story` values.
93
- - `pattern` (string, optional) – A JavaScript regular expression **source** (without leading and trailing `/`) that all `@story` values must match. If provided, the rule validates each `@story` against this pattern in addition to its built‑in structural checks. Defaults to the value returned by `getDefaultStoryPattern()`, which is equivalent to `^docs/stories/.*\.story\.md$`, aligning with the standard `docs/stories/<name>.story.md` convention.
94
- - `example` (string, optional) – A short example `@story` path shown in error messages when `story.pattern` is configured. Defaults to the value returned by `getDefaultStoryExample()`, `"docs/stories/001.0-EXAMPLE.story.md"`. This value is used **only** for guidance and does not affect validation.
93
+ - `pattern` (string, optional) – A JavaScript regular expression **source** (without leading and trailing `/`) that all `@story` values must match. If provided, the rule validates each `@story` against this pattern in addition to its built‑in structural checks. By default, the plugin uses a pattern equivalent to `^docs/stories/.*\.story\.md$`, which matches a typical project convention such as `docs/stories/<name>.story.md`; you can override this to match however your own project organizes story files.
94
+ - `example` (string, optional) – A short example `@story` path shown in error messages when `story.pattern` is configured. The built-in default example is `"docs/stories/001.0-EXAMPLE.story.md"`, intended as a generic illustration of a project story file, and does not refer to this plugin’s internal documentation.
95
95
  - `req` (object, optional) – Configuration for `@req` values.
96
96
  - `pattern` (string, optional) – A JavaScript regular expression **source** (without leading and trailing `/`) that all `@req` values must match. If provided, the rule validates each `@req` identifier against this pattern. Defaults to the value returned by `getDefaultReqPattern()`, which is equivalent to `^REQ-[A-Z0-9_-]+$`, matching IDs such as `REQ-USER-AUTH` or `REQ-1234`.
97
- - `example` (string, optional) – A short example requirement ID shown in error messages when `req.pattern` is configured. Defaults to the value returned by `getDefaultReqExample()`, `"REQ-USER-AUTH"`. This is purely informational and does not participate in matching.
97
+ - `example` (string, optional) – A short example requirement ID shown in error messages when `req.pattern` is configured. Defaults to the value returned by `getDefaultReqExample()`, `"REQ-USER-AUTH"`. This value is used **only** for guidance and does not affect validation.
98
98
 
99
99
  For backward compatibility, the rule also supports **flat shorthand** fields that map directly to the nested properties:
100
100
 
@@ -114,13 +114,10 @@ Behavior notes:
114
114
  The `valid-annotation-format` rule is intentionally **backward compatible** with existing code that only uses `@story` and `@req`. You can:
115
115
 
116
116
  - Continue using `@story` + `@req` for single-story functions and modules.
117
- - Introduce `@implements` incrementally for integration code that implements requirements from multiple stories.
117
+ - Introduce `@supports` incrementally for integration code that implements requirements from multiple stories.
118
118
  - Mix both styles in the same comment block when needed; the rule validates the format of each annotation independently.
119
119
 
120
- Deep requirement checking for both `@req` and `@implements` is handled by the `valid-req-reference` rule in the plugin's internal docs. For step-by-step guidance on when and how to migrate, see:
121
-
122
- - **Migration guide:** [Migration Guide](migration-guide.md) (section **3.1 Multi-story `@implements` annotations**)
123
- - **Rule docs:** The `valid-annotation-format` and `valid-req-reference` rule documentation in the plugin's internal docs.
120
+ Deep requirement checking for both `@req` and `@supports` is handled by the `valid-req-reference` rule in the plugin's internal docs. Advanced edge cases and internal semantics are mainly of interest to maintainers; typical end users can rely on the options and examples in this API reference when configuring the rule for their projects.
124
121
 
125
122
  Default Severity: `error`
126
123
  Example:
@@ -201,7 +198,7 @@ The plugin provides two built-in presets for easy configuration:
201
198
  Enables the **six core traceability rules** with severities tuned for common usage (most at `error`, with
202
199
  `traceability/valid-annotation-format` at `warn` to reduce noise). This `warn` level for `traceability/valid-annotation-format` is intentional to keep early adoption noise low, but you can safely raise it to `error` in projects that want strict enforcement of annotation formatting.
203
200
 
204
- The `prefer-implements-annotation` migration rule is **not included** in this (or any) preset and remains disabled by default. If you want to encourage or enforce multi-story `@implements` annotations, you must enable `traceability/prefer-implements-annotation` explicitly in your ESLint configuration and choose an appropriate severity (for example, `"warn"` during migration or `"error"` once fully adopted).
201
+ The `prefer-implements-annotation` migration rule is **not included** in this (or any) preset and remains disabled by default. If you want to encourage or enforce multi-story `@supports` annotations, you must enable `traceability/prefer-implements-annotation` explicitly in your ESLint configuration and choose an appropriate severity (for example, `"warn"` during migration or `"error"` once fully adopted).
205
202
 
206
203
  Core rules enabled by the `recommended` preset:
207
204
 
@@ -37,29 +37,29 @@ export default [traceability.configs.recommended];
37
37
  - `valid-req-reference` rejects path traversal (`../`) and absolute paths (`/etc/passwd`).
38
38
  - `valid-annotation-format` enforces correct JSDoc traceability annotation syntax (`@story` and `@req` tags).
39
39
 
40
- Review and update your existing annotations accordingly:
40
+ The following diff shows a typical migration in **your own project**, where `docs/stories/001.0-DEV-PLUGIN-SETUP.story.md` is an example of a story file path from your documentation tree:
41
41
 
42
42
  ```diff
43
43
  - /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.md */
44
44
  + /** @story docs/stories/001.0-DEV-PLUGIN-SETUP.story.md */
45
45
  ```
46
46
 
47
- ### 3.1 Multi-story `@implements` annotations
47
+ ### 3.1 Multi-story `@supports` annotations
48
48
 
49
- Starting in v1.x, `eslint-plugin-traceability` supports an additional annotation form for integration code that implements requirements from multiple stories:
49
+ Starting in v1.x, `eslint-plugin-traceability` supports an additional annotation form for integration code that implements requirements from multiple stories in a consuming project. The following snippet shows one example of how you might structure such an annotation in **your** codebase:
50
50
 
51
51
  ```js
52
52
  /**
53
- * @implements docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md REQ-IMPLEMENTS-PARSE REQ-IMPLEMENTS-VALIDATE
53
+ * @supports docs/stories/010.2-DEV-MULTI-STORY-SUPPORT.story.md REQ-IMPLEMENTS-PARSE REQ-IMPLEMENTS-VALIDATE
54
54
  */
55
55
  function integrate() {}
56
56
  ```
57
57
 
58
- You **do not** need to change existing, single-story annotations that already use `@story` and `@req`. Migration to `@implements` is only recommended when a function or module genuinely implements requirements from more than one story file.
58
+ You **do not** need to change existing, single-story annotations that already use `@story` and `@req`. Migration to `@supports` is only recommended when a function or module genuinely implements requirements from more than one story file.
59
59
 
60
60
  #### Optional `prefer-implements-annotation` migration rule
61
61
 
62
- For teams that want to gradually migrate from `@story` + `@req` to `@implements`, the plugin provides an optional rule: `traceability/prefer-implements-annotation`.
62
+ For teams that want to gradually migrate from `@story` + `@req` to `@supports`, the plugin provides an optional rule: `traceability/prefer-implements-annotation`.
63
63
 
64
64
  - This rule is **disabled by default** and is **not** included in any built-in presets.
65
65
  - You can enable it with any standard ESLint severity (`"off"`, `"warn"`, or `"error"`) in your config, for example:
@@ -73,8 +73,8 @@ For teams that want to gradually migrate from `@story` + `@req` to `@implements`
73
73
  }
74
74
  ```
75
75
 
76
- - When enabled, it offers **conservative auto-fixes** that rewrite eligible `@story` + `@req` combinations into equivalent `@implements` lines, without attempting risky or ambiguous transformations.
77
- - Detailed behavior, limitations, and examples are documented in `docs/rules/prefer-implements-annotation.md`.
76
+ - When enabled, it offers **conservative auto-fixes** that rewrite eligible `@story` + `@req` combinations into equivalent `@supports` lines, without attempting risky or ambiguous transformations.
77
+ - Detailed behavior, limitations, and examples are documented in the project’s internal rule documentation, which is primarily intended for maintainers; most users can rely on this guide and the API reference for day-to-day usage.
78
78
 
79
79
  #### When to keep `@story` + `@req`
80
80
 
@@ -84,7 +84,7 @@ Keep your current annotations if:
84
84
  - All relevant requirements live in that story file.
85
85
  - You do not need to distinguish which story a particular requirement ID comes from.
86
86
 
87
- Example (no migration required):
87
+ Example (no migration required). Here, `docs/stories/003.0-DEV-FUNCTION-ANNOTATIONS.story.md` is an illustrative path representing a typical story file location in **your** documentation structure:
88
88
 
89
89
  ```js
90
90
  /**
@@ -96,15 +96,15 @@ export function initAuth() {
96
96
  }
97
97
  ```
98
98
 
99
- #### When to introduce `@implements`
99
+ #### When to introduce `@supports`
100
100
 
101
- Adopt `@implements` for **multi-story integration** code, especially when:
101
+ Adopt `@supports` for **multi-story integration** code, especially when:
102
102
 
103
103
  - The function combines behavior governed by **multiple** stories.
104
104
  - Requirement IDs are reused across stories (for example, `REQ-SHARED-ID` appears in more than one story file).
105
105
  - You want deep validation (via `valid-req-reference`) to know **which story file** each requirement came from.
106
106
 
107
- Before (single-story annotations trying to describe multi-story behavior):
107
+ Before (single-story annotations trying to describe multi-story behavior). The story path shown here is an example of how you might name and organize a story file in your own project:
108
108
 
109
109
  ```js
110
110
  /**
@@ -118,7 +118,7 @@ export async function applyFilters(rows, options) {
118
118
  }
119
119
  ```
120
120
 
121
- After (multi-story `@implements`), aligned with Story 010.2:
121
+ After (multi-story `@supports`), using illustrative story paths that represent typical files in your project’s documentation tree (they are examples, not files provided by this plugin):
122
122
 
123
123
  ```js
124
124
  /**
@@ -127,8 +127,8 @@ After (multi-story `@implements`), aligned with Story 010.2:
127
127
  * @req REQ-AGE-THRESHOLD
128
128
  * @req REQ-OUTPUT
129
129
  *
130
- * @implements docs/stories/003.0-DEV-IDENTIFY-OUTDATED.story.md REQ-AGE-THRESHOLD REQ-OUTPUT
131
- * @implements docs/stories/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md REQ-AUDIT-CHECK REQ-SAFE-ONLY
130
+ * @supports docs/stories/003.0-DEV-IDENTIFY-OUTDATED.story.md REQ-AGE-THRESHOLD REQ-OUTPUT
131
+ * @supports docs/stories/004.0-DEV-FILTER-VULNERABLE-VERSIONS.story.md REQ-AUDIT-CHECK REQ-SAFE-ONLY
132
132
  */
133
133
  export async function applyFilters(rows, options) {
134
134
  // combined behavior
@@ -137,19 +137,19 @@ export async function applyFilters(rows, options) {
137
137
 
138
138
  In the "after" example:
139
139
 
140
- - `valid-annotation-format` ensures the `@implements` lines use a valid story path and requirement ID format.
141
- - `valid-req-reference` validates that each requirement listed after `@implements` exists in the corresponding story file.
140
+ - `valid-annotation-format` ensures the `@supports` lines use a valid story path and requirement ID format.
141
+ - `valid-req-reference` validates that each requirement listed after `@supports` exists in the corresponding story file.
142
142
 
143
143
  #### Mixed usage during migration
144
144
 
145
- You can introduce `@implements` gradually without breaking existing code:
145
+ You can introduce `@supports` gradually without breaking existing code:
146
146
 
147
147
  1. Leave existing `@story` and `@req` annotations in place.
148
- 2. Add `@implements` lines that group requirements by story file.
148
+ 2. Add `@supports` lines that group requirements by story file.
149
149
  3. Run ESLint with `traceability/valid-annotation-format` and `traceability/valid-req-reference` enabled to confirm everything passes.
150
- 4. Optionally, once you are comfortable, standardize on using `@implements` for multi-story integration functions while keeping `@story` + `@req` for simple, single-story code.
150
+ 4. Optionally, once you are comfortable, standardize on using `@supports` for multi-story integration functions while keeping `@story` + `@req` for simple, single-story code.
151
151
 
152
- For detailed semantics and edge cases (path validation, scoped requirement IDs, and multi-story fixtures), see the valid-annotation-format and valid-req-reference rule documentation and the multi-story support story in the project documentation.
152
+ Detailed semantics and edge cases (path validation, scoped requirement IDs, and multi-story fixtures) are ultimately governed by your own stories and requirements. For typical migrations, this guide together with the plugin’s API reference is sufficient.
153
153
 
154
154
  ## 4. Test and Validate
155
155