@chief-clancy/terminal 0.1.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 (217) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +62 -0
  3. package/dist/hooks/clancy-branch-guard.js +1 -0
  4. package/dist/hooks/clancy-check-update.js +2 -0
  5. package/dist/hooks/clancy-context-monitor.js +9 -0
  6. package/dist/hooks/clancy-credential-guard.js +2 -0
  7. package/dist/hooks/clancy-drift-detector.js +1 -0
  8. package/dist/hooks/clancy-notification.js +1 -0
  9. package/dist/hooks/clancy-post-compact.js +2 -0
  10. package/dist/hooks/clancy-statusline.js +1 -0
  11. package/dist/index.d.ts +24 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +23 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/installer/file-ops/file-ops.d.ts +35 -0
  16. package/dist/installer/file-ops/file-ops.d.ts.map +1 -0
  17. package/dist/installer/file-ops/file-ops.js +95 -0
  18. package/dist/installer/file-ops/file-ops.js.map +1 -0
  19. package/dist/installer/file-ops/index.d.ts +2 -0
  20. package/dist/installer/file-ops/index.d.ts.map +1 -0
  21. package/dist/installer/file-ops/index.js +2 -0
  22. package/dist/installer/file-ops/index.js.map +1 -0
  23. package/dist/installer/hook-installer/hook-installer.d.ts +22 -0
  24. package/dist/installer/hook-installer/hook-installer.d.ts.map +1 -0
  25. package/dist/installer/hook-installer/hook-installer.js +213 -0
  26. package/dist/installer/hook-installer/hook-installer.js.map +1 -0
  27. package/dist/installer/hook-installer/index.d.ts +2 -0
  28. package/dist/installer/hook-installer/index.d.ts.map +1 -0
  29. package/dist/installer/hook-installer/index.js +2 -0
  30. package/dist/installer/hook-installer/index.js.map +1 -0
  31. package/dist/installer/install/index.d.ts +3 -0
  32. package/dist/installer/install/index.d.ts.map +1 -0
  33. package/dist/installer/install/index.js +2 -0
  34. package/dist/installer/install/index.js.map +1 -0
  35. package/dist/installer/install/install.d.ts +124 -0
  36. package/dist/installer/install/install.d.ts.map +1 -0
  37. package/dist/installer/install/install.js +255 -0
  38. package/dist/installer/install/install.js.map +1 -0
  39. package/dist/installer/manifest/index.d.ts +2 -0
  40. package/dist/installer/manifest/index.d.ts.map +1 -0
  41. package/dist/installer/manifest/index.js +2 -0
  42. package/dist/installer/manifest/index.js.map +1 -0
  43. package/dist/installer/manifest/manifest.d.ts +46 -0
  44. package/dist/installer/manifest/manifest.d.ts.map +1 -0
  45. package/dist/installer/manifest/manifest.js +180 -0
  46. package/dist/installer/manifest/manifest.js.map +1 -0
  47. package/dist/installer/prompts/index.d.ts +2 -0
  48. package/dist/installer/prompts/index.d.ts.map +1 -0
  49. package/dist/installer/prompts/index.js +2 -0
  50. package/dist/installer/prompts/index.js.map +1 -0
  51. package/dist/installer/prompts/prompts.d.ts +34 -0
  52. package/dist/installer/prompts/prompts.d.ts.map +1 -0
  53. package/dist/installer/prompts/prompts.js +28 -0
  54. package/dist/installer/prompts/prompts.js.map +1 -0
  55. package/dist/installer/role-filter/index.d.ts +2 -0
  56. package/dist/installer/role-filter/index.d.ts.map +1 -0
  57. package/dist/installer/role-filter/index.js +2 -0
  58. package/dist/installer/role-filter/index.js.map +1 -0
  59. package/dist/installer/role-filter/role-filter.d.ts +33 -0
  60. package/dist/installer/role-filter/role-filter.d.ts.map +1 -0
  61. package/dist/installer/role-filter/role-filter.js +91 -0
  62. package/dist/installer/role-filter/role-filter.js.map +1 -0
  63. package/dist/installer/shared/fs-errors/fs-errors.d.ts +3 -0
  64. package/dist/installer/shared/fs-errors/fs-errors.d.ts.map +1 -0
  65. package/dist/installer/shared/fs-errors/fs-errors.js +7 -0
  66. package/dist/installer/shared/fs-errors/fs-errors.js.map +1 -0
  67. package/dist/installer/shared/fs-errors/index.d.ts +2 -0
  68. package/dist/installer/shared/fs-errors/index.d.ts.map +1 -0
  69. package/dist/installer/shared/fs-errors/index.js +2 -0
  70. package/dist/installer/shared/fs-errors/index.js.map +1 -0
  71. package/dist/installer/shared/fs-guards/fs-guards.d.ts +3 -0
  72. package/dist/installer/shared/fs-guards/fs-guards.d.ts.map +1 -0
  73. package/dist/installer/shared/fs-guards/fs-guards.js +18 -0
  74. package/dist/installer/shared/fs-guards/fs-guards.js.map +1 -0
  75. package/dist/installer/shared/fs-guards/index.d.ts +2 -0
  76. package/dist/installer/shared/fs-guards/index.d.ts.map +1 -0
  77. package/dist/installer/shared/fs-guards/index.js +2 -0
  78. package/dist/installer/shared/fs-guards/index.js.map +1 -0
  79. package/dist/installer/shared/type-guards/index.d.ts +2 -0
  80. package/dist/installer/shared/type-guards/index.d.ts.map +1 -0
  81. package/dist/installer/shared/type-guards/index.js +2 -0
  82. package/dist/installer/shared/type-guards/index.js.map +1 -0
  83. package/dist/installer/shared/type-guards/type-guards.d.ts +8 -0
  84. package/dist/installer/shared/type-guards/type-guards.d.ts.map +1 -0
  85. package/dist/installer/shared/type-guards/type-guards.js +10 -0
  86. package/dist/installer/shared/type-guards/type-guards.js.map +1 -0
  87. package/dist/installer/ui/index.d.ts +2 -0
  88. package/dist/installer/ui/index.d.ts.map +1 -0
  89. package/dist/installer/ui/index.js +2 -0
  90. package/dist/installer/ui/index.js.map +1 -0
  91. package/dist/installer/ui/ui.d.ts +23 -0
  92. package/dist/installer/ui/ui.d.ts.map +1 -0
  93. package/dist/installer/ui/ui.js +121 -0
  94. package/dist/installer/ui/ui.js.map +1 -0
  95. package/dist/runner/autopilot/autopilot.d.ts +71 -0
  96. package/dist/runner/autopilot/autopilot.d.ts.map +1 -0
  97. package/dist/runner/autopilot/autopilot.js +206 -0
  98. package/dist/runner/autopilot/autopilot.js.map +1 -0
  99. package/dist/runner/autopilot/index.d.ts +2 -0
  100. package/dist/runner/autopilot/index.d.ts.map +1 -0
  101. package/dist/runner/autopilot/index.js +2 -0
  102. package/dist/runner/autopilot/index.js.map +1 -0
  103. package/dist/runner/cli-bridge/cli-bridge.d.ts +34 -0
  104. package/dist/runner/cli-bridge/cli-bridge.d.ts.map +1 -0
  105. package/dist/runner/cli-bridge/cli-bridge.js +53 -0
  106. package/dist/runner/cli-bridge/cli-bridge.js.map +1 -0
  107. package/dist/runner/cli-bridge/index.d.ts +2 -0
  108. package/dist/runner/cli-bridge/index.d.ts.map +1 -0
  109. package/dist/runner/cli-bridge/index.js +2 -0
  110. package/dist/runner/cli-bridge/index.js.map +1 -0
  111. package/dist/runner/dep-factory/deliver-phase.d.ts +24 -0
  112. package/dist/runner/dep-factory/deliver-phase.d.ts.map +1 -0
  113. package/dist/runner/dep-factory/deliver-phase.js +57 -0
  114. package/dist/runner/dep-factory/deliver-phase.js.map +1 -0
  115. package/dist/runner/dep-factory/dep-factory.d.ts +38 -0
  116. package/dist/runner/dep-factory/dep-factory.d.ts.map +1 -0
  117. package/dist/runner/dep-factory/dep-factory.js +193 -0
  118. package/dist/runner/dep-factory/dep-factory.js.map +1 -0
  119. package/dist/runner/dep-factory/index.d.ts +2 -0
  120. package/dist/runner/dep-factory/index.d.ts.map +1 -0
  121. package/dist/runner/dep-factory/index.js +2 -0
  122. package/dist/runner/dep-factory/index.js.map +1 -0
  123. package/dist/runner/dep-factory/invoke-phase.d.ts +20 -0
  124. package/dist/runner/dep-factory/invoke-phase.d.ts.map +1 -0
  125. package/dist/runner/dep-factory/invoke-phase.js +45 -0
  126. package/dist/runner/dep-factory/invoke-phase.js.map +1 -0
  127. package/dist/runner/implement/implement.d.ts +38 -0
  128. package/dist/runner/implement/implement.d.ts.map +1 -0
  129. package/dist/runner/implement/implement.js +61 -0
  130. package/dist/runner/implement/implement.js.map +1 -0
  131. package/dist/runner/implement/index.d.ts +2 -0
  132. package/dist/runner/implement/index.d.ts.map +1 -0
  133. package/dist/runner/implement/index.js +2 -0
  134. package/dist/runner/implement/index.js.map +1 -0
  135. package/dist/runner/notify/index.d.ts +2 -0
  136. package/dist/runner/notify/index.d.ts.map +1 -0
  137. package/dist/runner/notify/index.js +2 -0
  138. package/dist/runner/notify/index.js.map +1 -0
  139. package/dist/runner/notify/notify.d.ts +49 -0
  140. package/dist/runner/notify/notify.d.ts.map +1 -0
  141. package/dist/runner/notify/notify.js +90 -0
  142. package/dist/runner/notify/notify.js.map +1 -0
  143. package/dist/runner/prompt-builder/index.d.ts +2 -0
  144. package/dist/runner/prompt-builder/index.d.ts.map +1 -0
  145. package/dist/runner/prompt-builder/index.js +2 -0
  146. package/dist/runner/prompt-builder/index.js.map +1 -0
  147. package/dist/runner/prompt-builder/prompt-builder.d.ts +53 -0
  148. package/dist/runner/prompt-builder/prompt-builder.d.ts.map +1 -0
  149. package/dist/runner/prompt-builder/prompt-builder.js +122 -0
  150. package/dist/runner/prompt-builder/prompt-builder.js.map +1 -0
  151. package/dist/runner/session-report/index.d.ts +2 -0
  152. package/dist/runner/session-report/index.d.ts.map +1 -0
  153. package/dist/runner/session-report/index.js +2 -0
  154. package/dist/runner/session-report/index.js.map +1 -0
  155. package/dist/runner/session-report/session-report.d.ts +81 -0
  156. package/dist/runner/session-report/session-report.d.ts.map +1 -0
  157. package/dist/runner/session-report/session-report.js +227 -0
  158. package/dist/runner/session-report/session-report.js.map +1 -0
  159. package/dist/runner/shared/types.d.ts +30 -0
  160. package/dist/runner/shared/types.d.ts.map +1 -0
  161. package/dist/runner/shared/types.js +2 -0
  162. package/dist/runner/shared/types.js.map +1 -0
  163. package/dist/shared/ansi/ansi.d.ts +59 -0
  164. package/dist/shared/ansi/ansi.d.ts.map +1 -0
  165. package/dist/shared/ansi/ansi.js +59 -0
  166. package/dist/shared/ansi/ansi.js.map +1 -0
  167. package/dist/shared/ansi/index.d.ts +2 -0
  168. package/dist/shared/ansi/index.d.ts.map +1 -0
  169. package/dist/shared/ansi/index.js +2 -0
  170. package/dist/shared/ansi/index.js.map +1 -0
  171. package/package.json +52 -0
  172. package/src/agents/agents.test.ts +57 -0
  173. package/src/agents/arch-agent.md +80 -0
  174. package/src/agents/concerns-agent.md +96 -0
  175. package/src/agents/design-agent.md +146 -0
  176. package/src/agents/devils-advocate.md +54 -0
  177. package/src/agents/quality-agent.md +178 -0
  178. package/src/agents/tech-agent.md +101 -0
  179. package/src/agents/verification-gate.md +128 -0
  180. package/src/roles/implementer/commands/autopilot.md +11 -0
  181. package/src/roles/implementer/commands/dry-run.md +15 -0
  182. package/src/roles/implementer/commands/implement.md +19 -0
  183. package/src/roles/implementer/workflows/autopilot.md +136 -0
  184. package/src/roles/implementer/workflows/implement.md +161 -0
  185. package/src/roles/planner/commands/approve-plan.md +11 -0
  186. package/src/roles/planner/commands/plan.md +22 -0
  187. package/src/roles/planner/workflows/approve-plan.md +970 -0
  188. package/src/roles/planner/workflows/plan.md +868 -0
  189. package/src/roles/reviewer/commands/logs.md +7 -0
  190. package/src/roles/reviewer/commands/review.md +9 -0
  191. package/src/roles/reviewer/commands/status.md +9 -0
  192. package/src/roles/reviewer/workflows/logs.md +109 -0
  193. package/src/roles/reviewer/workflows/review.md +197 -0
  194. package/src/roles/reviewer/workflows/status.md +142 -0
  195. package/src/roles/roles.test.ts +87 -0
  196. package/src/roles/setup/commands/doctor.md +7 -0
  197. package/src/roles/setup/commands/help.md +80 -0
  198. package/src/roles/setup/commands/init.md +7 -0
  199. package/src/roles/setup/commands/map-codebase.md +17 -0
  200. package/src/roles/setup/commands/settings.md +7 -0
  201. package/src/roles/setup/commands/uninstall.md +5 -0
  202. package/src/roles/setup/commands/update-docs.md +9 -0
  203. package/src/roles/setup/commands/update.md +13 -0
  204. package/src/roles/setup/workflows/doctor.md +131 -0
  205. package/src/roles/setup/workflows/init.md +1096 -0
  206. package/src/roles/setup/workflows/map-codebase.md +130 -0
  207. package/src/roles/setup/workflows/scaffold.md +872 -0
  208. package/src/roles/setup/workflows/settings.md +958 -0
  209. package/src/roles/setup/workflows/uninstall.md +170 -0
  210. package/src/roles/setup/workflows/update-docs.md +95 -0
  211. package/src/roles/setup/workflows/update.md +287 -0
  212. package/src/roles/strategist/commands/approve-brief.md +23 -0
  213. package/src/roles/strategist/commands/brief.md +29 -0
  214. package/src/roles/strategist/workflows/approve-brief.md +1540 -0
  215. package/src/roles/strategist/workflows/brief.md +1330 -0
  216. package/src/templates/CLAUDE.md +101 -0
  217. package/src/templates/templates.test.ts +53 -0
