opencastle 1.1.1 → 1.3.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 (307) hide show
  1. package/README.md +26 -9
  2. package/bin/cli.mjs +6 -0
  3. package/dist/cli/adapters/antigravity.d.ts +0 -1
  4. package/dist/cli/adapters/antigravity.d.ts.map +1 -1
  5. package/dist/cli/adapters/antigravity.js +2 -1
  6. package/dist/cli/adapters/antigravity.js.map +1 -1
  7. package/dist/cli/adapters/claude-code.d.ts +0 -1
  8. package/dist/cli/adapters/claude-code.d.ts.map +1 -1
  9. package/dist/cli/adapters/claude-code.js +0 -1
  10. package/dist/cli/adapters/claude-code.js.map +1 -1
  11. package/dist/cli/adapters/cursor.d.ts.map +1 -1
  12. package/dist/cli/adapters/cursor.js +8 -1
  13. package/dist/cli/adapters/cursor.js.map +1 -1
  14. package/dist/cli/adapters/opencode.d.ts +12 -5
  15. package/dist/cli/adapters/opencode.d.ts.map +1 -1
  16. package/dist/cli/adapters/opencode.js +17 -5
  17. package/dist/cli/adapters/opencode.js.map +1 -1
  18. package/dist/cli/adapters/rules-dir-base.d.ts +12 -1
  19. package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
  20. package/dist/cli/adapters/rules-dir-base.js +43 -57
  21. package/dist/cli/adapters/rules-dir-base.js.map +1 -1
  22. package/dist/cli/adapters/rules-dir-base.test.js +27 -18
  23. package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
  24. package/dist/cli/adapters/single-file-base.d.ts +11 -0
  25. package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
  26. package/dist/cli/adapters/single-file-base.js +44 -14
  27. package/dist/cli/adapters/single-file-base.js.map +1 -1
  28. package/dist/cli/adapters/vscode.d.ts +2 -1
  29. package/dist/cli/adapters/vscode.d.ts.map +1 -1
  30. package/dist/cli/adapters/vscode.js +2 -1
  31. package/dist/cli/adapters/vscode.js.map +1 -1
  32. package/dist/cli/adapters/windsurf.d.ts.map +1 -1
  33. package/dist/cli/adapters/windsurf.js +11 -1
  34. package/dist/cli/adapters/windsurf.js.map +1 -1
  35. package/dist/cli/agent-plugin.d.ts +119 -0
  36. package/dist/cli/agent-plugin.d.ts.map +1 -0
  37. package/dist/cli/agent-plugin.js +449 -0
  38. package/dist/cli/agent-plugin.js.map +1 -0
  39. package/dist/cli/agent-plugin.test.d.ts +2 -0
  40. package/dist/cli/agent-plugin.test.d.ts.map +1 -0
  41. package/dist/cli/agent-plugin.test.js +227 -0
  42. package/dist/cli/agent-plugin.test.js.map +1 -0
  43. package/dist/cli/baseline.d.ts.map +1 -1
  44. package/dist/cli/baseline.js +114 -34
  45. package/dist/cli/baseline.js.map +1 -1
  46. package/dist/cli/ci.d.ts.map +1 -1
  47. package/dist/cli/ci.js +18 -4
  48. package/dist/cli/ci.js.map +1 -1
  49. package/dist/cli/codex-target.test.js +14 -1
  50. package/dist/cli/codex-target.test.js.map +1 -1
  51. package/dist/cli/convoy/gates.d.ts +2 -20
  52. package/dist/cli/convoy/gates.d.ts.map +1 -1
  53. package/dist/cli/convoy/gates.js +3 -111
  54. package/dist/cli/convoy/gates.js.map +1 -1
  55. package/dist/cli/copy.d.ts +0 -8
  56. package/dist/cli/copy.d.ts.map +1 -1
  57. package/dist/cli/copy.js +0 -21
  58. package/dist/cli/copy.js.map +1 -1
  59. package/dist/cli/dispatcher.test.js +2 -2
  60. package/dist/cli/dispatcher.test.js.map +1 -1
  61. package/dist/cli/docs-accuracy.test.js +2 -0
  62. package/dist/cli/docs-accuracy.test.js.map +1 -1
  63. package/dist/cli/doctor.d.ts.map +1 -1
  64. package/dist/cli/doctor.js +2 -0
  65. package/dist/cli/doctor.js.map +1 -1
  66. package/dist/cli/doctor.test.js +2 -2
  67. package/dist/cli/doctor.test.js.map +1 -1
  68. package/dist/cli/explain.d.ts +5 -0
  69. package/dist/cli/explain.d.ts.map +1 -1
  70. package/dist/cli/explain.js +38 -2
  71. package/dist/cli/explain.js.map +1 -1
  72. package/dist/cli/init.test.js +78 -42
  73. package/dist/cli/init.test.js.map +1 -1
  74. package/dist/cli/layers.d.ts +8 -0
  75. package/dist/cli/layers.d.ts.map +1 -1
  76. package/dist/cli/layers.js +130 -13
  77. package/dist/cli/layers.js.map +1 -1
  78. package/dist/cli/layers.test.js +2 -2
  79. package/dist/cli/layers.test.js.map +1 -1
  80. package/dist/cli/legacy-install.test.js +8 -1
  81. package/dist/cli/legacy-install.test.js.map +1 -1
  82. package/dist/cli/lesson-command.test.d.ts +2 -0
  83. package/dist/cli/lesson-command.test.d.ts.map +1 -0
  84. package/dist/cli/lesson-command.test.js +100 -0
  85. package/dist/cli/lesson-command.test.js.map +1 -0
  86. package/dist/cli/lesson.d.ts +0 -9
  87. package/dist/cli/lesson.d.ts.map +1 -1
  88. package/dist/cli/lesson.js +212 -276
  89. package/dist/cli/lesson.js.map +1 -1
  90. package/dist/cli/lessons.d.ts +134 -0
  91. package/dist/cli/lessons.d.ts.map +1 -0
  92. package/dist/cli/lessons.js +493 -0
  93. package/dist/cli/lessons.js.map +1 -0
  94. package/dist/cli/lessons.test.d.ts +2 -0
  95. package/dist/cli/lessons.test.d.ts.map +1 -0
  96. package/dist/cli/lessons.test.js +214 -0
  97. package/dist/cli/lessons.test.js.map +1 -0
  98. package/dist/cli/managed-paths.d.ts.map +1 -1
  99. package/dist/cli/managed-paths.js +3 -1
  100. package/dist/cli/managed-paths.js.map +1 -1
  101. package/dist/cli/mcp-audit.d.ts.map +1 -1
  102. package/dist/cli/mcp-audit.js +2 -0
  103. package/dist/cli/mcp-audit.js.map +1 -1
  104. package/dist/cli/mcp-upgrade.test.js +24 -1
  105. package/dist/cli/mcp-upgrade.test.js.map +1 -1
  106. package/dist/cli/mcp.d.ts.map +1 -1
  107. package/dist/cli/mcp.js +22 -3
  108. package/dist/cli/mcp.js.map +1 -1
  109. package/dist/cli/pack-plugins.d.ts +8 -0
  110. package/dist/cli/pack-plugins.d.ts.map +1 -0
  111. package/dist/cli/pack-plugins.js +70 -0
  112. package/dist/cli/pack-plugins.js.map +1 -0
  113. package/dist/cli/plugin-command.test.d.ts +2 -0
  114. package/dist/cli/plugin-command.test.d.ts.map +1 -0
  115. package/dist/cli/plugin-command.test.js +114 -0
  116. package/dist/cli/plugin-command.test.js.map +1 -0
  117. package/dist/cli/plugin.d.ts +30 -0
  118. package/dist/cli/plugin.d.ts.map +1 -0
  119. package/dist/cli/plugin.js +291 -0
  120. package/dist/cli/plugin.js.map +1 -0
  121. package/dist/cli/promote-command.test.d.ts +2 -0
  122. package/dist/cli/promote-command.test.d.ts.map +1 -0
  123. package/dist/cli/promote-command.test.js +151 -0
  124. package/dist/cli/promote-command.test.js.map +1 -0
  125. package/dist/cli/promote.d.ts +12 -0
  126. package/dist/cli/promote.d.ts.map +1 -0
  127. package/dist/cli/promote.js +364 -0
  128. package/dist/cli/promote.js.map +1 -0
  129. package/dist/cli/secret-scan.d.ts +21 -0
  130. package/dist/cli/secret-scan.d.ts.map +1 -0
  131. package/dist/cli/secret-scan.js +114 -0
  132. package/dist/cli/secret-scan.js.map +1 -0
  133. package/dist/cli/sync-check.d.ts.map +1 -1
  134. package/dist/cli/sync-check.js +9 -0
  135. package/dist/cli/sync-check.js.map +1 -1
  136. package/dist/cli/sync-check.test.js +5 -4
  137. package/dist/cli/sync-check.test.js.map +1 -1
  138. package/dist/cli/team-commands.test.js +14 -2
  139. package/dist/cli/team-commands.test.js.map +1 -1
  140. package/dist/cli/team-sources.test.js +10 -0
  141. package/dist/cli/team-sources.test.js.map +1 -1
  142. package/dist/cli/types.d.ts +1 -1
  143. package/dist/cli/types.d.ts.map +1 -1
  144. package/dist/cli/update.d.ts.map +1 -1
  145. package/dist/cli/update.js +18 -0
  146. package/dist/cli/update.js.map +1 -1
  147. package/dist/cli/windsurf-target.test.d.ts +2 -0
  148. package/dist/cli/windsurf-target.test.d.ts.map +1 -0
  149. package/dist/cli/windsurf-target.test.js +62 -0
  150. package/dist/cli/windsurf-target.test.js.map +1 -0
  151. package/dist/orchestrator/plugins/agent-plugins.test.d.ts +2 -0
  152. package/dist/orchestrator/plugins/agent-plugins.test.d.ts.map +1 -0
  153. package/dist/orchestrator/plugins/agent-plugins.test.js +32 -0
  154. package/dist/orchestrator/plugins/agent-plugins.test.js.map +1 -0
  155. package/dist/orchestrator/plugins/registry.test.d.ts +2 -0
  156. package/dist/orchestrator/plugins/registry.test.d.ts.map +1 -0
  157. package/dist/orchestrator/plugins/registry.test.js +37 -0
  158. package/dist/orchestrator/plugins/registry.test.js.map +1 -0
  159. package/package.json +2 -1
  160. package/src/cli/adapters/antigravity.ts +2 -1
  161. package/src/cli/adapters/claude-code.ts +0 -1
  162. package/src/cli/adapters/cursor.ts +8 -1
  163. package/src/cli/adapters/opencode.ts +18 -6
  164. package/src/cli/adapters/rules-dir-base.test.ts +28 -18
  165. package/src/cli/adapters/rules-dir-base.ts +51 -90
  166. package/src/cli/adapters/single-file-base.ts +53 -14
  167. package/src/cli/adapters/vscode.ts +2 -1
  168. package/src/cli/adapters/windsurf.ts +11 -1
  169. package/src/cli/agent-plugin.test.ts +267 -0
  170. package/src/cli/agent-plugin.ts +469 -0
  171. package/src/cli/baseline.ts +115 -32
  172. package/src/cli/ci.ts +19 -4
  173. package/src/cli/codex-target.test.ts +15 -1
  174. package/src/cli/convoy/gates.ts +9 -142
  175. package/src/cli/copy.ts +0 -25
  176. package/src/cli/dispatcher.test.ts +2 -2
  177. package/src/cli/docs-accuracy.test.ts +2 -0
  178. package/src/cli/doctor.test.ts +2 -2
  179. package/src/cli/doctor.ts +2 -0
  180. package/src/cli/explain.ts +36 -2
  181. package/src/cli/fixtures/lessons-template-1.0.md +70 -0
  182. package/src/cli/init.test.ts +82 -42
  183. package/src/cli/layers.test.ts +2 -2
  184. package/src/cli/layers.ts +144 -14
  185. package/src/cli/legacy-install.test.ts +11 -1
  186. package/src/cli/lesson-command.test.ts +117 -0
  187. package/src/cli/lesson.ts +215 -266
  188. package/src/cli/lessons.test.ts +254 -0
  189. package/src/cli/lessons.ts +540 -0
  190. package/src/cli/managed-paths.ts +3 -1
  191. package/src/cli/mcp-audit.ts +2 -0
  192. package/src/cli/mcp-upgrade.test.ts +26 -1
  193. package/src/cli/mcp.ts +22 -3
  194. package/src/cli/pack-plugins.ts +70 -0
  195. package/src/cli/plugin-command.test.ts +125 -0
  196. package/src/cli/plugin.ts +309 -0
  197. package/src/cli/promote-command.test.ts +170 -0
  198. package/src/cli/promote.ts +371 -0
  199. package/src/cli/secret-scan.ts +154 -0
  200. package/src/cli/sync-check.test.ts +5 -4
  201. package/src/cli/sync-check.ts +9 -0
  202. package/src/cli/team-commands.test.ts +18 -2
  203. package/src/cli/team-sources.test.ts +11 -0
  204. package/src/cli/types.ts +1 -1
  205. package/src/cli/update.ts +20 -0
  206. package/src/cli/windsurf-target.test.ts +70 -0
  207. package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
  208. package/src/orchestrator/agents/researcher.agent.md +1 -1
  209. package/src/orchestrator/customizations/LESSONS-LEARNED.md +10 -66
  210. package/src/orchestrator/customizations/README.md +2 -1
  211. package/src/orchestrator/customizations/logs/README.md +1 -1
  212. package/src/orchestrator/plugins/agent-plugins.test.ts +34 -0
  213. package/src/orchestrator/plugins/astro/mcp.json +9 -0
  214. package/src/orchestrator/plugins/astro/plugin.json +21 -0
  215. package/src/orchestrator/plugins/chrome-devtools/mcp.json +13 -0
  216. package/src/orchestrator/plugins/chrome-devtools/plugin.json +21 -0
  217. package/src/orchestrator/plugins/cloudflare/mcp.json +9 -0
  218. package/src/orchestrator/plugins/cloudflare/plugin.json +21 -0
  219. package/src/orchestrator/plugins/contentful/mcp.json +13 -0
  220. package/src/orchestrator/plugins/contentful/plugin.json +21 -0
  221. package/src/orchestrator/plugins/convex/mcp.json +15 -0
  222. package/src/orchestrator/plugins/convex/plugin.json +21 -0
  223. package/src/orchestrator/plugins/coolify/mcp.json +13 -0
  224. package/src/orchestrator/plugins/coolify/plugin.json +25 -0
  225. package/src/orchestrator/plugins/cypress/plugin.json +21 -0
  226. package/src/orchestrator/plugins/drizzle/plugin.json +21 -0
  227. package/src/orchestrator/plugins/expo/mcp.json +9 -0
  228. package/src/orchestrator/plugins/expo/plugin.json +21 -0
  229. package/src/orchestrator/plugins/figma/mcp.json +9 -0
  230. package/src/orchestrator/plugins/figma/plugin.json +21 -0
  231. package/src/orchestrator/plugins/hetzner/plugin.json +24 -0
  232. package/src/orchestrator/plugins/jira/mcp.json +9 -0
  233. package/src/orchestrator/plugins/jira/plugin.json +21 -0
  234. package/src/orchestrator/plugins/linear/mcp.json +9 -0
  235. package/src/orchestrator/plugins/linear/plugin.json +21 -0
  236. package/src/orchestrator/plugins/netlify/mcp.json +13 -0
  237. package/src/orchestrator/plugins/netlify/plugin.json +21 -0
  238. package/src/orchestrator/plugins/nextjs/mcp.json +13 -0
  239. package/src/orchestrator/plugins/nextjs/plugin.json +21 -0
  240. package/src/orchestrator/plugins/notion/mcp.json +9 -0
  241. package/src/orchestrator/plugins/notion/plugin.json +21 -0
  242. package/src/orchestrator/plugins/nx/mcp.json +14 -0
  243. package/src/orchestrator/plugins/nx/plugin.json +21 -0
  244. package/src/orchestrator/plugins/playwright/mcp.json +13 -0
  245. package/src/orchestrator/plugins/playwright/plugin.json +21 -0
  246. package/src/orchestrator/plugins/prisma/mcp.json +14 -0
  247. package/src/orchestrator/plugins/prisma/plugin.json +21 -0
  248. package/src/orchestrator/plugins/registry.test.ts +42 -0
  249. package/src/orchestrator/plugins/resend/mcp.json +13 -0
  250. package/src/orchestrator/plugins/resend/plugin.json +24 -0
  251. package/src/orchestrator/plugins/sanity/mcp.json +9 -0
  252. package/src/orchestrator/plugins/sanity/plugin.json +21 -0
  253. package/src/orchestrator/plugins/sentry/mcp.json +12 -0
  254. package/src/orchestrator/plugins/sentry/plugin.json +24 -0
  255. package/src/orchestrator/plugins/slack/mcp.json +13 -0
  256. package/src/orchestrator/plugins/slack/plugin.json +24 -0
  257. package/src/orchestrator/plugins/strapi/mcp.json +13 -0
  258. package/src/orchestrator/plugins/strapi/plugin.json +21 -0
  259. package/src/orchestrator/plugins/stripe/mcp.json +9 -0
  260. package/src/orchestrator/plugins/stripe/plugin.json +21 -0
  261. package/src/orchestrator/plugins/supabase/mcp.json +9 -0
  262. package/src/orchestrator/plugins/supabase/plugin.json +21 -0
  263. package/src/orchestrator/plugins/teams/plugin.json +24 -0
  264. package/src/orchestrator/plugins/trello/mcp.json +13 -0
  265. package/src/orchestrator/plugins/trello/plugin.json +25 -0
  266. package/src/orchestrator/plugins/turborepo/plugin.json +21 -0
  267. package/src/orchestrator/plugins/vercel/mcp.json +9 -0
  268. package/src/orchestrator/plugins/vercel/plugin.json +21 -0
  269. package/src/orchestrator/plugins/vitest/plugin.json +21 -0
  270. package/src/orchestrator/skill-config-links.test.ts +2 -1
  271. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
  272. package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
  273. package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
  274. package/src/orchestrator/skills/memory-merger/SKILL.md +17 -21
  275. package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +44 -23
  276. package/src/orchestrator/skills/self-improvement/SKILL.md +30 -15
  277. /package/src/orchestrator/plugins/astro/{SKILL.md → skills/astro-framework/SKILL.md} +0 -0
  278. /package/src/orchestrator/plugins/chrome-devtools/{SKILL.md → skills/browser-testing/SKILL.md} +0 -0
  279. /package/src/orchestrator/plugins/cloudflare/{SKILL.md → skills/cloudflare-platform/SKILL.md} +0 -0
  280. /package/src/orchestrator/plugins/contentful/{SKILL.md → skills/contentful-cms/SKILL.md} +0 -0
  281. /package/src/orchestrator/plugins/convex/{SKILL.md → skills/convex-database/SKILL.md} +0 -0
  282. /package/src/orchestrator/plugins/coolify/{SKILL.md → skills/coolify-deployment/SKILL.md} +0 -0
  283. /package/src/orchestrator/plugins/cypress/{SKILL.md → skills/cypress-testing/SKILL.md} +0 -0
  284. /package/src/orchestrator/plugins/drizzle/{SKILL.md → skills/drizzle-orm/SKILL.md} +0 -0
  285. /package/src/orchestrator/plugins/expo/{SKILL.md → skills/expo-development/SKILL.md} +0 -0
  286. /package/src/orchestrator/plugins/figma/{SKILL.md → skills/figma-design/SKILL.md} +0 -0
  287. /package/src/orchestrator/plugins/hetzner/{SKILL.md → skills/hetzner-cloud/SKILL.md} +0 -0
  288. /package/src/orchestrator/plugins/jira/{SKILL.md → skills/jira-management/SKILL.md} +0 -0
  289. /package/src/orchestrator/plugins/linear/{SKILL.md → skills/linear-task-management/SKILL.md} +0 -0
  290. /package/src/orchestrator/plugins/netlify/{SKILL.md → skills/netlify-deployment/SKILL.md} +0 -0
  291. /package/src/orchestrator/plugins/nextjs/{SKILL.md → skills/nextjs-framework/SKILL.md} +0 -0
  292. /package/src/orchestrator/plugins/notion/{SKILL.md → skills/notion-knowledge-management/SKILL.md} +0 -0
  293. /package/src/orchestrator/plugins/nx/{SKILL.md → skills/nx-workspace/SKILL.md} +0 -0
  294. /package/src/orchestrator/plugins/playwright/{SKILL.md → skills/playwright-testing/SKILL.md} +0 -0
  295. /package/src/orchestrator/plugins/prisma/{SKILL.md → skills/prisma-database/SKILL.md} +0 -0
  296. /package/src/orchestrator/plugins/resend/{SKILL.md → skills/resend-email/SKILL.md} +0 -0
  297. /package/src/orchestrator/plugins/sanity/{SKILL.md → skills/sanity-cms/SKILL.md} +0 -0
  298. /package/src/orchestrator/plugins/sentry/{SKILL.md → skills/sentry-monitoring/SKILL.md} +0 -0
  299. /package/src/orchestrator/plugins/slack/{SKILL.md → skills/slack-notifications/SKILL.md} +0 -0
  300. /package/src/orchestrator/plugins/strapi/{SKILL.md → skills/strapi-cms/SKILL.md} +0 -0
  301. /package/src/orchestrator/plugins/stripe/{SKILL.md → skills/stripe-payments/SKILL.md} +0 -0
  302. /package/src/orchestrator/plugins/supabase/{SKILL.md → skills/supabase-database/SKILL.md} +0 -0
  303. /package/src/orchestrator/plugins/teams/{SKILL.md → skills/teams-notifications/SKILL.md} +0 -0
  304. /package/src/orchestrator/plugins/trello/{SKILL.md → skills/trello-task-management/SKILL.md} +0 -0
  305. /package/src/orchestrator/plugins/turborepo/{SKILL.md → skills/turborepo-monorepo/SKILL.md} +0 -0
  306. /package/src/orchestrator/plugins/vercel/{SKILL.md → skills/vercel-deployment/SKILL.md} +0 -0
  307. /package/src/orchestrator/plugins/vitest/{SKILL.md → skills/vitest-testing/SKILL.md} +0 -0
