agent-quality-kit 0.5.0 → 0.7.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.
Files changed (135) hide show
  1. package/README.md +53 -2
  2. package/README.ru.md +35 -1
  3. package/kit/docs/ai/agent-harness-playbook.md +1 -1
  4. package/kit/docs/ready-made-rules.md +65 -0
  5. package/kit/gates/README.md +60 -0
  6. package/kit/gates/ci-actually-fails/README.md +54 -0
  7. package/kit/gates/ci-actually-fails/check.sh +116 -0
  8. package/kit/gates/ci-actually-fails/gate.yml +14 -0
  9. package/kit/gates/ci-actually-fails/green/.github/workflows/ci.yml +30 -0
  10. package/kit/gates/ci-actually-fails/red/.github/workflows/ci.yml +12 -0
  11. package/kit/gates/ci-actually-fails/red/.github/workflows/soft.yml +15 -0
  12. package/kit/gates/color-from-token/check.sh +13 -1
  13. package/kit/gates/commit-explains-itself/README.md +13 -3
  14. package/kit/gates/commit-explains-itself/check.sh +8 -4
  15. package/kit/gates/complexity-limit/README.md +5 -0
  16. package/kit/gates/complexity-limit/check.sh +21 -2
  17. package/kit/gates/complexity-limit/green/test_fixtures.py +14 -0
  18. package/kit/gates/deps-are-pinned/README.md +14 -1
  19. package/kit/gates/deps-are-pinned/check.sh +6 -1
  20. package/kit/gates/deps-are-pinned/green/pyproject-with-requirements/pyproject.toml +12 -0
  21. package/kit/gates/deps-are-pinned/green/pyproject-with-requirements/requirements.txt +3 -0
  22. package/kit/gates/deps-are-pinned/red/pyproject-loose/pyproject.toml +12 -0
  23. package/kit/gates/deps-are-pinned/red/pyproject-loose/requirements.txt +3 -0
  24. package/kit/gates/duplicate-code/README.md +11 -2
  25. package/kit/gates/duplicate-code/check.sh +31 -4
  26. package/kit/gates/duplicate-code/gate.yml +8 -0
  27. package/kit/gates/duplicate-code/green/imports_a.go +20 -0
  28. package/kit/gates/duplicate-code/green/imports_b.go +19 -0
  29. package/kit/gates/entry-links-exist/README.md +5 -0
  30. package/kit/gates/entry-links-exist/check.sh +6 -0
  31. package/kit/gates/entry-links-exist/green/AGENTS.md +3 -0
  32. package/kit/gates/file-size-limit/README.md +9 -2
  33. package/kit/gates/file-size-limit/check.sh +13 -1
  34. package/kit/gates/gate-not-weakened/README.md +54 -0
  35. package/kit/gates/gate-not-weakened/check.sh +84 -0
  36. package/kit/gates/gate-not-weakened/gate.yml +15 -0
  37. package/kit/gates/gate-not-weakened/green/checkout.ts +8 -0
  38. package/kit/gates/gate-not-weakened/green/payments.py +6 -0
  39. package/kit/gates/gate-not-weakened/green/release.sh +2 -0
  40. package/kit/gates/gate-not-weakened/red/checkout.ts +9 -0
  41. package/kit/gates/gate-not-weakened/red/payments.py +6 -0
  42. package/kit/gates/gate-not-weakened/red/release.sh +2 -0
  43. package/kit/gates/hook-actually-fires/README.md +74 -0
  44. package/kit/gates/hook-actually-fires/check.sh +183 -0
  45. package/kit/gates/hook-actually-fires/gate.yml +15 -0
  46. package/kit/gates/hook-actually-fires/green/.claude/hooks/hooks.json +3 -0
  47. package/kit/gates/hook-actually-fires/green/.claude/settings.json +74 -0
  48. package/kit/gates/hook-actually-fires/green/.claude/settings.local.json +74 -0
  49. package/kit/gates/hook-actually-fires/red/.claude/hooks/hooks.json +4 -0
  50. package/kit/gates/hook-actually-fires/red/.claude/settings.json +53 -0
  51. package/kit/gates/no-phantom-package/README.md +84 -0
  52. package/kit/gates/no-phantom-package/check.sh +161 -0
  53. package/kit/gates/no-phantom-package/gate.yml +20 -0
  54. package/kit/gates/no-phantom-package/green/AGENTS.md +15 -0
  55. package/kit/gates/no-phantom-package/red/AGENTS.md +15 -0
  56. package/kit/gates/no-print-in-prod/README.md +33 -39
  57. package/kit/gates/no-print-in-prod/gate.yml +14 -6
  58. package/kit/gates/personal-config-not-shared/README.md +66 -0
  59. package/kit/gates/personal-config-not-shared/check.sh +103 -0
  60. package/kit/gates/personal-config-not-shared/gate.yml +16 -0
  61. package/kit/gates/personal-config-not-shared/green/.aqk-tracked +9 -0
  62. package/kit/gates/personal-config-not-shared/red/.aqk-tracked +6 -0
  63. package/kit/gates/promise-has-gate/README.md +50 -0
  64. package/kit/gates/promise-has-gate/check.sh +88 -0
  65. package/kit/gates/promise-has-gate/gate.yml +14 -0
  66. package/kit/gates/promise-has-gate/green/.aqk.yml +6 -0
  67. package/kit/gates/promise-has-gate/green/AGENTS.md +7 -0
  68. package/kit/gates/promise-has-gate/red/.aqk.yml +6 -0
  69. package/kit/gates/promise-has-gate/red/AGENTS.md +7 -0
  70. package/kit/gates/secrets-not-in-code/check.sh +13 -1
  71. package/kit/gates/swallowed-error/README.md +36 -18
  72. package/kit/gates/swallowed-error/gate.yml +13 -3
  73. package/kit/gates/test-has-assertion/README.md +47 -0
  74. package/kit/gates/test-has-assertion/check.sh +206 -0
  75. package/kit/gates/test-has-assertion/gate.yml +15 -0
  76. package/kit/gates/test-has-assertion/green/checkout.test.ts +9 -0
  77. package/kit/gates/test-has-assertion/green/test_billing.py +17 -0
  78. package/kit/gates/test-has-assertion/red/checkout.test.ts +8 -0
  79. package/kit/gates/test-has-assertion/red/test_billing.py +14 -0
  80. package/kit/gates/test-not-adjusted/README.md +79 -0
  81. package/kit/gates/test-not-adjusted/check.sh +136 -0
  82. package/kit/gates/test-not-adjusted/gate.yml +19 -0
  83. package/kit/gates/test-not-adjusted/green/after/calc.py +6 -0
  84. package/kit/gates/test-not-adjusted/green/after/tests/test_calc.py +9 -0
  85. package/kit/gates/test-not-adjusted/green/before/calc.py +2 -0
  86. package/kit/gates/test-not-adjusted/green/before/tests/test_calc.py +5 -0
  87. package/kit/gates/test-not-adjusted/red/after/calc.py +2 -0
  88. package/kit/gates/test-not-adjusted/red/after/tests/test_calc.py +5 -0
  89. package/kit/gates/test-not-adjusted/red/before/calc.py +2 -0
  90. package/kit/gates/test-not-adjusted/red/before/tests/test_calc.py +7 -0
  91. package/kit/gates/todo-without-task/README.md +6 -0
  92. package/kit/gates/todo-without-task/check.sh +13 -1
  93. package/kit/ratchet/ratchet.sh +70 -2
  94. package/kit/rules/general.md +23 -0
  95. package/kit/rules-en/general.md +82 -0
  96. package/kit/rules-en/security.md +33 -0
  97. package/kit/rules-en/testing.md +48 -0
  98. package/llms.txt +2 -1
  99. package/package.json +4 -2
  100. package/tool/commands/badge.mjs +7 -1
  101. package/tool/commands/doctor.mjs +90 -10
  102. package/tool/commands/gates.mjs +19 -5
  103. package/tool/commands/project.mjs +15 -2
  104. package/tool/commands/prove.mjs +67 -0
  105. package/tool/commands/report.mjs +4 -1
  106. package/tool/i18n/en-docs.mjs +70 -0
  107. package/tool/i18n/en.mjs +66 -54
  108. package/tool/i18n/ru-docs.mjs +70 -0
  109. package/tool/i18n/ru.mjs +66 -54
  110. package/tool/i18n/templates-en.mjs +9 -9
  111. package/tool/i18n/templates-ru.mjs +9 -9
  112. package/tool/lib/core.mjs +7 -1
  113. package/tool/lib/manifest.mjs +72 -5
  114. package/tool/lib/prove.mjs +160 -0
  115. package/tool/lib/repo.mjs +31 -2
  116. package/tool/lib/scope.mjs +131 -0
  117. package/tool/lib/templates.mjs +2 -0
  118. package/tool/program.mjs +6 -0
  119. package/tool/selfcheck/gates.sh +86 -3
  120. package/tool/selfcheck/lifecycle.mjs +29 -0
  121. package/tool/selfcheck/mutation.sh +21 -1
  122. package/tool/selfcheck/smoke.sh +329 -36
  123. package/tool/selfcheck/units-level.mjs +60 -0
  124. package/tool/selfcheck/units.mjs +196 -1
  125. package/kit/gates/no-print-in-prod/check.sh +0 -38
  126. package/kit/gates/no-print-in-prod/green/docs.ts +0 -15
  127. package/kit/gates/no-print-in-prod/green/main.go +0 -8
  128. package/kit/gates/no-print-in-prod/green/main.rs +0 -4
  129. package/kit/gates/no-print-in-prod/red/main.go +0 -8
  130. package/kit/gates/no-print-in-prod/red/main.rs +0 -4
  131. package/kit/gates/swallowed-error/check.sh +0 -54
  132. package/kit/gates/swallowed-error/green/run.js +0 -8
  133. package/kit/gates/swallowed-error/red/run.js +0 -3
  134. /package/kit/gates/commit-explains-itself/green/{COMMIT_MSG → .aqk-commit-msg} +0 -0
  135. /package/kit/gates/commit-explains-itself/red/{COMMIT_MSG → .aqk-commit-msg} +0 -0