@@ -0,0 +1,59 @@
1
+ /**
2
+ * ANSI escape code helpers for terminal output.
3
+ *
4
+ * Wraps strings in ANSI sequences for styling in CLI environments.
5
+ * These helpers do not compose — nesting calls (e.g. `bold(red('x'))`)
6
+ * produces concatenated codes where the inner reset cancels outer styles.
7
+ */
8
+ /**
9
+ * Dim the given string (reduced intensity).
10
+ *
11
+ * @param s - The string to style.
12
+ * @returns The string wrapped in ANSI dim codes.
13
+ */
14
+ export const dim = (s) => `\x1b[2m${s}\x1b[0m`;
15
+ /**
16
+ * Bold the given string.
17
+ *
18
+ * @param s - The string to style.
19
+ * @returns The string wrapped in ANSI bold codes.
20
+ */
21
+ export const bold = (s) => `\x1b[1m${s}\x1b[0m`;
22
+ /**
23
+ * Colour the given string blue with bold weight.
24
+ *
25
+ * Uses bold+blue (`1;34`) for contrast on dark backgrounds.
26
+ *
27
+ * @param s - The string to style.
28
+ * @returns The string wrapped in ANSI bold-blue codes.
29
+ */
30
+ export const blue = (s) => `\x1b[1;34m${s}\x1b[0m`;
31
+ /**
32
+ * Colour the given string cyan.
33
+ *
34
+ * @param s - The string to style.
35
+ * @returns The string wrapped in ANSI cyan codes.
36
+ */
37
+ export const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
38
+ /**
39
+ * Colour the given string green.
40
+ *
41
+ * @param s - The string to style.
42
+ * @returns The string wrapped in ANSI green codes.
43
+ */
44
+ export const green = (s) => `\x1b[32m${s}\x1b[0m`;
45
+ /**
46
+ * Colour the given string red.
47
+ *
48
+ * @param s - The string to style.
49
+ * @returns The string wrapped in ANSI red codes.
50
+ */
51
+ export const red = (s) => `\x1b[31m${s}\x1b[0m`;
52
+ /**
53
+ * Colour the given string yellow.
54
+ *
55
+ * @param s - The string to style.
56
+ * @returns The string wrapped in ANSI yellow codes.
57
+ */
58
+ export const yellow = (s) => `\x1b[33m${s}\x1b[0m`;
59
+ //# sourceMappingURL=ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../../src/shared/ansi/ansi.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,aAAa,CAAC,SAAS,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC;AAElE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC;AAEhE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAS,EAAU,EAAE,CAAC,WAAW,CAAC,SAAS,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { blue, bold, cyan, dim, green, red, yellow } from './ansi.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/ansi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { blue, bold, cyan, dim, green, red, yellow } from './ansi.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/shared/ansi/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC"}
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@chief-clancy/terminal",
3
+ "version": "0.1.0",
4
+ "description": "Installer, slash commands, hooks, AFK runner, agents, Claude CLI bridge",
5
+ "author": "Alex Clapperton",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/Pushedskydiver/chief-clancy.git",
10
+ "directory": "packages/terminal"
11
+ },
12
+ "homepage": "https://github.com/Pushedskydiver/chief-clancy#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/Pushedskydiver/chief-clancy/issues"
15
+ },
16
+ "keywords": [
17
+ "claude",
18
+ "claude-code",
19
+ "ai",
20
+ "cli",
21
+ "terminal",
22
+ "hooks",
23
+ "slash-commands",
24
+ "developer-tools"
25
+ ],
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "import": "./dist/index.js"
31
+ }
32
+ },
33
+ "files": [
34
+ "dist",
35
+ "src/roles",
36
+ "src/agents",
37
+ "src/templates"
38
+ ],
39
+ "dependencies": {
40
+ "@chief-clancy/core": "0.1.0"
41
+ },
42
+ "devDependencies": {
43
+ "esbuild": "^0.27.4"
44
+ },
45
+ "scripts": {
46
+ "build": "rm -rf dist tsconfig.build.tsbuildinfo && tsc --project tsconfig.build.json && tsc-alias --project tsconfig.build.json && node dist/hooks/esbuild.hooks.js",
47
+ "test": "vitest run",
48
+ "test:e2e": "vitest run --config vitest.config.e2e.ts",
49
+ "lint": "eslint .",
50
+ "typecheck": "tsc --noEmit"
51
+ }
52
+ }
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Structural tests for agent prompt files.
3
+ *
4
+ * Verifies the agents directory contains the expected prompt files
5
+ * that the installer and map-codebase workflow depend on.
6
+ */
7
+ import { readdirSync, readFileSync } from 'node:fs';
8
+ import { fileURLToPath } from 'node:url';
9
+
10
+ import { describe, expect, it } from 'vitest';
11
+
12
+ const AGENTS_DIR = fileURLToPath(new URL('.', import.meta.url));
13
+
14
+ const EXPECTED_AGENTS = [
15
+ 'arch-agent.md',
16
+ 'concerns-agent.md',
17
+ 'design-agent.md',
18
+ 'devils-advocate.md',
19
+ 'quality-agent.md',
20
+ 'tech-agent.md',
21
+ 'verification-gate.md',
22
+ ];
23
+
24
+ describe('agents directory structure', () => {
25
+ it('contains exactly the expected agent files', () => {
26
+ const agents = readdirSync(AGENTS_DIR)
27
+ .filter((f) => f.endsWith('.md'))
28
+ .sort();
29
+
30
+ expect(agents).toEqual([...EXPECTED_AGENTS].sort());
31
+ });
32
+
33
+ it('all agent files start with a heading', () => {
34
+ const issues: string[] = [];
35
+
36
+ EXPECTED_AGENTS.forEach((file) => {
37
+ const content = readFileSync(new URL(file, import.meta.url), 'utf8');
38
+ const firstLine = content.split('\n')[0]?.trim() ?? '';
39
+
40
+ if (!firstLine.startsWith('#')) {
41
+ issues.push(file);
42
+ }
43
+ });
44
+
45
+ expect(issues).toEqual([]);
46
+ });
47
+
48
+ it('verification-gate.md contains decision response markers', () => {
49
+ const content = readFileSync(
50
+ new URL('verification-gate.md', import.meta.url),
51
+ 'utf8',
52
+ );
53
+
54
+ expect(content).toContain('"decision"');
55
+ expect(content).toContain('"allow"');
56
+ });
57
+ });
@@ -0,0 +1,80 @@
1
+ # Architecture Agent
2
+
3
+ You are the architecture agent for Clancy's `map-codebase` command. Your job is to write one doc:
4
+
5
+ - `.clancy/docs/ARCHITECTURE.md`
6
+
7
+ ## Instructions
8
+
9
+ 1. Use Glob and Grep extensively before writing anything. Understand the actual structure — never guess.
10
+ 2. Use real file paths in your output.
11
+ 3. Show HOW things are done with real code examples, not just WHAT exists.
12
+ 4. Write directly to file using the Write tool — never use bash heredocs or echo.
13
+ 5. Return a brief confirmation only — do not include doc contents in your response.
14
+ 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
15
+
16
+ ## What to look for
17
+
18
+ Start by exploring the directory structure:
19
+
20
+ - Top-level directories (src, app, lib, packages, etc.)
21
+ - Key subdirectories and what they contain
22
+ - Entry points (main.tsx, index.ts, app/layout.tsx, etc.)
23
+
24
+ Then dig into:
25
+
26
+ **Overview** — One paragraph describing what the system does and how it's structured. Is it a monorepo? SPA? Full-stack app? API-only? Edge functions?
27
+
28
+ **Directory Structure** — Annotated directory tree. Use `tree`-style output. Annotate each directory with its purpose:
29
+
30
+ ```
31
+ src/
32
+ components/ — shared UI components
33
+ pages/ — Next.js pages (file-based routing)
34
+ lib/ — utility functions and shared logic
35
+ hooks/ — custom React hooks
36
+ store/ — Zustand/Redux/Jotai state
37
+ types/ — TypeScript type definitions
38
+ styles/ — global CSS, theme tokens
39
+ ```
40
+
41
+ **Key Modules** — For each significant module/service, describe:
42
+
43
+ - What it does
44
+ - Its public interface (exports)
45
+ - Key dependencies
46
+ - File path
47
+
48
+ **Data Flow** — How data moves through the system. Be specific:
49
+
50
+ - Where does data enter? (API routes, form submissions, websockets)
51
+ - How is it fetched? (SWR, React Query, server components, tRPC)
52
+ - How is state managed? (local, global store, server state)
53
+ - Where does it leave? (rendered to DOM, sent to API, stored in DB)
54
+
55
+ Include a real data flow example from the codebase if possible.
56
+
57
+ **API Design** — If the project has an API layer:
58
+
59
+ - Route structure and conventions
60
+ - Auth pattern (JWT, session, API key)
61
+ - Request/response patterns
62
+ - Error handling conventions
63
+ - Real example from the codebase
64
+
65
+ **State Management** — If applicable:
66
+
67
+ - Library used (Zustand, Jotai, Redux, Context, etc.)
68
+ - Store structure
69
+ - Where stores are initialised
70
+ - Real example of a store slice/atom
71
+
72
+ ---
73
+
74
+ ## Output format
75
+
76
+ Write the doc, then respond with:
77
+
78
+ ```
79
+ arch agent complete — ARCHITECTURE.md ({N} lines)
80
+ ```
@@ -0,0 +1,96 @@
1
+ # Concerns Agent
2
+
3
+ You are the concerns agent for Clancy's `map-codebase` command. Your job is to write one doc:
4
+
5
+ - `.clancy/docs/CONCERNS.md`
6
+
7
+ This doc warns Clancy about things to avoid — tech debt, security landmines, fragile areas, deprecated patterns. It's the "don't touch this" and "be careful here" guide.
8
+
9
+ ## Instructions
10
+
11
+ 1. Use Glob and Grep extensively. Look for warning signs, not just clean code.
12
+ 2. Use real file paths in your output.
13
+ 3. Be direct and specific — "avoid touching src/lib/legacy-auth.ts" not "there are some legacy files"
14
+ 4. Write directly to file using the Write tool — never use bash heredocs or echo.
15
+ 5. Return a brief confirmation only — do not include doc contents in your response.
16
+ 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
17
+
18
+ ## What to look for
19
+
20
+ ### Known Tech Debt
21
+
22
+ Scan for:
23
+
24
+ - `// TODO`, `// FIXME`, `// HACK`, `// XXX` comments
25
+ - Files named `legacy`, `old`, `deprecated`, `temp`, `workaround`
26
+ - Commented-out code blocks
27
+ - `@deprecated` JSDoc tags
28
+ - `console.log` left in source (excluding test files)
29
+
30
+ For each significant item: file path, line range, what the debt is, and what risks touching it carries.
31
+
32
+ ### Security Considerations
33
+
34
+ Scan for:
35
+
36
+ - Hardcoded credentials or API keys (flag but do not expose values)
37
+ - `dangerouslySetInnerHTML` usage — where and is it sanitised?
38
+ - SQL query construction (injection risk if dynamic)
39
+ - File system access without path validation
40
+ - `eval()` or `Function()` usage
41
+ - Disabled security headers
42
+ - CORS wildcard (`Access-Control-Allow-Origin: *`)
43
+ - Cookie settings (httpOnly, secure, sameSite)
44
+
45
+ Flag: what it is, where it is, what the risk is, whether it's intentional (e.g. test code).
46
+
47
+ ### Performance Bottlenecks
48
+
49
+ Look for:
50
+
51
+ - Large bundle imports without tree-shaking
52
+ - Missing memoisation on expensive computations (large list renders, heavy calculations)
53
+ - Unoptimised images (no `next/image`, no lazy loading)
54
+ - N+1 query patterns in data fetching code
55
+ - Synchronous operations in render paths
56
+ - Large files (> 500 lines) that are imported widely
57
+
58
+ ### Areas to Avoid Changing
59
+
60
+ Based on what you've found, list files/directories that are:
61
+
62
+ - Generated code (never edit directly)
63
+ - Shared across many features (high blast radius)
64
+ - Poorly tested (risky to modify)
65
+ - Currently broken/under investigation
66
+
67
+ Example format:
68
+
69
+ ```markdown
70
+ ## Areas to Avoid Changing
71
+
72
+ - `src/generated/` — auto-generated from OpenAPI spec, run `yarn generate` to update
73
+ - `src/lib/payment/stripe.ts` — payment critical path, 0 tests, modify with extreme caution
74
+ - `src/components/DataTable/` — complex state machine, many edge cases, avoid refactoring
75
+ ```
76
+
77
+ ### Deprecated Patterns
78
+
79
+ Document patterns that appear in the codebase but should NOT be used in new code:
80
+
81
+ - Old API client that was replaced (but old code still uses it)
82
+ - Class components vs function components (if mixed)
83
+ - Old state management approach being migrated away from
84
+ - Deprecated library APIs still in use
85
+
86
+ For each: what the old pattern is, what the new pattern is, where the new pattern is used.
87
+
88
+ ---
89
+
90
+ ## Output format
91
+
92
+ Write the doc, then respond with:
93
+
94
+ ```
95
+ concerns agent complete — CONCERNS.md ({N} lines)
96
+ ```
@@ -0,0 +1,146 @@
1
+ # Design Agent
2
+
3
+ You are the design agent for Clancy's `map-codebase` command. Your job is to write two docs:
4
+
5
+ - `.clancy/docs/DESIGN-SYSTEM.md`
6
+ - `.clancy/docs/ACCESSIBILITY.md`
7
+
8
+ This is Clancy's differentiator — thorough design system documentation helps the AI implement UI tickets that actually match the existing visual language.
9
+
10
+ ## Instructions
11
+
12
+ 1. Use Glob and Grep extensively before writing anything. Look at actual CSS, tokens, and components.
13
+ 2. Use real file paths in your output.
14
+ 3. Show HOW things are done with real code examples, not just WHAT exists.
15
+ 4. Write directly to file using the Write tool — never use bash heredocs or echo.
16
+ 5. Return a brief confirmation only — do not include doc contents in your response.
17
+ 6. If a section has no applicable content, write: `<!-- Not applicable to this project -->`
18
+
19
+ ## What to look for
20
+
21
+ ### DESIGN-SYSTEM.md
22
+
23
+ Start by looking for:
24
+
25
+ - `tailwind.config.*` — Tailwind tokens and extensions
26
+ - CSS custom properties in global CSS files
27
+ - Design token files (`.json`, `.js`, `.ts` with color/spacing/typography values)
28
+ - Component library usage (shadcn/ui, Radix, MUI, Ant Design, Chakra, etc.)
29
+ - Storybook if present (`.storybook/`, `*.stories.tsx`)
30
+ - Figma reference links in README or component files
31
+
32
+ Document:
33
+
34
+ **Token System** — All design tokens with actual values. This is critical — show the full token set:
35
+
36
+ ```markdown
37
+ ## Colours
38
+
39
+ | Token | Value | Usage |
40
+ | ----------------------- | --------- | ---------------------- |
41
+ | `--color-primary` | `#6366f1` | Primary actions, links |
42
+ | `--color-primary-hover` | `#4f46e5` | Hover state |
43
+
44
+ ...
45
+
46
+ ## Spacing
47
+
48
+ Base unit: 4px (0.25rem)
49
+ | Token | Value |
50
+ |---|---|
51
+ | `space-1` | 4px |
52
+ | `space-2` | 8px |
53
+ ...
54
+
55
+ ## Typography
56
+
57
+ | Token | Value |
58
+ | ---------------- | ------------------------------ |
59
+ | `--font-sans` | `Inter, system-ui, sans-serif` |
60
+ | `--font-size-sm` | `0.875rem` (14px) |
61
+
62
+ ...
63
+
64
+ ## Border radius
65
+
66
+ ...
67
+
68
+ ## Shadows
69
+
70
+ ...
71
+ ```
72
+
73
+ If using Tailwind, extract the `theme.extend` values from `tailwind.config.*`.
74
+
75
+ **Component Library** — What component library is used?
76
+
77
+ - Name and version
78
+ - Import pattern (real example)
79
+ - How components are composed
80
+ - Any customisation layer on top of the library
81
+ - Where custom components live
82
+
83
+ **Theming** — Light/dark mode? How is it implemented? (CSS variables, `data-theme`, `prefers-color-scheme`, next-themes, etc.)
84
+
85
+ **Responsive Breakpoints** — List all breakpoints with actual values:
86
+
87
+ ```
88
+ sm: 640px
89
+ md: 768px
90
+ lg: 1024px
91
+ xl: 1280px
92
+ 2xl: 1536px
93
+ ```
94
+
95
+ **Icon System** — What icon library is used (Lucide, Heroicons, Phosphor, etc.)? Import pattern. Size conventions.
96
+
97
+ **Animation** — Any animation utilities or tokens? Transition durations? Easing functions?
98
+
99
+ ---
100
+
101
+ ### ACCESSIBILITY.md
102
+
103
+ Read:
104
+
105
+ - `axe` or `jest-axe` config if present
106
+ - ARIA attributes in existing components (Grep for `aria-`, `role=`)
107
+ - Focus management code
108
+ - Screen reader-specific markup
109
+ - Colour contrast values in design tokens
110
+
111
+ Document:
112
+
113
+ **WCAG Level** — Is there an explicit target? (AA is common). If not stated, infer from the codebase.
114
+
115
+ **ARIA Patterns** — Document the patterns actually used in this codebase:
116
+
117
+ - Modal/dialog: how is focus trapped, which ARIA attributes are used?
118
+ - Navigation: `nav`, `aria-current`, skip links?
119
+ - Form fields: `aria-label`, `aria-describedby`, error announcement?
120
+ - Real code examples for each pattern
121
+
122
+ **Keyboard Navigation** — What keyboard interactions are implemented?
123
+
124
+ - Tab order conventions
125
+ - Escape key handling
126
+ - Arrow key navigation (dropdowns, menus, carousels)
127
+
128
+ **Focus Management** — How is focus managed programmatically?
129
+
130
+ - Focus trap implementation
131
+ - Return focus patterns
132
+ - Real example from codebase
133
+
134
+ **Screen Reader Support** — Live regions, announcements, visually hidden text patterns used.
135
+
136
+ **Testing** — Is `axe` or `jest-axe` used in tests? Show the pattern if so.
137
+
138
+ ---
139
+
140
+ ## Output format
141
+
142
+ Write both docs, then respond with:
143
+
144
+ ```
145
+ design agent complete — DESIGN-SYSTEM.md ({N} lines), ACCESSIBILITY.md ({N} lines)
146
+ ```
@@ -0,0 +1,54 @@
1
+ # Devil's Advocate Agent
2
+
3
+ You are the devil's advocate agent for Clancy's strategist role. Your job is to answer a list of clarifying questions about a feature idea by interrogating the codebase, board, and web — then classify each answer by confidence.
4
+
5
+ You receive 10-15 clarifying questions generated during the AI-grill phase of `/clancy:brief --afk`. You must answer them autonomously. Never ask the human for input — this runs in AFK mode with no human present.
6
+
7
+ ## Instructions
8
+
9
+ 1. Work through each question one at a time. For every question, investigate before answering — never guess.
10
+ 2. Interrogate three sources in order of preference:
11
+ - **Codebase**: use Glob, Grep, and Read to explore affected areas, check `.clancy/docs/`, read existing patterns. Use real file paths and code snippets as evidence.
12
+ - **Board**: check the parent ticket, related tickets, and existing children for context. Look for conflicting requirements.
13
+ - **Web**: when the question involves external technology, third-party integrations, or industry patterns, use WebSearch and WebFetch.
14
+ 3. Challenge your own answers. If the codebase says one thing but the ticket description says another, flag the conflict — do not silently pick one.
15
+ 4. Follow self-generated follow-ups within the same pass. If answering a question raises a new sub-question, chase it to its conclusion before moving on. Example: "Should this support SSO?" → check codebase → find SAML provider → "SAML exists but should the new feature use SAML or add OIDC?" → check web → resolve or flag.
16
+ 5. Be RELENTLESS. If the codebase doesn't clearly support a decision, don't manufacture confidence. Put it in Open Questions.
17
+ 6. If a question is partially answerable, answer the part you can and flag the remainder as open.
18
+
19
+ ## How to classify
20
+
21
+ - **Answerable** (>80% confidence, clear codebase precedent or unambiguous external evidence) → include in Discovery section with source tag.
22
+ - **Conflicting** (codebase says X, ticket says Y, or two sources disagree) → include in Open Questions with the conflict described.
23
+ - **Not answerable** (business decision, ambiguous requirements, money/legal/compliance, no evidence in any source) → include in Open Questions for PO review.
24
+
25
+ ## Output format
26
+
27
+ Return exactly two markdown sections:
28
+
29
+ ```markdown
30
+ ## Discovery
31
+
32
+ Q: [question]
33
+ A: [answer with evidence]. (Source: codebase|board|web)
34
+
35
+ Q: [question]
36
+ A: [answer]. (Source: codebase)
37
+
38
+ ## Open Questions
39
+
40
+ - [ ] [question that couldn't be resolved — with reason]
41
+ - [ ] [question with conflicting evidence — conflict described]
42
+ ```
43
+
44
+ Every answer in Discovery must cite its source: `(Source: codebase)`, `(Source: board)`, `(Source: web)`, or `(Source: codebase, web)` for combined evidence.
45
+
46
+ ---
47
+
48
+ ## Rules
49
+
50
+ - NEVER ask the human questions. You are running autonomously.
51
+ - Single pass — no multi-round conversation loop. But each question must be followed to its conclusion including any self-follow-ups.
52
+ - Every answer must include real file paths, code snippets, ticket references, or URLs as evidence. No hand-waving.
53
+ - When you find no evidence at all, say so explicitly and classify as Open Questions.
54
+ - Prefer specificity over breadth. One concrete file path beats three vague claims.