@@ -0,0 +1,154 @@
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { join } from 'node:path'
3
+ import { parse as yamlParse } from 'yaml'
4
+
5
+ /**
6
+ * Finding a credential in text before it is written somewhere it is committed
7
+ * or logged.
8
+ *
9
+ * The convoy engine scans every event and artefact it writes with this; lessons
10
+ * are scanned before they are written, because a lesson is committed with the
11
+ * project. It lives outside the engine so the compiler's own commands can use
12
+ * it without depending on the experimental engine.
13
+ */
14
+
15
+ // ── Secret patterns ───────────────────────────────────────────────────────────
16
+
17
+ interface SecretPatternEntry {
18
+ name: string
19
+ pattern: RegExp
20
+ }
21
+
22
+ const SECRET_PATTERNS: SecretPatternEntry[] = [
23
+ { name: 'AWS Access Key', pattern: /AKIA[0-9A-Z]{16}/i },
24
+ {
25
+ name: 'AWS Secret Key',
26
+ // eslint-disable-next-line no-useless-escape
27
+ pattern: /(?:aws_secret_access_key|secret_key)\s*[=:]\s*[A-Za-z0-9\/+=]{40}/i,
28
+ },
29
+ {
30
+ name: 'Generic API Key',
31
+ pattern: /(?:api[_-]?key|apikey)\s*[=:]\s*['"]?[A-Za-z0-9_-]{20,}/i,
32
+ },
33
+ { name: 'Bearer Token', pattern: /[Bb]earer\s+[A-Za-z0-9\-._~+/]+=*/ },
34
+ { name: 'Private Key', pattern: /-----BEGIN (?:RSA|EC|OPENSSH) PRIVATE KEY-----/ },
35
+ {
36
+ name: 'Connection String',
37
+ // eslint-disable-next-line no-useless-escape
38
+ pattern: /(?:postgres|mysql|mongodb|redis):\/\/[^\s]+:[^\s]+@/,
39
+ },
40
+ { name: 'GitHub Token', pattern: /(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9_]{36,}/ },
41
+ {
42
+ name: 'Generic Password',
43
+ pattern: /(?:password|passwd|pwd)\s*[=:]\s*['"]?[^\s'"]{8,}/i,
44
+ },
45
+ { name: 'Slack Token', pattern: /xox[bprs]-[A-Za-z0-9-]{10,}/i },
46
+ {
47
+ name: 'Generic Secret',
48
+ pattern: /(?:secret|token|credential)\s*[=:]\s*['"]?[A-Za-z0-9_-]{16,}/i,
49
+ },
50
+ ]
51
+
52
+ // ── Public types ──────────────────────────────────────────────────────────────
53
+
54
+ export interface SecretScanResult {
55
+ clean: boolean
56
+ findings: Array<{ pattern: string; file: string; line: number; snippet: string }>
57
+ }
58
+
59
+ // ── Allowlist ─────────────────────────────────────────────────────────────────
60
+
61
+ interface AllowlistEntry {
62
+ pattern?: string
63
+ literal?: string
64
+ reason: string
65
+ paths?: string[]
66
+ }
67
+
68
+ let _allowlist: AllowlistEntry[] | null = null
69
+
70
+ /** The config path used for the allowlist. Override for testing. */
71
+ export let _allowlistConfigPath = join(process.cwd(), '.opencastle', 'secret-scan-config.yml')
72
+
73
+ /** Reset the allowlist cache (for testing). */
74
+ export function _resetAllowlistCache(): void {
75
+ _allowlist = null
76
+ }
77
+
78
+ /** Override the allowlist config path and reset cache (for testing). */
79
+ export function _setAllowlistConfigPath(path: string): void {
80
+ _allowlistConfigPath = path
81
+ _allowlist = null
82
+ }
83
+
84
+ function loadAllowlist(): AllowlistEntry[] {
85
+ if (_allowlist !== null) return _allowlist
86
+ try {
87
+ if (!existsSync(_allowlistConfigPath)) {
88
+ _allowlist = []
89
+ return _allowlist
90
+ }
91
+ const content = readFileSync(_allowlistConfigPath, 'utf-8')
92
+ const parsed = yamlParse(content) as Record<string, unknown> | null
93
+ if (!parsed || !Array.isArray(parsed['allowlist'])) {
94
+ _allowlist = []
95
+ return _allowlist
96
+ }
97
+ _allowlist = parsed['allowlist'] as AllowlistEntry[]
98
+ return _allowlist
99
+ } catch {
100
+ _allowlist = []
101
+ return _allowlist
102
+ }
103
+ }
104
+
105
+ function isSuppressed(
106
+ finding: { snippet: string },
107
+ filePath: string,
108
+ allowlist: AllowlistEntry[],
109
+ ): boolean {
110
+ for (const entry of allowlist) {
111
+ if (entry.paths && entry.paths.length > 0) {
112
+ if (!entry.paths.some((p) => filePath.includes(p))) continue
113
+ }
114
+ if (entry.literal) {
115
+ if (finding.snippet.includes(entry.literal)) return true
116
+ } else if (entry.pattern) {
117
+ try {
118
+ if (new RegExp(entry.pattern, 'i').test(finding.snippet)) return true
119
+ } catch {
120
+ // Invalid regex in allowlist — skip entry
121
+ }
122
+ }
123
+ }
124
+ return false
125
+ }
126
+
127
+ // ── scanForSecrets ────────────────────────────────────────────────────────────
128
+
129
+ /**
130
+ * Scan text content line-by-line for secrets using the default pattern set.
131
+ * Allowlist entries in `.opencastle/secret-scan-config.yml` suppress false positives.
132
+ */
133
+ export function scanForSecrets(content: string, filePath = ''): SecretScanResult {
134
+ const allowlist = loadAllowlist()
135
+ const lines = content.split('\n')
136
+ const findings: SecretScanResult['findings'] = []
137
+
138
+ for (let i = 0; i < lines.length; i++) {
139
+ const line = lines[i]
140
+ for (const { name, pattern } of SECRET_PATTERNS) {
141
+ if (pattern.test(line)) {
142
+ const snippet = line.length > 100 ? line.slice(0, 97) + '...' : line
143
+ const finding = { pattern: name, file: filePath, line: i + 1, snippet }
144
+ if (!isSuppressed(finding, filePath, allowlist)) {
145
+ findings.push(finding)
146
+ }
147
+ // Only report the first matching pattern per line
148
+ break
149
+ }
150
+ }
151
+ }
152
+
153
+ return { clean: findings.length === 0, findings }
154
+ }
@@ -212,10 +212,11 @@ describe('two targets that share a root file', () => {
212
212
  }
213
213
  const text = readFileSync(join(projectRoot, 'AGENTS.md'), 'utf8')
214
214
  expect(text).toContain('shared by more than one assistant')
215
- expect(text).toContain('.opencode/skills/')
216
- expect(text).toContain('`.codex/`, `.agents/skills/`')
217
- // Both assistants still get their own files.
218
- expect(existsSync(join(projectRoot, '.opencode', 'skills'))).toBe(true)
215
+ expect(text).toContain('Skills are in `.agents/skills/`')
216
+ expect(text).toContain('also installed under `.codex/`.')
217
+ // Each keeps its own agents; both read the one skills directory.
218
+ expect(existsSync(join(projectRoot, '.opencode', 'agents'))).toBe(true)
219
+ expect(existsSync(join(projectRoot, '.codex', 'agents'))).toBe(true)
219
220
  expect(existsSync(join(projectRoot, '.agents', 'skills'))).toBe(true)
220
221
  })
221
222
  })
