@pebblehouse/odin-cli 0.7.0 → 0.8.0

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 +63 -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 Command10 } from "commander";
4
+ import { Command as Command11 } from "commander";
5
5
 
6
6
  // src/auth/login.ts
7
7
  import { createServer } from "http";
@@ -659,12 +659,70 @@ guidelinesCmd.command("deprecate <id>").description("Deprecate a guideline").act
659
659
  if (res.error) process.exit(1);
660
660
  });
661
661
 
662
- // src/index.ts
662
+ // src/commands/rules.ts
663
+ import { Command as Command10 } from "commander";
663
664
  import { readFileSync as readFileSync7 } from "fs";
665
+ var rulesCmd = new Command10("rules").description("Manage pebble rules");
666
+ rulesCmd.command("list <slug>").description("List rules for a pebble").option("--category <category>", "Filter by category").option("--status <status>", "Filter by status (default: active)").option("--all", "Include deprecated rules").action(async (slug, opts) => {
667
+ const params = {};
668
+ if (opts.category) params.category = opts.category;
669
+ if (opts.all) params.status = "all";
670
+ else if (opts.status) params.status = opts.status;
671
+ const res = await apiRequest(`/pebbles/${slug}/rules`, { params });
672
+ process.stdout.write(JSON.stringify(res) + "\n");
673
+ if (res.error) process.exit(1);
674
+ });
675
+ rulesCmd.command("get <slug> <id>").description("Get a rule by ID").action(async (slug, id) => {
676
+ const res = await apiRequest(`/pebbles/${slug}/rules/${id}`);
677
+ process.stdout.write(JSON.stringify(res) + "\n");
678
+ if (res.error) process.exit(1);
679
+ });
680
+ rulesCmd.command("create <slug> <title>").description("Create a rule").option("--category <category>", "Category", "other").option("--content <content>", "Rule content (max 500 chars)").option("--file <path>", "Read content from file").option("--source <source>", "Source", "manual").action(async (slug, title, opts) => {
681
+ const content = opts.file ? readFileSync7(opts.file, "utf-8") : opts.content ?? "";
682
+ const res = await apiRequest(`/pebbles/${slug}/rules`, {
683
+ method: "POST",
684
+ body: { category: opts.category, title, content, source: opts.source }
685
+ });
686
+ process.stdout.write(JSON.stringify(res) + "\n");
687
+ if (res.error) process.exit(1);
688
+ });
689
+ rulesCmd.command("update <slug> <id>").description("Update a rule").option("--title <title>", "New title").option("--content <content>", "New content (max 500 chars)").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 (slug, id, opts) => {
690
+ const body = {};
691
+ if (opts.title) body.title = opts.title;
692
+ if (opts.file) body.content = readFileSync7(opts.file, "utf-8");
693
+ else if (opts.content) body.content = opts.content;
694
+ if (opts.category) body.category = opts.category;
695
+ if (opts.status) body.status = opts.status;
696
+ if (opts.source) body.source = opts.source;
697
+ const res = await apiRequest(`/pebbles/${slug}/rules/${id}`, {
698
+ method: "PUT",
699
+ body
700
+ });
701
+ process.stdout.write(JSON.stringify(res) + "\n");
702
+ if (res.error) process.exit(1);
703
+ });
704
+ rulesCmd.command("delete <slug> <id>").description("Delete a rule").action(async (slug, id) => {
705
+ const res = await apiRequest(`/pebbles/${slug}/rules/${id}`, {
706
+ method: "DELETE"
707
+ });
708
+ process.stdout.write(JSON.stringify(res) + "\n");
709
+ if (res.error) process.exit(1);
710
+ });
711
+ rulesCmd.command("deprecate <slug> <id>").description("Deprecate a rule").action(async (slug, id) => {
712
+ const res = await apiRequest(`/pebbles/${slug}/rules/${id}`, {
713
+ method: "PUT",
714
+ body: { status: "deprecated" }
715
+ });
716
+ process.stdout.write(JSON.stringify(res) + "\n");
717
+ if (res.error) process.exit(1);
718
+ });
719
+
720
+ // src/index.ts
721
+ import { readFileSync as readFileSync8 } from "fs";
664
722
  import { fileURLToPath } from "url";
665
723
  import { dirname as dirname2, resolve } from "path";
666
724
  var __dirname = dirname2(fileURLToPath(import.meta.url));
667
- var pkg = JSON.parse(readFileSync7(resolve(__dirname, "../package.json"), "utf-8"));
725
+ var pkg = JSON.parse(readFileSync8(resolve(__dirname, "../package.json"), "utf-8"));
668
726
  var GOLD = "\x1B[33m";
669
727
  var DIM = "\x1B[2m";
670
728
  var RESET = "\x1B[0m";
@@ -682,7 +740,7 @@ ${RESET}
682
740
  ${DIM}${cwd}${RESET}
683
741
  `);
684
742
  }
685
- var program = new Command10();
743
+ var program = new Command11();
686
744
  program.name("odin").description("CLI for Odin \u2014 the knowledge backbone for Pebble House").version(VERSION);
687
745
  program.command("login").description("Authenticate with Odin via browser").action(async () => {
688
746
  printBanner();
@@ -707,6 +765,7 @@ program.addCommand(plansCmd);
707
765
  program.addCommand(artifactsCmd);
708
766
  program.addCommand(versionsCmd);
709
767
  program.addCommand(guidelinesCmd);
768
+ program.addCommand(rulesCmd);
710
769
  process.on("exit", () => {
711
770
  process.stderr.write("\n\n\n\n\n");
712
771
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pebblehouse/odin-cli",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "type": "module",
5
5
  "description": "CLI for Odin — the knowledge backbone for Pebble House",
6
6
  "bin": {