@yegor256/dogent 0.12.0 → 0.12.1

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 CHANGED
@@ -40,7 +40,7 @@
40
40
  "lint": "eslint .",
41
41
  "test": "mocha 'test/**/*.js' --timeout 60000"
42
42
  },
43
- "version": "0.12.0",
43
+ "version": "0.12.1",
44
44
  "dependencies": {
45
45
  "minimist": "^1.2.8",
46
46
  "pretty-ms": "^7.0.1"
package/src/defaults.js CHANGED
@@ -40,7 +40,12 @@ class Defaults {
40
40
  .split('\n')
41
41
  .map((line) => line.trim())
42
42
  .filter((line) => line !== '' && !line.startsWith('#'))
43
- .flatMap((line) => line.split(/\s+/u));
43
+ .flatMap((line) => {
44
+ const separator = line.search(/\s/u);
45
+ return separator < 0
46
+ ? [line]
47
+ : [line.slice(0, separator), line.slice(separator).trimStart()];
48
+ });
44
49
  }
45
50
  }
46
51
 
@@ -61,7 +61,7 @@ class DeadImport {
61
61
  return 'Fix or remove the @path import so it points to a real file, and break any circular or overly deep import chain the host tool cannot resolve.';
62
62
  }
63
63
  prompt() {
64
- return `${this.id}: flag any @path/to/file import that points to no file on disk`;
64
+ return `${this.id}: flag any @path/to/file import that points to no file on disk; only an @-prefixed token counts as an import, so never treat a bare path in prose as one`;
65
65
  }
66
66
  violations(document) {
67
67
  const uri = document.uri();
@@ -48,6 +48,8 @@ const defined = (masked) => {
48
48
  while (hit !== null) {
49
49
  if (hit.groups.acronym) {
50
50
  found.add(hit.groups.acronym);
51
+ } else if (/^[A-Z]{2,}$/u.test(hit.groups.gloss)) {
52
+ found.add(hit.groups.gloss);
51
53
  } else {
52
54
  found.add(initials(hit.groups.gloss));
53
55
  }
@@ -64,10 +66,11 @@ const undefining = (acronym, scope) => !scope.known.has(acronym) &&
64
66
  *
65
67
  * Flags an acronym that lands in prose without ever being expanded. An
66
68
  * acronym counts as defined when the document, anywhere, follows it with
67
- * a parenthetical gloss, as in "RBAC (role-based access control)", or when
69
+ * a parenthetical gloss, as in "RBAC (role-based access control)", when
68
70
  * a parenthetical's word initials spell it, as in "AAA pattern
69
- * (Arrange-Act-Assert)", so a single expansion licenses every later
70
- * mention. Well-known acronyms sit
71
+ * (Arrange-Act-Assert)", or when the expansion precedes a parenthetical
72
+ * acronym, as in "Virtual Private Network (VPN)", so a single expansion
73
+ * licenses every later mention. Well-known acronyms sit
71
74
  * in a built-in allowlist and pass untouched. Only the first unexpanded
72
75
  * occurrence of each acronym is reported. Its prompt hands non-acronym
73
76
  * domain jargon, the rare nouns a reader cannot parse, to the AI oracle.
@@ -19,7 +19,8 @@ const mask = require('../mask');
19
19
  * "Only use real data" beats "Don't use mock data". Its prompt hands
20
20
  * subtler bans, those carrying no head keyword, to the AI
21
21
  * oracle, which rewrites a prohibition with no keyword as a positive
22
- * command.
22
+ * command. The prompt demands an actual negation before flagging, so
23
+ * an affirmative imperative that already states what to do stays clean.
23
24
  */
24
25
  class Positive {
25
26
  constructor() {
@@ -29,7 +30,7 @@ class Positive {
29
30
  return 'Rewrite a prohibition as a positive imperative stating what to do, since a ban forces the model to process the forbidden idea first.';
30
31
  }
31
32
  prompt() {
32
- return `${this.id}: flag any instruction phrased as a prohibition, including bans carrying no fixed keyword, and rewrite each as a positive imperative`;
33
+ return `${this.id}: flag an instruction only when it forbids or negates an action, including a ban that carries no fixed keyword, and rewrite each as a positive imperative; leave an affirmative imperative that already states what to do untouched, returning nothing for it`;
33
34
  }
34
35
  violations(document) {
35
36
  const uri = document.uri();
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.0` marks an unreleased build straight from source.
12
+ * The default `0.12.1` marks an unreleased build straight from source.
13
13
  */
14
- const version = '0.12.0';
14
+ const version = '0.12.1';
15
15
 
16
16
  module.exports = version;