@defai.digital/ax-cli 0.0.34

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 (181) hide show
  1. package/.automatosx/agents/aerospace-scientist.yaml +159 -0
  2. package/.automatosx/agents/architecture.yaml +244 -0
  3. package/.automatosx/agents/backend.yaml +172 -0
  4. package/.automatosx/agents/ceo.yaml +105 -0
  5. package/.automatosx/agents/creative-marketer.yaml +173 -0
  6. package/.automatosx/agents/cto.yaml +118 -0
  7. package/.automatosx/agents/data-scientist.yaml +200 -0
  8. package/.automatosx/agents/data.yaml +106 -0
  9. package/.automatosx/agents/design.yaml +115 -0
  10. package/.automatosx/agents/devops.yaml +124 -0
  11. package/.automatosx/agents/frontend.yaml +171 -0
  12. package/.automatosx/agents/fullstack.yaml +172 -0
  13. package/.automatosx/agents/mobile.yaml +185 -0
  14. package/.automatosx/agents/product.yaml +103 -0
  15. package/.automatosx/agents/quality.yaml +93 -0
  16. package/.automatosx/agents/quantum-engineer.yaml +167 -0
  17. package/.automatosx/agents/researcher.yaml +122 -0
  18. package/.automatosx/agents/security.yaml +115 -0
  19. package/.automatosx/agents/standard.yaml +214 -0
  20. package/.automatosx/agents/writer.yaml +122 -0
  21. package/.automatosx/feature-flags.json +13 -0
  22. package/.automatosx/memory/memory.db +0 -0
  23. package/.automatosx/providers/README.md +117 -0
  24. package/.automatosx/providers/grok-zai.yaml.template +61 -0
  25. package/.automatosx/providers/grok.yaml.template +71 -0
  26. package/.automatosx/status/backend-1763517593334-85037.json +9 -0
  27. package/.automatosx/status/quality-1763516867087-82043.json +9 -0
  28. package/.automatosx/status/quality-1763516976722-84817.json +9 -0
  29. package/.automatosx/status/security-1763517871950-87357.json +9 -0
  30. package/.automatosx/teams/business.yaml +56 -0
  31. package/.automatosx/teams/core.yaml +60 -0
  32. package/.automatosx/teams/design.yaml +58 -0
  33. package/.automatosx/teams/engineering.yaml +69 -0
  34. package/.automatosx/teams/research.yaml +56 -0
  35. package/.automatosx/templates/analyst.yaml +60 -0
  36. package/.automatosx/templates/assistant.yaml +48 -0
  37. package/.automatosx/templates/basic-agent.yaml +28 -0
  38. package/.automatosx/templates/code-reviewer.yaml +52 -0
  39. package/.automatosx/templates/debugger.yaml +63 -0
  40. package/.automatosx/templates/designer.yaml +69 -0
  41. package/.automatosx/templates/developer.yaml +60 -0
  42. package/.automatosx/templates/fullstack-developer.yaml +395 -0
  43. package/.automatosx/templates/qa-specialist.yaml +71 -0
  44. package/.claude/mcp/automatosx.json +244 -0
  45. package/.claude/settings.local.json +34 -0
  46. package/.grok/settings.json +37 -0
  47. package/LICENSE +26 -0
  48. package/README.md +518 -0
  49. package/automatosx/PRD/README.md +9 -0
  50. package/automatosx/tmp/README.md +10 -0
  51. package/automatosx.config.json +333 -0
  52. package/dist/agent/grok-agent.d.ts +52 -0
  53. package/dist/agent/grok-agent.js +627 -0
  54. package/dist/agent/grok-agent.js.map +1 -0
  55. package/dist/agent/index.d.ts +14 -0
  56. package/dist/agent/index.js +136 -0
  57. package/dist/agent/index.js.map +1 -0
  58. package/dist/commands/mcp.d.ts +2 -0
  59. package/dist/commands/mcp.js +239 -0
  60. package/dist/commands/mcp.js.map +1 -0
  61. package/dist/grok/client.d.ts +49 -0
  62. package/dist/grok/client.js +80 -0
  63. package/dist/grok/client.js.map +1 -0
  64. package/dist/grok/tools.d.ts +8 -0
  65. package/dist/grok/tools.js +349 -0
  66. package/dist/grok/tools.js.map +1 -0
  67. package/dist/hooks/use-enhanced-input.d.ts +37 -0
  68. package/dist/hooks/use-enhanced-input.js +214 -0
  69. package/dist/hooks/use-enhanced-input.js.map +1 -0
  70. package/dist/hooks/use-input-handler.d.ts +34 -0
  71. package/dist/hooks/use-input-handler.js +608 -0
  72. package/dist/hooks/use-input-handler.js.map +1 -0
  73. package/dist/hooks/use-input-history.d.ts +9 -0
  74. package/dist/hooks/use-input-history.js +69 -0
  75. package/dist/hooks/use-input-history.js.map +1 -0
  76. package/dist/index.d.ts +2 -0
  77. package/dist/index.js +339 -0
  78. package/dist/index.js.map +1 -0
  79. package/dist/mcp/client.d.ts +31 -0
  80. package/dist/mcp/client.js +152 -0
  81. package/dist/mcp/client.js.map +1 -0
  82. package/dist/mcp/config.d.ts +13 -0
  83. package/dist/mcp/config.js +43 -0
  84. package/dist/mcp/config.js.map +1 -0
  85. package/dist/mcp/transports.d.ts +48 -0
  86. package/dist/mcp/transports.js +217 -0
  87. package/dist/mcp/transports.js.map +1 -0
  88. package/dist/schemas/index.d.ts +102 -0
  89. package/dist/schemas/index.js +105 -0
  90. package/dist/schemas/index.js.map +1 -0
  91. package/dist/tools/bash.d.ts +10 -0
  92. package/dist/tools/bash.js +82 -0
  93. package/dist/tools/bash.js.map +1 -0
  94. package/dist/tools/confirmation-tool.d.ts +16 -0
  95. package/dist/tools/confirmation-tool.js +72 -0
  96. package/dist/tools/confirmation-tool.js.map +1 -0
  97. package/dist/tools/index.d.ts +6 -0
  98. package/dist/tools/index.js +7 -0
  99. package/dist/tools/index.js.map +1 -0
  100. package/dist/tools/morph-editor.d.ts +36 -0
  101. package/dist/tools/morph-editor.js +308 -0
  102. package/dist/tools/morph-editor.js.map +1 -0
  103. package/dist/tools/search.d.ts +68 -0
  104. package/dist/tools/search.js +300 -0
  105. package/dist/tools/search.js.map +1 -0
  106. package/dist/tools/text-editor.d.ts +16 -0
  107. package/dist/tools/text-editor.js +526 -0
  108. package/dist/tools/text-editor.js.map +1 -0
  109. package/dist/tools/todo-tool.d.ts +20 -0
  110. package/dist/tools/todo-tool.js +129 -0
  111. package/dist/tools/todo-tool.js.map +1 -0
  112. package/dist/types/index.d.ts +30 -0
  113. package/dist/types/index.js +2 -0
  114. package/dist/types/index.js.map +1 -0
  115. package/dist/ui/app.d.ts +7 -0
  116. package/dist/ui/app.js +99 -0
  117. package/dist/ui/app.js.map +1 -0
  118. package/dist/ui/components/api-key-input.d.ts +7 -0
  119. package/dist/ui/components/api-key-input.js +80 -0
  120. package/dist/ui/components/api-key-input.js.map +1 -0
  121. package/dist/ui/components/chat-history.d.ts +8 -0
  122. package/dist/ui/components/chat-history.js +157 -0
  123. package/dist/ui/components/chat-history.js.map +1 -0
  124. package/dist/ui/components/chat-input.d.ts +9 -0
  125. package/dist/ui/components/chat-input.js +67 -0
  126. package/dist/ui/components/chat-input.js.map +1 -0
  127. package/dist/ui/components/chat-interface.d.ts +8 -0
  128. package/dist/ui/components/chat-interface.js +272 -0
  129. package/dist/ui/components/chat-interface.js.map +1 -0
  130. package/dist/ui/components/command-suggestions.d.ts +17 -0
  131. package/dist/ui/components/command-suggestions.js +22 -0
  132. package/dist/ui/components/command-suggestions.js.map +1 -0
  133. package/dist/ui/components/confirmation-dialog.d.ts +11 -0
  134. package/dist/ui/components/confirmation-dialog.js +105 -0
  135. package/dist/ui/components/confirmation-dialog.js.map +1 -0
  136. package/dist/ui/components/diff-renderer.d.ts +13 -0
  137. package/dist/ui/components/diff-renderer.js +186 -0
  138. package/dist/ui/components/diff-renderer.js.map +1 -0
  139. package/dist/ui/components/loading-spinner.d.ts +8 -0
  140. package/dist/ui/components/loading-spinner.js +59 -0
  141. package/dist/ui/components/loading-spinner.js.map +1 -0
  142. package/dist/ui/components/mcp-status.d.ts +5 -0
  143. package/dist/ui/components/mcp-status.js +36 -0
  144. package/dist/ui/components/mcp-status.js.map +1 -0
  145. package/dist/ui/components/model-selection.d.ts +12 -0
  146. package/dist/ui/components/model-selection.js +17 -0
  147. package/dist/ui/components/model-selection.js.map +1 -0
  148. package/dist/ui/shared/max-sized-box.d.ts +8 -0
  149. package/dist/ui/shared/max-sized-box.js +6 -0
  150. package/dist/ui/shared/max-sized-box.js.map +1 -0
  151. package/dist/ui/utils/code-colorizer.d.ts +2 -0
  152. package/dist/ui/utils/code-colorizer.js +7 -0
  153. package/dist/ui/utils/code-colorizer.js.map +1 -0
  154. package/dist/ui/utils/colors.d.ts +14 -0
  155. package/dist/ui/utils/colors.js +15 -0
  156. package/dist/ui/utils/colors.js.map +1 -0
  157. package/dist/ui/utils/markdown-renderer.d.ts +4 -0
  158. package/dist/ui/utils/markdown-renderer.js +23 -0
  159. package/dist/ui/utils/markdown-renderer.js.map +1 -0
  160. package/dist/utils/confirmation-service.d.ts +32 -0
  161. package/dist/utils/confirmation-service.js +109 -0
  162. package/dist/utils/confirmation-service.js.map +1 -0
  163. package/dist/utils/custom-instructions.d.ts +1 -0
  164. package/dist/utils/custom-instructions.js +17 -0
  165. package/dist/utils/custom-instructions.js.map +1 -0
  166. package/dist/utils/model-config.d.ts +28 -0
  167. package/dist/utils/model-config.js +42 -0
  168. package/dist/utils/model-config.js.map +1 -0
  169. package/dist/utils/settings-manager.d.ts +94 -0
  170. package/dist/utils/settings-manager.js +240 -0
  171. package/dist/utils/settings-manager.js.map +1 -0
  172. package/dist/utils/settings.d.ts +1 -0
  173. package/dist/utils/settings.js +4 -0
  174. package/dist/utils/settings.js.map +1 -0
  175. package/dist/utils/text-utils.d.ts +80 -0
  176. package/dist/utils/text-utils.js +182 -0
  177. package/dist/utils/text-utils.js.map +1 -0
  178. package/dist/utils/token-counter.d.ts +33 -0
  179. package/dist/utils/token-counter.js +78 -0
  180. package/dist/utils/token-counter.js.map +1 -0
  181. package/package.json +70 -0
