apero-kit-cli 2.2.5 → 2.4.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apero-kit-cli",
3
- "version": "2.2.5",
3
+ "version": "2.4.0",
4
4
  "description": "CLI tool to scaffold AI agent projects with pre-configured kits (Claude, OpenCode, Codex)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -35,6 +35,9 @@
35
35
  "agent",
36
36
  "claude",
37
37
  "claude-code",
38
+ "gemini",
39
+ "discord",
40
+ "clawbot",
38
41
  "opencode",
39
42
  "codex",
40
43
  "cli",
@@ -0,0 +1,227 @@
1
+ # Discord + OpenClaw Setup Guide
2
+
3
+ This directory contains configuration for running your AI agent on Discord via [OpenClaw](https://docs.openclaw.ai).
4
+
5
+ ## Features
6
+
7
+ - **Auto Intent Detection** - No need to type `/plan` or `/brainstorm`, bot understands natural language
8
+ - **Skills System** - Commands converted to skills format for better context
9
+ - **Train Prompt** - Add new knowledge via URLs, files, or inline content
10
+ - **Progressive Disclosure** - Skills load on-demand to save tokens
11
+
12
+ ## Quick Start
13
+
14
+ ### 1. Install OpenClaw CLI
15
+
16
+ ```bash
17
+ npm install -g openclaw
18
+ # or
19
+ npx openclaw
20
+ ```
21
+
22
+ ### 2. Create Discord Bot
23
+
24
+ 1. Go to [Discord Developer Portal](https://discord.com/developers/applications)
25
+ 2. Click "New Application" and name your bot
26
+ 3. Go to "Bot" section and click "Add Bot"
27
+ 4. Enable these Intents:
28
+ - **Message Content Intent** (required)
29
+ - **Server Members Intent** (recommended)
30
+ 5. Click "Reset Token" to get your bot token
31
+
32
+ ### 3. Configure Bot Token
33
+
34
+ **Option A: Environment Variable (Recommended)**
35
+ ```bash
36
+ export DISCORD_BOT_TOKEN="your-bot-token-here"
37
+ ```
38
+
39
+ **Option B: Direct Configuration**
40
+ ```bash
41
+ openclaw config set channels.discord.token '"your-bot-token-here"' --json
42
+ ```
43
+
44
+ ### 4. Enable Discord Channel
45
+
46
+ ```bash
47
+ openclaw config set channels.discord.enabled true --json
48
+ ```
49
+
50
+ ### 5. Start Gateway
51
+
52
+ ```bash
53
+ openclaw gateway
54
+ ```
55
+
56
+ ### 6. Invite Bot to Server
57
+
58
+ 1. Go to OAuth2 > URL Generator in Discord Developer Portal
59
+ 2. Select scopes: `bot`, `applications.commands`
60
+ 3. Select permissions:
61
+ - View Channels
62
+ - Send Messages
63
+ - Read Message History
64
+ - Embed Links
65
+ - Attach Files
66
+ - Add Reactions
67
+ 4. Copy the generated URL and open it to invite the bot
68
+
69
+ ### 7. Pairing (First-time Setup)
70
+
71
+ 1. Send a DM to your bot in Discord
72
+ 2. Bot responds with a pairing code
73
+ 3. Approve the pairing:
74
+ ```bash
75
+ openclaw pairing approve discord <CODE>
76
+ ```
77
+
78
+ ## Using Commands
79
+
80
+ Your commands are available in two ways:
81
+
82
+ ### As Slash Commands
83
+ Discord will automatically register your commands as slash commands.
84
+ Type `/` in Discord to see available commands.
85
+
86
+ Example:
87
+ - `/plan create a login feature`
88
+ - `/brainstorm how to optimize database queries`
89
+
90
+ ### As Message Commands
91
+ Mention the bot with a command:
92
+ ```
93
+ @YourBot /plan create a login feature
94
+ ```
95
+
96
+ ## Configuration
97
+
98
+ Edit `config.json5` to customize:
99
+
100
+ - **dmPolicy**: Control who can DM the bot
101
+ - **groupPolicy**: Control which servers can use the bot
102
+ - **guilds**: Configure per-server settings
103
+ - **streaming**: Enable live typing preview
104
+ - **bindings**: Route different users to different agents
105
+
106
+ ## Commands Available
107
+
108
+ Your commands are defined in the `commands/` directory:
109
+
110
+ | Command | Description |
111
+ |---------|-------------|
112
+ | `/plan` | Create implementation plans |
113
+ | `/brainstorm` | Brainstorm solutions |
114
+ | `/fix` | Fix code issues |
115
+ | `/code` | Write code |
116
+ | `/review` | Review code changes |
117
+ | ... | See `commands/` for full list |
118
+
119
+ ## Useful OpenClaw Commands
120
+
121
+ ```bash
122
+ # Check status
123
+ openclaw channels status --probe
124
+
125
+ # View logs
126
+ openclaw logs --follow
127
+
128
+ # List pairings
129
+ openclaw pairing list discord
130
+
131
+ # Restart gateway
132
+ openclaw gateway restart
133
+
134
+ # Health check
135
+ openclaw doctor
136
+ ```
137
+
138
+ ## Skills System
139
+
140
+ Your commands are converted to **OpenClaw Skills** format for better AI understanding.
141
+
142
+ ### Structure
143
+ ```
144
+ .discord/
145
+ ├── skills/
146
+ │ ├── auto-intent-router/ # Auto-detects user intent
147
+ │ │ └── SKILL.md
148
+ │ ├── train-prompt/ # Add new knowledge
149
+ │ │ └── SKILL.md
150
+ │ ├── planning/ # Converted from /plan
151
+ │ │ └── SKILL.md
152
+ │ ├── brainstorm/ # Converted from /brainstorm
153
+ │ │ └── SKILL.md
154
+ │ └── ...
155
+ ├── commands/ # Original commands (backup)
156
+ ├── commands.json5 # Slash commands config
157
+ └── config.json5 # Main config
158
+ ```
159
+
160
+ ### How It Works
161
+
162
+ 1. **Auto Intent Router** detects what user wants from natural language
163
+ 2. **Appropriate skill** is activated automatically
164
+ 3. User gets response without typing commands
165
+
166
+ Example:
167
+ ```
168
+ User: "I need to add payment processing"
169
+ Bot: [Detects PLANNING intent, activates planning skill]
170
+ "I'll help you plan the payment processing feature..."
171
+ ```
172
+
173
+ ## Training New Knowledge
174
+
175
+ Use the **train-prompt** skill to teach the bot new things:
176
+
177
+ ### Train from URL
178
+ ```
179
+ /train https://docs.stripe.com/api
180
+ ```
181
+
182
+ ### Train from File
183
+ ```
184
+ /train:file ./docs/coding-standards.md
185
+ ```
186
+
187
+ ### Train Inline
188
+ ```
189
+ /train:inline
190
+ Our deployment process:
191
+ 1. Run tests
192
+ 2. Build
193
+ 3. Deploy staging
194
+ 4. Deploy production
195
+ ```
196
+
197
+ ### List Trained Knowledge
198
+ ```
199
+ /train:list
200
+ ```
201
+
202
+ ## Troubleshooting
203
+
204
+ **Bot not responding?**
205
+ - Check Message Content Intent is enabled
206
+ - Verify bot token is correct
207
+ - Run `openclaw doctor` for diagnostics
208
+
209
+ **Commands not showing?**
210
+ - Wait a few minutes for Discord to sync
211
+ - Check `commands.native` is set to `"auto"`
212
+
213
+ **Permission errors?**
214
+ - Verify bot has required permissions
215
+ - Check guild configuration in `config.json5`
216
+
217
+ **Skills not loading?**
218
+ - Check `skills/` directory exists
219
+ - Verify SKILL.md files have correct frontmatter
220
+ - Run `openclaw skills list` to see active skills
221
+
222
+ ## Resources
223
+
224
+ - [OpenClaw Documentation](https://docs.openclaw.ai)
225
+ - [Discord Channel Guide](https://docs.openclaw.ai/channels/discord)
226
+ - [Skills Guide](https://docs.openclaw.ai/tools/skills)
227
+ - [Slash Commands](https://docs.openclaw.ai/tools/slash-commands)
@@ -0,0 +1,87 @@
1
+ // Clawbot Discord Configuration
2
+ // Generated by Apero Kit CLI
3
+ // Documentation: https://docs.openclaw.ai/channels/discord
4
+ {
5
+ // Discord Channel Settings
6
+ "channels": {
7
+ "discord": {
8
+ // Bot token - set via environment variable or here
9
+ // Recommended: Use DISCORD_BOT_TOKEN environment variable
10
+ "token": "${DISCORD_BOT_TOKEN}",
11
+
12
+ // Enable Discord channel
13
+ "enabled": true,
14
+
15
+ // Direct Message Policy
16
+ // "pairing" - Require pairing approval (recommended)
17
+ // "allowlist" - Only allow specific users
18
+ // "open" - Allow all DMs
19
+ // "disabled" - Disable DMs
20
+ "dmPolicy": "pairing",
21
+
22
+ // Guild (Server) Policy
23
+ // "open" - Allow all guilds
24
+ // "allowlist" - Only allow specific guilds
25
+ // "disabled" - Disable guild messages
26
+ "groupPolicy": "allowlist",
27
+
28
+ // Message History Limit (for context)
29
+ "historyLimit": 20,
30
+ "dmHistoryLimit": 50,
31
+
32
+ // Reply Mode
33
+ // "off" - No reply threading
34
+ // "first" - Reply to first message only
35
+ // "all" - Reply to all messages
36
+ "replyToMode": "first",
37
+
38
+ // Streaming Mode (live typing preview)
39
+ // "off" - No streaming
40
+ // "partial" - Partial updates
41
+ // "block" - Block updates
42
+ // "progress" - Progress indicator
43
+ "streaming": "partial",
44
+
45
+ // Guild Configurations
46
+ // Add your server(s) here
47
+ "guilds": {
48
+ // Example guild configuration
49
+ // Replace YOUR_SERVER_ID with actual Discord server ID
50
+ // "YOUR_SERVER_ID": {
51
+ // "requireMention": true,
52
+ // "users": ["YOUR_USER_ID"],
53
+ // "roles": ["ALLOWED_ROLE_ID"],
54
+ // "channels": {
55
+ // "general": { "allow": true },
56
+ // "bot-commands": { "allow": true }
57
+ // }
58
+ // }
59
+ },
60
+
61
+ // Bot Presence
62
+ "status": "online",
63
+ "activity": "Ready to assist",
64
+ "activityType": 4 // 0=Playing, 1=Streaming, 2=Listening, 3=Watching, 4=Custom
65
+ }
66
+ },
67
+
68
+ // Commands Configuration
69
+ "commands": {
70
+ // Enable native Discord slash commands
71
+ "native": "auto"
72
+ },
73
+
74
+ // Agent Bindings (optional)
75
+ // Route different users/roles to different agents
76
+ "bindings": [
77
+ // Example: Route users with specific role to opus agent
78
+ // {
79
+ // "agentId": "opus",
80
+ // "match": {
81
+ // "channel": "discord",
82
+ // "guildId": "YOUR_SERVER_ID",
83
+ // "roles": ["PREMIUM_ROLE_ID"]
84
+ // }
85
+ // }
86
+ ]
87
+ }
@@ -0,0 +1,195 @@
1
+ ---
2
+ name: auto-intent-router
3
+ description: Automatically detects user intent and routes to appropriate skill without manual commands
4
+ user-invocable: false
5
+ disable-model-invocation: false
6
+ metadata: {"openclaw": {"always": true, "priority": 1}}
7
+ ---
8
+
9
+ # Auto Intent Router
10
+
11
+ ## Purpose
12
+
13
+ This skill runs on EVERY message to detect user intent and automatically activate the appropriate skill. Users don't need to type commands like `/plan` or `/brainstorm` - the bot understands natural language.
14
+
15
+ ## Priority
16
+
17
+ This skill has highest priority (runs first) to route messages before other processing.
18
+
19
+ ## Intent Detection Matrix
20
+
21
+ | Intent | Keywords/Patterns | Activated Skill |
22
+ |--------|-------------------|-----------------|
23
+ | **PLANNING** | plan, design, architect, implement, create, build feature | `planning`, `plan-fast`, `plan-hard` |
24
+ | **BRAINSTORMING** | brainstorm, ideas, options, alternatives, think about, explore | `brainstorm` |
25
+ | **DEBUGGING** | fix, debug, error, broken, bug, issue, not working, crash | `debugging`, `fix-fast`, `fix-hard` |
26
+ | **CODE REVIEW** | review, check my code, look at this, audit, examine | `code-review` |
27
+ | **CODING** | code, implement, write, develop, create function | `code`, `cook` |
28
+ | **TESTING** | test, unit test, spec, coverage, jest, vitest | `testing` |
29
+ | **DATABASE** | database, schema, migration, query, sql, table | `database` |
30
+ | **API DESIGN** | api, endpoint, rest, graphql, route | `api-design` |
31
+ | **DOCUMENTATION** | document, docs, readme, explain, describe | `documentation` |
32
+ | **DEPLOYMENT** | deploy, release, staging, production, ci/cd | `deployment` |
33
+ | **TRAINING** | train, learn, teach, add knowledge, remember | `train-prompt` |
34
+ | **SCOUTING** | find, search, where is, locate, explore codebase | `scout` |
35
+
36
+ ## Detection Algorithm
37
+
38
+ ```
39
+ 1. EXTRACT keywords from user message
40
+ 2. MATCH against intent patterns
41
+ 3. CALCULATE confidence score for each intent
42
+ 4. IF confidence > 0.7:
43
+ ACTIVATE corresponding skill
44
+ ELSE IF multiple intents detected:
45
+ ASK user for clarification
46
+ ELSE:
47
+ PROCEED with general response
48
+ ```
49
+
50
+ ## Confidence Scoring
51
+
52
+ ```
53
+ score = (keyword_matches * 0.4) + (pattern_matches * 0.3) + (context_relevance * 0.3)
54
+
55
+ - keyword_matches: Number of intent keywords found
56
+ - pattern_matches: Regex patterns matched
57
+ - context_relevance: Based on conversation history
58
+ ```
59
+
60
+ ## Workflow
61
+
62
+ ### Step 1: Parse Message
63
+
64
+ Extract:
65
+ - Primary keywords
66
+ - Question type (how, what, why, can you)
67
+ - Code references (file paths, function names)
68
+ - URLs or links
69
+
70
+ ### Step 2: Intent Classification
71
+
72
+ For each potential intent:
73
+ 1. Count keyword matches
74
+ 2. Check pattern matches
75
+ 3. Consider conversation context
76
+ 4. Calculate confidence score
77
+
78
+ ### Step 3: Route or Clarify
79
+
80
+ **High Confidence (>0.7):**
81
+ ```
82
+ Silently activate the matched skill.
83
+ User sees natural response, not "Activating planning skill..."
84
+ ```
85
+
86
+ **Medium Confidence (0.4-0.7):**
87
+ ```
88
+ "I think you want to [intent]. Should I:
89
+ A) Create a plan for this
90
+ B) Brainstorm alternatives first
91
+ C) Just help directly"
92
+ ```
93
+
94
+ **Low Confidence (<0.4):**
95
+ ```
96
+ Respond naturally without special skill activation.
97
+ ```
98
+
99
+ ## Examples
100
+
101
+ ### Example 1: Planning Intent
102
+ ```
103
+ User: "I need to add user authentication to the app"
104
+
105
+ [Intent Detection]
106
+ Keywords: "add", "authentication", "app"
107
+ Pattern: "I need to" + feature description
108
+ Confidence: PLANNING = 0.85
109
+
110
+ [Action]
111
+ Activate: planning skill
112
+ Response: "I'll help you plan the authentication system..."
113
+ ```
114
+
115
+ ### Example 2: Debugging Intent
116
+ ```
117
+ User: "The login button isn't working anymore"
118
+
119
+ [Intent Detection]
120
+ Keywords: "isn't working"
121
+ Pattern: [component] + "not working"
122
+ Confidence: DEBUGGING = 0.9
123
+
124
+ [Action]
125
+ Activate: debugging skill
126
+ Response: "Let me investigate the login button issue..."
127
+ ```
128
+
129
+ ### Example 3: Ambiguous Intent
130
+ ```
131
+ User: "Can you help with the API?"
132
+
133
+ [Intent Detection]
134
+ Keywords: "API"
135
+ Confidence: API_DESIGN = 0.5, DEBUGGING = 0.4
136
+
137
+ [Action]
138
+ Clarify: "I can help with the API. Do you want to:
139
+ A) Design new endpoints
140
+ B) Fix an existing issue
141
+ C) Review the current implementation"
142
+ ```
143
+
144
+ ### Example 4: Training Intent
145
+ ```
146
+ User: "Learn this documentation: https://docs.stripe.com/api"
147
+
148
+ [Intent Detection]
149
+ Keywords: "learn", URL present
150
+ Confidence: TRAINING = 0.95
151
+
152
+ [Action]
153
+ Activate: train-prompt skill
154
+ Response: "I'll learn from the Stripe API documentation..."
155
+ ```
156
+
157
+ ## Context Awareness
158
+
159
+ The router considers conversation history:
160
+
161
+ - If previous message was about planning → lower threshold for planning-related follow-ups
162
+ - If user just shared code → debugging/review more likely
163
+ - If discussing architecture → planning/design more likely
164
+
165
+ ## Override Behavior
166
+
167
+ Users can still use explicit commands to override:
168
+ - `/plan` - Force planning mode
169
+ - `/brainstorm` - Force brainstorming mode
170
+ - `/fix` - Force debugging mode
171
+
172
+ Explicit commands bypass intent detection.
173
+
174
+ ## Configuration
175
+
176
+ Skills can declare their trigger conditions in their SKILL.md frontmatter:
177
+
178
+ ```yaml
179
+ metadata: {
180
+ "openclaw": {
181
+ "triggers": {
182
+ "keywords": ["plan", "design", "architect"],
183
+ "patterns": ["how should I", "best way to"],
184
+ "confidence_boost": 0.1
185
+ }
186
+ }
187
+ }
188
+ ```
189
+
190
+ ## Performance Notes
191
+
192
+ - Intent detection runs in <50ms
193
+ - Only loads full skill content after routing
194
+ - Caches recent intent classifications
195
+ - Batches multiple skill reads when needed