@yu_robotics/remote-cli 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.
- package/LICENSE +21 -0
- package/README.md +94 -0
- package/bin/remote-cli.js +2 -0
- package/dist/client/MessageHandler.d.ts +92 -0
- package/dist/client/MessageHandler.d.ts.map +1 -0
- package/dist/client/MessageHandler.js +496 -0
- package/dist/client/MessageHandler.js.map +1 -0
- package/dist/client/WebSocketClient.d.ts +109 -0
- package/dist/client/WebSocketClient.d.ts.map +1 -0
- package/dist/client/WebSocketClient.js +234 -0
- package/dist/client/WebSocketClient.js.map +1 -0
- package/dist/commands/config.d.ts +35 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +195 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/init.d.ts +25 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +112 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/start.d.ts +20 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +108 -0
- package/dist/commands/start.js.map +1 -0
- package/dist/commands/status.d.ts +37 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +71 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/stop.d.ts +23 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +52 -0
- package/dist/commands/stop.js.map +1 -0
- package/dist/config/ConfigManager.d.ts +109 -0
- package/dist/config/ConfigManager.d.ts.map +1 -0
- package/dist/config/ConfigManager.js +262 -0
- package/dist/config/ConfigManager.js.map +1 -0
- package/dist/executor/ClaudeExecutor.d.ts +89 -0
- package/dist/executor/ClaudeExecutor.d.ts.map +1 -0
- package/dist/executor/ClaudeExecutor.js +365 -0
- package/dist/executor/ClaudeExecutor.js.map +1 -0
- package/dist/executor/ClaudePersistentExecutor.d.ts +175 -0
- package/dist/executor/ClaudePersistentExecutor.d.ts.map +1 -0
- package/dist/executor/ClaudePersistentExecutor.js +958 -0
- package/dist/executor/ClaudePersistentExecutor.js.map +1 -0
- package/dist/executor/index.d.ts +20 -0
- package/dist/executor/index.d.ts.map +1 -0
- package/dist/executor/index.js +48 -0
- package/dist/executor/index.js.map +1 -0
- package/dist/hooks/ClaudeCodeHooks.d.ts +281 -0
- package/dist/hooks/ClaudeCodeHooks.d.ts.map +1 -0
- package/dist/hooks/ClaudeCodeHooks.js +350 -0
- package/dist/hooks/ClaudeCodeHooks.js.map +1 -0
- package/dist/hooks/FeishuNotificationAdapter.d.ts +87 -0
- package/dist/hooks/FeishuNotificationAdapter.d.ts.map +1 -0
- package/dist/hooks/FeishuNotificationAdapter.js +280 -0
- package/dist/hooks/FeishuNotificationAdapter.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +10 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +333 -0
- package/dist/index.js.map +1 -0
- package/dist/security/DirectoryGuard.d.ts +54 -0
- package/dist/security/DirectoryGuard.d.ts.map +1 -0
- package/dist/security/DirectoryGuard.js +143 -0
- package/dist/security/DirectoryGuard.js.map +1 -0
- package/dist/types/config.d.ts +46 -0
- package/dist/types/config.d.ts.map +1 -0
- package/dist/types/config.js +22 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +110 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/FeishuMessageFormatter.d.ts +84 -0
- package/dist/utils/FeishuMessageFormatter.d.ts.map +1 -0
- package/dist/utils/FeishuMessageFormatter.js +395 -0
- package/dist/utils/FeishuMessageFormatter.js.map +1 -0
- package/dist/utils/stripAnsi.d.ts +21 -0
- package/dist/utils/stripAnsi.d.ts.map +1 -0
- package/dist/utils/stripAnsi.js +30 -0
- package/dist/utils/stripAnsi.js.map +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Feishu Message Formatter
|
|
4
|
+
* Formats tool use and tool result messages into beautiful Feishu interactive cards
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.formatToolUseMessage = formatToolUseMessage;
|
|
8
|
+
exports.formatToolResultMessage = formatToolResultMessage;
|
|
9
|
+
exports.createDividerElement = createDividerElement;
|
|
10
|
+
exports.createMarkdownElement = createMarkdownElement;
|
|
11
|
+
exports.createToolSeparator = createToolSeparator;
|
|
12
|
+
exports.createResponseSeparator = createResponseSeparator;
|
|
13
|
+
exports.createToolUseCard = createToolUseCard;
|
|
14
|
+
exports.createToolResultCard = createToolResultCard;
|
|
15
|
+
/**
|
|
16
|
+
* Format tool use message as a compact indicator
|
|
17
|
+
* Intelligently extracts key information based on tool type
|
|
18
|
+
* @param toolUse Tool use information
|
|
19
|
+
* @returns Formatted compact message string
|
|
20
|
+
*/
|
|
21
|
+
function formatToolUseMessage(toolUse) {
|
|
22
|
+
const emoji = getToolEmoji(toolUse.name);
|
|
23
|
+
const input = toolUse.input;
|
|
24
|
+
// Build the message with tool name
|
|
25
|
+
let message = `${emoji} **${toolUse.name}**`;
|
|
26
|
+
// Extract context based on tool type and available fields
|
|
27
|
+
const context = extractToolContext(toolUse.name, input);
|
|
28
|
+
if (context) {
|
|
29
|
+
message += ` - ${context}`;
|
|
30
|
+
}
|
|
31
|
+
return message;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Extract human-readable context from tool input based on tool type
|
|
35
|
+
* @param toolName Name of the tool
|
|
36
|
+
* @param input Tool input parameters
|
|
37
|
+
* @returns Formatted context string or null
|
|
38
|
+
*/
|
|
39
|
+
function extractToolContext(toolName, input) {
|
|
40
|
+
if (!input || typeof input !== 'object') {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
// Tool-specific handling - some tools have special logic
|
|
44
|
+
switch (toolName) {
|
|
45
|
+
case 'Bash':
|
|
46
|
+
return extractBashContext(input);
|
|
47
|
+
case 'Read':
|
|
48
|
+
case 'Write':
|
|
49
|
+
case 'Edit':
|
|
50
|
+
if (typeof input.file_path === 'string' && input.file_path) {
|
|
51
|
+
return formatFilePath(input.file_path, 50);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
case 'Grep':
|
|
55
|
+
if (typeof input.pattern === 'string' && input.pattern) {
|
|
56
|
+
const path = typeof input.path === 'string' ? input.path : '.';
|
|
57
|
+
return `\`${truncate(input.pattern, 30)}\` in ${formatFilePath(path, 25)}`;
|
|
58
|
+
}
|
|
59
|
+
break;
|
|
60
|
+
case 'Glob':
|
|
61
|
+
if (typeof input.pattern === 'string' && input.pattern) {
|
|
62
|
+
return `\`${truncate(input.pattern, 40)}\``;
|
|
63
|
+
}
|
|
64
|
+
break;
|
|
65
|
+
case 'WebFetch':
|
|
66
|
+
if (typeof input.url === 'string' && input.url) {
|
|
67
|
+
return `\`${truncate(input.url, 50)}\``;
|
|
68
|
+
}
|
|
69
|
+
break;
|
|
70
|
+
case 'WebSearch':
|
|
71
|
+
if (typeof input.query === 'string' && input.query) {
|
|
72
|
+
return `\`${truncate(input.query, 50)}\``;
|
|
73
|
+
}
|
|
74
|
+
break;
|
|
75
|
+
case 'Task':
|
|
76
|
+
return extractTaskContext(input);
|
|
77
|
+
case 'TodoWrite':
|
|
78
|
+
if (Array.isArray(input.todos)) {
|
|
79
|
+
return `${input.todos.length} item(s)`;
|
|
80
|
+
}
|
|
81
|
+
break;
|
|
82
|
+
case 'AskUserQuestion':
|
|
83
|
+
if (typeof input.question === 'string' && input.question) {
|
|
84
|
+
return truncate(input.question, 50);
|
|
85
|
+
}
|
|
86
|
+
break;
|
|
87
|
+
}
|
|
88
|
+
// Generic fallback: description field (most tools have this)
|
|
89
|
+
if (typeof input.description === 'string' && input.description) {
|
|
90
|
+
return truncate(input.description, 50);
|
|
91
|
+
}
|
|
92
|
+
// Fallback: prompt field
|
|
93
|
+
if (typeof input.prompt === 'string' && input.prompt) {
|
|
94
|
+
return truncate(input.prompt, 50);
|
|
95
|
+
}
|
|
96
|
+
// Fallback: try to find informative string fields
|
|
97
|
+
const informativePatterns = [
|
|
98
|
+
/path|file|dir|folder/i,
|
|
99
|
+
/url|link|href/i,
|
|
100
|
+
/name|title/i,
|
|
101
|
+
/content|text|body/i,
|
|
102
|
+
/message|note/i,
|
|
103
|
+
];
|
|
104
|
+
const stringFields = Object.entries(input)
|
|
105
|
+
.filter(([key, value]) => {
|
|
106
|
+
// Skip internal/meta fields and generic params
|
|
107
|
+
const skipFields = ['id', 'tool_use_id', 'timestamp', 'type', 'param1', 'param2', 'param3', 'arg1', 'arg2'];
|
|
108
|
+
if (skipFields.includes(key))
|
|
109
|
+
return false;
|
|
110
|
+
if (typeof value !== 'string' || value.length === 0)
|
|
111
|
+
return false;
|
|
112
|
+
if (value.length > 100)
|
|
113
|
+
return false; // Too long
|
|
114
|
+
// Only include if key matches informative patterns
|
|
115
|
+
return informativePatterns.some(pattern => pattern.test(key));
|
|
116
|
+
})
|
|
117
|
+
.map(([key, value]) => ({ key, value: value }));
|
|
118
|
+
if (stringFields.length > 0) {
|
|
119
|
+
// Pick the first reasonable string field
|
|
120
|
+
const field = stringFields[0];
|
|
121
|
+
return `\`${truncate(field.value, 50)}\``;
|
|
122
|
+
}
|
|
123
|
+
return null;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Extract context for Bash tool - shows both description and command
|
|
127
|
+
* @param input Tool input parameters
|
|
128
|
+
* @returns Formatted context string
|
|
129
|
+
*/
|
|
130
|
+
function extractBashContext(input) {
|
|
131
|
+
const hasDescription = typeof input.description === 'string' && input.description;
|
|
132
|
+
const hasCommand = typeof input.command === 'string' && input.command;
|
|
133
|
+
if (hasDescription && hasCommand) {
|
|
134
|
+
// Show both: description (command)
|
|
135
|
+
const desc = truncate(input.description, 35);
|
|
136
|
+
const cmd = truncate(input.command, 30);
|
|
137
|
+
return `${desc} (\`${cmd}\`)`;
|
|
138
|
+
}
|
|
139
|
+
if (hasDescription) {
|
|
140
|
+
return truncate(input.description, 50);
|
|
141
|
+
}
|
|
142
|
+
if (hasCommand) {
|
|
143
|
+
return `\`${truncate(input.command, 50)}\``;
|
|
144
|
+
}
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Extract context for Task tool
|
|
149
|
+
* @param input Tool input parameters
|
|
150
|
+
* @returns Formatted context string
|
|
151
|
+
*/
|
|
152
|
+
function extractTaskContext(input) {
|
|
153
|
+
const hasPrompt = typeof input.prompt === 'string' && input.prompt;
|
|
154
|
+
const hasSubagent = typeof input.subagent_type === 'string' && input.subagent_type;
|
|
155
|
+
if (hasPrompt && hasSubagent) {
|
|
156
|
+
return `[${input.subagent_type}] ${truncate(input.prompt, 40)}`;
|
|
157
|
+
}
|
|
158
|
+
if (hasPrompt) {
|
|
159
|
+
return truncate(input.prompt, 50);
|
|
160
|
+
}
|
|
161
|
+
if (hasSubagent) {
|
|
162
|
+
return `[${input.subagent_type}]`;
|
|
163
|
+
}
|
|
164
|
+
return null;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Format file path for display - shows filename with smart truncation for long paths
|
|
168
|
+
* For long paths: keeps the beginning and filename, truncates the middle
|
|
169
|
+
* @param filePath Full file path
|
|
170
|
+
* @param maxLength Maximum length for the displayed path
|
|
171
|
+
* @returns Formatted path string
|
|
172
|
+
*/
|
|
173
|
+
function formatFilePath(filePath, maxLength) {
|
|
174
|
+
if (filePath.length <= maxLength) {
|
|
175
|
+
return `\`${filePath}\``;
|
|
176
|
+
}
|
|
177
|
+
// Extract filename (last part after / or \)
|
|
178
|
+
const separator = filePath.includes('/') ? '/' : '\\';
|
|
179
|
+
const parts = filePath.split(separator);
|
|
180
|
+
const fileName = parts[parts.length - 1];
|
|
181
|
+
// If filename itself is too long, truncate it
|
|
182
|
+
if (fileName.length > maxLength - 5) {
|
|
183
|
+
return `\`${truncate(fileName, maxLength - 5)}\``;
|
|
184
|
+
}
|
|
185
|
+
// Keep the start of the path and the filename, truncate middle
|
|
186
|
+
const prefixLength = maxLength - fileName.length - 5; // 5 for "..." + separators
|
|
187
|
+
if (prefixLength > 5) {
|
|
188
|
+
const prefix = filePath.substring(0, prefixLength);
|
|
189
|
+
return `\`${prefix}.../${fileName}\``;
|
|
190
|
+
}
|
|
191
|
+
// Fallback: just show truncated full path
|
|
192
|
+
return `\`${truncate(filePath, maxLength)}\``;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Truncate string to max length with ellipsis
|
|
196
|
+
*/
|
|
197
|
+
function truncate(str, maxLength) {
|
|
198
|
+
if (str.length <= maxLength) {
|
|
199
|
+
return str;
|
|
200
|
+
}
|
|
201
|
+
return str.substring(0, maxLength - 3) + '...';
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Format tool result message as a status indicator with visual indentation
|
|
205
|
+
* Only shows details when there's an error
|
|
206
|
+
* @param result Tool result information
|
|
207
|
+
* @returns Formatted message string with quote-style indentation
|
|
208
|
+
*/
|
|
209
|
+
function formatToolResultMessage(result) {
|
|
210
|
+
// On error, show detailed information
|
|
211
|
+
if (result.isError) {
|
|
212
|
+
// Truncate long error content
|
|
213
|
+
const content = result.content.length > 200
|
|
214
|
+
? result.content.substring(0, 200) + '...'
|
|
215
|
+
: result.content;
|
|
216
|
+
return `❌ **Failed**: ${content}`;
|
|
217
|
+
}
|
|
218
|
+
// On success, just show a compact checkmark
|
|
219
|
+
return `✅ Done`;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Create a Feishu divider element (horizontal rule)
|
|
223
|
+
* @returns Divider element for card
|
|
224
|
+
*/
|
|
225
|
+
function createDividerElement() {
|
|
226
|
+
return { tag: 'hr' };
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Create a Feishu markdown element
|
|
230
|
+
* @param content Markdown content
|
|
231
|
+
* @returns Markdown element for card
|
|
232
|
+
*/
|
|
233
|
+
function createMarkdownElement(content) {
|
|
234
|
+
return { tag: 'markdown', content };
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Create a visual separator between tool executions (for text mode)
|
|
238
|
+
* @returns Formatted separator string
|
|
239
|
+
* @deprecated Use createDividerElement() for card-based messages
|
|
240
|
+
*/
|
|
241
|
+
function createToolSeparator() {
|
|
242
|
+
return '\n────────────────────\n';
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Create a visual separator between tool execution and final response (for text mode)
|
|
246
|
+
* @returns Formatted separator string
|
|
247
|
+
* @deprecated Use createDividerElement() for card-based messages
|
|
248
|
+
*/
|
|
249
|
+
function createResponseSeparator() {
|
|
250
|
+
return '\n\n';
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Create Feishu interactive card for tool use
|
|
254
|
+
* This can be used to create a collapsible card with full details
|
|
255
|
+
*/
|
|
256
|
+
function createToolUseCard(toolUse) {
|
|
257
|
+
const emoji = getToolEmoji(toolUse.name);
|
|
258
|
+
return {
|
|
259
|
+
config: { wide_screen_mode: true },
|
|
260
|
+
header: {
|
|
261
|
+
template: 'blue',
|
|
262
|
+
title: {
|
|
263
|
+
tag: 'plain_text',
|
|
264
|
+
content: `${emoji} ${toolUse.name}`,
|
|
265
|
+
},
|
|
266
|
+
},
|
|
267
|
+
elements: [
|
|
268
|
+
{
|
|
269
|
+
tag: 'markdown',
|
|
270
|
+
content: formatToolParamsMarkdown(toolUse.input),
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
tag: 'note',
|
|
274
|
+
elements: [
|
|
275
|
+
{
|
|
276
|
+
tag: 'plain_text',
|
|
277
|
+
content: `ID: ${toolUse.id}`,
|
|
278
|
+
},
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
],
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Create Feishu interactive card for tool result
|
|
286
|
+
*/
|
|
287
|
+
function createToolResultCard(result) {
|
|
288
|
+
const color = result.isError ? 'red' : 'green';
|
|
289
|
+
const emoji = result.isError ? '❌' : '✅';
|
|
290
|
+
const status = result.isError ? 'Failed' : 'Success';
|
|
291
|
+
return {
|
|
292
|
+
config: { wide_screen_mode: true },
|
|
293
|
+
header: {
|
|
294
|
+
template: color,
|
|
295
|
+
title: {
|
|
296
|
+
tag: 'plain_text',
|
|
297
|
+
content: `${emoji} Tool ${status}`,
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
elements: [
|
|
301
|
+
{
|
|
302
|
+
tag: 'markdown',
|
|
303
|
+
content: result.content.substring(0, 4000), // Feishu limit
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
tag: 'note',
|
|
307
|
+
elements: [
|
|
308
|
+
{
|
|
309
|
+
tag: 'plain_text',
|
|
310
|
+
content: `ID: ${result.id}`,
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
},
|
|
314
|
+
],
|
|
315
|
+
};
|
|
316
|
+
}
|
|
317
|
+
/**
|
|
318
|
+
* Get emoji for tool based on tool name
|
|
319
|
+
*/
|
|
320
|
+
function getToolEmoji(toolName) {
|
|
321
|
+
const emojiMap = {
|
|
322
|
+
'Bash': '💻',
|
|
323
|
+
'Read': '📖',
|
|
324
|
+
'Write': '✍️',
|
|
325
|
+
'Edit': '📝',
|
|
326
|
+
'Grep': '🔍',
|
|
327
|
+
'Glob': '📁',
|
|
328
|
+
'Task': '🤖',
|
|
329
|
+
'WebFetch': '🌐',
|
|
330
|
+
'WebSearch': '🔎',
|
|
331
|
+
'AskUserQuestion': '❓',
|
|
332
|
+
'TodoWrite': '📋',
|
|
333
|
+
};
|
|
334
|
+
return emojiMap[toolName] || '🔧';
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Format tool parameters in a compact way
|
|
338
|
+
*/
|
|
339
|
+
function formatToolParams(input) {
|
|
340
|
+
const entries = Object.entries(input);
|
|
341
|
+
if (entries.length === 0) {
|
|
342
|
+
return '';
|
|
343
|
+
}
|
|
344
|
+
// Show only the most important parameters compactly
|
|
345
|
+
const lines = [];
|
|
346
|
+
for (const [key, value] of entries) {
|
|
347
|
+
if (typeof value === 'string') {
|
|
348
|
+
// For strings, show first 50 chars
|
|
349
|
+
const displayValue = value.length > 50 ? value.substring(0, 50) + '...' : value;
|
|
350
|
+
lines.push(` ${key}: ${displayValue}`);
|
|
351
|
+
}
|
|
352
|
+
else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
353
|
+
lines.push(` ${key}: ${value}`);
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
// For objects/arrays, show type only
|
|
357
|
+
lines.push(` ${key}: [${Array.isArray(value) ? 'array' : 'object'}]`);
|
|
358
|
+
}
|
|
359
|
+
// Limit to 3 parameters for compactness
|
|
360
|
+
if (lines.length >= 3) {
|
|
361
|
+
const remaining = entries.length - 3;
|
|
362
|
+
if (remaining > 0) {
|
|
363
|
+
lines.push(` ... and ${remaining} more`);
|
|
364
|
+
}
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
return lines.join('\n');
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Format tool parameters as markdown for card display
|
|
372
|
+
*/
|
|
373
|
+
function formatToolParamsMarkdown(input) {
|
|
374
|
+
const entries = Object.entries(input);
|
|
375
|
+
if (entries.length === 0) {
|
|
376
|
+
return '*No parameters*';
|
|
377
|
+
}
|
|
378
|
+
const lines = ['**Parameters:**'];
|
|
379
|
+
for (const [key, value] of entries) {
|
|
380
|
+
if (typeof value === 'string') {
|
|
381
|
+
// Use code blocks for strings
|
|
382
|
+
lines.push(`- **${key}**: \`${value.substring(0, 100)}${value.length > 100 ? '...' : ''}\``);
|
|
383
|
+
}
|
|
384
|
+
else if (typeof value === 'number' || typeof value === 'boolean') {
|
|
385
|
+
lines.push(`- **${key}**: ${value}`);
|
|
386
|
+
}
|
|
387
|
+
else {
|
|
388
|
+
// For complex types, use JSON
|
|
389
|
+
const jsonStr = JSON.stringify(value, null, 2);
|
|
390
|
+
lines.push(`- **${key}**:\n\`\`\`json\n${jsonStr.substring(0, 200)}${jsonStr.length > 200 ? '\n...' : ''}\n\`\`\``);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
return lines.join('\n');
|
|
394
|
+
}
|
|
395
|
+
//# sourceMappingURL=FeishuMessageFormatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeishuMessageFormatter.js","sourceRoot":"","sources":["../../src/utils/FeishuMessageFormatter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;AA0BH,oDAeC;AAiND,0DAYC;AA0BD,oDAEC;AAOD,sDAEC;AAOD,kDAEC;AAOD,0DAEC;AAOD,8CA4BC;AAKD,oDA8BC;AA/WD;;;;;GAKG;AACH,SAAgB,oBAAoB,CAAC,OAAoB;IACvD,MAAM,KAAK,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAE5B,mCAAmC;IACnC,IAAI,OAAO,GAAG,GAAG,KAAK,MAAM,OAAO,CAAC,IAAI,IAAI,CAAC;IAE7C,0DAA0D;IAC1D,MAAM,OAAO,GAAG,kBAAkB,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAExD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,IAAI,MAAM,OAAO,EAAE,CAAC;IAC7B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,SAAS,kBAAkB,CAAC,QAAgB,EAAE,KAA0B;IACtE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IACd,CAAC;IAED,yDAAyD;IAC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AC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strip ANSI escape sequences from a string
|
|
3
|
+
*
|
|
4
|
+
* ANSI escape sequences are used for terminal colors and formatting.
|
|
5
|
+
* They look like: \x1B[0m, \x1B[31m, etc.
|
|
6
|
+
*
|
|
7
|
+
* This regex matches:
|
|
8
|
+
* - \x1B or \u001B: ESC character
|
|
9
|
+
* - \[: Opening bracket
|
|
10
|
+
* - [0-9;]*: Any number of digits and semicolons (parameters)
|
|
11
|
+
* - [a-zA-Z]: The command letter
|
|
12
|
+
*
|
|
13
|
+
* @param text Text that may contain ANSI escape sequences
|
|
14
|
+
* @returns Text with ANSI escape sequences removed
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* stripAnsi('\x1B[31mRed Text\x1B[0m') // Returns: "Red Text"
|
|
18
|
+
* stripAnsi('[7m [1m [36m RUN [39m') // Returns: " RUN "
|
|
19
|
+
*/
|
|
20
|
+
export declare function stripAnsi(text: string): string;
|
|
21
|
+
//# sourceMappingURL=stripAnsi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripAnsi.d.ts","sourceRoot":"","sources":["../../src/utils/stripAnsi.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO9C"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.stripAnsi = stripAnsi;
|
|
4
|
+
/**
|
|
5
|
+
* Strip ANSI escape sequences from a string
|
|
6
|
+
*
|
|
7
|
+
* ANSI escape sequences are used for terminal colors and formatting.
|
|
8
|
+
* They look like: \x1B[0m, \x1B[31m, etc.
|
|
9
|
+
*
|
|
10
|
+
* This regex matches:
|
|
11
|
+
* - \x1B or \u001B: ESC character
|
|
12
|
+
* - \[: Opening bracket
|
|
13
|
+
* - [0-9;]*: Any number of digits and semicolons (parameters)
|
|
14
|
+
* - [a-zA-Z]: The command letter
|
|
15
|
+
*
|
|
16
|
+
* @param text Text that may contain ANSI escape sequences
|
|
17
|
+
* @returns Text with ANSI escape sequences removed
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* stripAnsi('\x1B[31mRed Text\x1B[0m') // Returns: "Red Text"
|
|
21
|
+
* stripAnsi('[7m [1m [36m RUN [39m') // Returns: " RUN "
|
|
22
|
+
*/
|
|
23
|
+
function stripAnsi(text) {
|
|
24
|
+
if (!text) {
|
|
25
|
+
return text;
|
|
26
|
+
}
|
|
27
|
+
// Match ANSI escape sequences: ESC [ parameters command
|
|
28
|
+
return text.replace(/\x1B\[[0-9;]*[a-zA-Z]/g, '');
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=stripAnsi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stripAnsi.js","sourceRoot":"","sources":["../../src/utils/stripAnsi.ts"],"names":[],"mappings":";;AAmBA,8BAOC;AA1BD;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,SAAS,CAAC,IAAY;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,IAAI,CAAC;IACd,CAAC;IAED,wDAAwD;IACxD,OAAO,IAAI,CAAC,OAAO,CAAC,wBAAwB,EAAE,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@yu_robotics/remote-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Remote control Claude Code CLI via mobile",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"bin": {
|
|
8
|
+
"remote-cli": "./bin/remote-cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"bin",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsx watch src/index.ts",
|
|
19
|
+
"test": "vitest",
|
|
20
|
+
"test:coverage": "vitest --coverage",
|
|
21
|
+
"prepublishOnly": "npm run build && npm test"
|
|
22
|
+
},
|
|
23
|
+
"publishConfig": {
|
|
24
|
+
"access": "public"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/xiaoyu/remote-cli.git",
|
|
29
|
+
"directory": "packages/cli"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://github.com/xiaoyu/remote-cli#readme",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/xiaoyu/remote-cli/issues"
|
|
34
|
+
},
|
|
35
|
+
"keywords": [
|
|
36
|
+
"claude",
|
|
37
|
+
"cli",
|
|
38
|
+
"remote",
|
|
39
|
+
"feishu",
|
|
40
|
+
"mobile",
|
|
41
|
+
"claude-code"
|
|
42
|
+
],
|
|
43
|
+
"author": "xiaoyu",
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.0",
|
|
50
|
+
"ws": "^8.18.0",
|
|
51
|
+
"commander": "^12.0.0",
|
|
52
|
+
"conf": "^12.0.0",
|
|
53
|
+
"chalk": "^5.3.0",
|
|
54
|
+
"ora": "^8.0.1",
|
|
55
|
+
"node-machine-id": "^1.1.12",
|
|
56
|
+
"dotenv": "^16.4.1"
|
|
57
|
+
},
|
|
58
|
+
"devDependencies": {
|
|
59
|
+
"@types/ws": "^8.5.10",
|
|
60
|
+
"tsx": "^4.7.0",
|
|
61
|
+
"vitest": "^1.2.0"
|
|
62
|
+
}
|
|
63
|
+
}
|