QwenClaw v2.0 - Complete Rebuild with ALL 81+ Skills
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
# Agent Identity Kit — OpenClaw Skill
|
||||
|
||||
A portable identity system for AI agents. Create, validate, and publish `agent.json` identity cards.
|
||||
|
||||
## What This Skill Does
|
||||
|
||||
- **Creates** agent identity cards (`agent.json`) via interactive setup
|
||||
- **Validates** identity cards against the Agent Card v1 schema
|
||||
- **Provides** the JSON Schema for editor integration and CI pipelines
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Generate a new agent.json
|
||||
|
||||
```bash
|
||||
./scripts/init.sh
|
||||
```
|
||||
|
||||
Prompts you for name, handle, description, owner, and capabilities. Outputs a valid `agent.json`.
|
||||
|
||||
### Validate an existing agent.json
|
||||
|
||||
```bash
|
||||
./scripts/validate.sh path/to/agent.json
|
||||
```
|
||||
|
||||
Validates the file against `schema/agent.schema.json`. Requires `ajv-cli` (auto-installs if missing).
|
||||
|
||||
## File Structure
|
||||
|
||||
```
|
||||
agent-identity-kit/
|
||||
├── schema/
|
||||
│ └── agent.schema.json # JSON Schema v1 for Agent Cards
|
||||
├── examples/
|
||||
│ ├── kai.agent.json # Full-featured example (Kai @ Reflectt)
|
||||
│ ├── minimal.agent.json # Bare minimum valid card
|
||||
│ └── team.agents.json # Multi-agent team roster
|
||||
├── skill/
|
||||
│ ├── SKILL.md # This file
|
||||
│ └── scripts/
|
||||
│ ├── init.sh # Generate a starter agent.json
|
||||
│ └── validate.sh # Validate against schema
|
||||
└── README.md
|
||||
```
|
||||
|
||||
## Schema Fields
|
||||
|
||||
| Field | Required | Description |
|
||||
|-------|----------|-------------|
|
||||
| `version` | ✅ | Spec version (`"1.0"`) |
|
||||
| `agent.name` | ✅ | Display name |
|
||||
| `agent.handle` | ✅ | Fediverse-style handle (`@name@domain`) |
|
||||
| `agent.description` | ✅ | What the agent does |
|
||||
| `owner.name` | ✅ | Who's accountable |
|
||||
| `capabilities` | — | List of capability tags |
|
||||
| `protocols` | — | Supported protocols (MCP, A2A, HTTP) |
|
||||
| `trust.level` | — | `new`, `active`, `established`, `verified` |
|
||||
| `endpoints.card` | — | Canonical URL of the card |
|
||||
| `links` | — | Website, repo, social links |
|
||||
|
||||
## Hosting Your Card
|
||||
|
||||
Serve your `agent.json` at a well-known URL:
|
||||
|
||||
```
|
||||
https://yourdomain.com/.well-known/agent.json
|
||||
```
|
||||
|
||||
For multiple agents:
|
||||
|
||||
```
|
||||
https://yourdomain.com/.well-known/agents.json
|
||||
```
|
||||
|
||||
## Integration with forAgents.dev
|
||||
|
||||
Register your agent at [foragents.dev](https://foragents.dev) to be indexed in the global agent directory. Verified agents get a badge on their card.
|
||||
|
||||
## Spec Reference
|
||||
|
||||
Full specification: <https://foragents.dev/spec/agent-card>
|
||||
JSON Schema: <https://foragents.dev/schemas/agent-card/v1.json>
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"owner": "ryancampbell",
|
||||
"slug": "agent-identity-kit",
|
||||
"displayName": "Agent Identity Kit",
|
||||
"latest": {
|
||||
"version": "1.0.0",
|
||||
"publishedAt": 1770237862960,
|
||||
"commit": "https://github.com/clawdbot/skills/commit/c932cd228147bdc51a8672c9e75fab93e052c3da"
|
||||
},
|
||||
"history": []
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
{
|
||||
"$schema": "https://foragents.dev/schemas/agent-card/v1.json",
|
||||
"version": "1.0",
|
||||
"agent": {
|
||||
"name": "Kai",
|
||||
"handle": "@kai@reflectt.ai",
|
||||
"description": "Lead coordinator for Team Reflectt. Manages agent team, ships products, writes code, and orchestrates multi-agent workflows.",
|
||||
"avatar": "https://reflectt.ai/agents/kai/avatar.png",
|
||||
"homepage": "https://reflectt.ai/agents/kai"
|
||||
},
|
||||
"owner": {
|
||||
"name": "Reflectt AI",
|
||||
"url": "https://reflectt.ai",
|
||||
"contact": "team@reflectt.ai",
|
||||
"verified": true
|
||||
},
|
||||
"platform": {
|
||||
"runtime": "openclaw",
|
||||
"model": "claude-sonnet-4-20250514",
|
||||
"version": "1.2.0"
|
||||
},
|
||||
"voice": {
|
||||
"name": "Kai",
|
||||
"style": "warm, direct, slightly playful",
|
||||
"preferredTTS": "elevenlabs",
|
||||
"voiceId": "optional-voice-id",
|
||||
"sampleUrl": "https://reflectt.ai/agents/kai/voice-sample.mp3"
|
||||
},
|
||||
"capabilities": [
|
||||
"code-generation",
|
||||
"task-management",
|
||||
"web-search",
|
||||
"file-operations",
|
||||
"team-coordination",
|
||||
"project-planning",
|
||||
"code-review"
|
||||
],
|
||||
"protocols": {
|
||||
"mcp": true,
|
||||
"a2a": false,
|
||||
"agent-card": "1.0",
|
||||
"http": true
|
||||
},
|
||||
"endpoints": {
|
||||
"card": "https://reflectt.ai/.well-known/agent.json",
|
||||
"inbox": "https://reflectt.ai/agents/kai/inbox",
|
||||
"status": "https://reflectt.ai/agents/kai/status"
|
||||
},
|
||||
"trust": {
|
||||
"level": "established",
|
||||
"created": "2026-01-15T00:00:00Z",
|
||||
"verified_by": ["foragents.dev"],
|
||||
"attestations": []
|
||||
},
|
||||
"links": {
|
||||
"website": "https://reflectt.ai",
|
||||
"repo": "https://github.com/itskai-dev",
|
||||
"social": [
|
||||
{
|
||||
"platform": "twitter",
|
||||
"url": "https://x.com/itskai_dev"
|
||||
}
|
||||
],
|
||||
"documentation": "https://foragents.dev/spec/agent-card"
|
||||
},
|
||||
"created_at": "2026-01-15T00:00:00Z",
|
||||
"updated_at": "2026-02-02T00:00:00Z"
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"$schema": "https://foragents.dev/schemas/agent-card/v1.json",
|
||||
"version": "1.0",
|
||||
"agent": {
|
||||
"name": "MyAgent",
|
||||
"handle": "@myagent@example.com",
|
||||
"description": "A minimal agent identity card."
|
||||
},
|
||||
"owner": {
|
||||
"name": "Jane Doe"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
{
|
||||
"$schema": "https://foragents.dev/schemas/agents/v1.json",
|
||||
"version": "1.0",
|
||||
"organization": "Reflectt AI",
|
||||
"agents": [
|
||||
{
|
||||
"name": "Kai",
|
||||
"handle": "@kai@reflectt.ai",
|
||||
"role": "Lead Coordinator",
|
||||
"description": "Manages agent team, ships products, writes code.",
|
||||
"card": "https://reflectt.ai/agents/kai/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Sage",
|
||||
"handle": "@sage@reflectt.ai",
|
||||
"role": "Strategy & Architecture",
|
||||
"description": "Product strategy, system design, and spec definition.",
|
||||
"card": "https://reflectt.ai/agents/sage/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Link",
|
||||
"handle": "@link@reflectt.ai",
|
||||
"role": "Lead Developer",
|
||||
"description": "Full-stack development, API design, infrastructure.",
|
||||
"card": "https://reflectt.ai/agents/link/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Echo",
|
||||
"handle": "@echo@reflectt.ai",
|
||||
"role": "Writer & Documentation",
|
||||
"description": "Technical writing, docs, content creation.",
|
||||
"card": "https://reflectt.ai/agents/echo/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Scout",
|
||||
"handle": "@scout@reflectt.ai",
|
||||
"role": "Research & Intelligence",
|
||||
"description": "Market research, competitive analysis, trend monitoring.",
|
||||
"card": "https://reflectt.ai/agents/scout/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Pixel",
|
||||
"handle": "@pixel@reflectt.ai",
|
||||
"role": "Design & UI",
|
||||
"description": "Visual design, UI/UX, brand identity.",
|
||||
"card": "https://reflectt.ai/agents/pixel/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Harmony",
|
||||
"handle": "@harmony@reflectt.ai",
|
||||
"role": "QA & Testing",
|
||||
"description": "Quality assurance, integration testing, validation.",
|
||||
"card": "https://reflectt.ai/agents/harmony/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Spark",
|
||||
"handle": "@spark@reflectt.ai",
|
||||
"role": "Growth & Marketing",
|
||||
"description": "Content marketing, community building, launch campaigns.",
|
||||
"card": "https://reflectt.ai/agents/spark/agent.json"
|
||||
},
|
||||
{
|
||||
"name": "Rhythm",
|
||||
"handle": "@rhythm@reflectt.ai",
|
||||
"role": "Operations & Workflow",
|
||||
"description": "Task queue management, scheduling, process optimization.",
|
||||
"card": "https://reflectt.ai/agents/rhythm/agent.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,267 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://foragents.dev/schemas/agent-card/v1.json",
|
||||
"title": "Agent Card",
|
||||
"description": "A portable, machine-readable identity document for AI agents. Like llms.txt tells agents about websites, agent.json tells the world about agents.",
|
||||
"type": "object",
|
||||
"required": ["version", "agent", "owner"],
|
||||
"properties": {
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"description": "JSON Schema reference URL"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "Agent Card spec version",
|
||||
"enum": ["1.0"]
|
||||
},
|
||||
"agent": {
|
||||
"type": "object",
|
||||
"description": "Core agent identity information",
|
||||
"required": ["name", "handle", "description"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Display name of the agent",
|
||||
"minLength": 1,
|
||||
"maxLength": 100
|
||||
},
|
||||
"handle": {
|
||||
"type": "string",
|
||||
"description": "Fediverse-style handle (@name@domain)",
|
||||
"pattern": "^@[a-zA-Z0-9_-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"description": "Human-readable description of what the agent does",
|
||||
"maxLength": 500
|
||||
},
|
||||
"avatar": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "URL to agent's avatar image"
|
||||
},
|
||||
"homepage": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "URL to agent's homepage or profile page"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"owner": {
|
||||
"type": "object",
|
||||
"description": "The human or organization accountable for this agent. Every agent MUST have an owner.",
|
||||
"required": ["name"],
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Name of the owner (person or organization)",
|
||||
"minLength": 1
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "Owner's website"
|
||||
},
|
||||
"contact": {
|
||||
"type": "string",
|
||||
"description": "Contact email or URL for the owner"
|
||||
},
|
||||
"verified": {
|
||||
"type": "boolean",
|
||||
"description": "Whether ownership has been verified by a registry",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"platform": {
|
||||
"type": "object",
|
||||
"description": "Runtime platform information",
|
||||
"properties": {
|
||||
"runtime": {
|
||||
"type": "string",
|
||||
"description": "Agent runtime (e.g., openclaw, langchain, autogen, custom)"
|
||||
},
|
||||
"model": {
|
||||
"type": "string",
|
||||
"description": "Primary AI model used (e.g., claude-sonnet-4-20250514, gpt-4)"
|
||||
},
|
||||
"version": {
|
||||
"type": "string",
|
||||
"description": "Runtime or agent software version"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"capabilities": {
|
||||
"type": "array",
|
||||
"description": "List of standardized capability tags describing what the agent can do",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9-]+$"
|
||||
},
|
||||
"uniqueItems": true,
|
||||
"examples": [
|
||||
["code-generation", "web-search", "file-operations", "task-management", "team-coordination"]
|
||||
]
|
||||
},
|
||||
"protocols": {
|
||||
"type": "object",
|
||||
"description": "Interoperability protocols the agent supports",
|
||||
"properties": {
|
||||
"mcp": {
|
||||
"type": "boolean",
|
||||
"description": "Supports Model Context Protocol",
|
||||
"default": false
|
||||
},
|
||||
"a2a": {
|
||||
"type": "boolean",
|
||||
"description": "Supports Google A2A Protocol",
|
||||
"default": false
|
||||
},
|
||||
"agent-card": {
|
||||
"type": "string",
|
||||
"description": "Agent Card spec version supported"
|
||||
},
|
||||
"http": {
|
||||
"type": "boolean",
|
||||
"description": "Supports HTTP API endpoints",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"endpoints": {
|
||||
"type": "object",
|
||||
"description": "URLs for interacting with this agent",
|
||||
"properties": {
|
||||
"card": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "Canonical URL of this Agent Card"
|
||||
},
|
||||
"inbox": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "URL to send messages to this agent"
|
||||
},
|
||||
"status": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "URL to check agent's operational status"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"trust": {
|
||||
"type": "object",
|
||||
"description": "Trust signals and verification status",
|
||||
"properties": {
|
||||
"level": {
|
||||
"type": "string",
|
||||
"description": "Self-declared trust level",
|
||||
"enum": ["new", "active", "established", "verified"],
|
||||
"default": "new"
|
||||
},
|
||||
"created": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "When the agent was first created (ISO 8601)"
|
||||
},
|
||||
"verified_by": {
|
||||
"type": "array",
|
||||
"description": "List of registries or entities that have verified this agent",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"attestations": {
|
||||
"type": "array",
|
||||
"description": "Signed attestations from other agents or services",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"by": { "type": "string" },
|
||||
"at": { "type": "string", "format": "date-time" },
|
||||
"claim": { "type": "string" }
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"voice": {
|
||||
"type": "object",
|
||||
"description": "Voice and audio identity for the agent. Enables TTS-based interactions and audio branding.",
|
||||
"properties": {
|
||||
"name": {
|
||||
"type": "string",
|
||||
"description": "Human-readable name of the voice (e.g., 'Kai', 'Nova')",
|
||||
"maxLength": 100
|
||||
},
|
||||
"style": {
|
||||
"type": "string",
|
||||
"description": "Description of the voice style and personality (e.g., 'warm, direct, slightly playful')",
|
||||
"maxLength": 200
|
||||
},
|
||||
"preferredTTS": {
|
||||
"type": "string",
|
||||
"description": "Preferred TTS provider (e.g., 'elevenlabs', 'openai', 'google', 'azure')"
|
||||
},
|
||||
"voiceId": {
|
||||
"type": "string",
|
||||
"description": "Provider-specific voice identifier for consistent voice reproduction"
|
||||
},
|
||||
"sampleUrl": {
|
||||
"type": "string",
|
||||
"format": "uri",
|
||||
"description": "URL to a sample audio clip demonstrating the agent's voice"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"links": {
|
||||
"type": "object",
|
||||
"description": "Additional links related to the agent",
|
||||
"properties": {
|
||||
"website": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"repo": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"social": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"platform": { "type": "string" },
|
||||
"url": { "type": "string", "format": "uri" }
|
||||
},
|
||||
"required": ["platform", "url"]
|
||||
}
|
||||
},
|
||||
"documentation": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
}
|
||||
},
|
||||
"additionalProperties": true
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "When this Agent Card document was created"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"description": "When this Agent Card document was last updated"
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Agent Identity Kit — Interactive agent.json Generator
|
||||
# Usage: ./init.sh [output_path]
|
||||
|
||||
OUTPUT="${1:-agent.json}"
|
||||
|
||||
echo "🪪 Agent Identity Kit — Create your agent.json"
|
||||
echo "================================================"
|
||||
echo ""
|
||||
|
||||
# Agent info
|
||||
read -rp "Agent name: " AGENT_NAME
|
||||
read -rp "Handle (@name@domain): " AGENT_HANDLE
|
||||
read -rp "Description: " AGENT_DESC
|
||||
|
||||
# Validate handle format
|
||||
if [[ ! "$AGENT_HANDLE" =~ ^@[a-zA-Z0-9_-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$ ]]; then
|
||||
echo "⚠️ Handle should be in @name@domain format (e.g., @myagent@example.com)"
|
||||
echo " Continuing anyway..."
|
||||
fi
|
||||
|
||||
# Owner info
|
||||
echo ""
|
||||
echo "Owner information (who's accountable for this agent):"
|
||||
read -rp "Owner name: " OWNER_NAME
|
||||
read -rp "Owner URL (optional): " OWNER_URL
|
||||
read -rp "Owner contact email (optional): " OWNER_CONTACT
|
||||
|
||||
# Capabilities
|
||||
echo ""
|
||||
echo "Capabilities (comma-separated, e.g., code-generation,web-search,file-operations):"
|
||||
read -rp "Capabilities: " CAPS_RAW
|
||||
|
||||
# Build capabilities JSON array
|
||||
CAPS_JSON="[]"
|
||||
if [ -n "$CAPS_RAW" ]; then
|
||||
IFS=',' read -ra CAPS_ARR <<< "$CAPS_RAW"
|
||||
CAPS_JSON="["
|
||||
FIRST=true
|
||||
for cap in "${CAPS_ARR[@]}"; do
|
||||
cap=$(echo "$cap" | xargs) # trim whitespace
|
||||
if [ "$FIRST" = true ]; then
|
||||
FIRST=false
|
||||
else
|
||||
CAPS_JSON+=","
|
||||
fi
|
||||
CAPS_JSON+="\"$cap\""
|
||||
done
|
||||
CAPS_JSON+="]"
|
||||
fi
|
||||
|
||||
# Platform
|
||||
echo ""
|
||||
read -rp "Runtime (e.g., openclaw, langchain, custom) [openclaw]: " RUNTIME
|
||||
RUNTIME="${RUNTIME:-openclaw}"
|
||||
read -rp "Model (e.g., claude-sonnet-4-20250514) [optional]: " MODEL
|
||||
|
||||
# Trust level
|
||||
echo ""
|
||||
echo "Trust level: new | active | established | verified"
|
||||
read -rp "Trust level [new]: " TRUST_LEVEL
|
||||
TRUST_LEVEL="${TRUST_LEVEL:-new}"
|
||||
|
||||
# Timestamps
|
||||
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
# Build owner JSON
|
||||
OWNER_JSON="{\"name\":\"$OWNER_NAME\""
|
||||
[ -n "$OWNER_URL" ] && OWNER_JSON+=",\"url\":\"$OWNER_URL\""
|
||||
[ -n "$OWNER_CONTACT" ] && OWNER_JSON+=",\"contact\":\"$OWNER_CONTACT\""
|
||||
OWNER_JSON+="}"
|
||||
|
||||
# Build platform JSON
|
||||
PLATFORM_JSON="{\"runtime\":\"$RUNTIME\""
|
||||
[ -n "$MODEL" ] && PLATFORM_JSON+=",\"model\":\"$MODEL\""
|
||||
PLATFORM_JSON+="}"
|
||||
|
||||
# Generate the agent.json
|
||||
cat > "$OUTPUT" << CARD
|
||||
{
|
||||
"\$schema": "https://foragents.dev/schemas/agent-card/v1.json",
|
||||
"version": "1.0",
|
||||
"agent": {
|
||||
"name": "$AGENT_NAME",
|
||||
"handle": "$AGENT_HANDLE",
|
||||
"description": "$AGENT_DESC"
|
||||
},
|
||||
"owner": $OWNER_JSON,
|
||||
"platform": $PLATFORM_JSON,
|
||||
"capabilities": $CAPS_JSON,
|
||||
"protocols": {
|
||||
"mcp": false,
|
||||
"a2a": false,
|
||||
"agent-card": "1.0"
|
||||
},
|
||||
"trust": {
|
||||
"level": "$TRUST_LEVEL",
|
||||
"created": "$NOW",
|
||||
"verified_by": [],
|
||||
"attestations": []
|
||||
},
|
||||
"created_at": "$NOW",
|
||||
"updated_at": "$NOW"
|
||||
}
|
||||
CARD
|
||||
|
||||
echo ""
|
||||
echo "✅ Agent card created: $OUTPUT"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Edit $OUTPUT to add endpoints, links, and more capabilities"
|
||||
echo " 2. Validate: ./scripts/validate.sh $OUTPUT"
|
||||
echo " 3. Host at: https://yourdomain.com/.well-known/agent.json"
|
||||
echo " 4. Register at: https://foragents.dev"
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Agent Identity Kit — Schema Validator
|
||||
# Usage: ./validate.sh <agent.json> [schema.json]
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
||||
|
||||
FILE="${1:-}"
|
||||
SCHEMA="${2:-$REPO_ROOT/schema/agent.schema.json}"
|
||||
|
||||
if [ -z "$FILE" ]; then
|
||||
echo "Usage: validate.sh <agent.json> [schema.json]"
|
||||
echo ""
|
||||
echo "Validates an agent.json file against the Agent Card v1 schema."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
echo "❌ File not found: $FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "$SCHEMA" ]; then
|
||||
echo "❌ Schema not found: $SCHEMA"
|
||||
echo " Expected at: $SCHEMA"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check for validation tool
|
||||
if command -v ajv &> /dev/null; then
|
||||
echo "🔍 Validating $FILE against Agent Card v1 schema..."
|
||||
echo ""
|
||||
if ajv validate -s "$SCHEMA" -d "$FILE" --spec=draft7; then
|
||||
echo ""
|
||||
echo "✅ Valid agent.json!"
|
||||
else
|
||||
echo ""
|
||||
echo "❌ Validation failed. Fix the errors above and try again."
|
||||
exit 1
|
||||
fi
|
||||
elif command -v npx &> /dev/null; then
|
||||
echo "🔍 Validating $FILE against Agent Card v1 schema..."
|
||||
echo " (Using npx ajv-cli — may take a moment on first run)"
|
||||
echo ""
|
||||
if npx ajv-cli validate -s "$SCHEMA" -d "$FILE" --spec=draft7; then
|
||||
echo ""
|
||||
echo "✅ Valid agent.json!"
|
||||
else
|
||||
echo ""
|
||||
echo "❌ Validation failed. Fix the errors above and try again."
|
||||
exit 1
|
||||
fi
|
||||
elif command -v python3 &> /dev/null; then
|
||||
echo "🔍 Validating $FILE against Agent Card v1 schema..."
|
||||
echo ""
|
||||
python3 -c "
|
||||
import json, sys
|
||||
try:
|
||||
from jsonschema import validate, ValidationError
|
||||
except ImportError:
|
||||
print('Installing jsonschema...')
|
||||
import subprocess
|
||||
subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'jsonschema', '-q'])
|
||||
from jsonschema import validate, ValidationError
|
||||
|
||||
with open('$SCHEMA') as f:
|
||||
schema = json.load(f)
|
||||
with open('$FILE') as f:
|
||||
data = json.load(f)
|
||||
|
||||
try:
|
||||
validate(instance=data, schema=schema)
|
||||
print('✅ Valid agent.json!')
|
||||
except ValidationError as e:
|
||||
print(f'❌ Validation failed: {e.message}')
|
||||
print(f' Path: {\" > \".join(str(p) for p in e.absolute_path)}')
|
||||
sys.exit(1)
|
||||
"
|
||||
else
|
||||
echo "❌ No validator found. Install one of:"
|
||||
echo " npm install -g ajv-cli"
|
||||
echo " pip install jsonschema"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user