Skip to content

Commit 1b70eda

Browse files
committed
Add CLI boilerplate
1 parent c5fc676 commit 1b70eda

File tree

5 files changed

+56
-12
lines changed

5 files changed

+56
-12
lines changed

bun.lockb

0 Bytes
Binary file not shown.

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
"build": "tsc",
1111
"lint": "eslint src"
1212
},
13+
"bin": {
14+
"agents": "dist/cli.js"
15+
},
1316
"devDependencies": {
1417
"@types/bun": "latest",
1518
"eslint": "^8.57.0",

src/cli.ts

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
import { version } from './index';
6+
import { Option, Command } from 'commander';
7+
8+
const program = new Command();
9+
program
10+
.name('agents')
11+
.description('LiveKit Agents CLI')
12+
.version(version)
13+
.addOption(
14+
new Option('--log-level', 'Set the logging level').choices([
15+
'DEBUG',
16+
'INFO',
17+
'WARNING',
18+
'ERROR',
19+
'CRITICAL',
20+
]),
21+
);
22+
23+
program
24+
.command('start')
25+
.description('Start the worker')
26+
.addOption(
27+
new Option('--url <string>', 'LiveKit server or Cloud project websocket URL')
28+
.makeOptionMandatory(true)
29+
.env('LIVEKIT_URL'),
30+
)
31+
.addOption(
32+
new Option('--api-key <string>', "LiveKit server or Cloud project's API key")
33+
.makeOptionMandatory(true)
34+
.env('LIVEKIT_API_KEY'),
35+
)
36+
.addOption(
37+
new Option('--api-secret <string>', "LiveKit server or Cloud project's API secret")
38+
.makeOptionMandatory(true)
39+
.env('LIVEKIT_API_SECRET'),
40+
)
41+
.action(() => {
42+
return;
43+
});
44+
45+
program.parse();

src/index.ts

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,6 @@
22
//
33
// SPDX-License-Identifier: Apache-2.0
44

5-
import { VAD, VADEventType, VADStream } from './vad';
6-
import { Plugin } from './plugin';
7-
8-
const version = '0.1.0';
9-
10-
export {
11-
version,
12-
VAD,
13-
VADEventType,
14-
VADStream,
15-
Plugin,
16-
};
5+
export { VAD, VADEventType, VADStream } from './vad';
6+
export { Plugin } from './plugin';
7+
export { version } from './version';

src/version.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// SPDX-FileCopyrightText: 2024 LiveKit, Inc.
2+
//
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
export const version = '0.1.0';

0 commit comments

Comments
 (0)