@kiwidata/grimoire 0.1.3 → 0.1.4

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 (127) hide show
  1. package/AGENTS.md +56 -4
  2. package/README.md +28 -1
  3. package/dist/cli/index.js +2 -0
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/commands/check.js +1 -1
  6. package/dist/commands/check.js.map +1 -1
  7. package/dist/commands/configure.d.ts +3 -0
  8. package/dist/commands/configure.d.ts.map +1 -0
  9. package/dist/commands/configure.js +19 -0
  10. package/dist/commands/configure.js.map +1 -0
  11. package/dist/commands/init.d.ts.map +1 -1
  12. package/dist/commands/init.js +2 -0
  13. package/dist/commands/init.js.map +1 -1
  14. package/dist/commands/map.d.ts.map +1 -1
  15. package/dist/commands/map.js +10 -11
  16. package/dist/commands/map.js.map +1 -1
  17. package/dist/core/archive.d.ts.map +1 -1
  18. package/dist/core/archive.js +32 -43
  19. package/dist/core/archive.js.map +1 -1
  20. package/dist/core/check.d.ts.map +1 -1
  21. package/dist/core/check.js +115 -104
  22. package/dist/core/check.js.map +1 -1
  23. package/dist/core/ci.d.ts.map +1 -1
  24. package/dist/core/ci.js +50 -69
  25. package/dist/core/ci.js.map +1 -1
  26. package/dist/core/configure.d.ts +14 -0
  27. package/dist/core/configure.d.ts.map +1 -0
  28. package/dist/core/configure.js +434 -0
  29. package/dist/core/configure.js.map +1 -0
  30. package/dist/core/detect.d.ts.map +1 -1
  31. package/dist/core/detect.js +153 -26
  32. package/dist/core/detect.js.map +1 -1
  33. package/dist/core/diff.d.ts.map +1 -1
  34. package/dist/core/diff.js +62 -93
  35. package/dist/core/diff.js.map +1 -1
  36. package/dist/core/doc-style.d.ts +0 -4
  37. package/dist/core/doc-style.d.ts.map +1 -1
  38. package/dist/core/doc-style.js +28 -23
  39. package/dist/core/doc-style.js.map +1 -1
  40. package/dist/core/docs.js +106 -100
  41. package/dist/core/docs.js.map +1 -1
  42. package/dist/core/health.js +55 -77
  43. package/dist/core/health.js.map +1 -1
  44. package/dist/core/hooks.d.ts +0 -3
  45. package/dist/core/hooks.d.ts.map +1 -1
  46. package/dist/core/hooks.js +0 -11
  47. package/dist/core/hooks.js.map +1 -1
  48. package/dist/core/init.d.ts +2 -0
  49. package/dist/core/init.d.ts.map +1 -1
  50. package/dist/core/init.js +230 -406
  51. package/dist/core/init.js.map +1 -1
  52. package/dist/core/list.d.ts.map +1 -1
  53. package/dist/core/list.js +55 -65
  54. package/dist/core/list.js.map +1 -1
  55. package/dist/core/log.d.ts.map +1 -1
  56. package/dist/core/log.js +23 -33
  57. package/dist/core/log.js.map +1 -1
  58. package/dist/core/map.d.ts +15 -2
  59. package/dist/core/map.d.ts.map +1 -1
  60. package/dist/core/map.js +257 -194
  61. package/dist/core/map.js.map +1 -1
  62. package/dist/core/shared-setup.d.ts +0 -40
  63. package/dist/core/shared-setup.d.ts.map +1 -1
  64. package/dist/core/shared-setup.js +87 -52
  65. package/dist/core/shared-setup.js.map +1 -1
  66. package/dist/core/status.d.ts.map +1 -1
  67. package/dist/core/status.js +42 -52
  68. package/dist/core/status.js.map +1 -1
  69. package/dist/core/test-quality.d.ts +0 -8
  70. package/dist/core/test-quality.d.ts.map +1 -1
  71. package/dist/core/test-quality.js +24 -30
  72. package/dist/core/test-quality.js.map +1 -1
  73. package/dist/core/trace.d.ts.map +1 -1
  74. package/dist/core/trace.js +31 -41
  75. package/dist/core/trace.js.map +1 -1
  76. package/dist/core/update.d.ts.map +1 -1
  77. package/dist/core/update.js +61 -11
  78. package/dist/core/update.js.map +1 -1
  79. package/dist/core/validate.d.ts +1 -4
  80. package/dist/core/validate.d.ts.map +1 -1
  81. package/dist/core/validate.js +126 -148
  82. package/dist/core/validate.js.map +1 -1
  83. package/dist/utils/config.d.ts +15 -5
  84. package/dist/utils/config.d.ts.map +1 -1
  85. package/dist/utils/config.js +63 -42
  86. package/dist/utils/config.js.map +1 -1
  87. package/dist/utils/fs.d.ts +0 -12
  88. package/dist/utils/fs.d.ts.map +1 -1
  89. package/dist/utils/fs.js +0 -12
  90. package/dist/utils/fs.js.map +1 -1
  91. package/dist/utils/paths.d.ts +0 -6
  92. package/dist/utils/paths.d.ts.map +1 -1
  93. package/dist/utils/paths.js +0 -6
  94. package/dist/utils/paths.js.map +1 -1
  95. package/dist/utils/spawn.d.ts +0 -3
  96. package/dist/utils/spawn.d.ts.map +1 -1
  97. package/dist/utils/spawn.js +0 -3
  98. package/dist/utils/spawn.js.map +1 -1
  99. package/package.json +1 -1
  100. package/skills/grimoire-apply/SKILL.md +84 -16
  101. package/skills/grimoire-audit/SKILL.md +21 -1
  102. package/skills/grimoire-bug/SKILL.md +48 -9
  103. package/skills/grimoire-commit/SKILL.md +2 -1
  104. package/skills/grimoire-design/SKILL.md +259 -0
  105. package/skills/grimoire-design-consult/SKILL.md +200 -0
  106. package/skills/grimoire-discover/SKILL.md +65 -2
  107. package/skills/grimoire-draft/SKILL.md +85 -2
  108. package/skills/grimoire-plan/SKILL.md +61 -18
  109. package/skills/grimoire-pr/SKILL.md +4 -6
  110. package/skills/grimoire-pr-review/SKILL.md +45 -114
  111. package/skills/grimoire-precommit-review/SKILL.md +205 -0
  112. package/skills/grimoire-refactor/SKILL.md +5 -5
  113. package/skills/grimoire-review/SKILL.md +74 -147
  114. package/skills/grimoire-verify/SKILL.md +33 -0
  115. package/skills/references/adversarial-personas.md +225 -0
  116. package/skills/references/brand-tokens-format.md +186 -0
  117. package/skills/references/code-quality.md +140 -0
  118. package/skills/references/design-heuristics.md +138 -0
  119. package/skills/references/design-input-formats.md +190 -0
  120. package/skills/references/pattern-guard.md +180 -0
  121. package/skills/references/refactor-scan-categories.md +152 -0
  122. package/skills/references/review-personas.md +405 -0
  123. package/skills/references/security-compliance.md +22 -1
  124. package/skills/references/visual-fidelity.md +206 -0
  125. package/templates/brand-tokens-example.json +13 -0
  126. package/templates/brand-voice-example.md +22 -0
  127. package/templates/design-tool-setup-stub.md +59 -0
