|
|
@@ -24,7 +24,7 @@ This is the persistent context file for Claude Code. Keep it concise and useful.
|
|
|
- Discord API: `arikawa/v3` + `ningen/v3` (state management + Discord markdown)
|
|
|
- Markdown: `goldmark` parser + `chroma/v2` syntax highlighting
|
|
|
- Config: TOML via `BurntSushi/toml`, file at `~/.config/discordo/config.toml`
|
|
|
-- Cache: `~/.cache/discordo/` (attachments, logs)
|
|
|
+- Cache: `~/.cache/discordo/` (attachments, logs, state)
|
|
|
|
|
|
## Architecture
|
|
|
- `main.go` → `cmd/root.go` (app init) → `internal/ui/` (TUI layers)
|
|
|
@@ -32,13 +32,14 @@ This is the persistent context file for Claude Code. Keep it concise and useful.
|
|
|
- `internal/markdown/renderer.go` — AST→styled lines, handles Discord markdown flavors
|
|
|
- `internal/config/` — `config.go` (struct + loader), `config.toml` (defaults, embedded), `keybinds.go`, `theme.go`
|
|
|
- `internal/consts/` — app name, cache dir
|
|
|
+- `internal/ui/chat/guildstate.go` — persists guild expand/collapse state to `~/.cache/discordo/state.json`
|
|
|
- Rendering pipeline: messages → `tview.LineBuilder` → `[]tview.Line` (segments with `tcell.Style`)
|
|
|
- URLs get `style.Url(rawURL)` metadata for OSC 8 terminal hyperlinks
|
|
|
- External commands (editor, image viewer) use `app.Suspend()` pattern — suspends TUI, runs command, resumes
|
|
|
|
|
|
## Key Patterns
|
|
|
- Keybinds: defined in `config/keybinds.go` structs, matched in `HandleEvent()` via `keybind.Matches()`
|
|
|
-- Help tooltips: `ShortHelp()` (bottom bar, contextual) and `FullHelp()` (full overlay via ctrl+.)
|
|
|
+- Help tooltips: `ShortHelp()` (bottom bar, contextual) and `FullHelp()` (full overlay via `?`)
|
|
|
- Attachments: downloaded to `~/.cache/discordo/attachments/`, opened via configured viewer or `open.Start()`
|
|
|
- Embeds: rendered with `▎` bar prefix, wrapped to viewport width, markdown in descriptions
|
|
|
- Config defaults embedded via `//go:embed config.toml`
|
|
|
@@ -50,11 +51,18 @@ This is the persistent context file for Claude Code. Keep it concise and useful.
|
|
|
- **Attachment URL fix**: split `builder.Write(filename+"\n"+url)` into proper `NewLine()` + `.Url()` style
|
|
|
- **Supported image types**: jpeg, png, webp, gif (via `supportedImageTypes` map)
|
|
|
- **ShortHelp**: `o` (open) now shows in bottom tooltip bar when message has attachments/URLs
|
|
|
+- **Help keybind**: changed from `ctrl+.` to `?` — `ctrl+.` not reliably handled by terminals
|
|
|
+- **Edit config**: `E` keybind (only active in help overlay) opens config in `$EDITOR`/vim via `app.Suspend()`
|
|
|
+- **Editor default**: falls back to `vim` when `editor = "default"` and `$EDITOR` is unset
|
|
|
+- **Guild state persistence**: expanded/collapsed guild state saved to `~/.cache/discordo/state.json`, restored on launch via `guildstate.go`
|
|
|
+- **Focus on channel select**: AutoFocus now targets messages list instead of message input when selecting a channel
|
|
|
|
|
|
## Config Fields We Added
|
|
|
- `image_viewer` — external image viewer command (default: `"mpv"`, `"default"` = system opener)
|
|
|
- `image_save_dir` — directory for saved images (supports `~/`, default: current dir)
|
|
|
- `keybinds.messages_list.save_image` — save image keybind (default: `S`)
|
|
|
+- `keybinds.edit_config` — open config in editor from help overlay (default: `E`)
|
|
|
+- `keybinds.toggle_help` — changed default from `ctrl+.` to `?`
|
|
|
|
|
|
## Build & Run
|
|
|
- Build: `go build -o discordo-plus .`
|