@codemieai/code 0.0.33 → 0.0.35

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 (294) hide show
  1. package/README.md +78 -7
  2. package/bin/codemie-claude-acp.js +21 -0
  3. package/bin/codemie-opencode.js +11 -0
  4. package/bin/codemie.js +13 -0
  5. package/dist/agents/codemie-code/agent.d.ts +38 -4
  6. package/dist/agents/codemie-code/agent.d.ts.map +1 -1
  7. package/dist/agents/codemie-code/agent.js +333 -178
  8. package/dist/agents/codemie-code/agent.js.map +1 -1
  9. package/dist/agents/codemie-code/index.d.ts +2 -1
  10. package/dist/agents/codemie-code/index.d.ts.map +1 -1
  11. package/dist/agents/codemie-code/index.js +36 -7
  12. package/dist/agents/codemie-code/index.js.map +1 -1
  13. package/dist/agents/codemie-code/prompts.d.ts +12 -5
  14. package/dist/agents/codemie-code/prompts.d.ts.map +1 -1
  15. package/dist/agents/codemie-code/prompts.js +53 -6
  16. package/dist/agents/codemie-code/prompts.js.map +1 -1
  17. package/dist/agents/codemie-code/toolMetadata.d.ts.map +1 -1
  18. package/dist/agents/codemie-code/toolMetadata.js +9 -8
  19. package/dist/agents/codemie-code/toolMetadata.js.map +1 -1
  20. package/dist/agents/codemie-code/tools/assistant-invocation.d.ts +47 -0
  21. package/dist/agents/codemie-code/tools/assistant-invocation.d.ts.map +1 -0
  22. package/dist/agents/codemie-code/tools/assistant-invocation.js +129 -0
  23. package/dist/agents/codemie-code/tools/assistant-invocation.js.map +1 -0
  24. package/dist/agents/codemie-code/tools/index.d.ts +70 -4
  25. package/dist/agents/codemie-code/tools/index.d.ts.map +1 -1
  26. package/dist/agents/codemie-code/tools/index.js +57 -44
  27. package/dist/agents/codemie-code/tools/index.js.map +1 -1
  28. package/dist/agents/codemie-code/tools/planning.d.ts +6 -5
  29. package/dist/agents/codemie-code/tools/planning.d.ts.map +1 -1
  30. package/dist/agents/codemie-code/tools/planning.js +12 -10
  31. package/dist/agents/codemie-code/tools/planning.js.map +1 -1
  32. package/dist/agents/codemie-code/types.d.ts +27 -3
  33. package/dist/agents/codemie-code/types.d.ts.map +1 -1
  34. package/dist/agents/codemie-code/types.js +24 -0
  35. package/dist/agents/codemie-code/types.js.map +1 -1
  36. package/dist/agents/codemie-code/ui/autocomplete.d.ts +98 -0
  37. package/dist/agents/codemie-code/ui/autocomplete.d.ts.map +1 -0
  38. package/dist/agents/codemie-code/ui/autocomplete.js +145 -0
  39. package/dist/agents/codemie-code/ui/autocomplete.js.map +1 -0
  40. package/dist/agents/codemie-code/ui/keyHandlers.d.ts +112 -0
  41. package/dist/agents/codemie-code/ui/keyHandlers.d.ts.map +1 -0
  42. package/dist/agents/codemie-code/ui/keyHandlers.js +415 -0
  43. package/dist/agents/codemie-code/ui/keyHandlers.js.map +1 -0
  44. package/dist/agents/codemie-code/ui/mentions.d.ts +86 -0
  45. package/dist/agents/codemie-code/ui/mentions.d.ts.map +1 -0
  46. package/dist/agents/codemie-code/ui/mentions.js +122 -0
  47. package/dist/agents/codemie-code/ui/mentions.js.map +1 -0
  48. package/dist/agents/codemie-code/ui/terminalCodes.d.ts +38 -0
  49. package/dist/agents/codemie-code/ui/terminalCodes.d.ts.map +1 -0
  50. package/dist/agents/codemie-code/ui/terminalCodes.js +42 -0
  51. package/dist/agents/codemie-code/ui/terminalCodes.js.map +1 -0
  52. package/dist/agents/codemie-code/ui/todoPanel.d.ts.map +1 -1
  53. package/dist/agents/codemie-code/ui/todoPanel.js +3 -4
  54. package/dist/agents/codemie-code/ui/todoPanel.js.map +1 -1
  55. package/dist/agents/codemie-code/ui.d.ts +8 -7
  56. package/dist/agents/codemie-code/ui.d.ts.map +1 -1
  57. package/dist/agents/codemie-code/ui.js +87 -145
  58. package/dist/agents/codemie-code/ui.js.map +1 -1
  59. package/dist/agents/core/AgentCLI.d.ts +5 -0
  60. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  61. package/dist/agents/core/AgentCLI.js +25 -1
  62. package/dist/agents/core/AgentCLI.js.map +1 -1
  63. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  64. package/dist/agents/core/BaseAgentAdapter.js +90 -27
  65. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  66. package/dist/agents/core/extension/BaseExtensionInstaller.d.ts +7 -1
  67. package/dist/agents/core/extension/BaseExtensionInstaller.d.ts.map +1 -1
  68. package/dist/agents/core/extension/BaseExtensionInstaller.js +58 -15
  69. package/dist/agents/core/extension/BaseExtensionInstaller.js.map +1 -1
  70. package/dist/agents/core/session/BaseSessionAdapter.d.ts +25 -0
  71. package/dist/agents/core/session/BaseSessionAdapter.d.ts.map +1 -1
  72. package/dist/agents/core/session/discovery-types.d.ts +53 -0
  73. package/dist/agents/core/session/discovery-types.d.ts.map +1 -0
  74. package/dist/agents/core/session/discovery-types.js +8 -0
  75. package/dist/agents/core/session/discovery-types.js.map +1 -0
  76. package/dist/agents/core/types.d.ts +62 -0
  77. package/dist/agents/core/types.d.ts.map +1 -1
  78. package/dist/agents/plugins/claude/claude-acp.plugin.d.ts +27 -0
  79. package/dist/agents/plugins/claude/claude-acp.plugin.d.ts.map +1 -0
  80. package/dist/agents/plugins/claude/claude-acp.plugin.js +63 -0
  81. package/dist/agents/plugins/claude/claude-acp.plugin.js.map +1 -0
  82. package/dist/agents/plugins/claude/claude-message-types.d.ts +1 -0
  83. package/dist/agents/plugins/claude/claude-message-types.d.ts.map +1 -1
  84. package/dist/agents/plugins/claude/claude.plugin.d.ts +44 -1
  85. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  86. package/dist/agents/plugins/claude/claude.plugin.js +263 -12
  87. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  88. package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
  89. package/dist/agents/plugins/claude/claude.session.js +14 -7
  90. package/dist/agents/plugins/claude/claude.session.js.map +1 -1
  91. package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
  92. package/dist/agents/plugins/claude/plugin/README.md +40 -2
  93. package/dist/agents/plugins/claude/plugin/claude-templates/README.md +5 -5
  94. package/dist/agents/plugins/claude/plugin/claude-templates/templates/CLAUDE.md.template +177 -436
  95. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/code-review-agent-template.md.template +49 -82
  96. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/refactor-cleaner-agent.md.template +337 -0
  97. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/solution-architect-agent.md.template +129 -419
  98. package/dist/agents/plugins/claude/plugin/claude-templates/templates/agents/unit-tester-agent.md.template +146 -693
  99. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/api/api-patterns.md.template +110 -138
  100. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/architecture.md.template +197 -0
  101. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/data/database-patterns.md.template +171 -91
  102. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/development/development-practices.md.template +219 -131
  103. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/security/security-practices.md.template +223 -98
  104. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/standards/code-quality.md.template +131 -95
  105. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/testing/testing-patterns.md.template +247 -75
  106. package/dist/agents/plugins/claude/plugin/commands/README.md +133 -0
  107. package/dist/agents/plugins/claude/plugin/commands/codemie-init.md +336 -544
  108. package/dist/agents/plugins/claude/plugin/commands/codemie-subagents.md +233 -504
  109. package/dist/agents/plugins/claude/plugin/commands/memory-add.md +311 -30
  110. package/dist/agents/plugins/claude/plugin/commands/memory-refresh.md +218 -39
  111. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts.map +1 -1
  112. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js +43 -8
  113. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js.map +1 -1
  114. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.d.ts.map +1 -1
  115. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js +68 -40
  116. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js.map +1 -1
  117. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  118. package/dist/agents/plugins/gemini/gemini.plugin.js +0 -3
  119. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  120. package/dist/agents/plugins/opencode/index.d.ts +8 -0
  121. package/dist/agents/plugins/opencode/index.d.ts.map +1 -0
  122. package/dist/agents/plugins/opencode/index.js +12 -0
  123. package/dist/agents/plugins/opencode/index.js.map +1 -0
  124. package/dist/agents/plugins/opencode/opencode-message-types.d.ts +207 -0
  125. package/dist/agents/plugins/opencode/opencode-message-types.d.ts.map +1 -0
  126. package/dist/agents/plugins/opencode/opencode-message-types.js +59 -0
  127. package/dist/agents/plugins/opencode/opencode-message-types.js.map +1 -0
  128. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts +65 -0
  129. package/dist/agents/plugins/opencode/opencode-model-configs.d.ts.map +1 -0
  130. package/dist/agents/plugins/opencode/opencode-model-configs.js +184 -0
  131. package/dist/agents/plugins/opencode/opencode-model-configs.js.map +1 -0
  132. package/dist/agents/plugins/opencode/opencode.paths.d.ts +62 -0
  133. package/dist/agents/plugins/opencode/opencode.paths.d.ts.map +1 -0
  134. package/dist/agents/plugins/opencode/opencode.paths.js +148 -0
  135. package/dist/agents/plugins/opencode/opencode.paths.js.map +1 -0
  136. package/dist/agents/plugins/opencode/opencode.plugin.d.ts +35 -0
  137. package/dist/agents/plugins/opencode/opencode.plugin.d.ts.map +1 -0
  138. package/dist/agents/plugins/opencode/opencode.plugin.js +338 -0
  139. package/dist/agents/plugins/opencode/opencode.plugin.js.map +1 -0
  140. package/dist/agents/plugins/opencode/opencode.session.d.ts +77 -0
  141. package/dist/agents/plugins/opencode/opencode.session.d.ts.map +1 -0
  142. package/dist/agents/plugins/opencode/opencode.session.js +424 -0
  143. package/dist/agents/plugins/opencode/opencode.session.js.map +1 -0
  144. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts +25 -0
  145. package/dist/agents/plugins/opencode/opencode.storage-utils.d.ts.map +1 -0
  146. package/dist/agents/plugins/opencode/opencode.storage-utils.js +96 -0
  147. package/dist/agents/plugins/opencode/opencode.storage-utils.js.map +1 -0
  148. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts +30 -0
  149. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.d.ts.map +1 -0
  150. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js +116 -0
  151. package/dist/agents/plugins/opencode/session/processors/opencode.conversations-processor.js.map +1 -0
  152. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts +102 -0
  153. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.d.ts.map +1 -0
  154. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js +584 -0
  155. package/dist/agents/plugins/opencode/session/processors/opencode.metrics-processor.js.map +1 -0
  156. package/dist/agents/registry.d.ts +1 -1
  157. package/dist/agents/registry.d.ts.map +1 -1
  158. package/dist/agents/registry.js +5 -1
  159. package/dist/agents/registry.js.map +1 -1
  160. package/dist/cli/commands/assistants/chat.d.ts +11 -0
  161. package/dist/cli/commands/assistants/chat.d.ts.map +1 -0
  162. package/dist/cli/commands/assistants/chat.js +201 -0
  163. package/dist/cli/commands/assistants/chat.js.map +1 -0
  164. package/dist/cli/commands/assistants/constants.d.ts +81 -0
  165. package/dist/cli/commands/assistants/constants.d.ts.map +1 -0
  166. package/dist/cli/commands/assistants/constants.js +75 -0
  167. package/dist/cli/commands/assistants/constants.js.map +1 -0
  168. package/dist/cli/commands/assistants/generators/claude-agent-generator.d.ts +26 -0
  169. package/dist/cli/commands/assistants/generators/claude-agent-generator.d.ts.map +1 -0
  170. package/dist/cli/commands/assistants/generators/claude-agent-generator.js +115 -0
  171. package/dist/cli/commands/assistants/generators/claude-agent-generator.js.map +1 -0
  172. package/dist/cli/commands/assistants/index.d.ts +11 -0
  173. package/dist/cli/commands/assistants/index.d.ts.map +1 -0
  174. package/dist/cli/commands/assistants/index.js +28 -0
  175. package/dist/cli/commands/assistants/index.js.map +1 -0
  176. package/dist/cli/commands/assistants/list.d.ts +11 -0
  177. package/dist/cli/commands/assistants/list.d.ts.map +1 -0
  178. package/dist/cli/commands/assistants/list.js +323 -0
  179. package/dist/cli/commands/assistants/list.js.map +1 -0
  180. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts +5 -0
  181. package/dist/cli/commands/doctor/checks/AgentsCheck.d.ts.map +1 -1
  182. package/dist/cli/commands/doctor/checks/AgentsCheck.js +29 -0
  183. package/dist/cli/commands/doctor/checks/AgentsCheck.js.map +1 -1
  184. package/dist/cli/commands/install.d.ts.map +1 -1
  185. package/dist/cli/commands/install.js +104 -13
  186. package/dist/cli/commands/install.js.map +1 -1
  187. package/dist/cli/commands/opencode-metrics.d.ts +13 -0
  188. package/dist/cli/commands/opencode-metrics.d.ts.map +1 -0
  189. package/dist/cli/commands/opencode-metrics.js +200 -0
  190. package/dist/cli/commands/opencode-metrics.js.map +1 -0
  191. package/dist/cli/commands/self-update.d.ts +3 -0
  192. package/dist/cli/commands/self-update.d.ts.map +1 -0
  193. package/dist/cli/commands/self-update.js +55 -0
  194. package/dist/cli/commands/self-update.js.map +1 -0
  195. package/dist/cli/commands/setup.d.ts.map +1 -1
  196. package/dist/cli/commands/setup.js +113 -0
  197. package/dist/cli/commands/setup.js.map +1 -1
  198. package/dist/cli/commands/skill.d.ts +6 -0
  199. package/dist/cli/commands/skill.d.ts.map +1 -0
  200. package/dist/cli/commands/skill.js +196 -0
  201. package/dist/cli/commands/skill.js.map +1 -0
  202. package/dist/cli/commands/update.d.ts.map +1 -1
  203. package/dist/cli/commands/update.js +34 -6
  204. package/dist/cli/commands/update.js.map +1 -1
  205. package/dist/cli/index.d.ts.map +1 -1
  206. package/dist/cli/index.js +12 -4
  207. package/dist/cli/index.js.map +1 -1
  208. package/dist/env/types.d.ts +13 -0
  209. package/dist/env/types.d.ts.map +1 -1
  210. package/dist/env/types.js +1 -1
  211. package/dist/env/types.js.map +1 -1
  212. package/dist/migrations/003-remove-hooks-node.migration.d.ts +22 -0
  213. package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -0
  214. package/dist/migrations/003-remove-hooks-node.migration.js +103 -0
  215. package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -0
  216. package/dist/migrations/index.d.ts +1 -0
  217. package/dist/migrations/index.d.ts.map +1 -1
  218. package/dist/migrations/index.js +1 -1
  219. package/dist/migrations/index.js.map +1 -1
  220. package/dist/providers/plugins/sso/sso.http-client.js +2 -2
  221. package/dist/providers/plugins/sso/sso.http-client.js.map +1 -1
  222. package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
  223. package/dist/providers/plugins/sso/sso.setup-steps.js +14 -10
  224. package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
  225. package/dist/skills/core/SkillDiscovery.d.ts +83 -0
  226. package/dist/skills/core/SkillDiscovery.d.ts.map +1 -0
  227. package/dist/skills/core/SkillDiscovery.js +237 -0
  228. package/dist/skills/core/SkillDiscovery.js.map +1 -0
  229. package/dist/skills/core/SkillManager.d.ts +86 -0
  230. package/dist/skills/core/SkillManager.d.ts.map +1 -0
  231. package/dist/skills/core/SkillManager.js +155 -0
  232. package/dist/skills/core/SkillManager.js.map +1 -0
  233. package/dist/skills/core/types.d.ts +120 -0
  234. package/dist/skills/core/types.d.ts.map +1 -0
  235. package/dist/skills/core/types.js +20 -0
  236. package/dist/skills/core/types.js.map +1 -0
  237. package/dist/skills/index.d.ts +12 -0
  238. package/dist/skills/index.d.ts.map +1 -0
  239. package/dist/skills/index.js +12 -0
  240. package/dist/skills/index.js.map +1 -0
  241. package/dist/skills/utils/content-loader.d.ts +25 -0
  242. package/dist/skills/utils/content-loader.d.ts.map +1 -0
  243. package/dist/skills/utils/content-loader.js +161 -0
  244. package/dist/skills/utils/content-loader.js.map +1 -0
  245. package/dist/skills/utils/frontmatter.d.ts +60 -0
  246. package/dist/skills/utils/frontmatter.d.ts.map +1 -0
  247. package/dist/skills/utils/frontmatter.js +114 -0
  248. package/dist/skills/utils/frontmatter.js.map +1 -0
  249. package/dist/skills/utils/pattern-matcher.d.ts +60 -0
  250. package/dist/skills/utils/pattern-matcher.d.ts.map +1 -0
  251. package/dist/skills/utils/pattern-matcher.js +97 -0
  252. package/dist/skills/utils/pattern-matcher.js.map +1 -0
  253. package/dist/utils/auth.d.ts +22 -0
  254. package/dist/utils/auth.d.ts.map +1 -0
  255. package/dist/utils/auth.js +50 -0
  256. package/dist/utils/auth.js.map +1 -0
  257. package/dist/utils/cli-updater.d.ts +70 -0
  258. package/dist/utils/cli-updater.d.ts.map +1 -0
  259. package/dist/utils/cli-updater.js +339 -0
  260. package/dist/utils/cli-updater.js.map +1 -0
  261. package/dist/utils/config.d.ts +6 -1
  262. package/dist/utils/config.d.ts.map +1 -1
  263. package/dist/utils/config.js +13 -0
  264. package/dist/utils/config.js.map +1 -1
  265. package/dist/utils/installation-detector.d.ts +22 -0
  266. package/dist/utils/installation-detector.d.ts.map +1 -0
  267. package/dist/utils/installation-detector.js +49 -0
  268. package/dist/utils/installation-detector.js.map +1 -0
  269. package/dist/utils/native-installer.d.ts +49 -0
  270. package/dist/utils/native-installer.d.ts.map +1 -0
  271. package/dist/utils/native-installer.js +225 -0
  272. package/dist/utils/native-installer.js.map +1 -0
  273. package/dist/utils/processes.js +1 -1
  274. package/dist/utils/profile.d.ts +2 -0
  275. package/dist/utils/profile.d.ts.map +1 -1
  276. package/dist/utils/profile.js +5 -0
  277. package/dist/utils/profile.js.map +1 -1
  278. package/dist/utils/sdk-client.d.ts +15 -0
  279. package/dist/utils/sdk-client.d.ts.map +1 -0
  280. package/dist/utils/sdk-client.js +92 -0
  281. package/dist/utils/sdk-client.js.map +1 -0
  282. package/dist/utils/version-utils.d.ts +50 -0
  283. package/dist/utils/version-utils.d.ts.map +1 -0
  284. package/dist/utils/version-utils.js +92 -0
  285. package/dist/utils/version-utils.js.map +1 -0
  286. package/package.json +11 -3
  287. package/scripts/copy-mr-skill-to-global.ts +252 -0
  288. package/scripts/demo-hooks.sh +125 -0
  289. package/scripts/test-hooks.sh +196 -0
  290. package/dist/agents/plugins/claude/plugin/claude-templates/templates/INDEX.md +0 -205
  291. package/dist/agents/plugins/claude/plugin/claude-templates/templates/TEMPLATE_SIZES.md +0 -74
  292. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/layered-architecture.md.template +0 -143
  293. package/dist/agents/plugins/claude/plugin/claude-templates/templates/guides/architecture/project-structure.md.template +0 -127
  294. package/dist/agents/plugins/claude/plugin/commands/codemie-pr.md +0 -25