@@ -1 +1 @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AAC,CAAC,CAAC,SAAS,CAA2B;KACtD,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAc;IACtC,OAAO,GAAG;SACP,MAAM,CAAC,CAAC,IAAI,EAAmC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;SACrF,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7B,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAc;IACvC,OAAO,GAAG;SACP,MAAM,CAAC,CAAC,IAAI,EAAmC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,CAAC;SACrF,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACd,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAC7B,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC;QAC1B,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,GAAG,CAAC,GAAY;IACvB,OAAO,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AACvC,CAAC"}
@@ -1,17 +1,5 @@
1
- /**
2
- * Check if a path exists (file or directory).
3
- */
4
1
  export declare function fileExists(path: string): Promise<boolean>;
5
- /**
6
- * Read a file, returning null if it doesn't exist or can't be read.
7
- */
8
2
  export declare function readFileOrNull(path: string): Promise<string | null>;
9
- /**
10
- * Escape a string for use in a RegExp constructor.
11
- */
12
3
  export declare function escapeRegex(str: string): string;
13
- /**
14
- * Find files matching a glob extension pattern under a directory.
15
- */
16
4
  export declare function findFiles(dir: string, ext: string): Promise<string[]>;
17
5
  //# sourceMappingURL=fs.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAED;;GAEG;AACH,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE3E"}
1
+ {"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAIA,wBAAsB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO/D;AAGD,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAMzE;AAGD,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE/C;AAGD,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAE3E"}
package/dist/utils/fs.js CHANGED
@@ -1,8 +1,5 @@
1
1
  import { access, readFile } from "node:fs/promises";
2
2
  import fg from "fast-glob";
