@flowrunner/cli 0.1.19-dev.3 → 0.1.19-dev.5
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/bin/banner.js +36 -0
- package/bin/flowrunner.js +31 -1
- package/dist/cli.js +367 -214
- package/dist/cli.js.map +4 -4
- package/dist/index.js +2 -1
- package/dist/index.js.map +2 -2
- package/dist/types/packages/cli/src/constants/testing.d.ts +10 -4
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -8877,11 +8877,11 @@ var require_mime_types = __commonJS({
|
|
|
8877
8877
|
}
|
|
8878
8878
|
return exts[0];
|
|
8879
8879
|
}
|
|
8880
|
-
function lookup(
|
|
8881
|
-
if (!
|
|
8880
|
+
function lookup(path24) {
|
|
8881
|
+
if (!path24 || typeof path24 !== "string") {
|
|
8882
8882
|
return false;
|
|
8883
8883
|
}
|
|
8884
|
-
var extension2 = extname("x." +
|
|
8884
|
+
var extension2 = extname("x." + path24).toLowerCase().substr(1);
|
|
8885
8885
|
if (!extension2) {
|
|
8886
8886
|
return false;
|
|
8887
8887
|
}
|
|
@@ -10044,11 +10044,11 @@ var require_form_data = __commonJS({
|
|
|
10044
10044
|
"use strict";
|
|
10045
10045
|
var CombinedStream = require_combined_stream();
|
|
10046
10046
|
var util = require("util");
|
|
10047
|
-
var
|
|
10047
|
+
var path24 = require("path");
|
|
10048
10048
|
var http2 = require("http");
|
|
10049
10049
|
var https = require("https");
|
|
10050
10050
|
var parseUrl = require("url").parse;
|
|
10051
|
-
var
|
|
10051
|
+
var fs22 = require("fs");
|
|
10052
10052
|
var crypto3 = require("crypto");
|
|
10053
10053
|
var mime = require_mime_types();
|
|
10054
10054
|
var asynckit = require_asynckit();
|
|
@@ -10118,7 +10118,7 @@ var require_form_data = __commonJS({
|
|
|
10118
10118
|
if (value.end != null && value.end !== Infinity && value.start != null) {
|
|
10119
10119
|
callback(null, value.end + 1 - (value.start ? value.start : 0));
|
|
10120
10120
|
} else {
|
|
10121
|
-
|
|
10121
|
+
fs22.stat(value.path, function(err, stat) {
|
|
10122
10122
|
var fileSize;
|
|
10123
10123
|
if (err) {
|
|
10124
10124
|
callback(err);
|
|
@@ -10176,11 +10176,11 @@ var require_form_data = __commonJS({
|
|
|
10176
10176
|
FormData2.prototype._getContentDisposition = function(value, options) {
|
|
10177
10177
|
var filename, contentDisposition;
|
|
10178
10178
|
if (typeof options.filepath === "string") {
|
|
10179
|
-
filename =
|
|
10179
|
+
filename = path24.normalize(options.filepath).replace(/\\/g, "/");
|
|
10180
10180
|
} else if (options.filename || value && (value.name || value.path)) {
|
|
10181
|
-
filename =
|
|
10181
|
+
filename = path24.basename(options.filename || value && (value.name || value.path));
|
|
10182
10182
|
} else if (value && value.readable && hasOwn(value, "httpVersion")) {
|
|
10183
|
-
filename =
|
|
10183
|
+
filename = path24.basename(value.client._httpMessage.path || "");
|
|
10184
10184
|
}
|
|
10185
10185
|
if (filename) {
|
|
10186
10186
|
contentDisposition = 'filename="' + escapeHeaderParam(filename) + '"';
|
|
@@ -10431,15 +10431,15 @@ var require_utils = __commonJS({
|
|
|
10431
10431
|
}
|
|
10432
10432
|
return uriComponent;
|
|
10433
10433
|
}
|
|
10434
|
-
function encodePath(
|
|
10435
|
-
return
|
|
10434
|
+
function encodePath(path24) {
|
|
10435
|
+
return path24.split("/").map(ensureComponentEncoding).join("/");
|
|
10436
10436
|
}
|
|
10437
|
-
function ensureEncoding(
|
|
10437
|
+
function ensureEncoding(path24) {
|
|
10438
10438
|
try {
|
|
10439
|
-
var url = new URL(
|
|
10440
|
-
return url.origin + encodePath(normalizeTrailingSlashInPath(
|
|
10439
|
+
var url = new URL(path24);
|
|
10440
|
+
return url.origin + encodePath(normalizeTrailingSlashInPath(path24, url)) + url.search;
|
|
10441
10441
|
} catch (_unused) {
|
|
10442
|
-
return encodePath(
|
|
10442
|
+
return encodePath(path24);
|
|
10443
10443
|
}
|
|
10444
10444
|
}
|
|
10445
10445
|
function normalizeTrailingSlashInPath(originPath, _ref) {
|
|
@@ -10794,15 +10794,15 @@ var require_client_node = __commonJS({
|
|
|
10794
10794
|
exports2.sendNodeAPIRequest = sendNodeAPIRequest;
|
|
10795
10795
|
var _utils = require_utils();
|
|
10796
10796
|
var _error = require_error();
|
|
10797
|
-
function sendNodeAPIRequest(
|
|
10797
|
+
function sendNodeAPIRequest(path24, method, headers, body, encoding, timeout, withCredentials, tlsOptions) {
|
|
10798
10798
|
return new Promise(function(resolve, reject) {
|
|
10799
|
-
var u = require("url").parse(
|
|
10799
|
+
var u = require("url").parse(path24);
|
|
10800
10800
|
var form = (0, _utils.isFormData)(body) && body;
|
|
10801
10801
|
var https = u.protocol === "https:";
|
|
10802
10802
|
var options = {
|
|
10803
10803
|
host: u.hostname,
|
|
10804
10804
|
port: u.port || (https ? 443 : 80),
|
|
10805
|
-
path: (0, _utils.normalizeTrailingSlashInPath)(
|
|
10805
|
+
path: (0, _utils.normalizeTrailingSlashInPath)(path24, u) + (u.search || ""),
|
|
10806
10806
|
method,
|
|
10807
10807
|
headers,
|
|
10808
10808
|
timeout
|
|
@@ -11210,12 +11210,12 @@ var require_request = __commonJS({
|
|
|
11210
11210
|
var Request = exports2.Request = /* @__PURE__ */ (function(_EventEmitter) {
|
|
11211
11211
|
_inherits(Request2, _EventEmitter);
|
|
11212
11212
|
var _super = _createSuper(Request2);
|
|
11213
|
-
function Request2(
|
|
11213
|
+
function Request2(path24, method, body) {
|
|
11214
11214
|
var _this;
|
|
11215
11215
|
_classCallCheck(this, Request2);
|
|
11216
11216
|
_this = _super.call(this);
|
|
11217
11217
|
_this.method = method;
|
|
11218
|
-
_this.path = (0, _utils.ensureEncoding)(
|
|
11218
|
+
_this.path = (0, _utils.ensureEncoding)(path24);
|
|
11219
11219
|
_this.body = body;
|
|
11220
11220
|
_this.unwrap = true;
|
|
11221
11221
|
_this.raw = false;
|
|
@@ -11444,10 +11444,10 @@ var require_request = __commonJS({
|
|
|
11444
11444
|
value: function send(body) {
|
|
11445
11445
|
var _this2 = this;
|
|
11446
11446
|
this.emit(REQUEST_EVENT, this);
|
|
11447
|
-
var
|
|
11447
|
+
var path24 = this.path;
|
|
11448
11448
|
var queryString = qs.stringify(this.queryParams);
|
|
11449
11449
|
if (queryString) {
|
|
11450
|
-
|
|
11450
|
+
path24 += "?" + queryString;
|
|
11451
11451
|
}
|
|
11452
11452
|
if (!(0, _utils.isFormData)(body) && (0, _utils.isWebFormData)(body)) {
|
|
11453
11453
|
body = toRequestFormData(body);
|
|
@@ -11464,11 +11464,11 @@ var require_request = __commonJS({
|
|
|
11464
11464
|
return _this2.unwrap ? res.body : res;
|
|
11465
11465
|
};
|
|
11466
11466
|
if (Request2.verbose) {
|
|
11467
|
-
console.log(this.method.toUpperCase(), decodeURIComponent(
|
|
11467
|
+
console.log(this.method.toUpperCase(), decodeURIComponent(path24), body, this.headers);
|
|
11468
11468
|
}
|
|
11469
11469
|
var withCredentials = typeof this.withCredentials === "boolean" ? this.withCredentials : Request2.withCredentials;
|
|
11470
11470
|
var syncError = new Error();
|
|
11471
|
-
var request = Request2.send(
|
|
11471
|
+
var request = Request2.send(path24, this.method.toUpperCase(), this.headers, body, this.encoding, this.timeout, withCredentials, this.tlsOptions).then(function(res) {
|
|
11472
11472
|
return parseBody(res, _this2.raw);
|
|
11473
11473
|
}).then(function(res) {
|
|
11474
11474
|
return ensureRawBody(res, _this2.raw);
|
|
@@ -11577,14 +11577,14 @@ var require_client_browser = __commonJS({
|
|
|
11577
11577
|
});
|
|
11578
11578
|
exports2.sendXmlHttpRequest = sendXmlHttpRequest;
|
|
11579
11579
|
var _request2 = require_request();
|
|
11580
|
-
function sendXmlHttpRequest(
|
|
11580
|
+
function sendXmlHttpRequest(path24, method, headers, body, encoding, timeout, withCredentials) {
|
|
11581
11581
|
return new Promise(function sendRequest(resolve, reject) {
|
|
11582
11582
|
var request = new _request2.Request.XMLHttpRequest();
|
|
11583
11583
|
request.timeout = timeout;
|
|
11584
11584
|
if (!encoding) {
|
|
11585
11585
|
request.responseType = "arraybuffer";
|
|
11586
11586
|
}
|
|
11587
|
-
request.open(method.toUpperCase(),
|
|
11587
|
+
request.open(method.toUpperCase(), path24, true);
|
|
11588
11588
|
if (typeof withCredentials === "boolean") {
|
|
11589
11589
|
request.withCredentials = withCredentials;
|
|
11590
11590
|
}
|
|
@@ -11657,16 +11657,16 @@ var require_lib = __commonJS({
|
|
|
11657
11657
|
}
|
|
11658
11658
|
});
|
|
11659
11659
|
_request.Request.XMLHttpRequest = typeof XMLHttpRequest !== "undefined" ? XMLHttpRequest : void 0;
|
|
11660
|
-
_request.Request.send = function(
|
|
11660
|
+
_request.Request.send = function(path24, method, headers, body, encoding, timeout, withCredentials, tlsOptions) {
|
|
11661
11661
|
var sender = typeof _request.Request.XMLHttpRequest !== "undefined" ? _clientBrowser.sendXmlHttpRequest : _clientNode.sendNodeAPIRequest;
|
|
11662
|
-
return sender(
|
|
11662
|
+
return sender(path24, method, headers, body, encoding, timeout, withCredentials, tlsOptions);
|
|
11663
11663
|
};
|
|
11664
11664
|
_request.Request.verbose = false;
|
|
11665
11665
|
_request.Request.withCredentials = false;
|
|
11666
11666
|
_request.Request.methods = ["get", "post", "put", "patch", "delete", "head", "options"];
|
|
11667
11667
|
_request.Request.methods.forEach(function(method) {
|
|
11668
|
-
_request.Request[method] = function(
|
|
11669
|
-
return new _request.Request(
|
|
11668
|
+
_request.Request[method] = function(path24, body) {
|
|
11669
|
+
return new _request.Request(path24, method, body);
|
|
11670
11670
|
};
|
|
11671
11671
|
});
|
|
11672
11672
|
exports2 = module2.exports = _request.Request;
|
|
@@ -12007,25 +12007,25 @@ var require_utils2 = __commonJS({
|
|
|
12007
12007
|
}
|
|
12008
12008
|
mkdirSync(folder);
|
|
12009
12009
|
};
|
|
12010
|
-
Utils.prototype.writeFileTo = function(
|
|
12010
|
+
Utils.prototype.writeFileTo = function(path24, content, overwrite, attr) {
|
|
12011
12011
|
const self = this;
|
|
12012
|
-
if (self.fs.existsSync(
|
|
12012
|
+
if (self.fs.existsSync(path24)) {
|
|
12013
12013
|
if (!overwrite) return false;
|
|
12014
|
-
var stat = self.fs.statSync(
|
|
12014
|
+
var stat = self.fs.statSync(path24);
|
|
12015
12015
|
if (stat.isDirectory()) {
|
|
12016
12016
|
return false;
|
|
12017
12017
|
}
|
|
12018
12018
|
}
|
|
12019
|
-
var folder = pth.dirname(
|
|
12019
|
+
var folder = pth.dirname(path24);
|
|
12020
12020
|
if (!self.fs.existsSync(folder)) {
|
|
12021
12021
|
self.makeDir(folder);
|
|
12022
12022
|
}
|
|
12023
12023
|
var fd;
|
|
12024
12024
|
try {
|
|
12025
|
-
fd = self.fs.openSync(
|
|
12025
|
+
fd = self.fs.openSync(path24, "w", 438);
|
|
12026
12026
|
} catch (e) {
|
|
12027
|
-
self.fs.chmodSync(
|
|
12028
|
-
fd = self.fs.openSync(
|
|
12027
|
+
self.fs.chmodSync(path24, 438);
|
|
12028
|
+
fd = self.fs.openSync(path24, "w", 438);
|
|
12029
12029
|
}
|
|
12030
12030
|
if (fd) {
|
|
12031
12031
|
try {
|
|
@@ -12034,22 +12034,22 @@ var require_utils2 = __commonJS({
|
|
|
12034
12034
|
self.fs.closeSync(fd);
|
|
12035
12035
|
}
|
|
12036
12036
|
}
|
|
12037
|
-
self.fs.chmodSync(
|
|
12037
|
+
self.fs.chmodSync(path24, attr || 438);
|
|
12038
12038
|
return true;
|
|
12039
12039
|
};
|
|
12040
|
-
Utils.prototype.writeFileToAsync = function(
|
|
12040
|
+
Utils.prototype.writeFileToAsync = function(path24, content, overwrite, attr, callback) {
|
|
12041
12041
|
if (typeof attr === "function") {
|
|
12042
12042
|
callback = attr;
|
|
12043
12043
|
attr = void 0;
|
|
12044
12044
|
}
|
|
12045
12045
|
const self = this;
|
|
12046
|
-
self.fs.exists(
|
|
12046
|
+
self.fs.exists(path24, function(exist) {
|
|
12047
12047
|
if (exist && !overwrite) return callback(false);
|
|
12048
|
-
self.fs.stat(
|
|
12048
|
+
self.fs.stat(path24, function(err, stat) {
|
|
12049
12049
|
if (exist && stat && stat.isDirectory()) {
|
|
12050
12050
|
return callback(false);
|
|
12051
12051
|
}
|
|
12052
|
-
var folder = pth.dirname(
|
|
12052
|
+
var folder = pth.dirname(path24);
|
|
12053
12053
|
self.fs.exists(folder, function(exists) {
|
|
12054
12054
|
if (!exists) {
|
|
12055
12055
|
try {
|
|
@@ -12062,16 +12062,16 @@ var require_utils2 = __commonJS({
|
|
|
12062
12062
|
self.fs.write(fd, content, 0, content.length, 0, function(writeErr) {
|
|
12063
12063
|
self.fs.close(fd, function() {
|
|
12064
12064
|
if (writeErr) return callback(false);
|
|
12065
|
-
self.fs.chmod(
|
|
12065
|
+
self.fs.chmod(path24, attr || 438, function() {
|
|
12066
12066
|
callback(true);
|
|
12067
12067
|
});
|
|
12068
12068
|
});
|
|
12069
12069
|
});
|
|
12070
12070
|
};
|
|
12071
|
-
self.fs.open(
|
|
12071
|
+
self.fs.open(path24, "w", 438, function(err2, fd) {
|
|
12072
12072
|
if (err2) {
|
|
12073
|
-
self.fs.chmod(
|
|
12074
|
-
self.fs.open(
|
|
12073
|
+
self.fs.chmod(path24, 438, function() {
|
|
12074
|
+
self.fs.open(path24, "w", 438, function(retryErr, fd2) {
|
|
12075
12075
|
if (retryErr || !fd2) return callback(false);
|
|
12076
12076
|
writeToFd(fd2);
|
|
12077
12077
|
});
|
|
@@ -12107,10 +12107,10 @@ var require_utils2 = __commonJS({
|
|
|
12107
12107
|
if (stat.isSymbolicLink()) throw Errors.FILE_IN_THE_WAY(`"${cur}"`);
|
|
12108
12108
|
}
|
|
12109
12109
|
};
|
|
12110
|
-
Utils.prototype.findFiles = function(
|
|
12110
|
+
Utils.prototype.findFiles = function(path24) {
|
|
12111
12111
|
const self = this;
|
|
12112
12112
|
const canLstat = typeof self.fs.lstatSync === "function";
|
|
12113
|
-
const rootReal = self.fs.realpathSync(
|
|
12113
|
+
const rootReal = self.fs.realpathSync(path24);
|
|
12114
12114
|
function escapesRoot(p) {
|
|
12115
12115
|
if (!canLstat) return false;
|
|
12116
12116
|
if (!self.fs.lstatSync(p).isSymbolicLink()) return false;
|
|
@@ -12129,23 +12129,23 @@ var require_utils2 = __commonJS({
|
|
|
12129
12129
|
}
|
|
12130
12130
|
let files = [];
|
|
12131
12131
|
self.fs.readdirSync(dir).forEach(function(file) {
|
|
12132
|
-
const
|
|
12133
|
-
if (escapesRoot(
|
|
12134
|
-
const stat = self.fs.statSync(
|
|
12135
|
-
if (!pattern || pattern.test(
|
|
12136
|
-
files.push(pth.normalize(
|
|
12132
|
+
const path25 = pth.join(dir, file);
|
|
12133
|
+
if (escapesRoot(path25)) return;
|
|
12134
|
+
const stat = self.fs.statSync(path25);
|
|
12135
|
+
if (!pattern || pattern.test(path25)) {
|
|
12136
|
+
files.push(pth.normalize(path25) + (stat.isDirectory() ? self.sep : ""));
|
|
12137
12137
|
}
|
|
12138
12138
|
if (stat.isDirectory() && recursive) {
|
|
12139
|
-
const realDir = self.fs.realpathSync(
|
|
12139
|
+
const realDir = self.fs.realpathSync(path25);
|
|
12140
12140
|
if (!visited.has(realDir)) {
|
|
12141
12141
|
visited.add(realDir);
|
|
12142
|
-
files = files.concat(findSync(
|
|
12142
|
+
files = files.concat(findSync(path25, pattern, recursive, visited));
|
|
12143
12143
|
}
|
|
12144
12144
|
}
|
|
12145
12145
|
});
|
|
12146
12146
|
return files;
|
|
12147
12147
|
}
|
|
12148
|
-
return findSync(
|
|
12148
|
+
return findSync(path24, void 0, true, /* @__PURE__ */ new Set([rootReal]));
|
|
12149
12149
|
};
|
|
12150
12150
|
Utils.prototype.findFilesAsync = function(dir, cb) {
|
|
12151
12151
|
const self = this;
|
|
@@ -12242,14 +12242,14 @@ var require_utils2 = __commonJS({
|
|
|
12242
12242
|
return "UNSUPPORTED (" + method + ")";
|
|
12243
12243
|
}
|
|
12244
12244
|
};
|
|
12245
|
-
Utils.canonical = function(
|
|
12246
|
-
if (!
|
|
12247
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
12245
|
+
Utils.canonical = function(path24) {
|
|
12246
|
+
if (!path24) return "";
|
|
12247
|
+
const safeSuffix = pth.posix.normalize("/" + path24.split("\\").join("/"));
|
|
12248
12248
|
return pth.join(".", safeSuffix);
|
|
12249
12249
|
};
|
|
12250
|
-
Utils.zipnamefix = function(
|
|
12251
|
-
if (!
|
|
12252
|
-
const safeSuffix = pth.posix.normalize("/" +
|
|
12250
|
+
Utils.zipnamefix = function(path24) {
|
|
12251
|
+
if (!path24) return "";
|
|
12252
|
+
const safeSuffix = pth.posix.normalize("/" + path24.split("\\").join("/"));
|
|
12253
12253
|
return pth.posix.join(".", safeSuffix);
|
|
12254
12254
|
};
|
|
12255
12255
|
Utils.findLast = function(arr, callback) {
|
|
@@ -12266,9 +12266,9 @@ var require_utils2 = __commonJS({
|
|
|
12266
12266
|
prefix = pth.resolve(pth.normalize(prefix));
|
|
12267
12267
|
var parts = name.split("/");
|
|
12268
12268
|
for (var i = 0, l = parts.length; i < l; i++) {
|
|
12269
|
-
var
|
|
12270
|
-
if (
|
|
12271
|
-
return
|
|
12269
|
+
var path24 = pth.normalize(pth.join(prefix, parts.slice(i, l).join(pth.sep)));
|
|
12270
|
+
if (path24 === prefix || path24.startsWith(prefix + pth.sep)) {
|
|
12271
|
+
return path24;
|
|
12272
12272
|
}
|
|
12273
12273
|
}
|
|
12274
12274
|
return pth.normalize(pth.join(prefix, pth.basename(name)));
|
|
@@ -12318,8 +12318,8 @@ var require_utils2 = __commonJS({
|
|
|
12318
12318
|
var require_fattr = __commonJS({
|
|
12319
12319
|
"node_modules/adm-zip/util/fattr.js"(exports2, module2) {
|
|
12320
12320
|
var pth = require("path");
|
|
12321
|
-
module2.exports = function(
|
|
12322
|
-
var _path =
|
|
12321
|
+
module2.exports = function(path24, { fs: fs22 }) {
|
|
12322
|
+
var _path = path24 || "", _obj = newAttr(), _stat = null;
|
|
12323
12323
|
function newAttr() {
|
|
12324
12324
|
return {
|
|
12325
12325
|
directory: false,
|
|
@@ -12330,8 +12330,8 @@ var require_fattr = __commonJS({
|
|
|
12330
12330
|
atime: 0
|
|
12331
12331
|
};
|
|
12332
12332
|
}
|
|
12333
|
-
if (_path &&
|
|
12334
|
-
_stat =
|
|
12333
|
+
if (_path && fs22.existsSync(_path)) {
|
|
12334
|
+
_stat = fs22.statSync(_path);
|
|
12335
12335
|
_obj.directory = _stat.isDirectory();
|
|
12336
12336
|
_obj.mtime = _stat.mtime;
|
|
12337
12337
|
_obj.atime = _stat.atime;
|
|
@@ -14503,12 +14503,32 @@ var require_adm_zip = __commonJS({
|
|
|
14503
14503
|
}
|
|
14504
14504
|
});
|
|
14505
14505
|
|
|
14506
|
+
// bin/banner.js
|
|
14507
|
+
var require_banner = __commonJS({
|
|
14508
|
+
"bin/banner.js"(exports2, module2) {
|
|
14509
|
+
"use strict";
|
|
14510
|
+
var os2 = require("os");
|
|
14511
|
+
var path24 = require("path");
|
|
14512
|
+
function shortPath2(target, home) {
|
|
14513
|
+
return target === home || target.startsWith(home + path24.sep) ? "~" + target.slice(home.length) : target;
|
|
14514
|
+
}
|
|
14515
|
+
function versionBanner2(cli, home = os2.homedir()) {
|
|
14516
|
+
const lines = [`FlowRunner CLI ${cli.version} \u2014 ${shortPath2(cli.root, home)}`];
|
|
14517
|
+
if (cli.launcher) {
|
|
14518
|
+
lines.push(` this project's copy, started by ${cli.launcher.version} \u2014 ${shortPath2(cli.launcher.root, home)}`);
|
|
14519
|
+
}
|
|
14520
|
+
return lines;
|
|
14521
|
+
}
|
|
14522
|
+
module2.exports = { shortPath: shortPath2, versionBanner: versionBanner2 };
|
|
14523
|
+
}
|
|
14524
|
+
});
|
|
14525
|
+
|
|
14506
14526
|
// package.json
|
|
14507
14527
|
var require_package = __commonJS({
|
|
14508
14528
|
"package.json"(exports2, module2) {
|
|
14509
14529
|
module2.exports = {
|
|
14510
14530
|
name: "@flowrunner/cli",
|
|
14511
|
-
version: "0.1.19-dev.
|
|
14531
|
+
version: "0.1.19-dev.5",
|
|
14512
14532
|
publishConfig: {
|
|
14513
14533
|
access: "public"
|
|
14514
14534
|
},
|
|
@@ -14624,7 +14644,8 @@ var TEST_DEV_DEPENDENCIES = {
|
|
|
14624
14644
|
nock: "^14.0.0"
|
|
14625
14645
|
};
|
|
14626
14646
|
var TEST_OVERRIDES = {
|
|
14627
|
-
glob: "^
|
|
14647
|
+
glob: "^14.0.6",
|
|
14648
|
+
minimatch: "^11.0.9"
|
|
14628
14649
|
};
|
|
14629
14650
|
var TEST_SCRIPTS = {
|
|
14630
14651
|
test: "jest",
|
|
@@ -15267,6 +15288,10 @@ function sayError(text2) {
|
|
|
15267
15288
|
console.error(text2);
|
|
15268
15289
|
record(text2);
|
|
15269
15290
|
}
|
|
15291
|
+
function sayStatus(text2) {
|
|
15292
|
+
console.error(text2);
|
|
15293
|
+
record(text2);
|
|
15294
|
+
}
|
|
15270
15295
|
function sayWarning(text2) {
|
|
15271
15296
|
console.warn(text2);
|
|
15272
15297
|
record(text2);
|
|
@@ -16337,31 +16362,31 @@ var SUPPORTED_TYPES = /* @__PURE__ */ new Set([
|
|
|
16337
16362
|
]);
|
|
16338
16363
|
var SUPPORTED_SPELLING = "z.string(), z.number(), z.bigint(), z.boolean(), z.date(), z.enum([\u2026]), z.literal(\u2026), z.object({ \u2026 }), z.array(\u2026), z.record(\u2026), z.union([\u2026]), z.null(), z.any(), z.unknown()";
|
|
16339
16364
|
var MODIFIER_SPELLING = ".optional(), .nullable(), .nullish(), .default(v), .prefault(v), .readonly(), .nonoptional(), .pipe(\u2026)/.transform(\u2026) and z.lazy(\u2026)";
|
|
16340
|
-
function subjectOf(source,
|
|
16365
|
+
function subjectOf(source, path24) {
|
|
16341
16366
|
const kind = source.kind ?? "extension";
|
|
16342
16367
|
const subject = source.itemId ? `${kind} "${source.itemId}": ` : "";
|
|
16343
|
-
return `${subject}\`${
|
|
16368
|
+
return `${subject}\`${path24}\``;
|
|
16344
16369
|
}
|
|
16345
|
-
function refuse(message, source,
|
|
16370
|
+
function refuse(message, source, path24, received) {
|
|
16346
16371
|
throw new InvalidSchemaError(
|
|
16347
16372
|
`[flow-extension:${source.serviceId}] ${message}`,
|
|
16348
|
-
{ serviceId: source.serviceId, kind: source.kind ?? "extension", itemId: source.itemId, slot: source.slot, path:
|
|
16373
|
+
{ serviceId: source.serviceId, kind: source.kind ?? "extension", itemId: source.itemId, slot: source.slot, path: path24, received }
|
|
16349
16374
|
);
|
|
16350
16375
|
}
|
|
16351
|
-
function refuseCatch(source,
|
|
16376
|
+
function refuseCatch(source, path24) {
|
|
16352
16377
|
refuse(
|
|
16353
|
-
`${subjectOf(source,
|
|
16378
|
+
`${subjectOf(source, path24)} uses \`.catch(\u2026)\`, which a parameter may not: it replaces an invalid value with the fallback instead of reporting it, and drops the field out of type coercion. Use \`.default(v)\` \u2014 same fallback when the value is absent, and a supplied-but-invalid one still fails.`,
|
|
16354
16379
|
source,
|
|
16355
|
-
|
|
16380
|
+
path24,
|
|
16356
16381
|
"catch"
|
|
16357
16382
|
);
|
|
16358
16383
|
}
|
|
16359
|
-
function refuseType(source,
|
|
16384
|
+
function refuseType(source, path24, type) {
|
|
16360
16385
|
const received = type ? `z.${type}()` : "a value that is not a zod schema";
|
|
16361
16386
|
refuse(
|
|
16362
|
-
`${subjectOf(source,
|
|
16387
|
+
`${subjectOf(source, path24)} declares ${received}, which the runtime cannot publish as a parameter \u2014 it has no widget, no published type and no coercion for it. Supported: ${SUPPORTED_SPELLING}; each may carry ${MODIFIER_SPELLING}.`,
|
|
16363
16388
|
source,
|
|
16364
|
-
|
|
16389
|
+
path24,
|
|
16365
16390
|
type ?? "unknown"
|
|
16366
16391
|
);
|
|
16367
16392
|
}
|
|
@@ -16377,7 +16402,7 @@ function isLooseObject(schema) {
|
|
|
16377
16402
|
function isDynamicPropsSlot(source, topLevel) {
|
|
16378
16403
|
return topLevel && source.kind === "action" && source.slot === "params";
|
|
16379
16404
|
}
|
|
16380
|
-
function assertDynamicProps(schema, name, siblings, source,
|
|
16405
|
+
function assertDynamicProps(schema, name, siblings, source, path24) {
|
|
16381
16406
|
const ins = inspect(schema);
|
|
16382
16407
|
const spec = ins.meta.frDynamicProps;
|
|
16383
16408
|
if (!spec) {
|
|
@@ -16388,49 +16413,49 @@ function assertDynamicProps(schema, name, siblings, source, path22) {
|
|
|
16388
16413
|
}
|
|
16389
16414
|
if (typeof spec.execute !== "function") {
|
|
16390
16415
|
refuse(
|
|
16391
|
-
`${subjectOf(source,
|
|
16416
|
+
`${subjectOf(source, path24)}: \`.dynamicProps()\` needs an \`execute\` function that returns the loaded fields.`,
|
|
16392
16417
|
source,
|
|
16393
|
-
|
|
16418
|
+
path24,
|
|
16394
16419
|
typeof spec.execute
|
|
16395
16420
|
);
|
|
16396
16421
|
}
|
|
16397
16422
|
if (spec.dependsOn !== void 0 && (!Array.isArray(spec.dependsOn) || spec.dependsOn.some((item) => typeof item !== "string"))) {
|
|
16398
16423
|
refuse(
|
|
16399
|
-
`${subjectOf(source,
|
|
16424
|
+
`${subjectOf(source, path24)}: \`.dynamicProps()\` \`dependsOn\` must be an array of param names.`,
|
|
16400
16425
|
source,
|
|
16401
|
-
|
|
16426
|
+
path24,
|
|
16402
16427
|
"dependsOn"
|
|
16403
16428
|
);
|
|
16404
16429
|
}
|
|
16405
16430
|
for (const dependency of spec.dependsOn ?? []) {
|
|
16406
16431
|
if (dependency === name || !siblings.includes(dependency)) {
|
|
16407
16432
|
refuse(
|
|
16408
|
-
`${subjectOf(source,
|
|
16433
|
+
`${subjectOf(source, path24)}: \`.dynamicProps()\` depends on "${dependency}", which is not another param of this action. Name its sibling params: ${siblings.filter((sibling) => sibling !== name).join(", ") || "none"}.`,
|
|
16409
16434
|
source,
|
|
16410
|
-
|
|
16435
|
+
path24,
|
|
16411
16436
|
dependency
|
|
16412
16437
|
);
|
|
16413
16438
|
}
|
|
16414
16439
|
}
|
|
16415
16440
|
if (ins.meta.frDictionary) {
|
|
16416
16441
|
refuse(
|
|
16417
|
-
`${subjectOf(source,
|
|
16442
|
+
`${subjectOf(source, path24)} declares both \`.dynamicProps()\` and \`.dictionary()\`. A dictionary offers values for one field; dynamic props load the fields inside an object \u2014 use one or the other.`,
|
|
16418
16443
|
source,
|
|
16419
|
-
|
|
16444
|
+
path24,
|
|
16420
16445
|
"dictionary"
|
|
16421
16446
|
);
|
|
16422
16447
|
}
|
|
16423
16448
|
const element = ins.resolvedType === "array" ? ins.core?._zod?.def?.element : void 0;
|
|
16424
16449
|
if (!isLooseObject(schema) && !isLooseObject(element)) {
|
|
16425
16450
|
refuse(
|
|
16426
|
-
`${subjectOf(source,
|
|
16451
|
+
`${subjectOf(source, path24)}: \`.dynamicProps()\` needs a loose object \u2014 the loaded fields are not declared, so a plain \`z.object()\` would strip them. ${DYNAMIC_PROPS_FIX}`,
|
|
16427
16452
|
source,
|
|
16428
|
-
|
|
16453
|
+
path24,
|
|
16429
16454
|
ins.resolvedType ?? "unknown"
|
|
16430
16455
|
);
|
|
16431
16456
|
}
|
|
16432
16457
|
}
|
|
16433
|
-
function assertDictionaryBinding(schema, source,
|
|
16458
|
+
function assertDictionaryBinding(schema, source, path24, scope2) {
|
|
16434
16459
|
const binding = inspect(schema).meta.frDictionary;
|
|
16435
16460
|
if (!binding) {
|
|
16436
16461
|
return;
|
|
@@ -16438,14 +16463,14 @@ function assertDictionaryBinding(schema, source, path22, scope2) {
|
|
|
16438
16463
|
const { clash } = resolveDependsOn(binding, scope2);
|
|
16439
16464
|
if (clash) {
|
|
16440
16465
|
refuse(
|
|
16441
|
-
`${subjectOf(source,
|
|
16466
|
+
`${subjectOf(source, path24)} uses dictionary "${binding.id}", whose criteria "${clash.key}" can come from ${clash.names.map((name) => `"${name}"`).join(" or ")} \u2014 and this field can see all of them, so the dictionary cannot tell which one is meant. Rename one of the params, or bind this field to a dictionary without that alias.`,
|
|
16442
16467
|
source,
|
|
16443
|
-
|
|
16468
|
+
path24,
|
|
16444
16469
|
clash.names.join(", ")
|
|
16445
16470
|
);
|
|
16446
16471
|
}
|
|
16447
16472
|
}
|
|
16448
|
-
function assertDateString(schema, source,
|
|
16473
|
+
function assertDateString(schema, source, path24) {
|
|
16449
16474
|
const ins = inspect(schema);
|
|
16450
16475
|
const pattern = ins.meta.frDateFormat;
|
|
16451
16476
|
const kind = dateStringKind(ins);
|
|
@@ -16453,9 +16478,9 @@ function assertDateString(schema, source, path22) {
|
|
|
16453
16478
|
const format = ins.core?._zod?.def?.format;
|
|
16454
16479
|
const zoned = ins.coreType === "string" && format === "datetime";
|
|
16455
16480
|
refuse(
|
|
16456
|
-
`${subjectOf(source,
|
|
16481
|
+
`${subjectOf(source, path24)} uses \`.dateFormat()\` on ${zoned ? "z.iso.datetime() with a zone \u2014 an instant, not a wall clock" : "a type that is not a date string"}. Only z.iso.date(), z.iso.datetime({ local: true }) and z.iso.time() take a format.`,
|
|
16457
16482
|
source,
|
|
16458
|
-
|
|
16483
|
+
path24,
|
|
16459
16484
|
zoned ? "datetime" : ins.resolvedType ?? "unknown"
|
|
16460
16485
|
);
|
|
16461
16486
|
}
|
|
@@ -16467,7 +16492,7 @@ function assertDateString(schema, source, path22) {
|
|
|
16467
16492
|
compilePattern(pattern, kind);
|
|
16468
16493
|
} catch (error) {
|
|
16469
16494
|
if (error instanceof DateFormatError) {
|
|
16470
|
-
refuse(`${subjectOf(source,
|
|
16495
|
+
refuse(`${subjectOf(source, path24)}: \`.dateFormat('${pattern}')\` ${error.message}.`, source, path24, pattern);
|
|
16471
16496
|
}
|
|
16472
16497
|
throw error;
|
|
16473
16498
|
}
|
|
@@ -16480,14 +16505,14 @@ function assertDateString(schema, source, path22) {
|
|
|
16480
16505
|
const fits = typeof fallback === "string" && (pattern !== void 0 ? !!parseInPattern(fallback, pattern, kind) : ((parts) => !!parts && toCanonical(parts, kind) === fallback)(parseIso(fallback, kind)));
|
|
16481
16506
|
if (!fits) {
|
|
16482
16507
|
refuse(
|
|
16483
|
-
`${subjectOf(source,
|
|
16508
|
+
`${subjectOf(source, path24)} has the default ${JSON.stringify(fallback)}, which is not written in ${written.replace(/'T'/, "T")} \u2014 a default is handed to \`execute\` as written, so write it in the field's own format.`,
|
|
16484
16509
|
source,
|
|
16485
|
-
|
|
16510
|
+
path24,
|
|
16486
16511
|
String(fallback)
|
|
16487
16512
|
);
|
|
16488
16513
|
}
|
|
16489
16514
|
}
|
|
16490
|
-
function assertField(schema, source,
|
|
16515
|
+
function assertField(schema, source, path24, seen, scope2, topLevel = false) {
|
|
16491
16516
|
if (!schema || seen.has(schema)) {
|
|
16492
16517
|
return;
|
|
16493
16518
|
}
|
|
@@ -16495,35 +16520,35 @@ function assertField(schema, source, path22, seen, scope2, topLevel = false) {
|
|
|
16495
16520
|
const ins = inspect(schema);
|
|
16496
16521
|
if (ins.meta.frDynamicProps && !isDynamicPropsSlot(source, topLevel)) {
|
|
16497
16522
|
refuse(
|
|
16498
|
-
`${subjectOf(source,
|
|
16523
|
+
`${subjectOf(source, path24)} uses \`.dynamicProps()\`, which is supported on top-level action params only. For a list of objects, put it on the array rather than on its element.`,
|
|
16499
16524
|
source,
|
|
16500
|
-
|
|
16525
|
+
path24,
|
|
16501
16526
|
"dynamicProps"
|
|
16502
16527
|
);
|
|
16503
16528
|
}
|
|
16504
16529
|
if (ins.resolvedType === "catch") {
|
|
16505
|
-
refuseCatch(source,
|
|
16530
|
+
refuseCatch(source, path24);
|
|
16506
16531
|
}
|
|
16507
|
-
assertDictionaryBinding(schema, source,
|
|
16508
|
-
assertDateString(schema, source,
|
|
16532
|
+
assertDictionaryBinding(schema, source, path24, scope2);
|
|
16533
|
+
assertDateString(schema, source, path24);
|
|
16509
16534
|
if (!ins.resolvedType || !SUPPORTED_TYPES.has(ins.resolvedType)) {
|
|
16510
|
-
refuseType(source,
|
|
16535
|
+
refuseType(source, path24, ins.resolvedType);
|
|
16511
16536
|
}
|
|
16512
16537
|
if (ins.branches) {
|
|
16513
|
-
ins.branches.forEach((branch, index) => assertField(branch, source, `${
|
|
16538
|
+
ins.branches.forEach((branch, index) => assertField(branch, source, `${path24}|branch ${index + 1}`, seen, scope2));
|
|
16514
16539
|
}
|
|
16515
16540
|
const def = ins.core._zod?.def ?? {};
|
|
16516
16541
|
if (ins.resolvedType === "array") {
|
|
16517
|
-
assertField(def.element, source, `${
|
|
16542
|
+
assertField(def.element, source, `${path24}[]`, seen, scope2);
|
|
16518
16543
|
}
|
|
16519
16544
|
if (ins.resolvedType === "record") {
|
|
16520
|
-
assertField(def.valueType, source, `${
|
|
16545
|
+
assertField(def.valueType, source, `${path24}{}`, seen, scope2);
|
|
16521
16546
|
}
|
|
16522
16547
|
if (ins.resolvedType === "object") {
|
|
16523
16548
|
const properties = shapeEntries(ins.core);
|
|
16524
16549
|
const inner = scope2.enter(properties.map(([name]) => name));
|
|
16525
16550
|
for (const [name, property] of properties) {
|
|
16526
|
-
assertField(property, source, `${
|
|
16551
|
+
assertField(property, source, `${path24}.${name}`, seen, inner);
|
|
16527
16552
|
}
|
|
16528
16553
|
}
|
|
16529
16554
|
}
|
|
@@ -17185,52 +17210,52 @@ function isAuthored(issue) {
|
|
|
17185
17210
|
}
|
|
17186
17211
|
function toFieldIssue(plan2, issue, fieldValue) {
|
|
17187
17212
|
const segments = (issue.path ?? []).map(String).filter(Boolean);
|
|
17188
|
-
const
|
|
17213
|
+
const path24 = segments.length ? `${plan2.name}.${segments.join(".")}` : plan2.name;
|
|
17189
17214
|
const code = issue.code ?? "custom";
|
|
17190
17215
|
const target = resolveTarget(plan2, segments, fieldValue);
|
|
17191
17216
|
const named = { ...plan2, label: target.label };
|
|
17192
17217
|
if (isAuthored(issue)) {
|
|
17193
|
-
return { path:
|
|
17218
|
+
return { path: path24, code, message: issue.message };
|
|
17194
17219
|
}
|
|
17195
17220
|
if (code === "invalid_format" && target.schema && inspect(target.schema).branches) {
|
|
17196
17221
|
const combined = unionPhrases(target.schema, target.value);
|
|
17197
17222
|
if (combined.length > 1) {
|
|
17198
|
-
return { path:
|
|
17223
|
+
return { path: path24, code: "invalid_union", message: `\xAB${target.label}\xBB must be ${combined.join(", or ")}` };
|
|
17199
17224
|
}
|
|
17200
17225
|
}
|
|
17201
17226
|
const dateKind = target.schema ? dateStringKind(inspect(target.schema)) : void 0;
|
|
17202
17227
|
const dateMissing = target.value == null || target.value === "";
|
|
17203
17228
|
if (dateKind && (code === "invalid_type" || code === "invalid_format")) {
|
|
17204
|
-
return dateMissing ? { path:
|
|
17229
|
+
return dateMissing ? { path: path24, code, message: requiredMessage(named) } : { path: path24, code, message: invalidTypeMessage(named, expectedDateString(inspect(target.schema), dateKind)) };
|
|
17205
17230
|
}
|
|
17206
17231
|
if (code === "invalid_type") {
|
|
17207
17232
|
const received = issue.received;
|
|
17208
17233
|
const absent = segments.length ? target.found && target.value == null : received === "undefined" || received === "null" || issue.expected === void 0;
|
|
17209
|
-
return absent ? { path:
|
|
17234
|
+
return absent ? { path: path24, code, message: requiredMessage(named) } : { path: path24, code, message: invalidTypeMessage(named, issue.expected ?? "") };
|
|
17210
17235
|
}
|
|
17211
17236
|
if (code === "too_small") {
|
|
17212
|
-
return { path:
|
|
17237
|
+
return { path: path24, code, message: `\xAB${target.label}\xBB must be at least ${bound(issue.minimum, plan2)}` };
|
|
17213
17238
|
}
|
|
17214
17239
|
if (code === "too_big") {
|
|
17215
|
-
return { path:
|
|
17240
|
+
return { path: path24, code, message: `\xAB${target.label}\xBB must be at most ${bound(issue.maximum, plan2)}` };
|
|
17216
17241
|
}
|
|
17217
17242
|
if (code === "invalid_value") {
|
|
17218
|
-
return { path:
|
|
17243
|
+
return { path: path24, code, message: `\xAB${target.label}\xBB must be ${oneOf(issue.values ?? [])}` };
|
|
17219
17244
|
}
|
|
17220
17245
|
if (code === "invalid_format") {
|
|
17221
17246
|
const described = FORMAT_DESCRIPTIONS[issue.format ?? ""];
|
|
17222
|
-
return described ? { path:
|
|
17247
|
+
return described ? { path: path24, code, message: `\xAB${target.label}\xBB is invalid \u2014 ${described.replace(/^Expects /, "expects ")}` } : { path: path24, code, message: `\xAB${target.label}\xBB has an invalid format` };
|
|
17223
17248
|
}
|
|
17224
17249
|
if (code === "invalid_union") {
|
|
17225
17250
|
if (segments.length && target.found && target.value == null) {
|
|
17226
|
-
return { path:
|
|
17251
|
+
return { path: path24, code, message: requiredMessage(named) };
|
|
17227
17252
|
}
|
|
17228
17253
|
const combined = unionIssue(plan2, issue, target.schema, target.value, fieldValue);
|
|
17229
17254
|
if (combined) {
|
|
17230
|
-
return combined.path ? combined : { path:
|
|
17255
|
+
return combined.path ? combined : { path: path24, code, message: `\xAB${target.label}\xBB ${combined.message}` };
|
|
17231
17256
|
}
|
|
17232
17257
|
}
|
|
17233
|
-
return { path:
|
|
17258
|
+
return { path: path24, code, message: `\xAB${target.label}\xBB is invalid` };
|
|
17234
17259
|
}
|
|
17235
17260
|
|
|
17236
17261
|
// ../../flow-extension-runner/src/params/schema/normalize.ts
|
|
@@ -17351,10 +17376,10 @@ var EXPECTED2 = {
|
|
|
17351
17376
|
};
|
|
17352
17377
|
function toIssues(error, param) {
|
|
17353
17378
|
return (error?.issues ?? []).map((issue) => {
|
|
17354
|
-
const
|
|
17379
|
+
const path24 = (issue.path ?? []).map(String).join(".");
|
|
17355
17380
|
const expected = issue.expected;
|
|
17356
|
-
const restated = param && !
|
|
17357
|
-
return { path:
|
|
17381
|
+
const restated = param && !path24 && issue.code === "invalid_type" && expected ? `\xAB${param}\xBB must be ${EXPECTED2[expected] ?? expected}` : void 0;
|
|
17382
|
+
return { path: path24, message: restated ?? issue.message ?? "invalid value", code: issue.code };
|
|
17358
17383
|
});
|
|
17359
17384
|
}
|
|
17360
17385
|
function parseSchema(schema, value, fail3, param) {
|
|
@@ -19031,8 +19056,8 @@ var PollingTriggers = class {
|
|
|
19031
19056
|
};
|
|
19032
19057
|
|
|
19033
19058
|
// ../../flow-extension-runner/src/path.ts
|
|
19034
|
-
function getPath(source,
|
|
19035
|
-
return
|
|
19059
|
+
function getPath(source, path24) {
|
|
19060
|
+
return path24.split(".").reduce(
|
|
19036
19061
|
(acc, key) => acc == null ? acc : acc[key],
|
|
19037
19062
|
source
|
|
19038
19063
|
);
|
|
@@ -19702,12 +19727,12 @@ var RealtimeTriggerMethod = class extends ExtensionMethod {
|
|
|
19702
19727
|
if (typeof match === "function") {
|
|
19703
19728
|
return !!await match({ params, providerEventData, webhookData });
|
|
19704
19729
|
}
|
|
19705
|
-
for (const [paramKey,
|
|
19730
|
+
for (const [paramKey, path24] of Object.entries(match)) {
|
|
19706
19731
|
const paramValue = params[paramKey];
|
|
19707
19732
|
if (!isFilled(paramValue)) {
|
|
19708
19733
|
continue;
|
|
19709
19734
|
}
|
|
19710
|
-
if (`${paramValue}` !== `${getPath(providerEventData,
|
|
19735
|
+
if (`${paramValue}` !== `${getPath(providerEventData, path24)}`) {
|
|
19711
19736
|
return false;
|
|
19712
19737
|
}
|
|
19713
19738
|
}
|
|
@@ -20459,7 +20484,7 @@ var ERROR_HTML = (error) => `<!DOCTYPE html>
|
|
|
20459
20484
|
</body></html>`;
|
|
20460
20485
|
|
|
20461
20486
|
// src/server/routes/callback.ts
|
|
20462
|
-
function callbackRoute(
|
|
20487
|
+
function callbackRoute(path24 = "/callback") {
|
|
20463
20488
|
let resolveCode = null;
|
|
20464
20489
|
let rejectCode = null;
|
|
20465
20490
|
const respond = (route2, html) => {
|
|
@@ -20468,7 +20493,7 @@ function callbackRoute(path22 = "/callback") {
|
|
|
20468
20493
|
};
|
|
20469
20494
|
const route = {
|
|
20470
20495
|
method: "GET",
|
|
20471
|
-
path:
|
|
20496
|
+
path: path24,
|
|
20472
20497
|
handle: (context) => {
|
|
20473
20498
|
const code = context.url.searchParams.get("code");
|
|
20474
20499
|
const error = context.url.searchParams.get("error");
|
|
@@ -21266,33 +21291,156 @@ async function createServiceCommand(templateId, options = {}) {
|
|
|
21266
21291
|
}
|
|
21267
21292
|
}
|
|
21268
21293
|
|
|
21294
|
+
// src/cli/commands/info.ts
|
|
21295
|
+
var import_os = __toESM(require("os"));
|
|
21296
|
+
|
|
21297
|
+
// src/operations/info.ts
|
|
21298
|
+
var import_fs13 = __toESM(require("fs"));
|
|
21299
|
+
var import_path18 = __toESM(require("path"));
|
|
21300
|
+
var CLI_PACKAGE_NAMES = ["@flowrunner/cli", "flowrunner-cli"];
|
|
21301
|
+
function readJson(file) {
|
|
21302
|
+
try {
|
|
21303
|
+
return JSON.parse(import_fs13.default.readFileSync(file, "utf-8"));
|
|
21304
|
+
} catch {
|
|
21305
|
+
return null;
|
|
21306
|
+
}
|
|
21307
|
+
}
|
|
21308
|
+
function pinnedCli(projectRoot) {
|
|
21309
|
+
const manifest = readJson(import_path18.default.join(projectRoot, "package.json"));
|
|
21310
|
+
for (const name of CLI_PACKAGE_NAMES) {
|
|
21311
|
+
const range = manifest?.devDependencies?.[name] ?? manifest?.dependencies?.[name];
|
|
21312
|
+
if (range) {
|
|
21313
|
+
return { name, range };
|
|
21314
|
+
}
|
|
21315
|
+
}
|
|
21316
|
+
return void 0;
|
|
21317
|
+
}
|
|
21318
|
+
function serviceFolders(projectRoot) {
|
|
21319
|
+
const servicesDir = import_path18.default.join(projectRoot, "services");
|
|
21320
|
+
if (!import_fs13.default.existsSync(servicesDir)) {
|
|
21321
|
+
return [];
|
|
21322
|
+
}
|
|
21323
|
+
return import_fs13.default.readdirSync(servicesDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).sort();
|
|
21324
|
+
}
|
|
21325
|
+
function info(options = {}) {
|
|
21326
|
+
const cwd = import_path18.default.resolve(options.cwd ?? ".");
|
|
21327
|
+
const env = options.env ?? process.env;
|
|
21328
|
+
const root = packageRoot();
|
|
21329
|
+
const manifest = readJson(import_path18.default.join(root, "package.json")) ?? {};
|
|
21330
|
+
const cli = {
|
|
21331
|
+
version: manifest.version ?? "unknown",
|
|
21332
|
+
root,
|
|
21333
|
+
launcher: env.FLOWRUNNER_LAUNCHER_ROOT ? { version: env.FLOWRUNNER_LAUNCHER_VERSION || "unknown", root: env.FLOWRUNNER_LAUNCHER_ROOT } : void 0,
|
|
21334
|
+
globalInstall: hasGlobalInstall(),
|
|
21335
|
+
node: process.version,
|
|
21336
|
+
nodeRequired: manifest.engines?.node ?? "any",
|
|
21337
|
+
platform: `${process.platform} ${process.arch}`,
|
|
21338
|
+
aiInstructions: import_path18.default.join(root, AI_INSTRUCTIONS_DIRECTORY)
|
|
21339
|
+
};
|
|
21340
|
+
if (!import_fs13.default.existsSync(import_path18.default.join(cwd, CONFIG_FILE))) {
|
|
21341
|
+
return { cli };
|
|
21342
|
+
}
|
|
21343
|
+
const config = readConfig(cwd);
|
|
21344
|
+
return {
|
|
21345
|
+
cli,
|
|
21346
|
+
project: {
|
|
21347
|
+
root: cwd,
|
|
21348
|
+
pinnedCli: pinnedCli(cwd),
|
|
21349
|
+
serverUrl: getServerUrl(cwd),
|
|
21350
|
+
workspaceId: config.workspaceId,
|
|
21351
|
+
workspaceName: config.workspaceName,
|
|
21352
|
+
loggedIn: loadAuth(cwd) !== null,
|
|
21353
|
+
services: serviceFolders(cwd),
|
|
21354
|
+
missingTestingFiles: TESTING_FILES.filter((file) => !import_fs13.default.existsSync(import_path18.default.join(cwd, file)))
|
|
21355
|
+
}
|
|
21356
|
+
};
|
|
21357
|
+
}
|
|
21358
|
+
|
|
21359
|
+
// src/cli/version-banner.ts
|
|
21360
|
+
var import_fs14 = __toESM(require("fs"));
|
|
21361
|
+
var import_path19 = __toESM(require("path"));
|
|
21362
|
+
var { shortPath, versionBanner } = require_banner();
|
|
21363
|
+
function runningCli() {
|
|
21364
|
+
const root = packageRoot();
|
|
21365
|
+
const { version: version2 } = JSON.parse(import_fs14.default.readFileSync(import_path19.default.join(root, "package.json"), "utf-8"));
|
|
21366
|
+
return { version: version2, root };
|
|
21367
|
+
}
|
|
21368
|
+
function commandBanner(env = process.env) {
|
|
21369
|
+
return env.FLOWRUNNER_BANNER_SHOWN ? [] : versionBanner(runningCli());
|
|
21370
|
+
}
|
|
21371
|
+
|
|
21372
|
+
// src/cli/commands/info.ts
|
|
21373
|
+
var EXACT_VERSION = /^\d+\.\d+\.\d+(-[\w.]+)?$/;
|
|
21374
|
+
function meetsNodeRequirement(required, running) {
|
|
21375
|
+
const match = /^>=\s*(\d+)$/.exec(required.trim());
|
|
21376
|
+
return match ? Number(running.replace(/^v/, "").split(".")[0]) >= Number(match[1]) : null;
|
|
21377
|
+
}
|
|
21378
|
+
function formatInfo({ cli, project }, home = import_os.default.homedir()) {
|
|
21379
|
+
const where = (target) => shortPath(target, home);
|
|
21380
|
+
const row = (label, value) => ` ${label.padEnd(13)} ${value}`;
|
|
21381
|
+
const nodeOk = meetsNodeRequirement(cli.nodeRequired, cli.node);
|
|
21382
|
+
const lines = [
|
|
21383
|
+
"FlowRunner CLI",
|
|
21384
|
+
row("Version", cli.version),
|
|
21385
|
+
row("Installed at", where(cli.root)),
|
|
21386
|
+
...cli.launcher ? [row("Started by", `${cli.launcher.version} \u2014 ${where(cli.launcher.root)}`)] : [],
|
|
21387
|
+
row("Global", cli.globalInstall ? "`flowrunner` is on PATH" : "not installed \u2014 commands run as `npx flowrunner`"),
|
|
21388
|
+
row("Node", `${cli.node} (requires ${cli.nodeRequired})${nodeOk === false ? " \u2190 too old" : ""}`),
|
|
21389
|
+
row("Platform", cli.platform),
|
|
21390
|
+
row("AI docs", `${where(cli.aiInstructions)}/`),
|
|
21391
|
+
""
|
|
21392
|
+
];
|
|
21393
|
+
if (!project) {
|
|
21394
|
+
lines.push("Project", ` none \u2014 no flowrunner.json here. \`${cliCommand()} init\` creates one.`);
|
|
21395
|
+
return lines;
|
|
21396
|
+
}
|
|
21397
|
+
const pinned = project.pinnedCli;
|
|
21398
|
+
const pinnedText = !pinned ? "not declared in package.json" : EXACT_VERSION.test(pinned.range) && pinned.range !== cli.version ? `${pinned.range} \u2190 differs from the running ${cli.version}` : pinned.range;
|
|
21399
|
+
lines.push(
|
|
21400
|
+
`Project ${where(project.root)}`,
|
|
21401
|
+
row("Pinned CLI", pinnedText),
|
|
21402
|
+
row("Server", describeServer(project.serverUrl)),
|
|
21403
|
+
row("Workspace", project.workspaceId ? describeWorkspace({ workspaceId: project.workspaceId, workspaceName: project.workspaceName }) : "not selected"),
|
|
21404
|
+
row("Login", project.loggedIn ? "logged in" : `not logged in \u2014 \`${cliCommand()} login\``),
|
|
21405
|
+
row("Services", project.services.length ? `${plural(project.services.length, "service")} \u2014 ${project.services.join(", ")}` : "none yet"),
|
|
21406
|
+
row("Test harness", project.missingTestingFiles.length ? `missing ${project.missingTestingFiles.join(", ")} \u2014 \`${cliCommand()} init\` adds them` : "in place")
|
|
21407
|
+
);
|
|
21408
|
+
return lines;
|
|
21409
|
+
}
|
|
21410
|
+
function infoCommand() {
|
|
21411
|
+
const [first, ...rest] = formatInfo(info());
|
|
21412
|
+
section(first);
|
|
21413
|
+
rest.forEach((line) => say(line));
|
|
21414
|
+
say("");
|
|
21415
|
+
}
|
|
21416
|
+
|
|
21269
21417
|
// src/cli/commands/init.ts
|
|
21270
|
-
var
|
|
21418
|
+
var import_path23 = __toESM(require("path"));
|
|
21271
21419
|
|
|
21272
21420
|
// src/operations/init/index.ts
|
|
21273
21421
|
var import_child_process = require("child_process");
|
|
21274
|
-
var
|
|
21275
|
-
var
|
|
21422
|
+
var import_fs16 = __toESM(require("fs"));
|
|
21423
|
+
var import_path21 = __toESM(require("path"));
|
|
21276
21424
|
|
|
21277
21425
|
// src/operations/init/testing.ts
|
|
21278
|
-
var
|
|
21279
|
-
var
|
|
21426
|
+
var import_fs15 = __toESM(require("fs"));
|
|
21427
|
+
var import_path20 = __toESM(require("path"));
|
|
21280
21428
|
function testingFilesDirectory() {
|
|
21281
|
-
return
|
|
21429
|
+
return import_path20.default.join(packageRoot(), PROJECT_FILES_DIRECTORY);
|
|
21282
21430
|
}
|
|
21283
21431
|
function writeTestingFiles(projectRoot) {
|
|
21284
21432
|
const source = testingFilesDirectory();
|
|
21285
21433
|
const created = [];
|
|
21286
21434
|
const skipped = [];
|
|
21287
21435
|
for (const file of TESTING_FILES) {
|
|
21288
|
-
const target =
|
|
21289
|
-
if (
|
|
21436
|
+
const target = import_path20.default.join(projectRoot, file);
|
|
21437
|
+
if (import_fs15.default.existsSync(target)) {
|
|
21290
21438
|
skipped.push(file);
|
|
21291
21439
|
continue;
|
|
21292
21440
|
}
|
|
21293
|
-
const contents =
|
|
21294
|
-
|
|
21295
|
-
|
|
21441
|
+
const contents = import_fs15.default.readFileSync(import_path20.default.join(source, file));
|
|
21442
|
+
import_fs15.default.mkdirSync(import_path20.default.dirname(target), { recursive: true });
|
|
21443
|
+
import_fs15.default.writeFileSync(target, contents);
|
|
21296
21444
|
created.push(file);
|
|
21297
21445
|
}
|
|
21298
21446
|
return { created, skipped };
|
|
@@ -21301,12 +21449,12 @@ function writeTestingFiles(projectRoot) {
|
|
|
21301
21449
|
// src/operations/init/index.ts
|
|
21302
21450
|
var GITIGNORE_ENTRIES = ["node_modules/", `${TOKEN_DIR}/`, ...TEST_GITIGNORE_ENTRIES];
|
|
21303
21451
|
var CLI_PACKAGE = "@flowrunner/cli";
|
|
21304
|
-
var
|
|
21452
|
+
var CLI_PACKAGE_NAMES2 = [CLI_PACKAGE, "flowrunner-cli"];
|
|
21305
21453
|
function cliVersion() {
|
|
21306
|
-
return JSON.parse(
|
|
21454
|
+
return JSON.parse(import_fs16.default.readFileSync(import_path21.default.join(packageRoot(), "package.json"), "utf-8")).version;
|
|
21307
21455
|
}
|
|
21308
21456
|
function packageNameFrom(directory) {
|
|
21309
|
-
const name =
|
|
21457
|
+
const name = import_path21.default.basename(import_path21.default.resolve(directory)).toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^[._-]+|[-._]+$/g, "");
|
|
21310
21458
|
return name || "flowrunner-extensions";
|
|
21311
21459
|
}
|
|
21312
21460
|
function addMissing(section2, additions, placeholders = {}) {
|
|
@@ -21320,12 +21468,12 @@ function addMissing(section2, additions, placeholders = {}) {
|
|
|
21320
21468
|
return changed;
|
|
21321
21469
|
}
|
|
21322
21470
|
function writePackageJson(projectRoot, tests) {
|
|
21323
|
-
const fullPath =
|
|
21471
|
+
const fullPath = import_path21.default.join(projectRoot, "package.json");
|
|
21324
21472
|
const version2 = cliVersion();
|
|
21325
21473
|
const devDependencies = { [CLI_PACKAGE]: version2, ...tests ? TEST_DEV_DEPENDENCIES : {} };
|
|
21326
21474
|
const scripts = { deploy: "flowrunner deploy --all", ...tests ? TEST_SCRIPTS : {} };
|
|
21327
21475
|
const overrides = tests ? TEST_OVERRIDES : {};
|
|
21328
|
-
if (!
|
|
21476
|
+
if (!import_fs16.default.existsSync(fullPath)) {
|
|
21329
21477
|
const manifest2 = {
|
|
21330
21478
|
name: packageNameFrom(projectRoot),
|
|
21331
21479
|
version: "0.0.1",
|
|
@@ -21335,11 +21483,11 @@ function writePackageJson(projectRoot, tests) {
|
|
|
21335
21483
|
devDependencies,
|
|
21336
21484
|
...tests ? { overrides } : {}
|
|
21337
21485
|
};
|
|
21338
|
-
|
|
21486
|
+
import_fs16.default.writeFileSync(fullPath, JSON.stringify(manifest2, null, 2) + "\n", "utf-8");
|
|
21339
21487
|
return "created";
|
|
21340
21488
|
}
|
|
21341
|
-
const manifest = JSON.parse(
|
|
21342
|
-
const alreadyDeclared =
|
|
21489
|
+
const manifest = JSON.parse(import_fs16.default.readFileSync(fullPath, "utf-8"));
|
|
21490
|
+
const alreadyDeclared = CLI_PACKAGE_NAMES2.some((name) => manifest.dependencies?.[name] || manifest.devDependencies?.[name]);
|
|
21343
21491
|
const additions = alreadyDeclared ? Object.fromEntries(Object.entries(devDependencies).filter(([name]) => name !== CLI_PACKAGE)) : devDependencies;
|
|
21344
21492
|
manifest.devDependencies ??= {};
|
|
21345
21493
|
manifest.scripts ??= {};
|
|
@@ -21354,22 +21502,22 @@ function writePackageJson(projectRoot, tests) {
|
|
|
21354
21502
|
if (!changed) {
|
|
21355
21503
|
return "skipped";
|
|
21356
21504
|
}
|
|
21357
|
-
|
|
21505
|
+
import_fs16.default.writeFileSync(fullPath, JSON.stringify(manifest, null, 2) + "\n", "utf-8");
|
|
21358
21506
|
return "updated";
|
|
21359
21507
|
}
|
|
21360
21508
|
function writeGitignore(projectRoot) {
|
|
21361
|
-
const fullPath =
|
|
21362
|
-
if (!
|
|
21363
|
-
|
|
21509
|
+
const fullPath = import_path21.default.join(projectRoot, ".gitignore");
|
|
21510
|
+
if (!import_fs16.default.existsSync(fullPath)) {
|
|
21511
|
+
import_fs16.default.writeFileSync(fullPath, GITIGNORE_ENTRIES.join("\n") + "\n", "utf-8");
|
|
21364
21512
|
return "created";
|
|
21365
21513
|
}
|
|
21366
|
-
const content =
|
|
21514
|
+
const content = import_fs16.default.readFileSync(fullPath, "utf-8");
|
|
21367
21515
|
const lines = content.split("\n").map((line) => line.trim());
|
|
21368
21516
|
const missing = GITIGNORE_ENTRIES.filter((entry) => !lines.includes(entry) && !lines.includes(entry.replace(/\/$/, "")));
|
|
21369
21517
|
if (missing.length === 0) {
|
|
21370
21518
|
return "skipped";
|
|
21371
21519
|
}
|
|
21372
|
-
|
|
21520
|
+
import_fs16.default.appendFileSync(fullPath, `${content.endsWith("\n") ? "" : "\n"}${missing.join("\n")}
|
|
21373
21521
|
`);
|
|
21374
21522
|
return "updated";
|
|
21375
21523
|
}
|
|
@@ -21417,11 +21565,11 @@ The authoring reference the CLI ships lives in
|
|
|
21417
21565
|
\`.flowrunner/token\` is the deploy token and must not.
|
|
21418
21566
|
`;
|
|
21419
21567
|
function writeReadme(projectRoot) {
|
|
21420
|
-
const fullPath =
|
|
21421
|
-
if (
|
|
21568
|
+
const fullPath = import_path21.default.join(projectRoot, "README.md");
|
|
21569
|
+
if (import_fs16.default.existsSync(fullPath)) {
|
|
21422
21570
|
return "skipped";
|
|
21423
21571
|
}
|
|
21424
|
-
|
|
21572
|
+
import_fs16.default.writeFileSync(fullPath, README(packageNameFrom(projectRoot)), "utf-8");
|
|
21425
21573
|
return "created";
|
|
21426
21574
|
}
|
|
21427
21575
|
var JSCONFIG = {
|
|
@@ -21433,11 +21581,11 @@ var JSCONFIG = {
|
|
|
21433
21581
|
include: ["services/*/src/**/*.js"]
|
|
21434
21582
|
};
|
|
21435
21583
|
function writeJsconfig(projectRoot) {
|
|
21436
|
-
const fullPath =
|
|
21437
|
-
if (
|
|
21584
|
+
const fullPath = import_path21.default.join(projectRoot, "jsconfig.json");
|
|
21585
|
+
if (import_fs16.default.existsSync(fullPath)) {
|
|
21438
21586
|
return "skipped";
|
|
21439
21587
|
}
|
|
21440
|
-
|
|
21588
|
+
import_fs16.default.writeFileSync(fullPath, JSON.stringify(JSCONFIG, null, 2) + "\n", "utf-8");
|
|
21441
21589
|
return "created";
|
|
21442
21590
|
}
|
|
21443
21591
|
function git(projectRoot, args) {
|
|
@@ -21488,13 +21636,13 @@ function npmInstall(projectRoot, warn) {
|
|
|
21488
21636
|
}
|
|
21489
21637
|
}
|
|
21490
21638
|
function describeTarget(projectRoot) {
|
|
21491
|
-
if (!
|
|
21639
|
+
if (!import_fs16.default.existsSync(projectRoot)) {
|
|
21492
21640
|
return { projectRoot, lines: ["a new directory"], defaultYes: true };
|
|
21493
21641
|
}
|
|
21494
|
-
if (!
|
|
21642
|
+
if (!import_fs16.default.statSync(projectRoot).isDirectory()) {
|
|
21495
21643
|
return { projectRoot, lines: ["not a directory"], defaultYes: false };
|
|
21496
21644
|
}
|
|
21497
|
-
const entries =
|
|
21645
|
+
const entries = import_fs16.default.readdirSync(projectRoot).filter((entry) => entry !== ".git");
|
|
21498
21646
|
if (entries.length === 0) {
|
|
21499
21647
|
return { projectRoot, lines: ["an empty directory"], defaultYes: true };
|
|
21500
21648
|
}
|
|
@@ -21511,7 +21659,7 @@ function describeTarget(projectRoot) {
|
|
|
21511
21659
|
return { projectRoot, lines, defaultYes: false };
|
|
21512
21660
|
}
|
|
21513
21661
|
async function init(options = {}) {
|
|
21514
|
-
const projectRoot =
|
|
21662
|
+
const projectRoot = import_path21.default.resolve(options.cwd ?? ".");
|
|
21515
21663
|
const emit = emitter(options);
|
|
21516
21664
|
const warn = (message) => emit({ type: "warning", message });
|
|
21517
21665
|
const template = options.template ? resolveTemplateId(options.template) : null;
|
|
@@ -21538,10 +21686,10 @@ async function init(options = {}) {
|
|
|
21538
21686
|
committed: false
|
|
21539
21687
|
};
|
|
21540
21688
|
}
|
|
21541
|
-
if (!
|
|
21542
|
-
|
|
21689
|
+
if (!import_fs16.default.existsSync(projectRoot)) {
|
|
21690
|
+
import_fs16.default.mkdirSync(projectRoot, { recursive: true });
|
|
21543
21691
|
}
|
|
21544
|
-
if (!
|
|
21692
|
+
if (!import_fs16.default.statSync(projectRoot).isDirectory()) {
|
|
21545
21693
|
throw new PromptAbortedError(`${projectRoot} is not a directory.`);
|
|
21546
21694
|
}
|
|
21547
21695
|
const created = [];
|
|
@@ -21583,10 +21731,10 @@ async function init(options = {}) {
|
|
|
21583
21731
|
|
|
21584
21732
|
// src/cli/offer-global-install.ts
|
|
21585
21733
|
var import_child_process2 = require("child_process");
|
|
21586
|
-
var
|
|
21587
|
-
var
|
|
21734
|
+
var import_fs17 = __toESM(require("fs"));
|
|
21735
|
+
var import_path22 = __toESM(require("path"));
|
|
21588
21736
|
function runningVersion() {
|
|
21589
|
-
return JSON.parse(
|
|
21737
|
+
return JSON.parse(import_fs17.default.readFileSync(import_path22.default.join(packageRoot(), "package.json"), "utf-8")).version;
|
|
21590
21738
|
}
|
|
21591
21739
|
async function offerGlobalInstall() {
|
|
21592
21740
|
if (!process.stdin.isTTY || hasGlobalInstall()) {
|
|
@@ -21637,7 +21785,7 @@ async function initCommand(templateId, options = {}) {
|
|
|
21637
21785
|
if (result.cancelled) {
|
|
21638
21786
|
return;
|
|
21639
21787
|
}
|
|
21640
|
-
const relative =
|
|
21788
|
+
const relative = import_path23.default.relative(process.cwd(), result.projectRoot);
|
|
21641
21789
|
const where = !relative || relative.startsWith("..") ? result.projectRoot : relative;
|
|
21642
21790
|
const step = (index2, text2) => say(` ${index2}. ${text2}`);
|
|
21643
21791
|
const option = (text2) => say(` ${text2}`);
|
|
@@ -21673,8 +21821,8 @@ async function initCommand(templateId, options = {}) {
|
|
|
21673
21821
|
}
|
|
21674
21822
|
|
|
21675
21823
|
// src/operations/init-claude/index.ts
|
|
21676
|
-
var
|
|
21677
|
-
var
|
|
21824
|
+
var import_fs18 = __toESM(require("fs"));
|
|
21825
|
+
var import_path24 = __toESM(require("path"));
|
|
21678
21826
|
|
|
21679
21827
|
// src/operations/init-claude/segment.ts
|
|
21680
21828
|
var BEGIN_MARKER = "<!-- flowrunner-cli:ai:start -->";
|
|
@@ -21709,16 +21857,16 @@ function mergeSegment(current, segment, file) {
|
|
|
21709
21857
|
|
|
21710
21858
|
// src/operations/init-claude/index.ts
|
|
21711
21859
|
function providerDirectory(provider = CLAUDE_PROVIDER) {
|
|
21712
|
-
return
|
|
21860
|
+
return import_path24.default.join(packageRoot(), AI_PROVIDERS_DIRECTORY, provider);
|
|
21713
21861
|
}
|
|
21714
21862
|
function packedAgents(directory) {
|
|
21715
|
-
if (!
|
|
21863
|
+
if (!import_fs18.default.existsSync(directory)) {
|
|
21716
21864
|
return [];
|
|
21717
21865
|
}
|
|
21718
|
-
return
|
|
21866
|
+
return import_fs18.default.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isFile() && entry.name.endsWith(".md")).map((entry) => entry.name).sort();
|
|
21719
21867
|
}
|
|
21720
21868
|
function writeAgents(sourceDirectory, projectRoot, layout) {
|
|
21721
|
-
const directory =
|
|
21869
|
+
const directory = import_path24.default.join(projectRoot, layout.agentsDirectory);
|
|
21722
21870
|
const agents = packedAgents(sourceDirectory);
|
|
21723
21871
|
const created = [];
|
|
21724
21872
|
const updated = [];
|
|
@@ -21728,59 +21876,59 @@ function writeAgents(sourceDirectory, projectRoot, layout) {
|
|
|
21728
21876
|
warnings.push(`The installed CLI ships no agent definitions in ${PROVIDER_AGENTS_DIRECTORY}/ \u2014 none were written.`);
|
|
21729
21877
|
return { directory, created, updated, unchanged, warnings };
|
|
21730
21878
|
}
|
|
21731
|
-
|
|
21879
|
+
import_fs18.default.mkdirSync(directory, { recursive: true });
|
|
21732
21880
|
for (const agent of agents) {
|
|
21733
|
-
const contents =
|
|
21734
|
-
const target =
|
|
21881
|
+
const contents = import_fs18.default.readFileSync(import_path24.default.join(sourceDirectory, agent), "utf-8");
|
|
21882
|
+
const target = import_path24.default.join(directory, agent);
|
|
21735
21883
|
if (contents.length === 0) {
|
|
21736
21884
|
warnings.push(`${agent} is empty in the installed CLI \u2014 written as an empty file.`);
|
|
21737
21885
|
}
|
|
21738
|
-
if (!
|
|
21739
|
-
|
|
21886
|
+
if (!import_fs18.default.existsSync(target)) {
|
|
21887
|
+
import_fs18.default.writeFileSync(target, contents, "utf-8");
|
|
21740
21888
|
created.push(agent);
|
|
21741
21889
|
continue;
|
|
21742
21890
|
}
|
|
21743
|
-
if (
|
|
21891
|
+
if (import_fs18.default.readFileSync(target, "utf-8") === contents) {
|
|
21744
21892
|
unchanged.push(agent);
|
|
21745
21893
|
continue;
|
|
21746
21894
|
}
|
|
21747
|
-
|
|
21895
|
+
import_fs18.default.writeFileSync(target, contents, "utf-8");
|
|
21748
21896
|
updated.push(agent);
|
|
21749
21897
|
}
|
|
21750
21898
|
return { directory, created, updated, unchanged, warnings };
|
|
21751
21899
|
}
|
|
21752
21900
|
function writeSegment(sourceDirectory, projectRoot, layout) {
|
|
21753
|
-
const file =
|
|
21754
|
-
const source =
|
|
21901
|
+
const file = import_path24.default.join(projectRoot, layout.instructionsFile);
|
|
21902
|
+
const source = import_path24.default.join(sourceDirectory, ORCHESTRATOR_SEGMENT_FILE);
|
|
21755
21903
|
const warnings = [];
|
|
21756
|
-
if (!
|
|
21904
|
+
if (!import_fs18.default.existsSync(source)) {
|
|
21757
21905
|
warnings.push(`The installed CLI ships no ${ORCHESTRATOR_SEGMENT_FILE} \u2014 ${layout.instructionsFile} was left alone.`);
|
|
21758
21906
|
return { file, outcome: "unchanged", warnings };
|
|
21759
21907
|
}
|
|
21760
|
-
const segment =
|
|
21908
|
+
const segment = import_fs18.default.readFileSync(source, "utf-8");
|
|
21761
21909
|
if (segment.trim().length === 0) {
|
|
21762
21910
|
warnings.push(`${ORCHESTRATOR_SEGMENT_FILE} is empty in the installed CLI \u2014 the marked block is empty.`);
|
|
21763
21911
|
}
|
|
21764
|
-
const current =
|
|
21912
|
+
const current = import_fs18.default.existsSync(file) ? import_fs18.default.readFileSync(file, "utf-8") : null;
|
|
21765
21913
|
const merged = mergeSegment(current, segment, layout.instructionsFile);
|
|
21766
21914
|
if (merged.outcome !== "unchanged") {
|
|
21767
|
-
|
|
21915
|
+
import_fs18.default.writeFileSync(file, merged.contents, "utf-8");
|
|
21768
21916
|
}
|
|
21769
21917
|
return { file, outcome: merged.outcome, warnings };
|
|
21770
21918
|
}
|
|
21771
21919
|
async function initClaude(options = {}) {
|
|
21772
|
-
const projectRoot =
|
|
21920
|
+
const projectRoot = import_path24.default.resolve(options.cwd ?? ".");
|
|
21773
21921
|
const emit = emitter(options);
|
|
21774
21922
|
const warnAll = (messages) => messages.forEach((message) => emit({ type: "warning", message }));
|
|
21775
21923
|
const layout = PROVIDERS[CLAUDE_PROVIDER];
|
|
21776
21924
|
const sourceDirectory = providerDirectory(layout.id);
|
|
21777
|
-
if (!
|
|
21778
|
-
throw new AiDocsMissingError(
|
|
21925
|
+
if (!import_fs18.default.existsSync(sourceDirectory)) {
|
|
21926
|
+
throw new AiDocsMissingError(import_path24.default.join(AI_PROVIDERS_DIRECTORY, CLAUDE_PROVIDER));
|
|
21779
21927
|
}
|
|
21780
|
-
if (!
|
|
21781
|
-
|
|
21928
|
+
if (!import_fs18.default.existsSync(projectRoot)) {
|
|
21929
|
+
import_fs18.default.mkdirSync(projectRoot, { recursive: true });
|
|
21782
21930
|
}
|
|
21783
|
-
const agents = writeAgents(
|
|
21931
|
+
const agents = writeAgents(import_path24.default.join(sourceDirectory, PROVIDER_AGENTS_DIRECTORY), projectRoot, layout);
|
|
21784
21932
|
emit({
|
|
21785
21933
|
type: "agents",
|
|
21786
21934
|
directory: agents.directory,
|
|
@@ -21854,12 +22002,12 @@ async function logoutCommand() {
|
|
|
21854
22002
|
|
|
21855
22003
|
// src/operations/pull/index.ts
|
|
21856
22004
|
var import_adm_zip2 = __toESM(require_adm_zip());
|
|
21857
|
-
var
|
|
21858
|
-
var
|
|
22005
|
+
var import_fs20 = __toESM(require("fs"));
|
|
22006
|
+
var import_path26 = __toESM(require("path"));
|
|
21859
22007
|
|
|
21860
22008
|
// src/operations/pull/extract.ts
|
|
21861
|
-
var
|
|
21862
|
-
var
|
|
22009
|
+
var import_fs19 = __toESM(require("fs"));
|
|
22010
|
+
var import_path25 = __toESM(require("path"));
|
|
21863
22011
|
var PACKAGE_PREFIX = "package/";
|
|
21864
22012
|
var SAFE_SERVICE_ID = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
21865
22013
|
function isSafeServiceId(serviceId) {
|
|
@@ -21878,12 +22026,12 @@ function extractService(archive, directory) {
|
|
|
21878
22026
|
let written = 0;
|
|
21879
22027
|
for (const entry of serviceEntries(archive)) {
|
|
21880
22028
|
const relativePath = entry.entryName.slice(PACKAGE_PREFIX.length);
|
|
21881
|
-
const target =
|
|
21882
|
-
if (target !== directory && !target.startsWith(directory +
|
|
22029
|
+
const target = import_path25.default.resolve(directory, relativePath);
|
|
22030
|
+
if (target !== directory && !target.startsWith(directory + import_path25.default.sep)) {
|
|
21883
22031
|
continue;
|
|
21884
22032
|
}
|
|
21885
|
-
|
|
21886
|
-
|
|
22033
|
+
import_fs19.default.mkdirSync(import_path25.default.dirname(target), { recursive: true });
|
|
22034
|
+
import_fs19.default.writeFileSync(target, entry.getData());
|
|
21887
22035
|
written++;
|
|
21888
22036
|
}
|
|
21889
22037
|
return written;
|
|
@@ -21903,7 +22051,7 @@ function declaredDependencies(archive) {
|
|
|
21903
22051
|
|
|
21904
22052
|
// src/operations/pull/index.ts
|
|
21905
22053
|
async function localState(projectRoot, service) {
|
|
21906
|
-
if (!
|
|
22054
|
+
if (!import_fs20.default.existsSync(import_path26.default.resolve(projectRoot, "services", service.serviceId))) {
|
|
21907
22055
|
return "absent";
|
|
21908
22056
|
}
|
|
21909
22057
|
try {
|
|
@@ -21948,7 +22096,7 @@ async function pull(options = {}) {
|
|
|
21948
22096
|
emit({ type: "skipped", serviceId: service.serviceId, reason });
|
|
21949
22097
|
continue;
|
|
21950
22098
|
}
|
|
21951
|
-
const directory =
|
|
22099
|
+
const directory = import_path26.default.resolve(projectRoot, "services", service.serviceId);
|
|
21952
22100
|
const state = await localState(projectRoot, service);
|
|
21953
22101
|
if (state === "same") {
|
|
21954
22102
|
upToDate.push({
|
|
@@ -21969,7 +22117,7 @@ async function pull(options = {}) {
|
|
|
21969
22117
|
const zipBuffer = await guard(() => downloadRemoteService(credentials, service.serviceId));
|
|
21970
22118
|
const archive = new import_adm_zip2.default(zipBuffer);
|
|
21971
22119
|
if (exists) {
|
|
21972
|
-
|
|
22120
|
+
import_fs20.default.rmSync(directory, { recursive: true, force: true });
|
|
21973
22121
|
}
|
|
21974
22122
|
const files = extractService(archive, directory);
|
|
21975
22123
|
const dependencies = declaredDependencies(archive);
|
|
@@ -22069,10 +22217,10 @@ async function pickServices2(available) {
|
|
|
22069
22217
|
}
|
|
22070
22218
|
|
|
22071
22219
|
// src/operations/use-server.ts
|
|
22072
|
-
var
|
|
22220
|
+
var import_fs21 = __toESM(require("fs"));
|
|
22073
22221
|
function useServer(target, options = {}) {
|
|
22074
22222
|
const projectRoot = options.cwd ?? process.cwd();
|
|
22075
|
-
if (!
|
|
22223
|
+
if (!import_fs21.default.existsSync(configPath(projectRoot))) {
|
|
22076
22224
|
throw new NotAProjectError();
|
|
22077
22225
|
}
|
|
22078
22226
|
const serverUrl = resolveServerTarget(target);
|
|
@@ -22148,7 +22296,11 @@ async function useCommand(target) {
|
|
|
22148
22296
|
// src/cli/index.ts
|
|
22149
22297
|
var { version } = require_package();
|
|
22150
22298
|
var program = new import_commander.Command();
|
|
22151
|
-
program.name("flowrunner").description("Flowrunner CLI for Custom extension management").version(version)
|
|
22299
|
+
program.name("flowrunner").description("Flowrunner CLI for Custom extension management").version(version).hook("preAction", (_program, command) => {
|
|
22300
|
+
if (command.name() !== "info") {
|
|
22301
|
+
commandBanner().forEach((line) => sayStatus(line));
|
|
22302
|
+
}
|
|
22303
|
+
});
|
|
22152
22304
|
program.command("init").argument("[template]", "Template to scaffold a first service from; omit to create just the project").description("Create a FlowRunner extensions project (package.json, flowrunner.json, .gitignore)").option("-d, --dir <path>", "Directory to create the project in (defaults to the current one)").option("-s, --server <target>", `Server to point the project at: prod, dev, local, or a full URL (default: ${DEFAULT_CLUSTER} \u2014 ${CLUSTERS[DEFAULT_CLUSTER]})`).option("--id <id>", "Service id, when a template is given (skips that prompt)").option("--name <name>", "Display name, when a template is given (skips that prompt)").option("--set <name=value...>", "Answer any prompt the template declares (repeatable)").option("-y, --yes", "Accept every default and ask nothing").option("--no-install", "Skip the npm install at the end").option("--no-git", "Skip initialising a git repository and making the first commit").option("--no-tests", "Skip the unit-test harness (jest config + sandbox/)").action(initCommand);
|
|
22153
22305
|
program.command("init-claude").description("Wire the FlowRunner agent instructions into this project's Claude setup").option("-d, --dir <path>", "Project directory to wire up (defaults to the current one)").action(initClaudeCommand);
|
|
22154
22306
|
program.command("login").description("Log in to a FlowRunner server via browser-based authorization").option("-s, --server <target>", "prod, dev, local, or a full URL (defaults to serverUrl in flowrunner.json)").action(loginCommand);
|
|
@@ -22157,6 +22309,7 @@ program.command("create-service").alias("cs").argument("[template]", "Template t
|
|
|
22157
22309
|
program.command("use").argument("[target]", "Which server: prod, dev, local \u2014 or a full URL. Omit to list them.").description("Point this project at a Flowrunner server, detaching any login from the previous one").action(useCommand);
|
|
22158
22310
|
program.command("deploy").description("Deploy services from this project to the workspace").option("-s, --service <id...>", "Service to deploy (repeatable). Omit to be asked.").option("--all", "Deploy every service in this project").option("--force", "Upload even a service the workspace already has byte-for-byte").action(deployCommand);
|
|
22159
22311
|
program.command("pull").alias("sync-services").description("Download the workspace's services into services/ so they can be edited and deployed back").option("-s, --service <id...>", "Service to pull (repeatable). Omit to be asked.").option("--all", "Pull every service in the workspace").option("--force", "Overwrite a services/<id>/ folder that already exists").action(pullCommand);
|
|
22312
|
+
program.command("info").description("Show the running CLI (version, location, Node) and this project (server, workspace, services)").action(infoCommand);
|
|
22160
22313
|
program.parse();
|
|
22161
22314
|
/*! Bundled license information:
|
|
22162
22315
|
|