Skip to content

Commit 526c4c8

Browse files
authored
feat: add npm keywords, fixture gallery, CLI converters, and GitHub Action (#102)
## Summary The DX release — everything to make aimock easier to discover, adopt, and integrate. - **npm keywords** — 30 keywords for search discoverability - **Fixture gallery** — 11 example fixtures + browsable docs page at /examples - **CLI converter subcommands** — `npx aimock convert vidaimock/mockllm` + docs on CLI page - **GitHub Action** — `uses: CopilotKit/aimock@v1` for one-line CI setup + docs page - **Vitest plugin** — `import { useAimock } from "@copilotkit/aimock/vitest"` with auto lifecycle + env patching - **Jest plugin** — `import { useAimock } from "@copilotkit/aimock/jest"` same API - **Publish workflow** — strips video URLs from README for npm ## Usage ### Vitest ```ts import { useAimock } from "@copilotkit/aimock/vitest"; const mock = useAimock({ fixtures: "./fixtures" }); it("responds", async () => { // mock().url is the server URL // OPENAI_BASE_URL is auto-patched const res = await myApp.chat("hello"); }); ``` ### GitHub Action ```yaml - uses: CopilotKit/aimock@v1 with: fixtures: ./test/fixtures - run: npm test env: OPENAI_BASE_URL: http://127.0.0.1:4010/v1 ``` ### Converter CLI ```bash npx aimock convert vidaimock ./templates/ ./fixtures/ npx aimock convert mockllm ./config.yaml ./fixtures/ ``` ## Test plan - [x] All 2303 tests pass - [x] Build passes (vitest.js, jest.js, vitest.d.ts, jest.d.ts all emitted) - [x] Sub-path exports resolve correctly - [x] CR loop converged 🤖 Generated with [Claude Code](https://claude.com/claude-code)
2 parents 752966a + e9a146b commit 526c4c8

37 files changed

+2651
-610
lines changed

.claude-plugin/marketplace.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"source": {
1010
"source": "npm",
1111
"package": "@copilotkit/aimock",
12-
"version": "^1.11.0"
12+
"version": "^1.13.0"
1313
},
1414
"description": "Fixture authoring skill for @copilotkit/aimock — match fields, response types, embeddings, structured output, sequential responses, streaming physics, agent loop patterns, gotchas, and debugging"
1515
}

