@powerformer/refly-cli 0.1.4 → 0.1.6
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 +334 -114
- package/dist/bin/refly.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -3
- package/skill/SKILL.md +37 -227
- package/skill/references/file.md +20 -0
- package/skill/references/node.md +46 -0
- package/skill/references/skill.md +119 -0
- package/skill/references/workflow.md +82 -0
- package/skill/registry.json +15 -0
- package/skill/references/api-errors.md +0 -120
- package/skill/references/node-types.md +0 -91
- package/skill/references/workflow-schema.md +0 -95
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
# API Errors Reference
|
|
2
|
-
|
|
3
|
-
All CLI errors use stable error codes for reliable error handling.
|
|
4
|
-
|
|
5
|
-
## Error Response Format
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"ok": false,
|
|
10
|
-
"type": "error",
|
|
11
|
-
"version": "1.0",
|
|
12
|
-
"error": {
|
|
13
|
-
"code": "ERROR_CODE",
|
|
14
|
-
"message": "Human-readable description",
|
|
15
|
-
"details": { },
|
|
16
|
-
"hint": "Suggested action"
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Error Codes
|
|
22
|
-
|
|
23
|
-
### Authentication Errors
|
|
24
|
-
|
|
25
|
-
| Code | Description | Hint |
|
|
26
|
-
|------|-------------|------|
|
|
27
|
-
| AUTH_REQUIRED | Not authenticated or token expired | Run `refly login` |
|
|
28
|
-
| AUTH_INVALID | Invalid credentials | Check API key |
|
|
29
|
-
| AUTH_EXPIRED | Token has expired | Run `refly login` |
|
|
30
|
-
|
|
31
|
-
### CLI Errors
|
|
32
|
-
|
|
33
|
-
| Code | Description | Hint |
|
|
34
|
-
|------|-------------|------|
|
|
35
|
-
| CLI_NOT_FOUND | CLI not installed or not in PATH | Run `npm i -g @refly/cli` |
|
|
36
|
-
| CONFIG_ERROR | Configuration file corrupted | Run `refly init` |
|
|
37
|
-
| VERSION_MISMATCH | CLI version incompatible with API | Run `npm update -g @refly/cli` |
|
|
38
|
-
|
|
39
|
-
### Builder Errors
|
|
40
|
-
|
|
41
|
-
| Code | Description | Hint |
|
|
42
|
-
|------|-------------|------|
|
|
43
|
-
| BUILDER_NOT_STARTED | No active builder session | Run `refly builder start` |
|
|
44
|
-
| BUILDER_ALREADY_STARTED | Builder session already exists | Run `refly builder abort` first |
|
|
45
|
-
| VALIDATION_REQUIRED | Must validate before commit | Run `refly builder validate` |
|
|
46
|
-
| VALIDATION_ERROR | DAG validation failed | See error details |
|
|
47
|
-
| DUPLICATE_NODE_ID | Node ID already exists | Use unique node ID |
|
|
48
|
-
| NODE_NOT_FOUND | Referenced node does not exist | Check node ID |
|
|
49
|
-
| CYCLE_DETECTED | Circular dependency in DAG | Remove cycle |
|
|
50
|
-
| INVALID_STATE | Invalid state transition | Check `refly builder status` |
|
|
51
|
-
|
|
52
|
-
### Workflow Errors
|
|
53
|
-
|
|
54
|
-
| Code | Description | Hint |
|
|
55
|
-
|------|-------------|------|
|
|
56
|
-
| WORKFLOW_NOT_FOUND | Workflow does not exist | Check workflow ID |
|
|
57
|
-
| WORKFLOW_EXISTS | Workflow name already taken | Use different name |
|
|
58
|
-
| RUN_NOT_FOUND | Workflow run does not exist | Check run ID |
|
|
59
|
-
| RUN_FAILED | Workflow execution failed | Check run details |
|
|
60
|
-
| RUN_ABORTED | Workflow was aborted | - |
|
|
61
|
-
|
|
62
|
-
### Node Errors
|
|
63
|
-
|
|
64
|
-
| Code | Description | Hint |
|
|
65
|
-
|------|-------------|------|
|
|
66
|
-
| INVALID_NODE_TYPE | Unknown node type | Run `refly node types` |
|
|
67
|
-
| INVALID_NODE_INPUT | Node input validation failed | Check input schema |
|
|
68
|
-
| NODE_EXECUTION_ERROR | Node execution failed | See error details |
|
|
69
|
-
|
|
70
|
-
### Network Errors
|
|
71
|
-
|
|
72
|
-
| Code | Description | Hint |
|
|
73
|
-
|------|-------------|------|
|
|
74
|
-
| NETWORK_ERROR | Cannot connect to API | Check internet connection |
|
|
75
|
-
| TIMEOUT | Request timed out | Retry later |
|
|
76
|
-
| API_ERROR | API returned error | See error message |
|
|
77
|
-
|
|
78
|
-
### General Errors
|
|
79
|
-
|
|
80
|
-
| Code | Description | Hint |
|
|
81
|
-
|------|-------------|------|
|
|
82
|
-
| NOT_FOUND | Resource not found | Verify resource ID |
|
|
83
|
-
| CONFLICT | Resource conflict | Refresh and retry |
|
|
84
|
-
| PERMISSION_DENIED | Insufficient permissions | Check access rights |
|
|
85
|
-
| INVALID_INPUT | Invalid input data | Check input format |
|
|
86
|
-
| INTERNAL_ERROR | Unexpected error | Report issue |
|
|
87
|
-
|
|
88
|
-
## Handling Errors
|
|
89
|
-
|
|
90
|
-
### In Claude Code
|
|
91
|
-
|
|
92
|
-
When `ok=false`:
|
|
93
|
-
1. Do NOT proceed with the operation
|
|
94
|
-
2. Show the user the `error.message`
|
|
95
|
-
3. Suggest the action in `error.hint`
|
|
96
|
-
4. If `error.details` exists, include relevant information
|
|
97
|
-
|
|
98
|
-
### Example Error Handling
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
# Check status before operations
|
|
102
|
-
result=$(refly status)
|
|
103
|
-
if [ "$(echo $result | jq -r '.ok')" = "false" ]; then
|
|
104
|
-
code=$(echo $result | jq -r '.error.code')
|
|
105
|
-
hint=$(echo $result | jq -r '.error.hint')
|
|
106
|
-
echo "Error: $code. Try: $hint"
|
|
107
|
-
exit 1
|
|
108
|
-
fi
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Exit Codes
|
|
112
|
-
|
|
113
|
-
| Exit Code | Meaning |
|
|
114
|
-
|-----------|---------|
|
|
115
|
-
| 0 | Success |
|
|
116
|
-
| 1 | General error |
|
|
117
|
-
| 2 | Authentication error |
|
|
118
|
-
| 3 | Validation error |
|
|
119
|
-
| 4 | Network error |
|
|
120
|
-
| 5 | Not found |
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
# Node Types Reference
|
|
2
|
-
|
|
3
|
-
This document describes the available node types for Refly workflows.
|
|
4
|
-
|
|
5
|
-
## Fetching Node Types
|
|
6
|
-
|
|
7
|
-
Use the CLI to get the current list of supported node types:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
refly node types
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
Response:
|
|
14
|
-
```json
|
|
15
|
-
{
|
|
16
|
-
"ok": true,
|
|
17
|
-
"type": "node.types",
|
|
18
|
-
"version": "1.0",
|
|
19
|
-
"payload": {
|
|
20
|
-
"types": [
|
|
21
|
-
{
|
|
22
|
-
"name": "document.parse",
|
|
23
|
-
"description": "Parse document content",
|
|
24
|
-
"inputSchema": { ... },
|
|
25
|
-
"outputSchema": { ... }
|
|
26
|
-
}
|
|
27
|
-
]
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Node Type Cache
|
|
33
|
-
|
|
34
|
-
- Location: `~/.refly/cache/node-types.json`
|
|
35
|
-
- TTL: 24 hours
|
|
36
|
-
- Force refresh: `refly node types --refresh`
|
|
37
|
-
|
|
38
|
-
## Common Node Categories
|
|
39
|
-
|
|
40
|
-
### Document Processing
|
|
41
|
-
- `document.parse` - Parse various document formats
|
|
42
|
-
- `document.export` - Export to different formats
|
|
43
|
-
- `document.split` - Split document into chunks
|
|
44
|
-
|
|
45
|
-
### LLM Operations
|
|
46
|
-
- `llm.summarize` - Summarize text content
|
|
47
|
-
- `llm.translate` - Translate content
|
|
48
|
-
- `llm.generate` - Generate content from prompt
|
|
49
|
-
- `llm.chat` - Interactive chat completion
|
|
50
|
-
|
|
51
|
-
### Data Operations
|
|
52
|
-
- `data.input` - Accept external input
|
|
53
|
-
- `data.output` - Produce workflow output
|
|
54
|
-
- `data.merge` - Merge multiple inputs
|
|
55
|
-
- `data.filter` - Filter data by criteria
|
|
56
|
-
- `data.transform` - Transform data structure
|
|
57
|
-
|
|
58
|
-
### Control Flow
|
|
59
|
-
- `control.condition` - Conditional branching
|
|
60
|
-
- `control.loop` - Iterate over items
|
|
61
|
-
- `control.parallel` - Parallel execution
|
|
62
|
-
|
|
63
|
-
## Testing Nodes
|
|
64
|
-
|
|
65
|
-
Run a single node for debugging:
|
|
66
|
-
|
|
67
|
-
```bash
|
|
68
|
-
refly node run --type "llm.summarize" --input '{"text": "Long text here..."}'
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
Response:
|
|
72
|
-
```json
|
|
73
|
-
{
|
|
74
|
-
"ok": true,
|
|
75
|
-
"type": "node.run",
|
|
76
|
-
"version": "1.0",
|
|
77
|
-
"payload": {
|
|
78
|
-
"result": { ... },
|
|
79
|
-
"metrics": {
|
|
80
|
-
"durationMs": 1234,
|
|
81
|
-
"tokensUsed": 500
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Notes
|
|
88
|
-
|
|
89
|
-
- Node types depend on your Refly backend configuration
|
|
90
|
-
- Some nodes may require specific permissions
|
|
91
|
-
- Input/output schemas are validated at runtime
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
# Workflow Schema Reference
|
|
2
|
-
|
|
3
|
-
This document defines the canonical workflow spec used by `refly workflow create --spec`.
|
|
4
|
-
|
|
5
|
-
## Spec Shape (v1)
|
|
6
|
-
|
|
7
|
-
```json
|
|
8
|
-
{
|
|
9
|
-
"version": 1,
|
|
10
|
-
"name": "string (required)",
|
|
11
|
-
"description": "string (optional)",
|
|
12
|
-
"nodes": [
|
|
13
|
-
{
|
|
14
|
-
"id": "string (required, unique)",
|
|
15
|
-
"type": "string (required, must be valid node type)",
|
|
16
|
-
"input": "object (required, node-specific configuration)",
|
|
17
|
-
"dependsOn": "string[] (optional, list of node IDs)"
|
|
18
|
-
}
|
|
19
|
-
],
|
|
20
|
-
"metadata": {
|
|
21
|
-
"tags": "string[] (optional)",
|
|
22
|
-
"owner": "string (optional)"
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Field Descriptions
|
|
28
|
-
|
|
29
|
-
### Top-level Fields
|
|
30
|
-
|
|
31
|
-
| Field | Type | Required | Description |
|
|
32
|
-
|-------|------|----------|-------------|
|
|
33
|
-
| version | number | Yes | Schema version, currently `1` |
|
|
34
|
-
| name | string | Yes | Workflow name, must be unique per user |
|
|
35
|
-
| description | string | No | Human-readable description |
|
|
36
|
-
| nodes | array | Yes | List of workflow nodes |
|
|
37
|
-
| metadata | object | No | Additional metadata |
|
|
38
|
-
|
|
39
|
-
### Node Fields
|
|
40
|
-
|
|
41
|
-
| Field | Type | Required | Description |
|
|
42
|
-
|-------|------|----------|-------------|
|
|
43
|
-
| id | string | Yes | Unique identifier within workflow |
|
|
44
|
-
| type | string | Yes | Node type from `refly node types` |
|
|
45
|
-
| input | object | Yes | Node-specific input configuration |
|
|
46
|
-
| dependsOn | string[] | No | IDs of nodes that must complete first |
|
|
47
|
-
|
|
48
|
-
## DAG Rules
|
|
49
|
-
|
|
50
|
-
1. **Unique IDs**: Each node `id` must be unique within the workflow
|
|
51
|
-
2. **No Cycles**: The dependency graph must be acyclic
|
|
52
|
-
3. **Valid References**: All `dependsOn` entries must reference existing node IDs
|
|
53
|
-
4. **No Self-Reference**: A node cannot depend on itself
|
|
54
|
-
5. **Valid Types**: All `type` values must be in the allowed node types list
|
|
55
|
-
|
|
56
|
-
## Examples
|
|
57
|
-
|
|
58
|
-
### Simple Sequential Workflow
|
|
59
|
-
|
|
60
|
-
```json
|
|
61
|
-
{
|
|
62
|
-
"version": 1,
|
|
63
|
-
"name": "document-processor",
|
|
64
|
-
"nodes": [
|
|
65
|
-
{ "id": "parse", "type": "document.parse", "input": { "format": "pdf" } },
|
|
66
|
-
{ "id": "summarize", "type": "llm.summarize", "input": {}, "dependsOn": ["parse"] },
|
|
67
|
-
{ "id": "export", "type": "document.export", "input": { "format": "md" }, "dependsOn": ["summarize"] }
|
|
68
|
-
]
|
|
69
|
-
}
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Parallel Processing
|
|
73
|
-
|
|
74
|
-
```json
|
|
75
|
-
{
|
|
76
|
-
"version": 1,
|
|
77
|
-
"name": "parallel-analysis",
|
|
78
|
-
"nodes": [
|
|
79
|
-
{ "id": "input", "type": "data.input", "input": {} },
|
|
80
|
-
{ "id": "analyze-a", "type": "analyze.sentiment", "input": {}, "dependsOn": ["input"] },
|
|
81
|
-
{ "id": "analyze-b", "type": "analyze.keywords", "input": {}, "dependsOn": ["input"] },
|
|
82
|
-
{ "id": "merge", "type": "data.merge", "input": {}, "dependsOn": ["analyze-a", "analyze-b"] }
|
|
83
|
-
]
|
|
84
|
-
}
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Validation Errors
|
|
88
|
-
|
|
89
|
-
| Error | Description |
|
|
90
|
-
|-------|-------------|
|
|
91
|
-
| DUPLICATE_NODE_ID | Two nodes have the same ID |
|
|
92
|
-
| INVALID_NODE_TYPE | Node type not in allowed list |
|
|
93
|
-
| MISSING_DEPENDENCY | dependsOn references non-existent node |
|
|
94
|
-
| CYCLE_DETECTED | Circular dependency found |
|
|
95
|
-
| MISSING_REQUIRED_FIELD | Required field is missing |
|