@muggleai/works 2.0.2 → 3.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 +173 -162
- package/dist/plugin/.claude-plugin/plugin.json +8 -0
- package/dist/plugin/.mcp.json +12 -0
- package/dist/plugin/hooks/hooks.json +14 -0
- package/dist/plugin/scripts/ensure-electron-app.sh +12 -0
- package/dist/plugin/skills/muggle-do/SKILL.md +53 -0
- package/dist/plugin/skills/muggle-do/impact-analysis.md +34 -0
- package/dist/plugin/skills/muggle-do/open-prs.md +52 -0
- package/dist/plugin/skills/muggle-do/qa.md +89 -0
- package/dist/plugin/skills/muggle-do/requirements.md +33 -0
- package/dist/plugin/skills/muggle-do/unit-tests.md +31 -0
- package/dist/plugin/skills/muggle-do/validate-code.md +30 -0
- package/dist/plugin/skills/publish-test-to-cloud/SKILL.md +41 -0
- package/dist/plugin/skills/test-feature-local/SKILL.md +86 -0
- package/package.json +7 -6
- package/plugin/.claude-plugin/plugin.json +8 -0
- package/plugin/.mcp.json +12 -0
- package/plugin/hooks/hooks.json +14 -0
- package/plugin/scripts/ensure-electron-app.sh +12 -0
- package/plugin/skills/muggle-do/SKILL.md +53 -0
- package/plugin/skills/muggle-do/impact-analysis.md +34 -0
- package/plugin/skills/muggle-do/open-prs.md +52 -0
- package/plugin/skills/muggle-do/qa.md +89 -0
- package/plugin/skills/muggle-do/requirements.md +33 -0
- package/plugin/skills/muggle-do/unit-tests.md +31 -0
- package/plugin/skills/muggle-do/validate-code.md +30 -0
- package/plugin/skills/publish-test-to-cloud/SKILL.md +41 -0
- package/plugin/skills/test-feature-local/SKILL.md +86 -0
- package/scripts/postinstall.mjs +2 -2
- package/skills-dist/muggle-do.md +0 -589
- package/skills-dist/publish-test-to-cloud.md +0 -43
- package/skills-dist/test-feature-local.md +0 -344
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# QA Agent
|
|
2
|
+
|
|
3
|
+
You are running QA test cases against code changes using Muggle AI's local testing infrastructure.
|
|
4
|
+
|
|
5
|
+
## Design
|
|
6
|
+
|
|
7
|
+
QA runs **locally** using the `test-feature-local` approach:
|
|
8
|
+
- `muggle-remote-*` tools manage cloud entities (auth, projects, test cases, scripts)
|
|
9
|
+
- `muggle-local-*` tools execute tests against the running local dev server
|
|
10
|
+
|
|
11
|
+
This guarantees QA always runs — no dependency on cloud replay service availability.
|
|
12
|
+
|
|
13
|
+
## Input
|
|
14
|
+
|
|
15
|
+
You receive:
|
|
16
|
+
- The Muggle project ID
|
|
17
|
+
- The list of changed repos, files, and a summary of changes
|
|
18
|
+
- The requirements goal
|
|
19
|
+
- `localUrl` per repo (from `muggle-repos.json`) — the locally running dev server URL
|
|
20
|
+
|
|
21
|
+
## Your Job
|
|
22
|
+
|
|
23
|
+
### Step 0: Resolve Local URL
|
|
24
|
+
|
|
25
|
+
Read `localUrl` for each repo from the context. If it is not provided, ask the user:
|
|
26
|
+
> "QA requires a running local server. What URL is the `<repo>` app running on? (e.g. `http://localhost:3000`)"
|
|
27
|
+
|
|
28
|
+
**Do not skip QA.** Wait for the user to provide the URL before proceeding.
|
|
29
|
+
|
|
30
|
+
### Step 1: Check Authentication
|
|
31
|
+
|
|
32
|
+
Use `muggle-remote-auth-status` to verify valid credentials. If not authenticated, use `muggle-remote-auth-login` to start the device-code login flow and `muggle-remote-auth-poll` to wait for completion.
|
|
33
|
+
|
|
34
|
+
### Step 2: Get Test Cases
|
|
35
|
+
|
|
36
|
+
Use `muggle-remote-test-case-list` with the project ID to fetch all test cases.
|
|
37
|
+
|
|
38
|
+
### Step 3: Filter Relevant Test Cases
|
|
39
|
+
|
|
40
|
+
Based on the changed files and the requirements goal, determine which test cases are relevant:
|
|
41
|
+
- Test cases whose use cases directly relate to the changed functionality
|
|
42
|
+
- Test cases that cover areas potentially affected by the changes
|
|
43
|
+
- When in doubt, include the test case (better to over-test than miss a regression)
|
|
44
|
+
|
|
45
|
+
### Step 4: Execute Tests Locally
|
|
46
|
+
|
|
47
|
+
For each relevant test case:
|
|
48
|
+
|
|
49
|
+
1. Call `muggle-remote-test-script-list` filtered by `testCaseId` to check for an existing script.
|
|
50
|
+
|
|
51
|
+
2. **If a script exists** (replay path):
|
|
52
|
+
- Call `muggle-remote-test-script-get` with the `testScriptId` to fetch the full script object.
|
|
53
|
+
- Call `muggle-local-execute-replay` with:
|
|
54
|
+
- `testScript`: the full script object
|
|
55
|
+
- `localUrl`: the resolved local URL
|
|
56
|
+
- `approveElectronAppLaunch`: `true` *(pipeline context — user starting `muggle-do` is implicit approval)*
|
|
57
|
+
|
|
58
|
+
3. **If no script exists** (generation path):
|
|
59
|
+
- Call `muggle-remote-test-case-get` with the `testCaseId` to fetch the full test case object.
|
|
60
|
+
- Call `muggle-local-execute-test-generation` with:
|
|
61
|
+
- `testCase`: the full test case object
|
|
62
|
+
- `localUrl`: the resolved local URL
|
|
63
|
+
- `approveElectronAppLaunch`: `true`
|
|
64
|
+
|
|
65
|
+
4. When execution completes, call `muggle-local-run-result-get` with the `runId` returned by the execute call.
|
|
66
|
+
|
|
67
|
+
5. **Retain per test case:** `testCaseId`, `testScriptId` (if present), `runId`, `status` (passed/failed), `artifactsDir`.
|
|
68
|
+
|
|
69
|
+
### Step 5: Collect Results
|
|
70
|
+
|
|
71
|
+
For each test case:
|
|
72
|
+
- Record pass or fail from the run result
|
|
73
|
+
- If failed, capture the error message and `artifactsDir` for reproduction
|
|
74
|
+
- Every test case must be executed — generate a new script if none exists (no skips)
|
|
75
|
+
|
|
76
|
+
## Output
|
|
77
|
+
|
|
78
|
+
**QA Report:**
|
|
79
|
+
|
|
80
|
+
**Passed:** (count)
|
|
81
|
+
- (test case name) [testCaseId: `<id>`, testScriptId: `<id>`, runId: `<id>`]: passed
|
|
82
|
+
|
|
83
|
+
**Failed:** (count)
|
|
84
|
+
- (test case name) [testCaseId: `<id>`, runId: `<id>`]: (error) — artifacts: `<artifactsDir>`
|
|
85
|
+
|
|
86
|
+
**Metadata:**
|
|
87
|
+
- projectId: `<projectId>`
|
|
88
|
+
|
|
89
|
+
**Overall:** ALL PASSED | FAILURES DETECTED
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Requirements Analysis Agent
|
|
2
|
+
|
|
3
|
+
You are analyzing a user's task description to extract structured requirements for an autonomous development cycle.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
You receive:
|
|
8
|
+
- A user's task description (natural language)
|
|
9
|
+
- A list of configured repository names
|
|
10
|
+
|
|
11
|
+
## Your Job
|
|
12
|
+
|
|
13
|
+
1. **Read the task description carefully.** Understand what the user wants to build, fix, or change.
|
|
14
|
+
2. **Extract the goal** — one clear sentence describing the outcome.
|
|
15
|
+
3. **Extract acceptance criteria** — specific, verifiable conditions that must be true when the task is done. Each criterion should be independently testable. If the user's description is vague, infer reasonable criteria but flag them as inferred.
|
|
16
|
+
4. **Identify which repos are likely affected** — based on the task description and the repo names provided.
|
|
17
|
+
|
|
18
|
+
## Output
|
|
19
|
+
|
|
20
|
+
Report your findings as a structured summary:
|
|
21
|
+
|
|
22
|
+
**Goal:** (one sentence)
|
|
23
|
+
|
|
24
|
+
**Acceptance Criteria:**
|
|
25
|
+
- (criterion 1)
|
|
26
|
+
- (criterion 2)
|
|
27
|
+
- ...
|
|
28
|
+
|
|
29
|
+
**Affected Repos:** (comma-separated list)
|
|
30
|
+
|
|
31
|
+
**Notes:** (any ambiguities, assumptions, or questions — optional)
|
|
32
|
+
|
|
33
|
+
Do NOT ask the user questions. Make reasonable inferences and flag assumptions in Notes.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Unit Test Runner Agent
|
|
2
|
+
|
|
3
|
+
You are running unit tests for each repository that has changes in the dev cycle pipeline.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
You receive:
|
|
8
|
+
- A list of repos with their paths and test commands (e.g., `pnpm test`)
|
|
9
|
+
|
|
10
|
+
## Your Job
|
|
11
|
+
|
|
12
|
+
For each repo:
|
|
13
|
+
|
|
14
|
+
1. **Run the test command** using Bash in the repo's directory. Use the provided test command (default: `pnpm test`).
|
|
15
|
+
2. **Capture the full output** — both stdout and stderr.
|
|
16
|
+
3. **Determine pass/fail** — exit code 0 means pass, anything else means fail.
|
|
17
|
+
4. **If tests fail**, extract the specific failing test names/descriptions from the output.
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
Per repo:
|
|
22
|
+
|
|
23
|
+
**Repo: (name)**
|
|
24
|
+
- Test command: (what was run)
|
|
25
|
+
- Result: PASS | FAIL
|
|
26
|
+
- Failed tests: (list, if any)
|
|
27
|
+
- Output: (relevant portion of test output — full output if failed, summary if passed)
|
|
28
|
+
|
|
29
|
+
**Overall:** ALL PASSED | FAILURES DETECTED
|
|
30
|
+
|
|
31
|
+
If any repo fails, clearly state which repos failed and include enough output for the user to diagnose the issue.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Code Validation Agent
|
|
2
|
+
|
|
3
|
+
You are validating that each repository's git state is ready for the dev cycle pipeline.
|
|
4
|
+
|
|
5
|
+
## Input
|
|
6
|
+
|
|
7
|
+
You receive:
|
|
8
|
+
- A list of repos with changes (from impact analysis), including their paths and branch names
|
|
9
|
+
|
|
10
|
+
## Your Job
|
|
11
|
+
|
|
12
|
+
For each repo:
|
|
13
|
+
|
|
14
|
+
1. **Verify the branch is a feature branch** (not main/master/the default branch). This should already be validated by impact analysis, but double-check.
|
|
15
|
+
2. **Check for uncommitted changes:** Run `git status --porcelain` in the repo. If there are uncommitted changes, warn the user — uncommitted changes won't be included in PRs.
|
|
16
|
+
3. **Get the branch diff:** Run `git diff <default-branch>...HEAD --stat` for a summary of changes.
|
|
17
|
+
4. **Verify commits exist on the branch:** Run `git log <default-branch>..HEAD --oneline` to confirm there are commits to push.
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
|
|
21
|
+
Per repo:
|
|
22
|
+
|
|
23
|
+
**Repo: (name)**
|
|
24
|
+
- Branch: (name)
|
|
25
|
+
- Commits on branch: (count and one-line summaries)
|
|
26
|
+
- Uncommitted changes: yes/no (with warning if yes)
|
|
27
|
+
- Diff stat: (file change summary)
|
|
28
|
+
- Status: READY | WARNING | ERROR
|
|
29
|
+
|
|
30
|
+
**Overall:** READY to proceed / BLOCKED (with reasons)
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: publish-test-to-cloud
|
|
3
|
+
description: Publish a local generation run to cloud workflow records using MCP tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Publish Test To Cloud
|
|
7
|
+
|
|
8
|
+
Publish a locally generated run to Muggle AI cloud so it appears in cloud workflow and test result views.
|
|
9
|
+
|
|
10
|
+
## Required tools
|
|
11
|
+
|
|
12
|
+
- `muggle-remote-auth-status`
|
|
13
|
+
- `muggle-remote-auth-login`
|
|
14
|
+
- `muggle-remote-auth-poll`
|
|
15
|
+
- `muggle-local-run-result-list`
|
|
16
|
+
- `muggle-local-run-result-get`
|
|
17
|
+
- `muggle-local-publish-test-script`
|
|
18
|
+
- `muggle-remote-local-run-upload` (manual fallback)
|
|
19
|
+
|
|
20
|
+
## Default flow
|
|
21
|
+
|
|
22
|
+
1. Check auth with `muggle-remote-auth-status`.
|
|
23
|
+
2. If not authenticated:
|
|
24
|
+
- `muggle-remote-auth-login`
|
|
25
|
+
- `muggle-remote-auth-poll` as needed.
|
|
26
|
+
3. Find a local run:
|
|
27
|
+
- `muggle-local-run-result-list`
|
|
28
|
+
- choose a generation run in `passed` or `failed` state.
|
|
29
|
+
4. Validate run:
|
|
30
|
+
- `muggle-local-run-result-get`
|
|
31
|
+
- ensure required metadata exists (`projectId`, `useCaseId`, `cloudTestCaseId`, `executionTimeMs`).
|
|
32
|
+
5. Publish:
|
|
33
|
+
- `muggle-local-publish-test-script` with `runId` and `cloudTestCaseId`.
|
|
34
|
+
6. Return cloud identifiers and view URL from tool response.
|
|
35
|
+
|
|
36
|
+
## Notes
|
|
37
|
+
|
|
38
|
+
- Prefer `muggle-local-publish-test-script`.
|
|
39
|
+
- Use `muggle-remote-local-run-upload` only for advanced/manual fallback.
|
|
40
|
+
- Replay runs are not publishable through this flow.
|
|
41
|
+
- If required metadata is missing, fail fast with explicit error context.
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-feature-local
|
|
3
|
+
description: Test a feature's user experience on localhost. Manage entities in cloud with muggle-remote tools and execute locally with muggle-local tools.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Test Feature Local
|
|
7
|
+
|
|
8
|
+
Run end-to-end feature testing against a local URL using a cloud-first workflow:
|
|
9
|
+
|
|
10
|
+
- Cloud management: `muggle-remote-*`
|
|
11
|
+
- Local execution and artifacts: `muggle-local-*`
|
|
12
|
+
|
|
13
|
+
## Workflow
|
|
14
|
+
|
|
15
|
+
1. **Auth**
|
|
16
|
+
- `muggle-remote-auth-status`
|
|
17
|
+
- If needed: `muggle-remote-auth-login` + `muggle-remote-auth-poll`
|
|
18
|
+
|
|
19
|
+
2. **Select project/use case/test case**
|
|
20
|
+
- `muggle-remote-project-list`
|
|
21
|
+
- `muggle-remote-use-case-list`
|
|
22
|
+
- `muggle-remote-test-case-list-by-use-case`
|
|
23
|
+
|
|
24
|
+
3. **Resolve local URL**
|
|
25
|
+
- Use the URL provided by the user.
|
|
26
|
+
- If missing, ask explicitly (do not guess).
|
|
27
|
+
|
|
28
|
+
4. **Check script availability**
|
|
29
|
+
- `muggle-remote-test-script-list` filtered by testCaseId
|
|
30
|
+
- If script exists, recommend replay unless user-flow changes suggest regeneration.
|
|
31
|
+
|
|
32
|
+
5. **Execute**
|
|
33
|
+
- Replay path:
|
|
34
|
+
- `muggle-remote-test-script-get`
|
|
35
|
+
- `muggle-local-execute-replay`
|
|
36
|
+
- Generation path:
|
|
37
|
+
- `muggle-remote-test-case-get`
|
|
38
|
+
- `muggle-local-execute-test-generation`
|
|
39
|
+
|
|
40
|
+
6. **Approval requirement**
|
|
41
|
+
- Before execution, get explicit user approval for launching Electron app.
|
|
42
|
+
- Only then set `approveElectronAppLaunch: true`.
|
|
43
|
+
|
|
44
|
+
7. **Report results**
|
|
45
|
+
- `muggle-local-run-result-get` with returned runId.
|
|
46
|
+
- Report:
|
|
47
|
+
- status
|
|
48
|
+
- duration
|
|
49
|
+
- artifacts path
|
|
50
|
+
- pass/fail summary
|
|
51
|
+
|
|
52
|
+
8. **Optional publish**
|
|
53
|
+
- Offer `muggle-local-publish-test-script` to publish generated script to cloud.
|
|
54
|
+
|
|
55
|
+
## Tool map
|
|
56
|
+
|
|
57
|
+
### Auth
|
|
58
|
+
- `muggle-remote-auth-status`
|
|
59
|
+
- `muggle-remote-auth-login`
|
|
60
|
+
- `muggle-remote-auth-poll`
|
|
61
|
+
- `muggle-remote-auth-logout`
|
|
62
|
+
|
|
63
|
+
### Cloud entities
|
|
64
|
+
- `muggle-remote-project-list`
|
|
65
|
+
- `muggle-remote-project-create`
|
|
66
|
+
- `muggle-remote-use-case-list`
|
|
67
|
+
- `muggle-remote-use-case-create-from-prompts`
|
|
68
|
+
- `muggle-remote-test-case-list-by-use-case`
|
|
69
|
+
- `muggle-remote-test-case-get`
|
|
70
|
+
- `muggle-remote-test-case-generate-from-prompt`
|
|
71
|
+
- `muggle-remote-test-script-list`
|
|
72
|
+
- `muggle-remote-test-script-get`
|
|
73
|
+
|
|
74
|
+
### Local execution
|
|
75
|
+
- `muggle-local-execute-test-generation`
|
|
76
|
+
- `muggle-local-execute-replay`
|
|
77
|
+
- `muggle-local-run-result-list`
|
|
78
|
+
- `muggle-local-run-result-get`
|
|
79
|
+
- `muggle-local-publish-test-script`
|
|
80
|
+
|
|
81
|
+
## Guardrails
|
|
82
|
+
|
|
83
|
+
- Do not silently skip auth.
|
|
84
|
+
- Do not silently skip test execution when no script exists; generate one.
|
|
85
|
+
- Do not launch Electron without explicit approval.
|
|
86
|
+
- Do not hide failing run details; include error and artifacts path.
|
package/scripts/postinstall.mjs
CHANGED
|
@@ -857,6 +857,6 @@ async function installSkills() {
|
|
|
857
857
|
// Run postinstall
|
|
858
858
|
initLogFile();
|
|
859
859
|
removeVersionOverrideFile();
|
|
860
|
-
|
|
861
|
-
|
|
860
|
+
log("Skipping Cursor MCP auto-registration (plugin-first mode). Install via: /plugin marketplace add <url>");
|
|
861
|
+
log("Skipping ~/.claude skill installation (plugin-first mode). Install via: /plugin install muggle@<marketplace>");
|
|
862
862
|
downloadElectronApp().catch(logError);
|