@powerformer/refly-cli 0.1.24 → 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 +5 -2
- package/dist/bin/refly.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skill/SKILL.md +2 -0
- package/skill/references/execution.md +218 -0
package/package.json
CHANGED
package/skill/SKILL.md
CHANGED
|
@@ -138,6 +138,7 @@ echo "Action completed with status: $STATUS"
|
|
|
138
138
|
├── base/ # Base skill files (this symlink target)
|
|
139
139
|
│ ├── SKILL.md
|
|
140
140
|
│ └── rules/
|
|
141
|
+
│ ├── execution.md
|
|
141
142
|
│ ├── workflow.md
|
|
142
143
|
│ ├── node.md
|
|
143
144
|
│ ├── file.md
|
|
@@ -157,6 +158,7 @@ User intent -> match domain skill (name/trigger) in `~/.claude/skills/`
|
|
|
157
158
|
|
|
158
159
|
## References
|
|
159
160
|
|
|
161
|
+
- `rules/execution.md` - **Skill execution patterns and error handling**
|
|
160
162
|
- `rules/workflow.md` - Workflow command reference
|
|
161
163
|
- `rules/node.md` - Node command reference
|
|
162
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
|