@muggleai/works 2.0.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/README.md +326 -0
- package/bin/muggle.js +2 -0
- package/dist/chunk-O6JAG3WQ.js +6950 -0
- package/dist/cli.js +8 -0
- package/dist/index.js +1 -0
- package/package.json +94 -0
- package/scripts/postinstall.mjs +862 -0
- package/skills-dist/muggle-do.md +589 -0
- package/skills-dist/publish-test-to-cloud.md +43 -0
- package/skills-dist/test-feature-local.md +344 -0
package/README.md
ADDED
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
# @muggleai/works
|
|
2
|
+
|
|
3
|
+
Unified MCP server for Muggle AI - combines Cloud QA and Local Testing tools into a single package.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @muggleai/works
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or install directly from GitHub:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install -g github:multiplex-ai/muggle-ai-works
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This is the canonical one-liner install path.
|
|
18
|
+
|
|
19
|
+
It automatically:
|
|
20
|
+
1. Installs the package
|
|
21
|
+
2. Downloads the Electron app binary (via postinstall)
|
|
22
|
+
3. Registers/updates `~/.cursor/mcp.json` with a `muggle` server entry
|
|
23
|
+
4. Sets up CLI commands
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Validate your install
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
muggle --version
|
|
31
|
+
muggle doctor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### 2. Add to your MCP client (if needed)
|
|
35
|
+
|
|
36
|
+
**Cursor (`~/.cursor/mcp.json`):**
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"mcpServers": {
|
|
41
|
+
"muggle": {
|
|
42
|
+
"command": "muggle",
|
|
43
|
+
"args": ["serve"]
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 2. Start using MCP tools
|
|
50
|
+
|
|
51
|
+
Ask your AI assistant to test your application! Authentication happens automatically when needed.
|
|
52
|
+
|
|
53
|
+
## CLI Commands
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# Server (main command - starts MCP server for AI clients)
|
|
57
|
+
muggle serve # Start server with all tools (default)
|
|
58
|
+
muggle serve --qa # Cloud QA tools only
|
|
59
|
+
muggle serve --local # Local testing tools only
|
|
60
|
+
|
|
61
|
+
# Setup & Diagnostics
|
|
62
|
+
muggle setup # Download/update Electron app
|
|
63
|
+
muggle setup --force # Force re-download
|
|
64
|
+
muggle doctor # Diagnose installation issues
|
|
65
|
+
|
|
66
|
+
# Authentication (optional - auth happens automatically)
|
|
67
|
+
muggle login # Manually trigger login
|
|
68
|
+
muggle logout # Clear credentials
|
|
69
|
+
muggle status # Show auth status
|
|
70
|
+
|
|
71
|
+
# Info
|
|
72
|
+
muggle --version # Show version
|
|
73
|
+
muggle --help # Show help
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Authentication
|
|
77
|
+
|
|
78
|
+
Authentication happens automatically when you first use a tool that requires it:
|
|
79
|
+
|
|
80
|
+
1. A browser window opens with a verification code
|
|
81
|
+
2. You log in with your Muggle AI account
|
|
82
|
+
3. The tool call continues with your credentials
|
|
83
|
+
|
|
84
|
+
Your credentials are stored in `~/.muggle-ai/credentials.json` and persist across sessions.
|
|
85
|
+
|
|
86
|
+
### Handling Expired Tokens
|
|
87
|
+
|
|
88
|
+
Tokens expire after a period of time. When this happens:
|
|
89
|
+
|
|
90
|
+
1. **Check status**: Run `muggle status` or call `muggle-remote-auth-status` to see expiration
|
|
91
|
+
2. **Re-authenticate**: Run `muggle login` or call `muggle-remote-auth-login` to get fresh tokens
|
|
92
|
+
3. **If login fails with "unauthorized_client"**: Check your runtime target configuration (see Troubleshooting)
|
|
93
|
+
|
|
94
|
+
The MCP server will attempt to auto-refresh tokens when possible, but manual re-authentication may be required if the refresh token has also expired.
|
|
95
|
+
|
|
96
|
+
## Muggle Do (`/muggle-do`)
|
|
97
|
+
|
|
98
|
+
An autonomous development pipeline that takes your code changes through requirements analysis, testing, QA, and PR creation — all inside Claude Code.
|
|
99
|
+
|
|
100
|
+
### How it works
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
You write code on a feature branch
|
|
104
|
+
|
|
|
105
|
+
v
|
|
106
|
+
/muggle-do "what I built"
|
|
107
|
+
|
|
|
108
|
+
Stage 1: Requirements → extracts goal + acceptance criteria
|
|
109
|
+
Stage 2: Impact Analysis → detects which repos have git changes
|
|
110
|
+
Stage 3: Validate → checks feature branch, commits exist
|
|
111
|
+
Stage 4: Unit Tests → runs test commands, fails fast
|
|
112
|
+
Stage 5: QA → runs Muggle AI test cases
|
|
113
|
+
Stage 6: Open PRs → pushes branch, creates PR with QA results
|
|
114
|
+
|
|
|
115
|
+
v
|
|
116
|
+
PR ready for review
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Step by step
|
|
120
|
+
|
|
121
|
+
**1. Make your changes on a feature branch:**
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
cd /path/to/your/repo
|
|
125
|
+
git checkout -b feat/add-login
|
|
126
|
+
# ... write your code ...
|
|
127
|
+
git add -A && git commit -m "feat: add login page"
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**2. Configure your repos** — create `muggle-repos.json` in the muggle-ai-works root:
|
|
131
|
+
|
|
132
|
+
```json
|
|
133
|
+
[
|
|
134
|
+
{ "name": "frontend", "path": "/absolute/path/to/frontend", "testCommand": "pnpm test" }
|
|
135
|
+
]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**3. Open Claude Code and run the dev cycle:**
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
/muggle-do "Add a login page with email/password authentication"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Claude will detect your changes, run tests, trigger QA, and open a PR.
|
|
145
|
+
|
|
146
|
+
### What if something fails?
|
|
147
|
+
|
|
148
|
+
| Failure | What happens |
|
|
149
|
+
|---|---|
|
|
150
|
+
| No changes detected | Stops — make changes first, re-run |
|
|
151
|
+
| On main/master | Stops — create a feature branch first |
|
|
152
|
+
| Unit tests fail | Shows output, stops — fix and re-run |
|
|
153
|
+
| QA fails | Shows failing tests — fix and re-run |
|
|
154
|
+
|
|
155
|
+
### Repo config
|
|
156
|
+
|
|
157
|
+
| Field | Required | Default | Description |
|
|
158
|
+
|---|---|---|---|
|
|
159
|
+
| `name` | yes | — | Short identifier for the repo |
|
|
160
|
+
| `path` | yes | — | Absolute path on your machine |
|
|
161
|
+
| `testCommand` | no | `pnpm test` | Command to run unit tests |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Available Tools
|
|
166
|
+
|
|
167
|
+
### Cloud QA Tools (muggle-remote-*)
|
|
168
|
+
|
|
169
|
+
Tools that work with the Muggle AI cloud backend:
|
|
170
|
+
|
|
171
|
+
- `muggle-remote-project-create` - Create QA project
|
|
172
|
+
- `muggle-remote-project-list` - List projects
|
|
173
|
+
- `muggle-remote-use-case-create-from-prompts` - Create use cases
|
|
174
|
+
- `muggle-remote-test-case-generate-from-prompt` - Generate test cases
|
|
175
|
+
- `muggle-remote-workflow-start-*` - Start various workflows
|
|
176
|
+
- And more...
|
|
177
|
+
|
|
178
|
+
### Local QA Tools (muggle-local-*)
|
|
179
|
+
|
|
180
|
+
Tools that work with local testing:
|
|
181
|
+
|
|
182
|
+
- `muggle-local-check-status` - Check local status
|
|
183
|
+
- `muggle-local-list-sessions` - List sessions
|
|
184
|
+
- `muggle-local-execute-test-generation` - Generate test script
|
|
185
|
+
- `muggle-local-execute-replay` - Replay test script
|
|
186
|
+
- `muggle-local-run-result-list` - List run results
|
|
187
|
+
- `muggle-local-publish-test-script` - Publish to cloud
|
|
188
|
+
- And more...
|
|
189
|
+
|
|
190
|
+
## Data Directory
|
|
191
|
+
|
|
192
|
+
All Muggle AI data is stored in `~/.muggle-ai/`:
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
~/.muggle-ai/
|
|
196
|
+
├── credentials.json # Auth credentials (auto-generated)
|
|
197
|
+
├── projects/ # Local test projects
|
|
198
|
+
├── sessions/ # Test execution sessions
|
|
199
|
+
└── electron-app/ # Downloaded Electron app
|
|
200
|
+
└── 1.0.0/
|
|
201
|
+
└── MuggleAI.exe
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
## Requirements
|
|
205
|
+
|
|
206
|
+
- Node.js 22 or higher
|
|
207
|
+
- For local testing: Electron app (downloaded automatically)
|
|
208
|
+
|
|
209
|
+
## Development
|
|
210
|
+
|
|
211
|
+
### Building
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
npm install
|
|
215
|
+
npm run build
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Testing
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
npm test # Run tests once
|
|
222
|
+
npm run test:watch # Watch mode
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Linting
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run lint # Auto-fix issues
|
|
229
|
+
npm run lint:check # Check only
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## CI/CD Workflows
|
|
233
|
+
|
|
234
|
+
| Workflow | Trigger | Description |
|
|
235
|
+
| :------- | :------ | :---------- |
|
|
236
|
+
| `ci.yml` | Push/PR to `master` | Lint, test, build on multiple platforms/versions |
|
|
237
|
+
| `publish-works.yml` | Tag `v*` or manual dispatch | Verify, package-audit, smoke-install, publish to npm |
|
|
238
|
+
|
|
239
|
+
### Publishing a new version
|
|
240
|
+
|
|
241
|
+
1. Update version in `package.json`
|
|
242
|
+
2. Commit and push
|
|
243
|
+
3. Create a git tag: `git tag v1.0.1 && git push --tags`
|
|
244
|
+
4. The `publish-works.yml` workflow publishes to npm automatically
|
|
245
|
+
|
|
246
|
+
## Troubleshooting
|
|
247
|
+
|
|
248
|
+
### Expired Token Errors
|
|
249
|
+
|
|
250
|
+
If you see authentication errors like "Not authenticated" or token expiration messages:
|
|
251
|
+
|
|
252
|
+
1. **Check auth status**:
|
|
253
|
+
```bash
|
|
254
|
+
muggle status
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
2. **Re-authenticate**:
|
|
258
|
+
```bash
|
|
259
|
+
muggle login
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
3. **Clear and retry** (if login keeps failing):
|
|
263
|
+
```bash
|
|
264
|
+
muggle logout
|
|
265
|
+
muggle login
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### "unauthorized_client" Error During Login
|
|
269
|
+
|
|
270
|
+
This error indicates a mismatch between your Auth0 client configuration and the target environment.
|
|
271
|
+
|
|
272
|
+
**Cause**: The MCP is configured for one environment (dev/production) but trying to authenticate against another.
|
|
273
|
+
|
|
274
|
+
**Fix**: Ensure your MCP configuration matches your intended environment by setting the `MUGGLE_MCP_PROMPT_SERVICE_TARGET` environment variable in your MCP config:
|
|
275
|
+
|
|
276
|
+
**For Production** (`~/.cursor/mcp.json`):
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"mcpServers": {
|
|
280
|
+
"muggle": {
|
|
281
|
+
"command": "muggle",
|
|
282
|
+
"args": ["serve"],
|
|
283
|
+
"env": {
|
|
284
|
+
"MUGGLE_MCP_PROMPT_SERVICE_TARGET": "production"
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**For Development** (local services):
|
|
292
|
+
```json
|
|
293
|
+
{
|
|
294
|
+
"mcpServers": {
|
|
295
|
+
"muggle": {
|
|
296
|
+
"command": "muggle",
|
|
297
|
+
"args": ["serve"],
|
|
298
|
+
"env": {
|
|
299
|
+
"MUGGLE_MCP_PROMPT_SERVICE_TARGET": "dev"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
After changing the configuration, restart your MCP client (e.g., restart Cursor).
|
|
307
|
+
|
|
308
|
+
### Credential Files
|
|
309
|
+
|
|
310
|
+
Credentials are stored in `~/.muggle-ai/`:
|
|
311
|
+
|
|
312
|
+
| File | Purpose |
|
|
313
|
+
| :--- | :------ |
|
|
314
|
+
| `auth.json` | OAuth tokens (access token, refresh token, expiry) |
|
|
315
|
+
| `credentials.json` | API key for service calls |
|
|
316
|
+
|
|
317
|
+
If you need to reset authentication completely:
|
|
318
|
+
```bash
|
|
319
|
+
rm ~/.muggle-ai/auth.json
|
|
320
|
+
rm ~/.muggle-ai/credentials.json
|
|
321
|
+
muggle login
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
MIT
|
package/bin/muggle.js
ADDED