Initial commit

This commit is contained in:
Zhongwei Li
2025-11-29 18:52:16 +08:00
commit 2d26d607e7
17 changed files with 1359 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Assets
Bundled resources for api-event-emitter skill
- [ ] event_schema_template.json: A template for defining event schemas in JSON format.
- [ ] docker-compose.yml: A Docker Compose file for setting up a local message queue for development and testing.
- [ ] example_events.json: A collection of example events that can be used to test the API.

View 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": []
}
}

View File

@@ -0,0 +1,56 @@
version: "3.9"
services:
# Message Queue Service (e.g., RabbitMQ)
message_queue:
image: rabbitmq:3.9-management-alpine # Or choose your preferred message queue and version
container_name: rabbitmq_server
ports:
- "5672:5672" # AMQP protocol port
- "15672:15672" # Management UI port (optional)
environment:
RABBITMQ_DEFAULT_USER: "guest" # REPLACE_ME: Change default user in production
RABBITMQ_DEFAULT_PASS: "guest" # REPLACE_ME: Change default password in production
RABBITMQ_DEFAULT_VHOST: "/"
volumes:
- rabbitmq_data:/var/lib/rabbitmq # Persist data across restarts (optional)
healthcheck:
test: ["CMD", "rabbitmqctl", "status"]
interval: 30s
timeout: 10s
retries: 5
# Optional: Event Streaming Platform (e.g., Kafka) - uncomment to include
# event_streaming:
# image: confluentinc/cp-kafka:latest
# container_name: kafka_server
# ports:
# - "9092:9092"
# environment:
# KAFKA_BROKER_ID: 1
# KAFKA_LISTENERS: PLAINTEXT://:9092
# KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://localhost:9092 # REPLACE_ME: Adjust for your environment
# KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
# depends_on:
# - zookeeper
# healthcheck:
# test: ["CMD", "kafka-topics", "--list", "--zookeeper", "zookeeper:2181"]
# interval: 30s
# timeout: 10s
# retries: 5
# Optional: Zookeeper (required for Kafka) - uncomment to include if using Kafka
# zookeeper:
# image: confluentinc/cp-zookeeper:latest
# container_name: zookeeper_server
# ports:
# - "2181:2181"
# environment:
# ZOOKEEPER_CLIENT_PORT: 2181
# ZOOKEEPER_TICK_TIME: 2000
# Define persistent volumes
volumes:
rabbitmq_data: # Named volume for RabbitMQ data persistence
# kafka_data: # Uncomment if using Kafka
# zookeeper_data: # Uncomment if using Zookeeper

View File

@@ -0,0 +1,69 @@
{
"_comment": "Template for defining event schemas in JSON format",
"schema_version": "1.0",
"event_name": "user.created",
"description": "Event triggered when a new user is created.",
"source": "user-service",
"timestamp": "2024-10-27T10:00:00Z",
"payload": {
"_comment": "Data associated with the user.created event",
"user_id": {
"type": "string",
"format": "uuid",
"description": "Unique identifier for the user"
},
"username": {
"type": "string",
"minLength": 3,
"maxLength": 50,
"description": "Username of the new user"
},
"email": {
"type": "string",
"format": "email",
"description": "Email address of the new user"
},
"created_at": {
"type": "string",
"format": "date-time",
"description": "Timestamp of when the user was created"
},
"profile": {
"type": "object",
"description": "User profile information",
"properties": {
"first_name": {
"type": "string",
"description": "First name of the user"
},
"last_name": {
"type": "string",
"description": "Last name of the user"
}
},
"required": [
"first_name",
"last_name"
]
}
},
"required": [
"user_id",
"username",
"email",
"created_at"
],
"examples": [
{
"_comment": "Example of a user.created event",
"user_id": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"username": "newuser123",
"email": "newuser@example.com",
"created_at": "2024-10-27T10:00:00Z",
"profile": {
"first_name": "John",
"last_name": "Doe"
}
}
]
}

View File

@@ -0,0 +1,62 @@
{
"_comment": "Example events for testing the API event emitter plugin",
"user_created": {
"_comment": "Event emitted when a new user is created",
"event_type": "user.created",
"data": {
"user_id": "user123",
"username": "johndoe",
"email": "john.doe@example.com",
"created_at": "2024-10-27T10:00:00Z"
}
},
"product_added": {
"_comment": "Event emitted when a new product is added to the catalog",
"event_type": "product.added",
"data": {
"product_id": "prod456",
"product_name": "Awesome Widget",
"description": "A fantastic widget for all your needs",
"price": 19.99,
"created_at": "2024-10-27T10:05:00Z"
}
},
"order_placed": {
"_comment": "Event emitted when a user places an order",
"event_type": "order.placed",
"data": {
"order_id": "order789",
"user_id": "user123",
"order_date": "2024-10-27T10:10:00Z",
"total_amount": 39.98,
"items": [
{
"product_id": "prod456",
"quantity": 2
}
]
}
},
"payment_processed": {
"_comment": "Event emitted when a payment is successfully processed",
"event_type": "payment.processed",
"data": {
"payment_id": "payment012",
"order_id": "order789",
"amount": 39.98,
"payment_date": "2024-10-27T10:15:00Z",
"payment_method": "credit_card",
"status": "success"
}
},
"user_updated": {
"_comment": "Event emitted when a user's profile is updated",
"event_type": "user.updated",
"data": {
"user_id": "user123",
"username": "john.doe.updated",
"email": "john.doe.updated@example.com",
"updated_at": "2024-10-27T10:20:00Z"
}
}
}

View 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)"
}
}
}

View 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"
}
}