diff --git a/AGENTS.md b/AGENTS.md index bffa0b8..c570666 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,7 +11,6 @@ discord.js v14. slash/context-menu commands, Components V2). For the underlying platform, see the [Discord developer docs](https://discord.dev). - **Tooling**: [Biome](https://biomejs.dev) for formatting and linting. -- **HTTP**: `ofetch` for outbound API calls (e.g. ProductBoard). - **Config**: `@uwu/configmasher`. ## Commands @@ -38,7 +37,6 @@ src/ commands/ index.ts Aggregates every command into a name -> command map. util/ close, reopen, walkthrough. - product/ notes (ProductBoard context-menu command). events/ commands, messages, channels, walkthrough, bridge handlers. bridge/ linear/ Discord -> Linear mirror (client, api, orchestration). diff --git a/bun.lockb b/bun.lockb index db7040a..3ca34b0 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 53584d3..7febafa 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,6 @@ "@linear/sdk": "^90.0.0", "@uwu/configmasher": "^2.0.2", "discord.js": "^14.27.0", - "ofetch": "^1.5.1", "throttle-debounce": "^5.0.2" }, "trustedDependencies": [ diff --git a/src/commands/index.ts b/src/commands/index.ts index cf00f77..d5ae337 100644 --- a/src/commands/index.ts +++ b/src/commands/index.ts @@ -6,8 +6,6 @@ import type { SlashCommandOptionsOnlyBuilder, } from "discord.js"; -import { default as product_notes } from "./product/notes.js"; - import { default as close } from "./util/close.js"; import { default as reopen } from "./util/reopen.js"; import { default as updateThread } from "./util/update-thread.js"; @@ -28,13 +26,7 @@ const commandObject: { }; } = {}; -for (const command of [ - product_notes, - close, - reopen, - updateThread, - walkthrough, -]) { +for (const command of [close, reopen, updateThread, walkthrough]) { commandObject[command.data.name] = command; } diff --git a/src/commands/product/notes.ts b/src/commands/product/notes.ts deleted file mode 100644 index b1dfd9a..0000000 --- a/src/commands/product/notes.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { config } from "@lib/config.js"; -import { makeCodeBlock } from "@lib/discord/messages.js"; - -import { ofetch } from "ofetch"; - -import { - ContextMenuCommandBuilder, - ApplicationCommandType, - type MessageContextMenuCommandInteraction, - MessageFlags, - ActionRowBuilder, - ButtonStyle, - ButtonBuilder, -} from "discord.js"; - -// TODO: try to make the official API package work -async function createNote(body) { - return ofetch("https://api.productboard.com/notes", { - method: "POST", - headers: { - Authorization: `Bearer ${config.productBoard.token}`, - }, - body, - }); -} - -export default { - data: new ContextMenuCommandBuilder() - .setName("Add to product notes") - .setType(ApplicationCommandType.Message), - - execute: async (interaction: MessageContextMenuCommandInteraction) => { - const data = await createNote({ - title: `Discord message from ${interaction.targetMessage.author.displayName} (in '${interaction.channel.name}')`, // this will only work for threads - display_url: interaction.targetMessage.url, - content: interaction.targetMessage.content, - - company: { id: config.productBoard.companyId }, - user: { external_id: `discord:${interaction.targetMessage.author.id}` }, - - source: { origin: "discord", record_id: interaction.targetId }, - tags: ["discord"], - }); - - const replyComponents = []; - - if (data.links?.html) { - const button = new ButtonBuilder() - .setLabel("Open in ProductBoard") - .setStyle(ButtonStyle.Link) - .setURL(data.links.html); - - replyComponents.push( - new ActionRowBuilder().addComponents(button), - ); - } - - await interaction.reply({ - content: makeCodeBlock(JSON.stringify(data), "json"), - - components: replyComponents, - - flags: MessageFlags.Ephemeral, - }); - }, -}; diff --git a/src/lib/config.ts b/src/lib/config.ts index 27e32c7..cae1889 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -30,11 +30,6 @@ interface Config { vscode: string; }; - productBoard: { - token: string; - companyId: string; - }; - // One-way Discord -> Linear bridge for #help threads. Disabled by default. linearBridge: { enabled: boolean; @@ -116,9 +111,6 @@ export const { config, layers } = await loadConfig({ ["emojis", "macos"], ["emojis", "windows"], ["emojis", "vscode"], - - ["productBoard", "token"], - ["productBoard", "companyId"], ], });