the-grimoire-cli 0.3.2 → 0.5.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 (95) hide show
  1. package/.agents/AGENTS.md +112 -112
  2. package/.agents/NAVIGATOR.md +193 -168
  3. package/.agents/VERSION +4 -4
  4. package/.agents/agents/INDEX.md +7 -7
  5. package/.agents/agents/verifier.md +50 -50
  6. package/.agents/commands/INDEX.md +11 -11
  7. package/.agents/commands/checkpoint.md +15 -15
  8. package/.agents/commands/grimoire.md +14 -14
  9. package/.agents/commands/onboard.md +56 -56
  10. package/.agents/commands/present.md +23 -23
  11. package/.agents/commands/verify.md +20 -20
  12. package/.agents/grimoire.manifest +18 -18
  13. package/.agents/rules/00-always.md +42 -42
  14. package/.agents/rules/05-code-quality.md +28 -28
  15. package/.agents/rules/10-working-process.md +31 -31
  16. package/.agents/rules/15-skills.md +27 -27
  17. package/.agents/rules/20-modes.md +41 -41
  18. package/.agents/rules/25-surgical-changes.md +29 -29
  19. package/.agents/rules/30-verification.md +36 -36
  20. package/.agents/rules/35-context-economy.md +41 -41
  21. package/.agents/rules/40-handoff.md +25 -25
  22. package/.agents/rules/45-presentation.md +35 -35
  23. package/.agents/rules/50-security.md +30 -30
  24. package/.agents/rules/60-commit-style.md +14 -14
  25. package/.agents/rules/INDEX.md +18 -18
  26. package/.agents/skills/INDEX.md +8 -8
  27. package/.agents/skills/README.md +1 -1
  28. package/.agents/skills/catalog.md +106 -106
  29. package/.agents/skills/find-skills/SKILL.md +142 -142
  30. package/.agents/stack/README.md +71 -66
  31. package/.agents/stack/desktop.md +36 -36
  32. package/.agents/stack/library.md +1 -1
  33. package/.agents/stack/web-app.md +32 -32
  34. package/.agents/standards/INDEX.md +23 -23
  35. package/.agents/standards/accessibility.md +50 -50
  36. package/.agents/standards/architecture.md +39 -39
  37. package/.agents/standards/attribution.md +39 -39
  38. package/.agents/standards/clean-code.md +121 -121
  39. package/.agents/standards/codex.md +69 -69
  40. package/.agents/standards/error-codes.md +41 -41
  41. package/.agents/standards/general.md +46 -46
  42. package/.agents/standards/guardrail-tests.md +40 -40
  43. package/.agents/standards/knowledge-management.md +35 -35
  44. package/.agents/standards/launch-security-checklist.md +45 -45
  45. package/.agents/standards/observability.md +35 -35
  46. package/.agents/standards/release-versioning.md +53 -53
  47. package/.agents/standards/requirements.md +75 -75
  48. package/.agents/standards/security-scanners.md +42 -42
  49. package/.agents/standards/testing-strategy.md +61 -61
  50. package/.agents/standards/typescript.md +19 -19
  51. package/.agents/standards/writing.md +58 -58
  52. package/.agents/tooling.json +20 -19
  53. package/LICENSE +1 -1
  54. package/README.md +139 -139
  55. package/bin/grimoire.mjs +667 -598
  56. package/package.json +32 -32
  57. package/templates/CLAUDE.md +7 -7
  58. package/templates/ci/ci.yml +49 -49
  59. package/templates/ci/sast.yml +44 -44
  60. package/templates/codex/INDEX.md +18 -18
  61. package/templates/codex/README.md +28 -28
  62. package/templates/codex/decisions/0000-template.md +36 -36
  63. package/templates/codex/decisions/INDEX.md +11 -11
  64. package/templates/codex/decisions/README.md +25 -25
  65. package/templates/codex/domain/INDEX.md +14 -14
  66. package/templates/codex/domain/README.md +10 -10
  67. package/templates/codex/evidence/0000-extraction-template.md +36 -36
  68. package/templates/codex/evidence/INDEX.md +11 -11
  69. package/templates/codex/evidence/README.md +15 -15
  70. package/templates/codex/reference/INDEX.md +11 -11
  71. package/templates/codex/reference/README.md +15 -15
  72. package/templates/codex/reference/confirmed-values.md +18 -18
  73. package/templates/codex/requirements/INDEX.md +11 -11
  74. package/templates/codex/requirements/README.md +22 -22
  75. package/templates/codex/requirements/addons/0000-template.md +35 -35
  76. package/templates/codex/requirements/base.md +36 -36
  77. package/templates/codex/requirements/changes/0000-template.md +39 -39
  78. package/templates/codex/resources/INDEX.md +11 -11
  79. package/templates/codex/resources/README.md +17 -17
  80. package/templates/codex/resources/manifest.md +11 -11
  81. package/templates/codex/runbooks/INDEX.md +9 -9
  82. package/templates/codex/runbooks/README.md +8 -8
  83. package/templates/codex/runbooks/incident-runbook-template.md +58 -58
  84. package/templates/gitignore-snippet.txt +10 -12
  85. package/templates/journal/backlog/README.md +18 -18
  86. package/templates/journal/memory/MEMORY.md +15 -15
  87. package/templates/journal/session/archive/.gitkeep +1 -1
  88. package/templates/journal/session/artifacts/.gitkeep +1 -1
  89. package/templates/journal/session/current.md +12 -12
  90. package/templates/lint/README.md +25 -25
  91. package/templates/lint/eslint.config.mjs +33 -33
  92. package/templates/lint/tsconfig.base.json +11 -11
  93. package/templates/local/AGENTS.local.md +33 -33
  94. package/templates/local/README.md +55 -55
  95. package/templates/tests/guardrail.invariants.test.ts +59 -59