@@ -6,6 +6,7 @@ import { IDE_ADAPTERS } from './adapters/index.js'
6
6
  import { detectRepoInfo, mergeStackIntoRepoInfo } from './detect.js'
7
7
  import { getMcpConfigRelPath, expectedTeamEntries, containerKeyFor } from './mcp.js'
8
8
  import { parseMcpConfigText } from './mcp-file.js'
9
+ import { lessonsIndexDrift, LESSONS_INDEX } from './lessons.js'
9
10
  import { resolveStack, getIncludedMcpServers } from './stack-config.js'
10
11
  import { auditMcpConfig, describeFindingUnder, remedyFor, isFailure, type TeamAuditContext } from './mcp-audit.js'
11
12
  import { resolveSources, materialize, hasErrors, cliVersionOf, type CompileSource } from './layers.js'
@@ -652,6 +653,14 @@ async function compareProject(
652
653
  }
653
654
  }
654
655
 
656
+ // The lessons index, compiled from `.opencastle/lessons/` by `sync`. Two
657
+ // branches that each add a lesson merge cleanly; the index they both touched
658
+ // is what this catches, and `sync` rebuilds it.
659
+ {
660
+ const why = lessonsIndexDrift(resolve(projectRoot, '.opencastle'))
661
+ if (why) drift.push({ ide: 'all', path: `.opencastle/${LESSONS_INDEX}`, kind: 'outdated', detail: why, fix: 'opencastle sync' })
662
+ }
663
+
655
664
  // A manifest that parses but names no target this release knows is not a
