@codemieai/code 0.14.1 → 0.15.1

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 (298) hide show
  1. package/README.md +23 -0
  2. package/bin/codemie-openwiki.js +18 -0
  3. package/dist/agents/core/AgentCLI.d.ts.map +1 -1
  4. package/dist/agents/core/AgentCLI.js +2 -0
  5. package/dist/agents/core/AgentCLI.js.map +1 -1
  6. package/dist/agents/core/BaseAgentAdapter.d.ts.map +1 -1
  7. package/dist/agents/core/BaseAgentAdapter.js +25 -11
  8. package/dist/agents/core/BaseAgentAdapter.js.map +1 -1
  9. package/dist/agents/core/extension/BaseExtensionInstaller.d.ts +1 -0
  10. package/dist/agents/core/extension/BaseExtensionInstaller.d.ts.map +1 -1
  11. package/dist/agents/core/extension/BaseExtensionInstaller.js +20 -0
  12. package/dist/agents/core/extension/BaseExtensionInstaller.js.map +1 -1
  13. package/dist/agents/core/types.d.ts +8 -0
  14. package/dist/agents/core/types.d.ts.map +1 -1
  15. package/dist/agents/plugins/claude/claude-message-types.d.ts +1 -0
  16. package/dist/agents/plugins/claude/claude-message-types.d.ts.map +1 -1
  17. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  18. package/dist/agents/plugins/claude/claude.plugin.js +60 -6
  19. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  20. package/dist/agents/plugins/claude/plugin/__tests__/statusline.test.ts +26 -4
  21. package/dist/agents/plugins/claude/plugin/hooks/hooks.json +6 -6
  22. package/dist/agents/plugins/claude/plugin/statusline.mjs +5 -1
  23. package/dist/agents/plugins/codemie-code.plugin.d.ts +1 -0
  24. package/dist/agents/plugins/codemie-code.plugin.d.ts.map +1 -1
  25. package/dist/agents/plugins/codemie-code.plugin.js +12 -5
  26. package/dist/agents/plugins/codemie-code.plugin.js.map +1 -1
  27. package/dist/agents/plugins/codex/codex-message-types.d.ts +28 -0
  28. package/dist/agents/plugins/codex/codex-message-types.d.ts.map +1 -1
  29. package/dist/agents/plugins/codex/codex-message-types.js.map +1 -1
  30. package/dist/agents/plugins/codex/codex.plugin.d.ts.map +1 -1
  31. package/dist/agents/plugins/codex/codex.plugin.js +30 -2
  32. package/dist/agents/plugins/codex/codex.plugin.js.map +1 -1
  33. package/dist/agents/plugins/codex/index.d.ts +4 -2
  34. package/dist/agents/plugins/codex/index.d.ts.map +1 -1
  35. package/dist/agents/plugins/codex/index.js +3 -1
  36. package/dist/agents/plugins/codex/index.js.map +1 -1
  37. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.d.ts.map +1 -1
  38. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js +3 -1
  39. package/dist/agents/plugins/copilot-cli/copilot-cli.plugin.js.map +1 -1
  40. package/dist/agents/plugins/gemini/extension/hooks/hooks.json +4 -4
  41. package/dist/agents/plugins/gemini/gemini.models.d.ts +33 -0
  42. package/dist/agents/plugins/gemini/gemini.models.d.ts.map +1 -0
  43. package/dist/agents/plugins/gemini/gemini.models.js +122 -0
  44. package/dist/agents/plugins/gemini/gemini.models.js.map +1 -0
  45. package/dist/agents/plugins/gemini/gemini.plugin.d.ts.map +1 -1
  46. package/dist/agents/plugins/gemini/gemini.plugin.js +6 -0
  47. package/dist/agents/plugins/gemini/gemini.plugin.js.map +1 -1
  48. package/dist/agents/plugins/gemini/gemini.session-adapter.d.ts +1 -1
  49. package/dist/agents/plugins/gemini/gemini.session-adapter.d.ts.map +1 -1
  50. package/dist/agents/plugins/gemini/gemini.session-adapter.js +155 -16
  51. package/dist/agents/plugins/gemini/gemini.session-adapter.js.map +1 -1
  52. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.d.ts.map +1 -1
  53. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.js +77 -31
  54. package/dist/agents/plugins/gemini/session/processors/gemini.metrics-processor.js.map +1 -1
  55. package/dist/agents/plugins/gemini/session/utils/turn-detector.d.ts +1 -1
  56. package/dist/agents/plugins/gemini/session/utils/turn-detector.d.ts.map +1 -1
  57. package/dist/agents/plugins/gemini/session/utils/turn-detector.js +7 -1
  58. package/dist/agents/plugins/gemini/session/utils/turn-detector.js.map +1 -1
  59. package/dist/agents/plugins/openwiki/openwiki.plugin.d.ts +30 -0
  60. package/dist/agents/plugins/openwiki/openwiki.plugin.d.ts.map +1 -0
  61. package/dist/agents/plugins/openwiki/openwiki.plugin.js +73 -0
  62. package/dist/agents/plugins/openwiki/openwiki.plugin.js.map +1 -0
  63. package/dist/agents/plugins/pi/pi.models.d.ts.map +1 -1
  64. package/dist/agents/plugins/pi/pi.models.js +62 -0
  65. package/dist/agents/plugins/pi/pi.models.js.map +1 -1
  66. package/dist/agents/plugins/pi/pi.plugin.d.ts.map +1 -1
  67. package/dist/agents/plugins/pi/pi.plugin.js +7 -3
  68. package/dist/agents/plugins/pi/pi.plugin.js.map +1 -1
  69. package/dist/agents/registry.d.ts.map +1 -1
  70. package/dist/agents/registry.js +2 -0
  71. package/dist/agents/registry.js.map +1 -1
  72. package/dist/bin/proxy-daemon.js +3 -0
  73. package/dist/bin/proxy-daemon.js.map +1 -1
  74. package/dist/cli/commands/analytics/aggregator.d.ts.map +1 -1
  75. package/dist/cli/commands/analytics/aggregator.js +1 -0
  76. package/dist/cli/commands/analytics/aggregator.js.map +1 -1
  77. package/dist/cli/commands/analytics/cost/cost-enricher.d.ts.map +1 -1
  78. package/dist/cli/commands/analytics/cost/cost-enricher.js +6 -1
  79. package/dist/cli/commands/analytics/cost/cost-enricher.js.map +1 -1
  80. package/dist/cli/commands/analytics/cost/types.d.ts +8 -0
  81. package/dist/cli/commands/analytics/cost/types.d.ts.map +1 -1
  82. package/dist/cli/commands/analytics/report/client/app.js +111 -1
  83. package/dist/cli/commands/analytics/report/payload-builder.d.ts.map +1 -1
  84. package/dist/cli/commands/analytics/report/payload-builder.js +6 -0
  85. package/dist/cli/commands/analytics/report/payload-builder.js.map +1 -1
  86. package/dist/cli/commands/analytics/report/template.html +9 -0
  87. package/dist/cli/commands/analytics/report/types.d.ts +1 -0
  88. package/dist/cli/commands/analytics/report/types.d.ts.map +1 -1
  89. package/dist/cli/commands/analytics/types.d.ts +1 -0
  90. package/dist/cli/commands/analytics/types.d.ts.map +1 -1
  91. package/dist/cli/commands/assistants/chat/claudeUploadsDetector.d.ts.map +1 -1
  92. package/dist/cli/commands/assistants/chat/claudeUploadsDetector.js +43 -67
  93. package/dist/cli/commands/assistants/chat/claudeUploadsDetector.js.map +1 -1
  94. package/dist/cli/commands/assistants/chat/codexUploadsDetector.d.ts +26 -0
  95. package/dist/cli/commands/assistants/chat/codexUploadsDetector.d.ts.map +1 -0
  96. package/dist/cli/commands/assistants/chat/codexUploadsDetector.js +240 -0
  97. package/dist/cli/commands/assistants/chat/codexUploadsDetector.js.map +1 -0
  98. package/dist/cli/commands/assistants/chat/historyLoader.d.ts +2 -2
  99. package/dist/cli/commands/assistants/chat/historyLoader.d.ts.map +1 -1
  100. package/dist/cli/commands/assistants/chat/historyLoader.js.map +1 -1
  101. package/dist/cli/commands/assistants/chat/index.d.ts.map +1 -1
  102. package/dist/cli/commands/assistants/chat/index.js +14 -3
  103. package/dist/cli/commands/assistants/chat/index.js.map +1 -1
  104. package/dist/cli/commands/assistants/setup/data.d.ts.map +1 -1
  105. package/dist/cli/commands/assistants/setup/data.js +7 -0
  106. package/dist/cli/commands/assistants/setup/data.js.map +1 -1
  107. package/dist/cli/commands/assistants/setup/selection/utils.d.ts +3 -3
  108. package/dist/cli/commands/assistants/setup/selection/utils.d.ts.map +1 -1
  109. package/dist/cli/commands/assistants/setup/selection/utils.js.map +1 -1
  110. package/dist/cli/commands/docs.d.ts +12 -0
  111. package/dist/cli/commands/docs.d.ts.map +1 -0
  112. package/dist/cli/commands/docs.js +141 -0
  113. package/dist/cli/commands/docs.js.map +1 -0
  114. package/dist/cli/commands/install.d.ts.map +1 -1
  115. package/dist/cli/commands/install.js +30 -18
  116. package/dist/cli/commands/install.js.map +1 -1
  117. package/dist/cli/commands/log/filter.js +1 -1
  118. package/dist/cli/commands/log/filter.js.map +1 -1
  119. package/dist/cli/commands/log/formatter.d.ts.map +1 -1
  120. package/dist/cli/commands/log/formatter.js +1 -0
  121. package/dist/cli/commands/log/formatter.js.map +1 -1
  122. package/dist/cli/commands/log/parser.d.ts.map +1 -1
  123. package/dist/cli/commands/log/parser.js +2 -0
  124. package/dist/cli/commands/log/parser.js.map +1 -1
  125. package/dist/cli/commands/log/types.d.ts +1 -1
  126. package/dist/cli/commands/log/types.d.ts.map +1 -1
  127. package/dist/cli/commands/models.d.ts.map +1 -1
  128. package/dist/cli/commands/models.js +12 -2
  129. package/dist/cli/commands/models.js.map +1 -1
  130. package/dist/cli/commands/profile/display.d.ts +3 -3
  131. package/dist/cli/commands/profile/display.d.ts.map +1 -1
  132. package/dist/cli/commands/profile/display.js +6 -6
  133. package/dist/cli/commands/profile/display.js.map +1 -1
  134. package/dist/cli/commands/profile/index.d.ts.map +1 -1
  135. package/dist/cli/commands/profile/index.js +4 -2
  136. package/dist/cli/commands/profile/index.js.map +1 -1
  137. package/dist/cli/commands/proxy/connect-orchestrator.d.ts +9 -0
  138. package/dist/cli/commands/proxy/connect-orchestrator.d.ts.map +1 -1
  139. package/dist/cli/commands/proxy/connect-orchestrator.js +15 -1
  140. package/dist/cli/commands/proxy/connect-orchestrator.js.map +1 -1
  141. package/dist/cli/commands/proxy/connectors/codex-desktop.d.ts +1 -1
  142. package/dist/cli/commands/proxy/connectors/codex-desktop.d.ts.map +1 -1
  143. package/dist/cli/commands/proxy/connectors/codex-desktop.js +19 -9
  144. package/dist/cli/commands/proxy/connectors/codex-desktop.js.map +1 -1
  145. package/dist/cli/commands/proxy/connectors/desktop.d.ts.map +1 -1
  146. package/dist/cli/commands/proxy/connectors/desktop.js +9 -0
  147. package/dist/cli/commands/proxy/connectors/desktop.js.map +1 -1
  148. package/dist/cli/commands/proxy/daemon-manager.d.ts +2 -0
  149. package/dist/cli/commands/proxy/daemon-manager.d.ts.map +1 -1
  150. package/dist/cli/commands/proxy/daemon-manager.js +2 -0
  151. package/dist/cli/commands/proxy/daemon-manager.js.map +1 -1
  152. package/dist/cli/commands/proxy/index.d.ts.map +1 -1
  153. package/dist/cli/commands/proxy/index.js +44 -2
  154. package/dist/cli/commands/proxy/index.js.map +1 -1
  155. package/dist/cli/commands/setup.d.ts +0 -16
  156. package/dist/cli/commands/setup.d.ts.map +1 -1
  157. package/dist/cli/commands/setup.js +8 -126
  158. package/dist/cli/commands/setup.js.map +1 -1
  159. package/dist/cli/commands/shared/api-response-guard.d.ts +20 -0
  160. package/dist/cli/commands/shared/api-response-guard.d.ts.map +1 -0
  161. package/dist/cli/commands/shared/api-response-guard.js +31 -0
  162. package/dist/cli/commands/shared/api-response-guard.js.map +1 -0
  163. package/dist/cli/commands/skills/setup/data.d.ts.map +1 -1
  164. package/dist/cli/commands/skills/setup/data.js +8 -0
  165. package/dist/cli/commands/skills/setup/data.js.map +1 -1
  166. package/dist/cli/index.js +2 -0
  167. package/dist/cli/index.js.map +1 -1
  168. package/dist/env/types.d.ts +22 -15
  169. package/dist/env/types.d.ts.map +1 -1
  170. package/dist/env/types.js.map +1 -1
  171. package/dist/frameworks/core/registry.d.ts +6 -0
  172. package/dist/frameworks/core/registry.d.ts.map +1 -1
  173. package/dist/frameworks/core/registry.js +8 -0
  174. package/dist/frameworks/core/registry.js.map +1 -1
  175. package/dist/frameworks/core/types.d.ts +7 -0
  176. package/dist/frameworks/core/types.d.ts.map +1 -1
  177. package/dist/frameworks/plugins/codebase-memory.plugin.d.ts.map +1 -1
  178. package/dist/frameworks/plugins/codebase-memory.plugin.js +1 -0
  179. package/dist/frameworks/plugins/codebase-memory.plugin.js.map +1 -1
  180. package/dist/frameworks/plugins/codegraph.plugin.d.ts +17 -0
  181. package/dist/frameworks/plugins/codegraph.plugin.d.ts.map +1 -0
  182. package/dist/frameworks/plugins/codegraph.plugin.js +74 -0
  183. package/dist/frameworks/plugins/codegraph.plugin.js.map +1 -0
  184. package/dist/frameworks/plugins/graphify.plugin.d.ts +20 -0
  185. package/dist/frameworks/plugins/graphify.plugin.d.ts.map +1 -0
  186. package/dist/frameworks/plugins/graphify.plugin.js +92 -0
  187. package/dist/frameworks/plugins/graphify.plugin.js.map +1 -0
  188. package/dist/frameworks/plugins/index.d.ts +2 -0
  189. package/dist/frameworks/plugins/index.d.ts.map +1 -1
  190. package/dist/frameworks/plugins/index.js +6 -0
  191. package/dist/frameworks/plugins/index.js.map +1 -1
  192. package/dist/hooks/executor.d.ts +2 -0
  193. package/dist/hooks/executor.d.ts.map +1 -1
  194. package/dist/hooks/executor.js +14 -1
  195. package/dist/hooks/executor.js.map +1 -1
  196. package/dist/migrations/001-config-rename.migration.d.ts +0 -1
  197. package/dist/migrations/001-config-rename.migration.d.ts.map +1 -1
  198. package/dist/migrations/001-config-rename.migration.js +0 -1
  199. package/dist/migrations/001-config-rename.migration.js.map +1 -1
  200. package/dist/migrations/002-consolidate-sessions.migration.d.ts +0 -1
  201. package/dist/migrations/002-consolidate-sessions.migration.d.ts.map +1 -1
  202. package/dist/migrations/002-consolidate-sessions.migration.js +0 -1
  203. package/dist/migrations/002-consolidate-sessions.migration.js.map +1 -1
  204. package/dist/migrations/003-remove-hooks-node.migration.d.ts +0 -1
  205. package/dist/migrations/003-remove-hooks-node.migration.d.ts.map +1 -1
  206. package/dist/migrations/003-remove-hooks-node.migration.js +0 -1
  207. package/dist/migrations/003-remove-hooks-node.migration.js.map +1 -1
  208. package/dist/migrations/006-resolve-hook-command-paths.migration.d.ts +9 -0
  209. package/dist/migrations/006-resolve-hook-command-paths.migration.d.ts.map +1 -0
  210. package/dist/migrations/006-resolve-hook-command-paths.migration.js +59 -0
  211. package/dist/migrations/006-resolve-hook-command-paths.migration.js.map +1 -0
  212. package/dist/migrations/007-decouple-provider-workspace-config.migration.d.ts +10 -0
  213. package/dist/migrations/007-decouple-provider-workspace-config.migration.d.ts.map +1 -0
  214. package/dist/migrations/007-decouple-provider-workspace-config.migration.js +118 -0
  215. package/dist/migrations/007-decouple-provider-workspace-config.migration.js.map +1 -0
  216. package/dist/migrations/index.d.ts +2 -0
  217. package/dist/migrations/index.d.ts.map +1 -1
  218. package/dist/migrations/index.js +2 -0
  219. package/dist/migrations/index.js.map +1 -1
  220. package/dist/migrations/types.d.ts +1 -3
  221. package/dist/migrations/types.d.ts.map +1 -1
  222. package/dist/plugins/loaders/hooks-loader.js +1 -1
  223. package/dist/plugins/loaders/hooks-loader.js.map +1 -1
  224. package/dist/providers/core/default-agent-hooks.d.ts.map +1 -1
  225. package/dist/providers/core/default-agent-hooks.js +21 -5
  226. package/dist/providers/core/default-agent-hooks.js.map +1 -1
  227. package/dist/providers/core/types.d.ts +2 -28
  228. package/dist/providers/core/types.d.ts.map +1 -1
  229. package/dist/providers/core/types.js.map +1 -1
  230. package/dist/providers/integration/setup-ui.d.ts +5 -0
  231. package/dist/providers/integration/setup-ui.d.ts.map +1 -1
  232. package/dist/providers/integration/setup-ui.js +17 -2
  233. package/dist/providers/integration/setup-ui.js.map +1 -1
  234. package/dist/providers/plugins/anthropic-subscription/anthropic-subscription.template.d.ts.map +1 -1
  235. package/dist/providers/plugins/anthropic-subscription/anthropic-subscription.template.js +12 -0
  236. package/dist/providers/plugins/anthropic-subscription/anthropic-subscription.template.js.map +1 -1
  237. package/dist/providers/plugins/litellm/litellm.setup-steps.d.ts.map +1 -1
  238. package/dist/providers/plugins/litellm/litellm.setup-steps.js +4 -21
  239. package/dist/providers/plugins/litellm/litellm.setup-steps.js.map +1 -1
  240. package/dist/providers/plugins/ollama/ollama.health.js +1 -1
  241. package/dist/providers/plugins/ollama/ollama.health.js.map +1 -1
  242. package/dist/providers/plugins/ollama/ollama.models.d.ts +29 -2
  243. package/dist/providers/plugins/ollama/ollama.models.d.ts.map +1 -1
  244. package/dist/providers/plugins/ollama/ollama.models.js +103 -22
  245. package/dist/providers/plugins/ollama/ollama.models.js.map +1 -1
  246. package/dist/providers/plugins/ollama/ollama.setup-steps.d.ts.map +1 -1
  247. package/dist/providers/plugins/ollama/ollama.setup-steps.js +71 -8
  248. package/dist/providers/plugins/ollama/ollama.setup-steps.js.map +1 -1
  249. package/dist/providers/plugins/ollama/ollama.template.d.ts.map +1 -1
  250. package/dist/providers/plugins/ollama/ollama.template.js +66 -6
  251. package/dist/providers/plugins/ollama/ollama.template.js.map +1 -1
  252. package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts +3 -25
  253. package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.d.ts.map +1 -1
  254. package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js +93 -100
  255. package/dist/providers/plugins/sso/proxy/plugins/claude-request-normalizer.plugin.js.map +1 -1
  256. package/dist/providers/plugins/sso/proxy/plugins/codex-request-normalizer.plugin.js +7 -2
  257. package/dist/providers/plugins/sso/proxy/plugins/codex-request-normalizer.plugin.js.map +1 -1
  258. package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js +5 -1
  259. package/dist/providers/plugins/sso/proxy/plugins/header-injection.plugin.js.map +1 -1
  260. package/dist/providers/plugins/sso/proxy/plugins/sso-auth.plugin.d.ts.map +1 -1
  261. package/dist/providers/plugins/sso/proxy/plugins/sso-auth.plugin.js +32 -3
  262. package/dist/providers/plugins/sso/proxy/plugins/sso-auth.plugin.js.map +1 -1
  263. package/dist/providers/plugins/sso/proxy/proxy-errors.d.ts.map +1 -1
  264. package/dist/providers/plugins/sso/proxy/proxy-errors.js +27 -1
  265. package/dist/providers/plugins/sso/proxy/proxy-errors.js.map +1 -1
  266. package/dist/providers/plugins/sso/proxy/proxy-http-client.d.ts +7 -2
  267. package/dist/providers/plugins/sso/proxy/proxy-http-client.d.ts.map +1 -1
  268. package/dist/providers/plugins/sso/proxy/proxy-http-client.js +191 -15
  269. package/dist/providers/plugins/sso/proxy/proxy-http-client.js.map +1 -1
  270. package/dist/providers/plugins/sso/sso.auth.d.ts.map +1 -1
  271. package/dist/providers/plugins/sso/sso.auth.js +6 -2
  272. package/dist/providers/plugins/sso/sso.auth.js.map +1 -1
  273. package/dist/providers/plugins/sso/sso.setup-steps.d.ts.map +1 -1
  274. package/dist/providers/plugins/sso/sso.setup-steps.js +22 -39
  275. package/dist/providers/plugins/sso/sso.setup-steps.js.map +1 -1
  276. package/dist/utils/config.d.ts +20 -27
  277. package/dist/utils/config.d.ts.map +1 -1
  278. package/dist/utils/config.js +90 -84
  279. package/dist/utils/config.js.map +1 -1
  280. package/dist/utils/hardware.d.ts +36 -0
  281. package/dist/utils/hardware.d.ts.map +1 -0
  282. package/dist/utils/hardware.js +86 -0
  283. package/dist/utils/hardware.js.map +1 -0
  284. package/dist/utils/hook-command.d.ts +4 -0
  285. package/dist/utils/hook-command.d.ts.map +1 -0
  286. package/dist/utils/hook-command.js +82 -0
  287. package/dist/utils/hook-command.js.map +1 -0
  288. package/dist/utils/logger.d.ts +1 -0
  289. package/dist/utils/logger.d.ts.map +1 -1
  290. package/dist/utils/logger.js +21 -0
  291. package/dist/utils/logger.js.map +1 -1
  292. package/dist/utils/pricing.json +24 -0
  293. package/dist/utils/security.d.ts +28 -2
  294. package/dist/utils/security.d.ts.map +1 -1
  295. package/dist/utils/security.js +84 -24
  296. package/dist/utils/security.js.map +1 -1
  297. package/package.json +4 -10
  298. package/scripts/release.sh +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"sso.setup-steps.d.ts","sourceRoot":"","sources":["../../../../src/providers/plugins/sso/sso.setup-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EACV,kBAAkB,EAMnB,MAAM,qBAAqB,CAAC;AAc7B;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,kBA2S3B,CAAC"}
