oh-my-codex 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.
- package/README.md +269 -0
- package/bin/omx.js +25 -0
- package/dist/agents/definitions.d.ts +22 -0
- package/dist/agents/definitions.d.ts.map +1 -0
- package/dist/agents/definitions.js +235 -0
- package/dist/agents/definitions.js.map +1 -0
- package/dist/cli/doctor.d.ts +11 -0
- package/dist/cli/doctor.d.ts.map +1 -0
- package/dist/cli/doctor.js +157 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/index.d.ts +6 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +266 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/setup.d.ts +12 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli/setup.js +175 -0
- package/dist/cli/setup.js.map +1 -0
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.d.ts.map +1 -0
- package/dist/cli/version.js +17 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/config/generator.d.ts +14 -0
- package/dist/config/generator.d.ts.map +1 -0
- package/dist/config/generator.js +106 -0
- package/dist/config/generator.js.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts +8 -0
- package/dist/hooks/__tests__/agents-overlay.test.d.ts.map +1 -0
- package/dist/hooks/__tests__/agents-overlay.test.js +148 -0
- package/dist/hooks/__tests__/agents-overlay.test.js.map +1 -0
- package/dist/hooks/agents-overlay.d.ts +34 -0
- package/dist/hooks/agents-overlay.d.ts.map +1 -0
- package/dist/hooks/agents-overlay.js +265 -0
- package/dist/hooks/agents-overlay.js.map +1 -0
- package/dist/hooks/emulator.d.ts +44 -0
- package/dist/hooks/emulator.d.ts.map +1 -0
- package/dist/hooks/emulator.js +108 -0
- package/dist/hooks/emulator.js.map +1 -0
- package/dist/hooks/keyword-detector.d.ts +27 -0
- package/dist/hooks/keyword-detector.d.ts.map +1 -0
- package/dist/hooks/keyword-detector.js +63 -0
- package/dist/hooks/keyword-detector.js.map +1 -0
- package/dist/hooks/session.d.ts +38 -0
- package/dist/hooks/session.d.ts.map +1 -0
- package/dist/hooks/session.js +135 -0
- package/dist/hooks/session.js.map +1 -0
- package/dist/hud/colors.d.ts +26 -0
- package/dist/hud/colors.d.ts.map +1 -0
- package/dist/hud/colors.js +71 -0
- package/dist/hud/colors.js.map +1 -0
- package/dist/hud/index.d.ts +12 -0
- package/dist/hud/index.d.ts.map +1 -0
- package/dist/hud/index.js +107 -0
- package/dist/hud/index.js.map +1 -0
- package/dist/hud/render.d.ts +9 -0
- package/dist/hud/render.d.ts.map +1 -0
- package/dist/hud/render.js +192 -0
- package/dist/hud/render.js.map +1 -0
- package/dist/hud/state.d.ts +21 -0
- package/dist/hud/state.d.ts.map +1 -0
- package/dist/hud/state.js +101 -0
- package/dist/hud/state.js.map +1 -0
- package/dist/hud/types.d.ts +87 -0
- package/dist/hud/types.d.ts.map +1 -0
- package/dist/hud/types.js +8 -0
- package/dist/hud/types.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/code-intel-server.d.ts +7 -0
- package/dist/mcp/code-intel-server.d.ts.map +1 -0
- package/dist/mcp/code-intel-server.js +567 -0
- package/dist/mcp/code-intel-server.js.map +1 -0
- package/dist/mcp/memory-server.d.ts +7 -0
- package/dist/mcp/memory-server.d.ts.map +1 -0
- package/dist/mcp/memory-server.js +359 -0
- package/dist/mcp/memory-server.js.map +1 -0
- package/dist/mcp/state-server.d.ts +7 -0
- package/dist/mcp/state-server.d.ts.map +1 -0
- package/dist/mcp/state-server.js +181 -0
- package/dist/mcp/state-server.js.map +1 -0
- package/dist/mcp/trace-server.d.ts +7 -0
- package/dist/mcp/trace-server.d.ts.map +1 -0
- package/dist/mcp/trace-server.js +205 -0
- package/dist/mcp/trace-server.js.map +1 -0
- package/dist/modes/base.d.ts +50 -0
- package/dist/modes/base.d.ts.map +1 -0
- package/dist/modes/base.js +140 -0
- package/dist/modes/base.js.map +1 -0
- package/dist/notifications/notifier.d.ts +30 -0
- package/dist/notifications/notifier.d.ts.map +1 -0
- package/dist/notifications/notifier.js +124 -0
- package/dist/notifications/notifier.js.map +1 -0
- package/dist/team/orchestrator.d.ts +54 -0
- package/dist/team/orchestrator.d.ts.map +1 -0
- package/dist/team/orchestrator.js +106 -0
- package/dist/team/orchestrator.js.map +1 -0
- package/dist/utils/package.d.ts +9 -0
- package/dist/utils/package.d.ts.map +1 -0
- package/dist/utils/package.js +31 -0
- package/dist/utils/package.js.map +1 -0
- package/dist/utils/paths.d.ts +27 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +60 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/verification/verifier.d.ts +32 -0
- package/dist/verification/verifier.d.ts.map +1 -0
- package/dist/verification/verifier.js +81 -0
- package/dist/verification/verifier.js.map +1 -0
- package/package.json +54 -0
- package/prompts/analyst.md +110 -0
- package/prompts/api-reviewer.md +98 -0
- package/prompts/architect.md +109 -0
- package/prompts/build-fixer.md +89 -0
- package/prompts/code-reviewer.md +105 -0
- package/prompts/critic.md +87 -0
- package/prompts/debugger.md +93 -0
- package/prompts/deep-executor.md +112 -0
- package/prompts/dependency-expert.md +99 -0
- package/prompts/designer.md +103 -0
- package/prompts/executor.md +99 -0
- package/prompts/explore.md +112 -0
- package/prompts/git-master.md +92 -0
- package/prompts/information-architect.md +267 -0
- package/prompts/performance-reviewer.md +94 -0
- package/prompts/planner.md +116 -0
- package/prompts/product-analyst.md +299 -0
- package/prompts/product-manager.md +255 -0
- package/prompts/qa-tester.md +98 -0
- package/prompts/quality-reviewer.md +105 -0
- package/prompts/quality-strategist.md +227 -0
- package/prompts/researcher.md +96 -0
- package/prompts/scientist.md +92 -0
- package/prompts/security-reviewer.md +125 -0
- package/prompts/style-reviewer.md +87 -0
- package/prompts/test-engineer.md +103 -0
- package/prompts/ux-researcher.md +282 -0
- package/prompts/verifier.md +95 -0
- package/prompts/vision.md +75 -0
- package/prompts/writer.md +86 -0
- package/scripts/notify-hook.js +237 -0
- package/skills/analyze/SKILL.md +93 -0
- package/skills/autopilot/SKILL.md +175 -0
- package/skills/build-fix/SKILL.md +123 -0
- package/skills/cancel/SKILL.md +387 -0
- package/skills/code-review/SKILL.md +208 -0
- package/skills/configure-discord/SKILL.md +256 -0
- package/skills/configure-telegram/SKILL.md +232 -0
- package/skills/deepinit/SKILL.md +320 -0
- package/skills/deepsearch/SKILL.md +38 -0
- package/skills/doctor/SKILL.md +193 -0
- package/skills/ecomode/SKILL.md +114 -0
- package/skills/frontend-ui-ux/SKILL.md +34 -0
- package/skills/git-master/SKILL.md +29 -0
- package/skills/help/SKILL.md +192 -0
- package/skills/hud/SKILL.md +97 -0
- package/skills/learn-about-omx/SKILL.md +37 -0
- package/skills/learner/SKILL.md +135 -0
- package/skills/note/SKILL.md +62 -0
- package/skills/omx-setup/SKILL.md +1147 -0
- package/skills/pipeline/SKILL.md +407 -0
- package/skills/plan/SKILL.md +223 -0
- package/skills/project-session-manager/SKILL.md +560 -0
- package/skills/psm/SKILL.md +20 -0
- package/skills/ralph/SKILL.md +197 -0
- package/skills/ralph-init/SKILL.md +38 -0
- package/skills/ralplan/SKILL.md +34 -0
- package/skills/release/SKILL.md +83 -0
- package/skills/research/SKILL.md +510 -0
- package/skills/review/SKILL.md +30 -0
- package/skills/security-review/SKILL.md +284 -0
- package/skills/skill/SKILL.md +837 -0
- package/skills/swarm/SKILL.md +25 -0
- package/skills/tdd/SKILL.md +106 -0
- package/skills/team/SKILL.md +860 -0
- package/skills/trace/SKILL.md +33 -0
- package/skills/ultrapilot/SKILL.md +632 -0
- package/skills/ultraqa/SKILL.md +130 -0
- package/skills/ultrawork/SKILL.md +143 -0
- package/skills/writer-memory/SKILL.md +443 -0
- package/templates/AGENTS.md +326 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-review
|
|
3
|
+
description: Run a comprehensive code review
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Skill
|
|
7
|
+
|
|
8
|
+
Conduct a thorough code review for quality, security, and maintainability with severity-rated feedback.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
This skill activates when:
|
|
13
|
+
- User requests "review this code", "code review"
|
|
14
|
+
- Before merging a pull request
|
|
15
|
+
- After implementing a major feature
|
|
16
|
+
- User wants quality assessment
|
|
17
|
+
|
|
18
|
+
## What It Does
|
|
19
|
+
|
|
20
|
+
Delegates to the `code-reviewer` agent (Opus model) for deep analysis:
|
|
21
|
+
|
|
22
|
+
1. **Identify Changes**
|
|
23
|
+
- Run `git diff` to find changed files
|
|
24
|
+
- Determine scope of review (specific files or entire PR)
|
|
25
|
+
|
|
26
|
+
2. **Review Categories**
|
|
27
|
+
- **Security** - Hardcoded secrets, injection risks, XSS, CSRF
|
|
28
|
+
- **Code Quality** - Function size, complexity, nesting depth
|
|
29
|
+
- **Performance** - Algorithm efficiency, N+1 queries, caching
|
|
30
|
+
- **Best Practices** - Naming, documentation, error handling
|
|
31
|
+
- **Maintainability** - Duplication, coupling, testability
|
|
32
|
+
|
|
33
|
+
3. **Severity Rating**
|
|
34
|
+
- **CRITICAL** - Security vulnerability (must fix before merge)
|
|
35
|
+
- **HIGH** - Bug or major code smell (should fix before merge)
|
|
36
|
+
- **MEDIUM** - Minor issue (fix when possible)
|
|
37
|
+
- **LOW** - Style/suggestion (consider fixing)
|
|
38
|
+
|
|
39
|
+
4. **Specific Recommendations**
|
|
40
|
+
- File:line locations for each issue
|
|
41
|
+
- Concrete fix suggestions
|
|
42
|
+
- Code examples where applicable
|
|
43
|
+
|
|
44
|
+
## Agent Delegation
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
spawn_sub_agent(
|
|
48
|
+
subagent_type="oh-my-codex:code-reviewer",
|
|
49
|
+
model="opus",
|
|
50
|
+
prompt="CODE REVIEW TASK
|
|
51
|
+
|
|
52
|
+
Review code changes for quality, security, and maintainability.
|
|
53
|
+
|
|
54
|
+
Scope: [git diff or specific files]
|
|
55
|
+
|
|
56
|
+
Review Checklist:
|
|
57
|
+
- Security vulnerabilities (OWASP Top 10)
|
|
58
|
+
- Code quality (complexity, duplication)
|
|
59
|
+
- Performance issues (N+1, inefficient algorithms)
|
|
60
|
+
- Best practices (naming, documentation, error handling)
|
|
61
|
+
- Maintainability (coupling, testability)
|
|
62
|
+
|
|
63
|
+
Output: Code review report with:
|
|
64
|
+
- Files reviewed count
|
|
65
|
+
- Issues by severity (CRITICAL, HIGH, MEDIUM, LOW)
|
|
66
|
+
- Specific file:line locations
|
|
67
|
+
- Fix recommendations
|
|
68
|
+
- Approval recommendation (APPROVE / REQUEST CHANGES / COMMENT)"
|
|
69
|
+
)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## External Model Consultation (Preferred)
|
|
73
|
+
|
|
74
|
+
The code-reviewer agent SHOULD consult Codex for cross-validation.
|
|
75
|
+
|
|
76
|
+
### Protocol
|
|
77
|
+
1. **Form your OWN review FIRST** - Complete the review independently
|
|
78
|
+
2. **Consult for validation** - Cross-check findings with Codex
|
|
79
|
+
3. **Critically evaluate** - Never blindly adopt external findings
|
|
80
|
+
4. **Graceful fallback** - Never block if tools unavailable
|
|
81
|
+
|
|
82
|
+
### When to Consult
|
|
83
|
+
- Security-sensitive code changes
|
|
84
|
+
- Complex architectural patterns
|
|
85
|
+
- Unfamiliar codebases or languages
|
|
86
|
+
- High-stakes production code
|
|
87
|
+
|
|
88
|
+
### When to Skip
|
|
89
|
+
- Simple refactoring
|
|
90
|
+
- Well-understood patterns
|
|
91
|
+
- Time-critical reviews
|
|
92
|
+
- Small, isolated changes
|
|
93
|
+
|
|
94
|
+
### Tool Usage
|
|
95
|
+
Before first MCP tool use, call `ToolSearch("mcp")` to discover deferred MCP tools.
|
|
96
|
+
Use `mcp__x__ask_codex` with `agent_role: "code-reviewer"`.
|
|
97
|
+
If ToolSearch finds no MCP tools, fall back to the `code-reviewer` Claude agent.
|
|
98
|
+
|
|
99
|
+
**Note:** Codex calls can take up to 1 hour. Consider the review timeline before consulting.
|
|
100
|
+
|
|
101
|
+
## Output Format
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
CODE REVIEW REPORT
|
|
105
|
+
==================
|
|
106
|
+
|
|
107
|
+
Files Reviewed: 8
|
|
108
|
+
Total Issues: 15
|
|
109
|
+
|
|
110
|
+
CRITICAL (0)
|
|
111
|
+
-----------
|
|
112
|
+
(none)
|
|
113
|
+
|
|
114
|
+
HIGH (3)
|
|
115
|
+
--------
|
|
116
|
+
1. src/api/auth.ts:42
|
|
117
|
+
Issue: User input not sanitized before SQL query
|
|
118
|
+
Risk: SQL injection vulnerability
|
|
119
|
+
Fix: Use parameterized queries or ORM
|
|
120
|
+
|
|
121
|
+
2. src/components/UserProfile.tsx:89
|
|
122
|
+
Issue: Password displayed in plain text in logs
|
|
123
|
+
Risk: Credential exposure
|
|
124
|
+
Fix: Remove password from log statements
|
|
125
|
+
|
|
126
|
+
3. src/utils/validation.ts:15
|
|
127
|
+
Issue: Email regex allows invalid formats
|
|
128
|
+
Risk: Accepts malformed emails
|
|
129
|
+
Fix: Use proven email validation library
|
|
130
|
+
|
|
131
|
+
MEDIUM (7)
|
|
132
|
+
----------
|
|
133
|
+
...
|
|
134
|
+
|
|
135
|
+
LOW (5)
|
|
136
|
+
-------
|
|
137
|
+
...
|
|
138
|
+
|
|
139
|
+
RECOMMENDATION: REQUEST CHANGES
|
|
140
|
+
|
|
141
|
+
Critical security issues must be addressed before merge.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Review Checklist
|
|
145
|
+
|
|
146
|
+
The code-reviewer agent checks:
|
|
147
|
+
|
|
148
|
+
### Security
|
|
149
|
+
- [ ] No hardcoded secrets (API keys, passwords, tokens)
|
|
150
|
+
- [ ] All user inputs sanitized
|
|
151
|
+
- [ ] SQL/NoSQL injection prevention
|
|
152
|
+
- [ ] XSS prevention (escaped outputs)
|
|
153
|
+
- [ ] CSRF protection on state-changing operations
|
|
154
|
+
- [ ] Authentication/authorization properly enforced
|
|
155
|
+
|
|
156
|
+
### Code Quality
|
|
157
|
+
- [ ] Functions < 50 lines (guideline)
|
|
158
|
+
- [ ] Cyclomatic complexity < 10
|
|
159
|
+
- [ ] No deeply nested code (> 4 levels)
|
|
160
|
+
- [ ] No duplicate logic (DRY principle)
|
|
161
|
+
- [ ] Clear, descriptive naming
|
|
162
|
+
|
|
163
|
+
### Performance
|
|
164
|
+
- [ ] No N+1 query patterns
|
|
165
|
+
- [ ] Appropriate caching where applicable
|
|
166
|
+
- [ ] Efficient algorithms (avoid O(n²) when O(n) possible)
|
|
167
|
+
- [ ] No unnecessary re-renders (React/Vue)
|
|
168
|
+
|
|
169
|
+
### Best Practices
|
|
170
|
+
- [ ] Error handling present and appropriate
|
|
171
|
+
- [ ] Logging at appropriate levels
|
|
172
|
+
- [ ] Documentation for public APIs
|
|
173
|
+
- [ ] Tests for critical paths
|
|
174
|
+
- [ ] No commented-out code
|
|
175
|
+
|
|
176
|
+
## Approval Criteria
|
|
177
|
+
|
|
178
|
+
**APPROVE** - No CRITICAL or HIGH issues, minor improvements only
|
|
179
|
+
**REQUEST CHANGES** - CRITICAL or HIGH issues present
|
|
180
|
+
**COMMENT** - Only LOW/MEDIUM issues, no blocking concerns
|
|
181
|
+
|
|
182
|
+
## Use with Other Skills
|
|
183
|
+
|
|
184
|
+
**With Pipeline:**
|
|
185
|
+
```
|
|
186
|
+
/pipeline review "implement user authentication"
|
|
187
|
+
```
|
|
188
|
+
Includes code review as part of implementation workflow.
|
|
189
|
+
|
|
190
|
+
**With Ralph:**
|
|
191
|
+
```
|
|
192
|
+
/ralph code-review then fix all issues
|
|
193
|
+
```
|
|
194
|
+
Review code, get feedback, fix until approved.
|
|
195
|
+
|
|
196
|
+
**With Ultrawork:**
|
|
197
|
+
```
|
|
198
|
+
/ultrawork review all files in src/
|
|
199
|
+
```
|
|
200
|
+
Parallel code review across multiple files.
|
|
201
|
+
|
|
202
|
+
## Best Practices
|
|
203
|
+
|
|
204
|
+
- **Review early** - Catch issues before they compound
|
|
205
|
+
- **Review often** - Small, frequent reviews better than huge ones
|
|
206
|
+
- **Address CRITICAL/HIGH first** - Fix security and bugs immediately
|
|
207
|
+
- **Consider context** - Some "issues" may be intentional trade-offs
|
|
208
|
+
- **Learn from reviews** - Use feedback to improve coding practices
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configure-discord
|
|
3
|
+
description: Configure Discord webhook/bot notifications via natural language
|
|
4
|
+
triggers:
|
|
5
|
+
- "configure discord"
|
|
6
|
+
- "setup discord"
|
|
7
|
+
- "discord notifications"
|
|
8
|
+
- "discord webhook"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Configure Discord Notifications
|
|
12
|
+
|
|
13
|
+
Set up Discord notifications so OMX can ping you when sessions end, need input, or complete background tasks.
|
|
14
|
+
|
|
15
|
+
## How This Skill Works
|
|
16
|
+
|
|
17
|
+
This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to `~/.claude/.omx-config.json`.
|
|
18
|
+
|
|
19
|
+
## Step 1: Detect Existing Configuration
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
CONFIG_FILE="$HOME/.claude/.omx-config.json"
|
|
23
|
+
|
|
24
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
25
|
+
# Check for existing discord config
|
|
26
|
+
HAS_DISCORD=$(jq -r '.notifications.discord.enabled // false' "$CONFIG_FILE" 2>/dev/null)
|
|
27
|
+
HAS_DISCORD_BOT=$(jq -r '.notifications["discord-bot"].enabled // false' "$CONFIG_FILE" 2>/dev/null)
|
|
28
|
+
WEBHOOK_URL=$(jq -r '.notifications.discord.webhookUrl // empty' "$CONFIG_FILE" 2>/dev/null)
|
|
29
|
+
MENTION=$(jq -r '.notifications.discord.mention // empty' "$CONFIG_FILE" 2>/dev/null)
|
|
30
|
+
|
|
31
|
+
if [ "$HAS_DISCORD" = "true" ] || [ "$HAS_DISCORD_BOT" = "true" ]; then
|
|
32
|
+
echo "EXISTING_CONFIG=true"
|
|
33
|
+
echo "WEBHOOK_CONFIGURED=$HAS_DISCORD"
|
|
34
|
+
echo "BOT_CONFIGURED=$HAS_DISCORD_BOT"
|
|
35
|
+
[ -n "$WEBHOOK_URL" ] && echo "WEBHOOK_URL=$WEBHOOK_URL"
|
|
36
|
+
[ -n "$MENTION" ] && echo "MENTION=$MENTION"
|
|
37
|
+
else
|
|
38
|
+
echo "EXISTING_CONFIG=false"
|
|
39
|
+
fi
|
|
40
|
+
else
|
|
41
|
+
echo "NO_CONFIG_FILE"
|
|
42
|
+
fi
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
|
|
46
|
+
|
|
47
|
+
## Step 2: Choose Discord Method
|
|
48
|
+
|
|
49
|
+
Use AskUserQuestion:
|
|
50
|
+
|
|
51
|
+
**Question:** "How would you like to send Discord notifications?"
|
|
52
|
+
|
|
53
|
+
**Options:**
|
|
54
|
+
1. **Webhook (Recommended)** - Create a webhook in your Discord channel. Simple, no bot needed. Just paste the URL.
|
|
55
|
+
2. **Bot API** - Use a Discord bot token + channel ID. More flexible, requires a bot application.
|
|
56
|
+
|
|
57
|
+
## Step 3A: Webhook Setup
|
|
58
|
+
|
|
59
|
+
If user chose Webhook:
|
|
60
|
+
|
|
61
|
+
Use AskUserQuestion:
|
|
62
|
+
|
|
63
|
+
**Question:** "Paste your Discord webhook URL. To create one: Server Settings > Integrations > Webhooks > New Webhook > Copy URL"
|
|
64
|
+
|
|
65
|
+
The user will type their webhook URL in the "Other" field.
|
|
66
|
+
|
|
67
|
+
**Validate** the URL:
|
|
68
|
+
- Must start with `https://discord.com/api/webhooks/` or `https://discordapp.com/api/webhooks/`
|
|
69
|
+
- If invalid, explain the format and ask again
|
|
70
|
+
|
|
71
|
+
## Step 3B: Bot API Setup
|
|
72
|
+
|
|
73
|
+
If user chose Bot API:
|
|
74
|
+
|
|
75
|
+
Ask two questions:
|
|
76
|
+
|
|
77
|
+
1. **"Paste your Discord bot token"** - From discord.com/developers > Your App > Bot > Token
|
|
78
|
+
2. **"Paste the channel ID"** - Right-click channel > Copy Channel ID (requires Developer Mode)
|
|
79
|
+
|
|
80
|
+
## Step 4: Configure Mention (User Ping)
|
|
81
|
+
|
|
82
|
+
Use AskUserQuestion:
|
|
83
|
+
|
|
84
|
+
**Question:** "Would you like notifications to mention (ping) someone?"
|
|
85
|
+
|
|
86
|
+
**Options:**
|
|
87
|
+
1. **Yes, mention a user** - Tag a specific user by their Discord user ID
|
|
88
|
+
2. **Yes, mention a role** - Tag a role by its role ID
|
|
89
|
+
3. **No mentions** - Just post the message without pinging anyone
|
|
90
|
+
|
|
91
|
+
### If user wants to mention a user:
|
|
92
|
+
|
|
93
|
+
Ask: "What is the Discord user ID to mention? (Right-click user > Copy User ID, requires Developer Mode)"
|
|
94
|
+
|
|
95
|
+
The mention format is: `<@USER_ID>` (e.g., `<@1465264645320474637>`)
|
|
96
|
+
|
|
97
|
+
### If user wants to mention a role:
|
|
98
|
+
|
|
99
|
+
Ask: "What is the Discord role ID to mention? (Server Settings > Roles > right-click role > Copy Role ID)"
|
|
100
|
+
|
|
101
|
+
The mention format is: `<@&ROLE_ID>` (e.g., `<@&123456789>`)
|
|
102
|
+
|
|
103
|
+
## Step 5: Configure Events
|
|
104
|
+
|
|
105
|
+
Use AskUserQuestion with multiSelect:
|
|
106
|
+
|
|
107
|
+
**Question:** "Which events should trigger Discord notifications?"
|
|
108
|
+
|
|
109
|
+
**Options (multiSelect: true):**
|
|
110
|
+
1. **Session end (Recommended)** - When a Claude session finishes
|
|
111
|
+
2. **Input needed** - When Claude is waiting for your response (great for long-running tasks)
|
|
112
|
+
3. **Session start** - When a new session begins
|
|
113
|
+
4. **Session continuing** - When a persistent mode keeps the session alive
|
|
114
|
+
|
|
115
|
+
Default selection: session-end + ask-user-question.
|
|
116
|
+
|
|
117
|
+
## Step 6: Optional Username Override
|
|
118
|
+
|
|
119
|
+
Use AskUserQuestion:
|
|
120
|
+
|
|
121
|
+
**Question:** "Custom bot display name? (Shows as the webhook sender name in Discord)"
|
|
122
|
+
|
|
123
|
+
**Options:**
|
|
124
|
+
1. **OMX (default)** - Display as "OMX"
|
|
125
|
+
2. **Codex CLI** - Display as "Codex CLI"
|
|
126
|
+
3. **Custom** - Enter a custom name
|
|
127
|
+
|
|
128
|
+
## Step 7: Write Configuration
|
|
129
|
+
|
|
130
|
+
Read the existing config, merge the new Discord settings, and write back:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
CONFIG_FILE="$HOME/.claude/.omx-config.json"
|
|
134
|
+
mkdir -p "$(dirname "$CONFIG_FILE")"
|
|
135
|
+
|
|
136
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
137
|
+
EXISTING=$(cat "$CONFIG_FILE")
|
|
138
|
+
else
|
|
139
|
+
EXISTING='{}'
|
|
140
|
+
fi
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### For Webhook method:
|
|
144
|
+
|
|
145
|
+
Build the notifications object with the collected values and merge into `.omx-config.json` using jq:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
# WEBHOOK_URL, MENTION, USERNAME are collected from user
|
|
149
|
+
# EVENTS is the list of enabled events
|
|
150
|
+
|
|
151
|
+
echo "$EXISTING" | jq \
|
|
152
|
+
--arg url "$WEBHOOK_URL" \
|
|
153
|
+
--arg mention "$MENTION" \
|
|
154
|
+
--arg username "$USERNAME" \
|
|
155
|
+
'.notifications = (.notifications // {enabled: true}) |
|
|
156
|
+
.notifications.enabled = true |
|
|
157
|
+
.notifications.discord = {
|
|
158
|
+
enabled: true,
|
|
159
|
+
webhookUrl: $url,
|
|
160
|
+
mention: (if $mention == "" then null else $mention end),
|
|
161
|
+
username: (if $username == "" then null else $username end)
|
|
162
|
+
}' > "$CONFIG_FILE"
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### For Bot API method:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
echo "$EXISTING" | jq \
|
|
169
|
+
--arg token "$BOT_TOKEN" \
|
|
170
|
+
--arg channel "$CHANNEL_ID" \
|
|
171
|
+
--arg mention "$MENTION" \
|
|
172
|
+
'.notifications = (.notifications // {enabled: true}) |
|
|
173
|
+
.notifications.enabled = true |
|
|
174
|
+
.notifications["discord-bot"] = {
|
|
175
|
+
enabled: true,
|
|
176
|
+
botToken: $token,
|
|
177
|
+
channelId: $channel,
|
|
178
|
+
mention: (if $mention == "" then null else $mention end)
|
|
179
|
+
}' > "$CONFIG_FILE"
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Add event-specific config if user didn't select all events:
|
|
183
|
+
|
|
184
|
+
For each event NOT selected, disable it:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Example: disable session-start if not selected
|
|
188
|
+
echo "$(cat "$CONFIG_FILE")" | jq \
|
|
189
|
+
'.notifications.events = (.notifications.events // {}) |
|
|
190
|
+
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Step 8: Test the Configuration
|
|
194
|
+
|
|
195
|
+
After writing config, offer to send a test notification:
|
|
196
|
+
|
|
197
|
+
Use AskUserQuestion:
|
|
198
|
+
|
|
199
|
+
**Question:** "Send a test notification to verify the setup?"
|
|
200
|
+
|
|
201
|
+
**Options:**
|
|
202
|
+
1. **Yes, test now (Recommended)** - Send a test message to your Discord channel
|
|
203
|
+
2. **No, I'll test later** - Skip testing
|
|
204
|
+
|
|
205
|
+
### If testing:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# For webhook:
|
|
209
|
+
curl -s -o /dev/null -w "%{http_code}" \
|
|
210
|
+
-H "Content-Type: application/json" \
|
|
211
|
+
-d "{\"content\": \"${MENTION:+$MENTION\\n}OMX test notification - Discord is configured!\"}" \
|
|
212
|
+
"$WEBHOOK_URL"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Report success or failure. If it fails, help the user debug (check URL, permissions, etc.).
|
|
216
|
+
|
|
217
|
+
## Step 9: Confirm
|
|
218
|
+
|
|
219
|
+
Display the final configuration summary:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
Discord Notifications Configured!
|
|
223
|
+
|
|
224
|
+
Method: Webhook / Bot API
|
|
225
|
+
Mention: <@1465264645320474637> (or "none")
|
|
226
|
+
Events: session-end, ask-user-question
|
|
227
|
+
Username: OMX
|
|
228
|
+
|
|
229
|
+
Config saved to: ~/.claude/.omx-config.json
|
|
230
|
+
|
|
231
|
+
You can also set these via environment variables:
|
|
232
|
+
OMX_DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
|
|
233
|
+
OMX_DISCORD_MENTION=<@1465264645320474637>
|
|
234
|
+
|
|
235
|
+
To reconfigure: /configure-discord
|
|
236
|
+
To configure Telegram: /configure-telegram
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
## Environment Variable Alternative
|
|
240
|
+
|
|
241
|
+
Users can skip this wizard entirely by setting env vars in their shell profile:
|
|
242
|
+
|
|
243
|
+
**Webhook method:**
|
|
244
|
+
```bash
|
|
245
|
+
export OMX_DISCORD_WEBHOOK_URL="https://discord.com/api/webhooks/..."
|
|
246
|
+
export OMX_DISCORD_MENTION="<@1465264645320474637>" # optional
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Bot API method:**
|
|
250
|
+
```bash
|
|
251
|
+
export OMX_DISCORD_NOTIFIER_BOT_TOKEN="your-bot-token"
|
|
252
|
+
export OMX_DISCORD_NOTIFIER_CHANNEL="your-channel-id"
|
|
253
|
+
export OMX_DISCORD_MENTION="<@1465264645320474637>" # optional
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
Env vars are auto-detected by the notification system without needing `.omx-config.json`.
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: configure-telegram
|
|
3
|
+
description: Configure Telegram bot notifications via natural language
|
|
4
|
+
triggers:
|
|
5
|
+
- "configure telegram"
|
|
6
|
+
- "setup telegram"
|
|
7
|
+
- "telegram notifications"
|
|
8
|
+
- "telegram bot"
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Configure Telegram Notifications
|
|
12
|
+
|
|
13
|
+
Set up Telegram notifications so OMX can message you when sessions end, need input, or complete background tasks.
|
|
14
|
+
|
|
15
|
+
## How This Skill Works
|
|
16
|
+
|
|
17
|
+
This is an interactive, natural-language configuration skill. Walk the user through setup by asking questions with AskUserQuestion. Write the result to `~/.claude/.omx-config.json`.
|
|
18
|
+
|
|
19
|
+
## Step 1: Detect Existing Configuration
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
CONFIG_FILE="$HOME/.claude/.omx-config.json"
|
|
23
|
+
|
|
24
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
25
|
+
HAS_TELEGRAM=$(jq -r '.notifications.telegram.enabled // false' "$CONFIG_FILE" 2>/dev/null)
|
|
26
|
+
CHAT_ID=$(jq -r '.notifications.telegram.chatId // empty' "$CONFIG_FILE" 2>/dev/null)
|
|
27
|
+
PARSE_MODE=$(jq -r '.notifications.telegram.parseMode // "Markdown"' "$CONFIG_FILE" 2>/dev/null)
|
|
28
|
+
|
|
29
|
+
if [ "$HAS_TELEGRAM" = "true" ]; then
|
|
30
|
+
echo "EXISTING_CONFIG=true"
|
|
31
|
+
echo "CHAT_ID=$CHAT_ID"
|
|
32
|
+
echo "PARSE_MODE=$PARSE_MODE"
|
|
33
|
+
else
|
|
34
|
+
echo "EXISTING_CONFIG=false"
|
|
35
|
+
fi
|
|
36
|
+
else
|
|
37
|
+
echo "NO_CONFIG_FILE"
|
|
38
|
+
fi
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
If existing config is found, show the user what's currently configured and ask if they want to update or reconfigure.
|
|
42
|
+
|
|
43
|
+
## Step 2: Create a Telegram Bot
|
|
44
|
+
|
|
45
|
+
Guide the user through creating a bot if they don't have one:
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
To set up Telegram notifications, you need a Telegram bot token and your chat ID.
|
|
49
|
+
|
|
50
|
+
CREATE A BOT (if you don't have one):
|
|
51
|
+
1. Open Telegram and search for @BotFather
|
|
52
|
+
2. Send /newbot
|
|
53
|
+
3. Choose a name (e.g., "My OMX Notifier")
|
|
54
|
+
4. Choose a username (e.g., "my_omc_bot")
|
|
55
|
+
5. BotFather will give you a token like: 123456789:ABCdefGHIjklMNOpqrsTUVwxyz
|
|
56
|
+
|
|
57
|
+
GET YOUR CHAT ID:
|
|
58
|
+
1. Start a chat with your new bot (send /start)
|
|
59
|
+
2. Visit: https://api.telegram.org/bot<YOUR_TOKEN>/getUpdates
|
|
60
|
+
3. Look for "chat":{"id":YOUR_CHAT_ID}
|
|
61
|
+
- Personal chat IDs are positive numbers (e.g., 123456789)
|
|
62
|
+
- Group chat IDs are negative numbers (e.g., -1001234567890)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Step 3: Collect Bot Token
|
|
66
|
+
|
|
67
|
+
Use AskUserQuestion:
|
|
68
|
+
|
|
69
|
+
**Question:** "Paste your Telegram bot token (from @BotFather)"
|
|
70
|
+
|
|
71
|
+
The user will type their token in the "Other" field.
|
|
72
|
+
|
|
73
|
+
**Validate** the token:
|
|
74
|
+
- Must match pattern: `digits:alphanumeric` (e.g., `123456789:ABCdefGHI...`)
|
|
75
|
+
- If invalid, explain the format and ask again
|
|
76
|
+
|
|
77
|
+
## Step 4: Collect Chat ID
|
|
78
|
+
|
|
79
|
+
Use AskUserQuestion:
|
|
80
|
+
|
|
81
|
+
**Question:** "Paste your Telegram chat ID (the number from getUpdates API)"
|
|
82
|
+
|
|
83
|
+
The user will type their chat ID in the "Other" field.
|
|
84
|
+
|
|
85
|
+
**Validate** the chat ID:
|
|
86
|
+
- Must be a number (positive for personal, negative for groups)
|
|
87
|
+
- If invalid, offer to help them find it:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Help user find their chat ID
|
|
91
|
+
BOT_TOKEN="USER_PROVIDED_TOKEN"
|
|
92
|
+
echo "Fetching recent messages to find your chat ID..."
|
|
93
|
+
curl -s "https://api.telegram.org/bot${BOT_TOKEN}/getUpdates" | jq '.result[-1].message.chat.id // .result[-1].message.from.id // "No messages found - send /start to your bot first"'
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Step 5: Choose Parse Mode
|
|
97
|
+
|
|
98
|
+
Use AskUserQuestion:
|
|
99
|
+
|
|
100
|
+
**Question:** "Which message format do you prefer?"
|
|
101
|
+
|
|
102
|
+
**Options:**
|
|
103
|
+
1. **Markdown (Recommended)** - Bold, italic, code blocks with Markdown syntax
|
|
104
|
+
2. **HTML** - Bold, italic, code with HTML tags
|
|
105
|
+
|
|
106
|
+
## Step 6: Configure Events
|
|
107
|
+
|
|
108
|
+
Use AskUserQuestion with multiSelect:
|
|
109
|
+
|
|
110
|
+
**Question:** "Which events should trigger Telegram notifications?"
|
|
111
|
+
|
|
112
|
+
**Options (multiSelect: true):**
|
|
113
|
+
1. **Session end (Recommended)** - When a Claude session finishes
|
|
114
|
+
2. **Input needed** - When Claude is waiting for your response (great for long-running tasks)
|
|
115
|
+
3. **Session start** - When a new session begins
|
|
116
|
+
4. **Session continuing** - When a persistent mode keeps the session alive
|
|
117
|
+
|
|
118
|
+
Default selection: session-end + ask-user-question.
|
|
119
|
+
|
|
120
|
+
## Step 7: Write Configuration
|
|
121
|
+
|
|
122
|
+
Read the existing config, merge the new Telegram settings, and write back:
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
CONFIG_FILE="$HOME/.claude/.omx-config.json"
|
|
126
|
+
mkdir -p "$(dirname "$CONFIG_FILE")"
|
|
127
|
+
|
|
128
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
129
|
+
EXISTING=$(cat "$CONFIG_FILE")
|
|
130
|
+
else
|
|
131
|
+
EXISTING='{}'
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
# BOT_TOKEN, CHAT_ID, PARSE_MODE are collected from user
|
|
135
|
+
echo "$EXISTING" | jq \
|
|
136
|
+
--arg token "$BOT_TOKEN" \
|
|
137
|
+
--arg chatId "$CHAT_ID" \
|
|
138
|
+
--arg parseMode "$PARSE_MODE" \
|
|
139
|
+
'.notifications = (.notifications // {enabled: true}) |
|
|
140
|
+
.notifications.enabled = true |
|
|
141
|
+
.notifications.telegram = {
|
|
142
|
+
enabled: true,
|
|
143
|
+
botToken: $token,
|
|
144
|
+
chatId: $chatId,
|
|
145
|
+
parseMode: $parseMode
|
|
146
|
+
}' > "$CONFIG_FILE"
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Add event-specific config if user didn't select all events:
|
|
150
|
+
|
|
151
|
+
For each event NOT selected, disable it:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Example: disable session-start if not selected
|
|
155
|
+
echo "$(cat "$CONFIG_FILE")" | jq \
|
|
156
|
+
'.notifications.events = (.notifications.events // {}) |
|
|
157
|
+
.notifications.events["session-start"] = {enabled: false}' > "$CONFIG_FILE"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Step 8: Test the Configuration
|
|
161
|
+
|
|
162
|
+
After writing config, offer to send a test notification:
|
|
163
|
+
|
|
164
|
+
Use AskUserQuestion:
|
|
165
|
+
|
|
166
|
+
**Question:** "Send a test notification to verify the setup?"
|
|
167
|
+
|
|
168
|
+
**Options:**
|
|
169
|
+
1. **Yes, test now (Recommended)** - Send a test message to your Telegram chat
|
|
170
|
+
2. **No, I'll test later** - Skip testing
|
|
171
|
+
|
|
172
|
+
### If testing:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
BOT_TOKEN="USER_PROVIDED_TOKEN"
|
|
176
|
+
CHAT_ID="USER_PROVIDED_CHAT_ID"
|
|
177
|
+
PARSE_MODE="Markdown"
|
|
178
|
+
|
|
179
|
+
RESPONSE=$(curl -s -w "\n%{http_code}" \
|
|
180
|
+
"https://api.telegram.org/bot${BOT_TOKEN}/sendMessage" \
|
|
181
|
+
-d "chat_id=${CHAT_ID}" \
|
|
182
|
+
-d "parse_mode=${PARSE_MODE}" \
|
|
183
|
+
-d "text=OMX test notification - Telegram is configured!")
|
|
184
|
+
|
|
185
|
+
HTTP_CODE=$(echo "$RESPONSE" | tail -1)
|
|
186
|
+
BODY=$(echo "$RESPONSE" | head -1)
|
|
187
|
+
|
|
188
|
+
if [ "$HTTP_CODE" = "200" ]; then
|
|
189
|
+
echo "Test notification sent successfully!"
|
|
190
|
+
else
|
|
191
|
+
echo "Failed (HTTP $HTTP_CODE):"
|
|
192
|
+
echo "$BODY" | jq -r '.description // "Unknown error"' 2>/dev/null || echo "$BODY"
|
|
193
|
+
fi
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Report success or failure. Common issues:
|
|
197
|
+
- **401 Unauthorized**: Bot token is invalid
|
|
198
|
+
- **400 Bad Request: chat not found**: Chat ID is wrong, or user hasn't sent `/start` to the bot
|
|
199
|
+
- **Network error**: Check connectivity to api.telegram.org
|
|
200
|
+
|
|
201
|
+
## Step 9: Confirm
|
|
202
|
+
|
|
203
|
+
Display the final configuration summary:
|
|
204
|
+
|
|
205
|
+
```
|
|
206
|
+
Telegram Notifications Configured!
|
|
207
|
+
|
|
208
|
+
Bot: @your_bot_username
|
|
209
|
+
Chat ID: 123456789
|
|
210
|
+
Format: Markdown
|
|
211
|
+
Events: session-end, ask-user-question
|
|
212
|
+
|
|
213
|
+
Config saved to: ~/.claude/.omx-config.json
|
|
214
|
+
|
|
215
|
+
You can also set these via environment variables:
|
|
216
|
+
OMX_TELEGRAM_BOT_TOKEN=123456789:ABCdefGHI...
|
|
217
|
+
OMX_TELEGRAM_CHAT_ID=123456789
|
|
218
|
+
|
|
219
|
+
To reconfigure: /configure-telegram
|
|
220
|
+
To configure Discord: /configure-discord
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Environment Variable Alternative
|
|
224
|
+
|
|
225
|
+
Users can skip this wizard entirely by setting env vars in their shell profile:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
export OMX_TELEGRAM_BOT_TOKEN="123456789:ABCdefGHIjklMNOpqrsTUVwxyz"
|
|
229
|
+
export OMX_TELEGRAM_CHAT_ID="123456789"
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
Env vars are auto-detected by the notification system without needing `.omx-config.json`.
|