@gobing-ai/ts-rule-engine 0.3.21 → 0.3.22

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.
@@ -73,19 +73,31 @@ function findExports(lines, requested) {
73
73
  /**
74
74
  * True when a JSDoc block precedes a declaration.
75
75
  *
76
- * Skips decorator lines (`@Component(...)`) so a documented but decorated class
77
- * is not falsely flagged, then checks whether the nearest preceding non-decorator
78
- * line closes (or is) a JSDoc comment.
76
+ * Walks backward from the line before the declaration, skipping blank lines,
77
+ * JSDoc body lines (`* …`), and decorator / JSDoc-tag lines (`@…`), then
78
+ * checks whether the nearest meaningful line closes (or is) a JSDoc comment.
79
79
  */
80
80
  function precededByJsdoc(lines, declarationLine) {
81
81
  let cursor = declarationLine - 2; // zero-based line above the declaration
82
82
  while (cursor >= 0) {
83
83
  const prev = lines[cursor]?.trim() ?? '';
84
- if (prev.startsWith('@')) {
85
- cursor -= 1; // decorator — keep walking up
84
+ // Blank line between JSDoc closing fence and declaration — keep walking.
85
+ if (prev === '') {
86
+ cursor -= 1;
86
87
  continue;
87
88
  }
88
- return prev.endsWith('*/') || prev.startsWith('/**');
89
+ // JSDoc closing or single-line fence — found it.
90
+ if (prev.endsWith('*/') || prev.startsWith('/**')) {
91
+ return true;
92
+ }
93
+ // JSDoc body line (* …) or decorator / tag (@…). Check after the
94
+ // fence so `*/` is never misidentified as a body line.
95
+ if (prev.startsWith('*') || prev.startsWith('@')) {
96
+ cursor -= 1;
97
+ continue;
98
+ }
99
+ // Non-JSDoc, non-decorator line — no JSDoc precedes this declaration.
100
+ return false;
89
101
  }
90
102
  return false;
91
103
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gobing-ai/ts-rule-engine",
3
- "version": "0.3.21",
3
+ "version": "0.3.22",
4
4
  "description": "@gobing-ai/ts-rule-engine — Constraint rule schemas, loading, evaluation, and result formatting.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -49,10 +49,10 @@
49
49
  "release": "echo 'Manual publish is disabled. Releases go through GitHub Actions via Trusted Publishing — push a tag: git tag @gobing-ai/ts-rule-engine-v<version> && git push --tags' && exit 1"
50
50
  },
51
51
  "dependencies": {
52
- "@gobing-ai/ts-ai-runner": "^0.3.21",
53
- "@gobing-ai/ts-infra": "^0.3.21",
54
- "@gobing-ai/ts-runtime": "^0.3.21",
55
- "@gobing-ai/ts-db": "^0.3.21",
52
+ "@gobing-ai/ts-ai-runner": "^0.3.22",
53
+ "@gobing-ai/ts-infra": "^0.3.22",
54
+ "@gobing-ai/ts-runtime": "^0.3.22",
55
+ "@gobing-ai/ts-db": "^0.3.22",
56
56
  "yaml": "^2.7.0",
57
57
  "zod": "^4.1.0"
58
58
  },
@@ -96,19 +96,31 @@ function findExports(lines: string[], requested: ReadonlySet<ExportKind>): Expor
96
96
  /**
97
97
  * True when a JSDoc block precedes a declaration.
98
98
  *
99
- * Skips decorator lines (`@Component(...)`) so a documented but decorated class
100
- * is not falsely flagged, then checks whether the nearest preceding non-decorator
101
- * line closes (or is) a JSDoc comment.
99
+ * Walks backward from the line before the declaration, skipping blank lines,
100
+ * JSDoc body lines (`* …`), and decorator / JSDoc-tag lines (`@…`), then
101
+ * checks whether the nearest meaningful line closes (or is) a JSDoc comment.
102
102
  */
103
103
  function precededByJsdoc(lines: string[], declarationLine: number): boolean {
104
104
  let cursor = declarationLine - 2; // zero-based line above the declaration
105
105
  while (cursor >= 0) {
106
106
  const prev = lines[cursor]?.trim() ?? '';
107
- if (prev.startsWith('@')) {
108
- cursor -= 1; // decorator — keep walking up
107
+ // Blank line between JSDoc closing fence and declaration — keep walking.
108
+ if (prev === '') {
109
+ cursor -= 1;
109
110
  continue;
110
111
  }
111
- return prev.endsWith('*/') || prev.startsWith('/**');
112
+ // JSDoc closing or single-line fence — found it.
113
+ if (prev.endsWith('*/') || prev.startsWith('/**')) {
114
+ return true;
115
+ }
116
+ // JSDoc body line (* …) or decorator / tag (@…). Check after the
117
+ // fence so `*/` is never misidentified as a body line.
118
+ if (prev.startsWith('*') || prev.startsWith('@')) {
119
+ cursor -= 1;
120
+ continue;
121
+ }
122
+ // Non-JSDoc, non-decorator line — no JSDoc precedes this declaration.
123
+ return false;
112
124
  }
113
125
  return false;
114
126
  }