3
- /**
4
- * Check if a path exists (file or directory).
5
- */
6
3
  export async function fileExists(path) {
7
4
  try {
8
5
  await access(path);
@@ -12,9 +9,6 @@ export async function fileExists(path) {
12
9
  return false;
13
10
  }
14
11
  }
15
- /**
16
- * Read a file, returning null if it doesn't exist or can't be read.
17
- */
18
12
  export async function readFileOrNull(path) {
19
13
  try {
20
14
  return await readFile(path, "utf-8");
@@ -23,15 +17,9 @@ export async function readFileOrNull(path) {
23
17
  return null;
24
18
  }
25
19
  }
26
- /**
27
- * Escape a string for use in a RegExp constructor.
28
- */
29
20
  export function escapeRegex(str) {
30
21
  return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31
22
  }
32
- /**
33
- * Find files matching a glob extension pattern under a directory.
34
- */
35
23
  export async function findFiles(dir, ext) {
36
24
  return fg(`**/*${ext}`, { cwd: dir, absolute: true });
37
25
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,WAAW,CAAC;AAE3B;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,GAAW;IACtD,OAAO,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"fs.js","sourceRoot":"","sources":["../../src/utils/fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,MAAM,WAAW,CAAC;AAG3B,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,IAAI,CAAC;QACH,OAAO,MAAM,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAGD,MAAM,UAAU,WAAW,CAAC,GAAW;IACrC,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACpD,CAAC;AAGD,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,GAAW;IACtD,OAAO,EAAE,CAAC,OAAO,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;AACxD,CAAC"}
@@ -1,10 +1,4 @@
1
- /**
2
- * Walk up from cwd to find a directory containing .grimoire/ or features/
3
- */
4
1
  export declare function findProjectRoot(): Promise<string>;
5
2
  export declare function resolveChangePath(root: string, changeId: string): string;
6
- /**
7
- * Resolve a path and verify it stays within the project root.
8
- */
9
3
  export declare function safePath(root: string, filePath: string): string;
10
4
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAgBvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKxE;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM/D"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAIA,wBAAsB,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC,CAgBvD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKxE;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAM/D"}
@@ -1,8 +1,5 @@
1
1
  import { join, resolve } from "node:path";
2
2
  import { fileExists } from "./fs.js";
3
- /**
4
- * Walk up from cwd to find a directory containing .grimoire/ or features/
5
- */
6
3
  export async function findProjectRoot() {
7
4
  let dir = process.cwd();
8
5
  const root = resolve("/");
@@ -22,9 +19,6 @@ export function resolveChangePath(root, changeId) {
22
19
  }
23
20
  return join(root, ".grimoire", "changes", changeId);
24
21
  }
25
- /**
26
- * Resolve a path and verify it stays within the project root.
27
- */
28
22
  export function safePath(root, filePath) {
29
23
  const resolved = resolve(root, filePath);
30
24
  if (!resolved.startsWith(root + "/") && resolved !== root) {
@@ -1 +1 @@
1
- {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC;;GAEG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IAAI,GAAG,GAAG,CAAC,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1D,MAAM,IAAI,KAAK,CAAC,8BAA8B,QAAQ,EAAE,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,5 +1,2 @@
1
- /**
2
- * Spawn a command with stdin piped, avoiding sh -c shell interpretation.
3
- */
4
1
  export declare function spawnWithStdin(command: string, args: string[], input: string, cwd: string): Promise<string>;
5
2
  //# sourceMappingURL=spawn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/utils/spawn.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
1
+ {"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../src/utils/spawn.ts"],"names":[],"mappings":"AAGA,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EAAE,EACd,KAAK,EAAE,MAAM,EACb,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAoCjB"}
@@ -1,7 +1,4 @@
1
1
  import { spawn } from "node:child_process";
2
- /**
3
- * Spawn a command with stdin piped, avoiding sh -c shell interpretation.
4
- */
5
2
  export function spawnWithStdin(command, args, input, cwd) {
6
3
  return new Promise((resolve, reject) => {
7
4
  const parts = command.split(/\s+/);
@@ -1 +1 @@
1
- {"version":3,"file":"spawn.js","sourceRoot":"","sources":["../../src/utils/spawn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,IAAc,EACd,KAAa,EACb,GAAW;IAE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I,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,IAAY,EAAE,EAAE;YACtC,MAAM,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC5B,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;YACxB,IAAI,IAAI,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;gBAChC,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACzB,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,4BAA4B,IAAI,EAAE,CAAC,CAAC,CAAC;YACzE,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAA0B,EAAE,EAAE;YACpD,IAAI,GAAG,CAAC,IAAI,KAAK,OAAO;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;QACxC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;YAC9B,IAAI,GAAG,IAAK,GAA6B,CAAC,IAAI,KAAK,OAAO;gBAAE,MAAM,CAAC,GAAG,CAAC,CAAC;YACxE,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kiwidata/grimoire",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Gherkin + MADR spec-driven development for AI coding assistants",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,7 +9,7 @@ metadata:
9
9
 
10
10
  # grimoire-apply
11
11
 
12
- Implement tasks from a planned grimoire change. Write production code AND tests. A task is not complete until its scenarios pass.
12
+ Implement tasks from a planned grimoire change using strict red-green BDD: write the failing test first, then the production code that makes it pass. A task is not complete until its scenarios pass.
13
13
 
14
14
  ## CRITICAL: Two Rules That Must Not Be Broken
15
15
 
@@ -119,6 +119,21 @@ The parent agent is the **orchestrator only** — it does NOT implement tasks it
119
119
  You are implementing grimoire tasks. Read `.grimoire/changes/<change-id>/tasks.md`,
120
120
  find section <N>, and implement all unchecked tasks in that section.
121
121
  Follow the red-green BDD cycle for each task. Mark tasks [x] when done.
122
+
123
+ Before writing any production code, read `../references/code-quality.md`,
124
+ `../references/testing-contracts.md`, and `../references/pattern-guard.md`.
125
+ Apply the code-quality rules WHILE you write (not after) — reuse before write,
126
+ trust callers (no defensive guards inside the trust boundary), specific names
127
+ (no `data`/`result`/`temp`), branching budget ~7, function size ~30 lines,
128
+ no premature abstraction, comments only for non-obvious WHY.
129
+ Before writing the test for each task, run the pattern-guard brief (Steps 1–1b–2–4):
130
+ classify the code type (Step 1), run reuse discovery — two search_graph calls
131
+ by concept and by name to find existing code to call instead of writing (Step 1b),
132
+ find 3–5 peers via search_graph (Step 2), extract the modal pattern, write a brief.
133
+ Write code that matches the brief. After writing production code, run the
134
+ hallucination check (Step 6): verify every called external function exists in
135
+ the graph before running tests.
136
+
122
137
  When the section is complete, write a <!-- SESSION: ... --> handoff note
123
138
  under the last task and exit.
124
139
  ```
@@ -174,6 +189,23 @@ Where `<type>` is `feat`, `fix`, `refactor`, or `chore` based on the change. If
174
189
 
175
190
  This links the git history to the grimoire change — `grimoire trace` and `grimoire log` depend on it.
176
191
 
192
+ ### 3b. Promote Feature Files
193
+
194
+ Before writing any code, copy the proposed feature files from the change directory into the live `features/` tree:
195
+
196
+ ```
197
+ cp -r .grimoire/changes/<change-id>/features/* features/
198
+ ```
199
+
200
+ For extended files (scenarios added to an existing feature), overwrite — the change copy already contains the baseline scenarios plus the new ones. For new files, place them at the correct path under `features/`.
201
+
202
+ **Why this comes first:** BDD test runners discover scenarios from `features/`. Scenarios that only exist in `.grimoire/changes/` are invisible to the test runner, so the red-green cycle cannot work. On a feature branch, `features/` is branch-local — promoting here has no effect on `main` until the PR merges.
203
+
204
+ Commit the promoted files before writing any step definitions:
205
+ ```
206
+ git add features/ && git commit -m "feat(<change-id>): promote feature specs to features/"
207
+ ```
208
+
177
209
  ### 4. Load Context
178
210
 
179
211
  **Use the context blocks in `tasks.md`.** Each task section has a `<!-- context: ... -->` comment listing the exact files to load for that section. This was computed during planning with full codebase knowledge. Load those files — they include the relevant feature files, area docs, and source files you'll need.
@@ -181,7 +213,7 @@ This links the git history to the grimoire change — `grimoire trace` and `grim
181
213
  **Loading order:**
182
214
  1. `tasks.md` — your checklist (load once at start, find the current section)
183
215
  2. Read the `<!-- context: ... -->` block for the current section
184
- 3. Load each file listed in the context block
216
+ 3. Load each file listed in the context block — this includes relevant `.grimoire/docs/conventions/<area>.md` files for directories touched by the diff (placement/naming guidance)
185
217
  4. If a listed file doesn't exist, it may need to be created as part of the task — that's fine
186
218
 
187
219
  **If the context window fills up** (degraded output quality, forgotten context, repeated mistakes):
@@ -190,10 +222,11 @@ This links the git history to the grimoire change — `grimoire trace` and `grim
190
222
  3. Tell the user: "Context is getting large. I've updated tasks.md with progress. A fresh session can resume from here."
191
223
 
192
224
  ### 5. Implement Tasks
193
- Work through `tasks.md` sequentially. **Every task follows the same cycle: codetest → green → next.**
225
+ Work through `tasks.md` sequentially. **Every task follows the same cycle: testredcode → green → next.**
194
226
 
195
227
  **For each task:**
196
228
  1. Announce which task you're working on
229
+ - **Pattern brief** (before writing anything): classify code type → `search_graph` for 3–5 peers (excluding last 60 days) → `get_code_snippet` → extract modal pattern across the four critical seams (error handling, dependency access, abstraction depth, return shape) → write a 5–8 rule brief. Skip if graph not indexed or < 3 peers. Full instructions in `../references/pattern-guard.md`.
197
230
  2. Write the step definitions FIRST (the test that will verify this task)
198
231
  3. Run the step definitions — **they MUST FAIL (red)**
199
232
  4. If the test passes immediately, STOP. The test is broken — it's not actually testing anything. Fix the step definition so it makes a real assertion that fails without production code. Common causes:
@@ -201,16 +234,25 @@ Work through `tasks.md` sequentially. **Every task follows the same cycle: code
201
234
  - Assertion against a mock/fixture that already satisfies the condition
202
235
  - Step wired to wrong function or missing the actual check
203
236
  - Overly broad assertion that matches anything
204
- 5. Once confirmed red: write the production code to make it pass
237
+ 5. Once confirmed red: write the production code to make it pass. **While writing — not after — apply the rules in `../references/code-quality.md` and the pattern brief from step 1. Do not write the slop version first and clean up later.** Inline rules:
238
+ - **Reuse first — search before write.** Before writing any new function or class, run two searches: `search_graph(semantic_query=["<concept>", "<verb>", "<domain_noun>"])` to find it by concept, then `search_graph(name_pattern="<likely_prefix_or_suffix>")` to find it by name. If either returns something that does the job → call it. If something almost fits → use it directly; don't generalize for a hypothetical second caller. Write new code only when both searches return nothing usable. No one-line wrappers. No re-implementations. Full instructions: `../references/pattern-guard.md` Step 1b.
239
+ - **Trust your callers.** No `if x is None` / `isinstance` / `try-except` guards inside the trust boundary. Validate at edges (user input, external APIs, file/network) only.
240
+ - **Names reveal intent.** No `data` / `result` / `temp` / `info` / `obj` when a specific name fits. Booleans read as yes/no questions (`is_expired`, `has_admin_role`).
241
+ - **Branching budget ~7.** If a function has more `if` / `else` / `case` / `&&` than that, split or drop dead guards.
242
+ - **Function size ~30 lines.** One job per function. If the name needs "and", split.
243
+ - **No premature abstraction.** Three near-identical copies is fine. No new `BaseX` / factory / strategy / config object for a single caller.
244
+ - **Comments: zero by default.** Do not add a comment unless you can state the non-obvious *why* in one sentence. No function docstrings unless the project's `comment_style` requires them. No inline comments restating what the code does (`# loop over users`, `# return result`). No block comments describing a section. No comments naming the task, PR, or ticket. If removing the comment would not confuse a future reader, do not write it.
205
245
  6. Run the step definitions again — they should PASS (green)
206
246
  7. If still red, fix the production code (not the test)
207
- 8. **Test quality check:** Before marking done, verify your step definitions have strong assertions:
247
+ 8. **Hallucination check:** Before running tests, verify every external function/method your new code calls actually exists in the graph: `search_graph(name_pattern="<name>")` for each. If not found: find the correct function or stop and flag to user. Do not run tests against calls to non-existent functions. (Full instructions in `../references/pattern-guard.md` Step 6.)
248
+ 9. **Test quality check:** Before marking done, verify your step definitions have strong assertions:
208
249
  - Every Then step has a specific `assert` or `expect` with an exact expected value (not `assert True`, not `toBeDefined()`)
209
250
  - No empty function bodies (`pass`, `...`, or no-op)
210
251
  - Assertions check behavior, not just types or existence — "response status is 302 and redirect URL is /dashboard/" not "response is not None"
211
252
  - If you wrote a test that would pass against a null/trivial implementation, strengthen it
212
- 9. Mark complete: `- [ ]` → `- [x]`
213
- 10. Move to next task
253
+ 10. **Code quality check:** Walk the seven-point checklist in `../references/code-quality.md` against every file you changed. Any fail fix code, re-run tests, re-check. Do not mark `[x]` while a check fails.
254
+ 11. Mark complete: `- [ ]` → `- [x]`
255
+ 12. Move to next task
214
256
 
215
257
  **This is strict red-green BDD.** A test that has never been red has never proven it can catch a failure. The red step is NOT a formality — it is the proof that the test works. If you skip it or the test passes immediately, you have a false positive that provides zero safety.
216
258
 
@@ -239,14 +281,37 @@ When all implementation tasks are complete:
239
281
 
240
282
  ### 7. Finalize
241
283
  When all tests are green:
242
- 1. Copy proposed `.feature` files from `.grimoire/changes/<change-id>/features/` to `features/` (replacing baseline)
243
- 2. Move new decision records to `.grimoire/decisions/` with proper sequential numbering
244
- 3. Update MADR status from `proposed` to `accepted` and set the date
245
- 4. If `data.yml` exists, merge the changes into `.grimoire/docs/data/schema.yml` — apply adds/modifies/removes so the baseline schema stays current
246
- 5. Move `manifest.md` to `.grimoire/archive/YYYY-MM-DD-<change-id>/`
247
- 6. Remove the change directory from `.grimoire/changes/`
248
-
249
- ### 8. Summary
284
+ 1. Move new decision records to `.grimoire/decisions/` with proper sequential numbering
285
+ 2. Update MADR status from `proposed` to `accepted` and set the date
286
+ 3. If `data.yml` exists, merge the changes into `.grimoire/docs/data/schema.yml` apply adds/modifies/removes so the baseline schema stays current
287
+ 4. Move `manifest.md` to `.grimoire/archive/YYYY-MM-DD-<change-id>/`
288
+ 5. Remove the change directory from `.grimoire/changes/`
289
+
290
+ Feature files were already promoted to `features/` in step 3b — no copy needed here.
291
+
292
+ ### 8. Commit
293
+
294
+ Finalize must be complete before committing — the commit captures the finished state including archived manifest and promoted decisions, not mid-flight change artefacts.
295
+
296
+ Stage everything:
297
+ ```
298
+ git add features/ .grimoire/decisions/ .grimoire/archive/ .grimoire/docs/ src/ tests/
299
+ git add -u # picks up any deleted files (removed change directory)
300
+ ```
301
+
302
+ Then commit using `/grimoire:commit` (reads change context for the message) or write a manual message following `AGENTS.md` commit trailer conventions:
303
+ ```
304
+ feat(<change-id>): <short description>
305
+
306
+ <body if needed>
307
+
308
+ Change: <change-id>
309
+ Scenarios: "<scenario 1>", "<scenario 2>"
310
+ ```
311
+
312
+ Mid-task commits are fine — commit whenever it makes sense during implementation. **Do not open a PR before finalize is complete.** The PR should represent the finished, archived state of the change.
313
+
314
+ ### 9. Summary
250
315
  Present a brief summary:
251
316
  - What was implemented
252
317
  - Which features now pass (with test counts if available)
@@ -255,7 +320,10 @@ Present a brief summary:
255
320
 
256
321
  ## References
257
322
 
258
- **Before writing code**, read `../references/testing-contracts.md` — covers: verify-before-using rules (imports, packages, APIs), mocking strategy (HTTP boundary not client), fixture management, contract tests, and step definition quality checks.
323
+ **Before writing code**, read all three:
324
+ - `../references/pattern-guard.md` — run before each task: (1) classify code type, (1b) reuse discovery — two `search_graph` calls (semantic_query by concept + name_pattern by likely name) to find existing code to call instead of writing new code, (2) find 3–5 peers, extract modal pattern across four seams (error handling, dependency, abstraction depth, return shape), write a pattern brief. Apply the brief while writing. Run hallucination check after writing (verify called functions exist in graph). Skip if graph not indexed.
325
+ - `../references/code-quality.md` — anti-slop rules to apply *while writing*: reuse before write, trust callers, names reveal intent, branching budget, function size, no premature abstraction, zero comments by default (only non-obvious *why*, never *what*). Includes a seven-point quality gate to run before marking each task `[x]`.
326
+ - `../references/testing-contracts.md` — verify-before-using rules (imports, packages, APIs), mocking strategy (HTTP boundary not client), fixture management, contract tests, and step definition quality checks.
259
327
 
260
328
  ## Important
261
329
  - **Tests are not optional.** Every task produces both production code and passing step definitions. No exceptions.
@@ -28,7 +28,8 @@ Audit an existing codebase to discover undocumented features and architecture de
28
28
  Ask the user what to audit:
29
29
  - **Features** — find behavioral functionality that has no `.feature` file
30
30
  - **Decisions** — find implicit architecture decisions that have no ADR
31
- - **Both** — full audit (default)
31
+ - **Conventions** — find conventions files in `.grimoire/docs/conventions/` whose placement/naming rules no longer match the codebase
32
+ - **Both** / **All** — full audit (default: features + decisions + conventions)
32
33
 
33
34
  Check what's already documented:
34
35
  - Read all files in `features/` for existing behavioral specs
@@ -60,9 +61,27 @@ Scan for implicit architecture decisions:
60
61
 
61
62
  For each pattern found, check if a corresponding ADR exists. If not, note it as undocumented.
62
63
 
64
+ ### 3.5. Conventions Drift Detection
65
+ Read each file in `.grimoire/docs/conventions/`. For each file:
66
+ 1. Use MCP `get_architecture` or `search_graph` to query the current code structure for the relevant area
67
+ 2. Compare the conventions file's placement rules, naming rules, and patterns against what MCP reports the codebase actually does
68
+ 3. Flag any conventions rule that no longer matches:
69
+ - "api.md says new views go in `src/api/views/` but MCP shows views now in `src/api/handlers/`"
70
+ - "models.md says models are prefixed with `I` but no `I`-prefixed models found in MCP graph"
71
+
72
+ Present drifted conventions to the user with the same batched interview approach:
73
+ > "api.md states that new views go in `src/api/views/`, but the codebase now places them in `src/api/handlers/`. Options:
74
+ > - **refresh** — update the conventions file to match current code (I'll open it for editing with MCP-sourced state)
75
+ > - **accept-as-is** — the conventions file is intentionally ahead of the code
76
+ > - **skip** — leave for now"
77
+
78
+ Skip this step when the user's scope answer was "features only" or "decisions only".
79
+
63
80
  ### 4. Interview the User
64
81
  Do NOT dump a massive list. Present findings in batches of 3-5, grouped by area, and ask the user about each:
65
82
 
83
+ Clearly label each batch item as one of: "undocumented feature", "undocumented decision", or "drifted convention"
84
+
66
85
  For features:
67
86
  > "I found a document review workflow with routes for `/dais/review/document/<id>/`. There's tab switching, error modals, and tag editing. I don't see a feature file covering this. Should I draft one?"
68
87
 
@@ -114,6 +133,7 @@ After the interview, summarize:
114
133
  - How many features are dead or stale
115
134
  - How many decisions are documented vs. undocumented
116
135
  - How many decisions are stale
136
+ - How many conventions files drifted vs. up-to-date
117
137
  - Suggest which areas to address first (highest risk / most complex / most frequently changed)
118
138
 
119
139
  ## Important
@@ -83,20 +83,52 @@ generation, causing user lookup to fail on the reset page.
83
83
  Added scenario: "Password reset with plus-sign email"
84
84
  ```
85
85
 
86
- ### 5. Create Fix Branch
87
- Before writing any code, create a branch for the fix:
86
+ ### 5. Decide the Branch
87
+
88
+ Default bias: **stay on the current branch if the bug is related to in-flight work.** Only create a new branch when the bug is clearly a separate concern from whatever the current branch is doing.
89
+
90
+ Snapshot state first:
91
+
88
92
  ```
89
- fix/<short-description>
93
+ git branch --show-current
94
+ git status --porcelain
95
+ grimoire list --changes --json
90
96
  ```
91
- For example: `fix/special-chars-password-reset`, `fix/null-pricing-response`.
97
+
98
+ Find any active change whose `manifest.md` `branch:` matches the current branch.
99
+
100
+ | Current state | Bug relation | Action |
101
+ |---------------|--------------|--------|
102
+ | Protected branch (`main`/`master`/`develop`/`trunk`), clean tree | any | Create `fix/<short-description>` and switch |
103
+ | Feature branch + active change on it | Bug is in the same feature/code path the change touches | **Stay on the branch.** Fix in place. The repro test and fix become part of that change |
104
+ | Feature branch + active change on it | Bug is unrelated to that change | Ask the user. Default: stash/commit, switch to default branch, create `fix/...` off it |
105
+ | Feature branch + no matching active change | any | Create `fix/<short-description>` off the default branch |
106
+ | Dirty tree, no clear owner | any | Block. Commit, stash, or discard before proceeding |
107
+
108
+ How to judge "related vs separate":
109
+ - **Related** — the bug lives in files the in-flight change is modifying, or the bug is a direct consequence of the in-flight work (e.g. tests added by the change reveal it, the new code path crashes on an edge case). Fixing it on the same branch keeps the change coherent and the PR self-contained.
110
+ - **Separate** — the bug exists on `main` independent of the in-flight change, touches unrelated code, or would still need to ship if the in-flight change were abandoned. Mixing it in pollutes the diff and the `Change:` trailer.
111
+
112
+ When in doubt, ask the user one question: "This bug looks like it's [in / outside] the scope of the current `<branch>` work — fix it here, or branch off main?"
113
+
114
+ Branch name format when creating new: `fix/<short-description>` (e.g. `fix/special-chars-password-reset`, `fix/null-pricing-response`).
92
115
 
93
116
  ### 6. Fix the Bug
94
- Now — and only now — modify production code:
117
+ Now — and only now — modify production code. **Apply `../references/code-quality.md` while writing the fix, not after.** Inline rules:
118
+ - Reuse existing utilities — grep / check the area doc before adding new helpers.
119
+ - No new defensive guards inside the trust boundary — fix the real bug, don't paper over it with `if x is None` / `try-except`.
120
+ - Specific names — no `data` / `result` / `temp` when a concrete name fits.
121
+ - No new abstraction layer for a one-line bug fix.
122
+ - Comments only for non-obvious *why* — one short note linking the bug + reproduction test is enough.
123
+
124
+ Then:
95
125
 
96
126
  1. Make the smallest change that fixes the failing test
97
- 2. Run the reproduction test it should pass
98
- 3. Run ALL existing testsno regressions
99
- 4. If the fix is more than a few lines, pause and consider whether the approach is the simplest one
127
+ 2. **Hallucination check:** Before running tests, verify every external function/method the fix calls actually exists: `search_graph(name_pattern="<name>")` for each new call. If not found: locate the correct function or stop and flag to user. (Full instructions in `../references/pattern-guard.md` Step 6. Skip if graph not indexed.)
128
+ 3. Run the reproduction testit should pass
129
+ 4. Run ALL existing tests no regressions
130
+ 5. If the fix is more than a few lines, pause and consider whether the approach is the simplest one
131
+ 6. **Code quality check:** Walk the seven-point checklist in `../references/code-quality.md` against every file you changed. Any fail → fix and re-run tests.
100
132
 
101
133
  **Escalation guard:** If the fix requires changes to more than 3 files, introduces new abstractions, modifies data models, or crosses service boundaries — STOP. This is not a bug fix, it's a change that needs design. Tell the user: "This fix is larger than a typical bug fix. I recommend routing to `grimoire-draft` to handle this as a proper change with specs and a plan." The user can override.
102
134
 
@@ -120,7 +152,7 @@ After the fix, generate a checklist for testers to verify the fix and check for
120
152
  3. **Generate the checklist:**
121
153
  ```markdown
122
154
  ## Verification Checklist: <bug-id>
123
- Fix branch: `fix/<name>`
155
+ Branch: `<current-branch>` (new `fix/...` branch, or the in-flight feature branch if fixed in place)
124
156
 
125
157
  ### Original Bug
126
158
  - [ ] Reproduce the original steps: <steps>
@@ -149,12 +181,19 @@ Report to the user:
149
181
  - **Performance issues** — these usually need profiling, not a repro test. Handle directly.
150
182
  - **Configuration errors** — wrong env vars, missing dependencies, bad setup. Just fix the config.
151
183
 
184
+ ## References
185
+
186
+ **Before writing the fix**, read both:
187
+ - `../references/code-quality.md` — anti-slop rules to apply *while writing*: reuse before write, trust callers, names reveal intent, branching budget, function size, no premature abstraction, comments only for non-obvious why. Includes a seven-point quality gate to run before declaring the fix done.
188
+ - `../references/pattern-guard.md` Step 6 only — after writing the fix, verify every new external function call exists in the graph via `search_graph`. Skip the full pattern brief (over-constrains bug fixes). Skip entirely if graph not indexed.
189
+
152
190
  ## Important
153
191
  - **Reproduce before you fix.** No exceptions. If you can't reproduce it, you don't understand it, and your fix is a guess.
154
192
  - **Small fixes only.** If the bug fix requires significant architectural changes, it's not a bug fix — route to `grimoire-draft` for a proper change.
155
193
  - **Don't over-document.** The test is the documentation. A one-line comment in the test explaining the bug is enough. Don't create tracking files, bug reports, or manifests for a bug fix.
156
194
  - **The feature file is truth.** If a scenario describes behavior the user now says is wrong, that's a spec change, not a bug. Handle it through `grimoire-draft`.
157
195
  - **One bug, one fix.** Don't bundle "while I'm in here" improvements with a bug fix. Fix the bug, nothing more.
196
+ - **Don't reflexively branch.** A bug related to in-flight work belongs on the in-flight branch — splitting it into a separate PR fragments the change and breaks the `Change:` trailer audit trail. Branch only when the bug is genuinely a separate concern. See step 5.
158
197
 
159
198
  ## Done
160
199
  When the bug is fixed, tests pass (reproduction + regression), and the summary is presented, the workflow is complete. Suggest `grimoire-commit` for the fix commit.
@@ -19,7 +19,8 @@ Write a commit message from staged changes and active grimoire context. Never au
19
19
  ## Routing
20
20
  - No changes to commit → nothing to do
21
21
  - Want to create a PR → `grimoire-pr` (commit first, then PR)
22
- - Want to review changes before committing → show the diff first
22
+ - Want a multi-persona review of the staged diff before committing → `grimoire-precommit-review`
23
+ - Just want to eyeball the diff → show the diff first
23
24
 
24
25
  ## Workflow
25
26