@powerformer/refly-cli 0.1.18 → 0.1.19
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 +220 -146
- package/dist/bin/refly.js.map +1 -1
- package/package.json +2 -1
- package/skill/references/node.md +2 -2
- package/skill/references/workflow.md +8 -49
package/dist/bin/refly.js
CHANGED
|
@@ -989,7 +989,7 @@ var require_command = __commonJS({
|
|
|
989
989
|
init_cjs_shims();
|
|
990
990
|
var EventEmitter = require("events").EventEmitter;
|
|
991
991
|
var childProcess2 = require("child_process");
|
|
992
|
-
var
|
|
992
|
+
var path22 = require("path");
|
|
993
993
|
var fs27 = require("fs");
|
|
994
994
|
var process8 = require("process");
|
|
995
995
|
var { Argument: Argument2, humanReadableArgName } = require_argument();
|
|
@@ -1922,9 +1922,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1922
1922
|
let launchWithNode = false;
|
|
1923
1923
|
const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
|
|
1924
1924
|
function findFile(baseDir, baseName) {
|
|
1925
|
-
const localBin =
|
|
1925
|
+
const localBin = path22.resolve(baseDir, baseName);
|
|
1926
1926
|
if (fs27.existsSync(localBin)) return localBin;
|
|
1927
|
-
if (sourceExt.includes(
|
|
1927
|
+
if (sourceExt.includes(path22.extname(baseName))) return void 0;
|
|
1928
1928
|
const foundExt = sourceExt.find(
|
|
1929
1929
|
(ext) => fs27.existsSync(`${localBin}${ext}`)
|
|
1930
1930
|
);
|
|
@@ -1942,17 +1942,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1942
1942
|
} catch (err) {
|
|
1943
1943
|
resolvedScriptPath = this._scriptPath;
|
|
1944
1944
|
}
|
|
1945
|
-
executableDir =
|
|
1946
|
-
|
|
1945
|
+
executableDir = path22.resolve(
|
|
1946
|
+
path22.dirname(resolvedScriptPath),
|
|
1947
1947
|
executableDir
|
|
1948
1948
|
);
|
|
1949
1949
|
}
|
|
1950
1950
|
if (executableDir) {
|
|
1951
1951
|
let localFile = findFile(executableDir, executableFile);
|
|
1952
1952
|
if (!localFile && !subcommand._executableFile && this._scriptPath) {
|
|
1953
|
-
const legacyName =
|
|
1953
|
+
const legacyName = path22.basename(
|
|
1954
1954
|
this._scriptPath,
|
|
1955
|
-
|
|
1955
|
+
path22.extname(this._scriptPath)
|
|
1956
1956
|
);
|
|
1957
1957
|
if (legacyName !== this._name) {
|
|
1958
1958
|
localFile = findFile(
|
|
@@ -1963,7 +1963,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1963
1963
|
}
|
|
1964
1964
|
executableFile = localFile || executableFile;
|
|
1965
1965
|
}
|
|
1966
|
-
launchWithNode = sourceExt.includes(
|
|
1966
|
+
launchWithNode = sourceExt.includes(path22.extname(executableFile));
|
|
1967
1967
|
let proc;
|
|
1968
1968
|
if (process8.platform !== "win32") {
|
|
1969
1969
|
if (launchWithNode) {
|
|
@@ -2803,7 +2803,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2803
2803
|
* @return {Command}
|
|
2804
2804
|
*/
|
|
2805
2805
|
nameFromFilename(filename) {
|
|
2806
|
-
this._name =
|
|
2806
|
+
this._name = path22.basename(filename, path22.extname(filename));
|
|
2807
2807
|
return this;
|
|
2808
2808
|
}
|
|
2809
2809
|
/**
|
|
@@ -2817,9 +2817,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2817
2817
|
* @param {string} [path]
|
|
2818
2818
|
* @return {(string|null|Command)}
|
|
2819
2819
|
*/
|
|
2820
|
-
executableDir(
|
|
2821
|
-
if (
|
|
2822
|
-
this._executableDir =
|
|
2820
|
+
executableDir(path23) {
|
|
2821
|
+
if (path23 === void 0) return this._executableDir;
|
|
2822
|
+
this._executableDir = path23;
|
|
2823
2823
|
return this;
|
|
2824
2824
|
}
|
|
2825
2825
|
/**
|
|
@@ -4894,7 +4894,7 @@ var ErrorCodes = {
|
|
|
4894
4894
|
|
|
4895
4895
|
// src/bin/refly.ts
|
|
4896
4896
|
var fs26 = __toESM(require("fs"));
|
|
4897
|
-
var
|
|
4897
|
+
var path21 = __toESM(require("path"));
|
|
4898
4898
|
|
|
4899
4899
|
// src/commands/init.ts
|
|
4900
4900
|
init_cjs_shims();
|
|
@@ -5399,8 +5399,8 @@ function getErrorMap() {
|
|
|
5399
5399
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
|
|
5400
5400
|
init_cjs_shims();
|
|
5401
5401
|
var makeIssue = (params) => {
|
|
5402
|
-
const { data, path:
|
|
5403
|
-
const fullPath = [...
|
|
5402
|
+
const { data, path: path22, errorMaps, issueData } = params;
|
|
5403
|
+
const fullPath = [...path22, ...issueData.path || []];
|
|
5404
5404
|
const fullIssue = {
|
|
5405
5405
|
...issueData,
|
|
5406
5406
|
path: fullPath
|
|
@@ -5520,11 +5520,11 @@ var errorUtil;
|
|
|
5520
5520
|
|
|
5521
5521
|
// ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
|
|
5522
5522
|
var ParseInputLazyPath = class {
|
|
5523
|
-
constructor(parent, value,
|
|
5523
|
+
constructor(parent, value, path22, key) {
|
|
5524
5524
|
this._cachedPath = [];
|
|
5525
5525
|
this.parent = parent;
|
|
5526
5526
|
this.data = value;
|
|
5527
|
-
this._path =
|
|
5527
|
+
this._path = path22;
|
|
5528
5528
|
this._key = key;
|
|
5529
5529
|
}
|
|
5530
5530
|
get path() {
|
|
@@ -9886,10 +9886,10 @@ var NetworkError = class extends CLIError {
|
|
|
9886
9886
|
// src/api/client.ts
|
|
9887
9887
|
init_logger();
|
|
9888
9888
|
var DEFAULT_TIMEOUT = 3e4;
|
|
9889
|
-
async function apiRequest(
|
|
9889
|
+
async function apiRequest(path22, options = {}) {
|
|
9890
9890
|
const { method = "GET", body, query, timeout = DEFAULT_TIMEOUT, requireAuth = true } = options;
|
|
9891
9891
|
const endpoint = getApiEndpoint();
|
|
9892
|
-
let url = `${endpoint}${
|
|
9892
|
+
let url = `${endpoint}${path22}`;
|
|
9893
9893
|
if (query && Object.keys(query).length > 0) {
|
|
9894
9894
|
const params = new URLSearchParams(query);
|
|
9895
9895
|
url = `${url}?${params.toString()}`;
|
|
@@ -9927,7 +9927,7 @@ async function apiRequest(path23, options = {}) {
|
|
|
9927
9927
|
const controller = new AbortController();
|
|
9928
9928
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
9929
9929
|
try {
|
|
9930
|
-
logger.debug(`API Request: ${method} ${
|
|
9930
|
+
logger.debug(`API Request: ${method} ${path22}`);
|
|
9931
9931
|
const response = await fetch(url, {
|
|
9932
9932
|
method,
|
|
9933
9933
|
headers,
|
|
@@ -10042,10 +10042,10 @@ function mapAPIError(status, response) {
|
|
|
10042
10042
|
}
|
|
10043
10043
|
return new CLIError(errCode, errMsg);
|
|
10044
10044
|
}
|
|
10045
|
-
async function apiRequestStream(
|
|
10045
|
+
async function apiRequestStream(path22, options = {}) {
|
|
10046
10046
|
const { timeout = 3e5 } = options;
|
|
10047
10047
|
const endpoint = getApiEndpoint();
|
|
10048
|
-
const url = `${endpoint}${
|
|
10048
|
+
const url = `${endpoint}${path22}`;
|
|
10049
10049
|
const headers = {
|
|
10050
10050
|
"User-Agent": "refly-cli/0.1.0"
|
|
10051
10051
|
};
|
|
@@ -10076,7 +10076,7 @@ async function apiRequestStream(path23, options = {}) {
|
|
|
10076
10076
|
const controller = new AbortController();
|
|
10077
10077
|
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
10078
10078
|
try {
|
|
10079
|
-
logger.debug(`API Stream Request: GET ${
|
|
10079
|
+
logger.debug(`API Stream Request: GET ${path22}`);
|
|
10080
10080
|
const response = await fetch(url, {
|
|
10081
10081
|
method: "GET",
|
|
10082
10082
|
headers,
|
|
@@ -10750,7 +10750,7 @@ 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.
|
|
10753
|
+
var CLI_VERSION = "0.1.19";
|
|
10754
10754
|
var NPM_TAG = "test";
|
|
10755
10755
|
function compareSemver(a, b) {
|
|
10756
10756
|
const parseVersion = (v) => {
|
|
@@ -11006,16 +11006,16 @@ configCommand.action(() => {
|
|
|
11006
11006
|
};
|
|
11007
11007
|
ok("config", safeConfig);
|
|
11008
11008
|
});
|
|
11009
|
-
function getNestedValue(obj,
|
|
11010
|
-
return
|
|
11009
|
+
function getNestedValue(obj, path22) {
|
|
11010
|
+
return path22.split(".").reduce((current, key) => {
|
|
11011
11011
|
if (current && typeof current === "object" && key in current) {
|
|
11012
11012
|
return current[key];
|
|
11013
11013
|
}
|
|
11014
11014
|
return void 0;
|
|
11015
11015
|
}, obj);
|
|
11016
11016
|
}
|
|
11017
|
-
function setNestedValue(obj,
|
|
11018
|
-
const keys =
|
|
11017
|
+
function setNestedValue(obj, path22, value) {
|
|
11018
|
+
const keys = path22.split(".");
|
|
11019
11019
|
const lastKey = keys.pop();
|
|
11020
11020
|
let current = obj;
|
|
11021
11021
|
for (const key of keys) {
|
|
@@ -11386,7 +11386,7 @@ var workflowDeleteCommand = new Command("delete").description("Delete a workflow
|
|
|
11386
11386
|
init_cjs_shims();
|
|
11387
11387
|
var readline2 = __toESM(require("readline/promises"));
|
|
11388
11388
|
var import_node_process8 = require("process");
|
|
11389
|
-
var
|
|
11389
|
+
var path9 = __toESM(require("path"));
|
|
11390
11390
|
|
|
11391
11391
|
// src/utils/prompt.ts
|
|
11392
11392
|
init_cjs_shims();
|
|
@@ -11436,34 +11436,87 @@ async function promptForFilePath(variableName, resourceTypes, isRequired) {
|
|
|
11436
11436
|
|
|
11437
11437
|
// src/utils/file-type.ts
|
|
11438
11438
|
init_cjs_shims();
|
|
11439
|
-
var
|
|
11439
|
+
var CODE_FILE_EXTENSIONS = [
|
|
11440
|
+
// TypeScript/JavaScript
|
|
11441
|
+
"ts",
|
|
11442
|
+
"tsx",
|
|
11443
|
+
"js",
|
|
11444
|
+
"jsx",
|
|
11445
|
+
"mjs",
|
|
11446
|
+
"cjs",
|
|
11447
|
+
// Web
|
|
11448
|
+
"css",
|
|
11449
|
+
"scss",
|
|
11450
|
+
"sass",
|
|
11451
|
+
"less",
|
|
11452
|
+
// Other programming languages
|
|
11453
|
+
"py",
|
|
11454
|
+
"java",
|
|
11455
|
+
"c",
|
|
11456
|
+
"cpp",
|
|
11457
|
+
"h",
|
|
11458
|
+
"hpp",
|
|
11459
|
+
"cs",
|
|
11460
|
+
"go",
|
|
11461
|
+
"rs",
|
|
11462
|
+
"rb",
|
|
11463
|
+
"php",
|
|
11464
|
+
"swift",
|
|
11465
|
+
"kt",
|
|
11466
|
+
"scala",
|
|
11467
|
+
"sh",
|
|
11468
|
+
"bash",
|
|
11469
|
+
"zsh",
|
|
11470
|
+
// Config files
|
|
11471
|
+
"json",
|
|
11472
|
+
"yaml",
|
|
11473
|
+
"yml",
|
|
11474
|
+
"toml",
|
|
11475
|
+
"xml",
|
|
11476
|
+
"ini",
|
|
11477
|
+
"env",
|
|
11478
|
+
// Text and document files
|
|
11479
|
+
"txt",
|
|
11480
|
+
"md",
|
|
11481
|
+
"markdown"
|
|
11482
|
+
];
|
|
11440
11483
|
var IMAGE_EXTENSIONS = ["jpg", "jpeg", "png", "gif", "webp", "svg", "bmp", "ico", "tiff", "tif"];
|
|
11441
11484
|
var VIDEO_EXTENSIONS = ["mp4", "webm", "mov", "avi", "mkv", "flv", "wmv", "m4v"];
|
|
11442
|
-
var AUDIO_EXTENSIONS = ["mp3", "wav", "ogg", "flac", "m4a", "aac", "wma", "opus"];
|
|
11443
|
-
function
|
|
11444
|
-
const
|
|
11445
|
-
if (
|
|
11446
|
-
return "
|
|
11447
|
-
}
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
|
|
11485
|
+
var AUDIO_EXTENSIONS = ["mp3", "wav", "ogg", "flac", "m4a", "aac", "wma", "opus", "mpga"];
|
|
11486
|
+
function getFileExtension(filename) {
|
|
11487
|
+
const lastDotIndex = filename.lastIndexOf(".");
|
|
11488
|
+
if (lastDotIndex === -1 || lastDotIndex === filename.length - 1) {
|
|
11489
|
+
return "";
|
|
11490
|
+
}
|
|
11491
|
+
return filename.slice(lastDotIndex + 1).toLowerCase();
|
|
11492
|
+
}
|
|
11493
|
+
function getFileCategoryByName(filename, mimeType) {
|
|
11494
|
+
const extension = getFileExtension(filename);
|
|
11495
|
+
if (CODE_FILE_EXTENSIONS.includes(extension)) {
|
|
11496
|
+
return "document";
|
|
11497
|
+
}
|
|
11498
|
+
if (IMAGE_EXTENSIONS.includes(extension)) return "image";
|
|
11499
|
+
if (VIDEO_EXTENSIONS.includes(extension)) return "video";
|
|
11500
|
+
if (AUDIO_EXTENSIONS.includes(extension)) return "audio";
|
|
11454
11501
|
if (mimeType) {
|
|
11455
|
-
|
|
11456
|
-
|
|
11457
|
-
|
|
11458
|
-
if (
|
|
11459
|
-
return "video";
|
|
11460
|
-
}
|
|
11461
|
-
if (mimeType.startsWith("audio/")) {
|
|
11462
|
-
return "audio";
|
|
11463
|
-
}
|
|
11502
|
+
const mimeTypePrefix = mimeType.split("/")[0].toLowerCase();
|
|
11503
|
+
if (mimeTypePrefix === "image") return "image";
|
|
11504
|
+
if (mimeTypePrefix === "audio") return "audio";
|
|
11505
|
+
if (mimeTypePrefix === "video") return "video";
|
|
11464
11506
|
}
|
|
11465
11507
|
return "document";
|
|
11466
11508
|
}
|
|
11509
|
+
function getFileCategoryByMimeType(mimeType) {
|
|
11510
|
+
if (mimeType.startsWith("image/")) return "image";
|
|
11511
|
+
if (mimeType.startsWith("video/")) return "video";
|
|
11512
|
+
if (mimeType.startsWith("audio/")) return "audio";
|
|
11513
|
+
if (mimeType === "application/pdf") return "document";
|
|
11514
|
+
if (mimeType.includes("word") || mimeType.includes("document")) return "document";
|
|
11515
|
+
if (mimeType.includes("sheet") || mimeType.includes("excel")) return "document";
|
|
11516
|
+
if (mimeType.includes("presentation") || mimeType.includes("powerpoint")) return "document";
|
|
11517
|
+
if (mimeType.startsWith("text/")) return "document";
|
|
11518
|
+
return "document";
|
|
11519
|
+
}
|
|
11467
11520
|
|
|
11468
11521
|
// src/utils/variable-check.ts
|
|
11469
11522
|
init_cjs_shims();
|
|
@@ -11683,7 +11736,7 @@ ${details}`;
|
|
|
11683
11736
|
if (!filePath) {
|
|
11684
11737
|
continue;
|
|
11685
11738
|
}
|
|
11686
|
-
const filename =
|
|
11739
|
+
const filename = path9.basename(filePath);
|
|
11687
11740
|
process.stdout.write(` Uploading ${filename}...`);
|
|
11688
11741
|
try {
|
|
11689
11742
|
const uploadResult = await apiUploadDriveFile(filePath, workflowId);
|
|
@@ -11692,7 +11745,7 @@ ${details}`;
|
|
|
11692
11745
|
type: "resource",
|
|
11693
11746
|
resource: {
|
|
11694
11747
|
name: uploadResult.name,
|
|
11695
|
-
fileType:
|
|
11748
|
+
fileType: getFileCategoryByName(filePath, uploadResult.type),
|
|
11696
11749
|
fileId: uploadResult.fileId,
|
|
11697
11750
|
storageKey: uploadResult.storageKey
|
|
11698
11751
|
}
|
|
@@ -11743,7 +11796,7 @@ function convertKeyValueToVariables(obj, workflow) {
|
|
|
11743
11796
|
}
|
|
11744
11797
|
variables.push({
|
|
11745
11798
|
variableId: varDef?.variableId,
|
|
11746
|
-
name,
|
|
11799
|
+
name: varDef?.name || name,
|
|
11747
11800
|
variableType: "resource",
|
|
11748
11801
|
value: fileValues,
|
|
11749
11802
|
required: varDef?.required
|
|
@@ -11757,7 +11810,7 @@ function convertKeyValueToVariables(obj, workflow) {
|
|
|
11757
11810
|
}
|
|
11758
11811
|
variables.push({
|
|
11759
11812
|
variableId: varDef?.variableId,
|
|
11760
|
-
name,
|
|
11813
|
+
name: varDef?.name || name,
|
|
11761
11814
|
variableType: "string",
|
|
11762
11815
|
value,
|
|
11763
11816
|
required: varDef?.required
|
|
@@ -12327,9 +12380,12 @@ var workflowLayoutCommand = new Command("layout").description("Auto-layout workf
|
|
|
12327
12380
|
}
|
|
12328
12381
|
});
|
|
12329
12382
|
|
|
12330
|
-
// src/commands/workflow/
|
|
12383
|
+
// src/commands/workflow/node/index.ts
|
|
12331
12384
|
init_cjs_shims();
|
|
12332
|
-
|
|
12385
|
+
|
|
12386
|
+
// src/commands/workflow/node/list.ts
|
|
12387
|
+
init_cjs_shims();
|
|
12388
|
+
var nodeListCommand = new Command("list").description("List all nodes in a workflow").argument("<workflowId>", "Workflow ID").option("--include-edges", "Include edge/connection information").option("--include-position", "Include node position coordinates").option("--include-metadata", "Include full node metadata").action(async (workflowId, options) => {
|
|
12333
12389
|
try {
|
|
12334
12390
|
const result = await apiRequest(`/v1/cli/workflow/${workflowId}`);
|
|
12335
12391
|
const nodes = result.nodes.map((node) => {
|
|
@@ -12362,12 +12418,13 @@ var workflowNodesCommand = new Command("nodes").description("List all nodes in a
|
|
|
12362
12418
|
}));
|
|
12363
12419
|
output3.edgeCount = result.edges.length;
|
|
12364
12420
|
}
|
|
12365
|
-
ok("workflow.
|
|
12421
|
+
ok("workflow.node.list", output3);
|
|
12366
12422
|
} catch (error) {
|
|
12367
12423
|
if (error instanceof CLIError) {
|
|
12424
|
+
const hint = error.hint?.replace(/<workflowId>/g, workflowId);
|
|
12368
12425
|
fail(error.code, error.message, {
|
|
12369
12426
|
details: error.details,
|
|
12370
|
-
hint
|
|
12427
|
+
hint,
|
|
12371
12428
|
suggestedFix: error.suggestedFix
|
|
12372
12429
|
});
|
|
12373
12430
|
}
|
|
@@ -12378,9 +12435,9 @@ var workflowNodesCommand = new Command("nodes").description("List all nodes in a
|
|
|
12378
12435
|
}
|
|
12379
12436
|
});
|
|
12380
12437
|
|
|
12381
|
-
// src/commands/workflow/node
|
|
12438
|
+
// src/commands/workflow/node/get.ts
|
|
12382
12439
|
init_cjs_shims();
|
|
12383
|
-
var
|
|
12440
|
+
var nodeGetCommand = new Command("get").description("Get single node information from a workflow").argument("<id>", "Workflow ID (c-xxx) or Run ID (we-xxx)").argument("<nodeId>", "Node ID").option("--include-connections", "Include incoming and outgoing connections").action(async (id, nodeId, options) => {
|
|
12384
12441
|
try {
|
|
12385
12442
|
const idType = detectIdType2(id);
|
|
12386
12443
|
let workflowId = id;
|
|
@@ -12392,7 +12449,7 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
|
|
|
12392
12449
|
const node = result.nodes.find((n) => n.id === nodeId);
|
|
12393
12450
|
if (!node) {
|
|
12394
12451
|
fail(ErrorCodes.NODE_NOT_FOUND, `Node ${nodeId} not found in workflow ${workflowId}`, {
|
|
12395
|
-
hint: `Use 'refly workflow
|
|
12452
|
+
hint: `Use 'refly workflow node list ${id}' to list all nodes`
|
|
12396
12453
|
});
|
|
12397
12454
|
}
|
|
12398
12455
|
const output3 = {
|
|
@@ -12427,12 +12484,13 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
|
|
|
12427
12484
|
outgoingCount: outgoing.length
|
|
12428
12485
|
};
|
|
12429
12486
|
}
|
|
12430
|
-
ok("workflow.node", output3);
|
|
12487
|
+
ok("workflow.node.get", output3);
|
|
12431
12488
|
} catch (error) {
|
|
12432
12489
|
if (error instanceof CLIError) {
|
|
12490
|
+
const hint = error.hint?.replace(/<workflowId>/g, id).replace(/<id>/g, id).replace(/<nodeId>/g, nodeId);
|
|
12433
12491
|
fail(error.code, error.message, {
|
|
12434
12492
|
details: error.details,
|
|
12435
|
-
hint
|
|
12493
|
+
hint,
|
|
12436
12494
|
suggestedFix: error.suggestedFix
|
|
12437
12495
|
});
|
|
12438
12496
|
}
|
|
@@ -12443,9 +12501,9 @@ var workflowNodeGetCommand = new Command("node").description("Get single node in
|
|
|
12443
12501
|
}
|
|
12444
12502
|
});
|
|
12445
12503
|
|
|
12446
|
-
// src/commands/workflow/node
|
|
12504
|
+
// src/commands/workflow/node/add.ts
|
|
12447
12505
|
init_cjs_shims();
|
|
12448
|
-
var
|
|
12506
|
+
var nodeAddCommand = new Command("add").description("Add a node to a workflow").argument("<workflowId>", "Workflow ID (c-xxx)").requiredOption("--type <type>", "Node type (skillResponse, start, document, resource, memo)").option("--id <nodeId>", "Custom node ID (auto-generated if not provided)").option("--query <query>", "Query/prompt for the node").option("--title <title>", "Node title").option("--toolset-keys <keys>", 'Comma-separated toolset keys (e.g., "web_search,execute_code")').option("--position <x,y>", 'Node position as "x,y" (default: 0,0)').option("--connect-from <nodeId>", "Connect from this node (creates edge)").option("--connect-to <nodeId>", "Connect to this node (creates edge)").option("--resolve-toolset-keys", "Resolve toolset keys to full IDs").option("--auto-layout", "Enable auto-layout to prevent overlapping").action(async (workflowId, options) => {
|
|
12449
12507
|
if (!workflowId.startsWith("c-")) {
|
|
12450
12508
|
fail(ErrorCodes.INVALID_INPUT, `Invalid workflow ID: ${workflowId}`, {
|
|
12451
12509
|
hint: 'Workflow ID should start with "c-"',
|
|
@@ -12544,15 +12602,16 @@ var workflowNodeAddCommand = new Command("node-add").description("Add a node to
|
|
|
12544
12602
|
...options.connectFrom && { connectedFrom: options.connectFrom },
|
|
12545
12603
|
...options.connectTo && { connectedTo: options.connectTo },
|
|
12546
12604
|
nextSteps: [
|
|
12547
|
-
`View node: \`refly workflow node ${workflowId} ${nodeId}\``,
|
|
12548
|
-
`List all nodes: \`refly workflow
|
|
12605
|
+
`View node: \`refly workflow node get ${workflowId} ${nodeId}\``,
|
|
12606
|
+
`List all nodes: \`refly workflow node list ${workflowId}\``
|
|
12549
12607
|
]
|
|
12550
12608
|
});
|
|
12551
12609
|
} catch (error) {
|
|
12552
12610
|
if (error instanceof CLIError) {
|
|
12611
|
+
const hint = error.hint?.replace(/<workflowId>/g, workflowId);
|
|
12553
12612
|
fail(error.code, error.message, {
|
|
12554
12613
|
details: error.details,
|
|
12555
|
-
hint
|
|
12614
|
+
hint,
|
|
12556
12615
|
suggestedFix: error.suggestedFix
|
|
12557
12616
|
});
|
|
12558
12617
|
return;
|
|
@@ -12564,9 +12623,9 @@ var workflowNodeAddCommand = new Command("node-add").description("Add a node to
|
|
|
12564
12623
|
}
|
|
12565
12624
|
});
|
|
12566
12625
|
|
|
12567
|
-
// src/commands/workflow/node
|
|
12626
|
+
// src/commands/workflow/node/update.ts
|
|
12568
12627
|
init_cjs_shims();
|
|
12569
|
-
var
|
|
12628
|
+
var nodeUpdateCommand = new Command("update").description("Update a node in a workflow").argument("<workflowId>", "Workflow ID (c-xxx)").argument("<nodeId>", "Node ID to update").option("--query <query>", "Update the query/prompt for the node").option("--title <title>", "Update the node title").option("--toolset-keys <keys>", 'Comma-separated toolset keys (e.g., "web_search,execute_code")').option("--data <json>", "Full node data as JSON (advanced usage)").option("--resolve-toolset-keys", "Resolve toolset keys to full IDs").action(async (workflowId, nodeId, options) => {
|
|
12570
12629
|
if (!workflowId.startsWith("c-")) {
|
|
12571
12630
|
fail(ErrorCodes.INVALID_INPUT, `Invalid workflow ID: ${workflowId}`, {
|
|
12572
12631
|
hint: 'Workflow ID should start with "c-"',
|
|
@@ -12656,15 +12715,16 @@ var workflowNodeUpdateCommand = new Command("node-update").description("Update a
|
|
|
12656
12715
|
...options.data && { data: "custom data applied" }
|
|
12657
12716
|
},
|
|
12658
12717
|
nextSteps: [
|
|
12659
|
-
`View updated node: \`refly workflow node ${workflowId} ${nodeId}\``,
|
|
12660
|
-
`List all nodes: \`refly workflow
|
|
12718
|
+
`View updated node: \`refly workflow node get ${workflowId} ${nodeId}\``,
|
|
12719
|
+
`List all nodes: \`refly workflow node list ${workflowId}\``
|
|
12661
12720
|
]
|
|
12662
12721
|
});
|
|
12663
12722
|
} catch (error) {
|
|
12664
12723
|
if (error instanceof CLIError) {
|
|
12724
|
+
const hint = error.hint?.replace(/<workflowId>/g, workflowId).replace(/<nodeId>/g, nodeId);
|
|
12665
12725
|
fail(error.code, error.message, {
|
|
12666
12726
|
details: error.details,
|
|
12667
|
-
hint
|
|
12727
|
+
hint,
|
|
12668
12728
|
suggestedFix: error.suggestedFix
|
|
12669
12729
|
});
|
|
12670
12730
|
return;
|
|
@@ -12676,9 +12736,9 @@ var workflowNodeUpdateCommand = new Command("node-update").description("Update a
|
|
|
12676
12736
|
}
|
|
12677
12737
|
});
|
|
12678
12738
|
|
|
12679
|
-
// src/commands/workflow/node
|
|
12739
|
+
// src/commands/workflow/node/delete.ts
|
|
12680
12740
|
init_cjs_shims();
|
|
12681
|
-
var
|
|
12741
|
+
var nodeDeleteCommand = new Command("delete").description("Delete a node from a workflow").argument("<workflowId>", "Workflow ID (c-xxx)").argument("<nodeId>", "Node ID to delete").action(async (workflowId, nodeId) => {
|
|
12682
12742
|
if (!workflowId.startsWith("c-")) {
|
|
12683
12743
|
fail(ErrorCodes.INVALID_INPUT, `Invalid workflow ID: ${workflowId}`, {
|
|
12684
12744
|
hint: 'Workflow ID should start with "c-"',
|
|
@@ -12708,13 +12768,14 @@ var workflowNodeDeleteCommand = new Command("node-delete").description("Delete a
|
|
|
12708
12768
|
workflowId,
|
|
12709
12769
|
nodeId,
|
|
12710
12770
|
note: "Connected edges were also removed",
|
|
12711
|
-
nextSteps: [`List remaining nodes: \`refly workflow
|
|
12771
|
+
nextSteps: [`List remaining nodes: \`refly workflow node list ${workflowId}\``]
|
|
12712
12772
|
});
|
|
12713
12773
|
} catch (error) {
|
|
12714
12774
|
if (error instanceof CLIError) {
|
|
12775
|
+
const hint = error.hint?.replace(/<workflowId>/g, workflowId).replace(/<nodeId>/g, nodeId);
|
|
12715
12776
|
fail(error.code, error.message, {
|
|
12716
12777
|
details: error.details,
|
|
12717
|
-
hint
|
|
12778
|
+
hint,
|
|
12718
12779
|
suggestedFix: error.suggestedFix
|
|
12719
12780
|
});
|
|
12720
12781
|
return;
|
|
@@ -12726,9 +12787,9 @@ var workflowNodeDeleteCommand = new Command("node-delete").description("Delete a
|
|
|
12726
12787
|
}
|
|
12727
12788
|
});
|
|
12728
12789
|
|
|
12729
|
-
// src/commands/workflow/node
|
|
12790
|
+
// src/commands/workflow/node/output.ts
|
|
12730
12791
|
init_cjs_shims();
|
|
12731
|
-
var
|
|
12792
|
+
var nodeOutputCommand = new Command("output").description("Get node execution output content").argument("<id>", "Workflow ID (c-xxx) or Run ID (we-xxx)").argument("<nodeId>", "Node ID").option("--include-tool-calls", "Include tool call details in output").option("--raw", "Output raw content without formatting").action(async (id, nodeId, options) => {
|
|
12732
12793
|
try {
|
|
12733
12794
|
const params = new URLSearchParams();
|
|
12734
12795
|
if (options.includeToolCalls) {
|
|
@@ -12740,7 +12801,7 @@ var workflowNodeOutputCommand = new Command("node-output").description("Get node
|
|
|
12740
12801
|
const idType = detectIdType2(id);
|
|
12741
12802
|
const url = buildWorkflowApiUrl(id, `node/${nodeId}/output`, params);
|
|
12742
12803
|
const result = await apiRequest(url);
|
|
12743
|
-
ok("workflow.
|
|
12804
|
+
ok("workflow.node.output", {
|
|
12744
12805
|
runId: result.runId,
|
|
12745
12806
|
workflowId: result.workflowId,
|
|
12746
12807
|
idType,
|
|
@@ -12761,9 +12822,10 @@ var workflowNodeOutputCommand = new Command("node-output").description("Get node
|
|
|
12761
12822
|
});
|
|
12762
12823
|
} catch (error) {
|
|
12763
12824
|
if (error instanceof CLIError) {
|
|
12825
|
+
const hint = error.hint?.replace(/<workflowId>/g, id).replace(/<id>/g, id);
|
|
12764
12826
|
fail(error.code, error.message, {
|
|
12765
12827
|
details: error.details,
|
|
12766
|
-
hint
|
|
12828
|
+
hint,
|
|
12767
12829
|
suggestedFix: error.suggestedFix
|
|
12768
12830
|
});
|
|
12769
12831
|
}
|
|
@@ -12771,12 +12833,15 @@ var workflowNodeOutputCommand = new Command("node-output").description("Get node
|
|
|
12771
12833
|
ErrorCodes.INTERNAL_ERROR,
|
|
12772
12834
|
error instanceof Error ? error.message : "Failed to get node output",
|
|
12773
12835
|
{
|
|
12774
|
-
hint:
|
|
12836
|
+
hint: `Ensure the node has completed execution. Use \`refly workflow status ${id}\` to check.`
|
|
12775
12837
|
}
|
|
12776
12838
|
);
|
|
12777
12839
|
}
|
|
12778
12840
|
});
|
|
12779
12841
|
|
|
12842
|
+
// src/commands/workflow/node/index.ts
|
|
12843
|
+
var workflowNodeCommand = new Command("node").description("Manage workflow nodes").addCommand(nodeListCommand).addCommand(nodeGetCommand).addCommand(nodeAddCommand).addCommand(nodeUpdateCommand).addCommand(nodeDeleteCommand).addCommand(nodeOutputCommand);
|
|
12844
|
+
|
|
12780
12845
|
// src/commands/workflow/edit.ts
|
|
12781
12846
|
init_cjs_shims();
|
|
12782
12847
|
var workflowEditCommand = new Command("edit").description("Edit a workflow using natural language").argument("<id>", "Canvas ID (c-xxx)").option("--query <text>", "Edit instruction in natural language").option("--session-id <id>", "Session ID (cs-xxx) for context continuity").option("--timeout <ms>", "Timeout for AI processing", "60000").action(async (id, options) => {
|
|
@@ -12854,17 +12919,6 @@ var workflowEditCommand = new Command("edit").description("Edit a workflow using
|
|
|
12854
12919
|
|
|
12855
12920
|
// src/commands/workflow/variables.ts
|
|
12856
12921
|
init_cjs_shims();
|
|
12857
|
-
function getFileTypeCategory(mimeType) {
|
|
12858
|
-
if (mimeType.startsWith("image/")) return "image";
|
|
12859
|
-
if (mimeType.startsWith("video/")) return "video";
|
|
12860
|
-
if (mimeType.startsWith("audio/")) return "audio";
|
|
12861
|
-
if (mimeType === "application/pdf") return "document";
|
|
12862
|
-
if (mimeType.includes("word") || mimeType.includes("document")) return "document";
|
|
12863
|
-
if (mimeType.includes("sheet") || mimeType.includes("excel")) return "document";
|
|
12864
|
-
if (mimeType.includes("presentation") || mimeType.includes("powerpoint")) return "document";
|
|
12865
|
-
if (mimeType.startsWith("text/")) return "document";
|
|
12866
|
-
return "document";
|
|
12867
|
-
}
|
|
12868
12922
|
async function getFileMetadata(fileId) {
|
|
12869
12923
|
try {
|
|
12870
12924
|
return await apiRequest(`/v1/cli/drive/files/${fileId}?includeContent=false`);
|
|
@@ -13024,7 +13078,7 @@ var variablesSetCommand = new Command("set").description("Set variable values fo
|
|
|
13024
13078
|
resource: {
|
|
13025
13079
|
fileId: newValue,
|
|
13026
13080
|
name: metadata?.name || "",
|
|
13027
|
-
fileType: metadata ?
|
|
13081
|
+
fileType: metadata ? getFileCategoryByMimeType(metadata.type) : "document",
|
|
13028
13082
|
storageKey: metadata?.storageKey || ""
|
|
13029
13083
|
}
|
|
13030
13084
|
}
|
|
@@ -13201,7 +13255,7 @@ var workflowSessionCommand = new Command("session").description("Get the latest
|
|
|
13201
13255
|
});
|
|
13202
13256
|
|
|
13203
13257
|
// src/commands/workflow/index.ts
|
|
13204
|
-
var workflowCommand = new Command("workflow").description("Manage and run workflows").addCommand(workflowCreateCommand).addCommand(workflowGenerateCommand).addCommand(workflowListCommand).addCommand(workflowGetCommand).addCommand(workflowDeleteCommand).addCommand(workflowRunCommand).addCommand(workflowRunsCommand).addCommand(workflowStatusCommand).addCommand(workflowDetailCommand).addCommand(workflowToolcallsCommand).addCommand(workflowAbortCommand).addCommand(workflowToolsetKeysCommand).addCommand(workflowLayoutCommand).addCommand(
|
|
13258
|
+
var workflowCommand = new Command("workflow").description("Manage and run workflows").addCommand(workflowCreateCommand).addCommand(workflowGenerateCommand).addCommand(workflowListCommand).addCommand(workflowGetCommand).addCommand(workflowDeleteCommand).addCommand(workflowRunCommand).addCommand(workflowRunsCommand).addCommand(workflowStatusCommand).addCommand(workflowDetailCommand).addCommand(workflowToolcallsCommand).addCommand(workflowAbortCommand).addCommand(workflowToolsetKeysCommand).addCommand(workflowLayoutCommand).addCommand(workflowNodeCommand).addCommand(workflowEditCommand).addCommand(workflowVariablesCommand).addCommand(workflowSessionCommand).addCommand(workflowResultCommand);
|
|
13205
13259
|
|
|
13206
13260
|
// src/commands/tool/index.ts
|
|
13207
13261
|
init_cjs_shims();
|
|
@@ -13382,14 +13436,14 @@ var fileGetCommand = new Command("get").description("Get file details").argument
|
|
|
13382
13436
|
// src/commands/file/download.ts
|
|
13383
13437
|
init_cjs_shims();
|
|
13384
13438
|
var fs14 = __toESM(require("fs"));
|
|
13385
|
-
var
|
|
13439
|
+
var path10 = __toESM(require("path"));
|
|
13386
13440
|
var fileDownloadCommand = new Command("download").description("Download file to local filesystem").argument("<fileId>", "File ID").option("-o, --output <path>", "Output file path (defaults to original filename)").action(async (fileId, options) => {
|
|
13387
13441
|
try {
|
|
13388
13442
|
const { data, filename, contentType, size } = await apiRequestStream(
|
|
13389
13443
|
`/v1/cli/drive/files/${fileId}/download`
|
|
13390
13444
|
);
|
|
13391
13445
|
const outputPath = options.output || filename || `${fileId}`;
|
|
13392
|
-
const resolvedPath =
|
|
13446
|
+
const resolvedPath = path10.resolve(outputPath);
|
|
13393
13447
|
fs14.writeFileSync(resolvedPath, data);
|
|
13394
13448
|
ok("file.download", {
|
|
13395
13449
|
fileId,
|
|
@@ -13416,7 +13470,7 @@ var fileDownloadCommand = new Command("download").description("Download file to
|
|
|
13416
13470
|
// src/commands/file/upload.ts
|
|
13417
13471
|
init_cjs_shims();
|
|
13418
13472
|
var fs15 = __toESM(require("fs"));
|
|
13419
|
-
var
|
|
13473
|
+
var path11 = __toESM(require("path"));
|
|
13420
13474
|
var MAX_FILES = 10;
|
|
13421
13475
|
function formatSize(bytes) {
|
|
13422
13476
|
if (bytes < 1024) return `${bytes}B`;
|
|
@@ -13426,7 +13480,7 @@ function formatSize(bytes) {
|
|
|
13426
13480
|
var fileUploadCommand = new Command("upload").description("Upload file(s) to a canvas").argument("<path>", "File or directory path").requiredOption("--canvas-id <id>", "Canvas ID (required)").option("--filter <extensions>", "Filter by extensions (e.g., pdf,docx,png)").action(async (inputPath, options) => {
|
|
13427
13481
|
const formatter = getFormatter();
|
|
13428
13482
|
try {
|
|
13429
|
-
const resolvedPath =
|
|
13483
|
+
const resolvedPath = path11.resolve(inputPath);
|
|
13430
13484
|
if (!fs15.existsSync(resolvedPath)) {
|
|
13431
13485
|
fail(ErrorCodes.NOT_FOUND, `Path not found: ${inputPath}`, {
|
|
13432
13486
|
hint: "Check if the file or directory exists"
|
|
@@ -13445,7 +13499,7 @@ var fileUploadCommand = new Command("upload").description("Upload file(s) to a c
|
|
|
13445
13499
|
const errors = [];
|
|
13446
13500
|
for (let i = 0; i < files.length; i++) {
|
|
13447
13501
|
const filePath = files[i];
|
|
13448
|
-
const filename =
|
|
13502
|
+
const filename = path11.basename(filePath);
|
|
13449
13503
|
const fileStats = fs15.statSync(filePath);
|
|
13450
13504
|
const sizeStr = formatSize(fileStats.size);
|
|
13451
13505
|
let currentStage = "presign";
|
|
@@ -13531,7 +13585,7 @@ function resolveFilesToUpload(inputPath, filter) {
|
|
|
13531
13585
|
if (stats.isFile()) {
|
|
13532
13586
|
if (filter) {
|
|
13533
13587
|
const filterExts = filter.split(",").map((e) => e.trim().toLowerCase());
|
|
13534
|
-
const ext =
|
|
13588
|
+
const ext = path11.extname(inputPath).slice(1).toLowerCase();
|
|
13535
13589
|
if (!filterExts.includes(ext)) {
|
|
13536
13590
|
return [];
|
|
13537
13591
|
}
|
|
@@ -13541,7 +13595,7 @@ function resolveFilesToUpload(inputPath, filter) {
|
|
|
13541
13595
|
if (stats.isDirectory()) {
|
|
13542
13596
|
const entries = fs15.readdirSync(inputPath);
|
|
13543
13597
|
const filterExts = filter?.split(",").map((e) => e.trim().toLowerCase());
|
|
13544
|
-
const files = entries.map((e) =>
|
|
13598
|
+
const files = entries.map((e) => path11.join(inputPath, e)).filter((p) => {
|
|
13545
13599
|
try {
|
|
13546
13600
|
return fs15.statSync(p).isFile();
|
|
13547
13601
|
} catch {
|
|
@@ -13549,7 +13603,7 @@ function resolveFilesToUpload(inputPath, filter) {
|
|
|
13549
13603
|
}
|
|
13550
13604
|
}).filter((p) => {
|
|
13551
13605
|
if (!filterExts) return true;
|
|
13552
|
-
const ext =
|
|
13606
|
+
const ext = path11.extname(p).slice(1).toLowerCase();
|
|
13553
13607
|
return filterExts.includes(ext);
|
|
13554
13608
|
}).sort((a, b) => {
|
|
13555
13609
|
try {
|
|
@@ -13740,6 +13794,7 @@ var skillCreateCommand = new Command("create").description("Create a new skill p
|
|
|
13740
13794
|
const webUrl = getWebUrl();
|
|
13741
13795
|
const payload = {
|
|
13742
13796
|
skillId: result.skillId,
|
|
13797
|
+
installationId: result.installationId,
|
|
13743
13798
|
name: result.name,
|
|
13744
13799
|
status: result.status,
|
|
13745
13800
|
createdAt: result.createdAt,
|
|
@@ -13771,7 +13826,7 @@ var skillCreateCommand = new Command("create").description("Create a new skill p
|
|
|
13771
13826
|
// src/commands/skill/update.ts
|
|
13772
13827
|
init_cjs_shims();
|
|
13773
13828
|
var fs17 = __toESM(require("fs"));
|
|
13774
|
-
var
|
|
13829
|
+
var path12 = __toESM(require("path"));
|
|
13775
13830
|
init_paths();
|
|
13776
13831
|
init_symlink();
|
|
13777
13832
|
var MIN_DESCRIPTION_WORDS = 20;
|
|
@@ -13801,7 +13856,7 @@ var skillUpdateCommand = new Command("update").description("Update skill install
|
|
|
13801
13856
|
try {
|
|
13802
13857
|
const name = options.name;
|
|
13803
13858
|
const skillDir = getReflyDomainSkillDir(name);
|
|
13804
|
-
const skillMdPath =
|
|
13859
|
+
const skillMdPath = path12.join(skillDir, "SKILL.md");
|
|
13805
13860
|
if (!fs17.existsSync(skillMdPath)) {
|
|
13806
13861
|
const skillsDir = getReflySkillsDir();
|
|
13807
13862
|
fail(ErrorCodes.NOT_FOUND, `SKILL.md not found at ${skillMdPath}`, {
|
|
@@ -13895,29 +13950,15 @@ To see installed skills: refly skill list`
|
|
|
13895
13950
|
// src/commands/skill/publish.ts
|
|
13896
13951
|
init_cjs_shims();
|
|
13897
13952
|
var fs18 = __toESM(require("fs"));
|
|
13898
|
-
var
|
|
13953
|
+
var path13 = __toESM(require("path"));
|
|
13899
13954
|
init_symlink();
|
|
13900
13955
|
init_paths();
|
|
13901
|
-
var skillPublishCommand = new Command("publish").description("Publish a skill package using local SKILL.md").
|
|
13956
|
+
var skillPublishCommand = new Command("publish").description("Publish a skill package using local SKILL.md").requiredOption("--name <name>", "Local skill name (directory in ~/.refly/skills/)").action(async (options) => {
|
|
13902
13957
|
try {
|
|
13903
13958
|
const skillsDir = getReflySkillsDir();
|
|
13904
|
-
if (!options.name) {
|
|
13905
|
-
fail(ErrorCodes.INVALID_INPUT, "Missing required option: --name", {
|
|
13906
|
-
hint: `The publish command requires --name to locate the local SKILL.md.
|
|
13907
|
-
|
|
13908
|
-
Usage:
|
|
13909
|
-
refly skill publish --name <name>
|
|
13910
|
-
refly skill publish --name <name> --id <skillId> # override skillId
|
|
13911
|
-
|
|
13912
|
-
To find your skill name:
|
|
13913
|
-
refly skill list
|
|
13914
|
-
ls ${skillsDir}/`
|
|
13915
|
-
});
|
|
13916
|
-
return;
|
|
13917
|
-
}
|
|
13918
13959
|
const name = options.name;
|
|
13919
13960
|
const skillDir = getReflyDomainSkillDir(name);
|
|
13920
|
-
const skillMdPath =
|
|
13961
|
+
const skillMdPath = path13.join(skillDir, "SKILL.md");
|
|
13921
13962
|
if (!fs18.existsSync(skillMdPath)) {
|
|
13922
13963
|
fail(ErrorCodes.NOT_FOUND, `SKILL.md not found at ${skillMdPath}`, {
|
|
13923
13964
|
hint: `Make sure the skill '${name}' exists in ${skillsDir}/
|
|
@@ -13932,17 +13973,26 @@ To create a new skill: refly skill create --name "${name}" --workflow-query "...
|
|
|
13932
13973
|
try {
|
|
13933
13974
|
parsedSkill = parseReflySkillMd(skillContent);
|
|
13934
13975
|
} catch (parseError) {
|
|
13935
|
-
|
|
13936
|
-
|
|
13937
|
-
|
|
13938
|
-
|
|
13939
|
-
|
|
13940
|
-
|
|
13941
|
-
|
|
13976
|
+
const errorMessage = parseError.message;
|
|
13977
|
+
if (errorMessage.includes("skillId")) {
|
|
13978
|
+
fail(ErrorCodes.INVALID_INPUT, "SKILL.md is missing skillId", {
|
|
13979
|
+
hint: `The skill "${name}" has no skillId. This may happen if the skill was created manually.
|
|
13980
|
+
|
|
13981
|
+
To fix this:
|
|
13982
|
+
1. Reinstall the skill: refly skill install <skillId> --force
|
|
13983
|
+
2. Or create a new skill: refly skill create --name "${name}" --workflow <workflowId>
|
|
13984
|
+
|
|
13985
|
+
To find available skills: refly skill list`
|
|
13986
|
+
});
|
|
13987
|
+
return;
|
|
13988
|
+
}
|
|
13989
|
+
fail(ErrorCodes.INVALID_INPUT, `Failed to parse SKILL.md: ${errorMessage}`, {
|
|
13990
|
+
hint: "Make sure SKILL.md has valid frontmatter with required fields: name, description, skillId, workflowId"
|
|
13991
|
+
});
|
|
13942
13992
|
return;
|
|
13943
13993
|
}
|
|
13944
13994
|
const { meta } = parsedSkill;
|
|
13945
|
-
const skillId =
|
|
13995
|
+
const skillId = meta.skillId;
|
|
13946
13996
|
const result = await apiRequest(
|
|
13947
13997
|
`/v1/skill-packages/${skillId}/publish`,
|
|
13948
13998
|
{
|
|
@@ -13981,7 +14031,7 @@ To create a new skill: refly skill create --name "${name}" --workflow-query "...
|
|
|
13981
14031
|
// src/commands/skill/unpublish.ts
|
|
13982
14032
|
init_cjs_shims();
|
|
13983
14033
|
var fs19 = __toESM(require("fs"));
|
|
13984
|
-
var
|
|
14034
|
+
var path14 = __toESM(require("path"));
|
|
13985
14035
|
init_symlink();
|
|
13986
14036
|
init_paths();
|
|
13987
14037
|
var skillUnpublishCommand = new Command("unpublish").description("Unpublish a skill package to make it private").option("--id <skillId>", "Skill ID (skp-xxx)").option("--name <name>", "Local skill name (directory in ~/.refly/skills/)").action(async (options) => {
|
|
@@ -14003,8 +14053,20 @@ To find your skill name:
|
|
|
14003
14053
|
let name;
|
|
14004
14054
|
if (options.name) {
|
|
14005
14055
|
name = options.name;
|
|
14056
|
+
if (!name) {
|
|
14057
|
+
fail(ErrorCodes.INVALID_INPUT, "Skill name cannot be empty", {
|
|
14058
|
+
hint: `Usage:
|
|
14059
|
+
refly skill unpublish --name <name>
|
|
14060
|
+
refly skill unpublish --id <skillId>
|
|
14061
|
+
|
|
14062
|
+
To find your skill name:
|
|
14063
|
+
refly skill list
|
|
14064
|
+
ls ${skillsDir}/`
|
|
14065
|
+
});
|
|
14066
|
+
return;
|
|
14067
|
+
}
|
|
14006
14068
|
const skillDir = getReflyDomainSkillDir(name);
|
|
14007
|
-
const skillMdPath =
|
|
14069
|
+
const skillMdPath = path14.join(skillDir, "SKILL.md");
|
|
14008
14070
|
if (!fs19.existsSync(skillMdPath)) {
|
|
14009
14071
|
fail(ErrorCodes.NOT_FOUND, `SKILL.md not found at ${skillMdPath}`, {
|
|
14010
14072
|
hint: `Make sure the skill '${name}' exists in ${skillsDir}/
|
|
@@ -14058,7 +14120,7 @@ To see installed skills: refly skill list`
|
|
|
14058
14120
|
// src/commands/skill/run.ts
|
|
14059
14121
|
init_cjs_shims();
|
|
14060
14122
|
var fs20 = __toESM(require("fs"));
|
|
14061
|
-
var
|
|
14123
|
+
var path15 = __toESM(require("path"));
|
|
14062
14124
|
init_symlink();
|
|
14063
14125
|
init_paths();
|
|
14064
14126
|
var skillRunCommand = new Command("run").description("Run an installed skill").option("--id <installationId>", "Installation ID (skpi-xxx)").option("--name <name>", "Local skill name (directory in ~/.refly/skills/)").option("--input <json>", "Input JSON for the skill").option("--workflow <skillWorkflowId>", "Run specific workflow only").option("--async", "Run asynchronously").option("--no-prompt", "Disable interactive prompts (fail if required variables are missing)").action(async (options) => {
|
|
@@ -14083,7 +14145,7 @@ To find your skill name:
|
|
|
14083
14145
|
if (options.name) {
|
|
14084
14146
|
name = options.name;
|
|
14085
14147
|
const skillDir = getReflyDomainSkillDir(options.name);
|
|
14086
|
-
const skillMdPath =
|
|
14148
|
+
const skillMdPath = path15.join(skillDir, "SKILL.md");
|
|
14087
14149
|
if (!fs20.existsSync(skillMdPath)) {
|
|
14088
14150
|
fail(ErrorCodes.NOT_FOUND, `SKILL.md not found at ${skillMdPath}`, {
|
|
14089
14151
|
hint: `Make sure the skill '${name}' exists in ${skillsDir}/
|
|
@@ -14212,7 +14274,7 @@ To install: refly skill install ${meta.skillId}`
|
|
|
14212
14274
|
// src/commands/skill/stop.ts
|
|
14213
14275
|
init_cjs_shims();
|
|
14214
14276
|
var fs21 = __toESM(require("fs"));
|
|
14215
|
-
var
|
|
14277
|
+
var path16 = __toESM(require("path"));
|
|
14216
14278
|
init_symlink();
|
|
14217
14279
|
init_paths();
|
|
14218
14280
|
function getLocalSkillNames() {
|
|
@@ -14227,7 +14289,7 @@ var skillStopCommand = new Command("stop").description("Stop running skill execu
|
|
|
14227
14289
|
const skillsDir = getReflySkillsDir();
|
|
14228
14290
|
const name = options.name;
|
|
14229
14291
|
const skillDir = getReflyDomainSkillDir(name);
|
|
14230
|
-
const skillMdPath =
|
|
14292
|
+
const skillMdPath = path16.join(skillDir, "SKILL.md");
|
|
14231
14293
|
if (!fs21.existsSync(skillMdPath)) {
|
|
14232
14294
|
const availableSkills = getLocalSkillNames();
|
|
14233
14295
|
const skillList = availableSkills.length > 0 ? availableSkills.join(", ") : "(no skills installed)";
|
|
@@ -14427,7 +14489,7 @@ var skillInstallCommand = new Command("install").description("Install a skill pa
|
|
|
14427
14489
|
// src/commands/skill/uninstall.ts
|
|
14428
14490
|
init_cjs_shims();
|
|
14429
14491
|
var fs22 = __toESM(require("fs"));
|
|
14430
|
-
var
|
|
14492
|
+
var path17 = __toESM(require("path"));
|
|
14431
14493
|
init_symlink();
|
|
14432
14494
|
init_paths();
|
|
14433
14495
|
init_logger();
|
|
@@ -14451,8 +14513,20 @@ To find your skill name:
|
|
|
14451
14513
|
let name;
|
|
14452
14514
|
if (options.name) {
|
|
14453
14515
|
name = options.name;
|
|
14516
|
+
if (!name) {
|
|
14517
|
+
fail(ErrorCodes.INVALID_INPUT, "Skill name cannot be empty", {
|
|
14518
|
+
hint: `Usage:
|
|
14519
|
+
refly skill uninstall --name <name>
|
|
14520
|
+
refly skill uninstall --id <installationId>
|
|
14521
|
+
|
|
14522
|
+
To find your skill name:
|
|
14523
|
+
refly skill list
|
|
14524
|
+
ls ${skillsDir}/`
|
|
14525
|
+
});
|
|
14526
|
+
return;
|
|
14527
|
+
}
|
|
14454
14528
|
const skillDir = getReflyDomainSkillDir(name);
|
|
14455
|
-
const skillMdPath =
|
|
14529
|
+
const skillMdPath = path17.join(skillDir, "SKILL.md");
|
|
14456
14530
|
if (!fs22.existsSync(skillMdPath)) {
|
|
14457
14531
|
fail(ErrorCodes.NOT_FOUND, `SKILL.md not found at ${skillMdPath}`, {
|
|
14458
14532
|
hint: `Make sure the skill '${name}' exists in ${skillsDir}/
|
|
@@ -14578,7 +14652,7 @@ init_cjs_shims();
|
|
|
14578
14652
|
// src/skill/loader.ts
|
|
14579
14653
|
init_cjs_shims();
|
|
14580
14654
|
var fs23 = __toESM(require("fs"));
|
|
14581
|
-
var
|
|
14655
|
+
var path18 = __toESM(require("path"));
|
|
14582
14656
|
var import_gray_matter = __toESM(require("gray-matter"));
|
|
14583
14657
|
init_logger();
|
|
14584
14658
|
|
|
@@ -14759,13 +14833,13 @@ function extractSkillMetadata(content) {
|
|
|
14759
14833
|
// src/commands/skill/validate.ts
|
|
14760
14834
|
init_paths();
|
|
14761
14835
|
var fs24 = __toESM(require("fs"));
|
|
14762
|
-
var
|
|
14836
|
+
var path19 = __toESM(require("path"));
|
|
14763
14837
|
var skillValidateCommand = new Command("validate").description("Validate local skill files").argument("[skillPath]", "Path to skill file or directory (defaults to ~/.refly/skills)").option("--fix", "Attempt to fix common issues").action(async (skillPath, _options) => {
|
|
14764
14838
|
try {
|
|
14765
14839
|
const results = [];
|
|
14766
14840
|
let targetPath;
|
|
14767
14841
|
if (skillPath) {
|
|
14768
|
-
targetPath =
|
|
14842
|
+
targetPath = path19.resolve(skillPath);
|
|
14769
14843
|
} else {
|
|
14770
14844
|
await ensureSkillsDir();
|
|
14771
14845
|
targetPath = getSkillsDir();
|
|
@@ -14835,7 +14909,7 @@ function validateSkillFile(filePath) {
|
|
|
14835
14909
|
function findSkillFiles(dir, files = []) {
|
|
14836
14910
|
const entries = fs24.readdirSync(dir, { withFileTypes: true });
|
|
14837
14911
|
for (const entry of entries) {
|
|
14838
|
-
const fullPath =
|
|
14912
|
+
const fullPath = path19.join(dir, entry.name);
|
|
14839
14913
|
if (entry.isDirectory()) {
|
|
14840
14914
|
if (!entry.name.startsWith(".")) {
|
|
14841
14915
|
findSkillFiles(fullPath, files);
|
|
@@ -14852,7 +14926,7 @@ init_cjs_shims();
|
|
|
14852
14926
|
init_symlink();
|
|
14853
14927
|
init_paths();
|
|
14854
14928
|
var fs25 = __toESM(require("fs"));
|
|
14855
|
-
var
|
|
14929
|
+
var path20 = __toESM(require("path"));
|
|
14856
14930
|
var skillSyncCommand = new Command("sync").description("Validate and repair skill symlinks").option("--dry-run", "Show issues without making changes").option("--fix", "Attempt to repair broken symlinks").option("--prune", "Remove orphan symlinks (symlinks without source directory)").action(async (options) => {
|
|
14857
14931
|
try {
|
|
14858
14932
|
const symlinks = listSkillSymlinks();
|
|
@@ -14886,7 +14960,7 @@ var skillSyncCommand = new Command("sync").description("Validate and repair skil
|
|
|
14886
14960
|
if (entry.isDirectory() && entry.name !== "base") {
|
|
14887
14961
|
if (!symlinkNames.has(entry.name)) {
|
|
14888
14962
|
orphans += 1;
|
|
14889
|
-
warnings.push(`Orphan directory (no symlink): ${
|
|
14963
|
+
warnings.push(`Orphan directory (no symlink): ${path20.join(skillsDir, entry.name)}`);
|
|
14890
14964
|
if (options.prune && !options.dryRun) {
|
|
14891
14965
|
const result = createSkillSymlink(entry.name);
|
|
14892
14966
|
if (result.success) {
|
|
@@ -14936,7 +15010,7 @@ var skillCommand = new Command("skill").description("Manage skill packages and l
|
|
|
14936
15010
|
// src/bin/refly.ts
|
|
14937
15011
|
function getVersion() {
|
|
14938
15012
|
try {
|
|
14939
|
-
const pkgPath =
|
|
15013
|
+
const pkgPath = path21.join(__dirname, "..", "..", "package.json");
|
|
14940
15014
|
const pkg = JSON.parse(fs26.readFileSync(pkgPath, "utf-8"));
|
|
14941
15015
|
return pkg.version || "0.1.0";
|
|
14942
15016
|
} catch {
|