.claude-plugin/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "llmock",
3-
"version": "1.11.0",
3+
"version": "1.13.0",
44
"description": "Fixture authoring guidance for @copilotkit/aimock",
55
"author": {
66
"name": "CopilotKit"

.github/workflows/publish-release.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ jobs:
4949
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
5050
"
5151
52+
- name: Strip video URLs from README for npm
53+
if: steps.check.outputs.published == 'false'
54+
run: sed -i '/^https:\/\/github.com\/user-attachments\//d' README.md
55+
5256
- name: Build and publish
5357
if: steps.check.outputs.published == 'false'
5458
run: pnpm build && npm publish --access public

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @copilotkit/aimock
22

3+
## 1.13.0
4+
5+
### Minor Changes
6+
7+
- Add GitHub Action for one-line CI setup — `uses: CopilotKit/aimock@v1` with fixtures, config, port, args, and health check (#102)
8+
- Wire fixture converters into CLI — `npx aimock convert vidaimock` and `npx aimock convert mockllm` as first-class subcommands (#102)
9+
- Add 30 npm keywords for search discoverability (#102)
10+
- Add fixture gallery with 11 examples covering all mock types, plus browsable docs page at /examples (#102)
11+
- Add vitest and jest plugins for zero-config testing — `import { useAimock } from "@copilotkit/aimock/vitest"` (#102)
12+
- Strip video URLs from README for npm publishing (#102)
13+
314
## 1.12.0
415

516
### Minor Changes

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,23 @@ Run them all on one port with `npx aimock --config aimock.json`, or use the prog
5151
- **[WebSocket APIs](https://aimock.copilotkit.dev/websocket)** — OpenAI Realtime, Responses WS, Gemini Live
5252
- **[Prometheus Metrics](https://aimock.copilotkit.dev/metrics)** — Request counts, latencies, fixture match rates
5353
- **[Docker + Helm](https://aimock.copilotkit.dev/docker)** — Container image and Helm chart for CI/CD
54+
- **[Vitest & Jest Plugins](https://aimock.copilotkit.dev/test-plugins)** — Zero-config `useAimock()` with auto lifecycle and env patching
5455
- **Zero dependencies** — Everything from Node.js builtins
5556

57+
## GitHub Action
58+
59+
```yaml
60+
- uses: CopilotKit/aimock@v1
61+
with:
62+
fixtures: ./test/fixtures
63+
64+
- run: npm test
65+
env:
66+
OPENAI_BASE_URL: http://127.0.0.1:4010/v1
67+
```
68+
69+
See the [GitHub Action docs](https://aimock.copilotkit.dev/github-action) for all inputs and examples.
70+
5671
## CLI
5772
5873
```bash
@@ -65,6 +80,10 @@ npx aimock --config aimock.json
6580
# Record mode: proxy to real APIs, save fixtures
6681
npx aimock --record --provider-openai https://api.openai.com
6782

83+
# Convert fixtures from other tools
84+
npx aimock convert vidaimock ./templates/ ./fixtures/
85+
npx aimock convert mockllm ./config.yaml ./fixtures/
86+
6887
# Docker
6988
docker run -d -p 4010:4010 -v ./fixtures:/fixtures ghcr.io/copilotkit/aimock -f /fixtures
7089
```
@@ -75,7 +94,7 @@ Step-by-step migration guides: [MSW](https://aimock.copilotkit.dev/migrate-from-
7594

7695
## Documentation
7796

78-
**[https://aimock.copilotkit.dev](https://aimock.copilotkit.dev)**
97+
**[https://aimock.copilotkit.dev](https://aimock.copilotkit.dev)** · [Example fixtures](https://aimock.copilotkit.dev/examples)
7998

8099
## Real-World Usage
81100

action.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: "aimock"
2+
description: "Start an aimock server for AI application testing — LLM APIs, MCP, A2A, AG-UI, vector DBs"
3+
branding:
4+
icon: "server"
5+
color: "green"
6+
7+
inputs:
8+
fixtures:
9+
description: "Path to fixture files or directory"
10+
required: false
11+
default: "./fixtures"
12+
config:
13+
description: "Path to aimock JSON config file (overrides fixtures)"
14+
required: false
15+
port:
16+
description: "Port to listen on"
17+
required: false
18+
default: "4010"
19+
host:
20+
description: "Host to bind to"
21+
required: false
22+
default: "127.0.0.1"
23+
version:
24+
description: "aimock version to install (default: latest)"
25+
required: false
26+
default: "latest"
27+
args:
28+
description: "Additional CLI arguments (e.g., --strict --record --provider-openai https://api.openai.com)"
29+
required: false
30+
default: ""
31+
wait-timeout:
32+
description: "Max seconds to wait for health check (default: 30)"
33+
required: false
34+
default: "30"
35+
36+
outputs:
37+
url:
38+
description: "The aimock server URL (e.g., http://127.0.0.1:4010)"
39+
value: ${{ steps.start.outputs.url }}
40+
41+
runs:
42+
using: "composite"
43+
steps:
44+
- name: Install aimock
45+
shell: bash
46+
run: npm install -g @copilotkit/aimock@${{ inputs.version }}
47+
48+
- name: Start aimock
49+
id: start
50+
shell: bash
51+
run: |
52+
URL="http://${{ inputs.host }}:${{ inputs.port }}"
53+
echo "url=${URL}" >> $GITHUB_OUTPUT
54+
55+
if [ -n "${{ inputs.config }}" ]; then
56+
aimock --config "${{ inputs.config }}" \
57+
--port ${{ inputs.port }} \
58+
--host ${{ inputs.host }} \
59+
${{ inputs.args }} &
60+
else
61+
llmock --fixtures "${{ inputs.fixtures }}" \
62+
--port ${{ inputs.port }} \
63+
--host ${{ inputs.host }} \
64+
${{ inputs.args }} &
65+
fi
66+
67+
echo $! > /tmp/aimock.pid
68+
echo "Started aimock (PID: $(cat /tmp/aimock.pid))"
69+
70+
- name: Wait for health check
71+
shell: bash
72+
run: |
73+
URL="http://${{ inputs.host }}:${{ inputs.port }}/health"
74+
TIMEOUT=${{ inputs.wait-timeout }}
75+
ELAPSED=0
76+
77+
echo "Waiting for ${URL} ..."
78+
while [ $ELAPSED -lt $TIMEOUT ]; do
79+
if curl -sf "$URL" > /dev/null 2>&1; then
80+
echo "aimock is ready at http://${{ inputs.host }}:${{ inputs.port }}"
81+
exit 0
82+
fi
83+
sleep 1
84+
ELAPSED=$((ELAPSED + 1))
85+
done
86+
87+
echo "::error::aimock failed to start within ${TIMEOUT}s"
88+
if [ -f /tmp/aimock.pid ]; then
89+
kill "$(cat /tmp/aimock.pid)" 2>/dev/null || true
90+
fi
91+
exit 1

charts/aimock/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ name: aimock
33
description: Mock infrastructure for AI application testing (OpenAI, Anthropic, Gemini, MCP, A2A, vector)
44
type: application
55
version: 0.1.0
6-
appVersion: "1.12.0"
6+
appVersion: "1.13.0"

docs/aimock-cli/index.html

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,59 @@ <h2>Docker Usage</h2>
280280
</div>
281281
</div>
282282

283+
<h2>Fixture Converters</h2>
284+
<p>Convert fixtures from other mock tools to aimock format.</p>
285+
286+
<h3>Usage</h3>
287+
<div class="code-block">
288+
<div class="code-block-header">Convert fixtures <span class="lang-tag">shell</span></div>
289+
<pre><code>npx aimock convert &lt;format&gt; &lt;input&gt; [output]</code></pre>
290+
</div>
291+
292+
<h3>Supported Formats</h3>
293+
<table class="endpoint-table">
294+
<thead>
295+
<tr>
296+
<th>Format</th>
297+
<th>Source</th>
298+
<th>Description</th>
299+
</tr>
300+
</thead>
301+
<tbody>
302+
<tr>
303+
<td><code>vidaimock</code></td>
304+
<td>VidaiMock Tera templates</td>
305+
<td>
306+
Converts <code>.tera</code> / <code>.json</code> / <code>.txt</code> templates to
307+
aimock fixture JSON
308+
</td>
309+
</tr>
310+
<tr>
311+
<td><code>mockllm</code></td>
312+
<td>mock-llm YAML config</td>
313+
<td>
314+
Converts mock-llm YAML configs to aimock fixture JSON. Also extracts MCP tools if
315+
present.
316+
</td>
317+
</tr>
318+
</tbody>
319+
</table>
320+
321+
<h3>Examples</h3>
322+
<div class="code-block">
323+
<div class="code-block-header">
324+
Converter examples <span class="lang-tag">shell</span>
325+
</div>
326+
<pre><code><span class="cm"># Convert a directory of VidaiMock templates</span>
327+
$ npx aimock convert vidaimock ./templates/ ./fixtures/converted.json
328+
329+
<span class="cm"># Convert a mock-llm YAML config</span>
330+
$ npx aimock convert mockllm ./config.yaml ./fixtures/converted.json
331+
332+
<span class="cm"># Print to stdout (omit output path)</span>
333+
$ npx aimock convert vidaimock ./templates/</code></pre>
334+
</div>
335+
283336
<h2>Docker Compose</h2>
284337

285338
<div class="code-block">

docs/docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ <h2>The Suite</h2>
305305
</div>
306306
<p class="suite-card-desc">Chaos testing, metrics, drift detection, Docker</p>
307307
<ul class="suite-card-links">
308+
<li><a href="/test-plugins">Vitest &amp; Jest plugins</a></li>
308309
<li><a href="/chaos-testing">Chaos testing</a></li>
309-
<li><a href="/metrics">Prometheus</a></li>
310310
<li><a href="/drift-detection">Drift detection</a></li>
311311
<li><a href="/docker">Docker &amp; Helm</a></li>
312312
</ul>

0 commit comments

Comments
 (0)