@@ -0,0 +1,114 @@
1
+ import { parse as parseYaml } from 'yaml';
2
+ /**
3
+ * Error thrown when frontmatter parsing fails
4
+ */
5
+ export class FrontmatterParseError extends Error {
6
+ filePath;
7
+ cause;
8
+ constructor(message, filePath, cause) {
9
+ super(message);
10
+ this.filePath = filePath;
11
+ this.cause = cause;
12
+ this.name = 'FrontmatterParseError';
13
+ }
14
+ }
15
+ /**
16
+ * Parse YAML frontmatter from a markdown file
17
+ *
18
+ * Expected format:
19
+ * ```
20
+ * ---
21
+ * key: value
22
+ * ---
23
+ * Content here
24
+ * ```
25
+ *
26
+ * @param fileContent - Raw file content
27
+ * @param filePath - Optional file path (for error messages)
28
+ * @returns Parsed frontmatter metadata and markdown content
29
+ * @throws FrontmatterParseError if parsing fails
30
+ */
31
+ export function parseFrontmatter(fileContent, filePath) {
32
+ // Trim leading/trailing whitespace
33
+ const trimmed = fileContent.trim();
34
+ // Check if file starts with frontmatter delimiter
35
+ if (!trimmed.startsWith('---')) {
36
+ throw new FrontmatterParseError('File must start with frontmatter delimiter (---)', filePath);
37
+ }
38
+ // Find the closing delimiter
39
+ const lines = trimmed.split('\n');
40
+ let closingDelimiterIndex = -1;
41
+ // Start from line 1 (skip opening ---)
42
+ for (let i = 1; i < lines.length; i++) {
43
+ if (lines[i].trim() === '---') {
44
+ closingDelimiterIndex = i;
45
+ break;
46
+ }
47
+ }
48
+ if (closingDelimiterIndex === -1) {
49
+ throw new FrontmatterParseError('Missing closing frontmatter delimiter (---)', filePath);
50
+ }
51
+ // Extract YAML content (between delimiters)
52
+ const yamlLines = lines.slice(1, closingDelimiterIndex);
53
+ const yamlContent = yamlLines.join('\n');
54
+ // Extract markdown content (after closing delimiter)
55
+ const contentLines = lines.slice(closingDelimiterIndex + 1);
56
+ const content = contentLines.join('\n').trim();
57
+ // Parse YAML
58
+ let metadata;
59
+ try {
60
+ const parsed = parseYaml(yamlContent);
61
+ // Ensure we got an object
62
+ if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) {
63
+ throw new Error('Frontmatter must be a YAML object (key-value pairs)');
64
+ }
65
+ metadata = parsed;
66
+ }
67
+ catch (error) {
68
+ throw new FrontmatterParseError(`Failed to parse YAML frontmatter: ${error instanceof Error ? error.message : String(error)}`, filePath, error);
69
+ }
70
+ return {
71
+ metadata,
72
+ content,
73
+ };
74
+ }
75
+ /**
76
+ * Check if a file has valid frontmatter format (non-throwing)
77
+ *
78
+ * @param fileContent - Raw file content
79
+ * @returns true if file has valid frontmatter structure
80
+ */
81
+ export function hasFrontmatter(fileContent) {
82
+ try {
83
+ parseFrontmatter(fileContent);
84
+ return true;
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
90
+ /**
91
+ * Extract just the metadata without validating content
92
+ *
93
+ * @param fileContent - Raw file content
94
+ * @param filePath - Optional file path (for error messages)
95
+ * @returns Parsed metadata
96
+ * @throws FrontmatterParseError if parsing fails
97
+ */
98
+ export function extractMetadata(fileContent, filePath) {
99
+ const result = parseFrontmatter(fileContent, filePath);
100
+ return result.metadata;
101
+ }
102
+ /**
103
+ * Extract just the content without validating metadata
104
+ *
105
+ * @param fileContent - Raw file content
106
+ * @param filePath - Optional file path (for error messages)
107
+ * @returns Markdown content
108
+ * @throws FrontmatterParseError if parsing fails
109
+ */
110
+ export function extractContent(fileContent, filePath) {
111
+ const result = parseFrontmatter(fileContent, filePath);
112
+ return result.content;
113
+ }
114
+ //# sourceMappingURL=frontmatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.js","sourceRoot":"","sources":["../../../src/skills/utils/frontmatter.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Pattern matcher for skill invocation detection
3
+ *
4
+ * Detects /skill-name patterns in user messages and extracts skill names.
5
+ * Excludes URLs and built-in CLI commands.
6
+ */
7
+ /**
8
+ * Skill pattern detected in a message
9
+ */
10
+ export interface SkillPattern {
11
+ /** Skill name (e.g., 'mr', 'commit') */
12
+ name: string;
13
+ /** Position in message where pattern starts */
14
+ position: number;
15
+ /** Optional arguments after skill name */
16
+ args?: string;
17
+ /** Full matched pattern (e.g., '/mr', '/commit -m "fix"') */
18
+ raw: string;
19
+ }
20
+ /**
21
+ * Result of pattern matching
22
+ */
23
+ export interface PatternMatchResult {
24
+ /** Detected skill patterns */
25
+ patterns: SkillPattern[];
26
+ /** Original message */
27
+ originalMessage: string;
28
+ /** Whether any patterns were found */
29
+ hasPatterns: boolean;
30
+ }
31
+ /**
32
+ * Extract skill patterns from a user message
33
+ *
34
+ * @param message - User message to scan
35
+ * @returns Pattern match result with detected skills
36
+ *
37
+ * @example
38
+ * ```typescript
39
+ * const result = extractSkillPatterns('/mr');
40
+ * // result.patterns = [{ name: 'mr', position: 0, raw: '/mr' }]
41
+ *
42
+ * const result2 = extractSkillPatterns('ensure you can /commit this');
43
+ * // result2.patterns = [{ name: 'commit', position: 15, args: 'this', raw: '/commit this' }]
44
+ * ```
45
+ */
46
+ export declare function extractSkillPatterns(message: string): PatternMatchResult;
47
+ /**
48
+ * Validate a skill name
49
+ *
50
+ * @param name - Skill name to validate
51
+ * @returns True if valid, false otherwise
52
+ *
53
+ * Rules:
54
+ * - Lowercase letters only
55
+ * - Can include digits and hyphens
56
+ * - Must start with a letter
57
+ * - 1-50 characters
58
+ */
59
+ export declare function isValidSkillName(name: string): boolean;
60
+ //# sourceMappingURL=pattern-matcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern-matcher.d.ts","sourceRoot":"","sources":["../../../src/skills/utils/pattern-matcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,+CAA+C;IAC/C,QAAQ,EAAE,MAAM,CAAC;IACjB,0CAA0C;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,6DAA6D;IAC7D,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,uBAAuB;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,WAAW,EAAE,OAAO,CAAC;CACtB;AAyBD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,kBAAkB,CA8CxE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Pattern matcher for skill invocation detection
3
+ *
4
+ * Detects /skill-name patterns in user messages and extracts skill names.
5
+ * Excludes URLs and built-in CLI commands.
6
+ */
7
+ /**
8
+ * Built-in CLI commands that should NOT be treated as skills
9
+ */
10
+ const BUILT_IN_COMMANDS = new Set([
11
+ 'help',
12
+ 'clear',
13
+ 'exit',
14
+ 'quit',
15
+ 'stats',
16
+ 'todos',
17
+ 'config',
18
+ 'health',
19
+ ]);
20
+ /**
21
+ * Regex pattern for skill invocation
22
+ *
23
+ * Matches: /skill-name with optional arguments
24
+ * Excludes: URLs (negative lookbehind for : or alphanumeric before /)
25
+ * Format: /[a-z][a-z0-9-]{0,49} (lowercase, alphanumeric + hyphens, 1-50 chars)
26
+ */
27
+ const SKILL_PATTERN = /(?<![:\w])\/([a-z][a-z0-9-]{0,49})(?:\s+([^\n/]+))?/g;
28
+ /**
29
+ * Extract skill patterns from a user message
30
+ *
31
+ * @param message - User message to scan
32
+ * @returns Pattern match result with detected skills
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * const result = extractSkillPatterns('/mr');
37
+ * // result.patterns = [{ name: 'mr', position: 0, raw: '/mr' }]
38
+ *
39
+ * const result2 = extractSkillPatterns('ensure you can /commit this');
40
+ * // result2.patterns = [{ name: 'commit', position: 15, args: 'this', raw: '/commit this' }]
41
+ * ```
42
+ */
43
+ export function extractSkillPatterns(message) {
44
+ const patterns = [];
45
+ const seenNames = new Set();
46
+ // Reset regex state
47
+ SKILL_PATTERN.lastIndex = 0;
48
+ let match;
49
+ while ((match = SKILL_PATTERN.exec(message)) !== null) {
50
+ const [fullMatch, skillName, args] = match;
51
+ const position = match.index;
52
+ // Skip if this is part of a URL
53
+ // Check if there's http:// or https:// within the last 100 chars before this position
54
+ const lookback = Math.min(100, position);
55
+ const beforeMatch = message.slice(position - lookback, position);
56
+ // If we find a protocol and no whitespace between it and this slash, it's part of a URL
57
+ if (/https?:\/\/[^\s]*$/.test(beforeMatch)) {
58
+ continue;
59
+ }
60
+ // Skip built-in commands
61
+ if (BUILT_IN_COMMANDS.has(skillName)) {
62
+ continue;
63
+ }
64
+ // Deduplicate by skill name (keep first occurrence)
65
+ if (seenNames.has(skillName)) {
66
+ continue;
67
+ }
68
+ seenNames.add(skillName);
69
+ patterns.push({
70
+ name: skillName,
71
+ position,
72
+ args: args?.trim(),
73
+ raw: fullMatch,
74
+ });
75
+ }
76
+ return {
77
+ patterns,
78
+ originalMessage: message,
79
+ hasPatterns: patterns.length > 0,
80
+ };
81
+ }
82
+ /**
83
+ * Validate a skill name
84
+ *
85
+ * @param name - Skill name to validate
86
+ * @returns True if valid, false otherwise
87
+ *
88
+ * Rules:
89
+ * - Lowercase letters only
90
+ * - Can include digits and hyphens
91
+ * - Must start with a letter
92
+ * - 1-50 characters
93
+ */
94
+ export function isValidSkillName(name) {
95
+ return /^[a-z][a-z0-9-]{0,49}$/.test(name);
96
+ }
97
+ //# sourceMappingURL=pattern-matcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pattern-matcher.js","sourceRoot":"","sources":["../../../src/skills/utils/pattern-matcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AA4BH;;GAEG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAChC,MAAM;IACN,OAAO;IACP,MAAM;IACN,MAAM;IACN,OAAO;IACP,OAAO;IACP,QAAQ;IACR,QAAQ;CACT,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,sDAAsD,CAAC;AAE7E;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;IAEpC,oBAAoB;IACpB,aAAa,CAAC,SAAS,GAAG,CAAC,CAAC;IAE5B,IAAI,KAA6B,CAAC;IAClC,OAAO,CAAC,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACtD,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,KAAK,CAAC;QAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC;QAE7B,gCAAgC;QAChC,sFAAsF;QACtF,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QACzC,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEjE,wFAAwF;QACxF,IAAI,oBAAoB,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC;YAC3C,SAAS;QACX,CAAC;QAED,yBAAyB;QACzB,IAAI,iBAAiB,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YACrC,SAAS;QACX,CAAC;QAED,oDAAoD;QACpD,IAAI,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAC7B,SAAS;QACX,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAEzB,QAAQ,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,SAAS;YACf,QAAQ;YACR,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE;YAClB,GAAG,EAAE,SAAS;SACf,CAAC,CAAC;IACL,CAAC;IAED,OAAO;QACL,QAAQ;QACR,eAAe,EAAE,OAAO;QACxB,WAAW,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;KACjC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,OAAO,wBAAwB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC7C,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Shared authentication utilities for assistants commands
3
+ */
4
+ import type { CodeMieClient } from 'codemie-sdk';
5
+ import type { ProviderProfile } from '../env/types.js';
6
+ /**
7
+ * Get authenticated CodeMie client with automatic re-authentication on failure
8
+ *
9
+ * @param config - Provider configuration
10
+ * @returns Authenticated CodeMieClient instance
11
+ * @throws ConfigurationError if authentication fails and user declines re-auth
12
+ */
13
+ export declare function getAuthenticatedClient(config: ProviderProfile): Promise<CodeMieClient>;
14
+ /**
15
+ * Prompt user for re-authentication
16
+ *
17
+ * @param config - Provider configuration
18
+ * @returns True if re-authentication succeeded, false otherwise
19
+ * @throws ConfigurationError if re-authentication is not available
20
+ */
21
+ export declare function promptReauthentication(config: ProviderProfile): Promise<boolean>;
22
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAItD;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,CAa5F;AAED;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CActF"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Shared authentication utilities for assistants commands
3
+ */
4
+ import chalk from 'chalk';
5
+ import { getCodemieClient } from '../utils/sdk-client.js';
6
+ import { ConfigurationError } from '../utils/errors.js';
7
+ import { ProviderRegistry } from '../providers/core/registry.js';
8
+ import { handleAuthValidationFailure } from '../providers/core/auth-validation.js';
9
+ /**
10
+ * Get authenticated CodeMie client with automatic re-authentication on failure
11
+ *
12
+ * @param config - Provider configuration
13
+ * @returns Authenticated CodeMieClient instance
14
+ * @throws ConfigurationError if authentication fails and user declines re-auth
15
+ */
16
+ export async function getAuthenticatedClient(config) {
17
+ try {
18
+ return await getCodemieClient();
19
+ }
20
+ catch (error) {
21
+ if (error instanceof ConfigurationError && error.message.includes('SSO authentication required')) {
22
+ const reauthed = await promptReauthentication(config);
23
+ if (reauthed) {
24
+ // Retry getting client after successful re-authentication
25
+ return await getCodemieClient();
26
+ }
27
+ }
28
+ throw error;
29
+ }
30
+ }
31
+ /**
32
+ * Prompt user for re-authentication
33
+ *
34
+ * @param config - Provider configuration
35
+ * @returns True if re-authentication succeeded, false otherwise
36
+ * @throws ConfigurationError if re-authentication is not available
37
+ */
38
+ export async function promptReauthentication(config) {
39
+ const setupSteps = ProviderRegistry.getSetupSteps(config.provider || '');
40
+ if (setupSteps?.validateAuth) {
41
+ const validationResult = await setupSteps.validateAuth(config);
42
+ const reauthed = await handleAuthValidationFailure(validationResult, setupSteps, config);
43
+ if (reauthed) {
44
+ console.log(chalk.green('\n✓ Re-authentication successful\n'));
45
+ return true;
46
+ }
47
+ }
48
+ throw new ConfigurationError('Authentication expired. Please re-authenticate.');
49
+ }
50
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,2BAA2B,EAAE,MAAM,qCAAqC,CAAC;AAElF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAuB;IAClE,IAAI,CAAC;QACH,OAAO,MAAM,gBAAgB,EAAE,CAAC;IAClC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,kBAAkB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,EAAE,CAAC;YACjG,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,MAAM,CAAC,CAAC;YACtD,IAAI,QAAQ,EAAE,CAAC;gBACb,0DAA0D;gBAC1D,OAAO,MAAM,gBAAgB,EAAE,CAAC;YAClC,CAAC;QACH,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,MAAuB;IAClE,MAAM,UAAU,GAAG,gBAAgB,CAAC,aAAa,CAAC,MAAM,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;IAEzE,IAAI,UAAU,EAAE,YAAY,EAAE,CAAC;QAC7B,MAAM,gBAAgB,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/D,MAAM,QAAQ,GAAG,MAAM,2BAA2B,CAAC,gBAAgB,EAAE,UAAU,EAAE,MAAM,CAAC,CAAC;QAEzF,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;YAC/D,OAAO,IAAI,CAAC;QACd,CAAC;IACH,CAAC;IAED,MAAM,IAAI,kBAAkB,CAAC,iDAAiD,CAAC,CAAC;AAClF,CAAC"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * CLI Auto-Update Utilities
3
+ *
4
+ * Handles version checking and updating for the CodeMie CLI itself
5
+ * (@codemieai/code package)
6
+ *
7
+ * Environment Variables:
8
+ * - CODEMIE_AUTO_UPDATE=true (default): Silently update without prompting
9
+ * - CODEMIE_AUTO_UPDATE=false: Prompt user before updating
10
+ * - CODEMIE_UPDATE_CHECK_INTERVAL: Time between update checks in ms (default: 86400000 = 24h)
11
+ */
12
+ /**
13
+ * Get the current CLI version from package.json
14
+ */
15
+ export declare function getCurrentCliVersion(): Promise<string | null>;
16
+ /**
17
+ * Check if auto-update is enabled (default: true)
18
+ * Reads CODEMIE_AUTO_UPDATE environment variable
19
+ *
20
+ * @returns true if auto-update should happen silently, false if prompt required
21
+ */
22
+ export declare function isAutoUpdateEnabled(): boolean;
23
+ /**
24
+ * Result of checking for CLI updates
25
+ */
26
+ export interface CliUpdateCheckResult {
27
+ /** Current CLI version */
28
+ currentVersion: string;
29
+ /** Latest available version from npm */
30
+ latestVersion: string;
31
+ /** True if update available */
32
+ hasUpdate: boolean;
33
+ }
34
+ /**
35
+ * Check if a CLI update is available
36
+ * Fast check with 5-second timeout
37
+ *
38
+ * @returns Update check result, or null if check fails
39
+ */
40
+ export declare function checkForCliUpdate(): Promise<CliUpdateCheckResult | null>;
41
+ /**
42
+ * Prompt user to update CLI
43
+ *
44
+ * @param result - Update check result
45
+ * @returns True if user confirms update, false otherwise
46
+ */
47
+ export declare function promptForCliUpdate(result: CliUpdateCheckResult): Promise<boolean>;
48
+ /**
49
+ * Update the CLI to the latest version
50
+ *
51
+ * @param latestVersion - Version to install
52
+ * @param silent - If true, minimize output (for auto-update)
53
+ */
54
+ export declare function updateCli(latestVersion: string, silent?: boolean): Promise<void>;
55
+ /**
56
+ * Check for CLI updates and handle update (silent or prompted)
57
+ * This is the main entry point called from bin/codemie.js
58
+ *
59
+ * Behavior:
60
+ * - CODEMIE_AUTO_UPDATE=true (default): Silent update
61
+ * - CODEMIE_AUTO_UPDATE=false: Prompt user
62
+ *
63
+ * Performance optimizations:
64
+ * - Rate limited: Only checks once per UPDATE_CHECK_INTERVAL (default: 24h)
65
+ * - File-based locking: Prevents concurrent updates from multiple CLI processes
66
+ *
67
+ * Non-blocking: Failures are logged but don't block CLI startup
68
+ */
69
+ export declare function checkAndPromptForUpdate(): Promise<void>;
70
+ //# sourceMappingURL=cli-updater.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-updater.d.ts","sourceRoot":"","sources":["../../src/utils/cli-updater.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAsBH;;GAEG;AACH,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAcnE;AAkED;;;;;GAKG;AACH,wBAAgB,mBAAmB,IAAI,OAAO,CAW7C;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,0BAA0B;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,aAAa,EAAE,MAAM,CAAC;IACtB,+BAA+B;IAC/B,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAyC9E;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAmCvF;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,aAAa,EAAE,MAAM,EAAE,MAAM,UAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA4CpF;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkF7D"}