@pebblehouse/odin-cli 0.2.1 → 0.2.4
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 +32 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37,7 +37,7 @@ function clearCredentials() {
|
|
|
37
37
|
// src/auth/login.ts
|
|
38
38
|
var API_URL = process.env.ODIN_API_URL ?? "https://www.odin.mu";
|
|
39
39
|
async function login() {
|
|
40
|
-
return new Promise((
|
|
40
|
+
return new Promise((resolve2, reject) => {
|
|
41
41
|
const server = createServer(async (req, res) => {
|
|
42
42
|
if (req.method === "POST" && req.url?.startsWith("/callback")) {
|
|
43
43
|
let body = "";
|
|
@@ -70,7 +70,7 @@ async function login() {
|
|
|
70
70
|
</div>
|
|
71
71
|
</body></html>`);
|
|
72
72
|
server.close();
|
|
73
|
-
|
|
73
|
+
resolve2();
|
|
74
74
|
} else {
|
|
75
75
|
res.writeHead(404);
|
|
76
76
|
res.end();
|
|
@@ -329,6 +329,18 @@ plansCmd.command("create <slug> <title>").description("Create a plan").option("-
|
|
|
329
329
|
process.stdout.write(JSON.stringify(res) + "\n");
|
|
330
330
|
if (res.error) process.exit(1);
|
|
331
331
|
});
|
|
332
|
+
plansCmd.command("update <slug> <id>").description("Update a plan").option("--title <title>", "New title").option("--description <description>", "New description").option("--status <status>", "Plan status (active|completed|archived)").action(async (slug, id, opts) => {
|
|
333
|
+
const body = {};
|
|
334
|
+
if (opts.title) body.title = opts.title;
|
|
335
|
+
if (opts.description) body.description = opts.description;
|
|
336
|
+
if (opts.status) body.status = opts.status;
|
|
337
|
+
const res = await apiRequest(`/pebbles/${slug}/plans/${id}`, {
|
|
338
|
+
method: "PUT",
|
|
339
|
+
body
|
|
340
|
+
});
|
|
341
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
342
|
+
if (res.error) process.exit(1);
|
|
343
|
+
});
|
|
332
344
|
plansCmd.command("delete <slug> <id>").description("Delete a plan").action(async (slug, id) => {
|
|
333
345
|
const res = await apiRequest(`/pebbles/${slug}/plans/${id}`, {
|
|
334
346
|
method: "DELETE"
|
|
@@ -375,6 +387,9 @@ plansCmd.command("delete-phase <slug> <planId> <phaseId>").description("Delete a
|
|
|
375
387
|
|
|
376
388
|
// src/commands/conversations.ts
|
|
377
389
|
import { Command as Command8 } from "commander";
|
|
390
|
+
function collect(value, previous) {
|
|
391
|
+
return previous.concat([value]);
|
|
392
|
+
}
|
|
378
393
|
var conversationsCmd = new Command8("conversations").description("Manage conversations");
|
|
379
394
|
conversationsCmd.command("list <slug>").description("List conversations for a pebble").action(async (slug) => {
|
|
380
395
|
const res = await apiRequest(`/pebbles/${slug}/conversations`);
|
|
@@ -386,12 +401,14 @@ conversationsCmd.command("get <slug> <id>").description("Get a conversation by I
|
|
|
386
401
|
process.stdout.write(JSON.stringify(res) + "\n");
|
|
387
402
|
if (res.error) process.exit(1);
|
|
388
403
|
});
|
|
389
|
-
conversationsCmd.command("create <slug> <title>").description("Create a conversation").option("--summary <summary>", "Conversation summary").option("--source-url <url>", "Source URL").option("--session-id <id>", "Link to active session").action(async (slug, title, opts) => {
|
|
404
|
+
conversationsCmd.command("create <slug> <title>").description("Create a conversation").option("--summary <summary>", "Conversation summary").option("--key-point <point>", "Key point (repeatable)", collect, []).option("--decision <decision>", "Decision made (repeatable)", collect, []).option("--source-url <url>", "Source URL").option("--session-id <id>", "Link to active session").action(async (slug, title, opts) => {
|
|
390
405
|
const res = await apiRequest(`/pebbles/${slug}/conversations`, {
|
|
391
406
|
method: "POST",
|
|
392
407
|
body: {
|
|
393
408
|
title,
|
|
394
409
|
summary: opts.summary ?? null,
|
|
410
|
+
key_points: opts.keyPoint,
|
|
411
|
+
decisions_made: opts.decision,
|
|
395
412
|
source_url: opts.sourceUrl ?? null,
|
|
396
413
|
session_id: opts.sessionId ?? null
|
|
397
414
|
}
|
|
@@ -399,10 +416,12 @@ conversationsCmd.command("create <slug> <title>").description("Create a conversa
|
|
|
399
416
|
process.stdout.write(JSON.stringify(res) + "\n");
|
|
400
417
|
if (res.error) process.exit(1);
|
|
401
418
|
});
|
|
402
|
-
conversationsCmd.command("update <slug> <id>").description("Update a conversation").option("--title <title>", "New title").option("--summary <summary>", "New summary").option("--source-url <url>", "New source URL").action(async (slug, id, opts) => {
|
|
419
|
+
conversationsCmd.command("update <slug> <id>").description("Update a conversation").option("--title <title>", "New title").option("--summary <summary>", "New summary").option("--key-point <point>", "Key point (repeatable, replaces existing)", collect, []).option("--decision <decision>", "Decision made (repeatable, replaces existing)", collect, []).option("--source-url <url>", "New source URL").action(async (slug, id, opts) => {
|
|
403
420
|
const body = {};
|
|
404
421
|
if (opts.title) body.title = opts.title;
|
|
405
422
|
if (opts.summary) body.summary = opts.summary;
|
|
423
|
+
if (opts.keyPoint.length > 0) body.key_points = opts.keyPoint;
|
|
424
|
+
if (opts.decision.length > 0) body.decisions_made = opts.decision;
|
|
406
425
|
if (opts.sourceUrl) body.source_url = opts.sourceUrl;
|
|
407
426
|
const res = await apiRequest(`/pebbles/${slug}/conversations/${id}`, {
|
|
408
427
|
method: "PUT",
|
|
@@ -506,10 +525,15 @@ versionsCmd.command("get <slug> <docType> <versionId>").description("Get a speci
|
|
|
506
525
|
});
|
|
507
526
|
|
|
508
527
|
// src/index.ts
|
|
528
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
529
|
+
import { fileURLToPath } from "url";
|
|
530
|
+
import { dirname, resolve } from "path";
|
|
531
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
532
|
+
var pkg = JSON.parse(readFileSync5(resolve(__dirname, "../package.json"), "utf-8"));
|
|
509
533
|
var GOLD = "\x1B[33m";
|
|
510
534
|
var DIM = "\x1B[2m";
|
|
511
535
|
var RESET = "\x1B[0m";
|
|
512
|
-
var VERSION =
|
|
536
|
+
var VERSION = pkg.version;
|
|
513
537
|
function printBanner() {
|
|
514
538
|
const cwd = process.cwd();
|
|
515
539
|
console.error(`${GOLD}
|
|
@@ -550,6 +574,9 @@ program.addCommand(conversationsCmd);
|
|
|
550
574
|
program.addCommand(specsCmd);
|
|
551
575
|
program.addCommand(executionsCmd);
|
|
552
576
|
program.addCommand(versionsCmd);
|
|
577
|
+
process.on("exit", () => {
|
|
578
|
+
process.stderr.write("\n\n\n\n\n");
|
|
579
|
+
});
|
|
553
580
|
program.parseAsync(process.argv).catch((err) => {
|
|
554
581
|
console.error(err instanceof Error ? err.message : err);
|
|
555
582
|
process.exit(1);
|