@pebblehouse/odin-cli 0.3.1 → 0.4.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.
- package/dist/index.js +48 -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
|
|
4
|
+
import { Command as Command14 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/auth/login.ts
|
|
7
7
|
import { createServer } from "http";
|
|
@@ -615,6 +615,51 @@ guidelinesCmd.command("deprecate <id>").description("Deprecate a guideline").act
|
|
|
615
615
|
if (res.error) process.exit(1);
|
|
616
616
|
});
|
|
617
617
|
|
|
618
|
+
// src/commands/observations.ts
|
|
619
|
+
import { Command as Command13 } from "commander";
|
|
620
|
+
var observationsCmd = new Command13("observations").description(
|
|
621
|
+
"View and synthesize observations"
|
|
622
|
+
);
|
|
623
|
+
observationsCmd.command("list <slug>").description("List observations for a pebble").option("--limit <n>", "Max results", "50").option("--offset <n>", "Offset for pagination", "0").action(async (slug, opts) => {
|
|
624
|
+
const res = await apiRequest(
|
|
625
|
+
`/pebbles/${slug}/observations`,
|
|
626
|
+
{
|
|
627
|
+
params: { limit: opts.limit, offset: opts.offset }
|
|
628
|
+
}
|
|
629
|
+
);
|
|
630
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
631
|
+
if (res.error) process.exit(1);
|
|
632
|
+
});
|
|
633
|
+
observationsCmd.command("synthesize [slug]").description("Trigger observation synthesis (requires running worker)").action(async (slug) => {
|
|
634
|
+
try {
|
|
635
|
+
const body = {};
|
|
636
|
+
if (slug) body.slug = slug;
|
|
637
|
+
const res = await fetch("http://127.0.0.1:7433/synthesize", {
|
|
638
|
+
method: "POST",
|
|
639
|
+
headers: { "Content-Type": "application/json" },
|
|
640
|
+
body: JSON.stringify(body)
|
|
641
|
+
});
|
|
642
|
+
if (!res.ok) {
|
|
643
|
+
const text = await res.text();
|
|
644
|
+
console.error(`Worker returned ${res.status}: ${text}`);
|
|
645
|
+
process.exit(1);
|
|
646
|
+
}
|
|
647
|
+
const data = await res.json();
|
|
648
|
+
process.stdout.write(JSON.stringify(data) + "\n");
|
|
649
|
+
} catch (err) {
|
|
650
|
+
if (err instanceof Error && (err.message.includes("ECONNREFUSED") || err.message.includes("fetch failed"))) {
|
|
651
|
+
console.error(
|
|
652
|
+
"Worker not running. Start a Claude Code session to launch the worker."
|
|
653
|
+
);
|
|
654
|
+
} else {
|
|
655
|
+
console.error(
|
|
656
|
+
`Failed: ${err instanceof Error ? err.message : err}`
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
process.exit(1);
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
|
|
618
663
|
// src/index.ts
|
|
619
664
|
import { readFileSync as readFileSync6 } from "fs";
|
|
620
665
|
import { fileURLToPath } from "url";
|
|
@@ -638,7 +683,7 @@ ${RESET}
|
|
|
638
683
|
${DIM}${cwd}${RESET}
|
|
639
684
|
`);
|
|
640
685
|
}
|
|
641
|
-
var program = new
|
|
686
|
+
var program = new Command14();
|
|
642
687
|
program.name("odin").description("CLI for Odin \u2014 the knowledge backbone for Pebble House").version(VERSION);
|
|
643
688
|
program.command("login").description("Authenticate with Odin via browser").action(async () => {
|
|
644
689
|
printBanner();
|
|
@@ -666,6 +711,7 @@ program.addCommand(specsCmd);
|
|
|
666
711
|
program.addCommand(executionsCmd);
|
|
667
712
|
program.addCommand(versionsCmd);
|
|
668
713
|
program.addCommand(guidelinesCmd);
|
|
714
|
+
program.addCommand(observationsCmd);
|
|
669
715
|
process.on("exit", () => {
|
|
670
716
|
process.stderr.write("\n\n\n\n\n");
|
|
671
717
|
});
|