locdotech-ai 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (167) hide show
  1. package/README.md +104 -0
  2. package/bin/ai.js +16 -0
  3. package/dist/api/client.d.ts +75 -0
  4. package/dist/api/client.d.ts.map +1 -0
  5. package/dist/api/client.js +86 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/api/index.d.ts +4 -0
  8. package/dist/api/index.d.ts.map +1 -0
  9. package/dist/api/index.js +4 -0
  10. package/dist/api/index.js.map +1 -0
  11. package/dist/api/streaming.d.ts +15 -0
  12. package/dist/api/streaming.d.ts.map +1 -0
  13. package/dist/api/streaming.js +87 -0
  14. package/dist/api/streaming.js.map +1 -0
  15. package/dist/api/websocket.d.ts +20 -0
  16. package/dist/api/websocket.d.ts.map +1 -0
  17. package/dist/api/websocket.js +80 -0
  18. package/dist/api/websocket.js.map +1 -0
  19. package/dist/cli.d.ts +15 -0
  20. package/dist/cli.d.ts.map +1 -0
  21. package/dist/cli.js +72 -0
  22. package/dist/cli.js.map +1 -0
  23. package/dist/commands/clear.d.ts +3 -0
  24. package/dist/commands/clear.d.ts.map +1 -0
  25. package/dist/commands/clear.js +13 -0
  26. package/dist/commands/clear.js.map +1 -0
  27. package/dist/commands/config.d.ts +3 -0
  28. package/dist/commands/config.d.ts.map +1 -0
  29. package/dist/commands/config.js +116 -0
  30. package/dist/commands/config.js.map +1 -0
  31. package/dist/commands/help.d.ts +3 -0
  32. package/dist/commands/help.d.ts.map +1 -0
  33. package/dist/commands/help.js +42 -0
  34. package/dist/commands/help.js.map +1 -0
  35. package/dist/commands/history.d.ts +3 -0
  36. package/dist/commands/history.d.ts.map +1 -0
  37. package/dist/commands/history.js +62 -0
  38. package/dist/commands/history.js.map +1 -0
  39. package/dist/commands/index.d.ts +30 -0
  40. package/dist/commands/index.d.ts.map +1 -0
  41. package/dist/commands/index.js +54 -0
  42. package/dist/commands/index.js.map +1 -0
  43. package/dist/commands/model.d.ts +3 -0
  44. package/dist/commands/model.d.ts.map +1 -0
  45. package/dist/commands/model.js +57 -0
  46. package/dist/commands/model.js.map +1 -0
  47. package/dist/commands/quit.d.ts +3 -0
  48. package/dist/commands/quit.d.ts.map +1 -0
  49. package/dist/commands/quit.js +16 -0
  50. package/dist/commands/quit.js.map +1 -0
  51. package/dist/commands/status.d.ts +3 -0
  52. package/dist/commands/status.d.ts.map +1 -0
  53. package/dist/commands/status.js +39 -0
  54. package/dist/commands/status.js.map +1 -0
  55. package/dist/config/index.d.ts +2 -0
  56. package/dist/config/index.d.ts.map +1 -0
  57. package/dist/config/index.js +2 -0
  58. package/dist/config/index.js.map +1 -0
  59. package/dist/config/settings.d.ts +18 -0
  60. package/dist/config/settings.d.ts.map +1 -0
  61. package/dist/config/settings.js +56 -0
  62. package/dist/config/settings.js.map +1 -0
  63. package/dist/index.d.ts +3 -0
  64. package/dist/index.d.ts.map +1 -0
  65. package/dist/index.js +100 -0
  66. package/dist/index.js.map +1 -0
  67. package/dist/tools/bash.d.ts +41 -0
  68. package/dist/tools/bash.d.ts.map +1 -0
  69. package/dist/tools/bash.js +100 -0
  70. package/dist/tools/bash.js.map +1 -0
  71. package/dist/tools/file.d.ts +107 -0
  72. package/dist/tools/file.d.ts.map +1 -0
  73. package/dist/tools/file.js +189 -0
  74. package/dist/tools/file.js.map +1 -0
  75. package/dist/tools/glob.d.ts +38 -0
  76. package/dist/tools/glob.d.ts.map +1 -0
  77. package/dist/tools/glob.js +84 -0
  78. package/dist/tools/glob.js.map +1 -0
  79. package/dist/tools/grep.d.ts +76 -0
  80. package/dist/tools/grep.d.ts.map +1 -0
  81. package/dist/tools/grep.js +166 -0
  82. package/dist/tools/grep.js.map +1 -0
  83. package/dist/tools/index.d.ts +29 -0
  84. package/dist/tools/index.d.ts.map +1 -0
  85. package/dist/tools/index.js +130 -0
  86. package/dist/tools/index.js.map +1 -0
  87. package/dist/tools/mcp.d.ts +59 -0
  88. package/dist/tools/mcp.d.ts.map +1 -0
  89. package/dist/tools/mcp.js +155 -0
  90. package/dist/tools/mcp.js.map +1 -0
  91. package/dist/ui/App.d.ts +6 -0
  92. package/dist/ui/App.d.ts.map +1 -0
  93. package/dist/ui/App.js +161 -0
  94. package/dist/ui/App.js.map +1 -0
  95. package/dist/ui/components/CodeBlock.d.ts +9 -0
  96. package/dist/ui/components/CodeBlock.d.ts.map +1 -0
  97. package/dist/ui/components/CodeBlock.js +83 -0
  98. package/dist/ui/components/CodeBlock.js.map +1 -0
  99. package/dist/ui/components/Input.d.ts +11 -0
  100. package/dist/ui/components/Input.d.ts.map +1 -0
  101. package/dist/ui/components/Input.js +93 -0
  102. package/dist/ui/components/Input.js.map +1 -0
  103. package/dist/ui/components/Message.d.ts +7 -0
  104. package/dist/ui/components/Message.d.ts.map +1 -0
  105. package/dist/ui/components/Message.js +86 -0
  106. package/dist/ui/components/Message.js.map +1 -0
  107. package/dist/ui/components/ModelSelector.d.ts +7 -0
  108. package/dist/ui/components/ModelSelector.d.ts.map +1 -0
  109. package/dist/ui/components/ModelSelector.js +23 -0
  110. package/dist/ui/components/ModelSelector.js.map +1 -0
  111. package/dist/ui/components/Permission.d.ts +9 -0
  112. package/dist/ui/components/Permission.d.ts.map +1 -0
  113. package/dist/ui/components/Permission.js +41 -0
  114. package/dist/ui/components/Permission.js.map +1 -0
  115. package/dist/ui/components/StatusBar.d.ts +11 -0
  116. package/dist/ui/components/StatusBar.d.ts.map +1 -0
  117. package/dist/ui/components/StatusBar.js +9 -0
  118. package/dist/ui/components/StatusBar.js.map +1 -0
  119. package/dist/ui/components/TaskList.d.ts +12 -0
  120. package/dist/ui/components/TaskList.d.ts.map +1 -0
  121. package/dist/ui/components/TaskList.js +21 -0
  122. package/dist/ui/components/TaskList.js.map +1 -0
  123. package/dist/ui/components/ToolCall.d.ts +16 -0
  124. package/dist/ui/components/ToolCall.d.ts.map +1 -0
  125. package/dist/ui/components/ToolCall.js +50 -0
  126. package/dist/ui/components/ToolCall.js.map +1 -0
  127. package/dist/ui/components/index.d.ts +8 -0
  128. package/dist/ui/components/index.d.ts.map +1 -0
  129. package/dist/ui/components/index.js +8 -0
  130. package/dist/ui/components/index.js.map +1 -0
  131. package/dist/ui/hooks/index.d.ts +4 -0
  132. package/dist/ui/hooks/index.d.ts.map +1 -0
  133. package/dist/ui/hooks/index.js +4 -0
  134. package/dist/ui/hooks/index.js.map +1 -0
  135. package/dist/ui/hooks/useChat.d.ts +42 -0
  136. package/dist/ui/hooks/useChat.d.ts.map +1 -0
  137. package/dist/ui/hooks/useChat.js +305 -0
  138. package/dist/ui/hooks/useChat.js.map +1 -0
  139. package/dist/ui/hooks/useHistory.d.ts +14 -0
  140. package/dist/ui/hooks/useHistory.d.ts.map +1 -0
  141. package/dist/ui/hooks/useHistory.js +123 -0
  142. package/dist/ui/hooks/useHistory.js.map +1 -0
  143. package/dist/ui/hooks/useTools.d.ts +19 -0
  144. package/dist/ui/hooks/useTools.d.ts.map +1 -0
  145. package/dist/ui/hooks/useTools.js +54 -0
  146. package/dist/ui/hooks/useTools.js.map +1 -0
  147. package/dist/ui/themes/index.d.ts +21 -0
  148. package/dist/ui/themes/index.d.ts.map +1 -0
  149. package/dist/ui/themes/index.js +40 -0
  150. package/dist/ui/themes/index.js.map +1 -0
  151. package/dist/utils/auth.d.ts +5 -0
  152. package/dist/utils/auth.d.ts.map +1 -0
  153. package/dist/utils/auth.js +42 -0
  154. package/dist/utils/auth.js.map +1 -0
  155. package/dist/utils/format.d.ts +11 -0
  156. package/dist/utils/format.d.ts.map +1 -0
  157. package/dist/utils/format.js +71 -0
  158. package/dist/utils/format.js.map +1 -0
  159. package/dist/utils/index.d.ts +4 -0
  160. package/dist/utils/index.d.ts.map +1 -0
  161. package/dist/utils/index.js +4 -0
  162. package/dist/utils/index.js.map +1 -0
  163. package/dist/utils/logger.d.ts +18 -0
  164. package/dist/utils/logger.d.ts.map +1 -0
  165. package/dist/utils/logger.js +61 -0
  166. package/dist/utils/logger.js.map +1 -0
  167. package/package.json +64 -0