@@ -1,59 +1,59 @@
1
- // Guardrail test — structural invariants (standards/guardrail-tests.md).
2
- // Copy into the project's test dir and adapt the scanners. Runs under the existing `verify` gate
3
- // (Vitest shown; the pattern is runner-agnostic). Fail CLOSED: a scan that returns nothing because
4
- // it could not read its source is a failure, not a pass.
5
- import { describe, it, expect } from "vitest";
6
- import fs from "node:fs";
7
- import path from "node:path";
8
-
9
- const SRC = path.resolve(__dirname, "..", "src");
10
-
11
- function walk(dir: string, ext = ".ts"): string[] {
12
- const out: string[] = [];
13
- for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
14
- const p = path.join(dir, e.name);
15
- if (e.isDirectory()) out.push(...walk(p, ext));
16
- else if (e.name.endsWith(ext)) out.push(p);
17
- }
18
- return out;
19
- }
20
-
21
- function scan(re: RegExp): Set<string> {
22
- const hits = new Set<string>();
23
- for (const f of walk(SRC)) {
24
- const text = fs.readFileSync(f, "utf8");
25
- for (const m of text.matchAll(re)) hits.add(m[1]);
26
- }
27
- return hits;
28
- }
29
-
30
- function diff(a: Set<string>, b: Set<string>): string[] {
31
- return [...a].filter((x) => !b.has(x)).sort();
32
- }
33
-
34
- describe("guardrail: IPC channels are allow-listed", () => {
35
- // EXAMPLE — replace with the project's real registry/allow-list source of truth.
36
- const ALLOW_LIST: string[] = require("../src/ipc/allow-list").CHANNELS; // declared truth
37
- const used = scan(/ipcMain\.handle\(\s*["']([^"']+)["']/g); // live call sites
38
-
39
- it("every registered channel is declared (fail closed on undeclared)", () => {
40
- expect(used.size).toBeGreaterThan(0); // scanner found something — not a silent empty
41
- expect(diff(used, new Set(ALLOW_LIST))).toEqual([]); // used but undeclared
42
- });
43
-
44
- it("no stale allow-list entries", () => {
45
- expect(diff(new Set(ALLOW_LIST), used)).toEqual([]); // declared but unused
46
- });
47
- });
48
-
49
- describe("guardrail: thrown error codes exist in the catalog", () => {
50
- // EXAMPLE — replace catalog source + throw pattern with the project's.
51
- const catalog = fs.readFileSync(path.resolve(__dirname, "../.agents/standards/error-codes.md"), "utf8");
52
- const declared = new Set([...catalog.matchAll(/`([A-Z]+_[A-Z0-9_]+)`/g)].map((m) => m[1]));
53
- const thrown = scan(/AppError\(\s*["']([A-Z]+_[A-Z0-9_]+)["']/g);
54
-
55
- it("every thrown code is catalogued", () => {
56
- expect(declared.size).toBeGreaterThan(0); // catalog readable — fail closed, not a silent skip
57
- expect(diff(thrown, declared)).toEqual([]);
58
- });
59
- });
1
+ // Guardrail test — structural invariants (standards/guardrail-tests.md).
2
+ // Copy into the project's test dir and adapt the scanners. Runs under the existing `verify` gate
3
+ // (Vitest shown; the pattern is runner-agnostic). Fail CLOSED: a scan that returns nothing because
4
+ // it could not read its source is a failure, not a pass.
5
+ import { describe, it, expect } from "vitest";
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+
9
+ const SRC = path.resolve(__dirname, "..", "src");
10
+
11
+ function walk(dir: string, ext = ".ts"): string[] {
12
+ const out: string[] = [];
13
+ for (const e of fs.readdirSync(dir, { withFileTypes: true })) {
14
+ const p = path.join(dir, e.name);
15
+ if (e.isDirectory()) out.push(...walk(p, ext));
16
+ else if (e.name.endsWith(ext)) out.push(p);
17
+ }
18
+ return out;
19
+ }
20
+
21
+ function scan(re: RegExp): Set<string> {
22
+ const hits = new Set<string>();
23
+ for (const f of walk(SRC)) {
24
+ const text = fs.readFileSync(f, "utf8");
25
+ for (const m of text.matchAll(re)) hits.add(m[1]);
26
+ }
27
+ return hits;
28
+ }
29
+
30
+ function diff(a: Set<string>, b: Set<string>): string[] {
31
+ return [...a].filter((x) => !b.has(x)).sort();
32
+ }
33
+
34
+ describe("guardrail: IPC channels are allow-listed", () => {
35
+ // EXAMPLE — replace with the project's real registry/allow-list source of truth.
36
+ const ALLOW_LIST: string[] = require("../src/ipc/allow-list").CHANNELS; // declared truth
37
+ const used = scan(/ipcMain\.handle\(\s*["']([^"']+)["']/g); // live call sites
38
+
39
+ it("every registered channel is declared (fail closed on undeclared)", () => {
40
+ expect(used.size).toBeGreaterThan(0); // scanner found something — not a silent empty
41
+ expect(diff(used, new Set(ALLOW_LIST))).toEqual([]); // used but undeclared
42
+ });
43
+
44
+ it("no stale allow-list entries", () => {
45
+ expect(diff(new Set(ALLOW_LIST), used)).toEqual([]); // declared but unused
46
+ });
47
+ });
48
+
49
+ describe("guardrail: thrown error codes exist in the catalog", () => {
50
+ // EXAMPLE — replace catalog source + throw pattern with the project's.
51
+ const catalog = fs.readFileSync(path.resolve(__dirname, "../.agents/standards/error-codes.md"), "utf8");
52
+ const declared = new Set([...catalog.matchAll(/`([A-Z]+_[A-Z0-9_]+)`/g)].map((m) => m[1]));
53
+ const thrown = scan(/AppError\(\s*["']([A-Z]+_[A-Z0-9_]+)["']/g);
54
+
55
+ it("every thrown code is catalogued", () => {
56
+ expect(declared.size).toBeGreaterThan(0); // catalog readable — fail closed, not a silent skip
57
+ expect(diff(thrown, declared)).toEqual([]);
58
+ });
59
+ });