1
+ {"version":3,"file":"sso.setup-steps.d.ts","sourceRoot":"","sources":["../../../../src/providers/plugins/sso/sso.setup-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH,OAAO,KAAK,EACV,kBAAkB,EAInB,MAAM,qBAAqB,CAAC;AAc7B;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,kBAyR3B,CAAC"}
@@ -25,50 +25,33 @@ export const SSOSetupSteps = {
25
25
  /**
26
26
  * Step 1: Gather credentials/configuration
27
27
  *
28
- * Prompts for CodeMie URL and performs browser-based authentication.
29
- *
30
- * When the setup wizard already completed a CodeMie handshake (its
31
- * mandatory-integration gate authenticates before provider selection), that
32
- * session is reused so the user is not prompted for the portal URL and sent
33
- * through the browser a second time in one `codemie setup` run.
28
+ * Prompts for CodeMie URL and performs browser-based authentication
34
29
  */
35
- async getCredentials(_isUpdate = false, context) {
36
- const session = context?.codeMieSession;
37
- let codeMieUrl;
38
- let authResult;
30
+ async getCredentials() {
31
+ const codeMieUrl = await promptForCodeMieUrl(DEFAULT_CODEMIE_BASE_URL);
32
+ // Authenticate via browser
33
+ console.log(chalk.cyan('\n🔐 Authenticating via browser...\n'));
34
+ const authResult = await authenticateWithCodeMie(codeMieUrl, 120000);
35
+ if (!authResult.success) {
36
+ throw new Error(`SSO authentication failed: ${authResult.error || 'Unknown error'}`);
37
+ }
38
+ console.log(chalk.green('✓ Authentication successful!\n'));
39
+ // === NEW STEP: Fetch applications and select project ===
39
40
  let selectedProject;
40
41
  let selectedUserEmail;
41
- if (session) {
42
- codeMieUrl = session.codeMieUrl;
43
- authResult = session.authResult;
44
- selectedProject = session.project;
45
- selectedUserEmail = session.userEmail;
46
- console.log(chalk.green(`✓ Using existing authenticated session for ${codeMieUrl}`));
47
- console.log(chalk.dim(` Project: ${selectedProject}\n`));
48
- }
49
- else {
50
- codeMieUrl = await promptForCodeMieUrl(DEFAULT_CODEMIE_BASE_URL);
51
- // Authenticate via browser
52
- console.log(chalk.cyan('\n🔐 Authenticating via browser...\n'));
53
- authResult = await authenticateWithCodeMie(codeMieUrl, 120000);
54
- if (!authResult.success) {
55
- throw new Error(`SSO authentication failed: ${authResult.error || 'Unknown error'}`);
56
- }
57
- console.log(chalk.green('✓ Authentication successful!\n'));
58
- // === NEW STEP: Fetch applications and select project ===
59
- try {
60
- console.log(chalk.cyan('📂 Fetching available projects...\n'));
61
- ({ project: selectedProject, userEmail: selectedUserEmail } = await selectCodeMieProject(authResult));
62
- }
63
- catch (error) {
64
- const errorMsg = error instanceof Error ? error.message : String(error);
65
- console.log(chalk.red(`✗ Project selection failed: ${errorMsg}\n`));
66
- // Fail fast - project selection is required
67
- throw new Error(`Project selection required: ${errorMsg}`);
42
+ try {
43
+ console.log(chalk.cyan('📂 Fetching available projects...\n'));
44
+ // Ensure API URL and cookies are available
45
+ if (!authResult.apiUrl || !authResult.cookies) {
46
+ throw new Error('API URL or cookies not found in authentication result');
68
47
  }
48
+ ({ project: selectedProject, userEmail: selectedUserEmail } = await selectCodeMieProject(authResult));
69
49
  }
70
- if (!authResult.apiUrl || !authResult.cookies) {
71
- throw new Error('API URL or cookies not found in authentication result');
50
+ catch (error) {
51
+ const errorMsg = error instanceof Error ? error.message : String(error);
52
+ console.log(chalk.red(`✗ Project selection failed: ${errorMsg}\n`));
53
+ // Fail fast - project selection is required
54
+ throw new Error(`Project selection required: ${errorMsg}`);
72
55
  }
73
56
  // Check for LiteLLM integrations
74
57
  let integrations;
@@ -1 +1 @@
1
- {"version":3,"file":"sso.setup-steps.js","sourceRoot":"","sources":["../../../../src/providers/plugins/sso/sso.setup-steps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,GAAG,MAAM,KAAK,CAAC;AAUtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EAAE,MAAM,EAAE,MAAM,0BA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AC,CAAC;YAClD,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,CAAC;QAClC,CAAC;IACH,CAAC;CACF,CAAC;AAEF,4BAA4B;AAC5B,gBAAgB,CAAC,kBAAkB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { CodeMieConfigOptions, ProviderProfile, MultiProviderConfig, CodeMieIntegrationInfo, ConfigWithSource, ConfigWithSources, CodemieAssistant, CodemieSkill, StorageScope } from '../env/types.js';
1
+ import { CodeMieConfigOptions, ProviderProfile, MultiProviderConfig, WorkspaceConfig, CodeMieIntegrationInfo, ConfigWithSource, ConfigWithSources, CodemieAssistant, CodemieSkill, StorageScope } from '../env/types.js';
2
2
  export type { CodeMieConfigOptions, CodeMieIntegrationInfo, ConfigWithSource, ConfigWithSources };
3
3
  export { StorageScope };
4
4
  /**
@@ -26,6 +26,13 @@ export declare class ConfigLoader {
26
26
  * CLI args > Env vars > Project config > Global config > Defaults
27
27
  */
28
28
  static load(workingDir?: string, cliOverrides?: Partial<CodeMieConfigOptions>): Promise<CodeMieConfigOptions>;
29
+ /**
30
+ * Resolve the workspace-level (repo/tooling-context) configuration for a working
31
+ * directory, by whole-object override: the local scope's `workspace` if it is
32
+ * defined, else the global scope's, else `{}`. Never mixes fields between scopes —
33
+ * this is what lets switching the active profile keep workspace context intact.
34
+ */
35
+ static resolveWorkspace(workingDir: string): Promise<WorkspaceConfig>;
29
36
  /**
30
37
  * Load full configuration including analytics
31
38
  * Returns the complete multi-provider config with analytics settings
@@ -62,32 +69,6 @@ export declare class ConfigLoader {
62
69
  * 4. The selected global profile name (backward compatibility for single-profile local configs).
63
70
  */
64
71
  private static resolveLocalProfileName;
65
- /**
66
- * Fields that belong to the repository/project context rather than to the provider
67
- * identity. When a user explicitly selects a different global provider profile via
68
- * --profile, these fields should still be supplied by the team's local profile so the
69
- * repository context is not lost.
70
- */
71
- private static readonly PROJECT_FIELDS;
72
- /**
73
- * Returns true when the local team profile's project context (codeMieProject,
74
- * codeMieIntegration, codeMieUrl) is safe to compose with the selected global
75
- * profile. The composition is only safe when both profiles target the same
76
- * CodeMie environment — otherwise the local project/integration IDs reference
77
- * the wrong env's database rows and the URL is outright wrong.
78
- *
79
- * The gate is conservative: it only blocks composition when both URLs are
80
- * explicitly set and normalized-differ. A missing URL on either side is
81
- * treated as "no signal of conflict" and composition proceeds. This matches
82
- * the common case where a local profile sets only `codeMieProject` and relies
83
- * on the global profile for the URL.
84
- */
85
- private static shouldPreserveProjectContext;
86
- /**
87
- * Keep only project-level fields from a local profile. Used when the selected global
88
- * profile differs from the team's local default profile.
89
- */
90
- private static filterProjectFields;
91
72
  /**
92
73
  * Load configuration with validation (throws if required fields missing)
93
74
  */
@@ -120,6 +101,18 @@ export declare class ConfigLoader {
120
101
  */
121
102
  static saveMultiProviderConfig(config: MultiProviderConfig): Promise<void>;
122
103
  static saveUserEmail(email: string): Promise<void>;
104
+ /**
105
+ * Keys that belong to WorkspaceConfig (repo/tooling-context) rather than to a
106
+ * ProviderProfile. Used to split a saved profile's input into its profile half
107
+ * and its workspace half — see splitProfileAndWorkspace().
108
+ */
109
+ private static readonly WORKSPACE_KEYS;
110
+ /**
111
+ * Partition a profile-shaped input into its provider-identity half and its
112
+ * workspace half, so callers that persist a profile can route each half to
113
+ * where it belongs (profiles[name] vs. the scope's workspace).
114
+ */
115
+ private static splitProfileAndWorkspace;
123
116
  /**
124
117
  * Add or update a profile
125
118
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/utils/config.ts"],"names":[],"mappings":"AAKA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EAGb,MAAM,iBAAiB,CAAC;AAMzB,YAAY,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,CAAC;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,OAAO,CAAC,oBAAoB,CAAC,GAC3C,OAAO,CAAC,iBAAiB,CAAC;IAuF7B;;OAEG;WACU,eAAe,CAAC,UAAU,GAAE,MAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB/E;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,aAAa;IA6B5B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,mBAAmB;IA8BlC;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B;;OAEG;IACH,MAAM,CAAC,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAIvD;;;;;OAKG;IACH,MAAM,CAAC,qBAAqB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAyCnF;AAUD;;;GAGG;AACH,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,CAAC,CAiBzD;AAED;;;GAGG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAgB5E"}
@@ -85,27 +85,21 @@ export class ConfigLoader {
85
85
  // 4. Global config (~/.codemie/codemie-cli.config.json)
86
86
  const globalConfig = await this.loadGlobalConfigProfile(selectedProfileName);
87
87
  Object.assign(config, this.removeUndefined(globalConfig));
88
- // 3. Project-local config (.codemie/codemie-cli.config.json)
88
+ // 3. Project-local config (.codemie/codemie-cli.config.json) — provider identity
89
+ // (name/model/baseUrl/apiKey/etc.). Repo/tooling-context fields no longer live on
90
+ // the profile; they resolve independently below via resolveWorkspace().
89
91
  const localConfig = await this.loadLocalConfigProfile(workingDir, localProfileName);
90
- // When the selected global profile differs from the team's local profile, keep only
91
- // project-level local fields. The selection may come from --profile or activeProfile;
92
- // either way, the local team fallback must not replace provider, model, or credentials.
92
+ // When the selected global profile differs from the team's local profile, the local
93
+ // team profile must not replace provider, model, or credentials — apply none of it.
93
94
  const applyProjectOnly = Boolean(selectedProfileName && localProfileName && selectedProfileName !== localProfileName);
94
- // When applying project-only composition, gate it on URL equality. If the
95
- // selected global profile targets a different CodeMie env than the local
96
- // team profile, the team's project/integration/URL all reference the wrong
97
- // env's records — drop the project-context bundle and let the global
98
- // profile supply everything.
99
- const selectedProfileDefinesProjectContext = Boolean(globalConfig.codeMieProject || globalConfig.codeMieIntegration);
100
- const preserveProjectContext = applyProjectOnly &&
101
- !selectedProfileDefinesProjectContext &&
102
- this.shouldPreserveProjectContext(localConfig.codeMieUrl, globalConfig.codeMieUrl);
103
- const effectiveLocalConfig = preserveProjectContext
104
- ? this.filterProjectFields(localConfig)
105
- : applyProjectOnly
106
- ? {}
107
- : localConfig;
95
+ const effectiveLocalConfig = applyProjectOnly ? {} : localConfig;
108
96
  Object.assign(config, this.removeUndefined(effectiveLocalConfig));
97
+ // Workspace (repo/tooling-context) fields resolve by whole-object override — the
98
+ // local scope's workspace if defined, else the global scope's — independent of
99
+ // which profile is active, so switching the active profile never drops workspace
100
+ // context.
101
+ const workspace = await this.resolveWorkspace(workingDir);
102
+ Object.assign(config, this.removeUndefined(workspace));
109
103
  // 2. Environment variables (load .env first if in project)
110
104
  const envPath = path.join(workingDir, '.env');
111
105
  try {
@@ -166,6 +160,24 @@ export class ConfigLoader {
166
160
  }
167
161
  return config;
168
162
  }
163
+ /**
164
+ * Resolve the workspace-level (repo/tooling-context) configuration for a working
165
+ * directory, by whole-object override: the local scope's `workspace` if it is
166
+ * defined, else the global scope's, else `{}`. Never mixes fields between scopes —
167
+ * this is what lets switching the active profile keep workspace context intact.
168
+ */
169
+ static async resolveWorkspace(workingDir) {
170
+ // `!= null` (loose) deliberately also excludes an explicit `"workspace": null` —
171
+ // e.g. from a hand-edited or externally-written config file — which is not a
172
+ // valid WorkspaceConfig object and must fall back to the next scope rather than
173
+ // being treated as "defined" and passed downstream to Object.entries().
174
+ const localMultiConfig = await this.loadLocalMultiProviderConfig(workingDir);
175
+ if (localMultiConfig.workspace != null) {
176
+ return localMultiConfig.workspace;
177
+ }
178
+ const globalMultiConfig = await this.loadMultiProviderConfig();
179
+ return globalMultiConfig.workspace ?? {};
180
+ }
169
181
  /**
170
182
  * Load full configuration including analytics
171
183
  * Returns the complete multi-provider config with analytics settings
@@ -299,49 +311,6 @@ export class ConfigLoader {
299
311
  // Fallback: keep the original 2-level lookup behavior.
300
312
  return selectedProfileName;
301
313
  }
302
- /**
303
- * Fields that belong to the repository/project context rather than to the provider
304
- * identity. When a user explicitly selects a different global provider profile via
305
- * --profile, these fields should still be supplied by the team's local profile so the
306
- * repository context is not lost.
307
- */
308
- static PROJECT_FIELDS = [
309
- 'codeMieProject',
310
- 'codeMieIntegration',
311
- 'codeMieUrl'
312
- ];
313
- /**
314
- * Returns true when the local team profile's project context (codeMieProject,
315
- * codeMieIntegration, codeMieUrl) is safe to compose with the selected global
316
- * profile. The composition is only safe when both profiles target the same
317
- * CodeMie environment — otherwise the local project/integration IDs reference
318
- * the wrong env's database rows and the URL is outright wrong.
319
- *
320
- * The gate is conservative: it only blocks composition when both URLs are
321
- * explicitly set and normalized-differ. A missing URL on either side is
322
- * treated as "no signal of conflict" and composition proceeds. This matches
323
- * the common case where a local profile sets only `codeMieProject` and relies
324
- * on the global profile for the URL.
325
- */
326
- static shouldPreserveProjectContext(localUrl, globalUrl) {
327
- if (!localUrl || !globalUrl)
328
- return true;
329
- const normalize = (u) => u.replace(/\/+$/, '').toLowerCase();
330
- return normalize(localUrl) === normalize(globalUrl);
331
- }
332
- /**
333
- * Keep only project-level fields from a local profile. Used when the selected global
334
- * profile differs from the team's local default profile.
335
- */
336
- static filterProjectFields(config) {
337
- const result = {};
338
- for (const field of this.PROJECT_FIELDS) {
339
- if (config[field] !== undefined) {
340
- result[field] = config[field];
341
- }
342
- }
343
- return result;
344
- }
345
314
  /**
346
315
  * Load configuration with validation (throws if required fields missing)
347
316
  */
@@ -479,6 +448,38 @@ export class ConfigLoader {
479
448
  config.userEmail = email;
480
449
  await this.saveMultiProviderConfig(config);
481
450
  }
451
+ /**
452
+ * Keys that belong to WorkspaceConfig (repo/tooling-context) rather than to a
453
+ * ProviderProfile. Used to split a saved profile's input into its profile half
454
+ * and its workspace half — see splitProfileAndWorkspace().
455
+ */
456
+ static WORKSPACE_KEYS = [
457
+ 'codeMieUrl',
458
+ 'codeMieProject',
459
+ 'codeMieIntegration',
460
+ 'hooks',
461
+ 'plugins',
462
+ 'assistants',
463
+ 'skillsSearchUrl',
464
+ 'claudeAutocompactPct',
465
+ 'metrics'
466
+ ];
467
+ /**
468
+ * Partition a profile-shaped input into its provider-identity half and its
469
+ * workspace half, so callers that persist a profile can route each half to
470
+ * where it belongs (profiles[name] vs. the scope's workspace).
471
+ */
472
+ static splitProfileAndWorkspace(input) {
473
+ const profile = { ...input };
474
+ const workspace = {};
475
+ for (const key of this.WORKSPACE_KEYS) {
476
+ if (input[key] !== undefined) {
477
+ workspace[key] = input[key];
478
+ delete profile[key];
479
+ }
480
+ }
481
+ return { profile, workspace };
482
+ }
482
483
  /**
483
484
  * Add or update a profile
484
485
  */
@@ -486,8 +487,12 @@ export class ConfigLoader {
486
487
  const config = await this.loadMultiProviderConfig();
487
488
  // Strip top-level-only fields that must not live inside a profile
488
489
  const { codemieSkills: _skills, codemieAssistants: _assistants, ...cleanProfile } = profile;
489
- cleanProfile.name = profileName;
490
- config.profiles[profileName] = cleanProfile;
490
+ const { profile: profileFields, workspace: workspaceFields } = this.splitProfileAndWorkspace(cleanProfile);
491
+ profileFields.name = profileName;
492
+ config.profiles[profileName] = profileFields;
493
+ if (Object.keys(this.removeUndefined(workspaceFields)).length > 0) {
494
+ config.workspace = { ...config.workspace, ...workspaceFields };
495
+ }
491
496
  // If this is the first profile, make it active
492
497
  if (Object.keys(config.profiles).length === 1) {
493
498
  config.activeProfile = profileName;
@@ -710,26 +715,21 @@ export class ConfigLoader {
710
715
  await fs.mkdir(configDir, { recursive: true });
711
716
  // Create multi-provider config structure
712
717
  const profileName = overrides?.profileName || 'default';
713
- const profile = {};
714
- // Add overrides if provided
715
- if (overrides?.codeMieProject) {
716
- profile.codeMieProject = overrides.codeMieProject;
717
- }
718
- if (overrides?.codeMieIntegration) {
719
- profile.codeMieIntegration = overrides.codeMieIntegration;
720
- }
721
- // Add any other overrides
718
+ const rawOverrides = {};
719
+ // Collect all overrides (excluding the meta-only profileName key)
722
720
  for (const [key, value] of Object.entries(overrides || {})) {
723
- if (key !== 'profileName' && key !== 'codeMieProject' && key !== 'codeMieIntegration' && value !== undefined) {
724
- profile[key] = value;
721
+ if (key !== 'profileName' && value !== undefined) {
722
+ rawOverrides[key] = value;
725
723
  }
726
724
  }
725
+ const { profile, workspace } = this.splitProfileAndWorkspace(rawOverrides);
727
726
  const config = {
728
727
  version: 2,
729
728
  activeProfile: profileName,
730
729
  profiles: {
731
730
  [profileName]: profile
732
- }
731
+ },
732
+ ...(Object.keys(this.removeUndefined(workspace)).length > 0 ? { workspace } : {})
733
733
  };
734
734
  const configPath = path.join(configDir, 'codemie-cli.config.json');
735
735
  await fs.writeFile(configPath, JSON.stringify(config, null, 2), 'utf-8');
@@ -854,6 +854,8 @@ export class ConfigLoader {
854
854
  * Remove undefined values from object
855
855
  */
856
856
  static removeUndefined(obj) {
857
+ if (obj == null)
858
+ return {};
857
859
  return Object.fromEntries(Object.entries(obj).filter(([_, v]) => v !== undefined));
858
860
  }
859
861
  /**
@@ -958,15 +960,15 @@ export class ConfigLoader {
958
960
  const globalConfig = await this.loadGlobalConfigProfile(selectedProfileName);
959
961
  const localConfig = await this.loadLocalConfigProfile(workingDir, localProfileName);
960
962
  const applyProjectOnly = Boolean(selectedProfileName && localProfileName && selectedProfileName !== localProfileName);
961
- const selectedProfileDefinesProjectContext = Boolean(globalConfig.codeMieProject || globalConfig.codeMieIntegration);
962
- const preserveProjectContext = applyProjectOnly &&
963
- !selectedProfileDefinesProjectContext &&
964
- this.shouldPreserveProjectContext(localConfig.codeMieUrl, globalConfig.codeMieUrl);
965
- const effectiveLocalConfig = preserveProjectContext
966
- ? this.filterProjectFields(localConfig)
967
- : applyProjectOnly
968
- ? {}
969
- : localConfig;
963
+ const effectiveLocalConfig = applyProjectOnly ? {} : localConfig;
964
+ // Workspace (repo/tooling-context) fields resolve independently of profile
965
+ // selection — see resolveWorkspace(). Label the layer by which scope actually
966
+ // supplied it (mirrors resolveWorkspace()'s own local-else-global rule) rather
967
+ // than hardcoding 'project', so --show-sources doesn't misattribute a
968
+ // global-scope-only workspace value to the local config.
969
+ const localWorkspaceScope = await this.loadLocalMultiProviderConfig(workingDir);
970
+ const workspaceSource = localWorkspaceScope.workspace != null ? 'project' : 'global';
971
+ const workspace = await this.resolveWorkspace(workingDir);
970
972
  const configs = [
971
973
  {
972
974
  data: {
@@ -983,6 +985,10 @@ export class ConfigLoader {
983
985
  data: effectiveLocalConfig,
984
986
  source: 'project'
985
987
  },
988
+ {
989
+ data: workspace,
990
+ source: workspaceSource
991
+ },
986
992
  {
987
993
  data: this.loadFromEnv(),
988
994
  source: 'env'