@@ -0,0 +1,42 @@
1
+ import { getApiKey, setApiKey } from '../config/index.js';
2
+ import * as readline from 'readline';
3
+ export function hasApiKey() {
4
+ const key = getApiKey();
5
+ return !!key && key.length > 0;
6
+ }
7
+ export async function promptForApiKey() {
8
+ return new Promise((resolve) => {
9
+ const rl = readline.createInterface({
10
+ input: process.stdin,
11
+ output: process.stdout,
12
+ });
13
+ console.log('\n╔════════════════════════════════════════════════════╗');
14
+ console.log('║ AI Router CLI - Authentication ║');
15
+ console.log('╚════════════════════════════════════════════════════╝\n');
16
+ console.log('No API key found. Please enter your AI Router API key.');
17
+ console.log('You can get your API key from the AIRouter dashboard.\n');
18
+ rl.question('API Key: ', (answer) => {
19
+ rl.close();
20
+ const key = answer.trim();
21
+ if (key) {
22
+ setApiKey(key);
23
+ console.log('\n✓ API key saved successfully!\n');
24
+ }
25
+ resolve(key);
26
+ });
27
+ });
28
+ }
29
+ export function validateApiKey(key) {
30
+ // Basic validation - just check it's not empty and has reasonable length
31
+ if (!key || key.length < 10) {
32
+ return false;
33
+ }
34
+ return true;
35
+ }
36
+ export function maskApiKey(key) {
37
+ if (!key || key.length < 8) {
38
+ return '********';
39
+ }
40
+ return '********' + key.slice(-4);
41
+ }
42
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/utils/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,MAAM,UAAU,SAAS;IACvB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAA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atBytes(bytes: number): string;
2
+ export declare function formatDuration(ms: number): string;
3
+ export declare function formatNumber(num: number): string;
4
+ export declare function truncate(str: string, maxLength: number): string;
5
+ export declare function wordWrap(text: string, maxWidth: number): string[];
6
+ export declare function indent(text: string, spaces: number): string;
7
+ export declare function stripAnsi(str: string): string;
8
+ export declare function escapeRegExp(string: string): string;
9
+ export declare function formatJSON(obj: unknown, indent?: number): string;
10
+ export declare function parseJSON<T>(str: string): T | null;
11
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG/D;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBjE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAM3D;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,SAAI,GAAG,MAAM,CAE3D;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMlD"}
@@ -0,0 +1,71 @@
1
+ export function formatBytes(bytes) {
2
+ if (bytes === 0)
3
+ return '0 B';
4
+ const k = 1024;
5
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
6
+ const i = Math.floor(Math.log(bytes) / Math.log(k));
7
+ return `${parseFloat((bytes / Math.pow(k, i)).toFixed(2))} ${sizes[i]}`;
8
+ }
9
+ export function formatDuration(ms) {
10
+ if (ms < 1000)
11
+ return `${ms}ms`;
12
+ if (ms < 60000)
13
+ return `${(ms / 1000).toFixed(1)}s`;
14
+ if (ms < 3600000)
15
+ return `${Math.floor(ms / 60000)}m ${Math.floor((ms % 60000) / 1000)}s`;
16
+ const hours = Math.floor(ms / 3600000);
17
+ const minutes = Math.floor((ms % 3600000) / 60000);
18
+ return `${hours}h ${minutes}m`;
19
+ }
20
+ export function formatNumber(num) {
21
+ return num.toLocaleString();
22
+ }
23
+ export function truncate(str, maxLength) {
24
+ if (str.length <= maxLength)
25
+ return str;
26
+ return str.slice(0, maxLength - 3) + '...';
27
+ }
28
+ export function wordWrap(text, maxWidth) {
29
+ const words = text.split(' ');
30
+ const lines = [];
31
+ let currentLine = '';
32
+ for (const word of words) {
33
+ if (currentLine.length + word.length + 1 <= maxWidth) {
34
+ currentLine += (currentLine ? ' ' : '') + word;
35
+ }
36
+ else {
37
+ if (currentLine)
38
+ lines.push(currentLine);
39
+ currentLine = word;
40
+ }
41
+ }
42
+ if (currentLine)
43
+ lines.push(currentLine);
44
+ return lines;
45
+ }
46
+ export function indent(text, spaces) {
47
+ const prefix = ' '.repeat(spaces);
48
+ return text
49
+ .split('\n')
50
+ .map((line) => prefix + line)
51
+ .join('\n');
52
+ }
53
+ export function stripAnsi(str) {
54
+ // eslint-disable-next-line no-control-regex
55
+ return str.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
56
+ }
57
+ export function escapeRegExp(string) {
58
+ return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
59
+ }
60
+ export function formatJSON(obj, indent = 2) {
61
+ return JSON.stringify(obj, null, indent);
62
+ }
63
+ export function parseJSON(str) {
64
+ try {
65
+ return JSON.parse(str);
66
+ }
67
+ catch {
68
+ return null;
69
+ }
70
+ }
71
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAE9B,MAAM,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,KAAK,GAAG,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAEpD,OAAO,GAAG,UAAU,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,EAAU;IACvC,IAAI,EAAE,GAAG,IAAI;QAAE,OAAO,GAAG,EAAE,IAAI,CAAC;IAChC,IAAI,EAAE,GAAG,KAAK;QAAE,OAAO,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC;IACpD,IAAI,EAAE,GAAG,OAAO;QAAE,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC;IAE1F,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,IAAI,C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ClC,OAAO,IAAI;SACR,KAAK,CAAC,IAAI,CAAC;SACX,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,GAAG,IAAI,CAAC;SAC5B,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,4CAA4C;IAC5C,OAAO,GAAG,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AACvD,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAAY,EAAE,MAAM,GAAG,CAAC;IACjD,OAAO,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;AAC3C,CAAC;AAED,MAAM,UAAU,SAAS,CAAI,GAAW;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAM,CAAC;IAC9B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './logger.js';
2
+ export * from './auth.js';
3
+ export * from './format.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './logger.js';
2
+ export * from './auth.js';
3
+ export * from './format.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
@@ -0,0 +1,18 @@
1
+ export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
2
+ declare class Logger {
3
+ private level;
4
+ private enableFile;
5
+ constructor();
6
+ setLevel(level: LogLevel): void;
7
+ enableFileLogging(enable: boolean): void;
8
+ private shouldLog;
9
+ private formatMessage;
10
+ private log;
11
+ debug(message: string, data?: unknown): void;
12
+ info(message: string, data?: unknown): void;
13
+ warn(message: string, data?: unknown): void;
14
+ error(message: string, data?: unknown): void;
15
+ }
16
+ export declare const logger: Logger;
17
+ export {};
18
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAK3D,cAAM,MAAM;IACV,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,UAAU,CAAS;;IAS3B,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,IAAI;IAI/B,iBAAiB,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI;IAOxC,OAAO,CAAC,SAAS;IAKjB,OAAO,CAAC,aAAa;IAMrB,OAAO,CAAC,GAAG;IAeX,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI5C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI3C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;IAI3C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI;CAG7C;AAED,eAAO,MAAM,MAAM,QAAe,CAAC"}
@@ -0,0 +1,61 @@
1
+ import * as fs from 'fs';
2
+ import * as path from 'path';
3
+ import * as os from 'os';
4
+ const LOG_DIR = path.join(os.homedir(), '.ai-router', 'logs');
5
+ const LOG_FILE = path.join(LOG_DIR, `ai-router-${new Date().toISOString().split('T')[0]}.log`);
6
+ class Logger {
7
+ level = 'info';
8
+ enableFile = false;
9
+ constructor() {
10
+ // Create log directory if file logging is enabled
11
+ if (this.enableFile && !fs.existsSync(LOG_DIR)) {
12
+ fs.mkdirSync(LOG_DIR, { recursive: true });
13
+ }
14
+ }
15
+ setLevel(level) {
16
+ this.level = level;
17
+ }
18
+ enableFileLogging(enable) {
19
+ this.enableFile = enable;
20
+ if (enable && !fs.existsSync(LOG_DIR)) {
21
+ fs.mkdirSync(LOG_DIR, { recursive: true });
22
+ }
23
+ }
24
+ shouldLog(level) {
25
+ const levels = ['debug', 'info', 'warn', 'error'];
26
+ return levels.indexOf(level) >= levels.indexOf(this.level);
27
+ }
28
+ formatMessage(level, message, data) {
29
+ const timestamp = new Date().toISOString();
30
+ const dataStr = data ? ` ${JSON.stringify(data)}` : '';
31
+ return `[${timestamp}] [${level.toUpperCase()}] ${message}${dataStr}`;
32
+ }
33
+ log(level, message, data) {
34
+ if (!this.shouldLog(level))
35
+ return;
36
+ const formatted = this.formatMessage(level, message, data);
37
+ // Write to file if enabled
38
+ if (this.enableFile) {
39
+ try {
40
+ fs.appendFileSync(LOG_FILE, formatted + '\n');
41
+ }
42
+ catch {
43
+ // Ignore file write errors
44
+ }
45
+ }
46
+ }
47
+ debug(message, data) {
48
+ this.log('debug', message, data);
49
+ }
50
+ info(message, data) {
51
+ this.log('info', message, data);
52
+ }
53
+ warn(message, data) {
54
+ this.log('warn', message, data);
55
+ }
56
+ error(message, data) {
57
+ this.log('error', message, data);
58
+ }
59
+ }
60
+ export const logger = new Logger();
61
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,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AAE,IAAI,CAAC,CAAC;IACnC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC"}
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "locdotech-ai",
3
+ "version": "1.0.0",
4
+ "description": "LocdoTech AI CLI - Claude Code style interface. Created by LocDo.Tech",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "ai": "bin/ai.js",
10
+ "ai-router": "bin/ai.js"
11
+ },
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "dev": "tsc -w",
15
+ "start": "node bin/ai.js",
16
+ "prepublishOnly": "echo ready"
17
+ },
18
+ "keywords": [
19
+ "ai",
20
+ "cli",
21
+ "claude",
22
+ "assistant",
23
+ "terminal",
24
+ "locdotech",
25
+ "ai-router"
26
+ ],
27
+ "author": "LocDoTech",
28
+ "license": "MIT",
29
+ "dependencies": {
30
+ "chalk": "^5.3.0",
31
+ "commander": "^12.1.0",
32
+ "eventsource": "^2.0.2",
33
+ "glob": "^10.3.10",
34
+ "ink": "^5.0.1",
35
+ "ink-select-input": "^6.2.0",
36
+ "ink-spinner": "^5.0.0",
37
+ "ink-text-input": "^6.0.0",
38
+ "marked": "^12.0.0",
39
+ "marked-terminal": "^7.0.0",
40
+ "node-fetch": "^3.3.2",
41
+ "ora": "^8.0.1",
42
+ "react": "^18.2.0",
43
+ "strip-ansi": "^7.1.0",
44
+ "ws": "^8.16.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/eventsource": "^1.1.15",
48
+ "@types/node": "^20.11.0",
49
+ "@types/react": "^18.2.48",
50
+ "@types/ws": "^8.5.10",
51
+ "typescript": "^5.3.3"
52
+ },
53
+ "engines": {
54
+ "node": ">=18.0.0"
55
+ },
56
+ "files": [
57
+ "dist",
58
+ "bin"
59
+ ],
60
+ "repository": {
61
+ "type": "git",
62
+ "url": "git+https://github.com/locdotech/ai-router-cli.git"
63
+ }
64
+ }