@meet-ai/cli 0.0.10 → 0.0.12
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 +139 -19
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -227,7 +227,8 @@ function createClient(baseUrl, apiKey) {
|
|
|
227
227
|
});
|
|
228
228
|
if (!res.ok) {
|
|
229
229
|
const err = await res.json().catch(() => ({}));
|
|
230
|
-
|
|
230
|
+
const msg = err.error;
|
|
231
|
+
throw new Error(typeof msg === "string" ? msg : msg ? JSON.stringify(msg) : `HTTP ${res.status}`);
|
|
231
232
|
}
|
|
232
233
|
return res.text();
|
|
233
234
|
});
|
|
@@ -348,9 +349,115 @@ function checkIdleAgents(inboxDir, members, excludeAgent, notified, now = Date.n
|
|
|
348
349
|
return newlyIdle;
|
|
349
350
|
}
|
|
350
351
|
|
|
352
|
+
// src/config.ts
|
|
353
|
+
import { readFileSync as readFileSync2, existsSync } from "node:fs";
|
|
354
|
+
import { join, resolve } from "node:path";
|
|
355
|
+
import { homedir } from "node:os";
|
|
356
|
+
function loadSettingsFromPath(path) {
|
|
357
|
+
try {
|
|
358
|
+
if (!existsSync(path)) {
|
|
359
|
+
return null;
|
|
360
|
+
}
|
|
361
|
+
const content = readFileSync2(path, "utf-8");
|
|
362
|
+
return JSON.parse(content);
|
|
363
|
+
} catch {
|
|
364
|
+
return null;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
function getMeetAiConfig() {
|
|
368
|
+
if (process.env.MEET_AI_URL) {
|
|
369
|
+
return {
|
|
370
|
+
url: process.env.MEET_AI_URL,
|
|
371
|
+
key: process.env.MEET_AI_KEY
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const projectSettingsPath = resolve("./.claude/settings.json");
|
|
375
|
+
const projectSettings = loadSettingsFromPath(projectSettingsPath);
|
|
376
|
+
if (projectSettings?.env?.MEET_AI_URL) {
|
|
377
|
+
return {
|
|
378
|
+
url: projectSettings.env.MEET_AI_URL,
|
|
379
|
+
key: projectSettings.env.MEET_AI_KEY
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
const userSettingsPath = join(homedir(), ".claude/settings.json");
|
|
383
|
+
const userSettings = loadSettingsFromPath(userSettingsPath);
|
|
384
|
+
if (userSettings?.env?.MEET_AI_URL) {
|
|
385
|
+
return {
|
|
386
|
+
url: userSettings.env.MEET_AI_URL,
|
|
387
|
+
key: userSettings.env.MEET_AI_KEY
|
|
388
|
+
};
|
|
389
|
+
}
|
|
390
|
+
return {
|
|
391
|
+
url: "https://meet-ai.cc",
|
|
392
|
+
key: undefined
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/spawner.ts
|
|
397
|
+
import { spawn, execSync } from "node:child_process";
|
|
398
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
399
|
+
import { join as join2 } from "node:path";
|
|
400
|
+
import { homedir as homedir2, platform } from "node:os";
|
|
401
|
+
function findClaudeCli() {
|
|
402
|
+
try {
|
|
403
|
+
const command = platform() === "win32" ? "where claude" : "which claude";
|
|
404
|
+
const result = execSync(command, { encoding: "utf8", stdio: ["pipe", "pipe", "ignore"] }).trim();
|
|
405
|
+
const claudePath = result.split(`
|
|
406
|
+
`)[0].trim();
|
|
407
|
+
if (claudePath && existsSync2(claudePath)) {
|
|
408
|
+
return claudePath;
|
|
409
|
+
}
|
|
410
|
+
} catch {}
|
|
411
|
+
const envPath = process.env.MEET_AI_CLAUDE_PATH;
|
|
412
|
+
if (envPath && existsSync2(envPath)) {
|
|
413
|
+
return envPath;
|
|
414
|
+
}
|
|
415
|
+
const home = homedir2();
|
|
416
|
+
const commonPaths = [
|
|
417
|
+
join2(home, ".bun", "bin", "claude"),
|
|
418
|
+
"/opt/homebrew/bin/claude",
|
|
419
|
+
"/usr/local/bin/claude",
|
|
420
|
+
join2(home, ".local", "bin", "claude")
|
|
421
|
+
];
|
|
422
|
+
for (const path of commonPaths) {
|
|
423
|
+
if (existsSync2(path)) {
|
|
424
|
+
return path;
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
throw new Error(`
|
|
428
|
+
Claude Code is not installed
|
|
429
|
+
|
|
430
|
+
Please install Claude Code:
|
|
431
|
+
npm install -g @anthropic-ai/claude-code
|
|
432
|
+
|
|
433
|
+
Or set MEET_AI_CLAUDE_PATH to the Claude Code CLI path.
|
|
434
|
+
`.trim());
|
|
435
|
+
}
|
|
436
|
+
async function spawnInteractive() {
|
|
437
|
+
const claudePath = findClaudeCli();
|
|
438
|
+
return new Promise((resolve2, reject) => {
|
|
439
|
+
const child = spawn(claudePath, [], {
|
|
440
|
+
stdio: "inherit",
|
|
441
|
+
env: {
|
|
442
|
+
...process.env,
|
|
443
|
+
DISABLE_AUTOUPDATER: "1"
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
child.on("exit", (code) => {
|
|
447
|
+
if (code === 0 || code === null) {
|
|
448
|
+
resolve2();
|
|
449
|
+
} else {
|
|
450
|
+
reject(new Error(`Claude exited with code ${code}`));
|
|
451
|
+
}
|
|
452
|
+
});
|
|
453
|
+
child.on("error", reject);
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
|
|
351
457
|
// src/index.ts
|
|
352
|
-
var
|
|
353
|
-
var
|
|
458
|
+
var config = getMeetAiConfig();
|
|
459
|
+
var API_URL = config.url;
|
|
460
|
+
var API_KEY = config.key;
|
|
354
461
|
var client = createClient(API_URL, API_KEY);
|
|
355
462
|
var [command, ...args] = process.argv.slice(2);
|
|
356
463
|
async function downloadMessageAttachments(roomId, messageId) {
|
|
@@ -582,13 +689,13 @@ switch (command) {
|
|
|
582
689
|
}
|
|
583
690
|
case "send-team-info": {
|
|
584
691
|
if (args.includes("--help")) {
|
|
585
|
-
console.log("Usage: meet-ai send-team-info <roomId> '<json
|
|
692
|
+
console.log("Usage: meet-ai send-team-info <roomId> '<json>'");
|
|
586
693
|
process.exit(0);
|
|
587
694
|
}
|
|
588
|
-
rejectFlagLikeArgs(args, "meet-ai send-team-info <roomId> '<json
|
|
695
|
+
rejectFlagLikeArgs(args, "meet-ai send-team-info <roomId> '<json>'");
|
|
589
696
|
const [tiRoomId, tiPayload] = args;
|
|
590
697
|
if (!tiRoomId || !tiPayload) {
|
|
591
|
-
console.error("Usage: meet-ai send-team-info <roomId> '<json
|
|
698
|
+
console.error("Usage: meet-ai send-team-info <roomId> '<json>'");
|
|
592
699
|
process.exit(1);
|
|
593
700
|
}
|
|
594
701
|
try {
|
|
@@ -666,32 +773,45 @@ switch (command) {
|
|
|
666
773
|
break;
|
|
667
774
|
}
|
|
668
775
|
default: {
|
|
776
|
+
if (!command) {
|
|
777
|
+
console.log(`Starting Claude Code... (Press Ctrl+C to exit)
|
|
778
|
+
`);
|
|
779
|
+
await spawnInteractive();
|
|
780
|
+
break;
|
|
781
|
+
}
|
|
669
782
|
console.log(`meet-ai CLI
|
|
670
783
|
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
784
|
+
Usage:
|
|
785
|
+
meet-ai Start Claude Code interactively (default)
|
|
786
|
+
meet-ai <command> [options] Run a specific command
|
|
787
|
+
|
|
788
|
+
Configuration (in order of priority):
|
|
789
|
+
1. Environment variables:
|
|
790
|
+
MEET_AI_URL Server URL (default: https://meet-ai.cc)
|
|
791
|
+
MEET_AI_KEY API key for authentication
|
|
792
|
+
2. Project settings: ./.claude/settings.json
|
|
793
|
+
3. User settings: ~/.claude/settings.json
|
|
674
794
|
|
|
675
795
|
Commands:
|
|
676
|
-
create-room <name>
|
|
677
|
-
delete-room <roomId>
|
|
678
|
-
send-message <roomId> <sender> <content>
|
|
796
|
+
create-room <name> Create a new chat room
|
|
797
|
+
delete-room <roomId> Delete a room and all its messages
|
|
798
|
+
send-message <roomId> <sender> <content> Send a message to a room
|
|
679
799
|
--color <color> Set sender name color (e.g. #ff0000, red)
|
|
680
|
-
send-log <roomId> <sender> <content>
|
|
800
|
+
send-log <roomId> <sender> <content> Send a log entry to a room
|
|
681
801
|
--color <color> Set sender name color (e.g. #ff0000, red)
|
|
682
802
|
--message-id <id> Associate log with a parent message
|
|
683
|
-
poll <roomId> [options]
|
|
803
|
+
poll <roomId> [options] Fetch messages from a room
|
|
684
804
|
--after <id> Only messages after this ID
|
|
685
805
|
--exclude <sender> Exclude messages from sender
|
|
686
806
|
--sender-type <type> Filter by sender_type (human|agent)
|
|
687
|
-
listen <roomId> [options]
|
|
807
|
+
listen <roomId> [options] Stream messages via WebSocket
|
|
688
808
|
--exclude <sender> Exclude messages from sender
|
|
689
809
|
--sender-type <type> Filter by sender_type (human|agent)
|
|
690
810
|
--team <name> Write to Claude Code team inbox
|
|
691
811
|
--inbox <agent> Target agent inbox (requires --team)
|
|
692
|
-
download-attachment <attachmentId>
|
|
693
|
-
send-team-info <roomId> '<json>'
|
|
694
|
-
send-tasks <roomId> '<json>'
|
|
695
|
-
generate-key
|
|
812
|
+
download-attachment <attachmentId> Download an attachment to /tmp
|
|
813
|
+
send-team-info <roomId> '<json>' Send team info to a room
|
|
814
|
+
send-tasks <roomId> '<json>' Send tasks info to a room
|
|
815
|
+
generate-key Generate a new API key`);
|
|
696
816
|
}
|
|
697
817
|
}
|