kokoirc 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/README.md +227 -0
  2. package/docs/commands/alias.md +42 -0
  3. package/docs/commands/ban.md +26 -0
  4. package/docs/commands/close.md +25 -0
  5. package/docs/commands/connect.md +26 -0
  6. package/docs/commands/deop.md +24 -0
  7. package/docs/commands/devoice.md +24 -0
  8. package/docs/commands/disconnect.md +26 -0
  9. package/docs/commands/help.md +28 -0
  10. package/docs/commands/ignore.md +47 -0
  11. package/docs/commands/items.md +95 -0
  12. package/docs/commands/join.md +25 -0
  13. package/docs/commands/kb.md +26 -0
  14. package/docs/commands/kick.md +25 -0
  15. package/docs/commands/log.md +82 -0
  16. package/docs/commands/me.md +24 -0
  17. package/docs/commands/mode.md +29 -0
  18. package/docs/commands/msg.md +26 -0
  19. package/docs/commands/nick.md +24 -0
  20. package/docs/commands/notice.md +24 -0
  21. package/docs/commands/op.md +24 -0
  22. package/docs/commands/part.md +25 -0
  23. package/docs/commands/quit.md +24 -0
  24. package/docs/commands/reload.md +19 -0
  25. package/docs/commands/script.md +126 -0
  26. package/docs/commands/server.md +61 -0
  27. package/docs/commands/set.md +37 -0
  28. package/docs/commands/topic.md +24 -0
  29. package/docs/commands/unalias.md +22 -0
  30. package/docs/commands/unban.md +25 -0
  31. package/docs/commands/unignore.md +25 -0
  32. package/docs/commands/voice.md +25 -0
  33. package/docs/commands/whois.md +24 -0
  34. package/docs/commands/wii.md +23 -0
  35. package/package.json +38 -0
  36. package/src/app/App.tsx +205 -0
  37. package/src/core/commands/docs.ts +183 -0
  38. package/src/core/commands/execution.ts +114 -0
  39. package/src/core/commands/help-formatter.ts +185 -0
  40. package/src/core/commands/helpers.ts +168 -0
  41. package/src/core/commands/index.ts +7 -0
  42. package/src/core/commands/parser.ts +33 -0
  43. package/src/core/commands/registry.ts +1394 -0
  44. package/src/core/commands/types.ts +19 -0
  45. package/src/core/config/defaults.ts +66 -0
  46. package/src/core/config/loader.ts +209 -0
  47. package/src/core/constants.ts +20 -0
  48. package/src/core/init.ts +32 -0
  49. package/src/core/irc/antiflood.ts +244 -0
  50. package/src/core/irc/client.ts +145 -0
  51. package/src/core/irc/events.ts +1031 -0
  52. package/src/core/irc/formatting.ts +132 -0
  53. package/src/core/irc/ignore.ts +84 -0
  54. package/src/core/irc/index.ts +2 -0
  55. package/src/core/irc/netsplit.ts +292 -0
  56. package/src/core/scripts/api.ts +240 -0
  57. package/src/core/scripts/event-bus.ts +82 -0
  58. package/src/core/scripts/index.ts +26 -0
  59. package/src/core/scripts/manager.ts +154 -0
  60. package/src/core/scripts/types.ts +256 -0
  61. package/src/core/state/selectors.ts +39 -0
  62. package/src/core/state/sorting.ts +30 -0
  63. package/src/core/state/store.ts +242 -0
  64. package/src/core/storage/crypto.ts +78 -0
  65. package/src/core/storage/db.ts +107 -0
  66. package/src/core/storage/index.ts +80 -0
  67. package/src/core/storage/query.ts +204 -0
  68. package/src/core/storage/types.ts +37 -0
  69. package/src/core/storage/writer.ts +130 -0
  70. package/src/core/theme/index.ts +3 -0
  71. package/src/core/theme/loader.ts +45 -0
  72. package/src/core/theme/parser.ts +518 -0
  73. package/src/core/theme/renderer.tsx +25 -0
  74. package/src/index.tsx +17 -0
  75. package/src/types/config.ts +126 -0
  76. package/src/types/index.ts +107 -0
  77. package/src/types/irc-framework.d.ts +569 -0
  78. package/src/types/theme.ts +37 -0
  79. package/src/ui/ErrorBoundary.tsx +42 -0
  80. package/src/ui/chat/ChatView.tsx +39 -0
  81. package/src/ui/chat/MessageLine.tsx +92 -0
  82. package/src/ui/hooks/useStatusbarColors.ts +23 -0
  83. package/src/ui/input/CommandInput.tsx +273 -0
  84. package/src/ui/layout/AppLayout.tsx +126 -0
  85. package/src/ui/layout/TopicBar.tsx +46 -0
  86. package/src/ui/sidebar/BufferList.tsx +55 -0
  87. package/src/ui/sidebar/NickList.tsx +96 -0
  88. package/src/ui/splash/SplashScreen.tsx +100 -0
  89. package/src/ui/statusbar/StatusLine.tsx +205 -0
  90. package/themes/.gitkeep +0 -0
  91. package/themes/default.theme +57 -0
  92. package/tsconfig.json +19 -0