package/tool/i18n/en.mjs CHANGED
@@ -3,9 +3,12 @@
3
3
  // Правка здесь обязана иметь пару в ru.mjs с тем же ключом: расхождение ловит модульная
4
4
  // проверка «оба каталога несут одни и те же ключи».
5
5
 
6
+ import { enDocs } from "./en-docs.mjs";
7
+
6
8
  import { templates } from "./templates-en.mjs";
7
9
 
8
10
  export const en = {
11
+ ...enDocs,
9
12
  templates,
10
13
  help: {
11
14
  tagline: "tooling for building software with agents",
@@ -13,8 +16,10 @@ export const en = {
13
16
  init: "lay the rules and guides into the current project",
14
17
  initForce: "overwrite files that already exist",
15
18
  start: "no code yet: day-zero guards and the order of work",
19
+ prove: "prove the gates catch a defect: each against its own red and green sample",
16
20
  doctor: "check what is laid out and what is missing",
17
21
  doctorRun: "and also run the declared gates",
22
+ doctorSince: "the same, but show only what the diff against a ref introduced",
18
23
  add: "install a gate from the catalogue into the project",
19
24
  find: "is there already such a gate — matched by intent",
20
25
  why: "a bug slipped through — why did no guard catch it",
@@ -40,6 +45,8 @@ export const en = {
40
45
  emptyCommands: (n) => `AGENTS.md has ${n} unfilled commands.`,
41
46
  emptyCommandsWhy: "An agent cannot execute an empty line.",
42
47
 
48
+ levelUnproven: (cmd) => `not proven: ${cmd}`,
49
+ gatesDoNotCatch: (n, cmd) => `gates that do not catch a defect: ${n}. Details: ${cmd}`,
43
50
  levelHeading: "AQK compliance level",
44
51
  levelNone: "none",
45
52
  levelNotSet: "Level: the standard is not set up in this repository.",
@@ -66,6 +73,14 @@ export const en = {
66
73
  totalTodo: (n) => `applicable but not installed ${n}`,
67
74
  totalSkip: (n) => `hidden ${n}`,
68
75
 
76
+ sinceHeading: (ref, n) => `narrowed to the diff against ${ref}: ${n} files touched`,
77
+ sinceBadRef: (ref) => `cannot compare against "${ref}": no such ref, or this is not a git repository`,
78
+ notScopable: "output carries no paths — cannot be narrowed by diff, left red",
79
+ outsideDiff: (n) => `findings exist, but outside the diff (${n})`,
80
+ advisoryMark: "advisory — shown, the run was not failed",
81
+ advisorySummary: (names) =>
82
+ `advisory and red: ${names.join(", ")}. These are switched-off checks: ` +
83
+ `either fix them and drop them from advisory, or admit the rule does not exist.`,
69
84
  runHeading: "Running the declared gates",
70
85
  timeout: "did not finish within 5 minutes",
71
86
  exitCode: (code) => `exit ${code}`,
@@ -127,6 +142,8 @@ export const en = {
127
142
  has_deps: ["no dependency file in sight", "dependencies are declared"],
128
143
  has_tests: ["no tests in sight", "tests exist"],
129
144
  has_env: ["no environment file", "an environment file exists"],
145
+ has_agent_config: ["the agent was never configured here", "agent settings exist"],
146
+ has_agent_entry: ["no entry point for an agent here", "an entry point for an agent exists"],
130
147
  has_ui: ["no stylesheets or UI components in sight", "a UI exists: stylesheets or components"],
131
148
  },
132
149
  },
@@ -136,6 +153,18 @@ export const en = {
136
153
  none: "no recipe described",
137
154
  },
138
155
 
156
+ // Entry maturity. Computed from the entry's proof; it cannot be declared — see
157
+ // entryLifecycle in tool/lib/manifest.mjs.
158
+ lifecycle: {
159
+ stable: "proven by an incident from the journal",
160
+ experimental: "proof is not from the journal — the entry is provisional",
161
+ deprecated: "retired",
162
+ unknownReplacement: (v) => `superseded_by: ${v} — no such entry in the catalogue`,
163
+ noReplacement: "lifecycle: deprecated without superseded_by — no replacement is named",
164
+ notDeclarable: (v) => `lifecycle: ${v} cannot be declared — maturity is computed from the proof`,
165
+ unknown: (v) => `lifecycle: ${v} — no such state; only deprecated is declared`,
166
+ installDeprecated: (slug, by) => `entry ${slug} is retired, ${by} replaces it`,
167
+ },
139
168
  manifest: {
140
169
  noGatesBlock: "no gates: block in .aqk.yml",
141
170
  alreadyDeclared: "already declared",
@@ -143,7 +172,13 @@ export const en = {
143
172
 
144
173
  add: {
145
174
  noSuchGate: (slug, cmd) => `No such gate: ${slug}\nThe applicable ones — ${cmd}`,
146
- noRecipe: (slug, stack) => `Entry ${slug} has no command for ${stack} and no portable one.`,
175
+ toolMissing: (slug, missing) =>
176
+ `Entry ${slug} needs ${missing.join(" and ")}, which is not on this machine.\n fix: install ${missing.join(" and ")} and try again — this entry delegates to a ready-made tool by design and has no check of its own.`,
177
+ noRecipe: (slug, stack, missing) =>
178
+ `Entry ${slug} has no command for ${stack} and no portable one.` +
179
+ (Array.isArray(missing) && missing.length
180
+ ? `\n fix: install ${missing.join(" or ")} and try again — this entry delegates to a ready-made tool by design and has no check of its own.`
181
+ : `\n fix: add a recipe for your stack to this entry's gate.yml, or pick another entry.`),
147
182
  thisStack: "this stack",
148
183
  needName: (cmd, doctor) => `Name the gate: ${cmd}. The list — ${doctor}`,
149
184
  noManifest: (cmd) => `No .aqk.yml — run ${cmd} first`,
@@ -196,7 +231,14 @@ export const en = {
196
231
  registryHead: (slug, stamp) =>
197
232
  `# Debt registry: ${slug}\n` +
198
233
  `# Captured ${stamp}. This list may ONLY get shorter.\n` +
199
- `# A new violation turns the gate red; a fixed one is struck out automatically.\n`,
234
+ `# A new violation turns the gate red; a fixed one is struck out automatically.\n` +
235
+ `#\n` +
236
+ `# Debt with no goal and no deadline never ends. The goal is how many violations count as\n` +
237
+ `# paid off; on reaching it the ratchet tells you to remove the wrapper. The deadline is\n` +
238
+ `# optional, but if set, debt still open past that date turns the gate red — a deadline\n` +
239
+ `# without a consequence is not a deadline.\n` +
240
+ `# aqk-goal: 0\n` +
241
+ `# aqk-deadline:\n`,
200
242
  recorded: (n) => `${n} violations recorded as debt`,
201
243
  libCopied: "wrapper copied into the project",
202
244
  wrapped: "command wrapped in the ratchet",
@@ -278,6 +320,8 @@ export const en = {
278
320
 
279
321
  init: {
280
322
  noDocs: (dir) => `Guides not found: ${dir}\nLooks like the package is not fully installed.`,
323
+ docsRu:
324
+ "the guides in .aqk/docs/ are in Russian — a deliberate decision, not a broken install.\n The rules in .aqk/rules/ are in English; the guides are prose an agent may ignore anyway,\n and what a machine holds lives in .aqk.yml and the gates. Translation waits for someone who needs it.",
281
325
  created: (n) => `created (${n}):`,
282
326
  andMore: (n) => `… and ${n} more`,
283
327
  kept: (n) => `already there, left untouched (${n}):`,
@@ -369,31 +413,27 @@ export const en = {
369
413
  nextWhy: "— run everything that is declared",
370
414
  },
371
415
 
372
- manifestDoc: {
373
- head: [
374
- "# .aqk.yml — the Agent Quality Kit manifest",
375
- "# What this is: a machine-readable description of how agents live in this repository.",
376
- "# `aqk doctor` computes the compliance level. An empty field = the level is not reached,",
377
- "# and that is honest: filling it with placeholders is pointless, files are checked, not words.",
378
- ],
379
- entry: "# AQK-0 — what the agent reads first.",
380
- rules: "# AQK-1 — where the standards are and which checks are mandatory.",
381
- gates: [
382
- " # name: a command returning 0 or non-zero. An empty declaration protects nothing and is",
383
- ' # rejected by the "a declared gate runs" check — hence examples here, not placeholders.',
384
- ' # lint: "ruff check ."',
385
- ' # test: "pytest -q"',
386
- " # To install a ready entry from the catalogue together with its samples: aqk add <name>",
387
- ],
388
- samples: [
389
- "# AQK-2 — what proves the gates work, and where the debt registries are.",
390
- "# samples: the directory with red and green samples (a gate must go red on the first and",
391
- "# stay quiet on the second). ratchets: lists of known violations that may only get",
392
- "# shorter.",
393
- ],
394
- lessons: "# AQK-3 — where lessons accumulate. A path or an address.",
395
- },
396
416
 
417
+ prove: {
418
+ title: "aqk prove — proving the gates",
419
+ running: "proving the gates against their samples…",
420
+ proven: (n) => `proven: ${n}`,
421
+ broken: (n) => `do not catch: ${n}`,
422
+ unprovable: (n) => `nothing to prove with: ${n}`,
423
+ okRed: "red on the red sample, silent on the green one",
424
+ redPassed: "stayed silent on the RED sample — the gate does not catch the defect",
425
+ greenFailed: "went red on the GREEN sample — the gate complains about working code",
426
+ empty: "the command is empty — a declaration without a command protects nothing",
427
+ noSamples: "no samples — nothing to prove with",
428
+ noTarget: "no place to substitute the sample directory — the command was written by hand",
429
+ otherRecipe: (lang) => `the samples are written for the "${lang}" recipe, another one is installed — nothing to prove with`,
430
+ noGates: "no gates declared — nothing to prove",
431
+ noSamplesDir: "the samples field in .aqk.yml is empty — nowhere to look for samples",
432
+ nothingProven:
433
+ "not a single gate is proven. A level above AQK-1 would mean trust in the author, not a fact:\n a project whose gate is `true` would pass it exactly like a project with real protection.",
434
+ fix: (cmd) => `fix: install a catalogue entry together with its samples — ${cmd}`,
435
+ heading: "Proving the gates",
436
+ },
397
437
  badge: {
398
438
  noManifest: (cmd) => `No .aqk.yml — there is no level yet. Start with ${cmd}`,
399
439
  notReached: (cmd) => `AQK-0 is not reached — there is nothing to put on a badge. What is missing: ${cmd}`,
@@ -442,33 +482,5 @@ export const en = {
442
482
  },
443
483
  },
444
484
 
445
- levels: [
446
- {
447
- title: "a manifest and an entry point",
448
- need: "create .aqk.yml and point entry at the file an agent reads first (AGENTS.md)",
449
- gives: "any tool understands what to read in this repository",
450
- },
451
- {
452
- title: "rules and working gates",
453
- need: "set rules (the standards directory) and fill at least one gate in gates with a real command",
454
- gives: "checks are declared as commands, not described in prose",
455
- },
456
- {
457
- title: "gates are proven, debt is under a ratchet",
458
- need: "set samples (red and green gate samples) and ratchets (debt registries)",
459
- gives: "the gate has proven it catches defects and stays quiet on correct code",
460
- },
461
- {
462
- title: "lessons come back into the work",
463
- need: "set lessons — the path or address of a journal where every incident yields a conclusion",
464
- gives: "the project learns: the same bruise is not collected twice",
465
- },
466
- ],
467
485
 
468
- report: {
469
- title: "aqk doctor --run",
470
- version: "version",
471
- level: "level",
472
- summary: (ok, all) => `total: ${ok} of ${all} green`,
473
- },
474
486
  };
@@ -0,0 +1,70 @@
1
+ // tool/i18n/ru-docs.mjs — тексты, которые уходят В ФАЙЛ, а не в терминал.
2
+ //
3
+ // ЗАЧЕМ ОТДЕЛЬНО. Каталог строк перерос собственный предел в 500 строк — его поймал наш же
4
+ // гейт file-size-limit. Шов выбран по смыслу, а не пополам: здесь то, что программа ПИШЕТ
5
+ // (комментарии в .aqk.yml, названия ступеней, форма отчёта), а в ru.mjs — то, что она ГОВОРИТ.
6
+ // У этих текстов разная жизнь: первые читает человек в своём репозитории месяцы спустя,
7
+ // вторые — он же в терминале, одну секунду.
8
+
9
+ const ruDocs = {
10
+ manifestDoc: {
11
+ head: [
12
+ "# .aqk.yml — манифест Agent Quality Kit",
13
+ "# Что это: машиночитаемое описание того, как в этом репозитории живут агенты.",
14
+ "# Уровень соответствия считает `aqk doctor`. Пустое поле = ступень не пройдена,",
15
+ "# и это честно: заполнять заглушками бессмысленно, проверяются файлы, а не слова.",
16
+ ],
17
+ entry: "# AQK-0 — что агент читает первым.",
18
+ rules: "# AQK-1 — где стандарты и какие проверки обязательны.",
19
+ gates: [
20
+ " # Имя: команда, возвращающая 0 или не 0. Пустое объявление защиты не даёт и бракуется",
21
+ " # проверкой «объявленный гейт запускается» — поэтому здесь примеры, а не заготовки.",
22
+ ' # lint: "ruff check ."',
23
+ ' # test: "pytest -q"',
24
+ " # Поставить готовую запись из каталога вместе с образцами: aqk add <имя>",
25
+ ],
26
+ samples: [
27
+ "# AQK-2 — чем доказано, что гейты работают, и где реестры долга.",
28
+ "# samples: каталог с красными и зелёными образцами (гейт обязан краснеть на первом",
29
+ "# и молчать на втором). ratchets: списки известных нарушений, которые могут только",
30
+ "# укорачиваться.",
31
+ ],
32
+ lessons: "# AQK-3 — где копятся уроки. Путь или адрес.",
33
+ advisory: [
34
+ "# Совещательные гейты: показывают находки, но не роняют прогон. Третий способ ввести",
35
+ "# правило — рядом с храповиком и с большой чисткой. Список называется в каждом прогоне:",
36
+ "# совещательный гейт, о котором забыли, — это выключенная проверка.",
37
+ "# advisory:",
38
+ "# - complexity-limit",
39
+ ],
40
+ },
41
+ levels: [
42
+ {
43
+ title: "манифест и точка входа",
44
+ need: "создай .aqk.yml и укажи в entry файл, который агент читает первым (AGENTS.md)",
45
+ gives: "любой инструмент понимает, что читать в этом репозитории",
46
+ },
47
+ {
48
+ title: "правила и работающие гейты",
49
+ need: "укажи rules (каталог стандартов) и заполни хотя бы один гейт в gates реальной командой",
50
+ gives: "проверки объявлены командами, а не описаны словами",
51
+ },
52
+ {
53
+ title: "гейты доказаны, долг под храповиком",
54
+ need: "заведи samples (красные и зелёные образцы гейтов) и ratchets (реестры долга)",
55
+ gives: "гейт доказал, что ловит брак и молчит на исправном коде",
56
+ },
57
+ {
58
+ title: "уроки возвращаются в работу",
59
+ need: "укажи lessons — путь или адрес журнала, где каждый инцидент даёт вывод",
60
+ gives: "проект учится: одна и та же шишка не набивается дважды",
61
+ },
62
+ ],
63
+ report: {
64
+ title: "aqk doctor --run",
65
+ version: "версия",
66
+ level: "уровень",
67
+ summary: (ok, all) => `итого: ${ok} из ${all} зелёных`,
68
+ },
69
+ };
70
+ export { ruDocs };
package/tool/i18n/ru.mjs CHANGED
@@ -4,9 +4,12 @@
4
4
  // проверка «оба каталога несут одни и те же ключи». Иначе один язык молча отстаёт, а
5
5
  // обещание «два языка» превращается в слова.
6
6
 
7
+ import { ruDocs } from "./ru-docs.mjs";
8
+
7
9
  import { templates } from "./templates-ru.mjs";
8
10
 
9
11
  export const ru = {
12
+ ...ruDocs,
10
13
  templates,
11
14
  help: {
12
15
  tagline: "оснастка для разработки с агентами",
@@ -14,8 +17,10 @@ export const ru = {
14
17
  init: "разложить правила и методички в текущий проект",
15
18
  initForce: "перезаписать уже существующие файлы",
16
19
  start: "кода ещё нет: сторожа дня 0 и порядок работы",
20
+ prove: "доказать, что гейты ловят брак: каждый по своему красному и зелёному образцу",
17
21
  doctor: "проверить, что разложено и чего не хватает",
18
22
  doctorRun: "ещё и запустить объявленные гейты",
23
+ doctorSince: "то же, но показать только то, что внёс диф относительно ссылки",
19
24
  add: "поставить гейт из каталога в проект",
20
25
  find: "есть ли уже такой гейт — сверка по намерению",
21
26
  why: "поймал ошибку — почему её не поймал сторож",
@@ -41,6 +46,8 @@ export const ru = {
41
46
  emptyCommands: (n) => `В AGENTS.md ${n} незаполненных команд.`,
42
47
  emptyCommandsWhy: "Агент не может выполнить пустую строку.",
43
48
 
49
+ levelUnproven: (cmd) => `не доказано: ${cmd}`,
50
+ gatesDoNotCatch: (n, cmd) => `гейтов, не ловящих брак: ${n}. Подробности: ${cmd}`,
44
51
  levelHeading: "Уровень соответствия AQK",
45
52
  levelNone: "нет",
46
53
  levelNotSet: "Уровень: стандарт в этом репозитории не заведён.",
@@ -67,6 +74,14 @@ export const ru = {
67
74
  totalTodo: (n) => `применимо но не поставлено ${n}`,
68
75
  totalSkip: (n) => `скрыто ${n}`,
69
76
 
77
+ sinceHeading: (ref, n) => `сужено до дифа относительно ${ref}: файлов затронуто ${n}`,
78
+ sinceBadRef: (ref) => `не могу сравнить с «${ref}»: такой ссылки нет или это не репозиторий git`,
79
+ notScopable: "вывод без путей — дифом не сужается, оставлен красным",
80
+ outsideDiff: (n) => `находки есть, но вне дифа (${n})`,
81
+ advisoryMark: "совещательный — показано, прогон не уронен",
82
+ advisorySummary: (names) =>
83
+ `совещательные и красные: ${names.join(", ")}. Это выключенные проверки: ` +
84
+ `либо почини и убери из advisory, либо признай, что правила нет.`,
70
85
  runHeading: "Прогон объявленных гейтов",
71
86
  timeout: "не уложился в 5 минут",
72
87
  exitCode: (code) => `код ${code}`,
@@ -133,6 +148,8 @@ export const ru = {
133
148
  has_deps: ["не видно файла зависимостей", "зависимости объявлены"],
134
149
  has_tests: ["не видно тестов", "тесты есть"],
135
150
  has_env: ["нет файла окружения", "файл окружения есть"],
151
+ has_agent_config: ["агента здесь не настраивали", "настройки агента есть"],
152
+ has_agent_entry: ["свода для агента здесь нет", "свод для агента есть"],
136
153
  has_ui: ["не видно стилей и компонентов интерфейса", "интерфейс есть: стили или компоненты"],
137
154
  },
138
155
  },
@@ -142,6 +159,19 @@ export const ru = {
142
159
  none: "рецепт не описан",
143
160
  },
144
161
 
162
+ // Зрелость записи каталога. Считается по доказательству; объявить её нельзя — см.
163
+ // entryLifecycle в tool/lib/manifest.mjs.
164
+ lifecycle: {
165
+ stable: "доказана шишкой из журнала",
166
+ experimental: "доказательство не из журнала — запись условная",
167
+ deprecated: "выведена из употребления",
168
+ unknownReplacement: (v) => `superseded_by: ${v} — такой записи в каталоге нет`,
169
+ noReplacement: "lifecycle: deprecated без superseded_by — не назван тот, кто заменяет",
170
+ notDeclarable: (v) => `lifecycle: ${v} объявлять нельзя — зрелость считается по доказательству`,
171
+ unknown: (v) => `lifecycle: ${v} — такого состояния нет; объявляется только deprecated`,
172
+ installDeprecated: (slug, by) =>
173
+ `запись ${slug} выведена из употребления, её заменяет ${by}`,
174
+ },
145
175
  manifest: {
146
176
  noGatesBlock: "в .aqk.yml нет блока gates:",
147
177
  alreadyDeclared: "уже объявлен",
@@ -149,7 +179,13 @@ export const ru = {
149
179
 
150
180
  add: {
151
181
  noSuchGate: (slug, cmd) => `Нет такого гейта: ${slug}\nСписок применимых — ${cmd}`,
152
- noRecipe: (slug, stack) => `У записи ${slug} нет команды ни под ${stack}, ни общей.`,
182
+ toolMissing: (slug, missing) =>
183
+ `Записи ${slug} нужен ${missing.join(" и ")}, а его нет на этой машине.\n почини: поставь ${missing.join(" и ")} и повтори — запись делегирует готовому инструменту по устройству, своей проверки у неё нет.`,
184
+ noRecipe: (slug, stack, missing) =>
185
+ `У записи ${slug} нет команды ни под ${stack}, ни общей.` +
186
+ (Array.isArray(missing) && missing.length
187
+ ? `\n почини: поставь ${missing.join(" или ")} и повтори — запись делегирует готовому инструменту по устройству, своей проверки у неё нет.`
188
+ : `\n почини: добавь рецепт под свой стек в gate.yml этой записи либо возьми другую.`),
153
189
  thisStack: "этот стек",
154
190
  needName: (cmd, doctor) => `Укажи имя гейта: ${cmd}. Список — ${doctor}`,
155
191
  noManifest: (cmd) => `Нет .aqk.yml — сначала ${cmd}`,
@@ -202,7 +238,13 @@ export const ru = {
202
238
  registryHead: (slug, stamp) =>
203
239
  `# Реестр долга: ${slug}\n` +
204
240
  `# Снят ${stamp}. Список разрешается ТОЛЬКО укорачивать.\n` +
205
- `# Новое нарушение красит гейт; исправленное вычёркивается автоматически.\n`,
241
+ `# Новое нарушение красит гейт; исправленное вычёркивается автоматически.\n` +
242
+ `#\n` +
243
+ `# Долг без цели и срока не кончается. Цель — сколько нарушений считать погашенным долгом;\n` +
244
+ `# по достижении храповик скажет убрать обёртку. Срок необязателен, но если он есть,\n` +
245
+ `# после этой даты непогашенный долг красит гейт — срок без последствия не срок.\n` +
246
+ `# aqk-goal: 0\n` +
247
+ `# aqk-deadline:\n`,
206
248
  recorded: (n) => `${n} нарушений записано долгом`,
207
249
  libCopied: "обёртка скопирована в проект",
208
250
  wrapped: "команда завёрнута в храповик",
@@ -284,6 +326,8 @@ export const ru = {
284
326
 
285
327
  init: {
286
328
  noDocs: (dir) => `Не найден корпус методичек: ${dir}\nПохоже, пакет установлен не полностью.`,
329
+ docsRu:
330
+ "методички в .aqk/docs/ остаются на русском — решение, а не недоделка.",
287
331
  created: (n) => `создано (${n}):`,
288
332
  andMore: (n) => `… и ещё ${n}`,
289
333
  kept: (n) => `уже были на месте, не тронуты (${n}):`,
@@ -375,31 +419,27 @@ export const ru = {
375
419
  nextWhy: "— прогнать всё, что объявлено",
376
420
  },
377
421
 
378
- manifestDoc: {
379
- head: [
380
- "# .aqk.yml — манифест Agent Quality Kit",
381
- "# Что это: машиночитаемое описание того, как в этом репозитории живут агенты.",
382
- "# Уровень соответствия считает `aqk doctor`. Пустое поле = ступень не пройдена,",
383
- "# и это честно: заполнять заглушками бессмысленно, проверяются файлы, а не слова.",
384
- ],
385
- entry: "# AQK-0 — что агент читает первым.",
386
- rules: "# AQK-1 — где стандарты и какие проверки обязательны.",
387
- gates: [
388
- " # Имя: команда, возвращающая 0 или не 0. Пустое объявление защиты не даёт и бракуется",
389
- " # проверкой «объявленный гейт запускается» — поэтому здесь примеры, а не заготовки.",
390
- ' # lint: "ruff check ."',
391
- ' # test: "pytest -q"',
392
- " # Поставить готовую запись из каталога вместе с образцами: aqk add <имя>",
393
- ],
394
- samples: [
395
- "# AQK-2 — чем доказано, что гейты работают, и где реестры долга.",
396
- "# samples: каталог с красными и зелёными образцами (гейт обязан краснеть на первом",
397
- "# и молчать на втором). ratchets: списки известных нарушений, которые могут только",
398
- "# укорачиваться.",
399
- ],
400
- lessons: "# AQK-3 — где копятся уроки. Путь или адрес.",
401
- },
402
422
 
423
+ prove: {
424
+ title: "aqk prove — доказательство гейтов",
425
+ running: "доказываю гейты по их образцам…",
426
+ proven: (n) => `доказано: ${n}`,
427
+ broken: (n) => `не ловят: ${n}`,
428
+ unprovable: (n) => `нечем доказать: ${n}`,
429
+ okRed: "краснеет на красном, молчит на зелёном",
430
+ redPassed: "промолчал на КРАСНОМ образце — гейт не ловит брак",
431
+ greenFailed: "покраснел на ЗЕЛЁНОМ образце — гейт ругается на исправный код",
432
+ empty: "команда пустая — объявление без команды защиты не даёт",
433
+ noSamples: "нет образцов — доказать нечем",
434
+ noTarget: "не видно, куда подставить каталог образца — команда написана руками",
435
+ otherRecipe: (lang) => `образцы написаны под рецепт «${lang}», а стоит другой — доказать нечем`,
436
+ noGates: "гейтов не объявлено — доказывать нечего",
437
+ noSamplesDir: "в .aqk.yml не заполнено поле samples — образцы искать негде",
438
+ nothingProven:
439
+ "ни один гейт не доказан. Уровень выше AQK-1 означал бы доверие к автору, а не факт:\n проект с гейтом «true» прошёл бы его так же, как проект с настоящей защитой.",
440
+ fix: (cmd) => `почини: поставь запись каталога вместе с образцами — ${cmd}`,
441
+ heading: "Доказательство гейтов",
442
+ },
403
443
  badge: {
404
444
  noManifest: (cmd) => `Нет .aqk.yml — уровня ещё нет. Начни с ${cmd}`,
405
445
  notReached: (cmd) => `AQK-0 не достигнут — значок выдавать не за что. Чего не хватает: ${cmd}`,
@@ -448,33 +488,5 @@ export const ru = {
448
488
  },
449
489
  },
450
490
 
451
- levels: [
452
- {
453
- title: "манифест и точка входа",
454
- need: "создай .aqk.yml и укажи в entry файл, который агент читает первым (AGENTS.md)",
455
- gives: "любой инструмент понимает, что читать в этом репозитории",
456
- },
457
- {
458
- title: "правила и работающие гейты",
459
- need: "укажи rules (каталог стандартов) и заполни хотя бы один гейт в gates реальной командой",
460
- gives: "проверки объявлены командами, а не описаны словами",
461
- },
462
- {
463
- title: "гейты доказаны, долг под храповиком",
464
- need: "заведи samples (красные и зелёные образцы гейтов) и ratchets (реестры долга)",
465
- gives: "гейт доказал, что ловит брак и молчит на исправном коде",
466
- },
467
- {
468
- title: "уроки возвращаются в работу",
469
- need: "укажи lessons — путь или адрес журнала, где каждый инцидент даёт вывод",
470
- gives: "проект учится: одна и та же шишка не набивается дважды",
471
- },
472
- ],
473
491
 
474
- report: {
475
- title: "aqk doctor --run",
476
- version: "версия",
477
- level: "уровень",
478
- summary: (ok, all) => `итого: ${ok} из ${all} зелёных`,
479
- },
480
492
  };
@@ -11,17 +11,17 @@ const AGENTS_MD = `# AGENTS.md
11
11
 
12
12
  ## Hard rules
13
13
 
14
- - **A plan before code.** A non-trivial task starts with a plan a human approved in words.
15
- - **A red test before code.** First a check that fails, then the implementation.
16
- - **Three attempts maximum.** Not solved in three — stop and ask a human, not a fourth try.
17
- - **Secrets only in the environment.** Never in code, logs or commits.
18
- - **Only the files the task is about.** No fixing things "while we are here".
19
- - **Done = proven.** Name the arbiter: a test, a live run, a check against the source.
14
+ - **A plan before code.** A non-trivial task starts with a plan a human approved in words. <!-- aqk: human -->
15
+ - **A red test before code.** First a check that fails, then the implementation. <!-- aqk: human -->
16
+ - **Three attempts maximum.** Not solved in three — stop and ask a human, not a fourth try. <!-- aqk: human -->
17
+ - **Secrets only in the environment.** Never in code, logs or commits. <!-- aqk: secrets-not-in-code -->
18
+ - **Only the files the task is about.** No fixing things "while we are here". <!-- aqk: human -->
19
+ - **Done = proven.** Name the arbiter: a test, a live run, a check against the source. <!-- aqk: human -->
20
20
  "Looks like it works" is not done.
21
- - **Never swallow an error.** Either handled and logged, or re-raised.
22
- - **A fork in the road is a question for a human.** Departing from an agreed decision is not
21
+ - **Never swallow an error.** Either handled and logged, or re-raised. <!-- aqk: human -->
22
+ - **A fork in the road is a question for a human.** Departing from an agreed decision is not <!-- aqk: human -->
23
23
  documented with a code comment.
24
- - **Report on your work with the kit with a command, not with words.** When you are done, run
24
+ - **Report on your work with the kit with a command, not with words.** When you are done, run <!-- aqk: human -->
25
25
  \`aqk report\`. It is assembled from an actual run: a summary from memory always picks the
26
26
  convenient parts and stays quiet about a gate standing on the weakest recipe.
27
27
 
@@ -16,17 +16,17 @@ const AGENTS_MD = `# AGENTS.md
16
16
 
17
17
  ## Железные правила
18
18
 
19
- - **План до кода.** Нетривиальная задача начинается с плана, который человек одобрил словами.
20
- - **Красный тест до кода.** Сначала проверка, которая падает, потом реализация.
21
- - **Максимум 3 попытки.** Не решил за три — стоп и человеку, а не четвёртый заход.
22
- - **Секреты только в окружении.** Никогда в коде, логах и коммитах.
23
- - **Только файлы из задачи.** Заодно ничего не чиним.
24
- - **Готово = доказано.** Назови арбитра: тест, живой прогон, сверка с источником. «Выглядит
19
+ - **План до кода.** Нетривиальная задача начинается с плана, который человек одобрил словами. <!-- aqk: человек -->
20
+ - **Красный тест до кода.** Сначала проверка, которая падает, потом реализация. <!-- aqk: человек -->
21
+ - **Максимум 3 попытки.** Не решил за три — стоп и человеку, а не четвёртый заход. <!-- aqk: человек -->
22
+ - **Секреты только в окружении.** Никогда в коде, логах и коммитах. <!-- aqk: secrets-not-in-code -->
23
+ - **Только файлы из задачи.** Заодно ничего не чиним. <!-- aqk: человек -->
24
+ - **Готово = доказано.** Назови арбитра: тест, живой прогон, сверка с источником. «Выглядит <!-- aqk: человек -->
25
25
  рабочим» — не готово.
26
- - **Ошибку не глотать.** Либо обработана и залогирована, либо проброшена.
27
- - **Развилка — вопрос человеку.** Отступление от принятого решения не оформляется комментарием
26
+ - **Ошибку не глотать.** Либо обработана и залогирована, либо проброшена. <!-- aqk: человек -->
27
+ - **Развилка — вопрос человеку.** Отступление от принятого решения не оформляется комментарием <!-- aqk: человек -->
28
28
  в коде.
29
- - **Отчёт о работе с комплектом — командой, а не словами.** Закончил — выполни \`aqk report\`.
29
+ - **Отчёт о работе с комплектом — командой, а не словами.** Закончил — выполни \`aqk report\`. <!-- aqk: человек -->
30
30
  Он собирается прогоном: пересказ по памяти всегда выбирает удобное и молчит о том, что гейт
31
31
  стоит на слабейшем рецепте.
32
32
 
package/tool/lib/core.mjs CHANGED
@@ -4,6 +4,7 @@
4
4
  // пределе в 500. Разделена по назначению, а не пополам — так требует наше же правило про
5
5
  // размер файла. Зависимостей по-прежнему нет ни одной: только встроенные модули Node.
6
6
 
7
+ import { LANG } from "../i18n/index.mjs";
7
8
  import { access, readdir, mkdir, copyFile, writeFile } from "node:fs/promises";
8
9
  import { constants } from "node:fs";
9
10
  import { fileURLToPath } from "node:url";
@@ -17,7 +18,12 @@ const PKG_ROOT = resolve(HERE, "..", "..");
17
18
  const CWD = process.cwd();
18
19
 
19
20
  const DOCS_SRC = join(PKG_ROOT, "kit", "docs");
20
- const RULES_SRC = join(PKG_ROOT, "kit", "rules");
21
+ // Правила переносятся в проект НА ЯЗЫКЕ ВЫВОДА. Русский текст в англоязычном проекте — не
22
+ // мелочь: это первое, что там откроет человек, и первое, чего он не прочитает. Русская версия
23
+ // остаётся источником истины, английская — переводом; расходиться им нельзя, и совпадение
24
+ // НАБОРА ФАЙЛОВ сторожит модульная проверка. Совпадение содержания машина не сторожит — это
25
+ // названо в AGENTS.md, а не спрятано.
26
+ const RULES_SRC = join(PKG_ROOT, "kit", LANG === "en" ? "rules-en" : "rules");
21
27
  const TARGET_DIR = ".aqk";
22
28
 
23
29
  const c = {