Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"source": {
"source": "npm",
"package": "@copilotkit/aimock",
"version": "^1.11.0"
"version": "^1.13.0"
},
"description": "Fixture authoring skill for @copilotkit/aimock — match fields, response types, embeddings, structured output, sequential responses, streaming physics, agent loop patterns, gotchas, and debugging"
}
Expand Down
2 changes: 1 addition & 1 deletion .claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "llmock",
"version": "1.11.0",
"version": "1.13.0",
"description": "Fixture authoring guidance for @copilotkit/aimock",
"author": {
"name": "CopilotKit"
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ jobs:
fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\n');
"

- name: Strip video URLs from README for npm
if: steps.check.outputs.published == 'false'
run: sed -i '/^https:\/\/github.com\/user-attachments\//d' README.md

- name: Build and publish
if: steps.check.outputs.published == 'false'
run: pnpm build && npm publish --access public
Expand Down
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# @copilotkit/aimock

## 1.13.0

### Minor Changes

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

## 1.12.0

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

## 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
```

See the [GitHub Action docs](https://aimock.copilotkit.dev/github-action) for all inputs and examples.

## CLI

```bash
Expand All @@ -65,6 +80,10 @@ npx aimock --config aimock.json
# Record mode: proxy to real APIs, save fixtures
npx aimock --record --provider-openai https://api.openai.com

# Convert fixtures from other tools
npx aimock convert vidaimock ./templates/ ./fixtures/
npx aimock convert mockllm ./config.yaml ./fixtures/

# Docker
docker run -d -p 4010:4010 -v ./fixtures:/fixtures ghcr.io/copilotkit/aimock -f /fixtures
```
Expand All @@ -75,7 +94,7 @@ Step-by-step migration guides: [MSW](https://aimock.copilotkit.dev/migrate-from-

## Documentation

**[https://aimock.copilotkit.dev](https://aimock.copilotkit.dev)**
**[https://aimock.copilotkit.dev](https://aimock.copilotkit.dev)** · [Example fixtures](https://aimock.copilotkit.dev/examples)

## Real-World Usage

Expand Down
91 changes: 91 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: "aimock"
description: "Start an aimock server for AI application testing — LLM APIs, MCP, A2A, AG-UI, vector DBs"
branding:
icon: "server"
color: "green"

inputs:
fixtures:
description: "Path to fixture files or directory"
required: false
default: "./fixtures"
config:
description: "Path to aimock JSON config file (overrides fixtures)"
required: false
port:
description: "Port to listen on"
required: false
default: "4010"
host:
description: "Host to bind to"
required: false
default: "127.0.0.1"
version:
description: "aimock version to install (default: latest)"
required: false
default: "latest"
args:
description: "Additional CLI arguments (e.g., --strict --record --provider-openai https://api.openai.com)"
required: false
default: ""
wait-timeout:
description: "Max seconds to wait for health check (default: 30)"
required: false
default: "30"

outputs:
url:
description: "The aimock server URL (e.g., http://127.0.0.1:4010)"
value: ${{ steps.start.outputs.url }}

runs:
using: "composite"
steps:
- name: Install aimock
shell: bash
run: npm install -g @copilotkit/aimock@${{ inputs.version }}

- name: Start aimock
id: start
shell: bash
run: |
URL="http://${{ inputs.host }}:${{ inputs.port }}"
echo "url=${URL}" >> $GITHUB_OUTPUT

if [ -n "${{ inputs.config }}" ]; then
aimock --config "${{ inputs.config }}" \
--port ${{ inputs.port }} \
--host ${{ inputs.host }} \
${{ inputs.args }} &
else
llmock --fixtures "${{ inputs.fixtures }}" \
--port ${{ inputs.port }} \
--host ${{ inputs.host }} \
${{ inputs.args }} &
fi

echo $! > /tmp/aimock.pid
echo "Started aimock (PID: $(cat /tmp/aimock.pid))"

- name: Wait for health check
shell: bash
run: |
URL="http://${{ inputs.host }}:${{ inputs.port }}/health"
TIMEOUT=${{ inputs.wait-timeout }}
ELAPSED=0

echo "Waiting for ${URL} ..."
while [ $ELAPSED -lt $TIMEOUT ]; do
if curl -sf "$URL" > /dev/null 2>&1; then
echo "aimock is ready at http://${{ inputs.host }}:${{ inputs.port }}"
exit 0
fi
sleep 1
ELAPSED=$((ELAPSED + 1))
done

echo "::error::aimock failed to start within ${TIMEOUT}s"
if [ -f /tmp/aimock.pid ]; then
kill "$(cat /tmp/aimock.pid)" 2>/dev/null || true
fi
exit 1
2 changes: 1 addition & 1 deletion charts/aimock/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ name: aimock
description: Mock infrastructure for AI application testing (OpenAI, Anthropic, Gemini, MCP, A2A, vector)
type: application
version: 0.1.0
appVersion: "1.12.0"
appVersion: "1.13.0"
53 changes: 53 additions & 0 deletions docs/aimock-cli/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,59 @@ <h2>Docker Usage</h2>
</div>
</div>

<h2>Fixture Converters</h2>
<p>Convert fixtures from other mock tools to aimock format.</p>

<h3>Usage</h3>
<div class="code-block">
<div class="code-block-header">Convert fixtures <span class="lang-tag">shell</span></div>
<pre><code>npx aimock convert &lt;format&gt; &lt;input&gt; [output]</code></pre>
</div>

<h3>Supported Formats</h3>
<table class="endpoint-table">
<thead>
<tr>
<th>Format</th>
<th>Source</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>vidaimock</code></td>
<td>VidaiMock Tera templates</td>
<td>
Converts <code>.tera</code> / <code>.json</code> / <code>.txt</code> templates to
aimock fixture JSON
</td>
</tr>
<tr>
<td><code>mockllm</code></td>
<td>mock-llm YAML config</td>
<td>
Converts mock-llm YAML configs to aimock fixture JSON. Also extracts MCP tools if
present.
</td>
</tr>
</tbody>
</table>

<h3>Examples</h3>
<div class="code-block">
<div class="code-block-header">
Converter examples <span class="lang-tag">shell</span>
</div>
<pre><code><span class="cm"># Convert a directory of VidaiMock templates</span>
$ npx aimock convert vidaimock ./templates/ ./fixtures/converted.json

<span class="cm"># Convert a mock-llm YAML config</span>
$ npx aimock convert mockllm ./config.yaml ./fixtures/converted.json

<span class="cm"># Print to stdout (omit output path)</span>
$ npx aimock convert vidaimock ./templates/</code></pre>
</div>

<h2>Docker Compose</h2>

<div class="code-block">
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ <h2>The Suite</h2>
</div>
<p class="suite-card-desc">Chaos testing, metrics, drift detection, Docker</p>
<ul class="suite-card-links">
<li><a href="/test-plugins">Vitest &amp; Jest plugins</a></li>
<li><a href="/chaos-testing">Chaos testing</a></li>
<li><a href="/metrics">Prometheus</a></li>
<li><a href="/drift-detection">Drift detection</a></li>
<li><a href="/docker">Docker &amp; Helm</a></li>
</ul>
Expand Down
Loading
Loading