@pebblehouse/odin-cli 0.2.2 → 0.2.5

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.
Files changed (2) hide show
  1. package/dist/index.js +84 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { Command as Command12 } from "commander";
4
+ import { Command as Command13 } from "commander";
5
5
 
6
6
  // src/auth/login.ts
7
7
  import { createServer } from "http";
@@ -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"
@@ -512,12 +524,76 @@ versionsCmd.command("get <slug> <docType> <versionId>").description("Get a speci
512
524
  if (res.error) process.exit(1);
513
525
  });
514
526
 
515
- // src/index.ts
527
+ // src/commands/guidelines.ts
528
+ import { Command as Command12 } from "commander";
516
529
  import { readFileSync as readFileSync5 } from "fs";
530
+ var guidelinesCmd = new Command12("guidelines").description("Manage global guidelines");
531
+ guidelinesCmd.command("list").description("List guidelines").option("--category <category>", "Filter by category").option("--status <status>", "Filter by status (default: active)").option("--all", "Include deprecated guidelines").action(async (opts) => {
532
+ const params = new URLSearchParams();
533
+ if (opts.category) params.set("category", opts.category);
534
+ if (opts.all) params.set("status", "all");
535
+ else if (opts.status) params.set("status", opts.status);
536
+ const qs = params.toString();
537
+ const res = await apiRequest(`/guidelines${qs ? `?${qs}` : ""}`);
538
+ process.stdout.write(JSON.stringify(res) + "\n");
539
+ if (res.error) process.exit(1);
540
+ });
541
+ guidelinesCmd.command("get <id>").description("Get a guideline by ID").action(async (id) => {
542
+ const res = await apiRequest(`/guidelines/${id}`);
543
+ process.stdout.write(JSON.stringify(res) + "\n");
544
+ if (res.error) process.exit(1);
545
+ });
546
+ guidelinesCmd.command("create <title>").description("Create a guideline").option("--category <category>", "Category", "other").option("--content <content>", "Guideline content").option("--file <path>", "Read content from file").option("--source <source>", "Source", "manual").action(async (title, opts) => {
547
+ const content = opts.file ? readFileSync5(opts.file, "utf-8") : opts.content ?? "";
548
+ const res = await apiRequest("/guidelines", {
549
+ method: "POST",
550
+ body: { category: opts.category, title, content, source: opts.source }
551
+ });
552
+ process.stdout.write(JSON.stringify(res) + "\n");
553
+ if (res.error) process.exit(1);
554
+ });
555
+ guidelinesCmd.command("update <id>").description("Update a guideline").option("--title <title>", "New title").option("--content <content>", "New content").option("--file <path>", "Read content from file").option("--category <category>", "New category").option("--status <status>", "New status (active|deprecated)").option("--source <source>", "Source").action(async (id, opts) => {
556
+ const body = {};
557
+ if (opts.title) body.title = opts.title;
558
+ if (opts.file) body.content = readFileSync5(opts.file, "utf-8");
559
+ else if (opts.content) body.content = opts.content;
560
+ if (opts.category) body.category = opts.category;
561
+ if (opts.status) body.status = opts.status;
562
+ if (opts.source) body.source = opts.source;
563
+ const res = await apiRequest(`/guidelines/${id}`, {
564
+ method: "PUT",
565
+ body
566
+ });
567
+ process.stdout.write(JSON.stringify(res) + "\n");
568
+ if (res.error) process.exit(1);
569
+ });
570
+ guidelinesCmd.command("delete <id>").description("Delete a guideline").action(async (id) => {
571
+ const res = await apiRequest(`/guidelines/${id}`, {
572
+ method: "DELETE"
573
+ });
574
+ process.stdout.write(JSON.stringify(res) + "\n");
575
+ if (res.error) process.exit(1);
576
+ });
577
+ guidelinesCmd.command("versions <id>").description("List version history for a guideline").action(async (id) => {
578
+ const res = await apiRequest(`/guidelines/${id}/versions`);
579
+ process.stdout.write(JSON.stringify(res) + "\n");
580
+ if (res.error) process.exit(1);
581
+ });
582
+ guidelinesCmd.command("deprecate <id>").description("Deprecate a guideline").action(async (id) => {
583
+ const res = await apiRequest(`/guidelines/${id}`, {
584
+ method: "PUT",
585
+ body: { status: "deprecated" }
586
+ });
587
+ process.stdout.write(JSON.stringify(res) + "\n");
588
+ if (res.error) process.exit(1);
589
+ });
590
+
591
+ // src/index.ts
592
+ import { readFileSync as readFileSync6 } from "fs";
517
593
  import { fileURLToPath } from "url";
518
594
  import { dirname, resolve } from "path";
519
595
  var __dirname = dirname(fileURLToPath(import.meta.url));
520
- var pkg = JSON.parse(readFileSync5(resolve(__dirname, "../package.json"), "utf-8"));
596
+ var pkg = JSON.parse(readFileSync6(resolve(__dirname, "../package.json"), "utf-8"));
521
597
  var GOLD = "\x1B[33m";
522
598
  var DIM = "\x1B[2m";
523
599
  var RESET = "\x1B[0m";
@@ -535,7 +611,7 @@ ${RESET}
535
611
  ${DIM}${cwd}${RESET}
536
612
  `);
537
613
  }
538
- var program = new Command12();
614
+ var program = new Command13();
539
615
  program.name("odin").description("CLI for Odin \u2014 the knowledge backbone for Pebble House").version(VERSION);
540
616
  program.command("login").description("Authenticate with Odin via browser").action(async () => {
541
617
  printBanner();
@@ -562,6 +638,10 @@ program.addCommand(conversationsCmd);
562
638
  program.addCommand(specsCmd);
563
639
  program.addCommand(executionsCmd);
564
640
  program.addCommand(versionsCmd);
641
+ program.addCommand(guidelinesCmd);
642
+ process.on("exit", () => {
643
+ process.stderr.write("\n\n\n\n\n");
644
+ });
565
645
  program.parseAsync(process.argv).catch((err) => {
566
646
  console.error(err instanceof Error ? err.message : err);
567
647
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pebblehouse/odin-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "CLI for Odin — the knowledge backbone for Pebble House",
6
6
  "bin": {