the-grimoire-cli 0.3.2 → 0.4.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/.agents/AGENTS.md +112 -112
- package/.agents/NAVIGATOR.md +188 -168
- package/.agents/VERSION +4 -4
- package/.agents/agents/INDEX.md +7 -7
- package/.agents/agents/verifier.md +50 -50
- package/.agents/commands/INDEX.md +11 -11
- package/.agents/commands/checkpoint.md +15 -15
- package/.agents/commands/grimoire.md +14 -14
- package/.agents/commands/onboard.md +56 -56
- package/.agents/commands/present.md +23 -23
- package/.agents/commands/verify.md +20 -20
- package/.agents/grimoire.manifest +18 -18
- package/.agents/rules/00-always.md +42 -42
- package/.agents/rules/05-code-quality.md +28 -28
- package/.agents/rules/10-working-process.md +31 -31
- package/.agents/rules/15-skills.md +27 -27
- package/.agents/rules/20-modes.md +41 -41
- package/.agents/rules/25-surgical-changes.md +29 -29
- package/.agents/rules/30-verification.md +36 -36
- package/.agents/rules/35-context-economy.md +41 -41
- package/.agents/rules/40-handoff.md +25 -25
- package/.agents/rules/45-presentation.md +35 -35
- package/.agents/rules/50-security.md +30 -30
- package/.agents/rules/60-commit-style.md +14 -14
- package/.agents/rules/INDEX.md +18 -18
- package/.agents/skills/INDEX.md +8 -8
- package/.agents/skills/README.md +1 -1
- package/.agents/skills/catalog.md +106 -106
- package/.agents/skills/find-skills/SKILL.md +142 -142
- package/.agents/stack/README.md +69 -66
- package/.agents/stack/desktop.md +36 -36
- package/.agents/stack/library.md +1 -1
- package/.agents/stack/web-app.md +32 -32
- package/.agents/standards/INDEX.md +23 -23
- package/.agents/standards/accessibility.md +50 -50
- package/.agents/standards/architecture.md +39 -39
- package/.agents/standards/attribution.md +39 -39
- package/.agents/standards/clean-code.md +121 -121
- package/.agents/standards/codex.md +69 -69
- package/.agents/standards/error-codes.md +41 -41
- package/.agents/standards/general.md +46 -46
- package/.agents/standards/guardrail-tests.md +40 -40
- package/.agents/standards/knowledge-management.md +35 -35
- package/.agents/standards/launch-security-checklist.md +45 -45
- package/.agents/standards/observability.md +35 -35
- package/.agents/standards/release-versioning.md +53 -53
- package/.agents/standards/requirements.md +75 -75
- package/.agents/standards/security-scanners.md +42 -42
- package/.agents/standards/testing-strategy.md +61 -61
- package/.agents/standards/typescript.md +19 -19
- package/.agents/standards/writing.md +58 -58
- package/.agents/tooling.json +19 -19
- package/LICENSE +1 -1
- package/README.md +139 -139
- package/bin/grimoire.mjs +630 -598
- package/package.json +32 -32
- package/templates/CLAUDE.md +7 -7
- package/templates/ci/ci.yml +49 -49
- package/templates/ci/sast.yml +44 -44
- package/templates/codex/INDEX.md +18 -18
- package/templates/codex/README.md +28 -28
- package/templates/codex/decisions/0000-template.md +36 -36
- package/templates/codex/decisions/INDEX.md +11 -11
- package/templates/codex/decisions/README.md +25 -25
- package/templates/codex/domain/INDEX.md +14 -14
- package/templates/codex/domain/README.md +10 -10
- package/templates/codex/evidence/0000-extraction-template.md +36 -36
- package/templates/codex/evidence/INDEX.md +11 -11
- package/templates/codex/evidence/README.md +15 -15
- package/templates/codex/reference/INDEX.md +11 -11
- package/templates/codex/reference/README.md +15 -15
- package/templates/codex/reference/confirmed-values.md +18 -18
- package/templates/codex/requirements/INDEX.md +11 -11
- package/templates/codex/requirements/README.md +22 -22
- package/templates/codex/requirements/addons/0000-template.md +35 -35
- package/templates/codex/requirements/base.md +36 -36
- package/templates/codex/requirements/changes/0000-template.md +39 -39
- package/templates/codex/resources/INDEX.md +11 -11
- package/templates/codex/resources/README.md +17 -17
- package/templates/codex/resources/manifest.md +11 -11
- package/templates/codex/runbooks/INDEX.md +9 -9
- package/templates/codex/runbooks/README.md +8 -8
- package/templates/codex/runbooks/incident-runbook-template.md +58 -58
- package/templates/gitignore-snippet.txt +10 -12
- package/templates/journal/backlog/README.md +18 -18
- package/templates/journal/memory/MEMORY.md +15 -15
- package/templates/journal/session/archive/.gitkeep +1 -1
- package/templates/journal/session/artifacts/.gitkeep +1 -1
- package/templates/journal/session/current.md +12 -12
- package/templates/lint/README.md +25 -25
- package/templates/lint/eslint.config.mjs +33 -33
- package/templates/lint/tsconfig.base.json +11 -11
- package/templates/local/AGENTS.local.md +33 -33
- package/templates/local/README.md +55 -55
- 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
|
+
});
|