From c1c21ad5322765181c5e842d169103ca53f59d9e Mon Sep 17 00:00:00 2001 From: Steve Date: Thu, 26 Feb 2026 19:40:49 -0500 Subject: [PATCH] chore: version bump and clean up --- packages/cli/biome.json | 2 +- packages/cli/package.json | 2 +- packages/cli/src/commands/add.ts | 4 +- .../cli/src/components/sequoia-subscribe.js | 87 +------------------ packages/cli/src/index.ts | 2 +- packages/cli/src/lib/atproto.ts | 16 ++-- 6 files changed, 17 insertions(+), 96 deletions(-) diff --git a/packages/cli/biome.json b/packages/cli/biome.json index 63e4789..034ebcd 100644 --- a/packages/cli/biome.json +++ b/packages/cli/biome.json @@ -2,6 +2,6 @@ "$schema": "https://biomejs.dev/schemas/2.3.13/schema.json", "extends": ["../../biome.json"], "files": { - "includes": ["**", "!!**/dist"] + "includes": ["!!**/dist"] } } diff --git a/packages/cli/package.json b/packages/cli/package.json index 2a9f14b..ff7203c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "sequoia-cli", - "version": "0.4.0", + "version": "0.5.0", "type": "module", "bin": { "sequoia": "dist/index.js" diff --git a/packages/cli/src/commands/add.ts b/packages/cli/src/commands/add.ts index 4bd2572..2770a0f 100644 --- a/packages/cli/src/commands/add.ts +++ b/packages/cli/src/commands/add.ts @@ -40,7 +40,9 @@ export const addCommand = command({ intro("Add Sequoia Component"); // Validate component name - const component = AVAILABLE_COMPONENTS.find((c) => c.name === componentName); + const component = AVAILABLE_COMPONENTS.find( + (c) => c.name === componentName, + ); if (!component) { log.error(`Component '${componentName}' not found`); log.info("Available components:"); diff --git a/packages/cli/src/components/sequoia-subscribe.js b/packages/cli/src/components/sequoia-subscribe.js index 03160c4..fccaef6 100644 --- a/packages/cli/src/components/sequoia-subscribe.js +++ b/packages/cli/src/components/sequoia-subscribe.js @@ -126,89 +126,6 @@ const CHECK_ICON = ` s.id === "#atproto_pds" || s.type === "AtprotoPersonalDataServer", - ); - pdsUrl = pdsService?.serviceEndpoint; - } else if (did.startsWith("did:web:")) { - const domain = did.replace("did:web:", ""); - const didDocUrl = `https://${domain}/.well-known/did.json`; - const didDocResponse = await fetch(didDocUrl); - if (!didDocResponse.ok) { - throw new Error(`Could not fetch DID document: ${didDocResponse.status}`); - } - const didDoc = await didDocResponse.json(); - - const pdsService = didDoc.service?.find( - (s) => s.id === "#atproto_pds" || s.type === "AtprotoPersonalDataServer", - ); - pdsUrl = pdsService?.serviceEndpoint; - } else { - throw new Error(`Unsupported DID method: ${did}`); - } - - if (!pdsUrl) { - throw new Error("Could not find PDS URL for user"); - } - - return pdsUrl; -} - -/** - * Create a site.standard.graph.subscription record in the subscriber's PDS. - * @param {string} did - DID of the subscriber - * @param {string} accessToken - AT Protocol access token - * @param {string} publicationUri - AT URI of the publication to subscribe to - * @returns {Promise<{uri: string, cid: string}>} The created record's URI and CID - */ -async function createRecord(did, accessToken, publicationUri) { - const pdsUrl = await resolvePDS(did); - - const collection = "site.standard.graph.subscription"; - const url = `${pdsUrl}/xrpc/com.atproto.repo.createRecord`; - const response = await fetch(url, { - method: "POST", - headers: { - "Content-Type": "application/json", - Authorization: `Bearer ${accessToken}`, - }, - body: JSON.stringify({ - repo: did, - collection, - record: { - $type: "site.standard.graph.subscription", - publication: publicationUri, - }, - }), - }); - - if (!response.ok) { - const body = await response.json().catch(() => ({})); - const message = body?.message ?? body?.error ?? `HTTP ${response.status}`; - throw new Error(`Failed to create record: ${message}`); - } - - const data = await response.json(); - return { uri: data.uri, cid: data.cid }; -} - /** * Fetch the publication AT URI from the host site's well-known endpoint. * @param {string} [origin] - Origin to fetch from (defaults to current page origin) @@ -219,9 +136,7 @@ async function fetchPublicationUri(origin) { const url = `${base}/.well-known/site.standard.publication`; const response = await fetch(url); if (!response.ok) { - throw new Error( - `Could not fetch publication URI: ${response.status}`, - ); + throw new Error(`Could not fetch publication URI: ${response.status}`); } // Accept either plain text (the AT URI itself) or JSON with a `uri` field. diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 6079331..7a4fd3b 100755 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -36,7 +36,7 @@ Publish evergreen content to the ATmosphere > https://tangled.org/stevedylan.dev/sequoia `, - version: "0.4.0", + version: "0.5.0", cmds: { add: addCommand, auth: authCommand, diff --git a/packages/cli/src/lib/atproto.ts b/packages/cli/src/lib/atproto.ts index 3ceefdd..42a172c 100644 --- a/packages/cli/src/lib/atproto.ts +++ b/packages/cli/src/lib/atproto.ts @@ -622,7 +622,14 @@ export async function createBlueskyPost( agent: Agent, options: CreateBlueskyPostOptions, ): Promise { - const { title, description, bskyPost, canonicalUrl, coverImage, publishedAt } = options; + const { + title, + description, + bskyPost, + canonicalUrl, + coverImage, + publishedAt, + } = options; // Build post text: title + description // Max 300 graphemes for Bluesky posts @@ -633,8 +640,7 @@ export async function createBlueskyPost( if (bskyPost) { // Custom bsky post overrides any default behavior postText = bskyPost; - } - else if (description) { + } else if (description) { // Try: title + description const fullText = `${title}\n\n${description}`; if (countGraphemes(fullText) <= MAX_GRAPHEMES) { @@ -642,9 +648,7 @@ export async function createBlueskyPost( } else { // Truncate description to fit const availableForDesc = - MAX_GRAPHEMES - - countGraphemes(title) - - countGraphemes("\n\n"); + MAX_GRAPHEMES - countGraphemes(title) - countGraphemes("\n\n"); if (availableForDesc > 10) { const truncatedDesc = truncateToGraphemes( description, -- 2.51.2