Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions app-prefixable/src/components/telegram-setup-guide-constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
type ChecklistItem = {
id: string
label: string
}

export const TELEGRAM_READINESS_CHECKS = Object.freeze([
Object.freeze({ id: "token", label: "Bot token is set with TELEGRAM_BOT_TOKEN or persisted token." }),
Object.freeze({ id: "mode", label: "Bridge mode is selected: polling or webhook." }),
Object.freeze({ id: "api", label: "openCodeUrl points to your reachable OpenCode API." }),
Object.freeze({ id: "path", label: "sessionStorePath points to a persistent writable location." }),
Object.freeze({ id: "webhook", label: "For webhook mode: TELEGRAM_WEBHOOK_URL, TELEGRAM_WEBHOOK_PATH, and HTTPS ingress are configured." }),
Object.freeze({ id: "notify", label: "Notifications are enabled per chat with /notify on after a test message." }),
Object.freeze({ id: "alarm", label: "Session bell/alarm is enabled for each OpenCode session that should emit proactive alerts." }),
]) as readonly Readonly<ChecklistItem>[]

const commands = ["/pending", "/inbox", "/notify on", "/notify off", "/notify status", "/new", "/status", "/sessions", "/switch <session-id|index>", "/help"] as const
const sections = ["Readiness checklist", "Prerequisites", "Setup steps", "Command usage", "Security best practices", "Troubleshooting quick checks"] as const
const requiredKeys = ["TELEGRAM_BOT_TOKEN", "TELEGRAM_WEBHOOK_SECRET", "openCodeUrl", "webhookUrl"] as const

export const TELEGRAM_GUIDE_COMMANDS = [...commands]
export const TELEGRAM_GUIDE_SECTIONS = [...sections]
export const TELEGRAM_GUIDE_TITLE = "Telegram Setup Guide"
export const TELEGRAM_GUIDE_REQUIRED_KEYS = [...requiredKeys]
29 changes: 5 additions & 24 deletions app-prefixable/src/components/telegram-setup-guide.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,11 @@
import { For, createMemo, createSignal } from "solid-js"
import { TELEGRAM_GUIDE_COMMANDS, TELEGRAM_GUIDE_REQUIRED_KEYS, TELEGRAM_GUIDE_SECTIONS, TELEGRAM_GUIDE_TITLE, TELEGRAM_READINESS_CHECKS } from "./telegram-setup-guide-constants"

type ChecklistItem = {
id: string
label: string
}

const checklist = Object.freeze([
Object.freeze({ id: "token", label: "Bot token is set with TELEGRAM_BOT_TOKEN or persisted token." }),
Object.freeze({ id: "mode", label: "Bridge mode is selected: polling or webhook." }),
Object.freeze({ id: "api", label: "openCodeUrl points to your reachable OpenCode API." }),
Object.freeze({ id: "path", label: "sessionStorePath points to a persistent writable location." }),
Object.freeze({ id: "webhook", label: "For webhook mode: TELEGRAM_WEBHOOK_URL, TELEGRAM_WEBHOOK_PATH, and HTTPS ingress are configured." }),
Object.freeze({ id: "notify", label: "Notifications are enabled per chat with /notify on after a test message." }),
Object.freeze({ id: "alarm", label: "Session bell/alarm is enabled for each OpenCode session that should emit proactive alerts." }),
]) as readonly Readonly<ChecklistItem>[]
export { TELEGRAM_GUIDE_COMMANDS, TELEGRAM_GUIDE_REQUIRED_KEYS, TELEGRAM_GUIDE_SECTIONS, TELEGRAM_GUIDE_TITLE, TELEGRAM_READINESS_CHECKS }

const commands = ["/pending", "/inbox", "/notify on", "/notify off", "/notify status", "/new", "/status", "/sessions", "/switch <session-id|index>", "/help"] as const
const sections = ["Readiness checklist", "Prerequisites", "Setup steps", "Command usage", "Security best practices", "Troubleshooting quick checks"] as const
const title = "Telegram Setup Guide"
const requiredKeys = ["TELEGRAM_BOT_TOKEN", "TELEGRAM_WEBHOOK_SECRET", "openCodeUrl", "webhookUrl"] as const
const checklist = TELEGRAM_READINESS_CHECKS
const commands = TELEGRAM_GUIDE_COMMANDS
const title = TELEGRAM_GUIDE_TITLE

export function TelegramSetupGuide() {
const [done, setDone] = createSignal(new Set<string>())
Expand Down Expand Up @@ -168,9 +155,3 @@ export function TelegramSetupGuide() {
</div>
)
}

export const TELEGRAM_GUIDE_COMMANDS = [...commands]
export const TELEGRAM_READINESS_CHECKS = checklist
export const TELEGRAM_GUIDE_SECTIONS = [...sections]
export const TELEGRAM_GUIDE_TITLE = title
export const TELEGRAM_GUIDE_REQUIRED_KEYS = [...requiredKeys]
2 changes: 1 addition & 1 deletion app-prefixable/tests/telegram-guide.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from "bun:test"
import { TELEGRAM_GUIDE_COMMANDS, TELEGRAM_GUIDE_REQUIRED_KEYS, TELEGRAM_GUIDE_SECTIONS, TELEGRAM_GUIDE_TITLE, TELEGRAM_READINESS_CHECKS } from "../src/components/telegram-setup-guide"
import { TELEGRAM_GUIDE_COMMANDS, TELEGRAM_GUIDE_REQUIRED_KEYS, TELEGRAM_GUIDE_SECTIONS, TELEGRAM_GUIDE_TITLE, TELEGRAM_READINESS_CHECKS } from "../src/components/telegram-setup-guide-constants"
import { SETTINGS_BASE_TABS } from "../src/pages/settings-tabs"

describe("Telegram setup guide UI", () => {
Expand Down