Initial commit
This commit is contained in:
7
skills/skill-adapter/assets/README.md
Normal file
7
skills/skill-adapter/assets/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
# Assets
|
||||
|
||||
Bundled resources for api-mock-server skill
|
||||
|
||||
- [ ] mock_server_template.yaml: A template YAML file for configuring the mock server, including placeholders for the OpenAPI spec, response configurations, and other settings.
|
||||
- [ ] example_responses/: A directory containing example responses for different API endpoints, including successful responses, error responses, and edge cases.
|
||||
- [ ] openapi_example.yaml: Example OpenAPI spec file to be used as a starting point.
|
||||
32
skills/skill-adapter/assets/config-template.json
Normal file
32
skills/skill-adapter/assets/config-template.json
Normal file
@@ -0,0 +1,32 @@
|
||||
{
|
||||
"skill": {
|
||||
"name": "skill-name",
|
||||
"version": "1.0.0",
|
||||
"enabled": true,
|
||||
"settings": {
|
||||
"verbose": false,
|
||||
"autoActivate": true,
|
||||
"toolRestrictions": true
|
||||
}
|
||||
},
|
||||
"triggers": {
|
||||
"keywords": [
|
||||
"example-trigger-1",
|
||||
"example-trigger-2"
|
||||
],
|
||||
"patterns": []
|
||||
},
|
||||
"tools": {
|
||||
"allowed": [
|
||||
"Read",
|
||||
"Grep",
|
||||
"Bash"
|
||||
],
|
||||
"restricted": []
|
||||
},
|
||||
"metadata": {
|
||||
"author": "Plugin Author",
|
||||
"category": "general",
|
||||
"tags": []
|
||||
}
|
||||
}
|
||||
76
skills/skill-adapter/assets/mock_server_template.yaml
Normal file
76
skills/skill-adapter/assets/mock_server_template.yaml
Normal file
@@ -0,0 +1,76 @@
|
||||
# Configuration for the API Mock Server Plugin
|
||||
|
||||
# --- OpenAPI Specification ---
|
||||
# Path to your OpenAPI (Swagger) specification file (YAML or JSON).
|
||||
# This file defines the API endpoints, request parameters, and response schemas.
|
||||
openapi_spec_path: "REPLACE_ME/path/to/your/openapi.yaml"
|
||||
|
||||
# --- Server Settings ---
|
||||
# Host and port for the mock server to listen on.
|
||||
host: "0.0.0.0" # Listen on all interfaces
|
||||
port: 8080
|
||||
|
||||
# --- Response Configuration ---
|
||||
# Default settings for generating responses. These can be overridden per-endpoint.
|
||||
default_response:
|
||||
# Simulate network latency (in milliseconds).
|
||||
latency: 50 # milliseconds
|
||||
# Probability of returning an error (0.0 to 1.0).
|
||||
error_rate: 0.05 # 5% chance of error
|
||||
# Default HTTP status code to return for successful requests.
|
||||
success_status_code: 200
|
||||
|
||||
# Endpoint-specific overrides. Use the OpenAPI path as the key.
|
||||
endpoints:
|
||||
"/users":
|
||||
# Override the default latency for this endpoint.
|
||||
latency: 100
|
||||
# Example of a custom response for a specific HTTP method and status code.
|
||||
GET:
|
||||
200:
|
||||
# Custom response body (JSON). If not specified, will generate a fake response.
|
||||
body:
|
||||
message: "Successfully retrieved users"
|
||||
users:
|
||||
- id: "user1"
|
||||
name: "John Doe"
|
||||
- id: "user2"
|
||||
name: "Jane Smith"
|
||||
500:
|
||||
body:
|
||||
error: "Simulated server error"
|
||||
status_code: 500
|
||||
|
||||
"/products/{product_id}":
|
||||
GET:
|
||||
404:
|
||||
body:
|
||||
error: "Product not found"
|
||||
status_code: 404
|
||||
|
||||
|
||||
# --- Data Persistence ---
|
||||
# Whether to persist data between requests (stateful mocking).
|
||||
stateful: true
|
||||
# Path to a file where data will be stored. If empty, data will be stored in memory.
|
||||
data_file: "REPLACE_ME/path/to/data.json" # Example: data.json
|
||||
|
||||
# --- Security ---
|
||||
# API Key authentication (example).
|
||||
api_key:
|
||||
enabled: false
|
||||
# Header name for the API Key.
|
||||
header_name: "X-API-Key"
|
||||
# Valid API Key value.
|
||||
valid_key: "YOUR_API_KEY_HERE"
|
||||
|
||||
# --- Logging ---
|
||||
# Configure logging level. Options: DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
log_level: INFO
|
||||
|
||||
# --- Advanced Settings ---
|
||||
# CORS configuration (optional).
|
||||
cors:
|
||||
enabled: true
|
||||
# Allowed origins (e.g., "http://localhost:3000"). Use "*" to allow all origins (not recommended for production).
|
||||
allowed_origins: "*"
|
||||
145
skills/skill-adapter/assets/openapi_example.yaml
Normal file
145
skills/skill-adapter/assets/openapi_example.yaml
Normal file
@@ -0,0 +1,145 @@
|
||||
# openapi_example.yaml
|
||||
# This file defines an example OpenAPI specification for the API Mock Server plugin.
|
||||
# It's designed to be a starting point and should be customized to your specific API.
|
||||
|
||||
openapi: 3.0.0
|
||||
info:
|
||||
title: Example API
|
||||
version: 1.0.0
|
||||
description: A simple example API for demonstration purposes.
|
||||
|
||||
servers:
|
||||
- url: http://localhost:8080 # The base URL where the mock server will run. Change if needed.
|
||||
description: Local development server
|
||||
|
||||
paths:
|
||||
/users:
|
||||
get:
|
||||
summary: Get a list of users
|
||||
description: Returns a list of all users.
|
||||
operationId: getUsers
|
||||
responses:
|
||||
'200':
|
||||
description: A list of users.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/User'
|
||||
'500':
|
||||
description: Internal server error. Simulates a possible error response.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: Error message.
|
||||
example: "Internal Server Error"
|
||||
post:
|
||||
summary: Create a new user
|
||||
description: Creates a new user.
|
||||
operationId: createUser
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserCreate'
|
||||
responses:
|
||||
'201':
|
||||
description: User created successfully.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'400':
|
||||
description: Bad request. Invalid input.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: Error message.
|
||||
example: "Invalid input data"
|
||||
|
||||
/users/{userId}:
|
||||
get:
|
||||
summary: Get a user by ID
|
||||
description: Returns a single user by their ID.
|
||||
operationId: getUserById
|
||||
parameters:
|
||||
- in: path
|
||||
name: userId
|
||||
schema:
|
||||
type: integer
|
||||
required: true
|
||||
description: The ID of the user to retrieve.
|
||||
responses:
|
||||
'200':
|
||||
description: The user object.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
'404':
|
||||
description: User not found.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
error:
|
||||
type: string
|
||||
description: Error message.
|
||||
example: "User not found"
|
||||
|
||||
components:
|
||||
schemas:
|
||||
User:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: integer
|
||||
description: The user's ID.
|
||||
example: 123
|
||||
name:
|
||||
type: string
|
||||
description: The user's name.
|
||||
example: "John Doe"
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
description: The user's email address.
|
||||
example: "john.doe@example.com"
|
||||
# Add more user properties as needed
|
||||
# Example:
|
||||
# role:
|
||||
# type: string
|
||||
# description: The user's role.
|
||||
# example: "admin"
|
||||
required:
|
||||
- id
|
||||
- name
|
||||
- email
|
||||
|
||||
UserCreate:
|
||||
type: object
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
description: The user's name.
|
||||
example: "Jane Doe"
|
||||
email:
|
||||
type: string
|
||||
format: email
|
||||
description: The user's email address.
|
||||
example: "jane.doe@example.com"
|
||||
# Add more user creation properties as needed
|
||||
required:
|
||||
- name
|
||||
- email
|
||||
28
skills/skill-adapter/assets/skill-schema.json
Normal file
28
skills/skill-adapter/assets/skill-schema.json
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Claude Skill Configuration",
|
||||
"type": "object",
|
||||
"required": ["name", "description"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9-]+$",
|
||||
"maxLength": 64,
|
||||
"description": "Skill identifier (lowercase, hyphens only)"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"maxLength": 1024,
|
||||
"description": "What the skill does and when to use it"
|
||||
},
|
||||
"allowed-tools": {
|
||||
"type": "string",
|
||||
"description": "Comma-separated list of allowed tools"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"pattern": "^\\d+\\.\\d+\\.\\d+$",
|
||||
"description": "Semantic version (x.y.z)"
|
||||
}
|
||||
}
|
||||
}
|
||||
27
skills/skill-adapter/assets/test-data.json
Normal file
27
skills/skill-adapter/assets/test-data.json
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"testCases": [
|
||||
{
|
||||
"name": "Basic activation test",
|
||||
"input": "trigger phrase example",
|
||||
"expected": {
|
||||
"activated": true,
|
||||
"toolsUsed": ["Read", "Grep"],
|
||||
"success": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Complex workflow test",
|
||||
"input": "multi-step trigger example",
|
||||
"expected": {
|
||||
"activated": true,
|
||||
"steps": 3,
|
||||
"toolsUsed": ["Read", "Write", "Bash"],
|
||||
"success": true
|
||||
}
|
||||
}
|
||||
],
|
||||
"fixtures": {
|
||||
"sampleInput": "example data",
|
||||
"expectedOutput": "processed result"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user