@powerformer/refly-cli 0.1.23 → 0.1.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/refly.js +1564 -232
- package/dist/bin/refly.js.map +1 -1
- package/dist/index.d.ts +18 -0
- package/dist/index.js +1011 -92
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +116 -13
- package/skill/references/execution.md +218 -0
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: refly
|
|
3
|
-
description:
|
|
4
|
-
Base skill for Refly ecosystem: creates, discovers, and runs domain-specific skills bound to workflows.
|
|
5
|
-
Routes user intent to matching domain skills via symlinks in ~/.claude/skills/, delegates execution to Refly backend.
|
|
6
|
-
Use when user asks to: create skills, run workflows, automate multi-step tasks, or manage pipelines.
|
|
7
|
-
Triggers: refly, skill, workflow, run skill, create skill, automation, pipeline.
|
|
8
|
-
Requires: @refly/cli installed and authenticated.
|
|
3
|
+
description: "Base skill for Refly ecosystem: creates, discovers, and runs domain-specific skills bound to workflows. Routes user intent to matching domain skills via symlinks, delegates execution to Refly backend. Use when user asks to: create skills, run workflows, automate multi-step tasks, or manage pipelines. Triggers: refly, skill, workflow, run skill, create skill, automation, pipeline. Requires: @refly/cli installed and authenticated."
|
|
9
4
|
---
|
|
10
5
|
|
|
11
6
|
# Refly
|
|
@@ -18,17 +13,123 @@ description: |
|
|
|
18
13
|
4. **No tokens** - Never print or request auth tokens.
|
|
19
14
|
5. **Stop on error** - If `ok=false`, stop and show `hint`.
|
|
20
15
|
|
|
21
|
-
##
|
|
16
|
+
## Available Commands
|
|
17
|
+
|
|
18
|
+
| Command | ID Format | Description |
|
|
19
|
+
|---------|-----------|-------------|
|
|
20
|
+
| `refly status` | - | Check authentication and connection status |
|
|
21
|
+
| `refly login` | - | Authenticate with Refly |
|
|
22
|
+
| `refly skill list` | - | List all available skills in the marketplace |
|
|
23
|
+
| `refly skill installations` | - | List your installed skills (get installationId here) |
|
|
24
|
+
| `refly skill run --id <installationId> --input '<json>'` | skpi-xxx | Run an installed skill, returns runId (we-xxx) |
|
|
25
|
+
| `refly workflow status <runId> --watch` | we-xxx | Watch workflow execution status |
|
|
26
|
+
| `refly workflow detail <runId>` | we-xxx | Get workflow run details |
|
|
27
|
+
| `refly workflow toolcalls <runId> --files --latest` | we-xxx | Get files from latest toolcall |
|
|
28
|
+
| `refly file download <fileId> -o <path>` | df-xxx | Download a file |
|
|
29
|
+
|
|
30
|
+
**Tip**: Get `installationId` (skpi-xxx) from `refly skill installations`.
|
|
31
|
+
|
|
32
|
+
### Command Options
|
|
33
|
+
|
|
34
|
+
| Command | Option | Description |
|
|
35
|
+
|---------|--------|-------------|
|
|
36
|
+
| `workflow status` | `--watch` | Poll until workflow completes |
|
|
37
|
+
| `workflow status` | `--interval <ms>` | Polling interval in milliseconds (default: 5000) |
|
|
38
|
+
| `workflow toolcalls` | `--files` | Return simplified output with only files and content |
|
|
39
|
+
| `workflow toolcalls` | `--latest` | With `--files`, return only files from the most recent toolcall |
|
|
40
|
+
| `workflow toolcalls` | `--raw` | Disable output sanitization (show full tool outputs) |
|
|
41
|
+
|
|
42
|
+
**Recommended**: Use `--files --latest` to get files from the final output without processing all toolcalls.
|
|
43
|
+
|
|
44
|
+
## Skill Categories & Execution Patterns
|
|
45
|
+
|
|
46
|
+
Choose the execution pattern based on the skill's output type:
|
|
47
|
+
|
|
48
|
+
| Category | Skills | Output | Pattern |
|
|
49
|
+
|----------|--------|--------|---------|
|
|
50
|
+
| **File Generation** | image, video, audio skills | Files (png/mp4/mp3) | Run → Wait → Download → Open |
|
|
51
|
+
| **Text/Data** | search, research, report skills | Text content | Run → Wait → Extract content |
|
|
52
|
+
| **Action** | email, messaging, integration skills | Status confirmation | Run → Wait → Confirm |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### Pattern A: File Generation Skills
|
|
57
|
+
**Use for**: nano-banana-pro, fal-image, fal-video, fal-audio, seedream-image, kling-video, wan-video
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Step 1: Run and capture RUN_ID
|
|
61
|
+
RESULT=$(refly skill run --id <installationId> --input '<json>')
|
|
62
|
+
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
|
|
63
|
+
|
|
64
|
+
# Step 2: Wait for completion
|
|
65
|
+
refly workflow status "$RUN_ID" --watch --interval 30000
|
|
66
|
+
|
|
67
|
+
# Step 3: Get files and download to Desktop
|
|
68
|
+
FILES=$(refly workflow toolcalls "$RUN_ID" --files --latest | jq -r '.payload.files[]')
|
|
69
|
+
echo "$FILES" | jq -c '.' | while read -r file; do
|
|
70
|
+
FILE_ID=$(echo "$file" | jq -r '.fileId')
|
|
71
|
+
FILE_NAME=$(echo "$file" | jq -r '.name')
|
|
72
|
+
if [ -n "$FILE_ID" ] && [ "$FILE_ID" != "null" ]; then
|
|
73
|
+
refly file download "$FILE_ID" -o "$HOME/Desktop/${FILE_NAME}"
|
|
74
|
+
open "$HOME/Desktop/${FILE_NAME}"
|
|
75
|
+
fi
|
|
76
|
+
done
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
### Pattern B: Text/Data Skills
|
|
82
|
+
**Use for**: jina, perplexity, weather-report, exa, research skills
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Step 1: Run and capture RUN_ID
|
|
86
|
+
RESULT=$(refly skill run --id <installationId> --input '<json>')
|
|
87
|
+
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
|
|
88
|
+
|
|
89
|
+
# Step 2: Wait for completion
|
|
90
|
+
refly workflow status "$RUN_ID" --watch --interval 30000
|
|
91
|
+
|
|
92
|
+
# Step 3: Extract text content from toolcalls
|
|
93
|
+
CONTENT=$(refly workflow toolcalls "$RUN_ID" --files --latest | jq -r '.payload.nodes[].content')
|
|
94
|
+
echo "$CONTENT"
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
### Pattern C: Action Skills
|
|
100
|
+
**Use for**: send-email, slack, microsoft-teams, zoom, calendar, CRM integrations
|
|
22
101
|
|
|
23
102
|
```bash
|
|
24
|
-
|
|
25
|
-
refly
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
103
|
+
# Step 1: Run and capture RUN_ID
|
|
104
|
+
RESULT=$(refly skill run --id <installationId> --input '<json>')
|
|
105
|
+
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
|
|
106
|
+
|
|
107
|
+
# Step 2: Wait for completion
|
|
108
|
+
refly workflow status "$RUN_ID" --watch --interval 30000
|
|
109
|
+
|
|
110
|
+
# Step 3: Confirm action status
|
|
111
|
+
STATUS=$(refly workflow detail "$RUN_ID" | jq -r '.payload.status')
|
|
112
|
+
echo "Action completed with status: $STATUS"
|
|
29
113
|
```
|
|
30
114
|
|
|
31
|
-
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
**ID Types:**
|
|
118
|
+
| ID Format | Example | Used For |
|
|
119
|
+
|-----------|---------|----------|
|
|
120
|
+
| `skpi-xxx` | skpi-h9kpmts9ho1kl9l1sohaloeu | `skill run --id` only |
|
|
121
|
+
| `we-xxx` | we-abc123def456 | `workflow status`, `workflow detail`, `workflow toolcalls` |
|
|
122
|
+
| `c-xxx` | c-g6emwcpi1wpalsz6j4gyi3d9 | Browser URL only |
|
|
123
|
+
| `df-xxx` | df-b3yxyelshtwsbxbrkmcqxmx9 | `file download` |
|
|
124
|
+
| `skpe-xxx` | skpe-qga5lpyv59yjzz2ghz2iv9bu | ⚠️ Do NOT use for workflow commands |
|
|
125
|
+
|
|
126
|
+
**Required behavior:**
|
|
127
|
+
- `skill run` returns `RUN_ID` (we-xxx) in `.payload.workflowExecutions[0].id`
|
|
128
|
+
- Use `we-xxx` for all workflow commands (`status`, `detail`, `toolcalls`)
|
|
129
|
+
- Choose execution pattern (A/B/C) based on skill category
|
|
130
|
+
- File skills: Download to `~/Desktop/` and `open` to show user
|
|
131
|
+
- Text skills: Extract `.payload.nodes[].content` for text output
|
|
132
|
+
- Action skills: Confirm `.payload.status` for completion
|
|
32
133
|
|
|
33
134
|
## Directory Structure
|
|
34
135
|
|
|
@@ -37,6 +138,7 @@ Tip: Get `installationId` from `refly skill installations` after installing a sk
|
|
|
37
138
|
├── base/ # Base skill files (this symlink target)
|
|
38
139
|
│ ├── SKILL.md
|
|
39
140
|
│ └── rules/
|
|
141
|
+
│ ├── execution.md
|
|
40
142
|
│ ├── workflow.md
|
|
41
143
|
│ ├── node.md
|
|
42
144
|
│ ├── file.md
|
|
@@ -56,6 +158,7 @@ User intent -> match domain skill (name/trigger) in `~/.claude/skills/`
|
|
|
56
158
|
|
|
57
159
|
## References
|
|
58
160
|
|
|
161
|
+
- `rules/execution.md` - **Skill execution patterns and error handling**
|
|
59
162
|
- `rules/workflow.md` - Workflow command reference
|
|
60
163
|
- `rules/node.md` - Node command reference
|
|
61
164
|
- `rules/file.md` - File command reference
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Skill Execution Reference
|
|
2
|
+
|
|
3
|
+
## Quick Reference
|
|
4
|
+
|
|
5
|
+
| Command | Purpose |
|
|
6
|
+
|---------|---------|
|
|
7
|
+
| `refly skill run --id <skpi-xxx> --input '<json>'` | Run skill, returns RUN_ID |
|
|
8
|
+
| `refly workflow status <we-xxx> --watch --interval 30000` | Wait for completion |
|
|
9
|
+
| `refly workflow detail <we-xxx>` | Get execution details and status |
|
|
10
|
+
| `refly workflow toolcalls <we-xxx> --files --latest` | Get files and text content |
|
|
11
|
+
| `refly file download <df-xxx> -o <path>` | Download file to local path |
|
|
12
|
+
|
|
13
|
+
## ID Formats
|
|
14
|
+
|
|
15
|
+
| Format | Example | Used For |
|
|
16
|
+
|--------|---------|----------|
|
|
17
|
+
| `skpi-xxx` | skpi-h9kpmts9ho1kl9l1sohaloeu | `skill run --id` only |
|
|
18
|
+
| `we-xxx` | we-abc123def456 | `workflow status`, `workflow detail`, `workflow toolcalls` |
|
|
19
|
+
| `c-xxx` | c-g6emwcpi1wpalsz6j4gyi3d9 | Browser URL only (https://refly.ai/workflow/c-xxx) |
|
|
20
|
+
| `df-xxx` | df-b3yxyelshtwsbxbrkmcqxmx9 | `file download` |
|
|
21
|
+
| `skpe-xxx` | skpe-qga5lpyv59yjzz2ghz2iv9bu | **Do NOT use** for workflow commands |
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Standard Execution Flow
|
|
26
|
+
|
|
27
|
+
### Step 1: Run Skill and Get Run ID
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
RESULT=$(refly skill run --id <installationId> --input '{
|
|
31
|
+
"key": "value"
|
|
32
|
+
}')
|
|
33
|
+
|
|
34
|
+
# Check if command succeeded
|
|
35
|
+
if [ "$(echo "$RESULT" | jq -r '.ok')" != "true" ]; then
|
|
36
|
+
echo "Error: $(echo "$RESULT" | jq -r '.error.message')"
|
|
37
|
+
echo "Hint: $(echo "$RESULT" | jq -r '.hint // empty')"
|
|
38
|
+
exit 1
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
RUN_ID=$(echo "$RESULT" | jq -r '.payload.workflowExecutions[0].id')
|
|
42
|
+
echo "Run ID: $RUN_ID"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
**Important**: Run ID is in `.payload.workflowExecutions[0].id` (we-xxx format)
|
|
46
|
+
|
|
47
|
+
### Step 2: Open Workflow in Browser and Wait for Completion
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Open workflow in browser (optional, for monitoring)
|
|
51
|
+
open "https://refly.ai/workflow/<workflowId>"
|
|
52
|
+
|
|
53
|
+
# Poll every 30 seconds until workflow finishes
|
|
54
|
+
refly workflow status "$RUN_ID" --watch --interval 30000
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Step 3: Get Results (Choose Based on Skill Category)
|
|
58
|
+
|
|
59
|
+
Choose the pattern based on the skill's `category` field in SKILL.md:
|
|
60
|
+
- `category: file-generation` → Pattern A
|
|
61
|
+
- `category: text-data` → Pattern B
|
|
62
|
+
- `category: action` → Pattern C
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Pattern A: File Generation Skills
|
|
67
|
+
|
|
68
|
+
**Use for**: Skills with `category: file-generation` (image, video, audio skills)
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Get files from the latest toolcall
|
|
72
|
+
TOOLCALL_RESULT=$(refly workflow toolcalls "$RUN_ID" --files --latest)
|
|
73
|
+
|
|
74
|
+
# Check if files exist
|
|
75
|
+
FILES=$(echo "$TOOLCALL_RESULT" | jq -r '.payload.files // empty')
|
|
76
|
+
if [ -z "$FILES" ] || [ "$FILES" = "null" ]; then
|
|
77
|
+
echo "No files generated. Check workflow status:"
|
|
78
|
+
refly workflow detail "$RUN_ID"
|
|
79
|
+
exit 1
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
# Download and open each file
|
|
83
|
+
echo "$FILES" | jq -c '.[]' | while read -r file; do
|
|
84
|
+
FILE_ID=$(echo "$file" | jq -r '.fileId')
|
|
85
|
+
FILE_NAME=$(echo "$file" | jq -r '.name')
|
|
86
|
+
if [ -n "$FILE_ID" ] && [ "$FILE_ID" != "null" ]; then
|
|
87
|
+
refly file download "$FILE_ID" -o "$HOME/Desktop/${FILE_NAME}"
|
|
88
|
+
echo "Downloaded: $HOME/Desktop/${FILE_NAME}"
|
|
89
|
+
open "$HOME/Desktop/${FILE_NAME}"
|
|
90
|
+
fi
|
|
91
|
+
done
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Expected Output**: Files downloaded to `~/Desktop/` and opened automatically
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Pattern B: Text/Data Skills
|
|
99
|
+
|
|
100
|
+
**Use for**: Skills with `category: text-data` (search, research, report, analytics skills)
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
# Get text content from toolcalls
|
|
104
|
+
TOOLCALL_RESULT=$(refly workflow toolcalls "$RUN_ID" --files --latest)
|
|
105
|
+
|
|
106
|
+
# Extract content from nodes
|
|
107
|
+
CONTENT=$(echo "$TOOLCALL_RESULT" | jq -r '.payload.nodes[].content // empty')
|
|
108
|
+
if [ -z "$CONTENT" ]; then
|
|
109
|
+
echo "No content returned. Check workflow status:"
|
|
110
|
+
refly workflow detail "$RUN_ID"
|
|
111
|
+
exit 1
|
|
112
|
+
fi
|
|
113
|
+
|
|
114
|
+
echo "$CONTENT"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Expected Output**: Text content displayed to user
|
|
118
|
+
|
|
119
|
+
---
|
|
120
|
+
|
|
121
|
+
## Pattern C: Action Skills
|
|
122
|
+
|
|
123
|
+
**Use for**: Skills with `category: action` (email, messaging, CRM integration skills)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
# Confirm action completed
|
|
127
|
+
DETAIL=$(refly workflow detail "$RUN_ID")
|
|
128
|
+
STATUS=$(echo "$DETAIL" | jq -r '.payload.status')
|
|
129
|
+
|
|
130
|
+
if [ "$STATUS" = "finish" ]; then
|
|
131
|
+
echo "Action completed successfully"
|
|
132
|
+
else
|
|
133
|
+
echo "Action status: $STATUS"
|
|
134
|
+
echo "$DETAIL" | jq '.payload'
|
|
135
|
+
fi
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Expected Output**: Status confirmation (finish = success)
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Workflow Status Values
|
|
143
|
+
|
|
144
|
+
| Status | Description | Action |
|
|
145
|
+
|--------|-------------|--------|
|
|
146
|
+
| `init` | Workflow is initializing | Wait |
|
|
147
|
+
| `executing` | Workflow is running | Wait |
|
|
148
|
+
| `finish` | Workflow completed successfully | Get results |
|
|
149
|
+
| `failed` | Workflow encountered an error | Check error details |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Error Handling
|
|
154
|
+
|
|
155
|
+
### Check CLI Response
|
|
156
|
+
```bash
|
|
157
|
+
RESULT=$(refly skill run --id <installationId> --input '<json>')
|
|
158
|
+
if [ "$(echo "$RESULT" | jq -r '.ok')" != "true" ]; then
|
|
159
|
+
echo "Error: $(echo "$RESULT" | jq -r '.error.message')"
|
|
160
|
+
echo "Hint: $(echo "$RESULT" | jq -r '.hint // empty')"
|
|
161
|
+
fi
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Check Workflow Failed
|
|
165
|
+
```bash
|
|
166
|
+
DETAIL=$(refly workflow detail "$RUN_ID")
|
|
167
|
+
STATUS=$(echo "$DETAIL" | jq -r '.payload.status')
|
|
168
|
+
if [ "$STATUS" = "failed" ]; then
|
|
169
|
+
echo "Workflow failed. Details:"
|
|
170
|
+
echo "$DETAIL" | jq '.payload.nodes[] | select(.status == "failed")'
|
|
171
|
+
fi
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### No Files or Content Returned
|
|
175
|
+
```bash
|
|
176
|
+
# Get verbose output to debug
|
|
177
|
+
refly workflow toolcalls "$RUN_ID" --raw
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## Troubleshooting
|
|
183
|
+
|
|
184
|
+
### Get Full Workflow Details
|
|
185
|
+
```bash
|
|
186
|
+
refly workflow detail "$RUN_ID"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Get All Toolcalls (Verbose)
|
|
190
|
+
```bash
|
|
191
|
+
refly workflow toolcalls "$RUN_ID" --raw
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Filter Toolcalls by Status
|
|
195
|
+
```bash
|
|
196
|
+
refly workflow toolcalls "$RUN_ID" --status completed
|
|
197
|
+
refly workflow toolcalls "$RUN_ID" --status failed
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Check Authentication
|
|
201
|
+
```bash
|
|
202
|
+
refly status
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### List Installed Skills
|
|
206
|
+
```bash
|
|
207
|
+
refly skill installations
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Required Behavior
|
|
213
|
+
|
|
214
|
+
1. **CLI only** - Use `refly <command>`, never call API directly
|
|
215
|
+
2. **Trust JSON** - Only trust CLI JSON (`ok`, `payload`, `error`, `hint`)
|
|
216
|
+
3. **No fabricated IDs** - Never invent workflow/run/node IDs
|
|
217
|
+
4. **Stop on error** - If `ok=false`, stop and show `hint`
|
|
218
|
+
5. **Use correct IDs** - `skpi-xxx` for run, `we-xxx` for workflow commands
|