gennady 0.8.0 → 0.8.2
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/ai/agents/agent-resolve-conflicts.xml +0 -3
- package/ai/agents/agent-review-verifier.xml +0 -3
- package/ai/directives/coding/uikit-component-storybook.xml +0 -5
- package/ai/directives/coding/uikit-component-svelte.xml +0 -5
- package/ai/directives/coding/uikit-spec-drafting.xml +0 -5
- package/cli/cmd/orient/README.md +49 -0
- package/dist/ai/agents/agent-resolve-conflicts.xml +0 -3
- package/dist/ai/agents/agent-review-verifier.xml +0 -3
- package/dist/ai/directives/coding/uikit-component-storybook.xml +0 -5
- package/dist/ai/directives/coding/uikit-component-svelte.xml +0 -5
- package/dist/ai/directives/coding/uikit-spec-drafting.xml +0 -5
- package/dist/chunks/{help.cmd-BseRtoBF.js → help.cmd-BDO4k0_z.js} +3 -1
- package/dist/chunks/{index-ZM_FonZj.js → index-4fUNp3za.js} +1 -1
- package/dist/chunks/{index-CGsIRefC.js → index-9JlEjsvH.js} +1 -1
- package/dist/chunks/{index-k0nToACp.js → index-9e72uZq7.js} +1 -1
- package/dist/chunks/{index-BghL1-Nk.js → index-B4ODZbtC.js} +2 -2
- package/dist/chunks/{index-CDM74qdR.js → index-BmABG4HA.js} +2 -2
- package/dist/chunks/{index-Du1xR-qO.js → index-C9UEDrqg.js} +75 -73
- package/dist/chunks/{index-BU1AXJGA.js → index-DICatQqS.js} +1 -1
- package/dist/chunks/{index-CIvkaAQ3.js → index-DQpmjvCj.js} +1 -1
- package/dist/chunks/{index-BlqEQEGy.js → index-DS_1ZX6G.js} +1 -1
- package/dist/chunks/{index-CkczJ__m.js → index-ZpU_VoI0.js} +1 -1
- package/dist/chunks/{index-DEzym4Ae.js → index-jOIhIHdS.js} +1 -1
- package/dist/chunks/{index-OtehG7uM.js → index-mkUNzixA.js} +1 -1
- package/dist/chunks/{run-review-command.logic-BeYQin-I.js → run-review-command.logic-CHVCVJWO.js} +1 -1
- package/dist/chunks/{shared-DL_1LG0K.js → shared-9J_oXE74.js} +260 -250
- package/dist/gennady.js +19 -18
- package/dist/index.js +2 -2
- package/package.json +3 -2
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
<!-- @file: Agent directive for conflict resolution -->
|
|
2
|
-
<!-- @consumers: resolve-conflicts command -->
|
|
3
|
-
<!-- @tasks: TSK-33 -->
|
|
4
1
|
<Agent name="agent-resolve-conflicts" type="directive" ver="0.1">
|
|
5
2
|
<Mission>Resolve merge conflicts with confidence scoring.</Mission>
|
|
6
3
|
</Agent>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Storybook rules for uikit components — hierarchy mirroring spec, play functions with a11y, ai-generated tagging.
|
|
3
|
-
@consumers: SDD agents (story-writing phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-26
|
|
5
|
-
-->
|
|
6
1
|
<UiKitComponentStorybook keywords="uikit, storybook, hierarchy, play-function, a11y-audit, ai-generated, spec-mirror" type="testing-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Svelte component conventions for uikit — data attributes, CSS tokens, file structure, a11y, token overrides.
|
|
3
|
-
@consumers: SDD agents (implementation phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-26
|
|
5
|
-
-->
|
|
6
1
|
<UiKitComponentSvelte keywords="uikit, svelte-component, data-attributes, css-tokens, file-structure, a11y, token-overrides" type="coding-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Drafting rules for converting ExtractionResult JSON to a draft .ui.spec.md UI component spec.
|
|
3
|
-
@consumers: SDD agents (drafting phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-25
|
|
5
|
-
-->
|
|
6
1
|
<UiKitSpecDrafting keywords="uikit, spec-drafting, extraction-result, ui-spec, token-mapping, variant-grouping, bdd-generation, a11y-defaults" type="drafting-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Agent Rules: orient
|
|
2
|
+
|
|
3
|
+
`orient` — команда для навигации по репозиторию через file-header разметку
|
|
4
|
+
(`@file:`, `@tasks:`, `@consumers:`) и публичные сущности с их DBC-контрактами
|
|
5
|
+
(экспортируемые функции, классы, типы, интерфейсы).
|
|
6
|
+
|
|
7
|
+
## Когда использовать
|
|
8
|
+
|
|
9
|
+
| Тебе нужно ... | Вызови |
|
|
10
|
+
| ------------------------------------------------------- | ----------------------------------------------- |
|
|
11
|
+
| Понять структуру проекта, какие файлы за что отвечают | `npx gennady orient` |
|
|
12
|
+
| Найти файлы, связанные с конкретной задачей (TSK-XX) | `npx gennady orient --task=TSK-03` |
|
|
13
|
+
| Узнать, кто потребляет модуль (зависимости снизу-вверх) | `npx gennady orient --consumer=DbcTsLinter` |
|
|
14
|
+
| Найти файлы по ключевому слову в `@file:` описании | `npx gennady orient "keyword"` |
|
|
15
|
+
| Посмотреть хедер и DBC-контракты конкретного файла | `npx gennady orient --file=path/to/file.ts` |
|
|
16
|
+
| Найти экспортируемую сущность (fuzzy) | `npx gennady orient --entity=MyService --fuzzy` |
|
|
17
|
+
| Увидеть граф зависимостей (кто что потребляет) | `npx gennady orient --graph` |
|
|
18
|
+
| Обзор всех спек и их задач | `npx gennady orient --specs` |
|
|
19
|
+
|
|
20
|
+
## Примеры
|
|
21
|
+
|
|
22
|
+
### Узнать, кто потребляет DbcJsDocParser
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx gennady orient --consumer=DbcJsDocParser
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Вывод: список файлов, у которых `@consumers: DbcJsDocParser` в хедере.
|
|
29
|
+
|
|
30
|
+
### Найти файлы задачи TSK-04
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npx gennady orient --task=TSK-04
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Вывод: `TSK-04 → dbc-ts-linter.spec.md → список файлов с аннотациями`.
|
|
37
|
+
|
|
38
|
+
### Посмотреть конкретный файл в деталях
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npx gennady orient --file=services/dbc/parser/dbc-parser.types.ts
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Вывод: хедер (`@file:`, `@tasks:`, `@consumers:`) + все экспортируемые сущности с DBC-контрактами.
|
|
45
|
+
|
|
46
|
+
## Как встроить в AGENTS.md
|
|
47
|
+
|
|
48
|
+
Запусти `npx gennady agents-rules`, прочитай вывод, переосмысли под свою задачу
|
|
49
|
+
и добавь в секцию «Tools / Commands» своего AGENTS.md.
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
<!-- @file: Agent directive for conflict resolution -->
|
|
2
|
-
<!-- @consumers: resolve-conflicts command -->
|
|
3
|
-
<!-- @tasks: TSK-33 -->
|
|
4
1
|
<Agent name="agent-resolve-conflicts" type="directive" ver="0.1">
|
|
5
2
|
<Mission>Resolve merge conflicts with confidence scoring.</Mission>
|
|
6
3
|
</Agent>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Storybook rules for uikit components — hierarchy mirroring spec, play functions with a11y, ai-generated tagging.
|
|
3
|
-
@consumers: SDD agents (story-writing phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-26
|
|
5
|
-
-->
|
|
6
1
|
<UiKitComponentStorybook keywords="uikit, storybook, hierarchy, play-function, a11y-audit, ai-generated, spec-mirror" type="testing-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Svelte component conventions for uikit — data attributes, CSS tokens, file structure, a11y, token overrides.
|
|
3
|
-
@consumers: SDD agents (implementation phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-26
|
|
5
|
-
-->
|
|
6
1
|
<UiKitComponentSvelte keywords="uikit, svelte-component, data-attributes, css-tokens, file-structure, a11y, token-overrides" type="coding-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
<!--
|
|
2
|
-
@file: Drafting rules for converting ExtractionResult JSON to a draft .ui.spec.md UI component spec.
|
|
3
|
-
@consumers: SDD agents (drafting phase of uikit-component tasks)
|
|
4
|
-
@tasks: TSK-25
|
|
5
|
-
-->
|
|
6
1
|
<UiKitSpecDrafting keywords="uikit, spec-drafting, extraction-result, ui-spec, token-mapping, variant-grouping, bdd-generation, a11y-defaults" type="drafting-rules" ver="1.0">
|
|
7
2
|
<Directive_Context>
|
|
8
3
|
<Mission>
|
|
@@ -30,7 +30,9 @@ console.info(
|
|
|
30
30
|
console.info(
|
|
31
31
|
" orient Navigate file headers and DBC contracts — project map, search, dependency graph"
|
|
32
32
|
);
|
|
33
|
-
console.info(
|
|
33
|
+
console.info(
|
|
34
|
+
" agents-rules Print usage instructions for AI agents (navigate public entities, DBC contracts, file headers)"
|
|
35
|
+
);
|
|
34
36
|
console.info("");
|
|
35
37
|
console.info("Examples:");
|
|
36
38
|
console.info(" npx gennady");
|
|
@@ -2,7 +2,7 @@ import { readdirSync as D, statSync as S, mkdirSync as F, writeFileSync as k, re
|
|
|
2
2
|
import { join as d, sep as P } from "node:path";
|
|
3
3
|
import { fileURLToPath as U } from "node:url";
|
|
4
4
|
import { l as $ } from "./services-IgZptnTi.js";
|
|
5
|
-
import { n as x, b as T, r as A, S as b, p as z, f as I } from "./shared-
|
|
5
|
+
import { n as x, b as T, r as A, S as b, p as z, f as I } from "./shared-9J_oXE74.js";
|
|
6
6
|
class Y {
|
|
7
7
|
/** @purpose List of all synced file entries. */
|
|
8
8
|
entries;
|
|
@@ -7,7 +7,7 @@ import { promisify as h } from "node:util";
|
|
|
7
7
|
import z from "node:os";
|
|
8
8
|
import g from "node:fs";
|
|
9
9
|
import { Buffer as X } from "node:buffer";
|
|
10
|
-
import { p as G } from "./shared-
|
|
10
|
+
import { p as G } from "./shared-9J_oXE74.js";
|
|
11
11
|
import { c as K } from "./services-IgZptnTi.js";
|
|
12
12
|
let F;
|
|
13
13
|
function q() {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { p as j, s as e, g as x } from "./shared-
|
|
2
|
-
import { p as T, A as E } from "./index-
|
|
1
|
+
import { p as j, s as e, g as x } from "./shared-9J_oXE74.js";
|
|
2
|
+
import { p as T, A as E } from "./index-DQpmjvCj.js";
|
|
3
3
|
import { readdirSync as G, readFileSync as P } from "node:fs";
|
|
4
4
|
import { join as h, dirname as k } from "node:path";
|
|
5
5
|
import { fileURLToPath as N } from "node:url";
|
|
@@ -2,8 +2,8 @@ import u from "node:fs";
|
|
|
2
2
|
import S from "node:os";
|
|
3
3
|
import v from "node:path";
|
|
4
4
|
import { execSync as P } from "node:child_process";
|
|
5
|
-
import { p as d, A as E } from "./index-
|
|
6
|
-
import { g as H, s as t, x as D, p as F } from "./shared-
|
|
5
|
+
import { p as d, A as E } from "./index-DQpmjvCj.js";
|
|
6
|
+
import { g as H, s as t, x as D, p as F } from "./shared-9J_oXE74.js";
|
|
7
7
|
import { l as N } from "./services-IgZptnTi.js";
|
|
8
8
|
class U {
|
|
9
9
|
/** @purpose Configuration with defaults for mode, prompts, timeout. */
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { execSync as z } from "node:child_process";
|
|
2
|
-
import { existsSync as
|
|
3
|
-
import { resolve as y, relative as
|
|
2
|
+
import { existsSync as K, readFileSync as Y, readdirSync as P, statSync as X, lstatSync as q } from "node:fs";
|
|
3
|
+
import { resolve as y, relative as H, extname as F, join as Q } from "node:path";
|
|
4
4
|
import { l as C, D as ee, a as te, b as ne, s as se } from "./services-IgZptnTi.js";
|
|
5
|
-
import { p as oe } from "./shared-
|
|
6
|
-
class
|
|
5
|
+
import { p as oe } from "./shared-9J_oXE74.js";
|
|
6
|
+
class w {
|
|
7
7
|
/** @purpose Collected lint errors — empty array when clean. */
|
|
8
8
|
errors;
|
|
9
9
|
/** @purpose Count of errors auto-fixed by DbcContractCheck. */
|
|
@@ -36,8 +36,8 @@ class b {
|
|
|
36
36
|
...this.errors.map(
|
|
37
37
|
(e) => `${e.file}:${e.line}:${e.col}: ${e.severity}: ${e.code}: ${e.message}`
|
|
38
38
|
)
|
|
39
|
-
), this.specPaths.length > 0 || this.taskPaths.length > 0) {
|
|
40
|
-
t.push(""), t.push("---"), t.push("
|
|
39
|
+
), this.errors.length > 0 && (this.specPaths.length > 0 || this.taskPaths.length > 0)) {
|
|
40
|
+
t.push(""), t.push("---"), t.push("Relevant specs & tasks for errors above:");
|
|
41
41
|
for (const e of this.specPaths)
|
|
42
42
|
t.push(` ${e}`);
|
|
43
43
|
for (const e of this.taskPaths)
|
|
@@ -47,7 +47,7 @@ class b {
|
|
|
47
47
|
`);
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const U = "ERR_CLI_LINT_MISSING_FILE", W = "ERR_CLI_LINT_MISSING_CONSUMERS", ie = "ERR_CLI_LINT_ANCHOR_UNPAIRED_START", re = "ERR_CLI_LINT_ANCHOR_UNPAIRED_END", ce = "ERR_CLI_LINT_ANCHOR_NESTING", O = "ERR_CLI_LINT_ANCHOR_MALFORMED", G = "ERR_CLI_LINT_NON_ENGLISH", le = "ERR_CLI_LINT_RESOLVE_FAILED", ae = "ERR_CLI_LINT_STAGED_CONFLICT", fe = "ERR_CLI_LINT_UNAUTHORIZED_DISABLE", ue = "ERR_CLI_LINT_DISABLE_MISSING_PURPOSE", k = "ERR_CLI_LINT_TOO_MANY_INVARIANTS", de = "ERR_CLI_LINT_ANCHOR_AT_CLASS_BODY", he = "ERR_CLI_LINT_ANCHOR_CONSECUTIVE_START";
|
|
51
51
|
function ge(o, t) {
|
|
52
52
|
const e = [];
|
|
53
53
|
if (o.length === 0)
|
|
@@ -56,14 +56,14 @@ function ge(o, t) {
|
|
|
56
56
|
line: 1,
|
|
57
57
|
col: 1,
|
|
58
58
|
severity: "error",
|
|
59
|
-
code:
|
|
59
|
+
code: U,
|
|
60
60
|
message: "[FileHeaderCheck#check] Missing // @file: directive"
|
|
61
61
|
}), e.push({
|
|
62
62
|
file: t,
|
|
63
63
|
line: 1,
|
|
64
64
|
col: 1,
|
|
65
65
|
severity: "error",
|
|
66
|
-
code:
|
|
66
|
+
code: W,
|
|
67
67
|
message: "[FileHeaderCheck#check] Missing // @consumers: directive"
|
|
68
68
|
}), e;
|
|
69
69
|
const n = o.split(`
|
|
@@ -79,18 +79,18 @@ function ge(o, t) {
|
|
|
79
79
|
line: 1,
|
|
80
80
|
col: 1,
|
|
81
81
|
severity: "error",
|
|
82
|
-
code:
|
|
82
|
+
code: U,
|
|
83
83
|
message: "[FileHeaderCheck#check] Missing // @file: directive"
|
|
84
84
|
}), i || e.push({
|
|
85
85
|
file: t,
|
|
86
86
|
line: 1,
|
|
87
87
|
col: 1,
|
|
88
88
|
severity: "error",
|
|
89
|
-
code:
|
|
89
|
+
code: W,
|
|
90
90
|
message: "[FileHeaderCheck#check] Missing // @consumers: directive"
|
|
91
91
|
}), e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function D(o) {
|
|
94
94
|
let t = "", e = 0, n = !1, s = !1, i = !1;
|
|
95
95
|
for (; e < o.length; ) {
|
|
96
96
|
const r = o[e], c = o[e + 1] ?? "";
|
|
@@ -182,7 +182,7 @@ function pe(o, t) {
|
|
|
182
182
|
line: u,
|
|
183
183
|
col: g,
|
|
184
184
|
severity: "error",
|
|
185
|
-
code:
|
|
185
|
+
code: O,
|
|
186
186
|
message: `#endregion without END_<NAME> — expected END_${a.name} (auto-closed by stack top START_${a.name} at line ${a.line})`
|
|
187
187
|
}), s.pop(), r.delete(i), c.set(i, !1);
|
|
188
188
|
} else
|
|
@@ -191,7 +191,7 @@ function pe(o, t) {
|
|
|
191
191
|
line: u,
|
|
192
192
|
col: g,
|
|
193
193
|
severity: "error",
|
|
194
|
-
code:
|
|
194
|
+
code: O,
|
|
195
195
|
message: "#endregion without END_<NAME> — no open block to close"
|
|
196
196
|
});
|
|
197
197
|
else
|
|
@@ -200,7 +200,7 @@ function pe(o, t) {
|
|
|
200
200
|
line: u,
|
|
201
201
|
col: g,
|
|
202
202
|
severity: "error",
|
|
203
|
-
code:
|
|
203
|
+
code: O,
|
|
204
204
|
message: "#region without START_<NAME> — add START_ prefix with a block name"
|
|
205
205
|
});
|
|
206
206
|
}
|
|
@@ -223,7 +223,7 @@ function Re(o, t) {
|
|
|
223
223
|
}
|
|
224
224
|
function Ce(o, t) {
|
|
225
225
|
let e = t;
|
|
226
|
-
const n =
|
|
226
|
+
const n = D(o);
|
|
227
227
|
for (const s of n)
|
|
228
228
|
s === "{" ? e++ : s === "}" && e--;
|
|
229
229
|
return e;
|
|
@@ -245,13 +245,13 @@ async function Ie(o, t, e) {
|
|
|
245
245
|
const c = await i.lint(t, { content: o });
|
|
246
246
|
return C.info(
|
|
247
247
|
`[DbcContractCheck#check] [creating → linted] ${t} (${c.errors.length} errors)`
|
|
248
|
-
), { errors: c.errors.map(
|
|
248
|
+
), { errors: c.errors.map(B), autoFixed: 0 };
|
|
249
249
|
}
|
|
250
250
|
const r = await i.lintAndFix(t, { content: o });
|
|
251
251
|
return C.info(
|
|
252
252
|
`[DbcContractCheck#check] [creating → fixed] ${t} (autoFixed=${r.autoFixed}, remaining=${r.errors.length})`
|
|
253
253
|
), {
|
|
254
|
-
errors: r.errors.map(
|
|
254
|
+
errors: r.errors.map(B),
|
|
255
255
|
autoFixed: r.autoFixed
|
|
256
256
|
};
|
|
257
257
|
} catch (r) {
|
|
@@ -259,7 +259,7 @@ async function Ie(o, t, e) {
|
|
|
259
259
|
throw C.error(`[DbcContractCheck#check] [creating → failed] ${t}`, { error: c }), c;
|
|
260
260
|
}
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function B(o) {
|
|
263
263
|
return {
|
|
264
264
|
file: o.file,
|
|
265
265
|
line: o.line,
|
|
@@ -269,7 +269,7 @@ function G(o) {
|
|
|
269
269
|
message: o.message
|
|
270
270
|
};
|
|
271
271
|
}
|
|
272
|
-
const
|
|
272
|
+
const j = 8, Ne = /@ts-ignore|@ts-nocheck|@ts-expect-error|eslint-disable(?:-next-line|-line)?(?:-[a-z-]+)?\b/, Te = /\bd-\d+\b/i;
|
|
273
273
|
function Se(o) {
|
|
274
274
|
let t = !1, e = !1, n = !1;
|
|
275
275
|
for (let s = 0; s < o.length - 1; s++) {
|
|
@@ -302,13 +302,13 @@ function ye(o, t) {
|
|
|
302
302
|
continue;
|
|
303
303
|
}
|
|
304
304
|
const u = xe(c, f, _[0]);
|
|
305
|
-
u <
|
|
305
|
+
u < j && n.push({
|
|
306
306
|
file: t,
|
|
307
307
|
line: s + 1,
|
|
308
308
|
col: d,
|
|
309
309
|
severity: "error",
|
|
310
310
|
code: ue,
|
|
311
|
-
message: `Disable lacks purpose: \`${f}\` cites \`${_[0]}\` but the explanation is too short (${u} non-whitespace chars; need ≥ ${
|
|
311
|
+
message: `Disable lacks purpose: \`${f}\` cites \`${_[0]}\` but the explanation is too short (${u} non-whitespace chars; need ≥ ${j}). Add a purpose after the D-NNN reference, e.g., \`${f}: ${_[0]} — <why this disable is necessary>\`. Policy: see specs/cli/cli.spec.md#d-007.`
|
|
312
312
|
});
|
|
313
313
|
}
|
|
314
314
|
return n;
|
|
@@ -317,7 +317,7 @@ function xe(o, t, e) {
|
|
|
317
317
|
let n = o.replace(t, "");
|
|
318
318
|
return n = n.replace(e, ""), n = n.replace(/\*\//g, ""), n = n.replace(/^\/\/|^\/\*/g, ""), n.replace(/\s/g, "").length;
|
|
319
319
|
}
|
|
320
|
-
const
|
|
320
|
+
const J = new RegExp("\\p{Script=Cyrillic}", "u");
|
|
321
321
|
function Ae(o, t) {
|
|
322
322
|
const e = [], n = o.split(`
|
|
323
323
|
`), s = ke(n);
|
|
@@ -326,25 +326,25 @@ function Ae(o, t) {
|
|
|
326
326
|
if (l.startsWith("// @file:") || l.startsWith("// @consumers:")) {
|
|
327
327
|
const f = [...r];
|
|
328
328
|
for (let d = 0; d < f.length; d++)
|
|
329
|
-
|
|
329
|
+
J.test(f[d]) && e.push({
|
|
330
330
|
file: t,
|
|
331
331
|
line: c,
|
|
332
332
|
col: d + 1,
|
|
333
333
|
severity: "error",
|
|
334
|
-
code:
|
|
334
|
+
code: G,
|
|
335
335
|
message: `[LanguageCheck#check] Cyrillic character '${f[d]}' in file header — use English only`
|
|
336
336
|
});
|
|
337
337
|
}
|
|
338
338
|
if (s.has(i)) {
|
|
339
339
|
const f = [...r];
|
|
340
340
|
for (let d = 0; d < f.length; d++)
|
|
341
|
-
if (
|
|
341
|
+
if (J.test(f[d])) {
|
|
342
342
|
e.push({
|
|
343
343
|
file: t,
|
|
344
344
|
line: c,
|
|
345
345
|
col: d + 1,
|
|
346
346
|
severity: "error",
|
|
347
|
-
code:
|
|
347
|
+
code: G,
|
|
348
348
|
message: `[LanguageCheck#check] Cyrillic character '${f[d]}' in JSDoc contract — use English only`
|
|
349
349
|
});
|
|
350
350
|
break;
|
|
@@ -366,7 +366,7 @@ function ke(o) {
|
|
|
366
366
|
}
|
|
367
367
|
return t;
|
|
368
368
|
}
|
|
369
|
-
const
|
|
369
|
+
const ve = /^\s*export\s+(?:(?:default\s+)?(?:function|class|abstract\s+class|interface))\s+(\w+)/, De = /^\s*(?:function|class|abstract\s+class|interface)\s+(\w+)/, $e = /\/\/\s*#region\s+START_\w+.*\binvariant\s*:/;
|
|
370
370
|
function be(o, t, e) {
|
|
371
371
|
const n = o.split(`
|
|
372
372
|
`), s = [];
|
|
@@ -377,7 +377,7 @@ function be(o, t, e) {
|
|
|
377
377
|
const R = n[a], N = a + 1, p = R.trim();
|
|
378
378
|
if (p.startsWith("/**"))
|
|
379
379
|
if (p.includes("*/") && p.length > 3) {
|
|
380
|
-
const m =
|
|
380
|
+
const m = V(p);
|
|
381
381
|
g = [];
|
|
382
382
|
for (let L = 0; L < m; L++) g.push(N);
|
|
383
383
|
} else {
|
|
@@ -389,19 +389,19 @@ function be(o, t, e) {
|
|
|
389
389
|
u = !1;
|
|
390
390
|
continue;
|
|
391
391
|
}
|
|
392
|
-
const m =
|
|
392
|
+
const m = V(p);
|
|
393
393
|
for (let L = 0; L < m; L++) g.push(N);
|
|
394
394
|
continue;
|
|
395
395
|
}
|
|
396
|
-
const S = R.match(
|
|
396
|
+
const S = R.match(ve), E = p.includes("*/") ? p.slice(p.lastIndexOf("*/") + 2) : null, T = E ? E.match(
|
|
397
397
|
/^\s*export\s+(?:(?:default\s+)?(?:function|class|abstract\s+class|interface))\s+(\w+)/
|
|
398
398
|
) : null, x = S || T, h = T ? p.lastIndexOf("*/") + 2 : 0;
|
|
399
399
|
if (x) {
|
|
400
400
|
l = !0, f = x[1], d = N;
|
|
401
401
|
const m = (x.index ?? 0) + h, L = R.indexOf(f, m);
|
|
402
402
|
_ = (L >= 0 ? L : m) + 1;
|
|
403
|
-
} else g.length > 0 &&
|
|
404
|
-
const I =
|
|
403
|
+
} else g.length > 0 && De.test(R) && (g = []);
|
|
404
|
+
const I = D(R);
|
|
405
405
|
for (const m of I)
|
|
406
406
|
if (m === "{") {
|
|
407
407
|
if (i++, l) {
|
|
@@ -430,7 +430,7 @@ function be(o, t, e) {
|
|
|
430
430
|
code: k,
|
|
431
431
|
message: `Entity "${c.name}" has ${c.regionCount} region invariants (max ${e}) — consider reviewing the contract; too many region invariants suggest the entity is overloaded`
|
|
432
432
|
}), r.pop(), c = r.length > 0 ? r[r.length - 1] : null), i--);
|
|
433
|
-
c &&
|
|
433
|
+
c && $e.test(R) && c.regionCount++;
|
|
434
434
|
}
|
|
435
435
|
for (const a of r)
|
|
436
436
|
a.jsdocCount > e && s.push({
|
|
@@ -450,7 +450,7 @@ function be(o, t, e) {
|
|
|
450
450
|
});
|
|
451
451
|
return s.sort((a, R) => a.line - R.line || a.col - R.col), s;
|
|
452
452
|
}
|
|
453
|
-
function
|
|
453
|
+
function V(o) {
|
|
454
454
|
const t = o.match(/@invariant\b/g);
|
|
455
455
|
return t ? t.length : 0;
|
|
456
456
|
}
|
|
@@ -463,8 +463,8 @@ function Oe(o, t) {
|
|
|
463
463
|
let r = !1;
|
|
464
464
|
for (let c = 0; c < e.length; c++) {
|
|
465
465
|
const l = e[c], f = c + 1;
|
|
466
|
-
/\b(?:class|namespace)\s+\w/.test(
|
|
467
|
-
const d =
|
|
466
|
+
/\b(?:class|namespace)\s+\w/.test(D(l)) && (r = !0);
|
|
467
|
+
const d = D(l);
|
|
468
468
|
for (const u of d)
|
|
469
469
|
u === "{" ? (s++, r && (i.push(s), r = !1)) : u === "}" && (i.length > 0 && s === i[i.length - 1] && i.pop(), s--);
|
|
470
470
|
const _ = l.match(we);
|
|
@@ -484,19 +484,19 @@ function Oe(o, t) {
|
|
|
484
484
|
}
|
|
485
485
|
function Fe(o, t = "tasks") {
|
|
486
486
|
const e = /* @__PURE__ */ new Map(), n = y(o, t);
|
|
487
|
-
if (!
|
|
487
|
+
if (!K(n))
|
|
488
488
|
return e;
|
|
489
489
|
const s = He(n);
|
|
490
490
|
for (const i of s) {
|
|
491
491
|
let r;
|
|
492
492
|
try {
|
|
493
|
-
r =
|
|
493
|
+
r = Y(i, "utf-8");
|
|
494
494
|
} catch {
|
|
495
495
|
continue;
|
|
496
496
|
}
|
|
497
497
|
const c = r.match(/-\s+\*\*Task-ID:\*\*\s+(TSK-\d+)/);
|
|
498
498
|
if (!c) continue;
|
|
499
|
-
const l = c[1], f =
|
|
499
|
+
const l = c[1], f = H(o, i), d = Me(r, o);
|
|
500
500
|
e.set(l, { taskPath: f, specPaths: d });
|
|
501
501
|
}
|
|
502
502
|
return e;
|
|
@@ -511,27 +511,27 @@ function Me(o, t) {
|
|
|
511
511
|
if (!c) continue;
|
|
512
512
|
const l = Pe(y(t, "specs"), c);
|
|
513
513
|
if (l) {
|
|
514
|
-
const f =
|
|
514
|
+
const f = H(t, l);
|
|
515
515
|
f.startsWith("..") || e.add(f);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
return [...e].sort();
|
|
519
519
|
}
|
|
520
520
|
function Pe(o, t) {
|
|
521
|
-
if (!
|
|
521
|
+
if (!K(o)) return null;
|
|
522
522
|
const e = [o];
|
|
523
523
|
for (; e.length > 0; ) {
|
|
524
524
|
const n = e.pop();
|
|
525
525
|
let s;
|
|
526
526
|
try {
|
|
527
|
-
s =
|
|
527
|
+
s = P(n);
|
|
528
528
|
} catch {
|
|
529
529
|
continue;
|
|
530
530
|
}
|
|
531
531
|
for (const i of s) {
|
|
532
532
|
const r = y(n, i);
|
|
533
533
|
try {
|
|
534
|
-
const c =
|
|
534
|
+
const c = X(r);
|
|
535
535
|
if (c.isDirectory())
|
|
536
536
|
e.push(r);
|
|
537
537
|
else if (c.isFile() && i === t)
|
|
@@ -548,14 +548,14 @@ function He(o) {
|
|
|
548
548
|
const n = e.pop();
|
|
549
549
|
let s;
|
|
550
550
|
try {
|
|
551
|
-
s =
|
|
551
|
+
s = P(n);
|
|
552
552
|
} catch {
|
|
553
553
|
continue;
|
|
554
554
|
}
|
|
555
555
|
for (const i of s) {
|
|
556
556
|
const r = y(n, i);
|
|
557
557
|
try {
|
|
558
|
-
const c =
|
|
558
|
+
const c = X(r);
|
|
559
559
|
c.isDirectory() ? e.push(r) : c.isFile() && i.endsWith(".md") && t.push(r);
|
|
560
560
|
} catch {
|
|
561
561
|
}
|
|
@@ -637,7 +637,7 @@ async function je(o) {
|
|
|
637
637
|
code: ae,
|
|
638
638
|
message: "--staged and positional targets are mutually exclusive. Use either --staged or provide file/directory paths, not both."
|
|
639
639
|
};
|
|
640
|
-
return C.warn("[LintCommand#run] --staged and positional targets are mutually exclusive"), new
|
|
640
|
+
return C.warn("[LintCommand#run] --staged and positional targets are mutually exclusive"), new w([h]);
|
|
641
641
|
}
|
|
642
642
|
C.debug("[LintCommand#run] [idle → collecting] staged mode");
|
|
643
643
|
try {
|
|
@@ -660,12 +660,12 @@ async function je(o) {
|
|
|
660
660
|
if (u.length > 0 && _.length > 0) {
|
|
661
661
|
const h = u.length, I = y(".");
|
|
662
662
|
u = u.filter((m) => {
|
|
663
|
-
const L = m.startsWith("/") ?
|
|
663
|
+
const L = m.startsWith("/") ? H(I, m) : m;
|
|
664
664
|
return !_.some((A) => A.test(L));
|
|
665
665
|
}), C.debug(`[LintCommand#run] [filtering → filtered] ${h} → ${u.length} file(s)`);
|
|
666
666
|
}
|
|
667
667
|
if (u.length === 0)
|
|
668
|
-
return C.debug("[LintCommand#run] [collecting → done] no files to lint"), new
|
|
668
|
+
return C.debug("[LintCommand#run] [collecting → done] no files to lint"), new w(g);
|
|
669
669
|
C.debug(`[LintCommand#run] [collecting → linting] ${u.length} file(s)`);
|
|
670
670
|
const a = [...g];
|
|
671
671
|
let R = 0;
|
|
@@ -674,29 +674,31 @@ async function je(o) {
|
|
|
674
674
|
const I = y(h);
|
|
675
675
|
let m;
|
|
676
676
|
try {
|
|
677
|
-
C.debug(`[LintCommand#run] [linting → reading] ${h}`), m =
|
|
678
|
-
} catch (
|
|
679
|
-
const
|
|
680
|
-
C.error(`[LintCommand#run] [reading → failed] ${h}`, { error:
|
|
677
|
+
C.debug(`[LintCommand#run] [linting → reading] ${h}`), m = Y(I, "utf-8");
|
|
678
|
+
} catch ($) {
|
|
679
|
+
const b = new Error(`[LintCommand#run] Cannot read file: ${h}`, { cause: $ });
|
|
680
|
+
C.error(`[LintCommand#run] [reading → failed] ${h}`, { error: b });
|
|
681
681
|
continue;
|
|
682
682
|
}
|
|
683
|
+
const L = a.length;
|
|
683
684
|
a.push(...ge(m, h)), a.push(...pe(m, h)), a.push(...Ae(m, h)), a.push(...ye(m, h)), a.push(...Oe(m, h)), a.push(...be(m, h, r));
|
|
684
|
-
const L = Ue(m);
|
|
685
|
-
for (const v of L)
|
|
686
|
-
S.add(v);
|
|
687
685
|
const A = await Ie(m, h, n);
|
|
688
|
-
a.push(...A.errors), R += A.autoFixed
|
|
686
|
+
if (a.push(...A.errors), R += A.autoFixed, a.length > L) {
|
|
687
|
+
const $ = Ue(m);
|
|
688
|
+
for (const b of $)
|
|
689
|
+
S.add(b);
|
|
690
|
+
}
|
|
689
691
|
}
|
|
690
|
-
const { taskPaths: E, specPaths: T } = We([...S], p), x = new
|
|
691
|
-
return x.exitCode === 1 ? console.log(
|
|
692
|
+
const { taskPaths: E, specPaths: T } = We([...S], p), x = new w(a, R, E, T);
|
|
693
|
+
return x.exitCode === 1 ? console.log(`❌ [LintCommand#run] [linting → failed] ${a.length} error(s)`) : console.log("✅ [LintCommand#run] [linting → clean] no errors"), x;
|
|
692
694
|
}
|
|
693
|
-
const
|
|
695
|
+
const M = [".ts", ".tsx"], Je = /* @__PURE__ */ new Set(["node_modules", "dist", "coverage", "build", "out", "__tests__"]);
|
|
694
696
|
function Ve(o) {
|
|
695
697
|
C.debug(`[resolveTargets] [idle → resolving] ${o.length} target(s)`);
|
|
696
698
|
const t = /* @__PURE__ */ new Set(), e = [];
|
|
697
699
|
for (const s of o) {
|
|
698
|
-
const i =
|
|
699
|
-
if (i && !
|
|
700
|
+
const i = F(s).toLowerCase();
|
|
701
|
+
if (i && !M.includes(i) && !s.endsWith("/"))
|
|
700
702
|
continue;
|
|
701
703
|
let r;
|
|
702
704
|
try {
|
|
@@ -717,10 +719,10 @@ function Ve(o) {
|
|
|
717
719
|
continue;
|
|
718
720
|
const c = y(s);
|
|
719
721
|
if (r.isDirectory())
|
|
720
|
-
|
|
722
|
+
Z(c, t);
|
|
721
723
|
else if (r.isFile()) {
|
|
722
|
-
const l =
|
|
723
|
-
|
|
724
|
+
const l = F(s).toLowerCase();
|
|
725
|
+
M.includes(l) && t.add(c);
|
|
724
726
|
}
|
|
725
727
|
}
|
|
726
728
|
const n = [...t].sort();
|
|
@@ -728,10 +730,10 @@ function Ve(o) {
|
|
|
728
730
|
`[resolveTargets] [resolving → resolved] ${n.length} file(s), ${e.length} error(s)`
|
|
729
731
|
), { files: n, errors: e };
|
|
730
732
|
}
|
|
731
|
-
function
|
|
733
|
+
function Z(o, t) {
|
|
732
734
|
let e;
|
|
733
735
|
try {
|
|
734
|
-
e =
|
|
736
|
+
e = P(o, { withFileTypes: !0 });
|
|
735
737
|
} catch {
|
|
736
738
|
return;
|
|
737
739
|
}
|
|
@@ -739,14 +741,14 @@ function X(o, t) {
|
|
|
739
741
|
const s = Q(o, n.name);
|
|
740
742
|
if (!n.name.startsWith(".") && !Je.has(n.name) && !n.isSymbolicLink()) {
|
|
741
743
|
if (n.isDirectory())
|
|
742
|
-
|
|
744
|
+
Z(s, t);
|
|
743
745
|
else if (n.isFile()) {
|
|
744
|
-
const i =
|
|
745
|
-
|
|
746
|
+
const i = F(n.name).toLowerCase();
|
|
747
|
+
M.includes(i) && t.add(s);
|
|
746
748
|
}
|
|
747
749
|
}
|
|
748
750
|
}
|
|
749
751
|
}
|
|
750
|
-
const
|
|
751
|
-
(
|
|
752
|
-
process.exit(
|
|
752
|
+
const v = await je(process.argv);
|
|
753
|
+
(v.exitCode === 1 || v.autoFixed > 0) && console.log(v.format());
|
|
754
|
+
process.exit(v.exitCode);
|
|
@@ -8,7 +8,7 @@ import dt from "stream";
|
|
|
8
8
|
import In from "events";
|
|
9
9
|
import Qt from "fs";
|
|
10
10
|
import { l as xe, p as Nn, V as qn, d as Fn } from "./services-IgZptnTi.js";
|
|
11
|
-
import { p as Bn, s as ne } from "./shared-
|
|
11
|
+
import { p as Bn, s as ne } from "./shared-9J_oXE74.js";
|
|
12
12
|
var se = {}, ie = {}, Oe = {}, nr;
|
|
13
13
|
function jn() {
|
|
14
14
|
if (nr) return Oe;
|