@yegor256/dogent 0.8.0 → 0.9.0

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 CHANGED
@@ -64,6 +64,7 @@ The command exits with a non-zero status when problems are found,
64
64
  - Every line must be an instruction.
65
65
  - Instructions must be grouped in sections.
66
66
  - Section names must be short, 1-3 words.
67
+ - Every section must be a level-2 (`##`) heading, below the lone `#` title.
67
68
  - Every line must be no longer than 80 symbols.
68
69
  - The whole file must stay under 4000 tokens.
69
70
  - Every line must sound like a command.
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.8.0",
43
+ "version": "0.9.0",
44
44
  "dependencies": {
45
45
  "minimist": "^1.2.8"
46
46
  }
@@ -28,11 +28,13 @@ const Passive = require('./passive');
28
28
  const Unique = require('./unique');
29
29
  const Consistent = require('./consistent');
30
30
  const Simple = require('./simple');
31
+ const SectionLevel = require('./section-level');
31
32
 
32
33
  module.exports = () => [
33
34
  new Grouped(),
34
35
  new Empty(),
35
36
  new ShortSections(),
37
+ new SectionLevel(),
36
38
  new LineLength(80),
37
39
  new TokenCount(4000),
38
40
  new NoArticles(),
@@ -0,0 +1,55 @@
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
+ /**
12
+ * SectionLevel.
13
+ *
14
+ * Demands that every section sit at the second level, marked by two
15
+ * hashes. A lone top-level title may open the file, but any later
16
+ * first-level heading or any deeper sub-heading breaks the flat shape
17
+ * a manifesto must keep.
18
+ *
19
+ * The check is standalone and deterministic, so prompt() returns an
20
+ * empty string and the AI oracle never re-checks this rule.
21
+ */
22
+ class SectionLevel {
23
+ constructor() {
24
+ this.id = 'section-level';
25
+ }
26
+ prompt() {
27
+ return '';
28
+ }
29
+ violations(document) {
30
+ const uri = document.uri();
31
+ return document
32
+ .walk({
33
+ header: (text, line, depth) => [{line, depth}],
34
+ prose: () => [],
35
+ snippet: () => [],
36
+ bullets: () => [],
37
+ frontmatter: () => []
38
+ })
39
+ .map((header, index) => this.leveled(header, index, uri))
40
+ .flat();
41
+ }
42
+ leveled(header, index, uri) {
43
+ if (header.depth === 2 || header.depth === 1 && index === 0) {
44
+ return [];
45
+ }
46
+ return [new Violation(
47
+ this.id,
48
+ 'error',
49
+ `section must be a level-2 heading, found ${header.depth}`,
50
+ new Region(uri, header.line, 1)
51
+ )];
52
+ }
53
+ }
54
+
55
+ module.exports = SectionLevel;
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.8.0` marks an unreleased build straight from source.
12
+ * The default `0.9.0` marks an unreleased build straight from source.
13
13
  */
14
- const version = '0.8.0';
14
+ const version = '0.9.0';
15
15
 
16
16
  module.exports = version;