@pebblehouse/odin-cli 0.2.1 → 0.2.2
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 +17 -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();
|
|
@@ -375,6 +375,9 @@ plansCmd.command("delete-phase <slug> <planId> <phaseId>").description("Delete a
|
|
|
375
375
|
|
|
376
376
|
// src/commands/conversations.ts
|
|
377
377
|
import { Command as Command8 } from "commander";
|
|
378
|
+
function collect(value, previous) {
|
|
379
|
+
return previous.concat([value]);
|
|
380
|
+
}
|
|
378
381
|
var conversationsCmd = new Command8("conversations").description("Manage conversations");
|
|
379
382
|
conversationsCmd.command("list <slug>").description("List conversations for a pebble").action(async (slug) => {
|
|
380
383
|
const res = await apiRequest(`/pebbles/${slug}/conversations`);
|
|
@@ -386,12 +389,14 @@ conversationsCmd.command("get <slug> <id>").description("Get a conversation by I
|
|
|
386
389
|
process.stdout.write(JSON.stringify(res) + "\n");
|
|
387
390
|
if (res.error) process.exit(1);
|
|
388
391
|
});
|
|
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) => {
|
|
392
|
+
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
393
|
const res = await apiRequest(`/pebbles/${slug}/conversations`, {
|
|
391
394
|
method: "POST",
|
|
392
395
|
body: {
|
|
393
396
|
title,
|
|
394
397
|
summary: opts.summary ?? null,
|
|
398
|
+
key_points: opts.keyPoint,
|
|
399
|
+
decisions_made: opts.decision,
|
|
395
400
|
source_url: opts.sourceUrl ?? null,
|
|
396
401
|
session_id: opts.sessionId ?? null
|
|
397
402
|
}
|
|
@@ -399,10 +404,12 @@ conversationsCmd.command("create <slug> <title>").description("Create a conversa
|
|
|
399
404
|
process.stdout.write(JSON.stringify(res) + "\n");
|
|
400
405
|
if (res.error) process.exit(1);
|
|
401
406
|
});
|
|
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) => {
|
|
407
|
+
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
408
|
const body = {};
|
|
404
409
|
if (opts.title) body.title = opts.title;
|
|
405
410
|
if (opts.summary) body.summary = opts.summary;
|
|
411
|
+
if (opts.keyPoint.length > 0) body.key_points = opts.keyPoint;
|
|
412
|
+
if (opts.decision.length > 0) body.decisions_made = opts.decision;
|
|
406
413
|
if (opts.sourceUrl) body.source_url = opts.sourceUrl;
|
|
407
414
|
const res = await apiRequest(`/pebbles/${slug}/conversations/${id}`, {
|
|
408
415
|
method: "PUT",
|
|
@@ -506,10 +513,15 @@ versionsCmd.command("get <slug> <docType> <versionId>").description("Get a speci
|
|
|
506
513
|
});
|
|
507
514
|
|
|
508
515
|
// src/index.ts
|
|
516
|
+
import { readFileSync as readFileSync5 } from "fs";
|
|
517
|
+
import { fileURLToPath } from "url";
|
|
518
|
+
import { dirname, resolve } from "path";
|
|
519
|
+
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
520
|
+
var pkg = JSON.parse(readFileSync5(resolve(__dirname, "../package.json"), "utf-8"));
|
|
509
521
|
var GOLD = "\x1B[33m";
|
|
510
522
|
var DIM = "\x1B[2m";
|
|
511
523
|
var RESET = "\x1B[0m";
|
|
512
|
-
var VERSION =
|
|
524
|
+
var VERSION = pkg.version;
|
|
513
525
|
function printBanner() {
|
|
514
526
|
const cwd = process.cwd();
|
|
515
527
|
console.error(`${GOLD}
|