Something went wrong. Try again.
Sensemaker's CLI for protocol-native interaction on ATProto.
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132#!/usr/bin/env bun/** * sensemaker — Sensemaker's CLI for protocol-native interaction on ATProto. * * Currently ships one command: * * sensemaker interview <subcommand> * * See `sensemaker interview --help` for details, or * https://tangled.org/sensemaker.computer/sensemaker-cli for the repo. */
import { Command } from "commander"import { createInterviewSession, createQuestion, createAnswer, listSessions, listQuestions, listAnswers, showInterview, publishLexicons,} from "./interview.js"
const program = new Command() .name("sensemaker") .description("Sensemaker's CLI for protocol-native interaction on ATProto.") .version("0.1.0")
const interview = program .command("interview") .description("ATProto-native interviews — typed Q&A as records on each party's PDS.")
interview .command("session") .description("Create a new interview session record on your PDS") .requiredOption("-t, --title <title>", "Session title") .requiredOption("-s, --subject <handle-or-did>", "Subject of the interview (handle or DID)") .option("--topic <topic>", "Optional topic descriptor") .option("--introduction <text>", "Optional introduction explaining what the interview is about") .action(async opts => { await createInterviewSession({ title: opts.title, subject: opts.subject, topic: opts.topic, introduction: opts.introduction, }) })
interview .command("question") .description("Write a question record (lives on your PDS, references the subject)") .requiredOption("-t, --text <text>", "Question text") .requiredOption("-s, --subject <handle-or-did>", "Subject DID or handle") .option("--session <at-uri>", "AT-URI of the parent session record") .option("--topic <topic>", "Optional topic tag") .option("--in-reply-to <at-uri>", "AT-URI of a prior question/answer (for follow-ups)") .option("--context <text>", "Additional framing the answerer should know") .action(async opts => { await createQuestion({ text: opts.text, subject: opts.subject, session: opts.session, topic: opts.topic, inReplyTo: opts.inReplyTo, context: opts.context, }) })
interview .command("answer") .description("Write an answer record on your PDS, referencing a question URI") .requiredOption("-q, --question <at-uri>", "AT-URI of the question being answered") .requiredOption("-t, --text <text>", "Answer text") .option("--source <urls...>", "Optional source URLs or AT-URIs (repeatable)") .action(async opts => { await createAnswer({ text: opts.text, question: opts.question, sources: opts.source, }) })
interview .command("list-sessions") .description("List session records on a repo") .option("--repo <handle-or-did>", "Repo to query (defaults to authenticated user)") .option("-n, --limit <n>", "Max results", val => parseInt(val, 10), 50) .action(async opts => { await listSessions({ repo: opts.repo, limit: opts.limit }) })
interview .command("list-questions") .description("List question records on a repo, optionally filtered by session") .option("--repo <handle-or-did>", "Repo to query (defaults to authenticated user)") .option("--session <at-uri>", "Filter by parent session URI") .option("-n, --limit <n>", "Max results", val => parseInt(val, 10), 50) .action(async opts => { await listQuestions({ repo: opts.repo, session: opts.session, limit: opts.limit }) })
interview .command("list-answers") .description("List answer records on a repo, optionally filtered by question") .option("--repo <handle-or-did>", "Repo to query (defaults to authenticated user)") .option("--question <at-uri>", "Filter by question URI") .option("-n, --limit <n>", "Max results", val => parseInt(val, 10), 50) .action(async opts => { await listAnswers({ repo: opts.repo, question: opts.question, limit: opts.limit }) })
interview .command("show <session-uri>") .description("Render a session as Q&A — pulls questions from interviewer's PDS, answers from subject's") .action(async (sessionUri: string) => { await showInterview(sessionUri) })
interview .command("publish-lexicons") .description("Publish the network.sensemaker.{question,answer,session} lexicons as records on your PDS") .option("--dry-run", "Print what would be published without writing") .action(async opts => { await publishLexicons({ dryRun: opts.dryRun }) })
program.parseAsync(process.argv).catch(err => { console.error(err instanceof Error ? err.message : err) process.exit(1)})