@yegor256/dogent 0.6.0 → 0.6.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/README.md +2 -2
- package/package.json +1 -1
- package/src/rules/empty.js +4 -1
- package/src/rules/index.js +2 -0
- package/src/rules/redundant.js +92 -0
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ In short: `agnix` lints the harness, `dogent` lints the prompt.
|
|
|
29
29
|
Run it on any manifesto file, no installation required:
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
-
npx @yegor256/dogent@0.
|
|
32
|
+
npx @yegor256/dogent@0.6.0 CLAUDE.md
|
|
33
33
|
```
|
|
34
34
|
|
|
35
35
|
Lint several files at once:
|
|
@@ -150,7 +150,7 @@ Reference `dogent` as a remote hook in `.pre-commit-config.yaml`:
|
|
|
150
150
|
```yaml
|
|
151
151
|
repos:
|
|
152
152
|
- repo: https://github.com/yegor256/dogent
|
|
153
|
-
rev: 0.
|
|
153
|
+
rev: 0.6.0
|
|
154
154
|
hooks:
|
|
155
155
|
- id: dogent
|
|
156
156
|
```
|
package/package.json
CHANGED
package/src/rules/empty.js
CHANGED
|
@@ -15,13 +15,16 @@ const Region = require('../region');
|
|
|
15
15
|
* A heading is empty when it is immediately followed by another
|
|
16
16
|
* heading or by end-of-file — no prose, bullets, or snippet sits
|
|
17
17
|
* between them.
|
|
18
|
+
*
|
|
19
|
+
* The check is standalone and deterministic, so prompt() returns an
|
|
20
|
+
* empty string and the AI oracle never re-checks this rule.
|
|
18
21
|
*/
|
|
19
22
|
class Empty {
|
|
20
23
|
constructor() {
|
|
21
24
|
this.id = 'empty';
|
|
22
25
|
}
|
|
23
26
|
prompt() {
|
|
24
|
-
return
|
|
27
|
+
return '';
|
|
25
28
|
}
|
|
26
29
|
violations(document) {
|
|
27
30
|
const uri = document.uri();
|
package/src/rules/index.js
CHANGED
|
@@ -15,6 +15,7 @@ const Command = require('./command');
|
|
|
15
15
|
const Punctuation = require('./punctuation');
|
|
16
16
|
const Frontmatter = require('./frontmatter');
|
|
17
17
|
const DeadImport = require('./dead-import');
|
|
18
|
+
const Redundant = require('./redundant');
|
|
18
19
|
|
|
19
20
|
module.exports = () => [
|
|
20
21
|
new Grouped(),
|
|
@@ -26,6 +27,7 @@ module.exports = () => [
|
|
|
26
27
|
new Command(),
|
|
27
28
|
new Punctuation(),
|
|
28
29
|
new DeadImport(),
|
|
30
|
+
new Redundant(),
|
|
29
31
|
new Frontmatter(
|
|
30
32
|
'SKILL.md',
|
|
31
33
|
['name', 'description'],
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* SPDX-FileCopyrightText: Copyright (c) 2026 Yegor Bugayenko
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use strict';
|
|
7
|
+
|
|
8
|
+
const Violation = require('../violation');
|
|
9
|
+
const Region = require('../region');
|
|
10
|
+
|
|
11
|
+
const PHRASES = [
|
|
12
|
+
'be helpful',
|
|
13
|
+
'be helpful and accurate',
|
|
14
|
+
'be accurate',
|
|
15
|
+
'be concise',
|
|
16
|
+
'be clear',
|
|
17
|
+
'be polite',
|
|
18
|
+
'be professional',
|
|
19
|
+
'write clean code',
|
|
20
|
+
'write good code',
|
|
21
|
+
'write readable code',
|
|
22
|
+
'write maintainable code',
|
|
23
|
+
'follow best practices',
|
|
24
|
+
'follow industry best practices',
|
|
25
|
+
'use best practices',
|
|
26
|
+
'apply best practices',
|
|
27
|
+
'use meaningful variable names',
|
|
28
|
+
'use descriptive variable names',
|
|
29
|
+
'use good variable names',
|
|
30
|
+
'handle errors properly',
|
|
31
|
+
'handle errors gracefully',
|
|
32
|
+
'handle exceptions properly',
|
|
33
|
+
'avoid bugs',
|
|
34
|
+
'avoid mistakes',
|
|
35
|
+
'think step by step',
|
|
36
|
+
'do your best',
|
|
37
|
+
'try your best',
|
|
38
|
+
'pay attention to detail'
|
|
39
|
+
];
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Redundant.
|
|
43
|
+
*
|
|
44
|
+
* Flags a line that restates default model behavior, like
|
|
45
|
+
* "Be helpful and accurate" or "Write clean code". Such filler
|
|
46
|
+
* burns the context budget and drowns the project-specific
|
|
47
|
+
* guidance the manifesto exists to carry.
|
|
48
|
+
*
|
|
49
|
+
* @todo #15:60min Promote the standalone heuristic into a
|
|
50
|
+
* proper AI-oracle check when `OPENAI_API_KEY` is present, so
|
|
51
|
+
* redundancy detection covers paraphrases beyond the curated
|
|
52
|
+
* blacklist below. The hybrid pattern from `src/rules/command.js`
|
|
53
|
+
* is the model: keep the deterministic check as the default,
|
|
54
|
+
* let the oracle catch the rest.
|
|
55
|
+
*/
|
|
56
|
+
class Redundant {
|
|
57
|
+
constructor(phrases = PHRASES) {
|
|
58
|
+
this.id = 'redundant';
|
|
59
|
+
this.phrases = phrases;
|
|
60
|
+
}
|
|
61
|
+
prompt() {
|
|
62
|
+
return `${this.id}: flag any line that restates default agent behavior already known to the model, not a project-specific instruction`;
|
|
63
|
+
}
|
|
64
|
+
violations(document) {
|
|
65
|
+
const uri = document.uri();
|
|
66
|
+
return document.walk({
|
|
67
|
+
header: () => [],
|
|
68
|
+
prose: (text, line) => this.judge(text, line, uri),
|
|
69
|
+
snippet: () => [],
|
|
70
|
+
bullets: () => [],
|
|
71
|
+
frontmatter: () => []
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
judge(text, line, uri) {
|
|
75
|
+
const clean = text
|
|
76
|
+
.replace(/^\s*(?:[-*+]|\d+\.)\s+/u, '')
|
|
77
|
+
.replace(/[.!?]+\s*$/u, '')
|
|
78
|
+
.trim()
|
|
79
|
+
.toLowerCase();
|
|
80
|
+
if (!this.phrases.includes(clean)) {
|
|
81
|
+
return [];
|
|
82
|
+
}
|
|
83
|
+
return [new Violation(
|
|
84
|
+
this.id,
|
|
85
|
+
'error',
|
|
86
|
+
'generic instruction, model already knows this',
|
|
87
|
+
new Region(uri, line, 1)
|
|
88
|
+
)];
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = Redundant;
|