656
665
  // clean project — `sync` exits 1 on it. Reporting "0 generated files match
657
666
  // their sources across 0 targets" is an assertion that cannot fail, and it
@@ -219,7 +219,7 @@ describe.skipIf(!built)('a baseline package', () => {
219
219
  it('scaffolds one that passes its own check', () => {
220
220
  expect(run(dir, ['baseline', 'init', 'base', '--name', '@acme/base']).code).toBe(0)
221
221
  const pkg = JSON.parse(readFileSync(join(dir, 'base', 'package.json'), 'utf8'))
222
- expect(pkg.opencastle).toEqual({ baseline: 'layer' })
222
+ expect(pkg.opencastle).toEqual({ baseline: '.' })
223
223
  const check = run(dir, ['baseline', 'check', 'base', '--json'])
224
224
  expect(check.code).toBe(0)
225
225
  const report = JSON.parse(check.out)
@@ -240,6 +240,22 @@ describe.skipIf(!built)('a baseline package', () => {
240
240
  expect(check.out).toContain('points outside the package')
241
241
  })
242
242
 
243
+ it('names each problem once, by the path it was given', () => {
244
+ run(dir, ['baseline', 'init', 'base', '--name', '@acme/base'])
245
+ writeFileSync(
246
+ join(dir, 'base', 'mcp.json'),
247
+ JSON.stringify({ $schema: 'https://agent-plugins.org/schemas/1.0.0/mcp.schema.json', mcpServers: { docs: { type: 'streamable-http', url: 'https://docs.acme.example/mcp' } } }),
248
+ )
249
+ run(dir, ['plugin', 'build', 'base'])
250
+ const check = run(dir, ['baseline', 'check', 'base'])
251
+ // eslint-disable-next-line no-control-regex
252
+ check.out = check.out.replace(/\x1b\[[0-9;]*m/g, '')
253
+ expect(check.code).toBe(1)
254
+ expect(check.out).toContain('✗ base/mcp.json: defines MCP server "docs", which @acme/base does not allow\n → add it to policy.mcp.allow in @acme/base')
255
+ expect(check.out).not.toContain('✗ ✗')
256
+ expect(check.out).not.toContain(dir.replace(/^\//, ''))
257
+ })
258
+
243
259
  it('fails one that would publish empty', () => {
244
260
  run(dir, ['baseline', 'init', 'base', '--name', '@acme/base'])
245
261
  const path = join(dir, 'base', 'package.json')
@@ -248,6 +264,6 @@ describe.skipIf(!built)('a baseline package', () => {
248
264
  writeFileSync(path, JSON.stringify(pkg))
249
265
  const check = run(dir, ['baseline', 'check', 'base'])
250
266
  expect(check.code).toBe(1)
251
- expect(check.out).toContain('npm publish would ship a baseline with nothing in it')
267
+ expect(check.out).toContain('"files" does not include plugin.json, so npm publish would leave it out')
252
268
  })
253
269
  })
@@ -484,6 +484,17 @@ describe('what review found, kept fixed (compiler and commands)', () => {
484
484
  expect(plan.codeowners?.block).toContain('/apps/web/.opencastle/lock.json @acme/platform')
485
485
  })
486
486
 
487
+ it('ci: names paths as the project spells them, through a linked checkout', () => {
488
+ const real = join(project, 'real')
489
+ write(real, { 'package.json': '{}', 'package-lock.json': '{}', CODEOWNERS: '* @acme/everyone\n' })
490
+ execFileSync('git', ['init', '-q'], { cwd: real })
491
+ const linked = join(project, 'linked')
492
+ symlinkSync(real, linked)
493
+ const plan = planCi(linked, '0.36.0', '@acme/platform')
494
+ expect(plan.codeowners?.path).toBe(join(linked, 'CODEOWNERS'))
495
+ expect(plan.workflowPath.startsWith(linked)).toBe(true)
496
+ })
497
+
487
498
  it('ci: gives pnpm a version when package.json does not name one', () => {
488
499
  write(project, { 'package.json': '{}', 'pnpm-lock.yaml': '' })
489
500
  expect(planCi(project, '0.36.0').workflow).toContain('version: 10')
package/src/cli/types.ts CHANGED
@@ -4,7 +4,7 @@ import type { CompileSource } from './layers.js';
4
4
  // ── Stack selection types ──────────────────────────────────────
5
5
 
6
6
  export type IdeChoice = 'vscode' | 'cursor' | 'claude-code' | 'opencode' | 'windsurf' | 'codex' | 'antigravity';
7
- export type TechTool = 'sanity' | 'contentful' | 'strapi' | 'supabase' | 'convex' | 'vercel' | 'nx' | 'chrome-devtools' | 'nextjs' | 'astro' | 'netlify' | 'turborepo' | 'prisma' | 'cypress' | 'playwright' | 'vitest' | 'figma' | 'resend' | 'stripe' | 'sentry' | 'drizzle' | 'cloudflare' | 'coolify' | 'expo';
7
+ export type TechTool = 'sanity' | 'contentful' | 'strapi' | 'supabase' | 'convex' | 'vercel' | 'nx' | 'chrome-devtools' | 'nextjs' | 'astro' | 'netlify' | 'turborepo' | 'prisma' | 'cypress' | 'playwright' | 'vitest' | 'figma' | 'resend' | 'stripe' | 'sentry' | 'drizzle' | 'cloudflare' | 'coolify' | 'expo' | 'hetzner';
8
8
  export type TeamTool = 'linear' | 'jira' | 'trello' | 'notion' | 'slack' | 'teams';
9
9
 
10
10
  export interface StackConfig {
package/src/cli/update.ts CHANGED
@@ -33,6 +33,7 @@ import { buildLock, writeLock, LOCK_REL, priorTeam } from './lock.js'
33
33
  import { parseVersion, compareVersions } from './version-range.js'
34
34
  import { COMMAND_NAMESPACE } from './command-namespace.js'
35
35
  import { parseMcpConfigText } from './mcp-file.js'
36
+ import { syncLessons, LESSONS_DIR, LESSONS_INDEX } from './lessons.js'
36
37
 
37
38
  /** The config that replaced a legacy one, for the sentence that reports it. */
38
39
  function configBesideLegacy(rel: string, ides: string[]): string {
@@ -698,6 +699,11 @@ export default async function update({
698
699
  // ── Migrate legacy log files ────────────────────────────────────
699
700
  await migrateLegacyLogs(projectRoot)
700
701
 
702
+ // ── Lessons: one file each, and the index agents read compiled from them ──
703
+ // Not compiled output of any target — agents read `.opencastle/` directly —
704
+ // but compiled all the same, and `sync --check` holds it to its sources.
705
+ const lessons = syncLessons(resolve(projectRoot, '.opencastle'))
706
+
701
707
  // ── Update manifest ─────────────────────────────────────────────
702
708
  const before = manifestMeaning(manifest as unknown as Record<string, unknown>)
703
709
  manifest.version = pkg.version
@@ -749,6 +755,20 @@ export default async function update({
749
755
  if (teamWritten.size > 0) {
750
756
  console.log(` ${c.green('✓')} Wrote the team's MCP server(s) as defined: ${[...teamWritten].sort().join(', ')}`)
751
757
  }
758
+ if (lessons.migrated > 0) {
759
+ console.log(
760
+ ` ${c.green('✓')} Moved ${lessons.migrated} lesson(s) from .opencastle/${LESSONS_INDEX} into .opencastle/${LESSONS_DIR}/, one file each` +
761
+ (lessons.backup ? c.dim(` (the old file is kept as ${lessons.backup})`) : ''),
762
+ )
763
+ } else if (lessons.backup) {
764
+ console.log(` ${c.green('✓')} Replaced .opencastle/${LESSONS_INDEX} with an index of .opencastle/${LESSONS_DIR}/ ${c.dim(`(the old file is kept as ${lessons.backup})`)}`)
765
+ }
766
+ if (lessons.index === 'updated' && lessons.migrated === 0 && !lessons.backup) {
767
+ console.log(` ${c.green('✓')} Updated .opencastle/${LESSONS_INDEX} from .opencastle/${LESSONS_DIR}/`)
768
+ }
769
+ for (const problem of lessons.problems) {
770
+ console.log(` ${c.yellow('!')} Left .opencastle/${problem.split(' ')[0]} out of the lessons index — ${problem.slice(problem.indexOf(' ') + 1)}`)
771
+ }
752
772
  for (const rel of legacyDeleted) {
753
773
  console.log(` ${c.yellow('-')} Removed ${rel}, which its assistant never read ${c.dim(`(its servers are now in ${configBesideLegacy(rel, ides)})`)}`)
754
774
  }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Windsurf — now Devin Desktop — through the built CLI.
3
+ *
4
+ * Releases before this one wrote `.windsurf/mcp.json`, which no Devin Desktop
5
+ * agent reads (the legacy Cascade agent reads one global file, the default
6
+ * Devin Local agent `.devin/mcp_config.json`), and flattened every skill into
7
+ * a `.windsurf/rules/skills/` rule although both agents read Agent Skills.
8
+ */
9
+ import { execFileSync } from 'node:child_process'
10
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs'
11
+ import { tmpdir } from 'node:os'
12
+ import { dirname, join, resolve } from 'node:path'
13
+ import { describe, it, expect, beforeEach, afterEach } from 'vitest'
14
+ import type { Manifest } from './types.js'
15
+
16
+ const pkgRoot = resolve(import.meta.dirname, '..', '..')
17
+ const cli = join(pkgRoot, 'bin', 'cli.mjs')
18
+ const built = existsSync(join(pkgRoot, 'dist', 'cli', 'init.js'))
19
+
20
+ function write(root: string, files: Record<string, string>): void {
21
+ for (const [rel, text] of Object.entries(files)) {
22
+ mkdirSync(dirname(join(root, rel)), { recursive: true })
23
+ writeFileSync(join(root, rel), text)
24
+ }
25
+ }
26
+
27
+ const run = (cwd: string, ...args: string[]): string =>
28
+ execFileSync('node', [cli, ...args], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'] })
29
+
30
+ describe.skipIf(!built)('Windsurf as a target', () => {
31
+ let project: string
32
+ beforeEach(() => {
33
+ project = mkdtempSync(join(tmpdir(), 'oc-windsurf-'))
34
+ execFileSync('git', ['init', '-q'], { cwd: project })
35
+ write(project, {
36
+ 'package.json': JSON.stringify({ name: 'app', dependencies: { '@supabase/supabase-js': '^2.0.0' } }),
37
+ '.windsurfrules': '# House rules\n',
38
+ })
39
+ run(project, 'init', '--yes')
40
+ })
41
+ afterEach(() => rmSync(project, { recursive: true, force: true }))
42
+
43
+ it('installs skills and servers where Devin Desktop reads them', () => {
44
+ expect(existsSync(join(project, '.agents', 'skills', 'testing-workflow', 'SKILL.md'))).toBe(true)
45
+ const mcp = JSON.parse(readFileSync(join(project, '.devin', 'mcp_config.json'), 'utf8'))
46
+ expect(mcp.mcpServers.Supabase).toEqual({ url: 'https://mcp.supabase.com/mcp' })
47
+ expect(readFileSync(join(project, '.windsurfrules'), 'utf8')).toContain('Skills are in `.agents/skills/`')
48
+ run(project, 'sync', '--check')
49
+ })
50
+
51
+ it('the sync that upgrades a 1.0 install moves both, and leaves nothing behind', () => {
52
+ write(project, {
53
+ '.windsurf/mcp.json': JSON.stringify({ mcpServers: { Supabase: { url: 'https://mcp.supabase.com/mcp' } } }, null, 2) + '\n',
54
+ '.windsurf/rules/skills/testing-workflow.md': '---\ntrigger: model_decision\n---\n\nold\n',
55
+ '.windsurf/rules/skills/testing-workflow/REFERENCE.md': 'old\n',
56
+ })
57
+ const path = join(project, '.opencastle', 'manifest.json')
58
+ const manifest = JSON.parse(readFileSync(path, 'utf8')) as Manifest
59
+ manifest.version = '1.0.0'
60
+ manifest.createdConfigs = ['.windsurf/mcp.json']
61
+ writeFileSync(path, JSON.stringify(manifest, null, 2))
62
+
63
+ const out = run(project, 'sync', '--yes')
64
+ expect(out).toContain('Removed .windsurf/mcp.json')
65
+ expect(existsSync(join(project, '.windsurf', 'mcp.json'))).toBe(false)
66
+ expect(existsSync(join(project, '.windsurf', 'rules', 'skills'))).toBe(false)
67
+ expect(existsSync(join(project, '.devin', 'mcp_config.json'))).toBe(true)
68
+ run(project, 'sync', '--check')
69
+ })
70
+ })
@@ -1,25 +1,25 @@
1
1
  {
2
- "hash": "a4fd7106",
2
+ "hash": "12c645f9",
3
3
  "configHash": "30f8ea04",
4
- "lockfileHash": "68c77928",
5
- "browserHash": "b3c82596",
4
+ "lockfileHash": "af43301a",
5
+ "browserHash": "13776f9b",
6
6
  "optimized": {
7
7
  "astro > cssesc": {
8
8
  "src": "../../../../../node_modules/cssesc/cssesc.js",
9
9
  "file": "astro___cssesc.js",
10
- "fileHash": "efb66864",
10
+ "fileHash": "94f71dbc",
11
11
  "needsInterop": true
12
12
  },
13
13
  "astro > aria-query": {
14
14
  "src": "../../../../../node_modules/aria-query/lib/index.js",
15
15
  "file": "astro___aria-query.js",
16
- "fileHash": "372fa031",
16
+ "fileHash": "6f2c077e",
17
17
  "needsInterop": true
18
18
  },
19
19
  "astro > axobject-query": {
20
20
  "src": "../../../../../node_modules/axobject-query/lib/index.js",
21
21
  "file": "astro___axobject-query.js",
22
- "fileHash": "7c9d31bc",
22
+ "fileHash": "4c620914",
23
23
  "needsInterop": true
24
24
  }
25
25
  },
@@ -64,7 +64,7 @@ Writing or editing code · running tests and builds · creating tracker issues
64
64
  - [Question]: Searched [X, Y, Z] — could not determine
65
65
 
66
66
  ### Relevant Lessons
67
- - [LES-XXX]: [summary]
67
+ - [lesson id]: [summary]
68
68
 
69
69
  ### Recommendations
70
70
  - [Recommendation with rationale]
@@ -1,70 +1,14 @@
1
- ````markdown
2
- # Lessons Learned
3
-
4
- Structured log of tool/command pitfalls, workarounds, and correct approaches discovered through agent execution. **Every agent** must read this file before starting work and must add entries when they discover a new pitfall through trial-and-error.
5
-
6
- > **This file is the collective memory of the agent team.** It prevents repeating the same mistakes across sessions.
7
-
8
- ---
9
-
10
- ## How to Use This File
11
-
12
- ### Before starting work
13
-
14
- 1. Read the **entire file** (or at minimum, the sections relevant to your task)
15
- 2. Apply any relevant lessons to your approach **before** attempting commands or tool calls
16
-
17
- ### When to add a new entry
18
-
19
- Add a lesson when **any** of these occur:
20
- - A command, tool call, or API call fails and you had to retry with a different approach
21
- - You discover a parameter, syntax, or configuration quirk not documented elsewhere
22
- - A workaround is needed for a third-party tool, MCP server, or platform limitation
23
- - An approach that seems obvious turns out to be wrong
24
-
25
- ### Entry format
1
+ <!-- Generated by OpenCastle from the files in lessons/. Add a lesson with "opencastle lesson"; this index is rewritten by every sync. -->
26
2
 
27
- ```markdown
28
- ### LES-XXX: Short descriptive title
29
-
30
- | Field | Value |
31
- |-------|-------|
32
- | **Category** | `task-management` / `mcp-tools` / `codebase-tool` / `terminal` / `framework` / `cms` / `database` / `git` / `deployment` / `browser-testing` / `general` |
33
- | **Added** | YYYY-MM-DD |
34
- | **Severity** | `high` (blocks work) / `medium` (wastes 5+ min) / `low` (minor annoyance) |
35
-
36
- **Problem:** What went wrong and what error or unexpected behavior was observed.
37
-
38
- **Wrong approach:** The obvious/intuitive approach that fails.
39
-
40
- **Correct approach:** The working solution.
41
-
42
- **Why:** Root cause explanation (if known).
43
- ```
44
-
45
- ---
46
-
47
- ## Lessons
48
-
49
- <!-- Lessons are appended here by agents during sessions.
50
- Start numbering from LES-001. -->
51
-
52
- ---
3
+ # Lessons Learned
53
4
 
54
- ## Index by Category
5
+ What agents on this project learned the hard way: a command that failed, a
6
+ tool quirk, a convention written down nowhere else. **Read this before you
7
+ start work**, then open the lessons that match your task.
55
8
 
56
- | Category | Lessons |
57
- |----------|---------|
58
- | `task-management` | — |
59
- | `mcp-tools` | — |
60
- | `codebase-tool` | — |
61
- | `terminal` | — |
62
- | `framework` | — |
63
- | `cms` | — |
64
- | `database` | — |
65
- | `git` | — |
66
- | `deployment` | — |
67
- | `browser-testing` | — |
68
- | `general` | — |
9
+ Each lesson is a file in [`lessons/`](lessons/). Add one with
10
+ `opencastle lesson --title ... --category ... --severity ... --problem ...`
11
+ (and `--cite <path>` for the code it is about). Do not edit this index:
12
+ it is rewritten from those files by every `opencastle sync`.
69
13
 
70
- ````
14
+ No lessons yet.
@@ -13,7 +13,8 @@ Skills reference these files by root-relative path, like `.opencastle/stack/api-
13
13
  | File | Purpose |
14
14
  |------|---------|
15
15
  | `project.instructions.md` | High-level project context — apps, libraries, tech stack, ports, URLs |
16
- | `LESSONS-LEARNED.md` | Knowledge base of retries, workarounds, and gotchas — read before every session |
16
+ | `LESSONS-LEARNED.md` | Index of the lessons in `lessons/` — read before every session. Rewritten by `opencastle sync`; never edited by hand |
17
+ | `lessons/` | One file per lesson: retries, workarounds and gotchas, written by `opencastle lesson` |
17
18
  | `KNOWN-ISSUES.md` | Tracked issues, limitations, and accepted risks discovered during sessions |
18
19
  | `AGENT-FAILURES.md` | Dead letter queue for failed agent delegations |
19
20
  | `AGENT-PERFORMANCE.md` | Agent success tracking, log query recipes, performance metrics |
@@ -85,7 +85,7 @@ Run `opencastle log --help` for full options.
85
85
  | `duration_min` | `number` | No | Estimated session duration in minutes |
86
86
  | `files_changed` | `number` | No | Number of files created/modified |
87
87
  | `retries` | `number` | No | Number of retried operations |
88
- | `lessons_added` | `string[]` | No | Lesson IDs added (e.g., `["LES-015"]`) |
88
+ | `lessons_added` | `string[]` | No | Lesson ids added (e.g., `["2026-10-02-quote-shell-variables"]`) |
89
89
  | `discoveries` | `string[]` | No | Issues discovered (issue IDs or KNOWN-ISSUES IDs) |
90
90
 
91
91
  ## Delegation Record (`type: "delegation"`)
@@ -0,0 +1,34 @@
1
+ import { describe, it, expect } from 'vitest'
2
+ import { existsSync, readFileSync } from 'node:fs'
3
+ import { join } from 'node:path'
4
+ import { PLUGINS } from './index.js'
5
+ import { readAgentPlugin } from '../../cli/agent-plugin.js'
6
+ import { packFiles } from '../../cli/pack-plugins.js'
7
+
8
+ /**
9
+ * Every integration is an Agent Plugin 1.0 directory: plugin.json, its skill in
10
+ * skills/<name>/SKILL.md, and mcp.json when its server can be written portably.
11
+ * Checked the way a conformant client loads one, and held to config.ts, which
12
+ * the files are compiled from.
13
+ */
14
+ const root = import.meta.dirname
15
+
16
+ describe.each(Object.values(PLUGINS).map((p) => [p.id, p] as const))('%s', (id, plugin) => {
17
+ const dir = join(root, id)
18
+
19
+ it('is a conformant Agent Plugin, with its skill and server', () => {
20
+ const report = readAgentPlugin(dir)
21
+ expect(report.errors).toEqual([])
22
+ expect(report.warnings).toEqual([])
23
+ expect(report.skills).toEqual(plugin.skillName ? [plugin.skillName] : [])
24
+ const portable = packFiles(plugin)['mcp.json'] !== undefined
25
+ expect(Object.keys(report.servers)).toEqual(portable ? [plugin.mcpServerKey] : [])
26
+ })
27
+
28
+ it('matches its config.ts — run npm run plugins:build if not', () => {
29
+ for (const [rel, text] of Object.entries(packFiles(plugin))) {
30
+ expect(readFileSync(join(dir, rel), 'utf8'), `${id}/${rel}`).toBe(text)
31
+ }
32
+ if (!packFiles(plugin)['mcp.json']) expect(existsSync(join(dir, 'mcp.json'))).toBe(false)
33
+ })
34
+ })
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
3
+ "mcpServers": {
4
+ "Astro docs": {
5
+ "type": "streamable-http",
6
+ "url": "https://mcp.docs.astro.build/mcp"
7
+ }
8
+ }
9
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
+ "name": "astro",
4
+ "description": "Astro skill and MCP server for AI coding assistants: Content-driven web framework with islands architecture and Docs MCP.",
5
+ "homepage": "https://www.opencastle.dev/docs/plugins#astro",
6
+ "repository": "https://github.com/monkilabs/opencastle",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "tech",
10
+ "framework"
11
+ ],
12
+ "extensions": {
13
+ "dev.opencastle": {
14
+ "label": "Astro",
15
+ "category": "tech",
16
+ "subCategory": "framework",
17
+ "authType": "none",
18
+ "officialDocs": "https://docs.astro.build"
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
3
+ "mcpServers": {
4
+ "chrome-devtools": {
5
+ "type": "stdio",
6
+ "command": "npx",
7
+ "args": [
8
+ "-y",
9
+ "chrome-devtools-mcp@1.10.1"
10
+ ]
11
+ }
12
+ }
13
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
3
+ "name": "chrome-devtools",
4
+ "description": "Chrome DevTools skill and MCP server for AI coding assistants: Browser testing, screenshots, DOM inspection.",
5
+ "homepage": "https://www.opencastle.dev/docs/plugins#chrome-devtools",
6
+ "repository": "https://github.com/monkilabs/opencastle",
7
+ "license": "MIT",
8
+ "keywords": [
9
+ "tech",
10
+ "e2e-testing"
11
+ ],
12
+ "extensions": {
13
+ "dev.opencastle": {
14
+ "label": "Chrome DevTools",
15
+ "category": "tech",
16
+ "subCategory": "e2e-testing",
17
+ "authType": "none",
18
+ "officialDocs": "https://developer.chrome.com/docs/devtools"
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "$schema": "https://agent-plugins.org/schemas/1.0.0/mcp.schema.json",
3
+ "mcpServers": {
4
+ "Cloudflare": {
5
+ "type": "streamable-http",
6
+ "url": "https://mcp.cloudflare.com/mcp"
7
+ }
8
+ }
9
+ }