@pebblehouse/odin-cli 0.2.4 → 0.3.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 +90 -5
- 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 Command13 } from "commander";
|
|
5
5
|
|
|
6
6
|
// src/auth/login.ts
|
|
7
7
|
import { createServer } from "http";
|
|
@@ -255,7 +255,7 @@ decisionsCmd.command("log <slug> <title>").description("Log a decision").option(
|
|
|
255
255
|
|
|
256
256
|
// src/commands/context.ts
|
|
257
257
|
import { Command as Command4 } from "commander";
|
|
258
|
-
var contextCmd = new Command4("context").description("Get Tier 1 context for a pebble").argument("<slug>", "Pebble slug").option("--limit <n>", "Number of
|
|
258
|
+
var contextCmd = new Command4("context").description("Get Tier 1 context for a pebble").argument("<slug>", "Pebble slug").option("--limit <n>", "Number of context entries", "50").action(async (slug, opts) => {
|
|
259
259
|
const res = await apiRequest(`/pebbles/${slug}/context`, {
|
|
260
260
|
params: { limit: opts.limit }
|
|
261
261
|
});
|
|
@@ -494,6 +494,26 @@ specsCmd.command("delete <slug> <id>").description("Delete a spec").action(async
|
|
|
494
494
|
// src/commands/executions.ts
|
|
495
495
|
import { Command as Command10 } from "commander";
|
|
496
496
|
var executionsCmd = new Command10("executions").description("View Claude Code executions");
|
|
497
|
+
executionsCmd.command("create <slug>").description("Create an execution record").requiredOption("--tool-name <name>", "Tool name").option("--session-id <id>", "Session ID").option("--summary-text <text>", "Summary text").option("--execution-type <type>", "Execution type (task|discovery|system|plan)").option("--raw-input <json>", "Raw input JSON").option("--raw-output <json>", "Raw output JSON").option("--files-read <files...>", "Files read").option("--files-modified <files...>", "Files modified").option("--prompt-number <n>", "Prompt number").option("--content-hash <hash>", "Content hash for dedup").action(async (slug, opts) => {
|
|
498
|
+
const body = {
|
|
499
|
+
tool_name: opts.toolName
|
|
500
|
+
};
|
|
501
|
+
if (opts.sessionId) body.session_id = opts.sessionId;
|
|
502
|
+
if (opts.summaryText) body.summary_text = opts.summaryText;
|
|
503
|
+
if (opts.executionType) body.execution_type = opts.executionType;
|
|
504
|
+
if (opts.rawInput) body.raw_input = opts.rawInput;
|
|
505
|
+
if (opts.rawOutput) body.raw_output = opts.rawOutput;
|
|
506
|
+
if (opts.filesRead) body.files_read = opts.filesRead;
|
|
507
|
+
if (opts.filesModified) body.files_modified = opts.filesModified;
|
|
508
|
+
if (opts.promptNumber) body.prompt_number = parseInt(opts.promptNumber, 10);
|
|
509
|
+
if (opts.contentHash) body.content_hash = opts.contentHash;
|
|
510
|
+
const res = await apiRequest(`/pebbles/${slug}/executions`, {
|
|
511
|
+
method: "POST",
|
|
512
|
+
body
|
|
513
|
+
});
|
|
514
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
515
|
+
if (res.error) process.exit(1);
|
|
516
|
+
});
|
|
497
517
|
executionsCmd.command("list <slug>").description("List executions for a pebble").option("--session-id <id>", "Filter by session ID").option("--limit <n>", "Max results", "50").option("--offset <n>", "Offset for pagination", "0").action(async (slug, opts) => {
|
|
498
518
|
const params = {
|
|
499
519
|
limit: opts.limit,
|
|
@@ -524,12 +544,76 @@ versionsCmd.command("get <slug> <docType> <versionId>").description("Get a speci
|
|
|
524
544
|
if (res.error) process.exit(1);
|
|
525
545
|
});
|
|
526
546
|
|
|
527
|
-
// src/
|
|
547
|
+
// src/commands/guidelines.ts
|
|
548
|
+
import { Command as Command12 } from "commander";
|
|
528
549
|
import { readFileSync as readFileSync5 } from "fs";
|
|
550
|
+
var guidelinesCmd = new Command12("guidelines").description("Manage global guidelines");
|
|
551
|
+
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) => {
|
|
552
|
+
const params = new URLSearchParams();
|
|
553
|
+
if (opts.category) params.set("category", opts.category);
|
|
554
|
+
if (opts.all) params.set("status", "all");
|
|
555
|
+
else if (opts.status) params.set("status", opts.status);
|
|
556
|
+
const qs = params.toString();
|
|
557
|
+
const res = await apiRequest(`/guidelines${qs ? `?${qs}` : ""}`);
|
|
558
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
559
|
+
if (res.error) process.exit(1);
|
|
560
|
+
});
|
|
561
|
+
guidelinesCmd.command("get <id>").description("Get a guideline by ID").action(async (id) => {
|
|
562
|
+
const res = await apiRequest(`/guidelines/${id}`);
|
|
563
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
564
|
+
if (res.error) process.exit(1);
|
|
565
|
+
});
|
|
566
|
+
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) => {
|
|
567
|
+
const content = opts.file ? readFileSync5(opts.file, "utf-8") : opts.content ?? "";
|
|
568
|
+
const res = await apiRequest("/guidelines", {
|
|
569
|
+
method: "POST",
|
|
570
|
+
body: { category: opts.category, title, content, source: opts.source }
|
|
571
|
+
});
|
|
572
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
573
|
+
if (res.error) process.exit(1);
|
|
574
|
+
});
|
|
575
|
+
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) => {
|
|
576
|
+
const body = {};
|
|
577
|
+
if (opts.title) body.title = opts.title;
|
|
578
|
+
if (opts.file) body.content = readFileSync5(opts.file, "utf-8");
|
|
579
|
+
else if (opts.content) body.content = opts.content;
|
|
580
|
+
if (opts.category) body.category = opts.category;
|
|
581
|
+
if (opts.status) body.status = opts.status;
|
|
582
|
+
if (opts.source) body.source = opts.source;
|
|
583
|
+
const res = await apiRequest(`/guidelines/${id}`, {
|
|
584
|
+
method: "PUT",
|
|
585
|
+
body
|
|
586
|
+
});
|
|
587
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
588
|
+
if (res.error) process.exit(1);
|
|
589
|
+
});
|
|
590
|
+
guidelinesCmd.command("delete <id>").description("Delete a guideline").action(async (id) => {
|
|
591
|
+
const res = await apiRequest(`/guidelines/${id}`, {
|
|
592
|
+
method: "DELETE"
|
|
593
|
+
});
|
|
594
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
595
|
+
if (res.error) process.exit(1);
|
|
596
|
+
});
|
|
597
|
+
guidelinesCmd.command("versions <id>").description("List version history for a guideline").action(async (id) => {
|
|
598
|
+
const res = await apiRequest(`/guidelines/${id}/versions`);
|
|
599
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
600
|
+
if (res.error) process.exit(1);
|
|
601
|
+
});
|
|
602
|
+
guidelinesCmd.command("deprecate <id>").description("Deprecate a guideline").action(async (id) => {
|
|
603
|
+
const res = await apiRequest(`/guidelines/${id}`, {
|
|
604
|
+
method: "PUT",
|
|
605
|
+
body: { status: "deprecated" }
|
|
606
|
+
});
|
|
607
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
608
|
+
if (res.error) process.exit(1);
|
|
609
|
+
});
|
|
610
|
+
|
|
611
|
+
// src/index.ts
|
|
612
|
+
import { readFileSync as readFileSync6 } from "fs";
|
|
529
613
|
import { fileURLToPath } from "url";
|
|
530
614
|
import { dirname, resolve } from "path";
|
|
531
615
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
532
|
-
var pkg = JSON.parse(
|
|
616
|
+
var pkg = JSON.parse(readFileSync6(resolve(__dirname, "../package.json"), "utf-8"));
|
|
533
617
|
var GOLD = "\x1B[33m";
|
|
534
618
|
var DIM = "\x1B[2m";
|
|
535
619
|
var RESET = "\x1B[0m";
|
|
@@ -547,7 +631,7 @@ ${RESET}
|
|
|
547
631
|
${DIM}${cwd}${RESET}
|
|
548
632
|
`);
|
|
549
633
|
}
|
|
550
|
-
var program = new
|
|
634
|
+
var program = new Command13();
|
|
551
635
|
program.name("odin").description("CLI for Odin \u2014 the knowledge backbone for Pebble House").version(VERSION);
|
|
552
636
|
program.command("login").description("Authenticate with Odin via browser").action(async () => {
|
|
553
637
|
printBanner();
|
|
@@ -574,6 +658,7 @@ program.addCommand(conversationsCmd);
|
|
|
574
658
|
program.addCommand(specsCmd);
|
|
575
659
|
program.addCommand(executionsCmd);
|
|
576
660
|
program.addCommand(versionsCmd);
|
|
661
|
+
program.addCommand(guidelinesCmd);
|
|
577
662
|
process.on("exit", () => {
|
|
578
663
|
process.stderr.write("\n\n\n\n\n");
|
|
579
664
|
});
|