@yegor256/dogent 0.12.3 → 0.12.4
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.
- package/package.json +1 -1
- package/src/rules/description-voice.js +23 -5
- package/src/version.js +2 -2
package/package.json
CHANGED
|
@@ -20,7 +20,11 @@ const Region = require('../region');
|
|
|
20
20
|
* Distinct from description-triggers, which checks that a "when" clause
|
|
21
21
|
* exists, and from description-length, which checks the size; this one
|
|
22
22
|
* checks the grammatical voice. Its prompt hands subtler voice
|
|
23
|
-
* judgement to the AI oracle.
|
|
23
|
+
* judgement to the AI oracle. A deterministic guard then drops any
|
|
24
|
+
* oracle flag that lands off the frontmatter description row, or on that
|
|
25
|
+
* row when the deterministic pronoun check finds nothing, so the oracle
|
|
26
|
+
* stays bound to the same single line and vocabulary the standalone
|
|
27
|
+
* checker enforces.
|
|
24
28
|
*/
|
|
25
29
|
class DescriptionVoice {
|
|
26
30
|
constructor() {
|
|
@@ -38,6 +42,23 @@ class DescriptionVoice {
|
|
|
38
42
|
if (uri.replace(/^.*\//u, '') !== 'SKILL.md') {
|
|
39
43
|
return [];
|
|
40
44
|
}
|
|
45
|
+
const pair = this.description(document);
|
|
46
|
+
if (pair === null) {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return this.judge(pair, uri);
|
|
50
|
+
}
|
|
51
|
+
suppress(violation, document) {
|
|
52
|
+
if (violation.rule !== this.id) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
const pair = this.description(document);
|
|
56
|
+
if (pair === null || violation.spot.line() !== pair.row) {
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
return this.judge(pair, document.uri()).length === 0;
|
|
60
|
+
}
|
|
61
|
+
description(document) {
|
|
41
62
|
const pairs = document.walk({
|
|
42
63
|
header: () => [],
|
|
43
64
|
prose: () => [],
|
|
@@ -46,10 +67,7 @@ class DescriptionVoice {
|
|
|
46
67
|
frontmatter: (keys) => keys
|
|
47
68
|
});
|
|
48
69
|
const found = pairs.filter((pair) => pair.key === 'description');
|
|
49
|
-
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
return this.judge(found[0], uri);
|
|
70
|
+
return found.length === 0 ? null : found[0];
|
|
53
71
|
}
|
|
54
72
|
judge(pair, uri) {
|
|
55
73
|
const text = pair.value.replace(/use when.*$/isu, '');
|
package/src/version.js
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* Version.
|
|
10
10
|
*
|
|
11
11
|
* The current release of dogent, replaced on every release by rultor.
|
|
12
|
-
* The default `0.12.
|
|
12
|
+
* The default `0.12.4` marks an unreleased build straight from source.
|
|
13
13
|
*/
|
|
14
|
-
const version = '0.12.
|
|
14
|
+
const version = '0.12.4';
|
|
15
15
|
|
|
16
16
|
module.exports = version;
|