@@ -0,0 +1,186 @@
1
+ /**
2
+ * Professional diff renderer component
3
+ */
4
+ import React from 'react';
5
+ import { Box, Text } from 'ink';
6
+ import { Colors } from '../utils/colors.js';
7
+ import crypto from 'crypto';
8
+ import { MaxSizedBox } from '../shared/max-sized-box.js';
9
+ function parseDiffWithLineNumbers(diffContent) {
10
+ const lines = diffContent.split('\n');
11
+ const result = [];
12
+ let currentOldLine = 0;
13
+ let currentNewLine = 0;
14
+ let inHunk = false;
15
+ const hunkHeaderRegex = /^@@ -(\d+),?\d* \+(\d+),?\d* @@/;
16
+ for (const line of lines) {
17
+ const hunkMatch = line.match(hunkHeaderRegex);
18
+ if (hunkMatch) {
19
+ currentOldLine = parseInt(hunkMatch[1], 10);
20
+ currentNewLine = parseInt(hunkMatch[2], 10);
21
+ inHunk = true;
22
+ result.push({ type: 'hunk', content: line });
23
+ // We need to adjust the starting point because the first line number applies to the *first* actual line change/context,
24
+ // but we increment *before* pushing that line. So decrement here.
25
+ currentOldLine--;
26
+ currentNewLine--;
27
+ continue;
28
+ }
29
+ if (!inHunk) {
30
+ // Skip standard Git header lines more robustly
31
+ if (line.startsWith('--- ') ||
32
+ line.startsWith('+++ ') ||
33
+ line.startsWith('diff --git') ||
34
+ line.startsWith('index ') ||
35
+ line.startsWith('similarity index') ||
36
+ line.startsWith('rename from') ||
37
+ line.startsWith('rename to') ||
38
+ line.startsWith('new file mode') ||
39
+ line.startsWith('deleted file mode'))
40
+ continue;
41
+ // If it's not a hunk or header, skip (or handle as 'other' if needed)
42
+ continue;
43
+ }
44
+ if (line.startsWith('+')) {
45
+ currentNewLine++; // Increment before pushing
46
+ result.push({
47
+ type: 'add',
48
+ newLine: currentNewLine,
49
+ content: line.substring(1),
50
+ });
51
+ }
52
+ else if (line.startsWith('-')) {
53
+ currentOldLine++; // Increment before pushing
54
+ result.push({
55
+ type: 'del',
56
+ oldLine: currentOldLine,
57
+ content: line.substring(1),
58
+ });
59
+ }
60
+ else if (line.startsWith(' ')) {
61
+ currentOldLine++; // Increment before pushing
62
+ currentNewLine++;
63
+ result.push({
64
+ type: 'context',
65
+ oldLine: currentOldLine,
66
+ newLine: currentNewLine,
67
+ content: line.substring(1),
68
+ });
69
+ }
70
+ else if (line.startsWith('\\')) {
71
+ // Handle ""
72
+ result.push({ type: 'other', content: line });
73
+ }
74
+ }
75
+ return result;
76
+ }
77
+ const DEFAULT_TAB_WIDTH = 4; // Spaces per tab for normalization
78
+ export const DiffRenderer = ({ diffContent, filename, tabWidth = DEFAULT_TAB_WIDTH, availableTerminalHeight, terminalWidth = 80, }) => {
79
+ if (!diffContent || typeof diffContent !== 'string') {
80
+ return React.createElement(Text, { color: Colors.AccentYellow }, "No diff content.");
81
+ }
82
+ // Strip the first summary line (e.g. "Updated file.txt with 1 addition and 2 removals")
83
+ const lines = diffContent.split('\n');
84
+ const firstLine = lines[0];
85
+ let actualDiffContent = diffContent;
86
+ if (firstLine && (firstLine.startsWith('Updated ') || firstLine.startsWith('Created '))) {
87
+ actualDiffContent = lines.slice(1).join('\n');
88
+ }
89
+ const parsedLines = parseDiffWithLineNumbers(actualDiffContent);
90
+ if (parsedLines.length === 0) {
91
+ return React.createElement(Text, { dimColor: true }, "No changes detected.");
92
+ }
93
+ // Always render as diff format to show line numbers and + signs
94
+ const renderedOutput = renderDiffContent(parsedLines, filename, tabWidth, availableTerminalHeight, terminalWidth);
95
+ return React.createElement(React.Fragment, null, renderedOutput);
96
+ };
97
+ const renderDiffContent = (parsedLines, filename, tabWidth = DEFAULT_TAB_WIDTH, availableTerminalHeight, terminalWidth) => {
98
+ // 1. Normalize whitespace (replace tabs with spaces) *before* further processing
99
+ const normalizedLines = parsedLines.map((line) => ({
100
+ ...line,
101
+ content: line.content.replace(/\t/g, ' '.repeat(tabWidth)),
102
+ }));
103
+ // Filter out non-displayable lines (hunks, potentially 'other') using the normalized list
104
+ const displayableLines = normalizedLines.filter((l) => l.type !== 'hunk' && l.type !== 'other');
105
+ if (displayableLines.length === 0) {
106
+ return React.createElement(Text, { dimColor: true }, "No changes detected.");
107
+ }
108
+ // Calculate the minimum indentation across all displayable lines
109
+ let baseIndentation = Infinity; // Start high to find the minimum
110
+ for (const line of displayableLines) {
111
+ // Only consider lines with actual content for indentation calculation
112
+ if (line.content.trim() === '')
113
+ continue;
114
+ const firstCharIndex = line.content.search(/\S/); // Find index of first non-whitespace char
115
+ const currentIndent = firstCharIndex === -1 ? 0 : firstCharIndex; // Indent is 0 if no non-whitespace found
116
+ baseIndentation = Math.min(baseIndentation, currentIndent);
117
+ }
118
+ // If baseIndentation remained Infinity (e.g., no displayable lines with content), default to 0
119
+ if (!isFinite(baseIndentation)) {
120
+ baseIndentation = 0;
121
+ }
122
+ const key = filename
123
+ ? `diff-box-${filename}`
124
+ : `diff-box-${crypto.createHash('sha1').update(JSON.stringify(parsedLines)).digest('hex')}`;
125
+ let lastLineNumber = null;
126
+ const MAX_CONTEXT_LINES_WITHOUT_GAP = 5;
127
+ return (React.createElement(MaxSizedBox, { maxHeight: availableTerminalHeight, maxWidth: terminalWidth, key: key }, displayableLines.reduce((acc, line, index) => {
128
+ // Determine the relevant line number for gap calculation based on type
129
+ let relevantLineNumberForGapCalc = null;
130
+ if (line.type === 'add' || line.type === 'context') {
131
+ relevantLineNumberForGapCalc = line.newLine ?? null;
132
+ }
133
+ else if (line.type === 'del') {
134
+ // For deletions, the gap is typically in relation to the original file's line numbering
135
+ relevantLineNumberForGapCalc = line.oldLine ?? null;
136
+ }
137
+ if (lastLineNumber !== null &&
138
+ relevantLineNumberForGapCalc !== null &&
139
+ relevantLineNumberForGapCalc >
140
+ lastLineNumber + MAX_CONTEXT_LINES_WITHOUT_GAP + 1) {
141
+ acc.push(React.createElement(Box, { key: `gap-${index}` },
142
+ React.createElement(Text, { wrap: "truncate" }, '═'.repeat(terminalWidth))));
143
+ }
144
+ const lineKey = `diff-line-${index}`;
145
+ let gutterNumStr = '';
146
+ let backgroundColor = undefined;
147
+ let prefixSymbol = ' ';
148
+ let dim = false;
149
+ switch (line.type) {
150
+ case 'add':
151
+ gutterNumStr = (line.newLine ?? '').toString();
152
+ backgroundColor = '#86efac'; // Light green for additions
153
+ prefixSymbol = '+';
154
+ lastLineNumber = line.newLine ?? null;
155
+ break;
156
+ case 'del':
157
+ gutterNumStr = (line.oldLine ?? '').toString();
158
+ backgroundColor = 'redBright'; // Light red for deletions
159
+ prefixSymbol = '-';
160
+ // For deletions, update lastLineNumber based on oldLine if it's advancing.
161
+ // This helps manage gaps correctly if there are multiple consecutive deletions
162
+ // or if a deletion is followed by a context line far away in the original file.
163
+ if (line.oldLine !== undefined) {
164
+ lastLineNumber = line.oldLine;
165
+ }
166
+ break;
167
+ case 'context':
168
+ gutterNumStr = (line.newLine ?? '').toString();
169
+ dim = true;
170
+ prefixSymbol = ' ';
171
+ lastLineNumber = line.newLine ?? null;
172
+ break;
173
+ default:
174
+ return acc;
175
+ }
176
+ const displayContent = line.content.substring(baseIndentation);
177
+ acc.push(React.createElement(Box, { key: lineKey, flexDirection: "row" },
178
+ React.createElement(Text, { color: Colors.Gray, dimColor: dim }, gutterNumStr.padEnd(4)),
179
+ React.createElement(Text, { color: backgroundColor ? '#000000' : undefined, backgroundColor: backgroundColor, dimColor: !backgroundColor && dim },
180
+ prefixSymbol,
181
+ " "),
182
+ React.createElement(Text, { color: backgroundColor ? '#000000' : undefined, backgroundColor: backgroundColor, dimColor: !backgroundColor && dim, wrap: "wrap" }, displayContent)));
183
+ return acc;
184
+ }, [])));
185
+ };
186
+ //# sourceMappingURL=diff-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"diff-renderer.js","sourceRoot":"","sources":["../../../src/ui/components/diff-renderer.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AASzD,SAAS,wBAAwB,CAAC,WAAmB;IACnD,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,MAAM,GAAe,EAAE,CAAC;IAC9B,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,eAAe,GAAG,iCAAiC,CAAC;IAE1D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAC9C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ACb,CAAC,EAAE,EAAE,CAAC,CACM,CACf,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from "react";
2
+ interface LoadingSpinnerProps {
3
+ isActive: boolean;
4
+ processingTime: number;
5
+ tokenCount: number;
6
+ }
7
+ export declare function LoadingSpinner({ isActive, processingTime, tokenCount, }: LoadingSpinnerProps): React.JSX.Element | null;
8
+ export {};
@@ -0,0 +1,59 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Box, Text } from "ink";
3
+ import { formatTokenCount } from "../../utils/token-counter.js";
4
+ const loadingTexts = [
5
+ "Thinking...",
6
+ "Computing...",
7
+ "Analyzing...",
8
+ "Processing...",
9
+ "Calculating...",
10
+ "Interfacing...",
11
+ "Optimizing...",
12
+ "Synthesizing...",
13
+ "Decrypting...",
14
+ "Calibrating...",
15
+ "Bootstrapping...",
16
+ "Synchronizing...",
17
+ "Compiling...",
18
+ "Downloading...",
19
+ ];
20
+ export function LoadingSpinner({ isActive, processingTime, tokenCount, }) {
21
+ const [spinnerFrame, setSpinnerFrame] = useState(0);
22
+ const [loadingTextIndex, setLoadingTextIndex] = useState(0);
23
+ useEffect(() => {
24
+ if (!isActive)
25
+ return;
26
+ const spinnerFrames = ["/", "-", "\\", "|"];
27
+ // Reduced frequency: 500ms instead of 250ms to reduce flickering on Windows
28
+ const interval = setInterval(() => {
29
+ setSpinnerFrame((prev) => (prev + 1) % spinnerFrames.length);
30
+ }, 500);
31
+ return () => clearInterval(interval);
32
+ }, [isActive]);
33
+ useEffect(() => {
34
+ if (!isActive)
35
+ return;
36
+ setLoadingTextIndex(Math.floor(Math.random() * loadingTexts.length));
37
+ // Increased interval: 4s instead of 2s to reduce state changes
38
+ const interval = setInterval(() => {
39
+ setLoadingTextIndex(Math.floor(Math.random() * loadingTexts.length));
40
+ }, 4000);
41
+ return () => clearInterval(interval);
42
+ }, [isActive]);
43
+ if (!isActive)
44
+ return null;
45
+ const spinnerFrames = ["/", "-", "\\", "|"];
46
+ return (React.createElement(Box, { marginTop: 1 },
47
+ React.createElement(Text, { color: "cyan" },
48
+ spinnerFrames[spinnerFrame],
49
+ " ",
50
+ loadingTexts[loadingTextIndex],
51
+ " "),
52
+ React.createElement(Text, { color: "gray" },
53
+ "(",
54
+ processingTime,
55
+ "s \u00B7 \u2191 ",
56
+ formatTokenCount(tokenCount),
57
+ " tokens \u00B7 esc to interrupt)")));
58
+ }
59
+ //# sourceMappingURL=loading-spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loading-spinner.js","sourceRoot":"","sources":["../../../src/ui/components/loading-spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAQhE,MAAM,YAAY,GAAG;IACnB,aAAa;IACb,cAAc;IACd,cAAc;IACd,eAAe;IACf,gBAAgB;IAChB,gBAAgB;IAChB,eAAe;IACf,iBAAiB;IACjB,eAAe;IACf,gBAAgB;IAChB,kBAAkB;IAClB,kBAAkB;IAClB,cAAc;IACd,gBAAgB;CACjB,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,EAC7B,QAAQ,EACR,cAAc,EACd,UAAU,GACU;IACpB,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IACpD,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE5D,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,QAAQ;YAAE,OAAO;QAEtB,MAAM,aAAa,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QAC5C,4EAA4E;QAC5E,MAAM,QAAQ,GAAG,WAAW,CAA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@@
1
+ import React from "react";
2
+ interface MCPStatusProps {
3
+ }
4
+ export declare function MCPStatus({}: MCPStatusProps): React.JSX.Element | null;
5
+ export {};
@@ -0,0 +1,36 @@
1
+ import React, { useState, useEffect } from "react";
2
+ import { Box, Text } from "ink";
3
+ import { getMCPManager } from "../../grok/tools.js";
4
+ export function MCPStatus({}) {
5
+ const [connectedServers, setConnectedServers] = useState([]);
6
+ useEffect(() => {
7
+ const updateStatus = () => {
8
+ try {
9
+ const manager = getMCPManager();
10
+ const servers = manager.getServers();
11
+ setConnectedServers(servers);
12
+ }
13
+ catch (error) {
14
+ // MCP manager not initialized yet
15
+ setConnectedServers([]);
16
+ }
17
+ };
18
+ // Initial update with a small delay to allow MCP initialization
19
+ const initialTimer = setTimeout(updateStatus, 2000);
20
+ // Set up polling to check for status changes
21
+ const interval = setInterval(updateStatus, 2000);
22
+ return () => {
23
+ clearTimeout(initialTimer);
24
+ clearInterval(interval);
25
+ };
26
+ }, []);
27
+ if (connectedServers.length === 0) {
28
+ return null;
29
+ }
30
+ return (React.createElement(Box, { marginLeft: 1 },
31
+ React.createElement(Text, { color: "green" },
32
+ "\u2692 mcps: ",
33
+ connectedServers.length,
34
+ " ")));
35
+ }
36
+ //# sourceMappingURL=mcp-status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-status.js","sourceRoot":"","sources":["../../../src/ui/components/mcp-status.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,UAAU,SAAS,CAAC,EAAkB;IAC1C,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAW,EAAE,CAAC,CAAC;IAEvE,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,YAAY,GAAG,GAAG,EAAE;YACxB,IAAI,CAAC;gBACH,MAAM,OAAO,GAAG,aAAa,EAAE,CAAC;gBAChC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;gBAErC,mBAAmB,CAAC,OAAO,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,kCAAkC;gBAClC,mBAAmB,CAAC,EAAE,CAAC,CAAC;YAC1B,CAAC;QACH,CAAC,CAAC;QAEF,gEAAgE;QAChE,MAAM,YAAY,GAAG,UAAU,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAEpD,6CAA6C;QAC7C,MAAM,QAAQ,GAAG,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,CAAC;QAEjD,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,YAAY,CAAC,CAAC;YAC3B,aAAa,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,oBAAC,GAAG,IAAC,UAAU,EAAE,CAAC;QAChB,oBAAC,IAAI,IAAC,KAAK,EAAC,OAAO;;YAAU,gBAAgB,CAAC,MAAM;gBAAS,CACzD,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ import React from "react";
2
+ interface ModelOption {
3
+ model: string;
4
+ }
5
+ interface ModelSelectionProps {
6
+ models: ModelOption[];
7
+ selectedIndex: number;
8
+ isVisible: boolean;
9
+ currentModel: string;
10
+ }
11
+ export declare function ModelSelection({ models, selectedIndex, isVisible, currentModel, }: ModelSelectionProps): React.JSX.Element | null;
12
+ export {};
@@ -0,0 +1,17 @@
1
+ import React from "react";
2
+ import { Box, Text } from "ink";
3
+ export function ModelSelection({ models, selectedIndex, isVisible, currentModel, }) {
4
+ if (!isVisible)
5
+ return null;
6
+ return (React.createElement(Box, { marginTop: 1, flexDirection: "column" },
7
+ React.createElement(Box, { marginBottom: 1 },
8
+ React.createElement(Text, { color: "cyan" },
9
+ "Select Grok Model (current: ",
10
+ currentModel,
11
+ "):")),
12
+ models.map((modelOption, index) => (React.createElement(Box, { key: index, paddingLeft: 1 },
13
+ React.createElement(Text, { color: index === selectedIndex ? "black" : "white", backgroundColor: index === selectedIndex ? "cyan" : undefined }, modelOption.model)))),
14
+ React.createElement(Box, { marginTop: 1 },
15
+ React.createElement(Text, { color: "gray", dimColor: true }, "\u2191\u2193 navigate \u2022 Enter/Tab select \u2022 Esc cancel"))));
16
+ }
17
+ //# sourceMappingURL=model-selection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-selection.js","sourceRoot":"","sources":["../../../src/ui/components/model-selection.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAahC,MAAM,UAAU,cAAc,CAAC,EAC7B,MAAM,EACN,aAAa,EACb,SAAS,EACT,YAAY,GACQ;IACpB,IAAI,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAE5B,OAAO,CACL,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ;QACvC,oBAAC,GAAG,IAAC,YAAY,EAAE,CAAC;YAClB,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM;;gBAA8B,YAAY;qBAAU,CAClE;QACL,MAAM,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,EAAE,EAAE,CAAC,CAClC,oBAAC,GAAG,IAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;YAC7B,oBAAC,IAAI,IACH,KAAK,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAClD,eAAe,EAAE,KAAK,KAAK,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAE5D,WAAW,CAAC,KAAK,CACb,CACH,CACP,CAAC;QACF,oBAAC,GAAG,IAAC,SAAS,EAAE,CAAC;YACf,oBAAC,IAAI,IAAC,KAAK,EAAC,MAAM,EAAC,QAAQ,4EAEpB,CACH,CACF,CACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ interface MaxSizedBoxProps {
3
+ maxHeight?: number;
4
+ maxWidth?: number;
5
+ children: React.ReactNode;
6
+ }
7
+ export declare const MaxSizedBox: React.FC<MaxSizedBoxProps>;
8
+ export {};
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ import { Box } from 'ink';
3
+ export const MaxSizedBox = ({ maxHeight, maxWidth, children, ...props }) => {
4
+ return (React.createElement(Box, { flexDirection: "column", ...props }, children));
5
+ };
6
+ //# sourceMappingURL=max-sized-box.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"max-sized-box.js","sourceRoot":"","sources":["../../../src/ui/shared/max-sized-box.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAQ1B,MAAM,CAAC,MAAM,WAAW,GAA+B,CAAC,EACtD,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,GAAG,IACF,aAAa,EAAC,QAAQ,KAClB,KAAK,IAER,QAAQ,CACL,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import React from 'react';
2
+ export declare const colorizeCode: (content: string, _language: string | null, _availableTerminalHeight?: number, _terminalWidth?: number) => React.ReactNode;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { Text, Box } from 'ink';
3
+ export const colorizeCode = (content, _language, _availableTerminalHeight, _terminalWidth) => {
4
+ // Simple plain text rendering - could be enhanced with syntax highlighting later
5
+ return (React.createElement(Box, { flexDirection: "column" }, content.split('\n').map((line, index) => (React.createElement(Text, { key: index, wrap: "wrap" }, line)))));
6
+ };
7
+ //# sourceMappingURL=code-colorizer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"code-colorizer.js","sourceRoot":"","sources":["../../../src/ui/utils/code-colorizer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAEhC,MAAM,CAAC,MAAM,YAAY,GAAG,CAC1B,OAAe,EACf,SAAwB,EACxB,wBAAiC,EACjC,cAAuB,EACN,EAAE;IACnB,iFAAiF;IACjF,OAAO,CACL,oBAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,IACxB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CACxC,oBAAC,IAAI,IAAC,GAAG,EAAE,KAAK,EAAE,IAAI,EAAC,MAAM,IAC1B,IAAI,CACA,CACR,CAAC,CACE,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Color constants for the CLI interface
3
+ */
4
+ export declare const Colors: {
5
+ readonly AccentYellow: "yellow";
6
+ readonly Gray: "gray";
7
+ readonly Red: "red";
8
+ readonly Green: "green";
9
+ readonly Blue: "blue";
10
+ readonly Cyan: "cyan";
11
+ readonly Magenta: "magenta";
12
+ readonly White: "white";
13
+ readonly Black: "black";
14
+ };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Color constants for the CLI interface
3
+ */
4
+ export const Colors = {
5
+ AccentYellow: 'yellow',
6
+ Gray: 'gray',
7
+ Red: 'red',
8
+ Green: 'green',
9
+ Blue: 'blue',
10
+ Cyan: 'cyan',
11
+ Magenta: 'magenta',
12
+ White: 'white',
13
+ Black: 'black'
14
+ };
15
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../src/ui/utils/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,YAAY,EAAE,QAAQ;IACtB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;IAClB,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;CACN,CAAC"}
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ export declare function MarkdownRenderer({ content }: {
3
+ content: string;
4
+ }): React.JSX.Element;
@@ -0,0 +1,23 @@
1
+ import React from 'react';
2
+ import { Text } from 'ink';
3
+ import { marked } from 'marked';
4
+ import TerminalRenderer from 'marked-terminal';
5
+ // Configure marked to use the terminal renderer with default settings
6
+ marked.setOptions({
7
+ renderer: new TerminalRenderer()
8
+ });
9
+ export function MarkdownRenderer({ content }) {
10
+ try {
11
+ // Use marked.parse for synchronous parsing
12
+ const result = marked.parse(content);
13
+ // Handle both sync and async results
14
+ const rendered = typeof result === 'string' ? result : content;
15
+ return React.createElement(Text, null, rendered);
16
+ }
17
+ catch (error) {
18
+ // Fallback to plain text if markdown parsing fails
19
+ console.error('Markdown rendering error:', error);
20
+ return React.createElement(Text, null, content);
21
+ }
22
+ }
23
+ //# sourceMappingURL=markdown-renderer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-renderer.js","sourceRoot":"","sources":["../../../src/ui/utils/markdown-renderer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,gBAAgB,MAAM,iBAAiB,CAAC;AAE/C,sEAAsE;AACtE,MAAM,CAAC,UAAU,CAAC;IAChB,QAAQ,EAAE,IAAK,gBAAwB,EAAE;CAC1C,CAAC,CAAC;AAEH,MAAM,UAAU,gBAAgB,CAAC,EAAE,OAAO,EAAuB;IAC/D,IAAI,CAAC;QACH,2CAA2C;QAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACrC,qCAAqC;QACrC,MAAM,QAAQ,GAAG,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;QAC/D,OAAO,oBAAC,IAAI,QAAE,QAAQ,CAAQ,CAAC;IACjC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mDAAmD;QACnD,OAAO,CAAC,KAAK,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAC;QAClD,OAAO,oBAAC,IAAI,QAAE,OAAO,CAAQ,CAAC;IAChC,CAAC;AACH,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { EventEmitter } from "events";
2
+ export interface ConfirmationOptions {
3
+ operation: string;
4
+ filename: string;
5
+ showVSCodeOpen?: boolean;
6
+ content?: string;
7
+ }
8
+ export interface ConfirmationResult {
9
+ confirmed: boolean;
10
+ dontAskAgain?: boolean;
11
+ feedback?: string;
12
+ }
13
+ export declare class ConfirmationService extends EventEmitter {
14
+ private static instance;
15
+ private pendingConfirmation;
16
+ private resolveConfirmation;
17
+ private sessionFlags;
18
+ static getInstance(): ConfirmationService;
19
+ constructor();
20
+ requestConfirmation(options: ConfirmationOptions, operationType?: "file" | "bash"): Promise<ConfirmationResult>;
21
+ confirmOperation(confirmed: boolean, dontAskAgain?: boolean): void;
22
+ rejectOperation(feedback?: string): void;
23
+ private openInVSCode;
24
+ isPending(): boolean;
25
+ resetSession(): void;
26
+ getSessionFlags(): {
27
+ fileOperations: boolean;
28
+ bashCommands: boolean;
29
+ allOperations: boolean;
30
+ };
31
+ setSessionFlag(flagType: "fileOperations" | "bashCommands" | "allOperations", value: boolean): void;
32
+ }
@@ -0,0 +1,109 @@
1
+ import { exec } from "child_process";
2
+ import { promisify } from "util";
3
+ import { EventEmitter } from "events";
4
+ const execAsync = promisify(exec);
5
+ export class ConfirmationService extends EventEmitter {
6
+ static instance;
7
+ pendingConfirmation = null;
8
+ resolveConfirmation = null;
9
+ // Session flags for different operation types
10
+ sessionFlags = {
11
+ fileOperations: false,
12
+ bashCommands: false,
13
+ allOperations: false,
14
+ };
15
+ static getInstance() {
16
+ if (!ConfirmationService.instance) {
17
+ ConfirmationService.instance = new ConfirmationService();
18
+ }
19
+ return ConfirmationService.instance;
20
+ }
21
+ constructor() {
22
+ super();
23
+ }
24
+ async requestConfirmation(options, operationType = "file") {
25
+ // Check session flags
26
+ if (this.sessionFlags.allOperations ||
27
+ (operationType === "file" && this.sessionFlags.fileOperations) ||
28
+ (operationType === "bash" && this.sessionFlags.bashCommands)) {
29
+ return { confirmed: true };
30
+ }
31
+ // If VS Code should be opened, try to open it
32
+ if (options.showVSCodeOpen) {
33
+ try {
34
+ await this.openInVSCode(options.filename);
35
+ }
36
+ catch (error) {
37
+ // If VS Code opening fails, continue without it
38
+ options.showVSCodeOpen = false;
39
+ }
40
+ }
41
+ // Create a promise that will be resolved by the UI component
42
+ this.pendingConfirmation = new Promise((resolve) => {
43
+ this.resolveConfirmation = resolve;
44
+ });
45
+ // Emit custom event that the UI can listen to (using setImmediate to ensure the UI updates)
46
+ setImmediate(() => {
47
+ this.emit("confirmation-requested", options);
48
+ });
49
+ const result = await this.pendingConfirmation;
50
+ if (result.dontAskAgain) {
51
+ // Set the appropriate session flag based on operation type
52
+ if (operationType === "file") {
53
+ this.sessionFlags.fileOperations = true;
54
+ }
55
+ else if (operationType === "bash") {
56
+ this.sessionFlags.bashCommands = true;
57
+ }
58
+ // Could also set allOperations for global skip
59
+ }
60
+ return result;
61
+ }
62
+ confirmOperation(confirmed, dontAskAgain) {
63
+ if (this.resolveConfirmation) {
64
+ this.resolveConfirmation({ confirmed, dontAskAgain });
65
+ this.resolveConfirmation = null;
66
+ this.pendingConfirmation = null;
67
+ }
68
+ }
69
+ rejectOperation(feedback) {
70
+ if (this.resolveConfirmation) {
71
+ this.resolveConfirmation({ confirmed: false, feedback });
72
+ this.resolveConfirmation = null;
73
+ this.pendingConfirmation = null;
74
+ }
75
+ }
76
+ async openInVSCode(filename) {
77
+ // Try different VS Code commands
78
+ const commands = ["code", "code-insiders", "codium"];
79
+ for (const cmd of commands) {
80
+ try {
81
+ await execAsync(`which ${cmd}`);
82
+ await execAsync(`${cmd} "${filename}"`);
83
+ return;
84
+ }
85
+ catch (error) {
86
+ // Continue to next command
87
+ continue;
88
+ }
89
+ }
90
+ throw new Error("VS Code not found");
91
+ }
92
+ isPending() {
93
+ return this.pendingConfirmation !== null;
94
+ }
95
+ resetSession() {
96
+ this.sessionFlags = {
97
+ fileOperations: false,
98
+ bashCommands: false,
99
+ allOperations: false,
100
+ };
101
+ }
102
+ getSessionFlags() {
103
+ return { ...this.sessionFlags };
104
+ }
105
+ setSessionFlag(flagType, value) {
106
+ this.sessionFlags[flagType] = value;
107
+ }
108
+ }
109
+ //# sourceMappingURL=confirmation-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirmation-service.js","sourceRoot":"","sources":["../../src/utils/confirmation-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAEtC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAelC,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAC3C,MAAM,CAAC,QAAQ,CAAsB;IACrC,mBAAmB,GAAuC,IAAI,CAAC;IAC/D,mBAAmB,GACzB,IAAI,CAAC;IAEP,8CAA8C;IACtC,YAAY,GAAG;QACrB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C,CAAC;gBACxC,OAAO;YACT,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,2BAA2B;gBAC3B,SAAS;YACX,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,mBAAmB,KAAK,IAAI,CAAC;IAC3C,CAAC;IAED,YAAY;QACV,IAAI,CAAC,YAAY,GAAG;YAClB,cAAc,EAAE,KAAK;YACrB,YAAY,EAAE,KAAK;YACnB,aAAa,EAAE,KAAK;SACrB,CAAC;IACJ,CAAC;IAED,eAAe;QACb,OAAO,EAAE,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;IAClC,CAAC;IAED,cAAc,CACZ,QAA6D,EAC7D,KAAc;QAEd,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC;IACtC,CAAC;CACF"}
@@ -0,0 +1 @@
1
+ export declare function loadCustomInstructions(workingDirectory?: string): string | null;
@@ -0,0 +1,17 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ export function loadCustomInstructions(workingDirectory = process.cwd()) {
4
+ try {
5
+ const instructionsPath = path.join(workingDirectory, '.grok', 'GROK.md');
6
+ if (!fs.existsSync(instructionsPath)) {
7
+ return null;
8
+ }
9
+ const customInstructions = fs.readFileSync(instructionsPath, 'utf-8');
10
+ return customInstructions.trim();
11
+ }
12
+ catch (error) {
13
+ console.warn('Failed to load custom instructions:', error);
14
+ return null;
15
+ }
16
+ }
17
+ //# sourceMappingURL=custom-instructions.js.map