Commit Graph

4 Commits

Author SHA1 Message Date
clawbot
7bbd6de73a feat: add irc numerics package, deduplicate constants, fix dead code
All checks were successful
check / check (push) Successful in 1m5s
- Create internal/irc/ package with all IRC numeric reply codes (RFC 1459/2812)
  and command string constants as the single source of truth
- Replace all 69+ bare numeric string literals in api.go with named constants
  (e.g. irc.RplWelcome, irc.ErrNoSuchChannel)
- Add 'code' (int) and named 'command' (e.g. RPL_YOURHOST) fields to IRC
  message JSON replies via irc.Name() lookup in scanMessages
- Deduplicate command constants: remove local definitions from api.go,
  cmd/neoirc-cli/main.go, and cmd/neoirc-cli/api/client.go; all now import
  from internal/irc
- Fix dead code: remove handleListCmd/handleWhoCmd/handleWhoisCmd/
  sendWhoisNumerics that were unreachable due to dispatchCommand routing
  LIST/WHO/WHOIS to dispatchInfoCommand before dispatchQueryCommand.
  Route these commands to dispatchQueryCommand which has the improved
  implementations (e.g. ListAllChannelsWithCounts single-query vs N+1)
- Update enqueueNumeric and respondIRCError signatures from string to int
- Update test helper findNumeric to check the new 'code' JSON field

Closes #52
2026-03-09 15:49:29 -07:00
5efb4b6949 refactor: replace all bare command string literals with named constants
All checks were successful
check / check (push) Successful in 2m15s
Extract cmdLusers, cmdMode, cmdMotd, cmdNames, cmdNotice, cmdPing, cmdPong
constants in internal/handlers/api.go. Add corresponding constants in
cmd/neoirc-cli/main.go and cmd/neoirc-cli/api/client.go. Replace every bare
IRC command string literal in switch cases and command dispatch code with the
named constant. Zero bare command strings remain in any dispatch path.
2026-03-09 15:23:00 -07:00
47fb089969 fix: IRC SPA cleanup — /motd, /query, Firefox / key, default MOTD (#58)
All checks were successful
check / check (push) Successful in 1m0s
## Summary

Fixes IRC client SPA issues reported in [issue #57](#57).

## Changes

### Server-side
- **Default MOTD**: Added figlet-style ASCII art MOTD for "neoirc" as the default when no MOTD is configured via environment/config
- **MOTD command handler**: Added `MOTD` case to `dispatchCommand` so clients can re-request the MOTD at any time (proper IRC behavior)

### SPA (web client)
- **`/motd` command**: Sends MOTD request to server, displays 375/372/376 numerics in server window
- **`/query nick [message]`**: Opens a DM tab with the specified user, optionally sends a message
- **`/clear`**: Clears messages in the current tab
- **Firefox `/` key fix**: Added global `keydown` listener that captures `/` when input is not focused, preventing Firefox quick search and redirecting focus to the input element. Also auto-focuses input on SPA init.
- **MOTD on resumed sessions**: When restoring from a saved token, the MOTD is re-requested so it always appears in the server window
- **Updated `/help`**: Shows all new commands with descriptions
- **Login screen MOTD styling**: Improved for ASCII art display (monospace, proper line height)

## Testing
- `docker build .` passes (includes `make check` with tests, lint, fmt-check)
- All existing tests pass with no modifications

closes #57

<!-- session: agent:sdlc-manager:subagent:7c880fec-f818-49ff-a548-2d3c26758bb6 -->

Co-authored-by: user <user@Mac.lan guest wan>
Reviewed-on: #58
Co-authored-by: clawbot <clawbot@noreply.example.org>
Co-committed-by: clawbot <clawbot@noreply.example.org>
2026-03-09 23:00:34 +01:00
2da7f11484 Rename app from chat to neoirc, binary to neoircd (closes #46) (#47)
All checks were successful
check / check (push) Successful in 2m24s
Complete rename of the application from `chat` to `neoirc` with binary name `neoircd`.

closes #46

## Changes

- **Go module path**: `git.eeqj.de/sneak/chat` → `git.eeqj.de/sneak/neoirc`
- **Server binary**: `chatd` → `neoircd`
- **CLI binary**: `chat-cli` → `neoirc-cli`
- **Cmd directories**: `cmd/chatd` → `cmd/neoircd`, `cmd/chat-cli` → `cmd/neoirc-cli`
- **Go package**: `chatapi` → `neoircapi`
- **Makefile**: binary name, build targets, docker image tag, clean target
- **Dockerfile**: binary paths, user/group names (`chat` → `neoirc`), ENTRYPOINT
- **`.gitignore`/`.dockerignore`**: artifact names
- **All Go imports and doc comments**
- **Default server name**: `chat` → `neoirc`
- **Web client**: localStorage keys (`chat_token`/`chat_channels` → `neoirc_token`/`neoirc_channels`), page title, default server display name
- **Schema files**: all `$id` URLs and example hostnames
- **README.md**: project name, all binary references, examples, directory tree
- **AGENTS.md**: build command reference
- **Test fixtures**: app name and channel names

Docker build passes. All tests pass.

<!-- session: agent:sdlc-manager:subagent:a4b8dbd3-a7c8-4fad-8239-bb5a64a9b3d6 -->

Co-authored-by: clawbot <clawbot@noreply.eeqj.de>
Reviewed-on: #47
Co-authored-by: clawbot <clawbot@noreply.example.org>
Co-committed-by: clawbot <clawbot@noreply.example.org>
2026-03-07 14:43:58 +01:00