@powerformer/refly-cli 0.1.20 → 0.1.22
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 +12 -142
- package/dist/bin/refly.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -2
package/dist/bin/refly.js
CHANGED
|
@@ -8997,8 +8997,8 @@ var ConfigSchema = external_exports.object({
|
|
|
8997
8997
|
installedAt: external_exports.string().optional()
|
|
8998
8998
|
}).optional()
|
|
8999
8999
|
});
|
|
9000
|
-
var DEFAULT_API_ENDPOINT = "https://
|
|
9001
|
-
var DEFAULT_WEB_URL = "https://refly.
|
|
9000
|
+
var DEFAULT_API_ENDPOINT = "https://staging-api.refly.ai";
|
|
9001
|
+
var DEFAULT_WEB_URL = "https://staging.refly.ai";
|
|
9002
9002
|
var DEFAULT_CONFIG = {
|
|
9003
9003
|
version: 1,
|
|
9004
9004
|
api: {
|
|
@@ -10496,7 +10496,7 @@ function sleep(ms) {
|
|
|
10496
10496
|
}
|
|
10497
10497
|
|
|
10498
10498
|
// src/commands/init.ts
|
|
10499
|
-
var DEFAULT_API_ENDPOINT2 = "https://
|
|
10499
|
+
var DEFAULT_API_ENDPOINT2 = "https://staging-api.refly.ai";
|
|
10500
10500
|
var initCommand = new Command("init").description("Initialize Refly CLI, install skill files, and authenticate").option("--force", "Force reinstall even if already installed").option("--host <url>", "API server URL", DEFAULT_API_ENDPOINT2).option("--skip-login", "Skip automatic login after initialization").action(async (options) => {
|
|
10501
10501
|
try {
|
|
10502
10502
|
const { force, host, skipLogin } = options;
|
|
@@ -10750,8 +10750,8 @@ var import_node_child_process6 = require("child_process");
|
|
|
10750
10750
|
var import_node_fs5 = __toESM(require("fs"));
|
|
10751
10751
|
init_logger();
|
|
10752
10752
|
init_paths();
|
|
10753
|
-
var CLI_VERSION = "0.1.
|
|
10754
|
-
var NPM_TAG = "
|
|
10753
|
+
var CLI_VERSION = "0.1.22";
|
|
10754
|
+
var NPM_TAG = "staging";
|
|
10755
10755
|
function compareSemver(a, b) {
|
|
10756
10756
|
const parseVersion = (v) => {
|
|
10757
10757
|
const parts = v.replace(/^v/, "").split("-")[0].split(".");
|
|
@@ -11032,144 +11032,14 @@ init_cjs_shims();
|
|
|
11032
11032
|
|
|
11033
11033
|
// src/commands/workflow/create.ts
|
|
11034
11034
|
init_cjs_shims();
|
|
11035
|
-
var
|
|
11036
|
-
|
|
11037
|
-
|
|
11038
|
-
|
|
11039
|
-
|
|
11040
|
-
|
|
11041
|
-
}
|
|
11042
|
-
if (spec.metadata !== void 0) {
|
|
11043
|
-
return 'Field "metadata" is not supported in simplified format';
|
|
11044
|
-
}
|
|
11045
|
-
const nodes = spec.nodes;
|
|
11046
|
-
if (!nodes || !Array.isArray(nodes)) {
|
|
11047
|
-
return 'Spec must contain a "nodes" array';
|
|
11048
|
-
}
|
|
11049
|
-
if (nodes.length === 0) {
|
|
11050
|
-
return "Spec must contain at least one node";
|
|
11051
|
-
}
|
|
11052
|
-
for (const node of nodes) {
|
|
11053
|
-
if (!node.id || typeof node.id !== "string") {
|
|
11054
|
-
return 'Each node must have a string "id" field';
|
|
11055
|
-
}
|
|
11056
|
-
if (!node.type || typeof node.type !== "string") {
|
|
11057
|
-
return `Node "${node.id}": must have a string "type" field`;
|
|
11058
|
-
}
|
|
11059
|
-
if (node.type.startsWith("tool:")) {
|
|
11060
|
-
return `Node "${node.id}": type "tool:xxx" is not supported. Use type "skill" with toolsetKeys instead. Example: {"type":"skill","toolsetKeys":["${node.type.replace("tool:", "")}"]}`;
|
|
11061
|
-
}
|
|
11062
|
-
if (node.type === "start") {
|
|
11063
|
-
return `Node "${node.id}": type "start" is not supported. Start node is automatically created`;
|
|
11064
|
-
}
|
|
11065
|
-
if (!SUPPORTED_NODE_TYPES.includes(node.type)) {
|
|
11066
|
-
return `Node "${node.id}": type "${node.type}" is not supported. Use one of: ${SUPPORTED_NODE_TYPES.join(", ")}`;
|
|
11067
|
-
}
|
|
11068
|
-
for (const field of UNSUPPORTED_NODE_FIELDS) {
|
|
11069
|
-
if (node[field] !== void 0) {
|
|
11070
|
-
if (field === "prompt") {
|
|
11071
|
-
return `Node "${node.id}": field "prompt" is not supported. Use "query" instead`;
|
|
11072
|
-
}
|
|
11073
|
-
if (field === "input") {
|
|
11074
|
-
return `Node "${node.id}": field "input" is not supported. Use top-level "query" and "toolsetKeys" instead`;
|
|
11075
|
-
}
|
|
11076
|
-
return `Node "${node.id}": field "${field}" is not supported in simplified format`;
|
|
11077
|
-
}
|
|
11078
|
-
}
|
|
11079
|
-
if (node.query && typeof node.query === "string" && VARIABLE_PATTERN.test(node.query)) {
|
|
11080
|
-
return `Node "${node.id}": variable syntax "{{...}}" is not supported in query field`;
|
|
11081
|
-
}
|
|
11082
|
-
if (node.toolsetKeys !== void 0) {
|
|
11083
|
-
if (!Array.isArray(node.toolsetKeys)) {
|
|
11084
|
-
return `Node "${node.id}": "toolsetKeys" must be an array`;
|
|
11085
|
-
}
|
|
11086
|
-
for (const key of node.toolsetKeys) {
|
|
11087
|
-
if (typeof key !== "string") {
|
|
11088
|
-
return `Node "${node.id}": each item in "toolsetKeys" must be a string`;
|
|
11089
|
-
}
|
|
11090
|
-
}
|
|
11091
|
-
}
|
|
11092
|
-
if (node.dependsOn !== void 0) {
|
|
11093
|
-
if (!Array.isArray(node.dependsOn)) {
|
|
11094
|
-
return `Node "${node.id}": "dependsOn" must be an array`;
|
|
11095
|
-
}
|
|
11096
|
-
for (const dep of node.dependsOn) {
|
|
11097
|
-
if (typeof dep !== "string") {
|
|
11098
|
-
return `Node "${node.id}": each item in "dependsOn" must be a string`;
|
|
11099
|
-
}
|
|
11100
|
-
}
|
|
11101
|
-
}
|
|
11102
|
-
}
|
|
11103
|
-
const nodeIds = new Set(nodes.map((n) => n.id));
|
|
11104
|
-
for (const node of nodes) {
|
|
11105
|
-
if (node.dependsOn) {
|
|
11106
|
-
for (const dep of node.dependsOn) {
|
|
11107
|
-
if (!nodeIds.has(dep)) {
|
|
11108
|
-
return `Node "${node.id}": dependsOn references unknown node "${dep}"`;
|
|
11109
|
-
}
|
|
11110
|
-
}
|
|
11111
|
-
}
|
|
11112
|
-
}
|
|
11113
|
-
return null;
|
|
11114
|
-
}
|
|
11115
|
-
var workflowCreateCommand = new Command("create").description("Create a workflow from a spec").requiredOption("--name <name>", "Workflow name").requiredOption("--spec <json>", "Workflow spec as JSON").option("--description <description>", "Workflow description").action(async (options) => {
|
|
11116
|
-
try {
|
|
11117
|
-
let spec;
|
|
11118
|
-
try {
|
|
11119
|
-
const parsed = JSON.parse(options.spec);
|
|
11120
|
-
spec = Array.isArray(parsed) ? { nodes: parsed } : parsed;
|
|
11121
|
-
} catch {
|
|
11122
|
-
fail(ErrorCodes.INVALID_INPUT, "Invalid JSON in --spec", {
|
|
11123
|
-
hint: `Spec format: '[{"id": "node1", "type": "skill", "query": "task description", "toolsetKeys": ["web_search"]}]'
|
|
11124
|
-
Or full format: '{"nodes": [...], "edges": [...]}'`,
|
|
11125
|
-
suggestedFix: {
|
|
11126
|
-
field: "--spec",
|
|
11127
|
-
format: "json-array | json-object",
|
|
11128
|
-
example: '[{"id": "node1", "type": "skill", "query": "task description", "toolsetKeys": ["web_search"]}]'
|
|
11129
|
-
}
|
|
11130
|
-
});
|
|
11131
|
-
return;
|
|
11132
|
-
}
|
|
11133
|
-
const validationError = validateSimplifiedSpec(spec);
|
|
11134
|
-
if (validationError) {
|
|
11135
|
-
fail(ErrorCodes.INVALID_INPUT, validationError, {
|
|
11136
|
-
hint: 'Use simplified format: [{"id":"node1","type":"skill","query":"...","toolsetKeys":["tool_name"],"dependsOn":["other_node"]}]',
|
|
11137
|
-
suggestedFix: {
|
|
11138
|
-
field: "--spec",
|
|
11139
|
-
format: "json-array",
|
|
11140
|
-
example: '[{"id":"node1","type":"skill","query":"...","toolsetKeys":["tool_name"],"dependsOn":["other_node"]}]'
|
|
11141
|
-
}
|
|
11142
|
-
});
|
|
11143
|
-
return;
|
|
11144
|
-
}
|
|
11145
|
-
const result = await apiRequest("/v1/cli/workflow", {
|
|
11146
|
-
method: "POST",
|
|
11147
|
-
body: {
|
|
11148
|
-
name: options.name,
|
|
11149
|
-
description: options.description,
|
|
11150
|
-
spec
|
|
11151
|
-
}
|
|
11152
|
-
});
|
|
11153
|
-
ok("workflow.create", {
|
|
11154
|
-
message: "Workflow created successfully",
|
|
11155
|
-
workflowId: result.workflowId,
|
|
11156
|
-
name: result.name,
|
|
11157
|
-
createdAt: result.createdAt
|
|
11158
|
-
});
|
|
11159
|
-
} catch (error) {
|
|
11160
|
-
if (error instanceof CLIError) {
|
|
11161
|
-
fail(error.code, error.message, {
|
|
11162
|
-
details: error.details,
|
|
11163
|
-
hint: error.hint,
|
|
11164
|
-
suggestedFix: error.suggestedFix
|
|
11165
|
-
});
|
|
11166
|
-
return;
|
|
11035
|
+
var workflowCreateCommand = new Command("create").description('[Removed] Use "refly workflow generate" instead').allowUnknownOption(true).action(async () => {
|
|
11036
|
+
fail(ErrorCodes.INVALID_INPUT, 'Command "workflow create" has been removed', {
|
|
11037
|
+
hint: 'Use "refly workflow generate" to create workflows from natural language.\n\nExample:\n refly workflow generate --query "Parse PDF, summarize content, translate to Chinese"',
|
|
11038
|
+
suggestedFix: {
|
|
11039
|
+
field: "command",
|
|
11040
|
+
example: 'refly workflow generate --query "your workflow description"'
|
|
11167
11041
|
}
|
|
11168
|
-
|
|
11169
|
-
ErrorCodes.INTERNAL_ERROR,
|
|
11170
|
-
error instanceof Error ? error.message : "Failed to create workflow"
|
|
11171
|
-
);
|
|
11172
|
-
}
|
|
11042
|
+
});
|
|
11173
11043
|
});
|
|
11174
11044
|
|
|
11175
11045
|
// src/commands/workflow/generate.ts
|