@pebblehouse/odin-cli 0.2.4 → 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 +69 -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";
@@ -524,12 +524,76 @@ versionsCmd.command("get <slug> <docType> <versionId>").description("Get a speci
524
524
  if (res.error) process.exit(1);
525
525
  });
526
526
 
527
- // src/index.ts
527
+ // src/commands/guidelines.ts
528
+ import { Command as Command12 } from "commander";
528
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";
529
593
  import { fileURLToPath } from "url";
530
594
  import { dirname, resolve } from "path";
531
595
  var __dirname = dirname(fileURLToPath(import.meta.url));
532
- var pkg = JSON.parse(readFileSync5(resolve(__dirname, "../package.json"), "utf-8"));
596
+ var pkg = JSON.parse(readFileSync6(resolve(__dirname, "../package.json"), "utf-8"));
533
597
  var GOLD = "\x1B[33m";
534
598
  var DIM = "\x1B[2m";
535
599
  var RESET = "\x1B[0m";
@@ -547,7 +611,7 @@ ${RESET}
547
611
  ${DIM}${cwd}${RESET}
548
612
  `);
549
613
  }
550
- var program = new Command12();
614
+ var program = new Command13();
551
615
  program.name("odin").description("CLI for Odin \u2014 the knowledge backbone for Pebble House").version(VERSION);
552
616
  program.command("login").description("Authenticate with Odin via browser").action(async () => {
553
617
  printBanner();
@@ -574,6 +638,7 @@ program.addCommand(conversationsCmd);
574
638
  program.addCommand(specsCmd);
575
639
  program.addCommand(executionsCmd);
576
640
  program.addCommand(versionsCmd);
641
+ program.addCommand(guidelinesCmd);
577
642
  process.on("exit", () => {
578
643
  process.stderr.write("\n\n\n\n\n");
579
644
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pebblehouse/odin-cli",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "CLI for Odin — the knowledge backbone for Pebble House",
6
6
  "bin": {