@codemieai/code 0.0.36 → 0.0.37

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 (203) hide show
  1. package/README.md +33 -0
  2. package/dist/agents/codemie-code/tools/assistant-invocation.d.ts.map +1 -1
  3. package/dist/agents/codemie-code/tools/assistant-invocation.js +2 -2
  4. package/dist/agents/codemie-code/tools/assistant-invocation.js.map +1 -1
  5. package/dist/agents/core/extension/BaseExtensionInstaller.d.ts.map +1 -1
  6. package/dist/agents/core/extension/BaseExtensionInstaller.js +11 -4
  7. package/dist/agents/core/extension/BaseExtensionInstaller.js.map +1 -1
  8. package/dist/agents/core/session/BaseProcessor.d.ts +22 -1
  9. package/dist/agents/core/session/BaseProcessor.d.ts.map +1 -1
  10. package/dist/agents/plugins/claude/claude-acp.plugin.d.ts +5 -0
  11. package/dist/agents/plugins/claude/claude-acp.plugin.d.ts.map +1 -1
  12. package/dist/agents/plugins/claude/claude-acp.plugin.js +12 -2
  13. package/dist/agents/plugins/claude/claude-acp.plugin.js.map +1 -1
  14. package/dist/agents/plugins/claude/claude.plugin.d.ts.map +1 -1
  15. package/dist/agents/plugins/claude/claude.plugin.js +4 -0
  16. package/dist/agents/plugins/claude/claude.plugin.js.map +1 -1
  17. package/dist/agents/plugins/claude/claude.session.d.ts +5 -0
  18. package/dist/agents/plugins/claude/claude.session.d.ts.map +1 -1
  19. package/dist/agents/plugins/claude/claude.session.js +101 -2
  20. package/dist/agents/plugins/claude/claude.session.js.map +1 -1
  21. package/dist/agents/plugins/claude/plugin/.claude-plugin/plugin.json +1 -1
  22. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts +0 -1
  23. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.d.ts.map +1 -1
  24. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js +13 -19
  25. package/dist/agents/plugins/claude/session/processors/claude.conversations-processor.js.map +1 -1
  26. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.d.ts.map +1 -1
  27. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js +29 -4
  28. package/dist/agents/plugins/claude/session/processors/claude.metrics-processor.js.map +1 -1
  29. package/dist/cli/commands/assistants/chat.js +9 -6
  30. package/dist/cli/commands/assistants/chat.js.map +1 -1
  31. package/dist/cli/commands/assistants/constants.d.ts +2 -6
  32. package/dist/cli/commands/assistants/constants.d.ts.map +1 -1
  33. package/dist/cli/commands/assistants/constants.js +2 -5
  34. package/dist/cli/commands/assistants/constants.js.map +1 -1
  35. package/dist/cli/commands/assistants/index.d.ts.map +1 -1
  36. package/dist/cli/commands/assistants/index.js +1 -11
  37. package/dist/cli/commands/assistants/index.js.map +1 -1
  38. package/dist/cli/commands/assistants/setup/configuration/actions.d.ts +30 -0
  39. package/dist/cli/commands/assistants/setup/configuration/actions.d.ts.map +1 -0
  40. package/dist/cli/commands/assistants/setup/configuration/actions.js +63 -0
  41. package/dist/cli/commands/assistants/setup/configuration/actions.js.map +1 -0
  42. package/dist/cli/commands/assistants/setup/configuration/constants.d.ts +49 -0
  43. package/dist/cli/commands/assistants/setup/configuration/constants.d.ts.map +1 -0
  44. package/dist/cli/commands/assistants/setup/configuration/constants.js +56 -0
  45. package/dist/cli/commands/assistants/setup/configuration/constants.js.map +1 -0
  46. package/dist/cli/commands/assistants/setup/configuration/index.d.ts +9 -0
  47. package/dist/cli/commands/assistants/setup/configuration/index.d.ts.map +1 -0
  48. package/dist/cli/commands/assistants/setup/configuration/index.js +8 -0
  49. package/dist/cli/commands/assistants/setup/configuration/index.js.map +1 -0
  50. package/dist/cli/commands/assistants/setup/configuration/selection.d.ts +12 -0
  51. package/dist/cli/commands/assistants/setup/configuration/selection.d.ts.map +1 -0
  52. package/dist/cli/commands/assistants/setup/configuration/selection.js +94 -0
  53. package/dist/cli/commands/assistants/setup/configuration/selection.js.map +1 -0
  54. package/dist/cli/commands/assistants/setup/configuration/types.d.ts +22 -0
  55. package/dist/cli/commands/assistants/setup/configuration/types.d.ts.map +1 -0
  56. package/dist/cli/commands/assistants/setup/configuration/types.js +2 -0
  57. package/dist/cli/commands/assistants/setup/configuration/types.js.map +1 -0
  58. package/dist/cli/commands/assistants/setup/configuration/ui.d.ts +9 -0
  59. package/dist/cli/commands/assistants/setup/configuration/ui.d.ts.map +1 -0
  60. package/dist/cli/commands/assistants/setup/configuration/ui.js +86 -0
  61. package/dist/cli/commands/assistants/setup/configuration/ui.js.map +1 -0
  62. package/dist/cli/commands/assistants/setup/constants.d.ts +26 -0
  63. package/dist/cli/commands/assistants/setup/constants.d.ts.map +1 -0
  64. package/dist/cli/commands/assistants/setup/constants.js +21 -0
  65. package/dist/cli/commands/assistants/setup/constants.js.map +1 -0
  66. package/dist/cli/commands/assistants/setup/data.d.ts +30 -0
  67. package/dist/cli/commands/assistants/setup/data.d.ts.map +1 -0
  68. package/dist/cli/commands/assistants/setup/data.js +125 -0
  69. package/dist/cli/commands/assistants/setup/data.js.map +1 -0
  70. package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.d.ts.map +1 -0
  71. package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.js +6 -2
  72. package/dist/cli/commands/assistants/setup/generators/claude-agent-generator.js.map +1 -0
  73. package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts +12 -0
  74. package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.d.ts.map +1 -0
  75. package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js +94 -0
  76. package/dist/cli/commands/assistants/setup/generators/claude-skill-generator.js.map +1 -0
  77. package/dist/cli/commands/assistants/setup/helpers.d.ts +27 -0
  78. package/dist/cli/commands/assistants/setup/helpers.d.ts.map +1 -0
  79. package/dist/cli/commands/assistants/setup/helpers.js +94 -0
  80. package/dist/cli/commands/assistants/setup/helpers.js.map +1 -0
  81. package/dist/cli/commands/assistants/setup/index.d.ts +17 -0
  82. package/dist/cli/commands/assistants/setup/index.d.ts.map +1 -0
  83. package/dist/cli/commands/assistants/setup/index.js +193 -0
  84. package/dist/cli/commands/assistants/setup/index.js.map +1 -0
  85. package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts +47 -0
  86. package/dist/cli/commands/assistants/setup/manualConfiguration/actions.d.ts.map +1 -0
  87. package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js +140 -0
  88. package/dist/cli/commands/assistants/setup/manualConfiguration/actions.js.map +1 -0
  89. package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts +56 -0
  90. package/dist/cli/commands/assistants/setup/manualConfiguration/constants.d.ts.map +1 -0
  91. package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js +61 -0
  92. package/dist/cli/commands/assistants/setup/manualConfiguration/constants.js.map +1 -0
  93. package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts +12 -0
  94. package/dist/cli/commands/assistants/setup/manualConfiguration/index.d.ts.map +1 -0
  95. package/dist/cli/commands/assistants/setup/manualConfiguration/index.js +48 -0
  96. package/dist/cli/commands/assistants/setup/manualConfiguration/index.js.map +1 -0
  97. package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts +6 -0
  98. package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.d.ts.map +1 -0
  99. package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js +90 -0
  100. package/dist/cli/commands/assistants/setup/manualConfiguration/interactive-prompt.js.map +1 -0
  101. package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts +37 -0
  102. package/dist/cli/commands/assistants/setup/manualConfiguration/types.d.ts.map +1 -0
  103. package/dist/cli/commands/assistants/setup/manualConfiguration/types.js +2 -0
  104. package/dist/cli/commands/assistants/setup/manualConfiguration/types.js.map +1 -0
  105. package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts +6 -0
  106. package/dist/cli/commands/assistants/setup/manualConfiguration/ui.d.ts.map +1 -0
  107. package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js +103 -0
  108. package/dist/cli/commands/assistants/setup/manualConfiguration/ui.js.map +1 -0
  109. package/dist/cli/commands/assistants/setup/selection/actions.d.ts +31 -0
  110. package/dist/cli/commands/assistants/setup/selection/actions.d.ts.map +1 -0
  111. package/dist/cli/commands/assistants/setup/selection/actions.js +321 -0
  112. package/dist/cli/commands/assistants/setup/selection/actions.js.map +1 -0
  113. package/dist/cli/commands/assistants/setup/selection/constants.d.ts +79 -0
  114. package/dist/cli/commands/assistants/setup/selection/constants.d.ts.map +1 -0
  115. package/dist/cli/commands/assistants/setup/selection/constants.js +90 -0
  116. package/dist/cli/commands/assistants/setup/selection/constants.js.map +1 -0
  117. package/dist/cli/commands/assistants/setup/selection/index.d.ts +25 -0
  118. package/dist/cli/commands/assistants/setup/selection/index.d.ts.map +1 -0
  119. package/dist/cli/commands/assistants/setup/selection/index.js +127 -0
  120. package/dist/cli/commands/assistants/setup/selection/index.js.map +1 -0
  121. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts +20 -0
  122. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.d.ts.map +1 -0
  123. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js +328 -0
  124. package/dist/cli/commands/assistants/setup/selection/interactive-prompt.js.map +1 -0
  125. package/dist/cli/commands/assistants/setup/selection/types.d.ts +27 -0
  126. package/dist/cli/commands/assistants/setup/selection/types.d.ts.map +1 -0
  127. package/dist/cli/commands/assistants/setup/selection/types.js +2 -0
  128. package/dist/cli/commands/assistants/setup/selection/types.js.map +1 -0
  129. package/dist/cli/commands/assistants/setup/selection/ui.d.ts +11 -0
  130. package/dist/cli/commands/assistants/setup/selection/ui.d.ts.map +1 -0
  131. package/dist/cli/commands/assistants/setup/selection/ui.js +189 -0
  132. package/dist/cli/commands/assistants/setup/selection/ui.js.map +1 -0
  133. package/dist/cli/commands/assistants/setup/selection/utils.d.ts +36 -0
  134. package/dist/cli/commands/assistants/setup/selection/utils.d.ts.map +1 -0
  135. package/dist/cli/commands/assistants/setup/selection/utils.js +55 -0
  136. package/dist/cli/commands/assistants/setup/selection/utils.js.map +1 -0
  137. package/dist/cli/commands/assistants/setup/summary/index.d.ts +16 -0
  138. package/dist/cli/commands/assistants/setup/summary/index.d.ts.map +1 -0
  139. package/dist/cli/commands/assistants/setup/summary/index.js +48 -0
  140. package/dist/cli/commands/assistants/setup/summary/index.js.map +1 -0
  141. package/dist/cli/commands/log/cleaner.d.ts +33 -0
  142. package/dist/cli/commands/log/cleaner.d.ts.map +1 -0
  143. package/dist/cli/commands/log/cleaner.js +214 -0
  144. package/dist/cli/commands/log/cleaner.js.map +1 -0
  145. package/dist/cli/commands/log/filter.d.ts +55 -0
  146. package/dist/cli/commands/log/filter.d.ts.map +1 -0
  147. package/dist/cli/commands/log/filter.js +128 -0
  148. package/dist/cli/commands/log/filter.js.map +1 -0
  149. package/dist/cli/commands/log/follower.d.ts +36 -0
  150. package/dist/cli/commands/log/follower.d.ts.map +1 -0
  151. package/dist/cli/commands/log/follower.js +151 -0
  152. package/dist/cli/commands/log/follower.js.map +1 -0
  153. package/dist/cli/commands/log/formatter.d.ts +76 -0
  154. package/dist/cli/commands/log/formatter.d.ts.map +1 -0
  155. package/dist/cli/commands/log/formatter.js +261 -0
  156. package/dist/cli/commands/log/formatter.js.map +1 -0
  157. package/dist/cli/commands/log/index.d.ts +6 -0
  158. package/dist/cli/commands/log/index.d.ts.map +1 -0
  159. package/dist/cli/commands/log/index.js +398 -0
  160. package/dist/cli/commands/log/index.js.map +1 -0
  161. package/dist/cli/commands/log/parser.d.ts +20 -0
  162. package/dist/cli/commands/log/parser.d.ts.map +1 -0
  163. package/dist/cli/commands/log/parser.js +111 -0
  164. package/dist/cli/commands/log/parser.js.map +1 -0
  165. package/dist/cli/commands/log/reader.d.ts +61 -0
  166. package/dist/cli/commands/log/reader.d.ts.map +1 -0
  167. package/dist/cli/commands/log/reader.js +327 -0
  168. package/dist/cli/commands/log/reader.js.map +1 -0
  169. package/dist/cli/commands/log/types.d.ts +100 -0
  170. package/dist/cli/commands/log/types.d.ts.map +1 -0
  171. package/dist/cli/commands/log/types.js +5 -0
  172. package/dist/cli/commands/log/types.js.map +1 -0
  173. package/dist/cli/commands/setup.d.ts.map +1 -1
  174. package/dist/cli/commands/setup.js +2 -0
  175. package/dist/cli/commands/setup.js.map +1 -1
  176. package/dist/cli/index.js +2 -0
  177. package/dist/cli/index.js.map +1 -1
  178. package/dist/env/types.d.ts +1 -0
  179. package/dist/env/types.d.ts.map +1 -1
  180. package/dist/env/types.js.map +1 -1
  181. package/dist/providers/plugins/sso/session/SessionSyncer.d.ts +5 -0
  182. package/dist/providers/plugins/sso/session/SessionSyncer.d.ts.map +1 -1
  183. package/dist/providers/plugins/sso/session/SessionSyncer.js +102 -3
  184. package/dist/providers/plugins/sso/session/SessionSyncer.js.map +1 -1
  185. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts +0 -1
  186. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.d.ts.map +1 -1
  187. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js +25 -48
  188. package/dist/providers/plugins/sso/session/processors/conversations/conversation-sync-processor.js.map +1 -1
  189. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.d.ts.map +1 -1
  190. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js +8 -34
  191. package/dist/providers/plugins/sso/session/processors/metrics/metrics-sync-processor.js.map +1 -1
  192. package/dist/utils/native-installer.d.ts +1 -0
  193. package/dist/utils/native-installer.d.ts.map +1 -1
  194. package/dist/utils/native-installer.js +21 -7
  195. package/dist/utils/native-installer.js.map +1 -1
  196. package/package.json +2 -2
  197. package/dist/cli/commands/assistants/generators/claude-agent-generator.d.ts.map +0 -1
  198. package/dist/cli/commands/assistants/generators/claude-agent-generator.js.map +0 -1
  199. package/dist/cli/commands/assistants/list.d.ts +0 -11
  200. package/dist/cli/commands/assistants/list.d.ts.map +0 -1
  201. package/dist/cli/commands/assistants/list.js +0 -323
  202. package/dist/cli/commands/assistants/list.js.map +0 -1
  203. /package/dist/cli/commands/assistants/{generators → setup/generators}/claude-agent-generator.d.ts +0 -0
