@darkrymit/crunes-cli 0.5.7 → 0.5.9
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/cli.js +737 -245
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -34335,7 +34335,7 @@ var require_debuggability = __commonJS({
|
|
|
34335
34335
|
};
|
|
34336
34336
|
Promise2.prototype._onCancel = function() {
|
|
34337
34337
|
};
|
|
34338
|
-
Promise2.prototype._setOnCancel = function(
|
|
34338
|
+
Promise2.prototype._setOnCancel = function(handler39) {
|
|
34339
34339
|
;
|
|
34340
34340
|
};
|
|
34341
34341
|
Promise2.prototype._attachCancellationCallback = function(onCancel) {
|
|
@@ -34946,10 +34946,10 @@ var require_finally = __commonJS({
|
|
|
34946
34946
|
var CancellationError = Promise2.CancellationError;
|
|
34947
34947
|
var errorObj2 = util3.errorObj;
|
|
34948
34948
|
var catchFilter = require_catch_filter()(NEXT_FILTER);
|
|
34949
|
-
function PassThroughHandlerContext(promise2, type,
|
|
34949
|
+
function PassThroughHandlerContext(promise2, type, handler39) {
|
|
34950
34950
|
this.promise = promise2;
|
|
34951
34951
|
this.type = type;
|
|
34952
|
-
this.handler =
|
|
34952
|
+
this.handler = handler39;
|
|
34953
34953
|
this.called = false;
|
|
34954
34954
|
this.cancelPromise = null;
|
|
34955
34955
|
}
|
|
@@ -34984,10 +34984,10 @@ var require_finally = __commonJS({
|
|
|
34984
34984
|
}
|
|
34985
34985
|
function finallyHandler(reasonOrValue) {
|
|
34986
34986
|
var promise2 = this.promise;
|
|
34987
|
-
var
|
|
34987
|
+
var handler39 = this.handler;
|
|
34988
34988
|
if (!this.called) {
|
|
34989
34989
|
this.called = true;
|
|
34990
|
-
var ret2 = this.isFinallyHandler() ?
|
|
34990
|
+
var ret2 = this.isFinallyHandler() ? handler39.call(promise2._boundValue()) : handler39.call(promise2._boundValue(), reasonOrValue);
|
|
34991
34991
|
if (ret2 === NEXT_FILTER) {
|
|
34992
34992
|
return ret2;
|
|
34993
34993
|
} else if (ret2 !== void 0) {
|
|
@@ -35025,26 +35025,26 @@ var require_finally = __commonJS({
|
|
|
35025
35025
|
return reasonOrValue;
|
|
35026
35026
|
}
|
|
35027
35027
|
}
|
|
35028
|
-
Promise2.prototype._passThrough = function(
|
|
35029
|
-
if (typeof
|
|
35028
|
+
Promise2.prototype._passThrough = function(handler39, type, success, fail2) {
|
|
35029
|
+
if (typeof handler39 !== "function") return this.then();
|
|
35030
35030
|
return this._then(
|
|
35031
35031
|
success,
|
|
35032
35032
|
fail2,
|
|
35033
35033
|
void 0,
|
|
35034
|
-
new PassThroughHandlerContext(this, type,
|
|
35034
|
+
new PassThroughHandlerContext(this, type, handler39),
|
|
35035
35035
|
void 0
|
|
35036
35036
|
);
|
|
35037
35037
|
};
|
|
35038
|
-
Promise2.prototype.lastly = Promise2.prototype["finally"] = function(
|
|
35038
|
+
Promise2.prototype.lastly = Promise2.prototype["finally"] = function(handler39) {
|
|
35039
35039
|
return this._passThrough(
|
|
35040
|
-
|
|
35040
|
+
handler39,
|
|
35041
35041
|
0,
|
|
35042
35042
|
finallyHandler,
|
|
35043
35043
|
finallyHandler
|
|
35044
35044
|
);
|
|
35045
35045
|
};
|
|
35046
|
-
Promise2.prototype.tap = function(
|
|
35047
|
-
return this._passThrough(
|
|
35046
|
+
Promise2.prototype.tap = function(handler39) {
|
|
35047
|
+
return this._passThrough(handler39, 1, finallyHandler);
|
|
35048
35048
|
};
|
|
35049
35049
|
Promise2.prototype.tapCatch = function(handlerOrPredicate) {
|
|
35050
35050
|
var len = arguments.length;
|
|
@@ -35068,9 +35068,9 @@ var require_finally = __commonJS({
|
|
|
35068
35068
|
}
|
|
35069
35069
|
}
|
|
35070
35070
|
catchInstances.length = j3;
|
|
35071
|
-
var
|
|
35071
|
+
var handler39 = arguments[i];
|
|
35072
35072
|
return this._passThrough(
|
|
35073
|
-
catchFilter(catchInstances,
|
|
35073
|
+
catchFilter(catchInstances, handler39, this),
|
|
35074
35074
|
1,
|
|
35075
35075
|
void 0,
|
|
35076
35076
|
finallyHandler
|
|
@@ -35437,10 +35437,10 @@ var require_direct_resolve = __commonJS({
|
|
|
35437
35437
|
);
|
|
35438
35438
|
} else {
|
|
35439
35439
|
var _reason = arguments[1];
|
|
35440
|
-
var
|
|
35440
|
+
var handler39 = function() {
|
|
35441
35441
|
throw _reason;
|
|
35442
35442
|
};
|
|
35443
|
-
return this.caught(reason,
|
|
35443
|
+
return this.caught(reason, handler39);
|
|
35444
35444
|
}
|
|
35445
35445
|
};
|
|
35446
35446
|
Promise2.prototype.catchReturn = function(value) {
|
|
@@ -35456,10 +35456,10 @@ var require_direct_resolve = __commonJS({
|
|
|
35456
35456
|
} else {
|
|
35457
35457
|
var _value = arguments[1];
|
|
35458
35458
|
if (_value instanceof Promise2) _value.suppressUnhandledRejections();
|
|
35459
|
-
var
|
|
35459
|
+
var handler39 = function() {
|
|
35460
35460
|
return _value;
|
|
35461
35461
|
};
|
|
35462
|
-
return this.caught(value,
|
|
35462
|
+
return this.caught(value, handler39);
|
|
35463
35463
|
}
|
|
35464
35464
|
};
|
|
35465
35465
|
};
|
|
@@ -37624,22 +37624,22 @@ var require_promise = __commonJS({
|
|
|
37624
37624
|
}
|
|
37625
37625
|
var context = getContext();
|
|
37626
37626
|
if (!((bitField & 50397184) === 0)) {
|
|
37627
|
-
var
|
|
37627
|
+
var handler39, value, settler = target._settlePromiseCtx;
|
|
37628
37628
|
if ((bitField & 33554432) !== 0) {
|
|
37629
37629
|
value = target._rejectionHandler0;
|
|
37630
|
-
|
|
37630
|
+
handler39 = didFulfill;
|
|
37631
37631
|
} else if ((bitField & 16777216) !== 0) {
|
|
37632
37632
|
value = target._fulfillmentHandler0;
|
|
37633
|
-
|
|
37633
|
+
handler39 = didReject;
|
|
37634
37634
|
target._unsetRejectionIsUnhandled();
|
|
37635
37635
|
} else {
|
|
37636
37636
|
settler = target._settlePromiseLateCancellationObserver;
|
|
37637
37637
|
value = new CancellationError("late cancellation observer");
|
|
37638
37638
|
target._attachExtraTrace(value);
|
|
37639
|
-
|
|
37639
|
+
handler39 = didReject;
|
|
37640
37640
|
}
|
|
37641
37641
|
async.invoke(settler, target, {
|
|
37642
|
-
handler: util3.contextBind(context,
|
|
37642
|
+
handler: util3.contextBind(context, handler39),
|
|
37643
37643
|
promise: promise2,
|
|
37644
37644
|
receiver: receiver2,
|
|
37645
37645
|
value
|
|
@@ -37831,7 +37831,7 @@ var require_promise = __commonJS({
|
|
|
37831
37831
|
promise2._rejectCallback(r, true);
|
|
37832
37832
|
}
|
|
37833
37833
|
};
|
|
37834
|
-
Promise2.prototype._settlePromiseFromHandler = function(
|
|
37834
|
+
Promise2.prototype._settlePromiseFromHandler = function(handler39, receiver2, value, promise2) {
|
|
37835
37835
|
var bitField = promise2._bitField;
|
|
37836
37836
|
if ((bitField & 65536) !== 0) return;
|
|
37837
37837
|
promise2._pushContext();
|
|
@@ -37841,10 +37841,10 @@ var require_promise = __commonJS({
|
|
|
37841
37841
|
x2 = errorObj2;
|
|
37842
37842
|
x2.e = new TypeError2("cannot .spread() a non-array: " + util3.classString(value));
|
|
37843
37843
|
} else {
|
|
37844
|
-
x2 = tryCatch2(
|
|
37844
|
+
x2 = tryCatch2(handler39).apply(this._boundValue(), value);
|
|
37845
37845
|
}
|
|
37846
37846
|
} else {
|
|
37847
|
-
x2 = tryCatch2(
|
|
37847
|
+
x2 = tryCatch2(handler39).call(receiver2, value);
|
|
37848
37848
|
}
|
|
37849
37849
|
var promiseCreated = promise2._popContext();
|
|
37850
37850
|
bitField = promise2._bitField;
|
|
@@ -37869,7 +37869,7 @@ var require_promise = __commonJS({
|
|
|
37869
37869
|
Promise2.prototype._setFollowee = function(promise2) {
|
|
37870
37870
|
this._rejectionHandler0 = promise2;
|
|
37871
37871
|
};
|
|
37872
|
-
Promise2.prototype._settlePromise = function(promise2,
|
|
37872
|
+
Promise2.prototype._settlePromise = function(promise2, handler39, receiver2, value) {
|
|
37873
37873
|
var isPromise = promise2 instanceof Promise2;
|
|
37874
37874
|
var bitField = this._bitField;
|
|
37875
37875
|
var asyncGuaranteed = (bitField & 134217728) !== 0;
|
|
@@ -37877,10 +37877,10 @@ var require_promise = __commonJS({
|
|
|
37877
37877
|
if (isPromise) promise2._invokeInternalOnCancel();
|
|
37878
37878
|
if (receiver2 instanceof PassThroughHandlerContext && receiver2.isFinallyHandler()) {
|
|
37879
37879
|
receiver2.cancelPromise = promise2;
|
|
37880
|
-
if (tryCatch2(
|
|
37880
|
+
if (tryCatch2(handler39).call(receiver2, value) === errorObj2) {
|
|
37881
37881
|
promise2._reject(errorObj2.e);
|
|
37882
37882
|
}
|
|
37883
|
-
} else if (
|
|
37883
|
+
} else if (handler39 === reflectHandler2) {
|
|
37884
37884
|
promise2._fulfill(reflectHandler2.call(receiver2));
|
|
37885
37885
|
} else if (receiver2 instanceof Proxyable) {
|
|
37886
37886
|
receiver2._promiseCancelled(promise2);
|
|
@@ -37889,12 +37889,12 @@ var require_promise = __commonJS({
|
|
|
37889
37889
|
} else {
|
|
37890
37890
|
receiver2.cancel();
|
|
37891
37891
|
}
|
|
37892
|
-
} else if (typeof
|
|
37892
|
+
} else if (typeof handler39 === "function") {
|
|
37893
37893
|
if (!isPromise) {
|
|
37894
|
-
|
|
37894
|
+
handler39.call(receiver2, value, promise2);
|
|
37895
37895
|
} else {
|
|
37896
37896
|
if (asyncGuaranteed) promise2._setAsyncGuaranteed();
|
|
37897
|
-
this._settlePromiseFromHandler(
|
|
37897
|
+
this._settlePromiseFromHandler(handler39, receiver2, value, promise2);
|
|
37898
37898
|
}
|
|
37899
37899
|
} else if (receiver2 instanceof Proxyable) {
|
|
37900
37900
|
if (!receiver2._isResolved()) {
|
|
@@ -37914,15 +37914,15 @@ var require_promise = __commonJS({
|
|
|
37914
37914
|
}
|
|
37915
37915
|
};
|
|
37916
37916
|
Promise2.prototype._settlePromiseLateCancellationObserver = function(ctx) {
|
|
37917
|
-
var
|
|
37917
|
+
var handler39 = ctx.handler;
|
|
37918
37918
|
var promise2 = ctx.promise;
|
|
37919
37919
|
var receiver2 = ctx.receiver;
|
|
37920
37920
|
var value = ctx.value;
|
|
37921
|
-
if (typeof
|
|
37921
|
+
if (typeof handler39 === "function") {
|
|
37922
37922
|
if (!(promise2 instanceof Promise2)) {
|
|
37923
|
-
|
|
37923
|
+
handler39.call(receiver2, value, promise2);
|
|
37924
37924
|
} else {
|
|
37925
|
-
this._settlePromiseFromHandler(
|
|
37925
|
+
this._settlePromiseFromHandler(handler39, receiver2, value, promise2);
|
|
37926
37926
|
}
|
|
37927
37927
|
} else if (promise2 instanceof Promise2) {
|
|
37928
37928
|
promise2._reject(value);
|
|
@@ -37931,12 +37931,12 @@ var require_promise = __commonJS({
|
|
|
37931
37931
|
Promise2.prototype._settlePromiseCtx = function(ctx) {
|
|
37932
37932
|
this._settlePromise(ctx.promise, ctx.handler, ctx.receiver, ctx.value);
|
|
37933
37933
|
};
|
|
37934
|
-
Promise2.prototype._settlePromise0 = function(
|
|
37934
|
+
Promise2.prototype._settlePromise0 = function(handler39, value, bitField) {
|
|
37935
37935
|
var promise2 = this._promise0;
|
|
37936
37936
|
var receiver2 = this._receiverAt(0);
|
|
37937
37937
|
this._promise0 = void 0;
|
|
37938
37938
|
this._receiver0 = void 0;
|
|
37939
|
-
this._settlePromise(promise2,
|
|
37939
|
+
this._settlePromise(promise2, handler39, receiver2, value);
|
|
37940
37940
|
};
|
|
37941
37941
|
Promise2.prototype._clearCallbackDataAtIndex = function(index3) {
|
|
37942
37942
|
var base = index3 * 4 - 4;
|
|
@@ -37977,20 +37977,20 @@ var require_promise = __commonJS({
|
|
|
37977
37977
|
};
|
|
37978
37978
|
Promise2.prototype._fulfillPromises = function(len, value) {
|
|
37979
37979
|
for (var i = 1; i < len; i++) {
|
|
37980
|
-
var
|
|
37980
|
+
var handler39 = this._fulfillmentHandlerAt(i);
|
|
37981
37981
|
var promise2 = this._promiseAt(i);
|
|
37982
37982
|
var receiver2 = this._receiverAt(i);
|
|
37983
37983
|
this._clearCallbackDataAtIndex(i);
|
|
37984
|
-
this._settlePromise(promise2,
|
|
37984
|
+
this._settlePromise(promise2, handler39, receiver2, value);
|
|
37985
37985
|
}
|
|
37986
37986
|
};
|
|
37987
37987
|
Promise2.prototype._rejectPromises = function(len, reason) {
|
|
37988
37988
|
for (var i = 1; i < len; i++) {
|
|
37989
|
-
var
|
|
37989
|
+
var handler39 = this._rejectionHandlerAt(i);
|
|
37990
37990
|
var promise2 = this._promiseAt(i);
|
|
37991
37991
|
var receiver2 = this._receiverAt(i);
|
|
37992
37992
|
this._clearCallbackDataAtIndex(i);
|
|
37993
|
-
this._settlePromise(promise2,
|
|
37993
|
+
this._settlePromise(promise2, handler39, receiver2, reason);
|
|
37994
37994
|
}
|
|
37995
37995
|
};
|
|
37996
37996
|
Promise2.prototype._settlePromises = function() {
|
|
@@ -43041,23 +43041,23 @@ var require_async3 = __commonJS({
|
|
|
43041
43041
|
unsaturated: [],
|
|
43042
43042
|
empty: []
|
|
43043
43043
|
};
|
|
43044
|
-
function on2(event,
|
|
43045
|
-
events[event].push(
|
|
43044
|
+
function on2(event, handler39) {
|
|
43045
|
+
events[event].push(handler39);
|
|
43046
43046
|
}
|
|
43047
|
-
function once2(event,
|
|
43047
|
+
function once2(event, handler39) {
|
|
43048
43048
|
const handleAndRemove = (...args) => {
|
|
43049
43049
|
off(event, handleAndRemove);
|
|
43050
|
-
|
|
43050
|
+
handler39(...args);
|
|
43051
43051
|
};
|
|
43052
43052
|
events[event].push(handleAndRemove);
|
|
43053
43053
|
}
|
|
43054
|
-
function off(event,
|
|
43054
|
+
function off(event, handler39) {
|
|
43055
43055
|
if (!event) return Object.keys(events).forEach((ev) => events[ev] = []);
|
|
43056
|
-
if (!
|
|
43057
|
-
events[event] = events[event].filter((ev) => ev !==
|
|
43056
|
+
if (!handler39) return events[event] = [];
|
|
43057
|
+
events[event] = events[event].filter((ev) => ev !== handler39);
|
|
43058
43058
|
}
|
|
43059
43059
|
function trigger(event, ...args) {
|
|
43060
|
-
events[event].forEach((
|
|
43060
|
+
events[event].forEach((handler39) => handler39(...args));
|
|
43061
43061
|
}
|
|
43062
43062
|
var processingScheduled = false;
|
|
43063
43063
|
function _insert(data, insertAtFront, rejectOnError, callback2) {
|
|
@@ -43126,8 +43126,8 @@ var require_async3 = __commonJS({
|
|
|
43126
43126
|
}
|
|
43127
43127
|
return false;
|
|
43128
43128
|
}
|
|
43129
|
-
const eventMethod = (name) => (
|
|
43130
|
-
if (!
|
|
43129
|
+
const eventMethod = (name) => (handler39) => {
|
|
43130
|
+
if (!handler39) {
|
|
43131
43131
|
return new Promise((resolve7, reject2) => {
|
|
43132
43132
|
once2(name, (err, data) => {
|
|
43133
43133
|
if (err) return reject2(err);
|
|
@@ -43136,7 +43136,7 @@ var require_async3 = __commonJS({
|
|
|
43136
43136
|
});
|
|
43137
43137
|
}
|
|
43138
43138
|
off(name);
|
|
43139
|
-
on2(name,
|
|
43139
|
+
on2(name, handler39);
|
|
43140
43140
|
};
|
|
43141
43141
|
var isProcessing = false;
|
|
43142
43142
|
var q3 = {
|
|
@@ -71572,9 +71572,9 @@ var require_event_target = __commonJS({
|
|
|
71572
71572
|
* the listener would be automatically removed when invoked.
|
|
71573
71573
|
* @public
|
|
71574
71574
|
*/
|
|
71575
|
-
addEventListener(type,
|
|
71575
|
+
addEventListener(type, handler39, options = {}) {
|
|
71576
71576
|
for (const listener of this.listeners(type)) {
|
|
71577
|
-
if (!options[kForOnEventAttribute] && listener[kListener] ===
|
|
71577
|
+
if (!options[kForOnEventAttribute] && listener[kListener] === handler39 && !listener[kForOnEventAttribute]) {
|
|
71578
71578
|
return;
|
|
71579
71579
|
}
|
|
71580
71580
|
}
|
|
@@ -71585,7 +71585,7 @@ var require_event_target = __commonJS({
|
|
|
71585
71585
|
data: isBinary ? data : data.toString()
|
|
71586
71586
|
});
|
|
71587
71587
|
event[kTarget] = this;
|
|
71588
|
-
callListener(
|
|
71588
|
+
callListener(handler39, this, event);
|
|
71589
71589
|
};
|
|
71590
71590
|
} else if (type === "close") {
|
|
71591
71591
|
wrapper = function onClose(code2, message) {
|
|
@@ -71595,7 +71595,7 @@ var require_event_target = __commonJS({
|
|
|
71595
71595
|
wasClean: this._closeFrameReceived && this._closeFrameSent
|
|
71596
71596
|
});
|
|
71597
71597
|
event[kTarget] = this;
|
|
71598
|
-
callListener(
|
|
71598
|
+
callListener(handler39, this, event);
|
|
71599
71599
|
};
|
|
71600
71600
|
} else if (type === "error") {
|
|
71601
71601
|
wrapper = function onError(error) {
|
|
@@ -71604,19 +71604,19 @@ var require_event_target = __commonJS({
|
|
|
71604
71604
|
message: error.message
|
|
71605
71605
|
});
|
|
71606
71606
|
event[kTarget] = this;
|
|
71607
|
-
callListener(
|
|
71607
|
+
callListener(handler39, this, event);
|
|
71608
71608
|
};
|
|
71609
71609
|
} else if (type === "open") {
|
|
71610
71610
|
wrapper = function onOpen() {
|
|
71611
71611
|
const event = new Event2("open");
|
|
71612
71612
|
event[kTarget] = this;
|
|
71613
|
-
callListener(
|
|
71613
|
+
callListener(handler39, this, event);
|
|
71614
71614
|
};
|
|
71615
71615
|
} else {
|
|
71616
71616
|
return;
|
|
71617
71617
|
}
|
|
71618
71618
|
wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
|
|
71619
|
-
wrapper[kListener] =
|
|
71619
|
+
wrapper[kListener] = handler39;
|
|
71620
71620
|
if (options.once) {
|
|
71621
71621
|
this.once(type, wrapper);
|
|
71622
71622
|
} else {
|
|
@@ -71630,9 +71630,9 @@ var require_event_target = __commonJS({
|
|
|
71630
71630
|
* @param {(Function|Object)} handler The listener to remove
|
|
71631
71631
|
* @public
|
|
71632
71632
|
*/
|
|
71633
|
-
removeEventListener(type,
|
|
71633
|
+
removeEventListener(type, handler39) {
|
|
71634
71634
|
for (const listener of this.listeners(type)) {
|
|
71635
|
-
if (listener[kListener] ===
|
|
71635
|
+
if (listener[kListener] === handler39 && !listener[kForOnEventAttribute]) {
|
|
71636
71636
|
this.removeListener(type, listener);
|
|
71637
71637
|
break;
|
|
71638
71638
|
}
|
|
@@ -72275,15 +72275,15 @@ var require_websocket = __commonJS({
|
|
|
72275
72275
|
}
|
|
72276
72276
|
return null;
|
|
72277
72277
|
},
|
|
72278
|
-
set(
|
|
72278
|
+
set(handler39) {
|
|
72279
72279
|
for (const listener of this.listeners(method)) {
|
|
72280
72280
|
if (listener[kForOnEventAttribute]) {
|
|
72281
72281
|
this.removeListener(method, listener);
|
|
72282
72282
|
break;
|
|
72283
72283
|
}
|
|
72284
72284
|
}
|
|
72285
|
-
if (typeof
|
|
72286
|
-
this.addEventListener(method,
|
|
72285
|
+
if (typeof handler39 !== "function") return;
|
|
72286
|
+
this.addEventListener(method, handler39, {
|
|
72287
72287
|
[kForOnEventAttribute]: true
|
|
72288
72288
|
});
|
|
72289
72289
|
}
|
|
@@ -73977,7 +73977,7 @@ var init_embedded = __esm({
|
|
|
73977
73977
|
init_require_shim();
|
|
73978
73978
|
md = "export function h1(text) { return `# ${text}\\n`; }\nexport function h2(text) { return `## ${text}\\n`; }\nexport function h3(text) { return `### ${text}\\n`; }\nexport function p(text) { return `${text}\\n`; }\nexport function bold(text) { return `**${text}**`; }\nexport function italic(text) { return `_${text}_`; }\nexport function code(text) { return `\\`${text}\\``; }\n\nexport function codeBlock(text, lang = '') {\n return `\\`\\`\\`${lang}\\n${text}\\n\\`\\`\\`\\n`;\n}\n\nexport function ul(items) {\n return items.map(i => `- ${i}`).join('\\n') + '\\n';\n}\n\nexport function ol(items) {\n return items.map((i, n) => `${n + 1}. ${i}`).join('\\n') + '\\n';\n}\n\nexport function link(text, url) {\n return `[${text}](${url})`;\n}\n\nexport function table(headers, rows) {\n const sep = headers.map(() => '---');\n const lines = [\n `| ${headers.join(' | ')} |`,\n `| ${sep.join(' | ')} |`,\n ...rows.map(r => `| ${r.join(' | ')} |`),\n ];\n return lines.join('\\n') + '\\n';\n}\n\nexport function blockquote(text) {\n return text.split('\\n').map(line => `> ${line}`).join('\\n') + '\\n';\n}\n";
|
|
73979
73979
|
tree = "export function node(name, description, children = []) {\n return { name, description, children };\n}\n\n/**\n * Formats a tree node to a string.\n * options.style: 'tree' (default, ASCII art) | 'list' (nested markdown list)\n * options.bullet: '-' (default) | '*' | '+' \u2014 only used for 'list' style\n */\nexport function format(root, options = {}) {\n const { style = 'tree', bullet = '-' } = options;\n if (style === 'list') return formatList(root, bullet, 0);\n return formatTree(root);\n}\n\nfunction formatTree(root) {\n if (!root) return '';\n const lines = [`${root.name.padEnd(12)}${root.description}`];\n appendTreeChildren(root.children ?? [], '', lines);\n return lines.join('\\n');\n}\n\nfunction appendTreeChildren(children, prefix, lines) {\n for (let i = 0; i < children.length; i++) {\n const child = children[i];\n const isLast = i === children.length - 1;\n const connector = isLast ? '\u2514\u2500\u2500 ' : '\u251C\u2500\u2500 ';\n const childPrefix = prefix + (isLast ? ' ' : '\u2502 ');\n lines.push(`${prefix}${connector}${child.name.padEnd(12)}${child.description}`);\n appendTreeChildren(child.children ?? [], childPrefix, lines);\n }\n}\n\nfunction formatList(node, bullet, depth) {\n const indent = ' '.repeat(depth);\n const lines = [`${indent}${bullet} **${node.name}** \u2014 ${node.description}`];\n for (const child of (node.children ?? [])) {\n lines.push(formatList(child, bullet, depth + 1));\n }\n return lines.join('\\n');\n}\n";
|
|
73980
|
-
utils = "// Assembled inside the V8 isolate. Imports from pre-compiled isolate modules for\n// md and tree; wires host-side Reference callbacks for fs, shell, and section.\n// $__utils_* globals are injected by the host before this module is evaluated.\n\nimport * as md from 'crunes:md'\nimport * as tree from 'crunes:tree'\n\nconst __vars = JSON.parse($__vars)\n\nclass TextEncoder {\n encode(str) {\n const bytes = []\n for (let i = 0; i < str.length; i++) {\n let code = str.charCodeAt(i)\n if (code < 0x80) {\n bytes.push(code)\n } else if (code < 0x800) {\n bytes.push(0xc0 | (code >> 6), 0x80 | (code & 0x3f))\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes.push(0xe0 | (code >> 12), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f))\n } else {\n i++\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n bytes.push(0xf0 | (code >> 18), 0x80 | ((code >> 12) & 0x3f), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f))\n }\n }\n return new Uint8Array(bytes)\n }\n}\n\nclass TextDecoder {\n decode(bytes) {\n let str = ''\n let i = 0\n while (i < bytes.length) {\n const b = bytes[i++]\n if (b < 0x80) {\n str += String.fromCharCode(b)\n } else if (b < 0xe0) {\n str += String.fromCharCode(((b & 0x1f) << 6) | (bytes[i++] & 0x3f))\n } else if (b < 0xf0) {\n str += String.fromCharCode(((b & 0x0f) << 12) | ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f))\n } else {\n let code = ((b & 0x07) << 18) | ((bytes[i++] & 0x3f) << 12) | ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f)\n code -= 0x10000\n str += String.fromCharCode(0xd800 | (code >> 10), 0xdc00 | (code & 0x3ff))\n }\n }\n return str\n }\n}\n\nglobalThis.TextEncoder = TextEncoder\nglobalThis.TextDecoder = TextDecoder\n\nglobalThis.utils = {\n fs: {\n cwd: () => $__projectDir,\n resolve:(p) => $__utils_fs_resolve.apply(undefined, [p], { result: { promise: true, copy: true } }),\n read: (p, o) => $__utils_fs_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n exists: (p) => $__utils_fs_exists.apply(undefined, [p], { result: { promise: true } }),\n glob: (p, o) => $__utils_fs_glob.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, c) => $__utils_fs_write.apply(undefined, [p, c], { arguments: { copy: true }, result: { promise: true } }),\n copy: (src, dest) => $__utils_fs_copy.apply(undefined, [src, dest], { result: { promise: true } }),\n remove: (path, opts) => $__utils_fs_remove.apply(undefined, [path, opts], { result: { promise: true } }),\n move: (src, dest) => $__utils_fs_move.apply(undefined, [src, dest], { result: { promise: true } }),\n stat: (path) => $__utils_fs_stat.apply(undefined, [path], { result: { promise: true, copy: true } }),\n mkdir: (path) => $__utils_fs_mkdir.apply(undefined, [path], { result: { promise: true } }),\n readAsBytes: async (path, opts) => {\n const ab = await $__utils_fs_read_bytes.apply(undefined, [path, opts], { result: { promise: true, copy: true } })\n return ab ? new Uint8Array(ab) : null\n },\n writeAsBytes: (path, content) => {\n if (!(content instanceof Uint8Array)) throw new TypeError('writeAsBytes requires a Uint8Array')\n return $__utils_fs_write_bytes.apply(undefined, [path, content.buffer], { arguments: { copy: true }, result: { promise: true } })\n },\n replace: async (p, regex, replacement) => {\n const content = await globalThis.utils.fs.read(p);\n const newContent = content.replace(regex, replacement);\n await globalThis.utils.fs.write(p, newContent);\n },\n },\n shell: {\n exec: (cmd, o) => $__utils_shell_exec.apply(undefined, [cmd, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n execInSession: (cmd, o) => {\n const id = $__utils_shell_execInSession_open.applySync(undefined, [cmd, o], { arguments: { copy: true } })\n return {\n write: (text) => $__utils_shell_execInSession_write.applySync(undefined, [id, text]),\n expect: (pattern, timeoutMs) => {\n const pat = pattern instanceof RegExp ? { type: 'regex', source: pattern.source, flags: pattern.flags } : pattern\n return $__utils_shell_execInSession_expect.apply(undefined, [id, pat, timeoutMs], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n output: () => $__utils_shell_execInSession_output.applySync(undefined, [id]),\n waitForExit: () => $__utils_shell_execInSession_waitForExit.apply(undefined, [id], { result: { promise: true } }),\n kill: () => $__utils_shell_execInSession_kill.applySync(undefined, [id])\n }\n }\n },\n section: {\n create: (name, data, o) => $__utils_section_create.applySync(undefined, [name, data, o], { arguments: { copy: true }, result: { copy: true } }),\n match: (sectionName, patterns) => $__utils_section_match.applySync(undefined, [sectionName, patterns], { arguments: { copy: true }, result: { copy: true } }),\n selected: () => $__utils_section_selected.applySync(undefined, [], { result: { copy: true } }),\n },\n rune: {\n use: (key, args) => $__utils_rune\n .apply(undefined, [key, args], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n spawn: (key, args) => $__utils_rune_spawn\n .apply(undefined, [key, args], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n kill: (id, signal) => $__utils_rune_kill\n .apply(undefined, [id, signal ?? null], { result: { promise: true } }),\n exists: (id) => $__utils_rune_exists\n .apply(undefined, [id], { result: { promise: true } }),\n },\n json: {\n read: (p, o) => $__utils_json_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n readPath: (p, q, d) => $__utils_json_readPath.apply(undefined, [p, q, d], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n readPathAll: (p, q, d) => $__utils_json_readPathAll.apply(undefined, [p, q, d], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_json_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, spaces = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.json.read(filepath)\n }\n const data = missing ? JSON.parse(JSON.stringify(initial)) : await globalThis.utils.json.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.json.write(filepath, result !== undefined ? result : data, { spaces })\n },\n },\n yaml: {\n read: (p, o) => $__utils_yaml_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_yaml_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, indent = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.yaml.read(filepath)\n }\n const data = missing\n ? JSON.parse(JSON.stringify(initial))\n : await globalThis.utils.yaml.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.yaml.write(filepath, result !== undefined ? result : data, { indent })\n },\n },\n xml: {\n read: (p, o) => $__utils_xml_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_xml_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, indent = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.xml.read(filepath)\n }\n const data = missing ? JSON.parse(JSON.stringify(initial)) : await globalThis.utils.xml.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.xml.write(filepath, result !== undefined ? result : data, { indent })\n },\n },\n http: {\n fetch: async (url, opts = {}) => {\n let body = opts.body\n if (Array.isArray(body)) {\n body = body.map(entry => {\n if (entry.value instanceof Uint8Array) {\n return { ...entry, value: { type: 'Buffer', data: Array.from(entry.value) } }\n }\n return entry\n })\n }\n const raw = await $__utils_http_fetch.apply(undefined, [url, { ...opts, body }], { arguments: { copy: true }, result: { promise: true, copy: true } })\n return {\n ok: raw.ok,\n status: raw.status,\n statusText: raw.statusText,\n headers: raw.headers,\n text: () => Promise.resolve(raw._text),\n json: () => Promise.resolve(JSON.parse(raw._text)),\n }\n },\n },\n env: {\n read: (key, fallback) => $__utils_env_read\n .apply(undefined, [key, fallback], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(r => r !== null ? r : fallback),\n has: (key) => $__utils_env_has\n .apply(undefined, [key], { result: { promise: true } }),\n },\n vars: {\n read: (key, fallback = undefined) => Object.hasOwn(__vars, key) ? __vars[key] : fallback,\n has: (key) => Object.hasOwn(__vars, key),\n },\n archive: {\n zip: (s, d) => $__utils_archive_zip.apply(undefined, [s, d], { result: { promise: true } }),\n unzip: (s, d) => $__utils_archive_unzip.apply(undefined, [s, d], { result: { promise: true } }),\n tar: (s, d, o) => $__utils_archive_tar.apply(undefined, [s, d, o], { arguments: { copy: true }, result: { promise: true } }),\n untar: (s, d, o) => $__utils_archive_untar.apply(undefined, [s, d, o], { arguments: { copy: true }, result: { promise: true } }),\n },\n cache: {\n open: async (location, name) => {\n const id = await $__utils_cache_open.apply(undefined, [location, name ?? null], { result: { promise: true } })\n return {\n set: (k, v, ttl) => $__utils_cache_set.apply(undefined, [id, k, v, ttl ?? null], { arguments: { copy: true }, result: { promise: true } }),\n get: (k) => $__utils_cache_get.apply(undefined, [id, k], { result: { promise: true, copy: true } }),\n delete: (k) => $__utils_cache_delete.apply(undefined, [id, k], { result: { promise: true } }),\n clear: () => $__utils_cache_clear.apply(undefined, [id], { result: { promise: true } }),\n }\n },\n },\n sqlite: {\n open: async (location, name) => {\n const id = await $__utils_sqlite_open.apply(undefined, [location, name ?? null], { result: { promise: true } })\n const db = {\n query: (sql, params = []) =>\n $__utils_sqlite_query.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n get: (sql, params = []) =>\n $__utils_sqlite_get.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n exec: (sql, params = []) =>\n $__utils_sqlite_exec.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n transaction: async (fn) => {\n await db.exec('BEGIN')\n try { await fn(); await db.exec('COMMIT') }\n catch (e) { await db.exec('ROLLBACK'); throw e }\n },\n close: () =>\n $__utils_sqlite_close.apply(undefined, [id], { result: { promise: true } }),\n }\n return db\n },\n },\n crypto: {\n hash: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(arr => new Uint8Array(arr))\n },\n hashAsHex: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash_hex.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n hashAsBase64: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash_base64.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n uuid: () => $__crypto_uuid.applySync(undefined, []),\n randomHex: (size) => $__crypto_random_hex.applySync(undefined, [size]),\n randomBase64: (size) => $__crypto_random_base64.applySync(undefined, [size]),\n\n hmac: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(arr => new Uint8Array(arr))\n },\n hmacAsHex: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac_hex.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n hmacAsBase64: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac_base64.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n\n encrypt: (algorithm, key, iv, data) => {\n const k = key instanceof Uint8Array ? Array.from(key) : key\n const i = iv instanceof Uint8Array ? Array.from(iv) : iv\n const d = data instanceof Uint8Array ? Array.from(data) : data\n return $__crypto_encrypt.apply(undefined, [algorithm, k, i, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(ab => new Uint8Array(ab))\n },\n\n decrypt: (algorithm, key, iv, ciphertext) => {\n const k = key instanceof Uint8Array ? Array.from(key) : key\n const i = iv instanceof Uint8Array ? Array.from(iv) : iv\n const c = ciphertext instanceof Uint8Array ? Array.from(ciphertext) : ciphertext\n return $__crypto_decrypt.apply(undefined, [algorithm, k, i, c], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(ab => new Uint8Array(ab))\n },\n\n // Encoding Conversions\n toHex: (data) => {\n const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data\n let hex = ''\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, '0')\n }\n return hex\n },\n fromHex: (hex) => {\n const len = hex.length / 2\n const bytes = new Uint8Array(len)\n for (let i = 0; i < len; i++) {\n bytes[i] = parseInt(hex.substring(i * 2, i * 2 + 2), 16)\n }\n return bytes\n },\n toBase64: (data) => {\n const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n let result = ''\n const len = bytes.length\n for (let i = 0; i < len; i += 3) {\n const b1 = bytes[i]\n const b2 = i + 1 < len ? bytes[i + 1] : NaN\n const b3 = i + 2 < len ? bytes[i + 2] : NaN\n const enc1 = b1 >> 2\n const enc2 = ((b1 & 3) << 4) | (isNaN(b2) ? 0 : b2 >> 4)\n const enc3 = isNaN(b2) ? 64 : ((b2 & 15) << 2) | (isNaN(b3) ? 0 : b3 >> 6)\n const enc4 = isNaN(b3) ? 64 : b3 & 63\n result += chars[enc1] + chars[enc2] + (enc3 === 64 ? '=' : chars[enc3]) + (enc4 === 64 ? '=' : chars[enc4])\n }\n return result\n },\n fromBase64: (base64) => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n const lookup = new Uint8Array(256)\n for (let i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i\n const clean = base64.replace(/=/g, '')\n const len = clean.length\n const bytes = new Uint8Array(Math.floor(len * 0.75))\n let p = 0\n for (let i = 0; i < len; i += 4) {\n const w1 = lookup[clean.charCodeAt(i)]\n const w2 = i + 1 < len ? lookup[clean.charCodeAt(i + 1)] : 0\n const w3 = i + 2 < len ? lookup[clean.charCodeAt(i + 2)] : 0\n const w4 = i + 3 < len ? lookup[clean.charCodeAt(i + 3)] : 0\n bytes[p++] = (w1 << 2) | (w2 >> 4)\n if (p < bytes.length) bytes[p++] = ((w2 & 15) << 4) | (w3 >> 2)\n if (p < bytes.length) bytes[p++] = ((w3 & 3) << 6) | w4\n }\n return bytes\n },\n fromUtf8: (utf8) => {\n return new TextEncoder().encode(utf8)\n },\n toUtf8: (data) => {\n return new TextDecoder().decode(data)\n }\n },\n ws: {\n client(url, opts) {\n const id = $__utils_ws_client.applySync(\n undefined,\n [url, opts],\n { arguments: { copy: true } },\n )\n return {\n on(event, handler) {\n const isolateHandler = event === 'error'\n ? async (errJson) => {\n let d\n try { d = JSON.parse(errJson) }\n catch { d = { message: errJson } }\n const errorObj = new Error(d.message)\n errorObj.name = 'WebSocketError'\n if (d.code) errorObj.code = d.code\n if (d.stack) errorObj.stack = d.stack\n handler(errorObj)\n }\n : event === 'binary'\n ? async (arrayBuffer) => {\n handler(new Uint8Array(arrayBuffer))\n }\n : handler\n $__utils_ws_on.applySync(undefined, [id, event, isolateHandler], {\n arguments: { reference: true },\n })\n },\n open: () => $__utils_ws_open.apply(undefined, [id], { result: { promise: true } }),\n sendText: (msg) => $__utils_ws_send_text.apply(undefined, [id, msg], { result: { promise: true } }),\n sendBinary: (data) => {\n if (data instanceof Uint8Array) {\n return $__utils_ws_send_binary.apply(undefined, [id, data.buffer, data.byteOffset, data.byteLength], {\n arguments: { copy: true },\n result: { promise: true }\n })\n } else if (data instanceof ArrayBuffer) {\n return $__utils_ws_send_binary.apply(undefined, [id, data, 0, data.byteLength], {\n arguments: { copy: true },\n result: { promise: true }\n })\n } else {\n throw new TypeError('sendBinary requires an ArrayBuffer or Uint8Array')\n }\n },\n close: () => $__utils_ws_close.apply(undefined, [id], { result: { promise: true, copy: true } }),\n closed: () => $__utils_ws_closed.apply(undefined, [id], { result: { promise: true, copy: true } }),\n }\n },\n },\n time: {\n after: (ms) => $__utils_time_after_ref.apply(undefined, [ms], { result: { promise: true } }),\n },\n md,\n tree,\n}\n\nexport const { fs, shell, section, rune, json, yaml, xml, http, env, vars, archive, cache, sqlite, crypto, ws, time } = globalThis.utils\nexport { md, tree }\n\n// \u2500\u2500\u2500 Global Sandbox Timers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst timers = new Map()\nlet nextTimerId = 1\n\nglobalThis.setTimeout = function(callback, delay = 0, ...args) {\n if (typeof callback !== 'function') throw new TypeError('callback must be a function')\n const id = nextTimerId++\n let active = true\n\n timers.set(id, {\n clear() {\n active = false\n timers.delete(id)\n }\n })\n\n globalThis.utils.time.after(delay).then(() => {\n if (active) {\n timers.delete(id)\n callback(...args)\n }\n })\n\n return id\n}\n\nglobalThis.clearTimeout = function(id) {\n const timer = timers.get(id)\n if (timer) timer.clear()\n}\n\nglobalThis.setInterval = function(callback, delay = 0, ...args) {\n if (typeof callback !== 'function') throw new TypeError('callback must be a function')\n const id = nextTimerId++\n let active = true\n\n const run = () => {\n $__utils_time_after_ref.apply(undefined, [delay], { result: { promise: true } }).then(() => {\n if (active) {\n callback(...args)\n run() // Schedule next execution\n }\n })\n }\n\n timers.set(id, {\n clear() {\n active = false\n timers.delete(id)\n }\n })\n\n run()\n return id\n}\n\nglobalThis.clearInterval = function(id) {\n const timer = timers.get(id)\n if (timer) timer.clear()\n}\n";
|
|
73980
|
+
utils = "// Assembled inside the V8 isolate. Imports from pre-compiled isolate modules for\n// md and tree; wires host-side Reference callbacks for fs, shell, and section.\n// $__utils_* globals are injected by the host before this module is evaluated.\n\nimport * as md from 'crunes:md'\nimport * as tree from 'crunes:tree'\n\nconst __vars = JSON.parse($__vars)\n\nclass TextEncoder {\n encode(str) {\n const bytes = []\n for (let i = 0; i < str.length; i++) {\n let code = str.charCodeAt(i)\n if (code < 0x80) {\n bytes.push(code)\n } else if (code < 0x800) {\n bytes.push(0xc0 | (code >> 6), 0x80 | (code & 0x3f))\n } else if (code < 0xd800 || code >= 0xe000) {\n bytes.push(0xe0 | (code >> 12), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f))\n } else {\n i++\n code = 0x10000 + (((code & 0x3ff) << 10) | (str.charCodeAt(i) & 0x3ff))\n bytes.push(0xf0 | (code >> 18), 0x80 | ((code >> 12) & 0x3f), 0x80 | ((code >> 6) & 0x3f), 0x80 | (code & 0x3f))\n }\n }\n return new Uint8Array(bytes)\n }\n}\n\nclass TextDecoder {\n decode(bytes) {\n let str = ''\n let i = 0\n while (i < bytes.length) {\n const b = bytes[i++]\n if (b < 0x80) {\n str += String.fromCharCode(b)\n } else if (b < 0xe0) {\n str += String.fromCharCode(((b & 0x1f) << 6) | (bytes[i++] & 0x3f))\n } else if (b < 0xf0) {\n str += String.fromCharCode(((b & 0x0f) << 12) | ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f))\n } else {\n let code = ((b & 0x07) << 18) | ((bytes[i++] & 0x3f) << 12) | ((bytes[i++] & 0x3f) << 6) | (bytes[i++] & 0x3f)\n code -= 0x10000\n str += String.fromCharCode(0xd800 | (code >> 10), 0xdc00 | (code & 0x3ff))\n }\n }\n return str\n }\n}\n\nglobalThis.TextEncoder = TextEncoder\nglobalThis.TextDecoder = TextDecoder\n\nglobalThis.utils = {\n fs: {\n cwd: () => $__projectDir,\n resolve:(p) => $__utils_fs_resolve.apply(undefined, [p], { result: { promise: true, copy: true } }),\n read: (p, o) => $__utils_fs_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n exists: (p) => $__utils_fs_exists.apply(undefined, [p], { result: { promise: true } }),\n glob: (p, o) => $__utils_fs_glob.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, c) => $__utils_fs_write.apply(undefined, [p, c], { arguments: { copy: true }, result: { promise: true } }),\n copy: (src, dest) => $__utils_fs_copy.apply(undefined, [src, dest], { result: { promise: true } }),\n remove: (path, opts) => $__utils_fs_remove.apply(undefined, [path, opts], { result: { promise: true } }),\n move: (src, dest) => $__utils_fs_move.apply(undefined, [src, dest], { result: { promise: true } }),\n stat: (path) => $__utils_fs_stat.apply(undefined, [path], { result: { promise: true, copy: true } }),\n mkdir: (path) => $__utils_fs_mkdir.apply(undefined, [path], { result: { promise: true } }),\n readAsBytes: async (path, opts) => {\n const ab = await $__utils_fs_read_bytes.apply(undefined, [path, opts], { result: { promise: true, copy: true } })\n return ab ? new Uint8Array(ab) : null\n },\n writeAsBytes: (path, content) => {\n if (!(content instanceof Uint8Array)) throw new TypeError('writeAsBytes requires a Uint8Array')\n return $__utils_fs_write_bytes.apply(undefined, [path, content.buffer], { arguments: { copy: true }, result: { promise: true } })\n },\n replace: async (p, regex, replacement) => {\n const content = await globalThis.utils.fs.read(p);\n const newContent = content.replace(regex, replacement);\n await globalThis.utils.fs.write(p, newContent);\n },\n },\n shell: {\n exec: (cmd, o) => $__utils_shell_exec.apply(undefined, [cmd, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n execInSession: (cmd, o) => {\n const id = $__utils_shell_execInSession_open.applySync(undefined, [cmd, o], { arguments: { copy: true } })\n return {\n write: (text) => $__utils_shell_execInSession_write.applySync(undefined, [id, text]),\n expect: (pattern, timeoutMs) => {\n const pat = pattern instanceof RegExp ? { type: 'regex', source: pattern.source, flags: pattern.flags } : pattern\n return $__utils_shell_execInSession_expect.apply(undefined, [id, pat, timeoutMs], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n output: () => $__utils_shell_execInSession_output.applySync(undefined, [id]),\n waitForExit: () => $__utils_shell_execInSession_waitForExit.apply(undefined, [id], { result: { promise: true } }),\n kill: () => $__utils_shell_execInSession_kill.applySync(undefined, [id])\n }\n }\n },\n section: {\n create: (name, data, o) => $__utils_section_create.applySync(undefined, [name, data, o], { arguments: { copy: true }, result: { copy: true } }),\n match: (sectionName, patterns) => $__utils_section_match.applySync(undefined, [sectionName, patterns], { arguments: { copy: true }, result: { copy: true } }),\n selected: () => $__utils_section_selected.applySync(undefined, [], { result: { copy: true } }),\n },\n rune: {\n use: (key, args) => $__utils_rune\n .apply(undefined, [key, args], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n spawn: (key, args) => $__utils_rune_spawn\n .apply(undefined, [key, args], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n kill: (id, signal) => $__utils_rune_kill\n .apply(undefined, [id, signal ?? null], { result: { promise: true } }),\n exists: (id) => $__utils_rune_exists\n .apply(undefined, [id], { result: { promise: true } }),\n },\n json: {\n read: (p, o) => $__utils_json_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n readPath: (p, q, d) => $__utils_json_readPath.apply(undefined, [p, q, d], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n readPathAll: (p, q, d) => $__utils_json_readPathAll.apply(undefined, [p, q, d], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_json_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, spaces = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.json.read(filepath)\n }\n const data = missing ? JSON.parse(JSON.stringify(initial)) : await globalThis.utils.json.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.json.write(filepath, result !== undefined ? result : data, { spaces })\n },\n },\n yaml: {\n read: (p, o) => $__utils_yaml_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_yaml_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, indent = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.yaml.read(filepath)\n }\n const data = missing\n ? JSON.parse(JSON.stringify(initial))\n : await globalThis.utils.yaml.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.yaml.write(filepath, result !== undefined ? result : data, { indent })\n },\n },\n xml: {\n read: (p, o) => $__utils_xml_read.apply(undefined, [p, o], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n write: (p, d, o) => $__utils_xml_write.apply(undefined, [p, d, o], { arguments: { copy: true }, result: { promise: true } }),\n modify: async (filepath, callback, opts = {}) => {\n const { initial, indent = 2 } = opts\n const missing = !(await globalThis.utils.fs.exists(filepath))\n if (missing && initial === undefined) {\n await globalThis.utils.xml.read(filepath)\n }\n const data = missing ? JSON.parse(JSON.stringify(initial)) : await globalThis.utils.xml.read(filepath)\n const result = await callback(data, { exists: !missing })\n await globalThis.utils.xml.write(filepath, result !== undefined ? result : data, { indent })\n },\n },\n http: {\n fetch: async (url, opts = {}) => {\n let body = opts.body\n if (Array.isArray(body)) {\n body = body.map(entry => {\n if (entry.value instanceof Uint8Array) {\n return { ...entry, value: { type: 'Buffer', data: Array.from(entry.value) } }\n }\n return entry\n })\n }\n const raw = await $__utils_http_fetch.apply(undefined, [url, { ...opts, body }], { arguments: { copy: true }, result: { promise: true, copy: true } })\n return {\n ok: raw.ok,\n status: raw.status,\n statusText: raw.statusText,\n headers: raw.headers,\n text: () => Promise.resolve(raw._text),\n json: () => Promise.resolve(JSON.parse(raw._text)),\n }\n },\n },\n env: {\n read: (key, fallback) => $__utils_env_read\n .apply(undefined, [key, fallback], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(r => r !== null ? r : fallback),\n has: (key) => $__utils_env_has\n .apply(undefined, [key], { result: { promise: true } }),\n },\n vars: {\n read: (key, fallback = undefined) => Object.hasOwn(__vars, key) ? __vars[key] : fallback,\n has: (key) => Object.hasOwn(__vars, key),\n },\n archive: {\n zip: (s, d) => $__utils_archive_zip.apply(undefined, [s, d], { result: { promise: true } }),\n unzip: (s, d) => $__utils_archive_unzip.apply(undefined, [s, d], { result: { promise: true } }),\n tar: (s, d, o) => $__utils_archive_tar.apply(undefined, [s, d, o], { arguments: { copy: true }, result: { promise: true } }),\n untar: (s, d, o) => $__utils_archive_untar.apply(undefined, [s, d, o], { arguments: { copy: true }, result: { promise: true } }),\n },\n cache: {\n open: async (location, name) => {\n const id = await $__utils_cache_open.apply(undefined, [location, name ?? null], { result: { promise: true } })\n return {\n set: (k, v, ttl) => $__utils_cache_set.apply(undefined, [id, k, v, ttl ?? null], { arguments: { copy: true }, result: { promise: true } }),\n get: (k) => $__utils_cache_get.apply(undefined, [id, k], { result: { promise: true, copy: true } }),\n delete: (k) => $__utils_cache_delete.apply(undefined, [id, k], { result: { promise: true } }),\n clear: () => $__utils_cache_clear.apply(undefined, [id], { result: { promise: true } }),\n }\n },\n },\n sqlite: {\n open: async (location, name) => {\n const id = await $__utils_sqlite_open.apply(undefined, [location, name ?? null], { result: { promise: true } })\n const db = {\n query: (sql, params = []) =>\n $__utils_sqlite_query.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n get: (sql, params = []) =>\n $__utils_sqlite_get.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n exec: (sql, params = []) =>\n $__utils_sqlite_exec.apply(undefined, [id, sql, params], { arguments: { copy: true }, result: { promise: true, copy: true } }),\n transaction: async (fn) => {\n await db.exec('BEGIN')\n try { await fn(); await db.exec('COMMIT') }\n catch (e) { await db.exec('ROLLBACK'); throw e }\n },\n close: () =>\n $__utils_sqlite_close.apply(undefined, [id], { result: { promise: true } }),\n }\n return db\n },\n },\n crypto: {\n hash: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(arr => new Uint8Array(arr))\n },\n hashAsHex: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash_hex.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n hashAsBase64: (algorithm, data) => {\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hash_base64.apply(undefined, [algorithm, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n uuid: () => $__crypto_uuid.applySync(undefined, []),\n randomHex: (size) => $__crypto_random_hex.applySync(undefined, [size]),\n randomBase64: (size) => $__crypto_random_base64.applySync(undefined, [size]),\n\n hmac: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(arr => new Uint8Array(arr))\n },\n hmacAsHex: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac_hex.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n hmacAsBase64: (algorithm, key, data) => {\n const k = key instanceof Uint8Array ? key.buffer : key\n const d = data instanceof Uint8Array ? data.buffer : data\n return $__crypto_hmac_base64.apply(undefined, [algorithm, k, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n },\n\n encrypt: (algorithm, key, iv, data) => {\n const k = key instanceof Uint8Array ? Array.from(key) : key\n const i = iv instanceof Uint8Array ? Array.from(iv) : iv\n const d = data instanceof Uint8Array ? Array.from(data) : data\n return $__crypto_encrypt.apply(undefined, [algorithm, k, i, d], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(ab => new Uint8Array(ab))\n },\n\n decrypt: (algorithm, key, iv, ciphertext) => {\n const k = key instanceof Uint8Array ? Array.from(key) : key\n const i = iv instanceof Uint8Array ? Array.from(iv) : iv\n const c = ciphertext instanceof Uint8Array ? Array.from(ciphertext) : ciphertext\n return $__crypto_decrypt.apply(undefined, [algorithm, k, i, c], { arguments: { copy: true }, result: { promise: true, copy: true } })\n .then(ab => new Uint8Array(ab))\n },\n\n // Encoding Conversions\n toHex: (data) => {\n const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data\n let hex = ''\n for (let i = 0; i < bytes.length; i++) {\n hex += bytes[i].toString(16).padStart(2, '0')\n }\n return hex\n },\n fromHex: (hex) => {\n const len = hex.length / 2\n const bytes = new Uint8Array(len)\n for (let i = 0; i < len; i++) {\n bytes[i] = parseInt(hex.substring(i * 2, i * 2 + 2), 16)\n }\n return bytes\n },\n toBase64: (data) => {\n const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n let result = ''\n const len = bytes.length\n for (let i = 0; i < len; i += 3) {\n const b1 = bytes[i]\n const b2 = i + 1 < len ? bytes[i + 1] : NaN\n const b3 = i + 2 < len ? bytes[i + 2] : NaN\n const enc1 = b1 >> 2\n const enc2 = ((b1 & 3) << 4) | (isNaN(b2) ? 0 : b2 >> 4)\n const enc3 = isNaN(b2) ? 64 : ((b2 & 15) << 2) | (isNaN(b3) ? 0 : b3 >> 6)\n const enc4 = isNaN(b3) ? 64 : b3 & 63\n result += chars[enc1] + chars[enc2] + (enc3 === 64 ? '=' : chars[enc3]) + (enc4 === 64 ? '=' : chars[enc4])\n }\n return result\n },\n fromBase64: (base64) => {\n const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'\n const lookup = new Uint8Array(256)\n for (let i = 0; i < chars.length; i++) lookup[chars.charCodeAt(i)] = i\n const clean = base64.replace(/=/g, '')\n const len = clean.length\n const bytes = new Uint8Array(Math.floor(len * 0.75))\n let p = 0\n for (let i = 0; i < len; i += 4) {\n const w1 = lookup[clean.charCodeAt(i)]\n const w2 = i + 1 < len ? lookup[clean.charCodeAt(i + 1)] : 0\n const w3 = i + 2 < len ? lookup[clean.charCodeAt(i + 2)] : 0\n const w4 = i + 3 < len ? lookup[clean.charCodeAt(i + 3)] : 0\n bytes[p++] = (w1 << 2) | (w2 >> 4)\n if (p < bytes.length) bytes[p++] = ((w2 & 15) << 4) | (w3 >> 2)\n if (p < bytes.length) bytes[p++] = ((w3 & 3) << 6) | w4\n }\n return bytes\n },\n fromUtf8: (utf8) => {\n return new TextEncoder().encode(utf8)\n },\n toUtf8: (data) => {\n return new TextDecoder().decode(data)\n }\n },\n ws: {\n client(url, opts) {\n const id = $__utils_ws_client.applySync(\n undefined,\n [url, opts],\n { arguments: { copy: true } },\n )\n return {\n on(event, handler) {\n const isolateHandler = event === 'error'\n ? async (errJson) => {\n let d\n try { d = JSON.parse(errJson) }\n catch { d = { message: errJson } }\n const errorObj = new Error(d.message)\n errorObj.name = 'WebSocketError'\n if (d.code) errorObj.code = d.code\n if (d.stack) errorObj.stack = d.stack\n handler(errorObj)\n }\n : event === 'binary'\n ? async (arrayBuffer) => {\n handler(new Uint8Array(arrayBuffer))\n }\n : handler\n $__utils_ws_on.applySync(undefined, [id, event, isolateHandler], {\n arguments: { reference: true },\n })\n },\n open: () => $__utils_ws_open.apply(undefined, [id], { result: { promise: true } }),\n sendText: (msg) => $__utils_ws_send_text.apply(undefined, [id, msg], { result: { promise: true } }),\n sendBinary: (data) => {\n if (data instanceof Uint8Array) {\n return $__utils_ws_send_binary.apply(undefined, [id, data.buffer, data.byteOffset, data.byteLength], {\n arguments: { copy: true },\n result: { promise: true }\n })\n } else if (data instanceof ArrayBuffer) {\n return $__utils_ws_send_binary.apply(undefined, [id, data, 0, data.byteLength], {\n arguments: { copy: true },\n result: { promise: true }\n })\n } else {\n throw new TypeError('sendBinary requires an ArrayBuffer or Uint8Array')\n }\n },\n close: () => $__utils_ws_close.apply(undefined, [id], { result: { promise: true, copy: true } }),\n closed: () => $__utils_ws_closed.apply(undefined, [id], { result: { promise: true, copy: true } }),\n }\n },\n },\n time: {\n after: (ms) => $__utils_time_after_ref.apply(undefined, [ms], { result: { promise: true } }),\n },\n md,\n tree,\n}\n\nexport const { fs, shell, section, rune, json, yaml, xml, http, env, vars, archive, cache, sqlite, crypto, ws, time } = globalThis.utils\nexport { md, tree }\n\n// \u2500\u2500\u2500 Global Sandbox Timers \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\nconst timers = new Map()\nlet nextTimerId = 1\n\nglobalThis.setTimeout = function(callback, delay = 0, ...args) {\n if (typeof callback !== 'function') throw new TypeError('callback must be a function')\n const id = nextTimerId++\n let active = true\n\n timers.set(id, {\n clear() {\n active = false\n timers.delete(id)\n }\n })\n\n $__utils_time_after.apply(undefined, [delay], { result: { promise: true } }).then(() => {\n if (active) {\n timers.delete(id)\n callback(...args)\n }\n })\n\n return id\n}\n\nglobalThis.clearTimeout = function(id) {\n const timer = timers.get(id)\n if (timer) timer.clear()\n}\n\nglobalThis.setInterval = function(callback, delay = 0, ...args) {\n if (typeof callback !== 'function') throw new TypeError('callback must be a function')\n const id = nextTimerId++\n let active = true\n\n const run = () => {\n $__utils_time_after_ref.apply(undefined, [delay], { result: { promise: true } }).then(() => {\n if (active) {\n callback(...args)\n run() // Schedule next execution\n }\n })\n }\n\n timers.set(id, {\n clear() {\n active = false\n timers.delete(id)\n }\n })\n\n run()\n return id\n}\n\nglobalThis.clearInterval = function(id) {\n const timer = timers.get(id)\n if (timer) timer.clear()\n}\n";
|
|
73981
73981
|
console2 = "// Console shim for the isolate. $__log and $__err are ivm.Reference globals\n// set by the host before this module is evaluated.\nglobalThis.console = {\n log: (...a) => $__log.applyIgnored(undefined, a.map(String)),\n error: (...a) => $__err.applyIgnored(undefined, a.map(String)),\n warn: (...a) => $__err.applyIgnored(undefined, a.map(String)),\n}\n";
|
|
73982
73982
|
}
|
|
73983
73983
|
});
|
|
@@ -75031,10 +75031,76 @@ function buildYargsConfig(schema) {
|
|
|
75031
75031
|
}
|
|
75032
75032
|
return cfg;
|
|
75033
75033
|
}
|
|
75034
|
+
function mapPositionals(parsed, positionals, offset = 0) {
|
|
75035
|
+
if (!positionals) return;
|
|
75036
|
+
for (let i = 0; i < positionals.length; i++) {
|
|
75037
|
+
const spec = positionals[i].spec;
|
|
75038
|
+
const match2 = spec.match(/^[<\[]([a-zA-Z0-9_-]+)[>\]]$/);
|
|
75039
|
+
if (match2) {
|
|
75040
|
+
const key = match2[1];
|
|
75041
|
+
const val = parsed._[i + offset];
|
|
75042
|
+
if (val !== void 0) {
|
|
75043
|
+
parsed[key] = val;
|
|
75044
|
+
}
|
|
75045
|
+
}
|
|
75046
|
+
}
|
|
75047
|
+
}
|
|
75034
75048
|
function parseArgs(rawArgs, schema) {
|
|
75035
|
-
|
|
75036
|
-
|
|
75049
|
+
if (!schema) {
|
|
75050
|
+
const parsed2 = lib_default(rawArgs, {});
|
|
75051
|
+
parsed2.$raw = rawArgs;
|
|
75052
|
+
return parsed2;
|
|
75053
|
+
}
|
|
75054
|
+
let currentSchema = schema;
|
|
75055
|
+
const commandsMatched = [];
|
|
75056
|
+
while (true) {
|
|
75057
|
+
const activeOptions = /* @__PURE__ */ new Map();
|
|
75058
|
+
for (const opt of schema.options ?? []) {
|
|
75059
|
+
activeOptions.set(opt.flags, opt);
|
|
75060
|
+
}
|
|
75061
|
+
let temp2 = schema;
|
|
75062
|
+
for (const name of commandsMatched) {
|
|
75063
|
+
temp2 = temp2.commands.find((c) => c.name === name);
|
|
75064
|
+
for (const opt of temp2.options ?? []) {
|
|
75065
|
+
activeOptions.set(opt.flags, opt);
|
|
75066
|
+
}
|
|
75067
|
+
}
|
|
75068
|
+
const rootCfg = buildYargsConfig({ options: Array.from(activeOptions.values()) });
|
|
75069
|
+
const tempParsed = lib_default(rawArgs, rootCfg);
|
|
75070
|
+
const nextPosIndex = commandsMatched.length;
|
|
75071
|
+
const nextArg = tempParsed._[nextPosIndex];
|
|
75072
|
+
if (nextArg && currentSchema.commands) {
|
|
75073
|
+
const match2 = currentSchema.commands.find((c) => c.name === nextArg);
|
|
75074
|
+
if (match2) {
|
|
75075
|
+
commandsMatched.push(nextArg);
|
|
75076
|
+
currentSchema = match2;
|
|
75077
|
+
continue;
|
|
75078
|
+
}
|
|
75079
|
+
}
|
|
75080
|
+
break;
|
|
75081
|
+
}
|
|
75082
|
+
const optionsMap = /* @__PURE__ */ new Map();
|
|
75083
|
+
for (const opt of schema.options ?? []) {
|
|
75084
|
+
optionsMap.set(opt.flags, opt);
|
|
75085
|
+
}
|
|
75086
|
+
let temp = schema;
|
|
75087
|
+
for (const name of commandsMatched) {
|
|
75088
|
+
temp = temp.commands.find((c) => c.name === name);
|
|
75089
|
+
for (const opt of temp.options ?? []) {
|
|
75090
|
+
optionsMap.set(opt.flags, opt);
|
|
75091
|
+
}
|
|
75092
|
+
}
|
|
75093
|
+
const finalSchema = { options: Array.from(optionsMap.values()) };
|
|
75094
|
+
const finalCfg = buildYargsConfig(finalSchema);
|
|
75095
|
+
const parsed = lib_default(rawArgs, finalCfg);
|
|
75037
75096
|
parsed.$raw = rawArgs;
|
|
75097
|
+
if (commandsMatched.length > 0) {
|
|
75098
|
+
parsed.command = commandsMatched.join(" ");
|
|
75099
|
+
parsed.commands = commandsMatched;
|
|
75100
|
+
parsed.subcommand = parsed.command;
|
|
75101
|
+
parsed.subcommands = parsed.commands;
|
|
75102
|
+
}
|
|
75103
|
+
mapPositionals(parsed, currentSchema.positionals, commandsMatched.length);
|
|
75038
75104
|
return parsed;
|
|
75039
75105
|
}
|
|
75040
75106
|
var FLAG_SHORT, FLAG_LONG;
|
|
@@ -75487,15 +75553,43 @@ if (typeof args !== "undefined") globalThis.__crunes_args = args;
|
|
|
75487
75553
|
const schema = await context.evalClosure(
|
|
75488
75554
|
`return (async () => {
|
|
75489
75555
|
const b = (() => {
|
|
75490
|
-
const opts = [], pos = [], exs = []
|
|
75491
|
-
|
|
75492
|
-
|
|
75493
|
-
|
|
75494
|
-
|
|
75495
|
-
|
|
75556
|
+
const opts = [], pos = [], exs = [], cmds = []
|
|
75557
|
+
const createBuilder = (subName, subDesc) => {
|
|
75558
|
+
const sOpts = [], sPos = [], sExs = [], sCmds = []
|
|
75559
|
+
const subBuilder = {
|
|
75560
|
+
option(flags, description, def) { sOpts.push({ flags, description, def }); return subBuilder },
|
|
75561
|
+
positional(spec, description) { sPos.push({ spec, description }); return subBuilder },
|
|
75562
|
+
example(usage, description) { sExs.push({ usage, description }); return subBuilder },
|
|
75563
|
+
command(name, description, callback) {
|
|
75564
|
+
const nestedBuilder = createBuilder(name, description)
|
|
75565
|
+
if (typeof callback === 'function') {
|
|
75566
|
+
callback(nestedBuilder)
|
|
75567
|
+
}
|
|
75568
|
+
sCmds.push(nestedBuilder.build())
|
|
75569
|
+
return subBuilder
|
|
75570
|
+
},
|
|
75571
|
+
build() { return { name: subName, description: subDesc, options: sOpts, positionals: sPos, examples: sExs, commands: sCmds } }
|
|
75572
|
+
}
|
|
75573
|
+
return subBuilder
|
|
75574
|
+
}
|
|
75575
|
+
const rootBuilder = {
|
|
75576
|
+
option(flags, description, def) { opts.push({ flags, description, def }); return rootBuilder },
|
|
75577
|
+
positional(spec, description) { pos.push({ spec, description }); return rootBuilder },
|
|
75578
|
+
example(usage, description) { exs.push({ usage, description }); return rootBuilder },
|
|
75579
|
+
command(name, description, callback) {
|
|
75580
|
+
const subBuilder = createBuilder(name, description)
|
|
75581
|
+
if (typeof callback === 'function') {
|
|
75582
|
+
callback(subBuilder)
|
|
75583
|
+
}
|
|
75584
|
+
cmds.push(subBuilder.build())
|
|
75585
|
+
return rootBuilder
|
|
75586
|
+
},
|
|
75587
|
+
build() { return { options: opts, positionals: pos, examples: exs, commands: cmds } }
|
|
75496
75588
|
}
|
|
75589
|
+
return rootBuilder
|
|
75497
75590
|
})()
|
|
75498
|
-
|
|
75591
|
+
const res = await __crunes_args(b)
|
|
75592
|
+
return (res && typeof res.build === 'function') ? res.build() : res
|
|
75499
75593
|
})()`,
|
|
75500
75594
|
[],
|
|
75501
75595
|
isolateTimeoutMs !== void 0 ? { timeout: isolateTimeoutMs, result: { promise: true, copy: true } } : { result: { promise: true, copy: true } }
|
|
@@ -75586,15 +75680,43 @@ async function getArgsSchema(runeFile, effective, projectDir, {
|
|
|
75586
75680
|
const schema = await context.evalClosure(
|
|
75587
75681
|
`return (async () => {
|
|
75588
75682
|
const b = (() => {
|
|
75589
|
-
const opts = [], pos = [], exs = []
|
|
75590
|
-
|
|
75591
|
-
|
|
75592
|
-
|
|
75593
|
-
|
|
75594
|
-
|
|
75683
|
+
const opts = [], pos = [], exs = [], cmds = []
|
|
75684
|
+
const createBuilder = (subName, subDesc) => {
|
|
75685
|
+
const sOpts = [], sPos = [], sExs = [], sCmds = []
|
|
75686
|
+
const subBuilder = {
|
|
75687
|
+
option(flags, description, def) { sOpts.push({ flags, description, def }); return subBuilder },
|
|
75688
|
+
positional(spec, description) { sPos.push({ spec, description }); return subBuilder },
|
|
75689
|
+
example(usage, description) { sExs.push({ usage, description }); return subBuilder },
|
|
75690
|
+
command(name, description, callback) {
|
|
75691
|
+
const nestedBuilder = createBuilder(name, description)
|
|
75692
|
+
if (typeof callback === 'function') {
|
|
75693
|
+
callback(nestedBuilder)
|
|
75694
|
+
}
|
|
75695
|
+
sCmds.push(nestedBuilder.build())
|
|
75696
|
+
return subBuilder
|
|
75697
|
+
},
|
|
75698
|
+
build() { return { name: subName, description: subDesc, options: sOpts, positionals: sPos, examples: sExs, commands: sCmds } }
|
|
75699
|
+
}
|
|
75700
|
+
return subBuilder
|
|
75701
|
+
}
|
|
75702
|
+
const rootBuilder = {
|
|
75703
|
+
option(flags, description, def) { opts.push({ flags, description, def }); return rootBuilder },
|
|
75704
|
+
positional(spec, description) { pos.push({ spec, description }); return rootBuilder },
|
|
75705
|
+
example(usage, description) { exs.push({ usage, description }); return rootBuilder },
|
|
75706
|
+
command(name, description, callback) {
|
|
75707
|
+
const subBuilder = createBuilder(name, description)
|
|
75708
|
+
if (typeof callback === 'function') {
|
|
75709
|
+
callback(subBuilder)
|
|
75710
|
+
}
|
|
75711
|
+
cmds.push(subBuilder.build())
|
|
75712
|
+
return rootBuilder
|
|
75713
|
+
},
|
|
75714
|
+
build() { return { options: opts, positionals: pos, examples: exs, commands: cmds } }
|
|
75595
75715
|
}
|
|
75716
|
+
return rootBuilder
|
|
75596
75717
|
})()
|
|
75597
|
-
|
|
75718
|
+
const res = await __crunes_args(b)
|
|
75719
|
+
return (res && typeof res.build === 'function') ? res.build() : res
|
|
75598
75720
|
})()`,
|
|
75599
75721
|
[],
|
|
75600
75722
|
{ timeout: isolateTimeoutMs, result: { promise: true, copy: true } }
|
|
@@ -76024,11 +76146,46 @@ var init_use = __esm({
|
|
|
76024
76146
|
});
|
|
76025
76147
|
|
|
76026
76148
|
// src/docs/formatter.js
|
|
76149
|
+
function formatCommands(commands, depth = 0) {
|
|
76150
|
+
const lines = [];
|
|
76151
|
+
const indent = " ".repeat(depth + 1);
|
|
76152
|
+
const childIndent = " ".repeat(depth + 2);
|
|
76153
|
+
const detailIndent = " ".repeat(depth + 3);
|
|
76154
|
+
for (const cmd of commands) {
|
|
76155
|
+
const posSpecs = (cmd.positionals ?? []).map((p4) => p4.spec).join(" ");
|
|
76156
|
+
const cmdStr = `${cmd.name}${posSpecs ? " " + posSpecs : ""}`;
|
|
76157
|
+
lines.push(`${indent}${cmdStr.padEnd(30 - depth * 2)} ${cmd.description ?? ""}`.trimEnd());
|
|
76158
|
+
const cmdOpts = cmd.options ?? [];
|
|
76159
|
+
if (cmdOpts.length > 0) {
|
|
76160
|
+
lines.push(`${childIndent}Options:`);
|
|
76161
|
+
for (const opt of cmdOpts) {
|
|
76162
|
+
const defStr = opt.def !== void 0 ? ` [default: ${JSON.stringify(opt.def)}]` : "";
|
|
76163
|
+
lines.push(`${detailIndent}${opt.flags.padEnd(26)} ${opt.description ?? ""}${defStr}`.trimEnd());
|
|
76164
|
+
}
|
|
76165
|
+
}
|
|
76166
|
+
const cmdExs = cmd.examples ?? [];
|
|
76167
|
+
if (cmdExs.length > 0) {
|
|
76168
|
+
lines.push(`${childIndent}Examples:`);
|
|
76169
|
+
for (const ex of cmdExs) {
|
|
76170
|
+
lines.push(`${detailIndent}${ex.usage}`);
|
|
76171
|
+
if (ex.description) lines.push(`${detailIndent} ${ex.description}`);
|
|
76172
|
+
}
|
|
76173
|
+
}
|
|
76174
|
+
const nestedCmds = cmd.commands ?? [];
|
|
76175
|
+
if (nestedCmds.length > 0) {
|
|
76176
|
+
lines.push(`${childIndent}Commands:`);
|
|
76177
|
+
lines.push(...formatCommands(nestedCmds, depth + 2));
|
|
76178
|
+
}
|
|
76179
|
+
lines.push("");
|
|
76180
|
+
}
|
|
76181
|
+
return lines;
|
|
76182
|
+
}
|
|
76027
76183
|
function formatHelp(schema, runeMeta) {
|
|
76028
76184
|
const lines = [];
|
|
76029
76185
|
const key = runeMeta?.key ?? "rune";
|
|
76030
76186
|
const desc = runeMeta?.description ?? runeMeta?.name;
|
|
76031
|
-
|
|
76187
|
+
const hasCommands = (schema?.commands ?? []).length > 0;
|
|
76188
|
+
lines.push(`Usage: crunes use ${key} ${hasCommands ? "<command> " : ""}[options]`);
|
|
76032
76189
|
if (desc) {
|
|
76033
76190
|
lines.push("");
|
|
76034
76191
|
lines.push(` ${desc}`);
|
|
@@ -76049,6 +76206,16 @@ function formatHelp(schema, runeMeta) {
|
|
|
76049
76206
|
lines.push(` ${opt.flags.padEnd(30)} ${opt.description ?? ""}${defStr}`.trimEnd());
|
|
76050
76207
|
}
|
|
76051
76208
|
}
|
|
76209
|
+
const commands = schema?.commands ?? [];
|
|
76210
|
+
if (commands.length > 0) {
|
|
76211
|
+
lines.push("");
|
|
76212
|
+
lines.push("Commands:");
|
|
76213
|
+
const cmdLines = formatCommands(commands, 0);
|
|
76214
|
+
lines.push(...cmdLines);
|
|
76215
|
+
if (lines[lines.length - 1] === "") {
|
|
76216
|
+
lines.pop();
|
|
76217
|
+
}
|
|
76218
|
+
}
|
|
76052
76219
|
const examples = schema?.examples ?? [];
|
|
76053
76220
|
if (examples.length > 0) {
|
|
76054
76221
|
lines.push("");
|
|
@@ -89779,14 +89946,14 @@ var init_lifecycle_api = __esm({
|
|
|
89779
89946
|
},
|
|
89780
89947
|
children: [
|
|
89781
89948
|
{
|
|
89782
|
-
id:
|
|
89949
|
+
id: 39,
|
|
89783
89950
|
name: "build",
|
|
89784
89951
|
variant: "declaration",
|
|
89785
89952
|
kind: 2048,
|
|
89786
89953
|
flags: {},
|
|
89787
89954
|
signatures: [
|
|
89788
89955
|
{
|
|
89789
|
-
id:
|
|
89956
|
+
id: 40,
|
|
89790
89957
|
name: "build",
|
|
89791
89958
|
variant: "signature",
|
|
89792
89959
|
kind: 4096,
|
|
@@ -89806,6 +89973,130 @@ var init_lifecycle_api = __esm({
|
|
|
89806
89973
|
}
|
|
89807
89974
|
]
|
|
89808
89975
|
},
|
|
89976
|
+
{
|
|
89977
|
+
id: 31,
|
|
89978
|
+
name: "command",
|
|
89979
|
+
variant: "declaration",
|
|
89980
|
+
kind: 2048,
|
|
89981
|
+
flags: {},
|
|
89982
|
+
signatures: [
|
|
89983
|
+
{
|
|
89984
|
+
id: 32,
|
|
89985
|
+
name: "command",
|
|
89986
|
+
variant: "signature",
|
|
89987
|
+
kind: 4096,
|
|
89988
|
+
flags: {},
|
|
89989
|
+
comment: {
|
|
89990
|
+
summary: [
|
|
89991
|
+
{
|
|
89992
|
+
kind: "text",
|
|
89993
|
+
text: "Declares a nested command under the current command."
|
|
89994
|
+
}
|
|
89995
|
+
]
|
|
89996
|
+
},
|
|
89997
|
+
parameters: [
|
|
89998
|
+
{
|
|
89999
|
+
id: 33,
|
|
90000
|
+
name: "name",
|
|
90001
|
+
variant: "param",
|
|
90002
|
+
kind: 32768,
|
|
90003
|
+
flags: {},
|
|
90004
|
+
comment: {
|
|
90005
|
+
summary: [
|
|
90006
|
+
{
|
|
90007
|
+
kind: "text",
|
|
90008
|
+
text: "Command name (e.g. 'create')."
|
|
90009
|
+
}
|
|
90010
|
+
]
|
|
90011
|
+
},
|
|
90012
|
+
type: {
|
|
90013
|
+
type: "intrinsic",
|
|
90014
|
+
name: "string"
|
|
90015
|
+
}
|
|
90016
|
+
},
|
|
90017
|
+
{
|
|
90018
|
+
id: 34,
|
|
90019
|
+
name: "description",
|
|
90020
|
+
variant: "param",
|
|
90021
|
+
kind: 32768,
|
|
90022
|
+
flags: {},
|
|
90023
|
+
comment: {
|
|
90024
|
+
summary: [
|
|
90025
|
+
{
|
|
90026
|
+
kind: "text",
|
|
90027
|
+
text: "Command description."
|
|
90028
|
+
}
|
|
90029
|
+
]
|
|
90030
|
+
},
|
|
90031
|
+
type: {
|
|
90032
|
+
type: "intrinsic",
|
|
90033
|
+
name: "string"
|
|
90034
|
+
}
|
|
90035
|
+
},
|
|
90036
|
+
{
|
|
90037
|
+
id: 35,
|
|
90038
|
+
name: "callback",
|
|
90039
|
+
variant: "param",
|
|
90040
|
+
kind: 32768,
|
|
90041
|
+
flags: {
|
|
90042
|
+
isOptional: true
|
|
90043
|
+
},
|
|
90044
|
+
comment: {
|
|
90045
|
+
summary: [
|
|
90046
|
+
{
|
|
90047
|
+
kind: "text",
|
|
90048
|
+
text: "Callback configured with a subcommand ArgBuilder."
|
|
90049
|
+
}
|
|
90050
|
+
]
|
|
90051
|
+
},
|
|
90052
|
+
type: {
|
|
90053
|
+
type: "reflection",
|
|
90054
|
+
declaration: {
|
|
90055
|
+
id: 36,
|
|
90056
|
+
name: "__type",
|
|
90057
|
+
variant: "declaration",
|
|
90058
|
+
kind: 65536,
|
|
90059
|
+
flags: {},
|
|
90060
|
+
signatures: [
|
|
90061
|
+
{
|
|
90062
|
+
id: 37,
|
|
90063
|
+
name: "__type",
|
|
90064
|
+
variant: "signature",
|
|
90065
|
+
kind: 4096,
|
|
90066
|
+
flags: {},
|
|
90067
|
+
parameters: [
|
|
90068
|
+
{
|
|
90069
|
+
id: 38,
|
|
90070
|
+
name: "sub",
|
|
90071
|
+
variant: "param",
|
|
90072
|
+
kind: 32768,
|
|
90073
|
+
flags: {},
|
|
90074
|
+
type: {
|
|
90075
|
+
type: "reference",
|
|
90076
|
+
target: 17,
|
|
90077
|
+
name: "ArgBuilder",
|
|
90078
|
+
package: "@darkrymit/crunes-cli",
|
|
90079
|
+
qualifiedName: "lifecycle.ArgBuilder"
|
|
90080
|
+
}
|
|
90081
|
+
}
|
|
90082
|
+
],
|
|
90083
|
+
type: {
|
|
90084
|
+
type: "intrinsic",
|
|
90085
|
+
name: "void"
|
|
90086
|
+
}
|
|
90087
|
+
}
|
|
90088
|
+
]
|
|
90089
|
+
}
|
|
90090
|
+
}
|
|
90091
|
+
}
|
|
90092
|
+
],
|
|
90093
|
+
type: {
|
|
90094
|
+
type: "intrinsic",
|
|
90095
|
+
name: "this"
|
|
90096
|
+
}
|
|
90097
|
+
}
|
|
90098
|
+
]
|
|
90099
|
+
},
|
|
89809
90100
|
{
|
|
89810
90101
|
id: 27,
|
|
89811
90102
|
name: "example",
|
|
@@ -90036,6 +90327,7 @@ var init_lifecycle_api = __esm({
|
|
|
90036
90327
|
{
|
|
90037
90328
|
title: "Methods",
|
|
90038
90329
|
children: [
|
|
90330
|
+
39,
|
|
90039
90331
|
31,
|
|
90040
90332
|
27,
|
|
90041
90333
|
18,
|
|
@@ -90045,7 +90337,7 @@ var init_lifecycle_api = __esm({
|
|
|
90045
90337
|
]
|
|
90046
90338
|
},
|
|
90047
90339
|
{
|
|
90048
|
-
id:
|
|
90340
|
+
id: 41,
|
|
90049
90341
|
name: "ParsedArgs",
|
|
90050
90342
|
variant: "declaration",
|
|
90051
90343
|
kind: 256,
|
|
@@ -90060,7 +90352,7 @@ var init_lifecycle_api = __esm({
|
|
|
90060
90352
|
},
|
|
90061
90353
|
children: [
|
|
90062
90354
|
{
|
|
90063
|
-
id:
|
|
90355
|
+
id: 42,
|
|
90064
90356
|
name: "_",
|
|
90065
90357
|
variant: "declaration",
|
|
90066
90358
|
kind: 1024,
|
|
@@ -90082,7 +90374,7 @@ var init_lifecycle_api = __esm({
|
|
|
90082
90374
|
}
|
|
90083
90375
|
},
|
|
90084
90376
|
{
|
|
90085
|
-
id:
|
|
90377
|
+
id: 43,
|
|
90086
90378
|
name: "$raw",
|
|
90087
90379
|
variant: "declaration",
|
|
90088
90380
|
kind: 1024,
|
|
@@ -90102,27 +90394,74 @@ var init_lifecycle_api = __esm({
|
|
|
90102
90394
|
name: "string"
|
|
90103
90395
|
}
|
|
90104
90396
|
}
|
|
90397
|
+
},
|
|
90398
|
+
{
|
|
90399
|
+
id: 44,
|
|
90400
|
+
name: "command",
|
|
90401
|
+
variant: "declaration",
|
|
90402
|
+
kind: 1024,
|
|
90403
|
+
flags: {
|
|
90404
|
+
isOptional: true
|
|
90405
|
+
},
|
|
90406
|
+
comment: {
|
|
90407
|
+
summary: [
|
|
90408
|
+
{
|
|
90409
|
+
kind: "text",
|
|
90410
|
+
text: "Space-separated matched command path string (e.g. 'remote add')"
|
|
90411
|
+
}
|
|
90412
|
+
]
|
|
90413
|
+
},
|
|
90414
|
+
type: {
|
|
90415
|
+
type: "intrinsic",
|
|
90416
|
+
name: "string"
|
|
90417
|
+
}
|
|
90418
|
+
},
|
|
90419
|
+
{
|
|
90420
|
+
id: 45,
|
|
90421
|
+
name: "commands",
|
|
90422
|
+
variant: "declaration",
|
|
90423
|
+
kind: 1024,
|
|
90424
|
+
flags: {
|
|
90425
|
+
isOptional: true
|
|
90426
|
+
},
|
|
90427
|
+
comment: {
|
|
90428
|
+
summary: [
|
|
90429
|
+
{
|
|
90430
|
+
kind: "text",
|
|
90431
|
+
text: "Array of matched command path levels (e.g. ['remote', 'add'])"
|
|
90432
|
+
}
|
|
90433
|
+
]
|
|
90434
|
+
},
|
|
90435
|
+
type: {
|
|
90436
|
+
type: "array",
|
|
90437
|
+
elementType: {
|
|
90438
|
+
type: "intrinsic",
|
|
90439
|
+
name: "string"
|
|
90440
|
+
}
|
|
90441
|
+
}
|
|
90105
90442
|
}
|
|
90106
90443
|
],
|
|
90107
90444
|
groups: [
|
|
90108
90445
|
{
|
|
90109
90446
|
title: "Properties",
|
|
90110
90447
|
children: [
|
|
90111
|
-
|
|
90112
|
-
|
|
90448
|
+
42,
|
|
90449
|
+
43,
|
|
90450
|
+
44,
|
|
90451
|
+
45
|
|
90113
90452
|
]
|
|
90114
90453
|
}
|
|
90115
90454
|
],
|
|
90116
90455
|
indexSignatures: [
|
|
90117
90456
|
{
|
|
90118
|
-
id:
|
|
90457
|
+
id: 46,
|
|
90119
90458
|
name: "__index",
|
|
90120
90459
|
variant: "signature",
|
|
90121
90460
|
kind: 8192,
|
|
90122
90461
|
flags: {},
|
|
90123
90462
|
parameters: [
|
|
90124
90463
|
{
|
|
90125
|
-
id:
|
|
90464
|
+
id: 47,
|
|
90126
90465
|
name: "key",
|
|
90127
90466
|
variant: "param",
|
|
90128
90467
|
kind: 32768,
|
|
@@ -90410,7 +90749,7 @@ var init_lifecycle_api = __esm({
|
|
|
90410
90749
|
},
|
|
90411
90750
|
type: {
|
|
90412
90751
|
type: "reference",
|
|
90413
|
-
target:
|
|
90752
|
+
target: 41,
|
|
90414
90753
|
name: "ParsedArgs",
|
|
90415
90754
|
package: "@darkrymit/crunes-cli",
|
|
90416
90755
|
qualifiedName: "lifecycle.ParsedArgs"
|
|
@@ -90498,7 +90837,7 @@ var init_lifecycle_api = __esm({
|
|
|
90498
90837
|
title: "Interfaces",
|
|
90499
90838
|
children: [
|
|
90500
90839
|
17,
|
|
90501
|
-
|
|
90840
|
+
41,
|
|
90502
90841
|
8
|
|
90503
90842
|
]
|
|
90504
90843
|
},
|
|
@@ -90675,27 +91014,77 @@ var init_lifecycle_api = __esm({
|
|
|
90675
91014
|
"31": {
|
|
90676
91015
|
packageName: "@darkrymit/crunes-cli",
|
|
90677
91016
|
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
90678
|
-
qualifiedName: "lifecycle.ArgBuilder.
|
|
91017
|
+
qualifiedName: "lifecycle.ArgBuilder.command"
|
|
90679
91018
|
},
|
|
90680
91019
|
"32": {
|
|
90681
91020
|
packageName: "@darkrymit/crunes-cli",
|
|
90682
91021
|
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
90683
|
-
qualifiedName: "lifecycle.ArgBuilder.
|
|
91022
|
+
qualifiedName: "lifecycle.ArgBuilder.command"
|
|
90684
91023
|
},
|
|
90685
91024
|
"33": {
|
|
90686
91025
|
packageName: "@darkrymit/crunes-cli",
|
|
90687
91026
|
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
90688
|
-
qualifiedName: "
|
|
91027
|
+
qualifiedName: "name"
|
|
90689
91028
|
},
|
|
90690
91029
|
"34": {
|
|
90691
91030
|
packageName: "@darkrymit/crunes-cli",
|
|
90692
91031
|
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
90693
|
-
qualifiedName: "
|
|
91032
|
+
qualifiedName: "description"
|
|
90694
91033
|
},
|
|
90695
91034
|
"35": {
|
|
91035
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91036
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91037
|
+
qualifiedName: "callback"
|
|
91038
|
+
},
|
|
91039
|
+
"36": {
|
|
91040
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91041
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91042
|
+
qualifiedName: "__type"
|
|
91043
|
+
},
|
|
91044
|
+
"37": {
|
|
91045
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91046
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91047
|
+
qualifiedName: "__type"
|
|
91048
|
+
},
|
|
91049
|
+
"38": {
|
|
91050
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91051
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91052
|
+
qualifiedName: "sub"
|
|
91053
|
+
},
|
|
91054
|
+
"39": {
|
|
91055
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91056
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91057
|
+
qualifiedName: "lifecycle.ArgBuilder.build"
|
|
91058
|
+
},
|
|
91059
|
+
"40": {
|
|
91060
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91061
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91062
|
+
qualifiedName: "lifecycle.ArgBuilder.build"
|
|
91063
|
+
},
|
|
91064
|
+
"41": {
|
|
91065
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91066
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91067
|
+
qualifiedName: "lifecycle.ParsedArgs"
|
|
91068
|
+
},
|
|
91069
|
+
"42": {
|
|
91070
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91071
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91072
|
+
qualifiedName: "lifecycle.ParsedArgs._"
|
|
91073
|
+
},
|
|
91074
|
+
"43": {
|
|
90696
91075
|
packageName: "@darkrymit/crunes-cli",
|
|
90697
91076
|
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
90698
91077
|
qualifiedName: "lifecycle.ParsedArgs.$raw"
|
|
91078
|
+
},
|
|
91079
|
+
"44": {
|
|
91080
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91081
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91082
|
+
qualifiedName: "lifecycle.ParsedArgs.command"
|
|
91083
|
+
},
|
|
91084
|
+
"45": {
|
|
91085
|
+
packageName: "@darkrymit/crunes-cli",
|
|
91086
|
+
packagePath: "src/rune/api/types-lifecycle/lifecycle.d.ts",
|
|
91087
|
+
qualifiedName: "lifecycle.ParsedArgs.commands"
|
|
90699
91088
|
}
|
|
90700
91089
|
},
|
|
90701
91090
|
files: {
|
|
@@ -91705,15 +92094,22 @@ async function compileIntro({ config, format: format3, projectRoot, configRoot,
|
|
|
91705
92094
|
lines.push("Crunes execute inside an isolated sandbox (`isolated-vm`). Runes are ESM modules exporting a `use` method and an optional `args` method to declare schemas:");
|
|
91706
92095
|
lines.push("");
|
|
91707
92096
|
lines.push("```javascript");
|
|
91708
|
-
lines.push("// Example Rune:
|
|
92097
|
+
lines.push("// Example Rune: git.js");
|
|
91709
92098
|
lines.push("export function args(builder) {");
|
|
91710
92099
|
lines.push(" return builder");
|
|
91711
|
-
lines.push(" .
|
|
92100
|
+
lines.push(" .option('--verbose', 'Verbose output', false)");
|
|
92101
|
+
lines.push(" .command('remote', 'Manage git remotes', remote => {");
|
|
92102
|
+
lines.push(" remote.command('add', 'Add remote', add => {");
|
|
92103
|
+
lines.push(" add.positional('<name>', 'Remote name')");
|
|
92104
|
+
lines.push(" .positional('<url>', 'Remote URL')");
|
|
92105
|
+
lines.push(" })");
|
|
92106
|
+
lines.push(" })");
|
|
91712
92107
|
lines.push("}");
|
|
91713
92108
|
lines.push("");
|
|
91714
92109
|
lines.push("export async function use(args) {");
|
|
91715
|
-
lines.push("
|
|
91716
|
-
lines.push("
|
|
92110
|
+
lines.push(" if (args.command === 'remote add') {");
|
|
92111
|
+
lines.push(" return `Adding remote ${args.name} at ${args.url}`;");
|
|
92112
|
+
lines.push(" }");
|
|
91717
92113
|
lines.push("}");
|
|
91718
92114
|
lines.push("```");
|
|
91719
92115
|
lines.push("");
|
|
@@ -91756,6 +92152,12 @@ async function compileIntro({ config, format: format3, projectRoot, configRoot,
|
|
|
91756
92152
|
lines.push("crunes use api v2 --section endpoints");
|
|
91757
92153
|
lines.push("```");
|
|
91758
92154
|
lines.push("");
|
|
92155
|
+
lines.push("### Custom Commands & Nested Parameters Mapping");
|
|
92156
|
+
lines.push("Runes can recursively nest commands using `.command()` on the builder. Inside `use(args)`, Crunes automatically exposes:");
|
|
92157
|
+
lines.push('- **`args.command`**: The space-separated matched command path string (e.g. `"remote add"`).');
|
|
92158
|
+
lines.push('- **`args.commands`**: The matched command path levels array (e.g. `["remote", "add"]`).');
|
|
92159
|
+
lines.push("- **Named Positionals**: Parameters like `<name>` or `[scope]` are automatically mapped to `args.name` or `args.scope`, with offsets automatically calculated based on matched command depth.");
|
|
92160
|
+
lines.push("");
|
|
91759
92161
|
lines.push("### Batched Executions");
|
|
91760
92162
|
lines.push("Multiple runes can be run sequentially in one invocation using the `+` operator (requires the `-b` / `--batch` command flag):");
|
|
91761
92163
|
lines.push("```bash");
|
|
@@ -92032,13 +92434,95 @@ var init_intro = __esm({
|
|
|
92032
92434
|
}
|
|
92033
92435
|
});
|
|
92034
92436
|
|
|
92437
|
+
// src/docs/commands/args.js
|
|
92438
|
+
var args_exports = {};
|
|
92439
|
+
__export(args_exports, {
|
|
92440
|
+
handler: () => handler5
|
|
92441
|
+
});
|
|
92442
|
+
async function handler5() {
|
|
92443
|
+
process.stdout.write(`# Docs: The args(builder) Export
|
|
92444
|
+
|
|
92445
|
+
Runes declare options, positionals, examples, and nested commands using \`export function args(builder)\`. This is executed inside a sandboxed V8 isolate context before running the rune or loading help text.
|
|
92446
|
+
|
|
92447
|
+
## 1. Builder Methods Reference
|
|
92448
|
+
|
|
92449
|
+
- **\`.option(flags, description, defaultValue?)\`**: Declares a named flag.
|
|
92450
|
+
- *Example*: \`b.option('-c, --count <number>', 'Max results', 10)\`
|
|
92451
|
+
- **\`.positional(spec, description)\`**: Declares a descriptive positional parameter.
|
|
92452
|
+
- *Example*: \`b.positional('<name>', 'Item name')\`
|
|
92453
|
+
- **\`.example(usage, description)\`**: Adds a CLI calling example.
|
|
92454
|
+
- *Example*: \`b.example('crunes use my-rune hello', 'Basic call')\`
|
|
92455
|
+
- **\`.command(name, description, callback?)\`**: Declares a recursively nested command.
|
|
92456
|
+
- *Example*:
|
|
92457
|
+
\`\`\`javascript
|
|
92458
|
+
b.command('remote', 'Manage remotes', remote => {
|
|
92459
|
+
remote.command('add', 'Add a remote repository')
|
|
92460
|
+
})
|
|
92461
|
+
\`\`\`
|
|
92462
|
+
|
|
92463
|
+
## 2. Sandbox Extraction & Implicit Build Gotcha
|
|
92464
|
+
The arguments builder runs inside a strict, secure V8 isolate. Because functions (methods) cannot cross the sandbox-host boundary directly, the host automatically calls \`.build()\` inside the sandbox.
|
|
92465
|
+
|
|
92466
|
+
Developers can return the builder chain directly without appending \`.build()\`:
|
|
92467
|
+
\`\`\`javascript
|
|
92468
|
+
export function args(b) {
|
|
92469
|
+
return b.positional('<query>', 'Query search') // Implicitly built!
|
|
92470
|
+
}
|
|
92471
|
+
\`\`\`
|
|
92472
|
+
|
|
92473
|
+
`);
|
|
92474
|
+
}
|
|
92475
|
+
var init_args = __esm({
|
|
92476
|
+
"src/docs/commands/args.js"() {
|
|
92477
|
+
init_require_shim();
|
|
92478
|
+
}
|
|
92479
|
+
});
|
|
92480
|
+
|
|
92481
|
+
// src/docs/commands/use.js
|
|
92482
|
+
var use_exports2 = {};
|
|
92483
|
+
__export(use_exports2, {
|
|
92484
|
+
handler: () => handler6
|
|
92485
|
+
});
|
|
92486
|
+
async function handler6() {
|
|
92487
|
+
process.stdout.write(`# Docs: The use(args) Export
|
|
92488
|
+
|
|
92489
|
+
The entrypoint \`export async function use(args)\` executes the rune's main script lifecycle, receiving a parsed, type-coerced arguments object.
|
|
92490
|
+
|
|
92491
|
+
## 1. Parsed Arguments Structure
|
|
92492
|
+
|
|
92493
|
+
Inside \`use(args)\`, the \`args\` parameter contains:
|
|
92494
|
+
- **\`args.command\`** *(string)*: The full, space-separated matched command path (e.g. \`"remote add"\`).
|
|
92495
|
+
- **\`args.commands\`** *(string[])*: The array of matched command levels (e.g. \`["remote", "add"]\`).
|
|
92496
|
+
- **\`args._\`** *(string[])*: The raw, unmapped positional arguments array.
|
|
92497
|
+
- **\`args.$raw\`** *(string[])*: The exact raw string array before parsing.
|
|
92498
|
+
- **Named Options**: Values parsed from option flags (e.g., \`args.verbose\`).
|
|
92499
|
+
|
|
92500
|
+
## 2. Named Positional Mapping Quirks
|
|
92501
|
+
To make developers' lives significantly simpler, positional parameters defined in \`args(builder)\` are **automatically mapped** to their named keys:
|
|
92502
|
+
- **Root Level**: If you define \`.positional('<who>', ...)\` and run \`crunes use greeting "Alice"\`, you can access \`args.who\` directly!
|
|
92503
|
+
- **Nested Command Offset**: If you define \`remote add <name> <url>\`, the parser automatically skips command tokens and maps \`args.name\` and \`args.url\` starting at the correct index!
|
|
92504
|
+
|
|
92505
|
+
## 3. Strict 3-Tier Parsing Boundary
|
|
92506
|
+
1. **Global Flags**: Scoped to the process prefix (e.g. \`crunes --cwd ./project\`).
|
|
92507
|
+
2. **Command Flags**: Scoped to the command (e.g. \`use --format json\`).
|
|
92508
|
+
3. **Rune Arguments**: Scoped after the rune key (e.g. \`myrune remote add origin --verbose\`).
|
|
92509
|
+
Placing global or command flags after the rune key will cause them to be passed as raw rune arguments!
|
|
92510
|
+
|
|
92511
|
+
`);
|
|
92512
|
+
}
|
|
92513
|
+
var init_use2 = __esm({
|
|
92514
|
+
"src/docs/commands/use.js"() {
|
|
92515
|
+
init_require_shim();
|
|
92516
|
+
}
|
|
92517
|
+
});
|
|
92518
|
+
|
|
92035
92519
|
// package.json
|
|
92036
92520
|
var package_default;
|
|
92037
92521
|
var init_package = __esm({
|
|
92038
92522
|
"package.json"() {
|
|
92039
92523
|
package_default = {
|
|
92040
92524
|
name: "@darkrymit/crunes-cli",
|
|
92041
|
-
version: "0.5.
|
|
92525
|
+
version: "0.5.9",
|
|
92042
92526
|
description: "CLI tool for querying crunes enrichers",
|
|
92043
92527
|
type: "module",
|
|
92044
92528
|
bin: {
|
|
@@ -92089,7 +92573,7 @@ var init_package = __esm({
|
|
|
92089
92573
|
// src/cli/commands/version.js
|
|
92090
92574
|
var version_exports = {};
|
|
92091
92575
|
__export(version_exports, {
|
|
92092
|
-
handler: () =>
|
|
92576
|
+
handler: () => handler7
|
|
92093
92577
|
});
|
|
92094
92578
|
import fs11 from "node:fs/promises";
|
|
92095
92579
|
import path18 from "node:path";
|
|
@@ -92136,7 +92620,7 @@ async function checkForUpdate() {
|
|
|
92136
92620
|
if (!latest) return null;
|
|
92137
92621
|
return latest !== PKG_VERSION ? latest : null;
|
|
92138
92622
|
}
|
|
92139
|
-
async function
|
|
92623
|
+
async function handler7({ check = true, plain = false } = {}) {
|
|
92140
92624
|
if (plain) {
|
|
92141
92625
|
process.stdout.write(`${PKG_VERSION}
|
|
92142
92626
|
`);
|
|
@@ -92173,10 +92657,10 @@ var init_version = __esm({
|
|
|
92173
92657
|
// src/cli/commands/doctor.js
|
|
92174
92658
|
var doctor_exports = {};
|
|
92175
92659
|
__export(doctor_exports, {
|
|
92176
|
-
handler: () =>
|
|
92660
|
+
handler: () => handler8
|
|
92177
92661
|
});
|
|
92178
92662
|
import { spawnSync } from "node:child_process";
|
|
92179
|
-
async function
|
|
92663
|
+
async function handler8({ projectRoot = process.cwd() } = {}) {
|
|
92180
92664
|
let anyFailed = false;
|
|
92181
92665
|
const major = parseInt(process.versions.node.split(".")[0], 10);
|
|
92182
92666
|
if (major >= 20) {
|
|
@@ -92225,7 +92709,7 @@ var init_doctor = __esm({
|
|
|
92225
92709
|
// src/rune/commands/check.js
|
|
92226
92710
|
var check_exports = {};
|
|
92227
92711
|
__export(check_exports, {
|
|
92228
|
-
handler: () =>
|
|
92712
|
+
handler: () => handler9,
|
|
92229
92713
|
scanPermissionWarnings: () => scanPermissionWarnings
|
|
92230
92714
|
});
|
|
92231
92715
|
import { readFileSync as readFileSync5 } from "node:fs";
|
|
@@ -92276,7 +92760,7 @@ function checkSections(sections) {
|
|
|
92276
92760
|
}
|
|
92277
92761
|
return errors;
|
|
92278
92762
|
}
|
|
92279
|
-
async function
|
|
92763
|
+
async function handler9({ key, runeArgs = [], sections = null, projectRoot = process.cwd(), configRoot = projectRoot } = {}) {
|
|
92280
92764
|
let config;
|
|
92281
92765
|
try {
|
|
92282
92766
|
config = loadConfig(configRoot);
|
|
@@ -92333,7 +92817,7 @@ var init_check = __esm({
|
|
|
92333
92817
|
// src/rune/commands/benchmark.js
|
|
92334
92818
|
var benchmark_exports = {};
|
|
92335
92819
|
__export(benchmark_exports, {
|
|
92336
|
-
handler: () =>
|
|
92820
|
+
handler: () => handler10,
|
|
92337
92821
|
parseBenchArgs: () => parseBenchArgs
|
|
92338
92822
|
});
|
|
92339
92823
|
import { performance as performance2 } from "node:perf_hooks";
|
|
@@ -92380,7 +92864,7 @@ function parseBenchArgs(argv) {
|
|
|
92380
92864
|
const { key, sections, runeArgs } = parseSegment(argv.slice(i));
|
|
92381
92865
|
return { key, sections, runeArgs, runs, warmup };
|
|
92382
92866
|
}
|
|
92383
|
-
async function
|
|
92867
|
+
async function handler10({
|
|
92384
92868
|
key,
|
|
92385
92869
|
runeArgs = [],
|
|
92386
92870
|
runs = 1,
|
|
@@ -92878,9 +93362,9 @@ var require_utils9 = __commonJS({
|
|
|
92878
93362
|
function multiLineWordWrap(maxLength, input, wrapOnWordBoundary = true) {
|
|
92879
93363
|
let output2 = [];
|
|
92880
93364
|
input = input.split("\n");
|
|
92881
|
-
const
|
|
93365
|
+
const handler39 = wrapOnWordBoundary ? wordWrap : textWrap;
|
|
92882
93366
|
for (let i = 0; i < input.length; i++) {
|
|
92883
|
-
output2.push.apply(output2,
|
|
93367
|
+
output2.push.apply(output2, handler39(maxLength, input[i]));
|
|
92884
93368
|
}
|
|
92885
93369
|
return output2;
|
|
92886
93370
|
}
|
|
@@ -94305,9 +94789,9 @@ var require_cli_table3 = __commonJS({
|
|
|
94305
94789
|
// src/rune/commands/list.js
|
|
94306
94790
|
var list_exports = {};
|
|
94307
94791
|
__export(list_exports, {
|
|
94308
|
-
handler: () =>
|
|
94792
|
+
handler: () => handler11
|
|
94309
94793
|
});
|
|
94310
|
-
async function
|
|
94794
|
+
async function handler11({
|
|
94311
94795
|
format: format3 = "md",
|
|
94312
94796
|
plain = false,
|
|
94313
94797
|
projectRoot = process.cwd(),
|
|
@@ -94366,12 +94850,12 @@ var init_list = __esm({
|
|
|
94366
94850
|
// src/job/commands/list.js
|
|
94367
94851
|
var list_exports2 = {};
|
|
94368
94852
|
__export(list_exports2, {
|
|
94369
|
-
handler: () =>
|
|
94853
|
+
handler: () => handler12
|
|
94370
94854
|
});
|
|
94371
94855
|
function pad(str, len) {
|
|
94372
94856
|
return String(str ?? "-").padEnd(len);
|
|
94373
94857
|
}
|
|
94374
|
-
async function
|
|
94858
|
+
async function handler12({ projectDir, global: isGlobal }) {
|
|
94375
94859
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
94376
94860
|
await cleanJobs(key);
|
|
94377
94861
|
const jobs = await listJobs(key);
|
|
@@ -94411,9 +94895,9 @@ var init_list2 = __esm({
|
|
|
94411
94895
|
// src/job/commands/kill.js
|
|
94412
94896
|
var kill_exports = {};
|
|
94413
94897
|
__export(kill_exports, {
|
|
94414
|
-
handler: () =>
|
|
94898
|
+
handler: () => handler13
|
|
94415
94899
|
});
|
|
94416
|
-
async function
|
|
94900
|
+
async function handler13({ id, projectDir, global: isGlobal }) {
|
|
94417
94901
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
94418
94902
|
const jobs = await listJobs(key);
|
|
94419
94903
|
let resolvedId;
|
|
@@ -94443,12 +94927,12 @@ var init_kill = __esm({
|
|
|
94443
94927
|
// src/cache/commands/list.js
|
|
94444
94928
|
var list_exports3 = {};
|
|
94445
94929
|
__export(list_exports3, {
|
|
94446
|
-
handler: () =>
|
|
94930
|
+
handler: () => handler14
|
|
94447
94931
|
});
|
|
94448
94932
|
function pad2(s3, n) {
|
|
94449
94933
|
return String(s3 ?? "-").padEnd(n);
|
|
94450
94934
|
}
|
|
94451
|
-
async function
|
|
94935
|
+
async function handler14({ projectDir, global: isGlobal }) {
|
|
94452
94936
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
94453
94937
|
const buckets = await listCacheBuckets(key);
|
|
94454
94938
|
let projectPaths = {};
|
|
@@ -94497,9 +94981,9 @@ var init_list3 = __esm({
|
|
|
94497
94981
|
// src/cache/commands/clear.js
|
|
94498
94982
|
var clear_exports = {};
|
|
94499
94983
|
__export(clear_exports, {
|
|
94500
|
-
handler: () =>
|
|
94984
|
+
handler: () => handler15
|
|
94501
94985
|
});
|
|
94502
|
-
async function
|
|
94986
|
+
async function handler15({ id, projectDir, global: isGlobal }) {
|
|
94503
94987
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
94504
94988
|
let result;
|
|
94505
94989
|
try {
|
|
@@ -95219,9 +95703,9 @@ ${import_picocolors2.default.gray(d2)} ${t}
|
|
|
95219
95703
|
// src/cache/commands/delete.js
|
|
95220
95704
|
var delete_exports = {};
|
|
95221
95705
|
__export(delete_exports, {
|
|
95222
|
-
handler: () =>
|
|
95706
|
+
handler: () => handler16
|
|
95223
95707
|
});
|
|
95224
|
-
async function
|
|
95708
|
+
async function handler16({ id, yes, projectDir, global: isGlobal }) {
|
|
95225
95709
|
if (!yes) {
|
|
95226
95710
|
const confirm = await ye2({ message: `Delete cache bucket matching "${id}"?` });
|
|
95227
95711
|
if (pD(confirm) || !confirm) {
|
|
@@ -95251,9 +95735,9 @@ var init_delete = __esm({
|
|
|
95251
95735
|
// src/cache/commands/unset.js
|
|
95252
95736
|
var unset_exports = {};
|
|
95253
95737
|
__export(unset_exports, {
|
|
95254
|
-
handler: () =>
|
|
95738
|
+
handler: () => handler17
|
|
95255
95739
|
});
|
|
95256
|
-
async function
|
|
95740
|
+
async function handler17({ id, key: keyName, projectDir, global: isGlobal }) {
|
|
95257
95741
|
const projKey = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
95258
95742
|
let result;
|
|
95259
95743
|
try {
|
|
@@ -95275,12 +95759,12 @@ var init_unset = __esm({
|
|
|
95275
95759
|
// src/sqlite/commands/list.js
|
|
95276
95760
|
var list_exports4 = {};
|
|
95277
95761
|
__export(list_exports4, {
|
|
95278
|
-
handler: () =>
|
|
95762
|
+
handler: () => handler18
|
|
95279
95763
|
});
|
|
95280
95764
|
function pad3(s3, n) {
|
|
95281
95765
|
return String(s3 ?? "-").padEnd(n);
|
|
95282
95766
|
}
|
|
95283
|
-
async function
|
|
95767
|
+
async function handler18({ projectDir, global: isGlobal }) {
|
|
95284
95768
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
95285
95769
|
const dbs = await listSqliteDbs(key);
|
|
95286
95770
|
let projectPaths = {};
|
|
@@ -95329,9 +95813,9 @@ var init_list4 = __esm({
|
|
|
95329
95813
|
// src/sqlite/commands/delete.js
|
|
95330
95814
|
var delete_exports2 = {};
|
|
95331
95815
|
__export(delete_exports2, {
|
|
95332
|
-
handler: () =>
|
|
95816
|
+
handler: () => handler19
|
|
95333
95817
|
});
|
|
95334
|
-
async function
|
|
95818
|
+
async function handler19({ id, yes, projectDir, global: isGlobal }) {
|
|
95335
95819
|
if (!yes) {
|
|
95336
95820
|
const confirm = await ye2({ message: `Delete SQLite database matching "${id}"?` });
|
|
95337
95821
|
if (pD(confirm) || !confirm) {
|
|
@@ -95361,12 +95845,12 @@ var init_delete2 = __esm({
|
|
|
95361
95845
|
// src/sqlite/commands/query.js
|
|
95362
95846
|
var query_exports = {};
|
|
95363
95847
|
__export(query_exports, {
|
|
95364
|
-
handler: () =>
|
|
95848
|
+
handler: () => handler20
|
|
95365
95849
|
});
|
|
95366
95850
|
function pad4(s3, n) {
|
|
95367
95851
|
return String(s3 ?? "").padEnd(n);
|
|
95368
95852
|
}
|
|
95369
|
-
async function
|
|
95853
|
+
async function handler20({ id, sql, projectDir, global: isGlobal }) {
|
|
95370
95854
|
const key = isGlobal ? void 0 : getProjectKey(projectDir);
|
|
95371
95855
|
let rows;
|
|
95372
95856
|
try {
|
|
@@ -95398,11 +95882,11 @@ var init_query = __esm({
|
|
|
95398
95882
|
// src/core/commands/init.js
|
|
95399
95883
|
var init_exports = {};
|
|
95400
95884
|
__export(init_exports, {
|
|
95401
|
-
handler: () =>
|
|
95885
|
+
handler: () => handler21
|
|
95402
95886
|
});
|
|
95403
95887
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync2, existsSync } from "node:fs";
|
|
95404
95888
|
import { join as join6 } from "node:path";
|
|
95405
|
-
async function
|
|
95889
|
+
async function handler21({
|
|
95406
95890
|
yes = false,
|
|
95407
95891
|
projectRoot = process.cwd()
|
|
95408
95892
|
} = {}) {
|
|
@@ -95447,7 +95931,7 @@ var init_init = __esm({
|
|
|
95447
95931
|
// src/rune/commands/create.js
|
|
95448
95932
|
var create_exports = {};
|
|
95449
95933
|
__export(create_exports, {
|
|
95450
|
-
handler: () =>
|
|
95934
|
+
handler: () => handler22,
|
|
95451
95935
|
template: () => template
|
|
95452
95936
|
});
|
|
95453
95937
|
import { mkdir as mkdir5, writeFile as writeFile5, readFile as readFile5, rename } from "node:fs/promises";
|
|
@@ -95495,7 +95979,7 @@ function template(key, format3) {
|
|
|
95495
95979
|
``
|
|
95496
95980
|
].join("\n");
|
|
95497
95981
|
}
|
|
95498
|
-
async function
|
|
95982
|
+
async function handler22({
|
|
95499
95983
|
key,
|
|
95500
95984
|
format: format3,
|
|
95501
95985
|
path: runeRelPath,
|
|
@@ -96181,14 +96665,14 @@ var init_install = __esm({
|
|
|
96181
96665
|
// src/plugin/commands/install.js
|
|
96182
96666
|
var install_exports = {};
|
|
96183
96667
|
__export(install_exports, {
|
|
96184
|
-
handler: () =>
|
|
96668
|
+
handler: () => handler23
|
|
96185
96669
|
});
|
|
96186
96670
|
function parseInstallArg(arg) {
|
|
96187
96671
|
const idx = arg.indexOf("@");
|
|
96188
96672
|
if (idx === -1) return null;
|
|
96189
96673
|
return [arg.slice(0, idx), arg.slice(idx + 1)];
|
|
96190
96674
|
}
|
|
96191
|
-
async function
|
|
96675
|
+
async function handler23({ source, projectRoot }) {
|
|
96192
96676
|
const parts = parseInstallArg(source);
|
|
96193
96677
|
if (!parts) {
|
|
96194
96678
|
xe2("Use <marketplace>@<plugin> format (e.g. hello-world@hello-world)");
|
|
@@ -96229,9 +96713,9 @@ var init_install2 = __esm({
|
|
|
96229
96713
|
// src/plugin/commands/uninstall.js
|
|
96230
96714
|
var uninstall_exports = {};
|
|
96231
96715
|
__export(uninstall_exports, {
|
|
96232
|
-
handler: () =>
|
|
96716
|
+
handler: () => handler24
|
|
96233
96717
|
});
|
|
96234
|
-
async function
|
|
96718
|
+
async function handler24({ name, yes, projectRoot }) {
|
|
96235
96719
|
let pluginKey;
|
|
96236
96720
|
try {
|
|
96237
96721
|
const registry = await loadRegistry();
|
|
@@ -96268,9 +96752,9 @@ var init_uninstall = __esm({
|
|
|
96268
96752
|
// src/plugin/commands/list.js
|
|
96269
96753
|
var list_exports5 = {};
|
|
96270
96754
|
__export(list_exports5, {
|
|
96271
|
-
handler: () =>
|
|
96755
|
+
handler: () => handler25
|
|
96272
96756
|
});
|
|
96273
|
-
async function
|
|
96757
|
+
async function handler25({ format: format3 = "md" }) {
|
|
96274
96758
|
const registry = await loadRegistry();
|
|
96275
96759
|
const plugins = Object.entries(registry.plugins ?? {});
|
|
96276
96760
|
if (plugins.length === 0) {
|
|
@@ -96295,9 +96779,9 @@ var init_list5 = __esm({
|
|
|
96295
96779
|
// src/plugin/commands/update.js
|
|
96296
96780
|
var update_exports = {};
|
|
96297
96781
|
__export(update_exports, {
|
|
96298
|
-
handler: () =>
|
|
96782
|
+
handler: () => handler26
|
|
96299
96783
|
});
|
|
96300
|
-
async function
|
|
96784
|
+
async function handler26({ name, projectRoot }) {
|
|
96301
96785
|
const registry = await loadRegistry();
|
|
96302
96786
|
let plugins;
|
|
96303
96787
|
if (name) {
|
|
@@ -96362,11 +96846,11 @@ var init_update = __esm({
|
|
|
96362
96846
|
// src/plugin/commands/enable.js
|
|
96363
96847
|
var enable_exports = {};
|
|
96364
96848
|
__export(enable_exports, {
|
|
96365
|
-
handler: () =>
|
|
96849
|
+
handler: () => handler27
|
|
96366
96850
|
});
|
|
96367
96851
|
import fs15 from "node:fs/promises";
|
|
96368
96852
|
import path22 from "node:path";
|
|
96369
|
-
async function
|
|
96853
|
+
async function handler27({ name, projectRoot }) {
|
|
96370
96854
|
try {
|
|
96371
96855
|
const registry = await loadRegistry();
|
|
96372
96856
|
const pluginKey = resolvePluginKey(name, registry);
|
|
@@ -96407,11 +96891,11 @@ var init_enable = __esm({
|
|
|
96407
96891
|
// src/plugin/commands/disable.js
|
|
96408
96892
|
var disable_exports = {};
|
|
96409
96893
|
__export(disable_exports, {
|
|
96410
|
-
handler: () =>
|
|
96894
|
+
handler: () => handler28
|
|
96411
96895
|
});
|
|
96412
96896
|
import fs16 from "node:fs/promises";
|
|
96413
96897
|
import path23 from "node:path";
|
|
96414
|
-
async function
|
|
96898
|
+
async function handler28({ name, projectRoot }) {
|
|
96415
96899
|
try {
|
|
96416
96900
|
const registry = await loadRegistry();
|
|
96417
96901
|
const pluginKey = resolvePluginKey(name, registry);
|
|
@@ -96455,7 +96939,7 @@ __export(create_exports2, {
|
|
|
96455
96939
|
changelogMd: () => changelogMd,
|
|
96456
96940
|
exampleRune: () => exampleRune,
|
|
96457
96941
|
exampleTemplate: () => exampleTemplate,
|
|
96458
|
-
handler: () =>
|
|
96942
|
+
handler: () => handler29,
|
|
96459
96943
|
marketplaceJson: () => marketplaceJson,
|
|
96460
96944
|
pluginJson: () => pluginJson,
|
|
96461
96945
|
readmeMd: () => readmeMd
|
|
@@ -96583,7 +97067,7 @@ function getGitAuthor() {
|
|
|
96583
97067
|
const result = spawnSync2("git", ["config", "user.name"], { encoding: "utf8" });
|
|
96584
97068
|
return result.status === 0 ? result.stdout.trim() : "";
|
|
96585
97069
|
}
|
|
96586
|
-
async function
|
|
97070
|
+
async function handler29({
|
|
96587
97071
|
name,
|
|
96588
97072
|
description,
|
|
96589
97073
|
author,
|
|
@@ -96692,9 +97176,9 @@ var init_create2 = __esm({
|
|
|
96692
97176
|
// src/template/commands/list.js
|
|
96693
97177
|
var list_exports6 = {};
|
|
96694
97178
|
__export(list_exports6, {
|
|
96695
|
-
handler: () =>
|
|
97179
|
+
handler: () => handler30
|
|
96696
97180
|
});
|
|
96697
|
-
async function
|
|
97181
|
+
async function handler30({
|
|
96698
97182
|
source,
|
|
96699
97183
|
format: format3 = "md",
|
|
96700
97184
|
plain = false,
|
|
@@ -96783,9 +97267,9 @@ var init_list6 = __esm({
|
|
|
96783
97267
|
});
|
|
96784
97268
|
|
|
96785
97269
|
// src/template/commands/use.js
|
|
96786
|
-
var
|
|
96787
|
-
__export(
|
|
96788
|
-
handler: () =>
|
|
97270
|
+
var use_exports3 = {};
|
|
97271
|
+
__export(use_exports3, {
|
|
97272
|
+
handler: () => handler31,
|
|
96789
97273
|
resolveTemplate: () => resolveTemplate
|
|
96790
97274
|
});
|
|
96791
97275
|
import fs17 from "node:fs/promises";
|
|
@@ -96837,7 +97321,7 @@ async function resolveTemplate(sourceName, templateName, projectRoot) {
|
|
|
96837
97321
|
}
|
|
96838
97322
|
return null;
|
|
96839
97323
|
}
|
|
96840
|
-
async function
|
|
97324
|
+
async function handler31({
|
|
96841
97325
|
ref,
|
|
96842
97326
|
key,
|
|
96843
97327
|
path: runeRelPath,
|
|
@@ -96940,7 +97424,7 @@ Run: crunes use ${outputKey}`);
|
|
|
96940
97424
|
output.info(`Run: crunes use ${outputKey}`);
|
|
96941
97425
|
}
|
|
96942
97426
|
}
|
|
96943
|
-
var
|
|
97427
|
+
var init_use3 = __esm({
|
|
96944
97428
|
"src/template/commands/use.js"() {
|
|
96945
97429
|
init_require_shim();
|
|
96946
97430
|
init_dist6();
|
|
@@ -96954,7 +97438,7 @@ var init_use2 = __esm({
|
|
|
96954
97438
|
// src/template/commands/create.js
|
|
96955
97439
|
var create_exports3 = {};
|
|
96956
97440
|
__export(create_exports3, {
|
|
96957
|
-
handler: () =>
|
|
97441
|
+
handler: () => handler32,
|
|
96958
97442
|
templateStub: () => templateStub
|
|
96959
97443
|
});
|
|
96960
97444
|
import { mkdir as mkdir7, writeFile as writeFile7, readFile as readFile6, rename as rename2 } from "node:fs/promises";
|
|
@@ -96988,7 +97472,7 @@ function templateStub(name) {
|
|
|
96988
97472
|
``
|
|
96989
97473
|
].join("\n");
|
|
96990
97474
|
}
|
|
96991
|
-
async function
|
|
97475
|
+
async function handler32({
|
|
96992
97476
|
name,
|
|
96993
97477
|
path: templateRelPath,
|
|
96994
97478
|
templateName,
|
|
@@ -97078,9 +97562,9 @@ var init_create3 = __esm({
|
|
|
97078
97562
|
// src/marketplace/commands/add.js
|
|
97079
97563
|
var add_exports = {};
|
|
97080
97564
|
__export(add_exports, {
|
|
97081
|
-
handler: () =>
|
|
97565
|
+
handler: () => handler33
|
|
97082
97566
|
});
|
|
97083
|
-
async function
|
|
97567
|
+
async function handler33({ url }) {
|
|
97084
97568
|
try {
|
|
97085
97569
|
await addMarketplace(url);
|
|
97086
97570
|
console.log(`Marketplace "${url}" added.`);
|
|
@@ -97099,9 +97583,9 @@ var init_add = __esm({
|
|
|
97099
97583
|
// src/marketplace/commands/remove.js
|
|
97100
97584
|
var remove_exports = {};
|
|
97101
97585
|
__export(remove_exports, {
|
|
97102
|
-
handler: () =>
|
|
97586
|
+
handler: () => handler34
|
|
97103
97587
|
});
|
|
97104
|
-
async function
|
|
97588
|
+
async function handler34({ url }) {
|
|
97105
97589
|
try {
|
|
97106
97590
|
await removeMarketplace(url);
|
|
97107
97591
|
console.log(`Marketplace "${url}" removed.`);
|
|
@@ -97120,9 +97604,9 @@ var init_remove = __esm({
|
|
|
97120
97604
|
// src/marketplace/commands/list.js
|
|
97121
97605
|
var list_exports7 = {};
|
|
97122
97606
|
__export(list_exports7, {
|
|
97123
|
-
handler: () =>
|
|
97607
|
+
handler: () => handler35
|
|
97124
97608
|
});
|
|
97125
|
-
async function
|
|
97609
|
+
async function handler35() {
|
|
97126
97610
|
const sources = await listMarketplaces();
|
|
97127
97611
|
if (sources.length === 0) {
|
|
97128
97612
|
console.log("No marketplace sources configured.");
|
|
@@ -97142,9 +97626,9 @@ var init_list7 = __esm({
|
|
|
97142
97626
|
// src/marketplace/commands/search.js
|
|
97143
97627
|
var search_exports = {};
|
|
97144
97628
|
__export(search_exports, {
|
|
97145
|
-
handler: () =>
|
|
97629
|
+
handler: () => handler36
|
|
97146
97630
|
});
|
|
97147
|
-
async function
|
|
97631
|
+
async function handler36({ query }) {
|
|
97148
97632
|
const results = await searchMarketplaces(query);
|
|
97149
97633
|
if (results.length === 0) {
|
|
97150
97634
|
console.log(`No plugins found matching "${query}".`);
|
|
@@ -97166,9 +97650,9 @@ var init_search = __esm({
|
|
|
97166
97650
|
// src/marketplace/commands/update.js
|
|
97167
97651
|
var update_exports2 = {};
|
|
97168
97652
|
__export(update_exports2, {
|
|
97169
|
-
handler: () =>
|
|
97653
|
+
handler: () => handler37
|
|
97170
97654
|
});
|
|
97171
|
-
async function
|
|
97655
|
+
async function handler37({ url }) {
|
|
97172
97656
|
try {
|
|
97173
97657
|
if (url) {
|
|
97174
97658
|
await updateMarketplace(url);
|
|
@@ -97203,9 +97687,9 @@ var init_update2 = __esm({
|
|
|
97203
97687
|
// src/marketplace/commands/browse.js
|
|
97204
97688
|
var browse_exports = {};
|
|
97205
97689
|
__export(browse_exports, {
|
|
97206
|
-
handler: () =>
|
|
97690
|
+
handler: () => handler38
|
|
97207
97691
|
});
|
|
97208
|
-
async function
|
|
97692
|
+
async function handler38({ format: format3 = "md" }) {
|
|
97209
97693
|
const results = await searchMarketplaces("");
|
|
97210
97694
|
if (results.length === 0) {
|
|
97211
97695
|
console.log("No plugins found in configured marketplaces.");
|
|
@@ -97498,7 +97982,7 @@ var {
|
|
|
97498
97982
|
init_output();
|
|
97499
97983
|
function buildProgram() {
|
|
97500
97984
|
const program3 = new Command();
|
|
97501
|
-
program3.name("crunes").description("CLI tool for managing context runes").version("0.5.
|
|
97985
|
+
program3.name("crunes").description("CLI tool for managing context runes").version("0.5.9", "-v, --version").enablePositionalOptions().option("-y, --yes", "assume yes to all prompts and skip interactive mode (also auto-detected in non-TTY environments)").option("-p, --plain", "plain output: no colors, no box-drawing, plain symbols \u2014 optimised for AI/pipe use").option("--cwd <path>", "project root to use instead of the current working directory").option("--ccd <path>", "config directory \u2014 where .crunes/config.json and local rune files live (default: --cwd)").option("--verbose", "print full error stack traces and other verbose output");
|
|
97502
97986
|
program3.hook("preAction", (_thisCommand, actionCommand) => {
|
|
97503
97987
|
configure({ plain: !!program3.opts().plain, verbose: !!program3.opts().verbose });
|
|
97504
97988
|
if (program3.opts().verbose) {
|
|
@@ -97517,22 +98001,22 @@ function buildProgram() {
|
|
|
97517
98001
|
"after",
|
|
97518
98002
|
'\nImportant: Global flags (e.g. --cwd) MUST appear before the "use" command.\n\nSyntax:\n [-b] [--section s1,s2] <key> [rune-args...] [+ [--section s] <key> [rune-args...]]...\n\nCommand flags:\n -b, --batch enable batching multiple runes with +\n --section s1,s2 filter output sections (per rune, before the key)\n --format md|json output format (default: md)\n --fail-fast stop on first error\n\nKey prefixes:\n project:name resolve from project config only\n plugin:name resolve directly from an enabled plugin\n name auto-resolve: project config first, then plugins'
|
|
97519
98003
|
).allowUnknownOption().passThroughOptions().action(async (args) => {
|
|
97520
|
-
const { handler:
|
|
98004
|
+
const { handler: handler39, parseUseArgs: parseUseArgs2 } = await Promise.resolve().then(() => (init_use(), use_exports));
|
|
97521
98005
|
const { segments, format: format3, failFast } = parseUseArgs2(args);
|
|
97522
|
-
await
|
|
98006
|
+
await handler39({ segments, format: format3, failFast, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97523
98007
|
});
|
|
97524
98008
|
const helpGroup = program3.command("docs").description("Show documentation for runes and other resources");
|
|
97525
98009
|
helpGroup.command("rune <rune...>").description("Show usage, argument schema, and examples for one or more runes").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (keys, opts) => {
|
|
97526
|
-
const { handler:
|
|
97527
|
-
await
|
|
98010
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_rune(), rune_exports));
|
|
98011
|
+
await handler39({ keys, format: opts.format, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97528
98012
|
});
|
|
97529
98013
|
helpGroup.command("utils [namespaces...]").description("Show function signatures and parameter docs for utils.* namespaces").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (namespaces, opts) => {
|
|
97530
|
-
const { handler:
|
|
97531
|
-
await
|
|
98014
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_utils4(), utils_exports));
|
|
98015
|
+
await handler39({ namespaces, format: opts.format });
|
|
97532
98016
|
});
|
|
97533
98017
|
helpGroup.command("intro").description("Generate a comprehensive introduction and context document for Crunes and the active project").option("-g, --global", "generate a global, pure-ecosystem guide (skip local project context)").option("--out <path>", "output file path (defaults to stdout)").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (opts) => {
|
|
97534
|
-
const { handler:
|
|
97535
|
-
await
|
|
98018
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_intro(), intro_exports));
|
|
98019
|
+
await handler39({
|
|
97536
98020
|
global: !!opts.global,
|
|
97537
98021
|
out: opts.out,
|
|
97538
98022
|
format: opts.format,
|
|
@@ -97540,155 +98024,163 @@ function buildProgram() {
|
|
|
97540
98024
|
configRoot: configRoot()
|
|
97541
98025
|
});
|
|
97542
98026
|
});
|
|
98027
|
+
helpGroup.command("args").description("Show detailed documentation, conventions, and examples for the args(builder) export").action(async () => {
|
|
98028
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_args(), args_exports));
|
|
98029
|
+
await handler39();
|
|
98030
|
+
});
|
|
98031
|
+
helpGroup.command("use").description("Show detailed documentation, conventions, and examples for the use(args) export").action(async () => {
|
|
98032
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_use2(), use_exports2));
|
|
98033
|
+
await handler39();
|
|
98034
|
+
});
|
|
97543
98035
|
program3.command("version").description("Print the installed version and check for updates").option("--no-check", "skip the npm update check").action(async (opts) => {
|
|
97544
|
-
const { handler:
|
|
97545
|
-
await
|
|
98036
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_version(), version_exports));
|
|
98037
|
+
await handler39({ check: opts.check, plain: !!program3.opts().plain });
|
|
97546
98038
|
});
|
|
97547
98039
|
program3.command("doctor").description("Verify environment and project setup").action(async () => {
|
|
97548
|
-
const { handler:
|
|
97549
|
-
await
|
|
98040
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_doctor(), doctor_exports));
|
|
98041
|
+
await handler39({ projectRoot: projectRoot() });
|
|
97550
98042
|
});
|
|
97551
98043
|
program3.command("check [args...]").description("Run a rune and validate its output shape.").addHelpText("after", '\nImportant: Global flags (e.g. --cwd) MUST appear before the "check" command.\n\nSyntax:\n [--section s1,s2] <key> [rune-args...]').allowUnknownOption().passThroughOptions().action(async (args) => {
|
|
97552
98044
|
const { parseSegment: parseSegment2 } = await Promise.resolve().then(() => (init_use(), use_exports));
|
|
97553
|
-
const { handler:
|
|
98045
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_check(), check_exports));
|
|
97554
98046
|
const { key, sections, runeArgs } = parseSegment2(args);
|
|
97555
98047
|
if (!key) {
|
|
97556
98048
|
const { output: output2 } = await Promise.resolve().then(() => (init_output(), output_exports));
|
|
97557
98049
|
output2.error("Missing required argument: <rune>");
|
|
97558
98050
|
process.exit(1);
|
|
97559
98051
|
}
|
|
97560
|
-
await
|
|
98052
|
+
await handler39({ key, sections, runeArgs, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97561
98053
|
});
|
|
97562
98054
|
program3.command("bench [args...]").description("Time rune execution and report fast, ok, or slow.").addHelpText("after", '\nImportant: Global flags (e.g. --cwd) MUST appear before the "bench" command.\n\nSyntax:\n [--runs <n>] [--warmup] [--section s1,s2] <key> [rune-args...]').allowUnknownOption().passThroughOptions().action(async (args) => {
|
|
97563
|
-
const { handler:
|
|
98055
|
+
const { handler: handler39, parseBenchArgs: parseBenchArgs2 } = await Promise.resolve().then(() => (init_benchmark(), benchmark_exports));
|
|
97564
98056
|
const parsed = parseBenchArgs2(args);
|
|
97565
98057
|
if (!parsed.key) {
|
|
97566
98058
|
const { output: output2 } = await Promise.resolve().then(() => (init_output(), output_exports));
|
|
97567
98059
|
output2.error("Missing required argument: <rune>");
|
|
97568
98060
|
process.exit(1);
|
|
97569
98061
|
}
|
|
97570
|
-
await
|
|
98062
|
+
await handler39({ ...parsed, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97571
98063
|
});
|
|
97572
98064
|
program3.command("list").description("List all registered runes").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (opts) => {
|
|
97573
|
-
const { handler:
|
|
97574
|
-
await
|
|
98065
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list(), list_exports));
|
|
98066
|
+
await handler39({ format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97575
98067
|
});
|
|
97576
98068
|
const jobs = program3.command("job").description("Manage background jobs");
|
|
97577
98069
|
jobs.command("list").description("List background jobs for the current project").option("-g, --global", "list jobs across all projects").action(async (opts) => {
|
|
97578
|
-
const { handler:
|
|
97579
|
-
await
|
|
98070
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list2(), list_exports2));
|
|
98071
|
+
await handler39({ projectDir: projectRoot(), global: !!opts.global });
|
|
97580
98072
|
});
|
|
97581
98073
|
jobs.command("kill <id>").description("Send SIGTERM to a background job and remove its record").option("-g, --global", "search for the job across all projects").action(async (id, opts) => {
|
|
97582
|
-
const { handler:
|
|
97583
|
-
await
|
|
98074
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_kill(), kill_exports));
|
|
98075
|
+
await handler39({ id, projectDir: projectRoot(), global: !!opts.global });
|
|
97584
98076
|
});
|
|
97585
98077
|
const cache = program3.command("cache").description("Manage cache buckets");
|
|
97586
98078
|
cache.command("list").description("List cache buckets for the current project").option("-g, --global", "list all cache buckets across all projects and plugins").action(async (opts) => {
|
|
97587
|
-
const { handler:
|
|
97588
|
-
await
|
|
98079
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list3(), list_exports3));
|
|
98080
|
+
await handler39({ projectDir: projectRoot(), global: !!opts.global });
|
|
97589
98081
|
});
|
|
97590
98082
|
cache.command("clear <id>").description("Remove expired keys from a cache bucket").option("-g, --global", "resolve the id across all projects").action(async (id, opts) => {
|
|
97591
|
-
const { handler:
|
|
97592
|
-
await
|
|
98083
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_clear(), clear_exports));
|
|
98084
|
+
await handler39({ id, projectDir: projectRoot(), global: !!opts.global });
|
|
97593
98085
|
});
|
|
97594
98086
|
cache.command("delete <id>").description("Delete a cache bucket directory and deregister it").option("-g, --global", "resolve the id across all projects").action(async (id, opts) => {
|
|
97595
|
-
const { handler:
|
|
97596
|
-
await
|
|
98087
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_delete(), delete_exports));
|
|
98088
|
+
await handler39({ id, projectDir: projectRoot(), yes: !!program3.opts().yes, global: !!opts.global });
|
|
97597
98089
|
});
|
|
97598
98090
|
cache.command("unset <id> <key>").description("Remove a single key from a cache bucket").option("-g, --global", "resolve the id across all projects").action(async (id, key, opts) => {
|
|
97599
|
-
const { handler:
|
|
97600
|
-
await
|
|
98091
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_unset(), unset_exports));
|
|
98092
|
+
await handler39({ id, key, projectDir: projectRoot(), global: !!opts.global });
|
|
97601
98093
|
});
|
|
97602
98094
|
const sqlite = program3.command("sqlite").description("Manage SQLite databases");
|
|
97603
98095
|
sqlite.command("list").description("List all registered SQLite databases").option("-g, --global", "List databases from all projects (default: current project only)").action(async (opts) => {
|
|
97604
|
-
const { handler:
|
|
97605
|
-
await
|
|
98096
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list4(), list_exports4));
|
|
98097
|
+
await handler39({ projectDir: projectRoot(), global: !!opts.global });
|
|
97606
98098
|
});
|
|
97607
98099
|
sqlite.command("delete <id>").description("Delete a SQLite database file and deregister it").option("-g, --global", "Match databases from all projects (default: current project only)").action(async (id, opts) => {
|
|
97608
|
-
const { handler:
|
|
97609
|
-
await
|
|
98100
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_delete2(), delete_exports2));
|
|
98101
|
+
await handler39({ id, yes: !!program3.opts().yes, projectDir: projectRoot(), global: !!opts.global });
|
|
97610
98102
|
});
|
|
97611
98103
|
sqlite.command("query <id> <sql>").description("Run a SQL query against a registered SQLite database (readonly)").option("-g, --global", "Match databases from all projects (default: current project only)").action(async (id, sql, opts) => {
|
|
97612
|
-
const { handler:
|
|
97613
|
-
await
|
|
98104
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_query(), query_exports));
|
|
98105
|
+
await handler39({ id, sql, projectDir: projectRoot(), global: !!opts.global });
|
|
97614
98106
|
});
|
|
97615
98107
|
program3.command("init").description("Create .crunes/config.json in the current project").action(async () => {
|
|
97616
|
-
const { handler:
|
|
97617
|
-
await
|
|
98108
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_init(), init_exports));
|
|
98109
|
+
await handler39({ yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
97618
98110
|
});
|
|
97619
98111
|
program3.command("create [new-rune]").description("Scaffold a new rune and register it in config").addOption(new Option("--format <format>", "rune output format").choices(["tree", "markdown"])).option("--path <path>", "file path for the rune (default: .crunes/runes/<key>.js)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").action(async (key, opts) => {
|
|
97620
|
-
const { handler:
|
|
97621
|
-
await
|
|
98112
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_create(), create_exports));
|
|
98113
|
+
await handler39({ key, format: opts.format, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97622
98114
|
});
|
|
97623
98115
|
const plugin2 = program3.command("plugin").description("Manage rune plugins");
|
|
97624
98116
|
plugin2.command("install <source>").description("Install a plugin from a local path, GitHub repo (owner/repo), git URL, or npm package").action(async (source) => {
|
|
97625
|
-
const { handler:
|
|
97626
|
-
await
|
|
98117
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_install2(), install_exports));
|
|
98118
|
+
await handler39({ source, projectRoot: projectRoot() });
|
|
97627
98119
|
});
|
|
97628
98120
|
plugin2.command("uninstall <plugin>").description("Uninstall an installed plugin").action(async (name) => {
|
|
97629
|
-
const { handler:
|
|
97630
|
-
await
|
|
98121
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_uninstall(), uninstall_exports));
|
|
98122
|
+
await handler39({ name, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
97631
98123
|
});
|
|
97632
98124
|
plugin2.command("list").description("List installed plugins").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (opts) => {
|
|
97633
|
-
const { handler:
|
|
97634
|
-
await
|
|
98125
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list5(), list_exports5));
|
|
98126
|
+
await handler39({ format: opts.format });
|
|
97635
98127
|
});
|
|
97636
98128
|
plugin2.command("update [plugin]").description("Update one or all installed plugins").action(async (name) => {
|
|
97637
|
-
const { handler:
|
|
97638
|
-
await
|
|
98129
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_update(), update_exports));
|
|
98130
|
+
await handler39({ name, projectRoot: projectRoot() });
|
|
97639
98131
|
});
|
|
97640
98132
|
plugin2.command("enable <plugin>").description("Add a plugin to this project's enabled list").action(async (name) => {
|
|
97641
|
-
const { handler:
|
|
97642
|
-
await
|
|
98133
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_enable(), enable_exports));
|
|
98134
|
+
await handler39({ name, projectRoot: projectRoot() });
|
|
97643
98135
|
});
|
|
97644
98136
|
plugin2.command("disable <plugin>").description("Remove a plugin from this project's enabled list").action(async (name) => {
|
|
97645
|
-
const { handler:
|
|
97646
|
-
await
|
|
98137
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_disable(), disable_exports));
|
|
98138
|
+
await handler39({ name, projectRoot: projectRoot() });
|
|
97647
98139
|
});
|
|
97648
98140
|
plugin2.command("create [new-plugin]").description("Scaffold a new plugin directory with all required files").option("--description <text>", "short description for plugin.json and marketplace.json").option("--author <name>", "author name (default: git config user.name)").option("--license <spdx>", "SPDX license identifier (default: MIT)").option("--out <path>", "output directory (default: ./<name>)").action(async (name, opts) => {
|
|
97649
|
-
const { handler:
|
|
97650
|
-
await
|
|
98141
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_create2(), create_exports2));
|
|
98142
|
+
await handler39({ name, description: opts.description, author: opts.author, license: opts.license, out: opts.out, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
97651
98143
|
});
|
|
97652
98144
|
const template2 = program3.command("template").description("Manage rune templates");
|
|
97653
98145
|
template2.command("list [template-source]").description('List available templates. [template-source] can be "project" (project config only) or a plugin name; omit to list all.').addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (source, opts) => {
|
|
97654
|
-
const { handler:
|
|
97655
|
-
await
|
|
98146
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list6(), list_exports6));
|
|
98147
|
+
await handler39({ source, format: opts.format, plain: !!program3.opts().plain, projectRoot: projectRoot() });
|
|
97656
98148
|
});
|
|
97657
98149
|
template2.command("use <template>").description("Copy a template into the project as a new rune and register it in config.").addHelpText(
|
|
97658
98150
|
"after",
|
|
97659
98151
|
"\nKey prefixes:\n project:name \u2014 use a template defined in this project's config\n plugin:name \u2014 use a template from a specific installed plugin\n name \u2014 auto-resolve: project config first, then installed plugins"
|
|
97660
98152
|
).option("--as <new-rune>", "register the rune under a different key (default: template name)").option("--path <path>", "file path for the rune (default: .crunes/runes/<key>.js)").option("--name <name>", "human-readable label shown in crunes list").option("--description <description>", "short description of what context this rune provides").action(async (ref, opts) => {
|
|
97661
|
-
const { handler:
|
|
97662
|
-
await
|
|
98153
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_use3(), use_exports3));
|
|
98154
|
+
await handler39({ ref, key: opts.as, path: opts.path, name: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot() });
|
|
97663
98155
|
});
|
|
97664
98156
|
template2.command("create [new-template]").description("Scaffold a new template file and register it in config").option("--path <path>", "file path for the template (default: .crunes/templates/<name>.js)").option("--name <name>", "display label shown in crunes template list (separate from the template key)").option("--description <description>", "short description of what kind of rune this template produces").action(async (name, opts) => {
|
|
97665
|
-
const { handler:
|
|
97666
|
-
await
|
|
98157
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_create3(), create_exports3));
|
|
98158
|
+
await handler39({ name, path: opts.path, templateName: opts.name, description: opts.description, yes: !!program3.opts().yes, projectRoot: projectRoot(), configRoot: configRoot() });
|
|
97667
98159
|
});
|
|
97668
98160
|
const marketplace = program3.command("marketplace").description("Manage plugin marketplace sources");
|
|
97669
98161
|
marketplace.command("add <url>").description("Add a marketplace source URL").action(async (url) => {
|
|
97670
|
-
const { handler:
|
|
97671
|
-
await
|
|
98162
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_add(), add_exports));
|
|
98163
|
+
await handler39({ url });
|
|
97672
98164
|
});
|
|
97673
98165
|
marketplace.command("remove <url>").description("Remove a marketplace source URL").action(async (url) => {
|
|
97674
|
-
const { handler:
|
|
97675
|
-
await
|
|
98166
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_remove(), remove_exports));
|
|
98167
|
+
await handler39({ url });
|
|
97676
98168
|
});
|
|
97677
98169
|
marketplace.command("list").description("List configured marketplace sources").action(async () => {
|
|
97678
|
-
const { handler:
|
|
97679
|
-
await
|
|
98170
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_list7(), list_exports7));
|
|
98171
|
+
await handler39();
|
|
97680
98172
|
});
|
|
97681
98173
|
marketplace.command("search <query>").description("Search for plugins across configured marketplace sources").action(async (query) => {
|
|
97682
|
-
const { handler:
|
|
97683
|
-
await
|
|
98174
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_search(), search_exports));
|
|
98175
|
+
await handler39({ query });
|
|
97684
98176
|
});
|
|
97685
98177
|
marketplace.command("update [url]").description("Refresh cached marketplace data (all sources if no URL given)").action(async (url) => {
|
|
97686
|
-
const { handler:
|
|
97687
|
-
await
|
|
98178
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_update2(), update_exports2));
|
|
98179
|
+
await handler39({ url });
|
|
97688
98180
|
});
|
|
97689
98181
|
marketplace.command("browse").description("List all plugins from all configured marketplace sources").addOption(new Option("--format <format>", "output format").choices(["md", "json"]).default("md")).action(async (opts) => {
|
|
97690
|
-
const { handler:
|
|
97691
|
-
await
|
|
98182
|
+
const { handler: handler39 } = await Promise.resolve().then(() => (init_browse(), browse_exports));
|
|
98183
|
+
await handler39({ format: opts.format });
|
|
97692
98184
|
});
|
|
97693
98185
|
const completions = program3.command("completions").description("Manage shell tab-completions");
|
|
97694
98186
|
completions.command("bash [args...]").description("Bash completion handler \u2014 called by the installed hook at tab-press time.").allowUnknownOption().action(async () => {
|