pi-discord-bot 0.1.1

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.
@@ -0,0 +1,237 @@
1
+ ---
2
+ name: pi-discord-bot
3
+ description: Use this skill whenever the user wants to install, configure, start, debug, verify, or operate pi-discord-bot. Trigger for npm install, pi package install, source install, Discord bot setup, Discord permissions or intents, systemd setup, env setup, discord-policy.json, workspace setup, or why the bot is not responding. Prefer guiding the user through Pi skill usage instead of making them manually discover the setup flow.
4
+ ---
5
+
6
+ # pi-discord-bot
7
+
8
+ Use this skill to help users install and operate `pi-discord-bot` with very low friction.
9
+
10
+ ## Trigger check
11
+
12
+ This skill should trigger for requests like:
13
+ - "help me install pi-discord-bot"
14
+ - "how do I use pi-discord-bot from Pi?"
15
+ - "install this through npm"
16
+ - "install this from source"
17
+ - "help me configure the Discord bot"
18
+ - "how do I create discord-policy.json?"
19
+ - "help me run this with systemd"
20
+ - "the bot is not responding in Discord"
21
+
22
+ If the user wants to use, install, configure, start, debug, or verify `pi-discord-bot`, use this skill.
23
+
24
+ ## Main goal
25
+
26
+ Help the user in the simplest possible way:
27
+ - install the skill into Pi via npm or from source
28
+ - invoke the skill from Pi with `/skill:pi-discord-bot`
29
+ - let the skill guide the repo setup and operation
30
+ - configure env, policy, and Discord app settings only as needed
31
+ - start the bot locally or with systemd
32
+ - verify it responds in Discord
33
+
34
+ Always use and follow:
35
+ - `README.md`
36
+ - `docs/operator-env-config.md`
37
+ - `docs/using-skill-in-pi.md`
38
+
39
+ Assume many users already use normal Pi CLI / TUI on the same machine. Prefer Pi shared auth/settings flow instead of repo-local provider API keys unless the user explicitly asks for lower-level auth details.
40
+
41
+ ## Principles
42
+
43
+ - Keep guidance practical and low-friction.
44
+ - Prefer Pi package installation and `/skill:pi-discord-bot` over making the user manually memorize setup steps.
45
+ - Keep the workspace outside the repo.
46
+ - Default workspace is `$XDG_STATE_HOME/pi-discord-bot/agent` or `~/.local/state/pi-discord-bot/agent`.
47
+ - Respect `PI_DISCORD_BOT_WORKDIR` when set.
48
+ - Use the included systemd service for stable background operation.
49
+ - Do not hardcode machine-specific absolute paths in code.
50
+
51
+ ## Preferred user flows
52
+
53
+ When the user asks how to use this with Pi, prefer these flows.
54
+
55
+ ### Option A: Install from npm into Pi
56
+
57
+ This is the preferred low-setup path when the package is published.
58
+
59
+ ```bash
60
+ pi install npm:pi-discord-bot
61
+ pi
62
+ ```
63
+
64
+ Then in Pi:
65
+
66
+ ```text
67
+ /skill:pi-discord-bot
68
+ ```
69
+
70
+ or:
71
+
72
+ ```text
73
+ /skill:pi-discord-bot help me set up the bot
74
+ ```
75
+
76
+ ### Option B: Install from source into Pi
77
+
78
+ If the user has the repo checked out locally:
79
+
80
+ ```bash
81
+ pi install /absolute/path/to/pi-discord-bot
82
+ pi
83
+ ```
84
+
85
+ Then in Pi:
86
+
87
+ ```text
88
+ /skill:pi-discord-bot
89
+ ```
90
+
91
+ ### Option C: Run Pi inside the repo
92
+
93
+ If the user is already in the repo, Pi can auto-discover the project skill.
94
+
95
+ ```bash
96
+ cd /path/to/pi-discord-bot
97
+ pi
98
+ ```
99
+
100
+ Then either ask naturally:
101
+
102
+ ```text
103
+ Help me configure this bot.
104
+ ```
105
+
106
+ or force it explicitly:
107
+
108
+ ```text
109
+ /skill:pi-discord-bot
110
+ ```
111
+
112
+ ## How to help the user
113
+
114
+ Prefer this sequence unless the user asks for something narrower.
115
+
116
+ ### 1. Start from skill usage
117
+
118
+ First explain the simplest way to use the skill:
119
+ - `pi install npm:pi-discord-bot`
120
+ - or `pi install /path/to/pi-discord-bot`
121
+ - then `/skill:pi-discord-bot`
122
+
123
+ Do not start by dumping a long manual setup checklist unless the user specifically asks for raw steps.
124
+
125
+ ### 2. Configure env and auth
126
+
127
+ Create or edit:
128
+
129
+ - `~/.config/pi-discord-bot.env`
130
+
131
+ Minimum:
132
+
133
+ ```bash
134
+ DISCORD_TOKEN=...
135
+ ```
136
+
137
+ Optional:
138
+
139
+ ```bash
140
+ DISCORD_GUILD_ID=123456789012345678
141
+ PI_DISCORD_BOT_WORKDIR=/absolute/path/to/pi-discord-bot-agent
142
+ ```
143
+
144
+ If the user already uses Pi CLI / TUI on the same machine, prefer Pi shared auth/settings flow.
145
+
146
+ ### 3. Configure Discord
147
+
148
+ Use `README.md` for the bot app setup details.
149
+ Explain the required intents, scopes, and permissions.
150
+
151
+ ### 4. Configure the workspace policy
152
+
153
+ Create the external workspace and copy the policy example:
154
+
155
+ ```bash
156
+ mkdir -p ~/.local/state/pi-discord-bot/agent
157
+ cp discord-policy.example.json ~/.local/state/pi-discord-bot/agent/discord-policy.json
158
+ ```
159
+
160
+ Or with a custom workspace:
161
+
162
+ ```bash
163
+ mkdir -p "$PI_DISCORD_BOT_WORKDIR"
164
+ cp discord-policy.example.json "$PI_DISCORD_BOT_WORKDIR/discord-policy.json"
165
+ ```
166
+
167
+ Only explain the policy fields this repo uses:
168
+ - `allowDMs`
169
+ - `guildIds`
170
+ - `channelIds`
171
+ - `mentionMode`
172
+ - `slashCommands.guildId`
173
+
174
+ ### 5. Start the bot
175
+
176
+ If the user installed from source:
177
+
178
+ ```bash
179
+ cd /path/to/pi-discord-bot
180
+ npm install
181
+ npx tsx src/main.ts
182
+ ```
183
+
184
+ If the user installed the package to run the bot directly:
185
+
186
+ ```bash
187
+ pi-discord-bot
188
+ ```
189
+
190
+ ### 6. Run with systemd
191
+
192
+ Use:
193
+ - `pi-discord-bot.service`
194
+ - `pi-discord-bot.env.example`
195
+
196
+ Typical source-based flow:
197
+
198
+ ```bash
199
+ cd /path/to/pi-discord-bot
200
+ mkdir -p ~/.config/systemd/user ~/.config
201
+ cp pi-discord-bot.service ~/.config/systemd/user/
202
+ cp pi-discord-bot.env.example ~/.config/pi-discord-bot.env
203
+ $EDITOR ~/.config/pi-discord-bot.env
204
+ systemctl --user daemon-reload
205
+ systemctl --user enable --now pi-discord-bot.service
206
+ ```
207
+
208
+ ### 7. Verify in Discord
209
+
210
+ Help the user verify one of these works:
211
+ - DM the bot
212
+ - mention the bot in an allowed guild channel
213
+ - run `/pi`
214
+
215
+ If verification fails, inspect config and logs before proposing deeper changes.
216
+
217
+ ## Product behavior to explain
218
+
219
+ - One runner per conversation key:
220
+ - `dm:<userId>`
221
+ - `guild:<guildId>:channel:<channelId>`
222
+ - `guild:<guildId>:thread:<threadId>`
223
+ - Main message shows progress and final answer
224
+ - Replies or detail threads contain verbose details
225
+ - Logs are append-only
226
+ - The bot supports Discord slash commands and plain text commands beginning with `/`
227
+ - The bot uses Pi shared auth/settings/model flow rather than a hardcoded model layer
228
+
229
+ ## Good outcomes
230
+
231
+ A successful help session usually ends with the user having:
232
+ - installed the skill with `pi install npm:pi-discord-bot` or `pi install /path/to/pi-discord-bot`
233
+ - used `/skill:pi-discord-bot`
234
+ - created `~/.config/pi-discord-bot.env`
235
+ - created an external workspace and `<workspace>/discord-policy.json`
236
+ - started the bot locally or via systemd
237
+ - verified it responds in Discord