@meet-ai/cli 0.0.7 → 0.0.8
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/dist/index.js +30 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -185,6 +185,20 @@ function createClient(baseUrl, apiKey) {
|
|
|
185
185
|
}
|
|
186
186
|
return connect();
|
|
187
187
|
},
|
|
188
|
+
async sendLog(roomId, sender, content, color, messageId) {
|
|
189
|
+
return withRetry(async () => {
|
|
190
|
+
const res = await fetch(`${baseUrl}/api/rooms/${roomId}/logs`, {
|
|
191
|
+
method: "POST",
|
|
192
|
+
headers: headers(),
|
|
193
|
+
body: JSON.stringify({ sender, content, ...color && { color }, ...messageId && { message_id: messageId } })
|
|
194
|
+
});
|
|
195
|
+
if (!res.ok) {
|
|
196
|
+
const err = await res.json().catch(() => ({}));
|
|
197
|
+
throw new Error(err.error ?? `HTTP ${res.status}`);
|
|
198
|
+
}
|
|
199
|
+
return res.json();
|
|
200
|
+
});
|
|
201
|
+
},
|
|
188
202
|
async sendTeamInfo(roomId, payload) {
|
|
189
203
|
return withRetry(async () => {
|
|
190
204
|
const res = await fetch(`${baseUrl}/api/rooms/${roomId}/team-info`, {
|
|
@@ -393,6 +407,19 @@ switch (command) {
|
|
|
393
407
|
process.on("SIGTERM", shutdown);
|
|
394
408
|
break;
|
|
395
409
|
}
|
|
410
|
+
case "send-log": {
|
|
411
|
+
const { positional: slPos, flags: slFlags } = parseFlags(args);
|
|
412
|
+
const [slRoomId, slSender, ...slRest] = slPos;
|
|
413
|
+
const slContent = slRest.join(" ").replace(/\\n/g, `
|
|
414
|
+
`);
|
|
415
|
+
if (!slRoomId || !slSender || !slContent) {
|
|
416
|
+
console.error("Usage: cli send-log <roomId> <sender> <content> [--color <color>] [--message-id <id>]");
|
|
417
|
+
process.exit(1);
|
|
418
|
+
}
|
|
419
|
+
const log = await client.sendLog(slRoomId, slSender, slContent, slFlags.color, slFlags["message-id"]);
|
|
420
|
+
console.log(`Log sent: ${log.id}`);
|
|
421
|
+
break;
|
|
422
|
+
}
|
|
396
423
|
case "send-team-info": {
|
|
397
424
|
const [tiRoomId, tiPayload] = args;
|
|
398
425
|
if (!tiRoomId || !tiPayload) {
|
|
@@ -426,6 +453,9 @@ Commands:
|
|
|
426
453
|
create-room <name> Create a new chat room
|
|
427
454
|
send-message <roomId> <sender> <content> Send a message to a room
|
|
428
455
|
--color <color> Set sender name color (e.g. #ff0000, red)
|
|
456
|
+
send-log <roomId> <sender> <content> Send a log entry to a room
|
|
457
|
+
--color <color> Set sender name color (e.g. #ff0000, red)
|
|
458
|
+
--message-id <id> Associate log with a parent message
|
|
429
459
|
poll <roomId> [options] Fetch messages from a room
|
|
430
460
|
--after <id> Only messages after this ID
|
|
431
461
|
--exclude <sender> Exclude messages from sender
|