@@ -0,0 +1,82 @@
1
+ ---
2
+ category: Logging
3
+ description: Chat log management
4
+ ---
5
+
6
+ # /log
7
+
8
+ ## Syntax
9
+
10
+ /log [status|search] [query]
11
+
12
+ ## Description
13
+
14
+ Manage persistent chat logs. Messages are stored in a local SQLite database
15
+ at `~/.kokoirc/logs.db` with WAL mode for concurrent access.
16
+
17
+ Only messages that reach the UI are logged — messages filtered by `/ignore`,
18
+ antiflood, or script `stop()` propagation are never stored.
19
+
20
+ ## Subcommands
21
+
22
+ ### status
23
+
24
+ Show logging status including message count, database size, and encryption mode.
25
+
26
+ /log status
27
+
28
+ This is the default when no subcommand is given.
29
+
30
+ ### search
31
+
32
+ Full-text search across logged messages (plain text mode only).
33
+
34
+ /log search <query>
35
+
36
+ Searches within the current buffer's network and channel context. Results
37
+ show the 20 most recent matches with timestamps.
38
+
39
+ Search is not available in encrypted mode since ciphertext cannot be indexed.
40
+
41
+ ## Configuration
42
+
43
+ ```toml
44
+ [logging]
45
+ enabled = true # enable/disable logging
46
+ encrypt = false # AES-256-GCM encryption (disables search)
47
+ retention_days = 0 # 0 = keep forever
48
+ exclude_types = [] # filter: "message", "action", "notice", "ctcp", "event"
49
+ ```
50
+
51
+ ### Encryption
52
+
53
+ When `encrypt = true`, message text is encrypted with AES-256-GCM using a
54
+ 256-bit key auto-generated in `~/.kokoirc/.env`. No password is required —
55
+ same trust model as irssi logs or SSH keys.
56
+
57
+ Only the `text` column is encrypted. Network, buffer, nick, timestamp, and
58
+ type remain queryable for the future web frontend.
59
+
60
+ ### Retention
61
+
62
+ Set `retention_days` to automatically purge old messages on startup.
63
+ `0` means keep forever.
64
+
65
+ ### Excluding Types
66
+
67
+ Filter specific message types from logging:
68
+
69
+ ```toml
70
+ [logging]
71
+ exclude_types = ["event"] # skip join/part/quit events
72
+ ```
73
+
74
+ ## Examples
75
+
76
+ /log
77
+ /log status
78
+ /log search ssl certificate
79
+
80
+ ## See Also
81
+
82
+ /set, /ignore
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Messaging
3
+ description: Send an action message
4
+ ---
5
+
6
+ # /me
7
+
8
+ ## Syntax
9
+
10
+ /me <action>
11
+
12
+ ## Description
13
+
14
+ Send a CTCP ACTION message to the current channel or query. Displayed
15
+ as `* nick action` in the chat.
16
+
17
+ ## Examples
18
+
19
+ /me waves hello
20
+ /me is away for lunch
21
+
22
+ ## See Also
23
+
24
+ /msg, /notice
@@ -0,0 +1,29 @@
1
+ ---
2
+ category: Info
3
+ description: Set or query channel/user modes
4
+ ---
5
+
6
+ # /mode
7
+
8
+ ## Syntax
9
+
10
+ /mode [target] [+/-modes] [params]
11
+
12
+ ## Description
13
+
14
+ Set or query channel or user modes. With no arguments, queries your
15
+ own user modes. If the first argument starts with `+` or `-`, applies
16
+ the mode change to the current channel. Otherwise, the first argument
17
+ is treated as the target.
18
+
19
+ ## Examples
20
+
21
+ /mode
22
+ /mode +i
23
+ /mode #linux +o friend
24
+ /mode +nt
25
+ /mode #linux +b *!*@bad.host
26
+
27
+ ## See Also
28
+
29
+ /op, /deop, /voice, /ban
@@ -0,0 +1,26 @@
1
+ ---
2
+ category: Messaging
3
+ description: Send a message to a user or channel
4
+ ---
5
+
6
+ # /msg
7
+
8
+ ## Syntax
9
+
10
+ /msg <target> <message>
11
+
12
+ ## Description
13
+
14
+ Send a private message to a user or channel. For private messages, a
15
+ query window is automatically opened and focused. Messages sent to
16
+ channels appear in the channel buffer.
17
+
18
+ ## Examples
19
+
20
+ /msg NickServ IDENTIFY mypassword
21
+ /msg friend Hey, what's up?
22
+ /msg #linux Hello everyone
23
+
24
+ ## See Also
25
+
26
+ /notice, /me
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Messaging
3
+ description: Change your nickname
4
+ ---
5
+
6
+ # /nick
7
+
8
+ ## Syntax
9
+
10
+ /nick <newnick>
11
+
12
+ ## Description
13
+
14
+ Change your nickname on the current server. The server may reject the
15
+ change if the nick is already in use or contains invalid characters.
16
+
17
+ ## Examples
18
+
19
+ /nick newnick
20
+ /nick myname_away
21
+
22
+ ## See Also
23
+
24
+ /whois, /set
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Messaging
3
+ description: Send a notice
4
+ ---
5
+
6
+ # /notice
7
+
8
+ ## Syntax
9
+
10
+ /notice <target> <message>
11
+
12
+ ## Description
13
+
14
+ Send a NOTICE to a user or channel. Notices are typically used for
15
+ automated replies and should not trigger auto-responses from bots.
16
+
17
+ ## Examples
18
+
19
+ /notice friend Check out this link
20
+ /notice #linux Announcement: meeting at 5pm
21
+
22
+ ## See Also
23
+
24
+ /msg, /me
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Moderation
3
+ description: Give operator status
4
+ ---
5
+
6
+ # /op
7
+
8
+ ## Syntax
9
+
10
+ /op <nick> [nick2 ...]
11
+
12
+ ## Description
13
+
14
+ Give channel operator status (+o) to one or more users in the current channel.
15
+ You must be a channel operator to use this command.
16
+
17
+ ## Examples
18
+
19
+ /op friend
20
+ /op user1 user2 user3
21
+
22
+ ## See Also
23
+
24
+ /deop, /voice, /mode
@@ -0,0 +1,25 @@
1
+ ---
2
+ category: Channel
3
+ description: Leave a channel
4
+ ---
5
+
6
+ # /part
7
+
8
+ ## Syntax
9
+
10
+ /part [channel] [message]
11
+
12
+ ## Description
13
+
14
+ Leave an IRC channel. With no arguments, leaves the current channel.
15
+ Optionally specify a channel name and part message.
16
+
17
+ ## Examples
18
+
19
+ /part
20
+ /part #linux
21
+ /part #linux See you later
22
+
23
+ ## See Also
24
+
25
+ /join, /close
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Connection
3
+ description: Quit all connections and close kIRC
4
+ ---
5
+
6
+ # /quit
7
+
8
+ ## Syntax
9
+
10
+ /quit [message]
11
+
12
+ ## Description
13
+
14
+ Disconnect from all servers and close the application. An optional quit
15
+ message is sent to each server. Default message is "kIRC".
16
+
17
+ ## Examples
18
+
19
+ /quit
20
+ /quit Goodnight!
21
+
22
+ ## See Also
23
+
24
+ /disconnect, /close
@@ -0,0 +1,19 @@
1
+ ---
2
+ category: Configuration
3
+ description: Reload theme and config
4
+ ---
5
+
6
+ # /reload
7
+
8
+ ## Syntax
9
+
10
+ /reload
11
+
12
+ ## Description
13
+
14
+ Reload the configuration file and theme from disk. Useful after manually
15
+ editing `config/config.toml` or theme files.
16
+
17
+ ## See Also
18
+
19
+ /set, /items
@@ -0,0 +1,126 @@
1
+ ---
2
+ category: Scripts
3
+ description: Manage user scripts
4
+ ---
5
+
6
+ # /script
7
+
8
+ ## Syntax
9
+
10
+ /script [list|available|load|unload|reload] [name]
11
+
12
+ ## Description
13
+
14
+ Manage user scripts. Scripts are TypeScript files in `~/.kokoirc/scripts/`
15
+ that extend kokoIRC with custom commands, event hooks, filters, and automation.
16
+
17
+ Scripts have full access to the IRC client, store, and UI — same trust model
18
+ as irssi Perl scripts.
19
+
20
+ ## Subcommands
21
+
22
+ ### list
23
+
24
+ Show currently loaded scripts with version and description.
25
+
26
+ /script list
27
+
28
+ This is the default when no subcommand is given.
29
+
30
+ ### available
31
+
32
+ Show all script files found in `~/.kokoirc/scripts/`.
33
+
34
+ /script available
35
+
36
+ Loaded scripts are marked with a filled circle (●).
37
+
38
+ ### load
39
+
40
+ Load a script by name or absolute path.
41
+
42
+ /script load <name>
43
+ /script load /path/to/script.ts
44
+
45
+ When given a name without a path, looks for `~/.kokoirc/scripts/<name>.ts`.
46
+
47
+ ### unload
48
+
49
+ Unload a script. All event handlers, commands, and timers registered by
50
+ the script are automatically cleaned up.
51
+
52
+ /script unload <name>
53
+
54
+ ### reload
55
+
56
+ Unload and reload a script (cache-busted import).
57
+
58
+ /script reload <name>
59
+
60
+ ## Autoloading
61
+
62
+ Add script names to `config.toml` to load them on startup:
63
+
64
+ ```toml
65
+ [scripts]
66
+ autoload = ["auto-away", "spam-filter"]
67
+ debug = false
68
+ ```
69
+
70
+ ## Writing Scripts
71
+
72
+ Scripts are `.ts` files that export a default init function:
73
+
74
+ ```ts
75
+ import type { KokoAPI, IrcMessageEvent } from "@/core/scripts/types"
76
+
77
+ export const meta = { name: "my-script", version: "1.0.0", description: "..." }
78
+ export const config = { timeout: 300 } // defaults for [scripts.my-script]
79
+
80
+ export default function init(api: KokoAPI) {
81
+ // Use api.EventPriority for priority constants (HIGHEST, HIGH, NORMAL, LOW, LOWEST)
82
+ api.on("irc.privmsg", (event: IrcMessageEvent, ctx) => {
83
+ // ctx.stop() prevents lower-priority handlers + built-in store update
84
+ }, api.EventPriority.LOW)
85
+
86
+ api.command("mycommand", { handler(args, connId) { /* ... */ }, description: "..." })
87
+
88
+ return () => { /* cleanup on unload */ }
89
+ }
90
+ ```
91
+
92
+ **Import rules:** Scripts live outside the project, so `@/` path aliases only work
93
+ with `import type` (stripped at runtime). For values like `EventPriority`, use
94
+ `api.EventPriority` instead of importing.
95
+
96
+ ### Available Events
97
+
98
+ **IRC events:** `irc.privmsg`, `irc.action`, `irc.notice`, `irc.join`, `irc.part`,
99
+ `irc.quit`, `irc.kick`, `irc.nick`, `irc.topic`, `irc.mode`, `irc.invite`,
100
+ `irc.ctcp_request`, `irc.ctcp_response`, `irc.wallops`
101
+
102
+ **App events:** `command_input`, `connected`, `disconnected`
103
+
104
+ ### Per-Script Config
105
+
106
+ Declare defaults with `export const config = {...}`. Users override in TOML:
107
+
108
+ ```toml
109
+ [scripts.auto-away]
110
+ timeout = 300
111
+ message = "AFK"
112
+ ```
113
+
114
+ Access via `api.config.get("timeout", 300)`.
115
+
116
+ ## Examples
117
+
118
+ /script available
119
+ /script load auto-away
120
+ /script list
121
+ /script reload auto-away
122
+ /script unload auto-away
123
+
124
+ ## See Also
125
+
126
+ /set, /alias
@@ -0,0 +1,61 @@
1
+ ---
2
+ category: Connection
3
+ description: Manage server configurations
4
+ ---
5
+
6
+ # /server
7
+
8
+ ## Syntax
9
+
10
+ /server [list|add|remove] [args...]
11
+
12
+ ## Description
13
+
14
+ Manage IRC server configurations. Add, remove, and list servers.
15
+ Server credentials (passwords, SASL) are stored in `.env`.
16
+
17
+ ## Subcommands
18
+
19
+ ### list
20
+
21
+ List all configured servers with their connection status.
22
+
23
+ /server list
24
+
25
+ This is the default when no subcommand is given.
26
+
27
+ ### add
28
+
29
+ Add a new server to the configuration.
30
+
31
+ /server add <id> <address>[:<port>] [flags...]
32
+
33
+ **Flags:**
34
+ - `-tls` — Enable TLS (auto-sets port to 6697)
35
+ - `-noauto` — Don't auto-connect on startup
36
+ - `-notlsverify` — Skip TLS certificate verification
37
+ - `-bind=<ip>` — Bind to local IP (vhost)
38
+ - `-nick=<nick>` — Server-specific nick override
39
+ - `-label=<name>` — Display name
40
+ - `-password=<pass>` — Server password (saved to .env)
41
+ - `-sasl=<user>:<pass>` — SASL auth (saved to .env)
42
+
43
+ ### remove
44
+
45
+ Remove a server and disconnect if connected.
46
+
47
+ /server remove <id>
48
+
49
+ Aliases: del
50
+
51
+ ## Examples
52
+
53
+ /server list
54
+ /server add libera irc.libera.chat:6697 -tls
55
+ /server add libera irc.libera.chat:6697 -tls -sasl=user:pass
56
+ /server add local 127.0.0.1:6667 -noauto -label=dev
57
+ /server remove libera
58
+
59
+ ## See Also
60
+
61
+ /connect, /disconnect, /set
@@ -0,0 +1,37 @@
1
+ ---
2
+ category: Configuration
3
+ description: View or change configuration
4
+ ---
5
+
6
+ # /set
7
+
8
+ ## Syntax
9
+
10
+ /set [section.field] [value]
11
+
12
+ ## Description
13
+
14
+ View or change runtime configuration. Settings use dot-notation paths
15
+ like `general.nick` or `servers.libera.port`. Changes are saved to
16
+ `config/config.toml` immediately. Credentials (passwords, SASL) are
17
+ stored in `.env` instead.
18
+
19
+ With no arguments, lists all settings grouped by section.
20
+ With just a path, shows the current value.
21
+ With a path and value, sets the value and saves.
22
+
23
+ Boolean values accept: `true`/`false`, `on`/`off`, `yes`/`no`.
24
+ Array values use comma-separated format: `#chan1,#chan2`.
25
+
26
+ ## Examples
27
+
28
+ /set
29
+ /set general.nick
30
+ /set general.nick newnick
31
+ /set general.theme tokyo-night
32
+ /set servers.libera.tls true
33
+ /set servers.libera.channels #linux,#irc
34
+
35
+ ## See Also
36
+
37
+ /reload, /server, /items
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Channel
3
+ description: Set or view channel topic
4
+ ---
5
+
6
+ # /topic
7
+
8
+ ## Syntax
9
+
10
+ /topic [channel] <text>
11
+
12
+ ## Description
13
+
14
+ Set the topic for a channel. With just text, sets the topic for the
15
+ current channel. Specify a channel name to set a different channel's topic.
16
+
17
+ ## Examples
18
+
19
+ /topic Welcome to the channel!
20
+ /topic #linux Welcome to #linux
21
+
22
+ ## See Also
23
+
24
+ /join, /mode
@@ -0,0 +1,22 @@
1
+ ---
2
+ category: Configuration
3
+ description: Remove a user alias
4
+ ---
5
+
6
+ # /unalias
7
+
8
+ ## Syntax
9
+
10
+ /unalias <name>
11
+
12
+ ## Description
13
+
14
+ Remove a user-defined alias. Equivalent to `/alias -name`.
15
+
16
+ ## Examples
17
+
18
+ /unalias ns
19
+
20
+ ## See Also
21
+
22
+ /alias
@@ -0,0 +1,25 @@
1
+ ---
2
+ category: Moderation
3
+ description: Remove a ban
4
+ ---
5
+
6
+ # /unban
7
+
8
+ ## Syntax
9
+
10
+ /unban <nick|mask>
11
+
12
+ ## Description
13
+
14
+ Remove a ban from the current channel. If a plain nick is given, it's
15
+ converted to `nick!*@*`. If the argument contains `!` or `@`, it's used
16
+ as a literal hostmask.
17
+
18
+ ## Examples
19
+
20
+ /unban friend
21
+ /unban *!*@good.host.com
22
+
23
+ ## See Also
24
+
25
+ /ban, /kick, /kb, /mode
@@ -0,0 +1,25 @@
1
+ ---
2
+ category: Moderation
3
+ description: Remove an ignore rule
4
+ ---
5
+
6
+ # /unignore
7
+
8
+ ## Syntax
9
+
10
+ /unignore <number|mask>
11
+
12
+ ## Description
13
+
14
+ Remove an ignore rule by its number (from `/ignore` list) or
15
+ by the exact mask pattern.
16
+
17
+ ## Examples
18
+
19
+ /unignore 1
20
+ /unignore troll
21
+ /unignore *!*@bad.host.com
22
+
23
+ ## See Also
24
+
25
+ /ignore
@@ -0,0 +1,25 @@
1
+ ---
2
+ category: Moderation
3
+ description: Give voice status
4
+ ---
5
+
6
+ # /voice
7
+
8
+ ## Syntax
9
+
10
+ /voice <nick> [nick2 ...]
11
+
12
+ ## Description
13
+
14
+ Give voice status (+v) to one or more users in the current channel.
15
+ Voiced users can speak in moderated (+m) channels. You must be a
16
+ channel operator to use this command.
17
+
18
+ ## Examples
19
+
20
+ /voice user1
21
+ /voice user1 user2
22
+
23
+ ## See Also
24
+
25
+ /devoice, /op, /mode
@@ -0,0 +1,24 @@
1
+ ---
2
+ category: Info
3
+ description: Look up user information
4
+ ---
5
+
6
+ # /whois
7
+
8
+ ## Syntax
9
+
10
+ /whois <nick>
11
+
12
+ ## Description
13
+
14
+ Look up information about a user including their hostname, real name,
15
+ channels, server, and account status.
16
+
17
+ ## Examples
18
+
19
+ /whois friend
20
+ /whois ChanServ
21
+
22
+ ## See Also
23
+
24
+ /wii, /nick