@loghead/core 0.1.14 → 0.1.16

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/cli_main.js CHANGED
@@ -20,7 +20,7 @@ async function main() {
20
20
  console.log("Initializing database...");
21
21
  await (0, migrate_1.migrate)();
22
22
  })
23
- .command("start", "Start API Server", {}, async () => {
23
+ .command(["start", "$0"], "Start API Server", {}, async () => {
24
24
  console.log("Ensuring database is initialized...");
25
25
  await (0, migrate_1.migrate)(false); // Run migrations silently
26
26
  const token = await auth.getOrCreateMcpToken();
@@ -44,6 +44,10 @@ async function main() {
44
44
  .command("add <name>", "Add project", {}, (argv) => {
45
45
  const p = db.createProject(argv.name);
46
46
  console.log(`Project created: ${p.id}`);
47
+ })
48
+ .command("delete <id>", "Delete project", {}, (argv) => {
49
+ db.deleteProject(argv.id);
50
+ console.log(`Project deleted: ${argv.id}`);
47
51
  });
48
52
  })
49
53
  .command("streams <cmd> [type] [name]", "Manage streams", (yargs) => {
@@ -66,9 +70,15 @@ async function main() {
66
70
  console.log(`Stream created: ${s.id}`);
67
71
  console.log(`Token: ${s.token}`);
68
72
  })
69
- .command("token <streamId>", "Get token for stream", {}, async (argv) => {
70
- const token = await auth.createStreamToken(argv.streamId);
73
+ .command("token", "Get token for stream", {
74
+ stream: { type: "string", demandOption: true }
75
+ }, async (argv) => {
76
+ const token = await auth.createStreamToken(argv.stream);
71
77
  console.log(`Token: ${token}`);
78
+ })
79
+ .command("delete <id>", "Delete stream", {}, (argv) => {
80
+ db.deleteStream(argv.id);
81
+ console.log(`Stream deleted: ${argv.id}`);
72
82
  });
73
83
  })
74
84
  .demandCommand(1)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loghead/core",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "Core API and Database for Loghead",
5
5
  "repository": {
6
6
  "type": "git",
package/src/cli_main.ts CHANGED
@@ -18,7 +18,7 @@ async function main() {
18
18
  console.log("Initializing database...");
19
19
  await migrate();
20
20
  })
21
- .command("start", "Start API Server", {}, async () => {
21
+ .command(["start", "$0"], "Start API Server", {}, async () => {
22
22
  console.log("Ensuring database is initialized...");
23
23
  await migrate(false); // Run migrations silently
24
24
 
@@ -45,6 +45,10 @@ async function main() {
45
45
  .command("add <name>", "Add project", {}, (argv) => {
46
46
  const p = db.createProject(argv.name as string);
47
47
  console.log(`Project created: ${p.id}`);
48
+ })
49
+ .command("delete <id>", "Delete project", {}, (argv) => {
50
+ db.deleteProject(argv.id as string);
51
+ console.log(`Project deleted: ${argv.id}`);
48
52
  });
49
53
  })
50
54
  .command("streams <cmd> [type] [name]", "Manage streams", (yargs) => {
@@ -67,9 +71,15 @@ async function main() {
67
71
  console.log(`Stream created: ${s.id}`);
68
72
  console.log(`Token: ${s.token}`);
69
73
  })
70
- .command("token <streamId>", "Get token for stream", {}, async (argv) => {
71
- const token = await auth.createStreamToken(argv.streamId as string);
74
+ .command("token", "Get token for stream", {
75
+ stream: { type: "string", demandOption: true }
76
+ }, async (argv) => {
77
+ const token = await auth.createStreamToken(argv.stream as string);
72
78
  console.log(`Token: ${token}`);
79
+ })
80
+ .command("delete <id>", "Delete stream", {}, (argv) => {
81
+ db.deleteStream(argv.id as string);
82
+ console.log(`Stream deleted: ${argv.id}`);
73
83
  });
74
84
  })
75
85
  .demandCommand(1)