Skip to content

Commit 4f91e63

Browse files
authored
Merge pull request #6 from Gladium-AI/codex/flare-edge-cli-skill
feat: add flare-edge-cli agent skill
2 parents 7cc5dbc + bc2b8d2 commit 4f91e63

8 files changed

Lines changed: 321 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
.env.*
44
.idea/
55
.vscode/
6-
flare-edge-cli
6+
/flare-edge-cli
77
bin/
88
coverage.out
99
dist/

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ Prebuilt release archives are attached automatically for:
9191

9292
Release downloads are published on the [GitHub Releases](https://github.com/Gladium-AI/flare-edge-cli/releases) page.
9393

94+
Install the Claude Code skill:
95+
96+
```bash
97+
curl -fsSL https://raw.githubusercontent.com/Gladium-AI/flare-edge-cli/main/install-skill.sh | sh
98+
```
99+
100+
That installs the skill to `~/.claude/skills/flare-edge-cli` by default. Override the target directory with `SKILLS_DIR=/path/to/skills`.
101+
94102
Build from source from the repository root:
95103

96104
```bash

install-skill.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
set -eu
3+
4+
REPO="${REPO:-Gladium-AI/flare-edge-cli}"
5+
REF="${REF:-main}"
6+
SKILL_NAME="${SKILL_NAME:-flare-edge-cli}"
7+
SKILL_PATH="${SKILL_PATH:-skills/${SKILL_NAME}}"
8+
SKILLS_DIR="${SKILLS_DIR:-${CLAUDE_CODE_SKILLS_DIR:-$HOME/.claude/skills}}"
9+
10+
download() {
11+
url="$1"
12+
out="$2"
13+
14+
if command -v curl >/dev/null 2>&1; then
15+
curl -fsSL "$url" -o "$out"
16+
return
17+
fi
18+
19+
if command -v wget >/dev/null 2>&1; then
20+
wget -q "$url" -O "$out"
21+
return
22+
fi
23+
24+
echo "Error: curl or wget is required" >&2
25+
exit 1
26+
}
27+
28+
copy_skill() {
29+
src="$1"
30+
dst="${SKILLS_DIR}/${SKILL_NAME}"
31+
32+
mkdir -p "$SKILLS_DIR"
33+
rm -rf "$dst"
34+
cp -R "$src" "$dst"
35+
printf 'Installed skill to %s\n' "$dst"
36+
}
37+
38+
if [ -n "${SOURCE_DIR:-}" ]; then
39+
src="${SOURCE_DIR%/}/${SKILL_PATH}"
40+
if [ ! -d "$src" ]; then
41+
echo "Error: skill directory not found at $src" >&2
42+
exit 1
43+
fi
44+
copy_skill "$src"
45+
exit 0
46+
fi
47+
48+
tmpdir="$(mktemp -d)"
49+
trap 'rm -rf "$tmpdir"' EXIT INT TERM
50+
51+
archive="$tmpdir/repo.tar.gz"
52+
url="https://codeload.github.com/${REPO}/tar.gz/refs/heads/${REF}"
53+
54+
download "$url" "$archive"
55+
tar -xzf "$archive" -C "$tmpdir"
56+
57+
root_dir="$(find "$tmpdir" -mindepth 1 -maxdepth 1 -type d | head -n 1)"
58+
if [ -z "$root_dir" ]; then
59+
echo "Error: could not extract repository archive" >&2
60+
exit 1
61+
fi
62+
63+
src="${root_dir}/${SKILL_PATH}"
64+
if [ ! -d "$src" ]; then
65+
echo "Error: skill directory not found in downloaded archive: $src" >&2
66+
exit 1
67+
fi
68+
69+
copy_skill "$src"

skills/flare-edge-cli/SKILL.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
name: flare-edge-cli
3+
description: Use this skill when the task is to scaffold, validate, build, develop, deploy, inspect, operate, or tear down Go-based Cloudflare Workers with flare-edge-cli. Trigger on requests about Cloudflare edge functions, Go/Wasm Workers, Workers AI in Go, or cleanup of ephemeral Cloudflare resources created through flare-edge-cli.
4+
license: MIT
5+
metadata:
6+
author: Gladium AI
7+
version: 1.0.0
8+
category: developer-tools
9+
tags:
10+
- cloudflare
11+
- workers
12+
- golang
13+
- wasm
14+
- workers-ai
15+
- deployment
16+
---
17+
18+
# Flare Edge CLI
19+
20+
Use this skill to operate `flare-edge-cli` safely and consistently.
21+
22+
## Use This Skill For
23+
24+
- Creating a new Go-based Cloudflare Worker project
25+
- Validating Go-for-Wasm compatibility before build or deploy
26+
- Building and running local dev flows for Workers
27+
- Deploying or operating KV, D1, R2, routes, secrets, releases, and logs
28+
- Creating or testing Go-based Workers AI projects
29+
- Tearing down disposable Workers and attached side effects
30+
31+
## Core Rules
32+
33+
- Prefer `flare-edge-cli` over raw `wrangler` when the task fits the CLI surface.
34+
- Prefer `--json` output when another agent or program will consume the result.
35+
- Keep project work scoped to an explicit `--path` when you are not already inside the generated project directory.
36+
- Do not run `auth logout --all` unless the user explicitly asks to clear Cloudflare auth.
37+
- For disposable test environments, finish with `flare-edge-cli teardown` so remote side effects are removed.
38+
- If a task involves real Cloudflare AI usage, note that local dev still uses remote Workers AI and may incur charges.
39+
40+
## Quick Workflow
41+
42+
1. Verify prerequisites.
43+
2. Initialize or inspect the project.
44+
3. Run compatibility and build checks.
45+
4. Use `dev` for local validation.
46+
5. Use `deploy` for live rollout.
47+
6. Use service-specific commands for KV, D1, R2, secrets, routes, logs, and releases.
48+
7. Use `teardown` for cleanup when the environment is temporary.
49+
50+
## Prerequisites
51+
52+
- `flare-edge-cli` available on `PATH`, or use the repo-local binary/build path.
53+
- Go installed.
54+
- Wrangler installed.
55+
- Cloudflare auth already configured.
56+
57+
For the latest install flow and release-binary behavior, see [references/install-and-release.md](references/install-and-release.md).
58+
59+
## Standard Command Path
60+
61+
For a standard Worker:
62+
63+
```bash
64+
flare-edge-cli doctor --json
65+
flare-edge-cli project init my-worker --template edge-http
66+
flare-edge-cli compat check --path ./my-worker --json
67+
flare-edge-cli build --path ./my-worker --json
68+
flare-edge-cli dev --path ./my-worker --local
69+
flare-edge-cli deploy --path ./my-worker --json
70+
```
71+
72+
For an AI Worker:
73+
74+
```bash
75+
flare-edge-cli project init my-ai-worker --template ai-chat
76+
flare-edge-cli build --path ./my-ai-worker --json
77+
flare-edge-cli dev --path ./my-ai-worker --local
78+
flare-edge-cli deploy --path ./my-ai-worker --json
79+
```
80+
81+
Load [references/ai-workers.md](references/ai-workers.md) when the task is about AI templates, current model defaults, or how to test Workers AI locally.
82+
83+
## Cleanup
84+
85+
If you create temporary infrastructure or disposable test projects, tear them down explicitly:
86+
87+
```bash
88+
flare-edge-cli teardown --path ./my-worker --json
89+
```
90+
91+
Use `--keep-bindings` only when the user wants to preserve KV, D1, or R2 resources.
92+
93+
## Troubleshooting
94+
95+
- Start with `flare-edge-cli doctor`.
96+
- If deployment succeeds but the Worker fails at runtime, use `flare-edge-cli logs tail`.
97+
- If a command mutates Cloudflare resources, verify whether the target project path and Worker name are correct before rerunning it.
98+
- If a project mixes manual Wrangler edits with CLI-managed config, inspect both `flare-edge.json` and `wrangler.jsonc`.
99+
100+
For common command sequences and operational guidance, read [references/workflows.md](references/workflows.md).
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
interface:
2+
display_name: "Flare Edge CLI"
3+
short_description: "Operate Go-based Cloudflare Workers and AI Workers with flare-edge-cli"
4+
default_prompt: "Use flare-edge-cli to scaffold, validate, build, deploy, test, or tear down a Go-based Cloudflare Worker and return the concrete commands, outputs, and cleanup actions."
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# AI Workers With Flare Edge CLI
2+
3+
`flare-edge-cli` supports first-class Workers AI scaffolds for Go/Wasm Workers.
4+
5+
## Supported AI Templates
6+
7+
- `ai-text`
8+
- `ai-chat`
9+
- `ai-vision`
10+
- `ai-stt`
11+
- `ai-tts`
12+
- `ai-image`
13+
- `ai-embeddings`
14+
15+
## Current Default Models
16+
17+
- `ai-text` / `ai-chat`: `@cf/moonshotai/kimi-k2.5`
18+
- `ai-vision`: `@cf/moonshotai/kimi-k2.5`
19+
- `ai-stt`: `@cf/deepgram/nova-3`
20+
- `ai-tts`: `@cf/deepgram/aura-2-en`
21+
- `ai-image`: `@cf/black-forest-labs/flux-2-klein-9b`
22+
- `ai-embeddings`: `@cf/qwen/qwen3-embedding-0.6b`
23+
24+
## Local Testing Guidance
25+
26+
- `flare-edge-cli dev --local` still uses the remote Cloudflare AI binding.
27+
- Expect real account usage and potential charges during local testing.
28+
- First request in a fresh `wrangler dev` session may prompt for Cloudflare account selection.
29+
30+
## Typical AI Workflow
31+
32+
```bash
33+
flare-edge-cli project init demo-ai --template ai-chat
34+
flare-edge-cli build --path ./demo-ai --json
35+
flare-edge-cli dev --path ./demo-ai --local
36+
```
37+
38+
Then test the local endpoint with a simple request, for example:
39+
40+
```bash
41+
curl 'http://127.0.0.1:8787/?prompt=Reply%20with%20OK'
42+
```
43+
44+
## Cleanup
45+
46+
If the AI Worker was created for a temporary run, prefer:
47+
48+
```bash
49+
flare-edge-cli teardown --path ./demo-ai --json
50+
```
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Install And Release
2+
3+
## Install Options
4+
5+
One-line installer:
6+
7+
```bash
8+
curl -fsSL https://raw.githubusercontent.com/Gladium-AI/flare-edge-cli/main/install.sh | sh
9+
```
10+
11+
Source build:
12+
13+
```bash
14+
make build
15+
make install
16+
```
17+
18+
## Release Assets
19+
20+
GitHub releases publish binaries for:
21+
22+
- `linux/amd64`
23+
- `linux/arm64`
24+
- `darwin/amd64`
25+
- `darwin/arm64`
26+
- `windows/amd64`
27+
- `windows/arm64`
28+
29+
Release assets are attached automatically by the GitHub Actions release workflow when a GitHub release is published.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Flare Edge CLI Workflows
2+
3+
Use these patterns when operating `flare-edge-cli` projects.
4+
5+
## 1. Bootstrap a Standard Worker
6+
7+
```bash
8+
flare-edge-cli doctor --json
9+
flare-edge-cli project init hello-edge --template edge-http
10+
flare-edge-cli compat check --path ./hello-edge --json
11+
flare-edge-cli build --path ./hello-edge --json
12+
flare-edge-cli dev --path ./hello-edge --local
13+
flare-edge-cli deploy --path ./hello-edge --json
14+
```
15+
16+
## 2. Bootstrap an AI Worker
17+
18+
```bash
19+
flare-edge-cli project init hello-ai --template ai-chat
20+
flare-edge-cli build --path ./hello-ai --json
21+
flare-edge-cli dev --path ./hello-ai --local
22+
flare-edge-cli deploy --path ./hello-ai --json
23+
```
24+
25+
## 3. Operate an Existing Project
26+
27+
```bash
28+
flare-edge-cli project info --path ./hello-edge --json
29+
flare-edge-cli compat check --path ./hello-edge --json
30+
flare-edge-cli build --path ./hello-edge --json
31+
flare-edge-cli logs tail --path ./hello-edge
32+
```
33+
34+
## 4. Provision Data Resources
35+
36+
```bash
37+
flare-edge-cli kv namespace create CACHE --path ./hello-edge --json
38+
flare-edge-cli d1 create DB --path ./hello-edge --json
39+
flare-edge-cli r2 bucket create FILES --path ./hello-edge --json
40+
```
41+
42+
## 5. Safe Cleanup
43+
44+
For temporary resources created during tests or agent workflows:
45+
46+
```bash
47+
flare-edge-cli teardown --path ./hello-edge --json
48+
```
49+
50+
If the local project should also be removed:
51+
52+
```bash
53+
flare-edge-cli teardown --path ./hello-edge --delete-project --json
54+
```
55+
56+
## Notes
57+
58+
- Prefer `--json` for machine consumption.
59+
- Prefer `--path` over relying on the current working directory when the target project is not obvious.
60+
- Use `doctor` early if auth or tooling health is uncertain.

0 commit comments

Comments
 (0)