@pebblehouse/odin-cli 0.2.5 → 0.3.1
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 +31 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -104,6 +104,14 @@ import { Command } from "commander";
|
|
|
104
104
|
import { createClient } from "@supabase/supabase-js";
|
|
105
105
|
var SUPABASE_URL = process.env.ODIN_SUPABASE_URL ?? "https://vdiwtiiksdyhlibqrngw.supabase.co";
|
|
106
106
|
var SUPABASE_ANON_KEY = process.env.ODIN_SUPABASE_ANON_KEY ?? "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InZkaXd0aWlrc2R5aGxpYnFybmd3Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NzM2ODM4NDksImV4cCI6MjA4OTI1OTg0OX0.gAccODqqhBnL_npqG7H42EvaT2CWR1P2pqo5NVjKFas";
|
|
107
|
+
function createNodeClient() {
|
|
108
|
+
return createClient(SUPABASE_URL, SUPABASE_ANON_KEY, {
|
|
109
|
+
auth: {
|
|
110
|
+
autoRefreshToken: false,
|
|
111
|
+
persistSession: false
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
107
115
|
async function getValidToken() {
|
|
108
116
|
const creds = getCredentials();
|
|
109
117
|
if (!creds) {
|
|
@@ -113,9 +121,8 @@ async function getValidToken() {
|
|
|
113
121
|
if (creds.expires_at > now + 60) {
|
|
114
122
|
return creds.access_token;
|
|
115
123
|
}
|
|
116
|
-
const supabase =
|
|
117
|
-
const { data, error } = await supabase.auth.
|
|
118
|
-
access_token: creds.access_token,
|
|
124
|
+
const supabase = createNodeClient();
|
|
125
|
+
const { data, error } = await supabase.auth.refreshSession({
|
|
119
126
|
refresh_token: creds.refresh_token
|
|
120
127
|
});
|
|
121
128
|
if (error || !data.session) {
|
|
@@ -255,7 +262,7 @@ decisionsCmd.command("log <slug> <title>").description("Log a decision").option(
|
|
|
255
262
|
|
|
256
263
|
// src/commands/context.ts
|
|
257
264
|
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
|
|
265
|
+
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
266
|
const res = await apiRequest(`/pebbles/${slug}/context`, {
|
|
260
267
|
params: { limit: opts.limit }
|
|
261
268
|
});
|
|
@@ -494,6 +501,26 @@ specsCmd.command("delete <slug> <id>").description("Delete a spec").action(async
|
|
|
494
501
|
// src/commands/executions.ts
|
|
495
502
|
import { Command as Command10 } from "commander";
|
|
496
503
|
var executionsCmd = new Command10("executions").description("View Claude Code executions");
|
|
504
|
+
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) => {
|
|
505
|
+
const body = {
|
|
506
|
+
tool_name: opts.toolName
|
|
507
|
+
};
|
|
508
|
+
if (opts.sessionId) body.session_id = opts.sessionId;
|
|
509
|
+
if (opts.summaryText) body.summary_text = opts.summaryText;
|
|
510
|
+
if (opts.executionType) body.execution_type = opts.executionType;
|
|
511
|
+
if (opts.rawInput) body.raw_input = opts.rawInput;
|
|
512
|
+
if (opts.rawOutput) body.raw_output = opts.rawOutput;
|
|
513
|
+
if (opts.filesRead) body.files_read = opts.filesRead;
|
|
514
|
+
if (opts.filesModified) body.files_modified = opts.filesModified;
|
|
515
|
+
if (opts.promptNumber) body.prompt_number = parseInt(opts.promptNumber, 10);
|
|
516
|
+
if (opts.contentHash) body.content_hash = opts.contentHash;
|
|
517
|
+
const res = await apiRequest(`/pebbles/${slug}/executions`, {
|
|
518
|
+
method: "POST",
|
|
519
|
+
body
|
|
520
|
+
});
|
|
521
|
+
process.stdout.write(JSON.stringify(res) + "\n");
|
|
522
|
+
if (res.error) process.exit(1);
|
|
523
|
+
});
|
|
497
524
|
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
525
|
const params = {
|
|
499
526
|
limit: opts.limit,
|