@@ -0,0 +1,189 @@
1
+ /**
2
+ * UI Rendering
3
+ *
4
+ * All UI building and rendering functions
5
+ */
6
+ import chalk from 'chalk';
7
+ import { ANSI, BOX, SYMBOL, TEXT, CONFIG, PAGINATION_CONTROL } from './constants.js';
8
+ import { COLOR } from '../constants.js';
9
+ /**
10
+ * Render the complete UI
11
+ */
12
+ export function renderUI(state, cursorIndex) {
13
+ const activePanel = state.panels.find(p => p.id === state.activePanelId);
14
+ let output = '';
15
+ output += ANSI.CURSOR_HOME_CLEAR;
16
+ output += buildTopLine();
17
+ output += buildPanelHeader(state.panels, state.activePanelId);
18
+ output += buildCount(activePanel);
19
+ output += buildSearchInput(state.searchQuery, state.isSearchFocused);
20
+ output += buildAssistantsList(activePanel, state.selectedIds, state.isSearchFocused, cursorIndex, state.isPaginationFocused);
21
+ output += buildPaginationControls(activePanel, state.isPaginationFocused, state.isSearchFocused);
22
+ output += buildButtons(state);
23
+ output += buildInstructions(activePanel);
24
+ return output;
25
+ }
26
+ /**
27
+ * Build top line spanning terminal width
28
+ */
29
+ function buildTopLine() {
30
+ const width = process.stdout.columns || 80;
31
+ const line = BOX.HORIZONTAL.repeat(width);
32
+ return chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(line) + '\n';
33
+ }
34
+ /**
35
+ * Build panel navigation header with hint
36
+ */
37
+ function buildPanelHeader(panels, activeId) {
38
+ const panelStrings = panels.map(panel => {
39
+ if (panel.id === activeId) {
40
+ return chalk.bgRgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).black(` ${panel.label} `);
41
+ }
42
+ return chalk.white(panel.label);
43
+ });
44
+ const label = chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(TEXT.LABEL);
45
+ const panelsLine = panelStrings.join(' ');
46
+ const hint = chalk.dim(TEXT.TAB_HINT);
47
+ return `${label} ${panelsLine} ${hint}\n\n`;
48
+ }
49
+ /**
50
+ * Build count above search box
51
+ */
52
+ function buildCount(activePanel) {
53
+ if (activePanel.filteredData.length === 0) {
54
+ return chalk.dim('0 assistants total, Page 1 of 1') + '\n';
55
+ }
56
+ const currentPage = activePanel.currentPage + 1; // Display as 1-indexed
57
+ const totalPages = activePanel.totalPages;
58
+ const totalAssistants = activePanel.totalItems;
59
+ return chalk.dim(`${totalAssistants} assistants total, Page ${currentPage} of ${totalPages}`) + '\n';
60
+ }
61
+ /**
62
+ * Build search input display with box
63
+ */
64
+ function buildSearchInput(query, isFocused) {
65
+ const width = process.stdout.columns || 80;
66
+ const innerWidth = width - 2;
67
+ const prefix = ` ${SYMBOL.SEARCH_ICON} `;
68
+ const contentText = query
69
+ ? (isFocused ? query + SYMBOL.CURSOR : query)
70
+ : TEXT.SEARCH_PLACEHOLDER;
71
+ const visualLength = prefix.length + contentText.length;
72
+ const paddingNeeded = innerWidth - visualLength;
73
+ const styledCursor = chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(SYMBOL.CURSOR);
74
+ const styledPlaceholder = chalk.dim(TEXT.SEARCH_PLACEHOLDER);
75
+ const displayText = query
76
+ ? (isFocused ? query + styledCursor : query)
77
+ : styledPlaceholder;
78
+ const contentLine = prefix + displayText + ' '.repeat(Math.max(0, paddingNeeded));
79
+ const borderColor = isFocused
80
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)
81
+ : chalk.white;
82
+ let output = '';
83
+ output += borderColor(BOX.TOP_LEFT + BOX.HORIZONTAL.repeat(innerWidth) + BOX.TOP_RIGHT) + '\n';
84
+ output += borderColor(BOX.VERTICAL) + contentLine + borderColor(BOX.VERTICAL) + '\n';
85
+ output += borderColor(BOX.BOTTOM_LEFT + BOX.HORIZONTAL.repeat(innerWidth) + BOX.BOTTOM_RIGHT) + '\n\n';
86
+ return output;
87
+ }
88
+ function buildAssistantsList(activePanel, selectedIds, isSearchFocused, cursorIndex, isPaginationFocused) {
89
+ const isMarketplace = activePanel.id === 'marketplace';
90
+ if (activePanel.isFetching) {
91
+ return chalk.cyan('Loading assistants...\n');
92
+ }
93
+ if (activePanel.error) {
94
+ return chalk.red(TEXT.ERROR_PREFIX + activePanel.error + '\n');
95
+ }
96
+ if (activePanel.filteredData.length === 0) {
97
+ return chalk.yellow(TEXT.NO_ASSISTANTS + '\n');
98
+ }
99
+ const displayAssistants = activePanel.filteredData;
100
+ let output = '';
101
+ displayAssistants.forEach((assistant, index) => {
102
+ const isSelected = selectedIds.has(assistant.id);
103
+ const isCursor = index === cursorIndex && !isSearchFocused && isPaginationFocused === null;
104
+ const circle = isSelected
105
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(SYMBOL.CIRCLE_FILLED)
106
+ : SYMBOL.CIRCLE_EMPTY;
107
+ const cursor = isCursor
108
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(SYMBOL.CURSOR_INDICATOR)
109
+ : ' ';
110
+ const name = isCursor
111
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(assistant.name)
112
+ : assistant.name;
113
+ const projectValue = 'project' in assistant ? assistant.project : null;
114
+ const projectName = projectValue
115
+ ? (typeof projectValue === 'object' ? projectValue.name : projectValue)
116
+ : null;
117
+ const project = projectName
118
+ ? chalk.dim(` · ${projectName}`)
119
+ : '';
120
+ const uniqueUsers = isMarketplace && 'unique_users_count' in assistant && assistant.unique_users_count !== undefined
121
+ ? chalk.dim(` · ⚭ ${assistant.unique_users_count} uses`)
122
+ : '';
123
+ output += `${cursor}${circle} ${name}${project}${uniqueUsers}\n`;
124
+ if (assistant.description) {
125
+ const singleLine = assistant.description.replace(/\n+/g, ' ');
126
+ const desc = singleLine.length > CONFIG.DESCRIPTION_MAX_LENGTH
127
+ ? singleLine.substring(0, CONFIG.DESCRIPTION_MAX_LENGTH) + SYMBOL.TRUNCATION
128
+ : singleLine;
129
+ output += chalk.dim(` ${desc}`) + '\n';
130
+ }
131
+ output += '\n';
132
+ });
133
+ return output;
134
+ }
135
+ function buildPaginationControls(activePanel, isPaginationFocused, isSearchFocused) {
136
+ const totalPages = activePanel.totalPages;
137
+ if (totalPages <= 1) {
138
+ return '';
139
+ }
140
+ const currentPage = activePanel.currentPage;
141
+ const hasPrev = currentPage > 0;
142
+ const hasNext = currentPage < totalPages - 1;
143
+ const prevLabel = hasPrev ? '[< Prev]' : '[< Prev]';
144
+ const prevCursor = isPaginationFocused === PAGINATION_CONTROL.PREV && !isSearchFocused
145
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(SYMBOL.CURSOR_INDICATOR)
146
+ : ' ';
147
+ const prevText = isPaginationFocused === PAGINATION_CONTROL.PREV && !isSearchFocused
148
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(prevLabel)
149
+ : hasPrev
150
+ ? chalk.white(prevLabel)
151
+ : chalk.dim(prevLabel);
152
+ const nextLabel = hasNext ? '[Next >]' : '[Next >]';
153
+ const nextCursor = isPaginationFocused === PAGINATION_CONTROL.NEXT && !isSearchFocused
154
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b)(SYMBOL.CURSOR_INDICATOR)
155
+ : ' ';
156
+ const nextText = isPaginationFocused === PAGINATION_CONTROL.NEXT && !isSearchFocused
157
+ ? chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).bold(nextLabel)
158
+ : hasNext
159
+ ? chalk.white(nextLabel)
160
+ : chalk.dim(nextLabel);
161
+ const label = chalk.dim('Switch page:');
162
+ return `${label} ${prevCursor}${prevText} ${nextCursor}${nextText}\n\n`;
163
+ }
164
+ /**
165
+ * Build buttons (Continue / Cancel)
166
+ */
167
+ function buildButtons(state) {
168
+ const { areNavigationButtonsFocused, focusedButton, isSearchFocused, isPaginationFocused } = state;
169
+ const buttonsActive = areNavigationButtonsFocused && !isSearchFocused && isPaginationFocused === null;
170
+ const continueButton = buttonsActive && focusedButton === 'continue'
171
+ ? chalk.bgRgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).black(` ${TEXT.CONTINUE_BUTTON} `)
172
+ : chalk.dim(`[${TEXT.CONTINUE_BUTTON}]`);
173
+ const cancelButton = buttonsActive && focusedButton === 'cancel'
174
+ ? chalk.bgRgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b).black(` ${TEXT.CANCEL_BUTTON} `)
175
+ : chalk.dim(`[${TEXT.CANCEL_BUTTON}]`);
176
+ return ` ${continueButton} ${cancelButton}\n\n`;
177
+ }
178
+ /**
179
+ * Build keyboard instructions
180
+ */
181
+ function buildInstructions(activePanel) {
182
+ const totalPages = activePanel.totalPages;
183
+ const hasMultiplePages = totalPages > 1;
184
+ const instructionsText = hasMultiplePages
185
+ ? TEXT.INSTRUCTIONS_WITH_PAGINATION
186
+ : TEXT.INSTRUCTIONS;
187
+ return chalk.dim(instructionsText + '\n');
188
+ }
189
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/ui.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,kBAAkB,EAAwC,MAAM,gBAAgB,CAAC;AAC3H,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAqB,EAAE,WAAmB;IACjE,MAAM,WAAW,GAA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,IAAI,CAAC,eAAe,GAAG,CAAC;QAChG,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IAE3C,MAAM,YAAY,GAAG,aAAa,IAAI,aAAa,KAAK,QAAQ;QAC9D,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC;QAC9F,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;IAEzC,OAAO,KAAK,cAAc,KAAK,YAAY,MAAM,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,SAAS,iBAAiB,CAAC,WAAuB;IAChD,MAAM,UAAU,GAAG,WAAW,CAAC,UAAU,CAAC;IAC1C,MAAM,gBAAgB,GAAG,UAAU,GAAG,CAAC,CAAC;IAExC,MAAM,gBAAgB,GAAG,gBAAgB;QACvC,CAAC,CAAC,IAAI,CAAC,4BAA4B;QACnC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC;IAEtB,OAAO,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Selection Helper Utilities
3
+ *
4
+ * Handles choice building, filtering, sorting, and display formatting
5
+ */
6
+ import type { Assistant, AssistantBase } from 'codemie-sdk';
7
+ import type { ProviderProfile } from '../../../../../env/types.js';
8
+ export interface AssistantChoice {
9
+ name: string;
10
+ value: string;
11
+ short: string;
12
+ checked: boolean;
13
+ }
14
+ /**
15
+ * Build display info for assistant choice
16
+ */
17
+ export declare function buildAssistantDisplayInfo(assistant: Assistant): string;
18
+ /**
19
+ * Create assistant choices for selection prompt
20
+ */
21
+ export declare function createAssistantChoices(assistants: (Assistant | AssistantBase)[], registeredIds: Set<string>): AssistantChoice[];
22
+ /**
23
+ * Display message when no assistants are found
24
+ */
25
+ export declare function displayNoAssistantsMessage(options: {
26
+ project?: string;
27
+ allProjects?: boolean;
28
+ }, config: ProviderProfile): void;
29
+ /**
30
+ * Get project filter from options or config
31
+ */
32
+ export declare function getProjectFilter(options: {
33
+ project?: string;
34
+ allProjects?: boolean;
35
+ }, config: ProviderProfile): string | undefined;
36
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAStE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,CAAC,SAAS,GAAG,aAAa,CAAC,EAAE,EACzC,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GACzB,eAAe,EAAE,CAanB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EACpD,MAAM,EAAE,eAAe,GACtB,IAAI,CAQN;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EACpD,MAAM,EAAE,eAAe,GACtB,MAAM,GAAG,SAAS,CAKpB"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Selection Helper Utilities
3
+ *
4
+ * Handles choice building, filtering, sorting, and display formatting
5
+ */
6
+ import chalk from 'chalk';
7
+ import { MESSAGES } from '../../../../../cli/commands/assistants/constants.js';
8
+ /**
9
+ * Build display info for assistant choice
10
+ */
11
+ export function buildAssistantDisplayInfo(assistant) {
12
+ const project = assistant.project;
13
+ const projectName = project && typeof project === 'object' ? project.name : project;
14
+ const projectInfo = projectName ? chalk.dim(` [${projectName}]`) : '';
15
+ const firstLine = assistant.name + projectInfo;
16
+ const descriptionInfo = assistant.description ? chalk.dim(`\n ${assistant.description}`) : '';
17
+ return firstLine + descriptionInfo;
18
+ }
19
+ /**
20
+ * Create assistant choices for selection prompt
21
+ */
22
+ export function createAssistantChoices(assistants, registeredIds) {
23
+ return assistants.map(assistant => {
24
+ const a = assistant;
25
+ const isRegistered = registeredIds.has(a.id);
26
+ const displayName = buildAssistantDisplayInfo(a);
27
+ return {
28
+ name: displayName,
29
+ value: a.id,
30
+ short: a.name,
31
+ checked: isRegistered
32
+ };
33
+ });
34
+ }
35
+ /**
36
+ * Display message when no assistants are found
37
+ */
38
+ export function displayNoAssistantsMessage(options, config) {
39
+ console.log(chalk.yellow(MESSAGES.SETUP.NO_ASSISTANTS));
40
+ const filterProject = options.project || config.codeMieProject;
41
+ if (filterProject && !options.allProjects) {
42
+ console.log(chalk.dim(MESSAGES.SETUP.FILTERED_BY_PROJECT(chalk.cyan(filterProject))));
43
+ console.log(chalk.dim(`Try ${chalk.cyan(MESSAGES.SETUP.TRY_ALL_PROJECTS)}${MESSAGES.SETUP.HINT_TRY_ALL}`));
44
+ }
45
+ }
46
+ /**
47
+ * Get project filter from options or config
48
+ */
49
+ export function getProjectFilter(options, config) {
50
+ if (options.allProjects) {
51
+ return undefined;
52
+ }
53
+ return options.project || config.codeMieProject;
54
+ }
55
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/selection/utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AASlE;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,SAAoB;IAC5D,MAAM,OAAO,GAAG,SAAS,CAAC,OAAO,CAAC;IAClC,MAAM,WAAW,GAAG,OAAO,IAAI,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAE,OAA4B,CAAC,IAAI,CAAC,CAAC,CAAC,OAA6B,CAAC;IAChI,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,WAAW,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACtE,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,GAAG,WAAW,CAAC;IAE/C,MAAM,eAAe,GAAG,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,SAAS,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEhG,OAAO,SAAS,GAAG,eAAe,CAAC;AACrC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,sBAAsB,CACpC,UAAyC,EACzC,aAA0B;IAE1B,OAAO,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE;QAChC,MAAM,CAAC,GAAG,SAAsB,CAAC;QACjC,MAAM,YAAY,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAC7C,MAAM,WAAW,GAAG,yBAAyB,CAAC,CAAC,CAAC,CAAC;QAEjD,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,CAAC,CAAC,EAAE;YACX,KAAK,EAAE,CAAC,CAAC,IAAI;YACb,OAAO,EAAE,YAAY;SACtB,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACxC,OAAoD,EACpD,MAAuB;IAEvB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;IAExD,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,cAAc,CAAC;IAC/D,IAAI,aAAa,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QAC1C,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;QACtF,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,gBAAgB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;IAC7G,CAAC;AACH,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAoD,EACpD,MAAuB;IAEvB,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;QACxB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,cAAc,CAAC;AAClD,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Summary Display Functions
3
+ *
4
+ * Functions for displaying registration summaries and currently registered assistants
5
+ */
6
+ import type { Assistant } from 'codemie-sdk';
7
+ import type { CodemieAssistant, ProviderProfile } from '../../../../../env/types.js';
8
+ /**
9
+ * Display summary of changes
10
+ */
11
+ export declare function displaySummary(toRegister: Assistant[], toUnregister: CodemieAssistant[], profileName: string, config: ProviderProfile): void;
12
+ /**
13
+ * Display currently registered assistants
14
+ */
15
+ export declare function displayCurrentlyRegistered(config: ProviderProfile): void;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/summary/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAKxE;;GAEG;AACH,wBAAgB,cAAc,CAC5B,UAAU,EAAE,SAAS,EAAE,EACvB,YAAY,EAAE,gBAAgB,EAAE,EAChC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,GACtB,IAAI,CAMN;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CA8BxE"}
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Summary Display Functions
3
+ *
4
+ * Functions for displaying registration summaries and currently registered assistants
5
+ */
6
+ import chalk from 'chalk';
7
+ import { MESSAGES } from '../../../../../cli/commands/assistants/constants.js';
8
+ import { REGISTRATION_MODE } from '../../../../../cli/commands/assistants/setup/manualConfiguration/constants.js';
9
+ import { COLOR } from '../constants.js';
10
+ /**
11
+ * Display summary of changes
12
+ */
13
+ export function displaySummary(toRegister, toUnregister, profileName, config) {
14
+ const totalChanges = toRegister.length + toUnregister.length;
15
+ console.log(chalk.green(MESSAGES.SETUP.SUMMARY_UPDATED(totalChanges)));
16
+ console.log(chalk.dim(MESSAGES.SETUP.SUMMARY_PROFILE(profileName)));
17
+ displayCurrentlyRegistered(config);
18
+ }
19
+ /**
20
+ * Display currently registered assistants
21
+ */
22
+ export function displayCurrentlyRegistered(config) {
23
+ if (!config.codemieAssistants || config.codemieAssistants.length === 0) {
24
+ return;
25
+ }
26
+ const purpleColor = chalk.rgb(COLOR.PURPLE.r, COLOR.PURPLE.g, COLOR.PURPLE.b);
27
+ const purpleLine = purpleColor('─'.repeat(60));
28
+ console.log('');
29
+ console.log(purpleLine);
30
+ console.log(chalk.bold('Registered assistants:'));
31
+ console.log('');
32
+ config.codemieAssistants.forEach((assistant) => {
33
+ const mode = assistant.registrationMode || REGISTRATION_MODE.AGENT;
34
+ // Build location info based on registration mode
35
+ let locationInfo = '';
36
+ if (mode === REGISTRATION_MODE.AGENT) {
37
+ locationInfo = chalk.dim(` (@${assistant.slug} in code or claude)`);
38
+ }
39
+ else if (mode === REGISTRATION_MODE.SKILL) {
40
+ locationInfo = chalk.dim(` (/${assistant.slug} in claude or @${assistant.slug} in code)`);
41
+ }
42
+ console.log(` • ${purpleColor(assistant.slug)} - ${assistant.name}${locationInfo}`);
43
+ });
44
+ console.log('');
45
+ console.log(purpleLine);
46
+ console.log('');
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/cli/commands/assistants/setup/summary/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kEAAkE,CAAC;AACrG,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC;;GAEG;AACH,MAAM,UAAU,cAAc,CAC5B,UAAuB,EACvB,YAAgC,EAChC,WAAmB,EACnB,MAAuB;IAEvB,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,GAAG,YAAY,CAAC,MAAM,CAAC;IAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,eAAe,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACvE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,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C,MAAM,SAAS,CAAC,IAAI,kBAAkB,SAAS,CAAC,IAAI,WAAW,CAAC,CAAC;QAC5F,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,SAAS,CAAC,IAAI,GAAG,YAAY,EAAE,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IACxB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AAClB,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Log cleaner - Cleanup old logs and sessions
3
+ */
4
+ import type { CleanupStats } from './types.js';
5
+ /**
6
+ * Clean up old log files and sessions
7
+ */
8
+ export declare class LogCleaner {
9
+ private logsDir;
10
+ private sessionsDir;
11
+ constructor(logsDir?: string, sessionsDir?: string);
12
+ /**
13
+ * Clean old files
14
+ */
15
+ clean(retentionDays: number, includeSessions: boolean, dryRun: boolean): CleanupStats;
16
+ /**
17
+ * Clean debug log files
18
+ */
19
+ private cleanDebugLogs;
20
+ /**
21
+ * Clean session files
22
+ */
23
+ private cleanSessions;
24
+ /**
25
+ * Get total size of all log files
26
+ */
27
+ getLogsSize(): number;
28
+ /**
29
+ * Get total size of all session files
30
+ */
31
+ getSessionsSize(): number;
32
+ }
33
+ //# sourceMappingURL=cleaner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleaner.d.ts","sourceRoot":"","sources":["../../../../src/cli/commands/log/cleaner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,CAAC,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IAKlD;;OAEG;IACH,KAAK,CAAC,aAAa,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,YAAY;IAoBrF;;OAEG;IACH,OAAO,CAAC,cAAc;IA6CtB;;OAEG;IACH,OAAO,CAAC,aAAa;IAuFrB;;OAEG;IACH,WAAW,IAAI,MAAM;IAyBrB;;OAEG;IACH,eAAe,IAAI,MAAM;CAwB1B"}
@@ -0,0 +1,214 @@
1
+ /**
2
+ * Log cleaner - Cleanup old logs and sessions
3
+ */
4
+ import { readdirSync, statSync, unlinkSync, existsSync } from 'fs';
5
+ import { join } from 'path';
6
+ import { getCodemiePath } from '../../../utils/paths.js';
7
+ /**
8
+ * Clean up old log files and sessions
9
+ */
10
+ export class LogCleaner {
11
+ logsDir;
12
+ sessionsDir;
13
+ constructor(logsDir, sessionsDir) {
14
+ this.logsDir = logsDir || getCodemiePath('logs');
15
+ this.sessionsDir = sessionsDir || getCodemiePath('sessions');
16
+ }
17
+ /**
18
+ * Clean old files
19
+ */
20
+ clean(retentionDays, includeSessions, dryRun) {
21
+ const stats = {
22
+ debugLogsDeleted: 0,
23
+ sessionsDeleted: 0,
24
+ bytesFreed: 0
25
+ };
26
+ const cutoffTime = Date.now() - (retentionDays * 24 * 60 * 60 * 1000);
27
+ // Clean debug logs
28
+ this.cleanDebugLogs(cutoffTime, dryRun, stats);
29
+ // Clean sessions if requested
30
+ if (includeSessions) {
31
+ this.cleanSessions(cutoffTime, dryRun, stats);
32
+ }
33
+ return stats;
34
+ }
35
+ /**
36
+ * Clean debug log files
37
+ */
38
+ cleanDebugLogs(cutoffTime, dryRun, stats) {
39
+ try {
40
+ if (!existsSync(this.logsDir)) {
41
+ return;
42
+ }
43
+ const files = readdirSync(this.logsDir);
44
+ for (const file of files) {
45
+ // Only process debug log files
46
+ if (!file.match(/^debug-\d{4}-\d{2}-\d{2}\.log$/)) {
47
+ continue;
48
+ }
49
+ const filePath = join(this.logsDir, file);
50
+ try {
51
+ const fileStats = statSync(filePath);
52
+ // Track oldest/newest file dates
53
+ if (!stats.oldestFileDate || fileStats.mtimeMs < stats.oldestFileDate.getTime()) {
54
+ stats.oldestFileDate = new Date(fileStats.mtimeMs);
55
+ }
56
+ if (!stats.newestFileDate || fileStats.mtimeMs > stats.newestFileDate.getTime()) {
57
+ stats.newestFileDate = new Date(fileStats.mtimeMs);
58
+ }
59
+ // Check if file is old enough to delete
60
+ if (fileStats.mtimeMs < cutoffTime) {
61
+ stats.bytesFreed += fileStats.size;
62
+ stats.debugLogsDeleted++;
63
+ if (!dryRun) {
64
+ unlinkSync(filePath);
65
+ }
66
+ }
67
+ }
68
+ catch {
69
+ // Skip files we can't access
70
+ }
71
+ }
72
+ }
73
+ catch {
74
+ // Logs directory doesn't exist or can't be read
75
+ }
76
+ }
77
+ /**
78
+ * Clean session files
79
+ */
80
+ cleanSessions(cutoffTime, dryRun, stats) {
81
+ try {
82
+ if (!existsSync(this.sessionsDir)) {
83
+ return;
84
+ }
85
+ const files = readdirSync(this.sessionsDir);
86
+ // UUID pattern for session IDs
87
+ const uuidPattern = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/;
88
+ // Group files by session ID
89
+ const sessionFiles = new Map();
90
+ for (const file of files) {
91
+ // Skip non-session files
92
+ if (!file.endsWith('.json') && !file.endsWith('.jsonl'))
93
+ continue;
94
+ // Extract session ID from filename
95
+ // Patterns: <uuid>.json, completed_<uuid>.json, <uuid>_metrics.jsonl, <uuid>_conversation.jsonl
96
+ let sessionId = null;
97
+ if (file.match(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\.json$/)) {
98
+ // UUID.json
99
+ sessionId = file.replace('.json', '');
100
+ }
101
+ else if (file.match(/^completed_[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\.json$/)) {
102
+ // completed_UUID.json
103
+ sessionId = file.replace('completed_', '').replace('.json', '');
104
+ }
105
+ else if (file.match(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}_metrics\.jsonl$/)) {
106
+ // UUID_metrics.jsonl
107
+ sessionId = file.replace('_metrics.jsonl', '');
108
+ }
109
+ else if (file.match(/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}_conversation\.jsonl$/)) {
110
+ // UUID_conversation.jsonl
111
+ sessionId = file.replace('_conversation.jsonl', '');
112
+ }
113
+ // Only process files with valid UUID session IDs
114
+ if (!sessionId || !uuidPattern.test(sessionId))
115
+ continue;
116
+ if (!sessionFiles.has(sessionId)) {
117
+ sessionFiles.set(sessionId, []);
118
+ }
119
+ sessionFiles.get(sessionId).push(file);
120
+ }
121
+ // Check each session
122
+ for (const [sessionId, files] of sessionFiles.entries()) {
123
+ const sessionFile = join(this.sessionsDir, `${sessionId}.json`);
124
+ try {
125
+ const fileStats = statSync(sessionFile);
126
+ // Track oldest/newest session dates
127
+ if (!stats.oldestFileDate || fileStats.mtimeMs < stats.oldestFileDate.getTime()) {
128
+ stats.oldestFileDate = new Date(fileStats.mtimeMs);
129
+ }
130
+ if (!stats.newestFileDate || fileStats.mtimeMs > stats.newestFileDate.getTime()) {
131
+ stats.newestFileDate = new Date(fileStats.mtimeMs);
132
+ }
133
+ // Check if session is old enough to delete
134
+ if (fileStats.mtimeMs < cutoffTime) {
135
+ // Delete all files associated with this session
136
+ for (const file of files) {
137
+ const filePath = join(this.sessionsDir, file);
138
+ try {
139
+ const fileStats = statSync(filePath);
140
+ stats.bytesFreed += fileStats.size;
141
+ if (!dryRun) {
142
+ unlinkSync(filePath);
143
+ }
144
+ }
145
+ catch {
146
+ // Skip files we can't delete
147
+ }
148
+ }
149
+ stats.sessionsDeleted++;
150
+ }
151
+ }
152
+ catch {
153
+ // Session metadata file doesn't exist or can't be read
154
+ }
155
+ }
156
+ }
157
+ catch {
158
+ // Sessions directory doesn't exist or can't be read
159
+ }
160
+ }
161
+ /**
162
+ * Get total size of all log files
163
+ */
164
+ getLogsSize() {
165
+ let totalBytes = 0;
166
+ try {
167
+ if (!existsSync(this.logsDir)) {
168
+ return 0;
169
+ }
170
+ const files = readdirSync(this.logsDir);
171
+ for (const file of files) {
172
+ const filePath = join(this.logsDir, file);
173
+ try {
174
+ const stats = statSync(filePath);
175
+ totalBytes += stats.size;
176
+ }
177
+ catch {
178
+ // Skip files we can't stat
179
+ }
180
+ }
181
+ }
182
+ catch {
183
+ // Directory doesn't exist
184
+ }
185
+ return totalBytes;
186
+ }
187
+ /**
188
+ * Get total size of all session files
189
+ */
190
+ getSessionsSize() {
191
+ let totalBytes = 0;
192
+ try {
193
+ if (!existsSync(this.sessionsDir)) {
194
+ return 0;
195
+ }
196
+ const files = readdirSync(this.sessionsDir);
197
+ for (const file of files) {
198
+ const filePath = join(this.sessionsDir, file);
199
+ try {
200
+ const stats = statSync(filePath);
201
+ totalBytes += stats.size;
202
+ }
203
+ catch {
204
+ // Skip files we can't stat
205
+ }
206
+ }
207
+ }
208
+ catch {
209
+ // Directory doesn't exist
210
+ }
211
+ return totalBytes;
212
+ }
213
+ }
214
+ //# sourceMappingURL=cleaner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleaner.js","sourceRoot":"","sources":["../../../../src/cli/commands/log/cleaner.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAGzD;;GAEG;AACH,MAAM,OAAO,UAAU;IACb,OAAO,CAAS;IAChB,WAAW,CAAS;IAE5B,YAAY,OAAgB,EAAE,WAAoB;QAChD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