@klaudworks/rmr 0.4.3 → 0.4.4
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/README.md +2 -0
- package/dist/index.js +327 -149
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ Define multi-step coding workflows that match how you actually work. `rmr` orche
|
|
|
8
8
|
|
|
9
9
|
```bash
|
|
10
10
|
npm install -g @klaudworks/rmr
|
|
11
|
+
|
|
12
|
+
# run from the root of your project
|
|
11
13
|
rmr install feature-dev
|
|
12
14
|
rmr run .rmr/workflows/feature-dev/workflow.yaml --task "Implement feature X"
|
|
13
15
|
```
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
2
|
-
// @bun
|
|
1
|
+
#!/usr/bin/env node
|
|
3
2
|
import { createRequire } from "node:module";
|
|
4
3
|
var __create = Object.create;
|
|
5
4
|
var __getProtoOf = Object.getPrototypeOf;
|
|
@@ -7944,46 +7943,6 @@ var require_public_api = __commonJS((exports) => {
|
|
|
7944
7943
|
exports.parseDocument = parseDocument;
|
|
7945
7944
|
exports.stringify = stringify;
|
|
7946
7945
|
});
|
|
7947
|
-
// node_modules/clipanion/lib/platform/node.mjs
|
|
7948
|
-
import tty from "tty";
|
|
7949
|
-
function getDefaultColorDepth() {
|
|
7950
|
-
if (tty && `getColorDepth` in tty.WriteStream.prototype)
|
|
7951
|
-
return tty.WriteStream.prototype.getColorDepth();
|
|
7952
|
-
if (process.env.FORCE_COLOR === `0`)
|
|
7953
|
-
return 1;
|
|
7954
|
-
if (process.env.FORCE_COLOR === `1`)
|
|
7955
|
-
return 8;
|
|
7956
|
-
if (typeof process.stdout !== `undefined` && process.stdout.isTTY)
|
|
7957
|
-
return 8;
|
|
7958
|
-
return 1;
|
|
7959
|
-
}
|
|
7960
|
-
var gContextStorage;
|
|
7961
|
-
function getCaptureActivator(context) {
|
|
7962
|
-
let contextStorage = gContextStorage;
|
|
7963
|
-
if (typeof contextStorage === `undefined`) {
|
|
7964
|
-
if (context.stdout === process.stdout && context.stderr === process.stderr)
|
|
7965
|
-
return null;
|
|
7966
|
-
const { AsyncLocalStorage: LazyAsyncLocalStorage } = __require("async_hooks");
|
|
7967
|
-
contextStorage = gContextStorage = new LazyAsyncLocalStorage;
|
|
7968
|
-
const origStdoutWrite = process.stdout._write;
|
|
7969
|
-
process.stdout._write = function(chunk, encoding, cb) {
|
|
7970
|
-
const context2 = contextStorage.getStore();
|
|
7971
|
-
if (typeof context2 === `undefined`)
|
|
7972
|
-
return origStdoutWrite.call(this, chunk, encoding, cb);
|
|
7973
|
-
return context2.stdout.write(chunk, encoding, cb);
|
|
7974
|
-
};
|
|
7975
|
-
const origStderrWrite = process.stderr._write;
|
|
7976
|
-
process.stderr._write = function(chunk, encoding, cb) {
|
|
7977
|
-
const context2 = contextStorage.getStore();
|
|
7978
|
-
if (typeof context2 === `undefined`)
|
|
7979
|
-
return origStderrWrite.call(this, chunk, encoding, cb);
|
|
7980
|
-
return context2.stderr.write(chunk, encoding, cb);
|
|
7981
|
-
};
|
|
7982
|
-
}
|
|
7983
|
-
return (fn) => {
|
|
7984
|
-
return contextStorage.run(context, fn);
|
|
7985
|
-
};
|
|
7986
|
-
}
|
|
7987
7946
|
|
|
7988
7947
|
// node_modules/clipanion/lib/constants.mjs
|
|
7989
7948
|
var SpecialToken;
|
|
@@ -8077,6 +8036,136 @@ var whileRunning = (input) => `While running ${input.filter((token) => {
|
|
|
8077
8036
|
}
|
|
8078
8037
|
}).join(` `)}`;
|
|
8079
8038
|
|
|
8039
|
+
// node_modules/clipanion/lib/advanced/options/utils.mjs
|
|
8040
|
+
var isOptionSymbol = Symbol(`clipanion/isOption`);
|
|
8041
|
+
function makeCommandOption(spec) {
|
|
8042
|
+
return { ...spec, [isOptionSymbol]: true };
|
|
8043
|
+
}
|
|
8044
|
+
function rerouteArguments(a, b) {
|
|
8045
|
+
if (typeof a === `undefined`)
|
|
8046
|
+
return [a, b];
|
|
8047
|
+
if (typeof a === `object` && a !== null && !Array.isArray(a)) {
|
|
8048
|
+
return [undefined, a];
|
|
8049
|
+
} else {
|
|
8050
|
+
return [a, b];
|
|
8051
|
+
}
|
|
8052
|
+
}
|
|
8053
|
+
function cleanValidationError(message, { mergeName = false } = {}) {
|
|
8054
|
+
const match = message.match(/^([^:]+): (.*)$/m);
|
|
8055
|
+
if (!match)
|
|
8056
|
+
return `validation failed`;
|
|
8057
|
+
let [, path, line] = match;
|
|
8058
|
+
if (mergeName)
|
|
8059
|
+
line = line[0].toLowerCase() + line.slice(1);
|
|
8060
|
+
line = path !== `.` || !mergeName ? `${path.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
8061
|
+
return line;
|
|
8062
|
+
}
|
|
8063
|
+
function formatError(message, errors) {
|
|
8064
|
+
if (errors.length === 1) {
|
|
8065
|
+
return new UsageError(`${message}${cleanValidationError(errors[0], { mergeName: true })}`);
|
|
8066
|
+
} else {
|
|
8067
|
+
return new UsageError(`${message}:
|
|
8068
|
+
${errors.map((error) => `
|
|
8069
|
+
- ${cleanValidationError(error)}`).join(``)}`);
|
|
8070
|
+
}
|
|
8071
|
+
}
|
|
8072
|
+
function applyValidator(name, value, validator) {
|
|
8073
|
+
if (typeof validator === `undefined`)
|
|
8074
|
+
return value;
|
|
8075
|
+
const errors = [];
|
|
8076
|
+
const coercions = [];
|
|
8077
|
+
const coercion = (v) => {
|
|
8078
|
+
const orig = value;
|
|
8079
|
+
value = v;
|
|
8080
|
+
return coercion.bind(null, orig);
|
|
8081
|
+
};
|
|
8082
|
+
const check = validator(value, { errors, coercions, coercion });
|
|
8083
|
+
if (!check)
|
|
8084
|
+
throw formatError(`Invalid value for ${name}`, errors);
|
|
8085
|
+
for (const [, op] of coercions)
|
|
8086
|
+
op();
|
|
8087
|
+
return value;
|
|
8088
|
+
}
|
|
8089
|
+
|
|
8090
|
+
// node_modules/clipanion/lib/advanced/Command.mjs
|
|
8091
|
+
class Command {
|
|
8092
|
+
constructor() {
|
|
8093
|
+
this.help = false;
|
|
8094
|
+
}
|
|
8095
|
+
static Usage(usage) {
|
|
8096
|
+
return usage;
|
|
8097
|
+
}
|
|
8098
|
+
async catch(error) {
|
|
8099
|
+
throw error;
|
|
8100
|
+
}
|
|
8101
|
+
async validateAndExecute() {
|
|
8102
|
+
const commandClass = this.constructor;
|
|
8103
|
+
const cascade = commandClass.schema;
|
|
8104
|
+
if (Array.isArray(cascade)) {
|
|
8105
|
+
const { isDict, isUnknown, applyCascade } = await Promise.resolve().then(() => __toESM(require_lib(), 1));
|
|
8106
|
+
const schema = applyCascade(isDict(isUnknown()), cascade);
|
|
8107
|
+
const errors = [];
|
|
8108
|
+
const coercions = [];
|
|
8109
|
+
const check = schema(this, { errors, coercions });
|
|
8110
|
+
if (!check)
|
|
8111
|
+
throw formatError(`Invalid option schema`, errors);
|
|
8112
|
+
for (const [, op] of coercions) {
|
|
8113
|
+
op();
|
|
8114
|
+
}
|
|
8115
|
+
} else if (cascade != null) {
|
|
8116
|
+
throw new Error(`Invalid command schema`);
|
|
8117
|
+
}
|
|
8118
|
+
const exitCode = await this.execute();
|
|
8119
|
+
if (typeof exitCode !== `undefined`) {
|
|
8120
|
+
return exitCode;
|
|
8121
|
+
} else {
|
|
8122
|
+
return 0;
|
|
8123
|
+
}
|
|
8124
|
+
}
|
|
8125
|
+
}
|
|
8126
|
+
Command.isOption = isOptionSymbol;
|
|
8127
|
+
Command.Default = [];
|
|
8128
|
+
// node_modules/clipanion/lib/platform/node.mjs
|
|
8129
|
+
import tty from "tty";
|
|
8130
|
+
function getDefaultColorDepth() {
|
|
8131
|
+
if (tty && `getColorDepth` in tty.WriteStream.prototype)
|
|
8132
|
+
return tty.WriteStream.prototype.getColorDepth();
|
|
8133
|
+
if (process.env.FORCE_COLOR === `0`)
|
|
8134
|
+
return 1;
|
|
8135
|
+
if (process.env.FORCE_COLOR === `1`)
|
|
8136
|
+
return 8;
|
|
8137
|
+
if (typeof process.stdout !== `undefined` && process.stdout.isTTY)
|
|
8138
|
+
return 8;
|
|
8139
|
+
return 1;
|
|
8140
|
+
}
|
|
8141
|
+
var gContextStorage;
|
|
8142
|
+
function getCaptureActivator(context) {
|
|
8143
|
+
let contextStorage = gContextStorage;
|
|
8144
|
+
if (typeof contextStorage === `undefined`) {
|
|
8145
|
+
if (context.stdout === process.stdout && context.stderr === process.stderr)
|
|
8146
|
+
return null;
|
|
8147
|
+
const { AsyncLocalStorage: LazyAsyncLocalStorage } = __require("async_hooks");
|
|
8148
|
+
contextStorage = gContextStorage = new LazyAsyncLocalStorage;
|
|
8149
|
+
const origStdoutWrite = process.stdout._write;
|
|
8150
|
+
process.stdout._write = function(chunk, encoding, cb) {
|
|
8151
|
+
const context2 = contextStorage.getStore();
|
|
8152
|
+
if (typeof context2 === `undefined`)
|
|
8153
|
+
return origStdoutWrite.call(this, chunk, encoding, cb);
|
|
8154
|
+
return context2.stdout.write(chunk, encoding, cb);
|
|
8155
|
+
};
|
|
8156
|
+
const origStderrWrite = process.stderr._write;
|
|
8157
|
+
process.stderr._write = function(chunk, encoding, cb) {
|
|
8158
|
+
const context2 = contextStorage.getStore();
|
|
8159
|
+
if (typeof context2 === `undefined`)
|
|
8160
|
+
return origStderrWrite.call(this, chunk, encoding, cb);
|
|
8161
|
+
return context2.stderr.write(chunk, encoding, cb);
|
|
8162
|
+
};
|
|
8163
|
+
}
|
|
8164
|
+
return (fn) => {
|
|
8165
|
+
return contextStorage.run(context, fn);
|
|
8166
|
+
};
|
|
8167
|
+
}
|
|
8168
|
+
|
|
8080
8169
|
// node_modules/clipanion/lib/core.mjs
|
|
8081
8170
|
function debug(str) {
|
|
8082
8171
|
if (IS_DEBUG) {
|
|
@@ -8860,70 +8949,6 @@ function formatMarkdownish(text, { format, paragraphs }) {
|
|
|
8860
8949
|
` : ``;
|
|
8861
8950
|
}
|
|
8862
8951
|
|
|
8863
|
-
// node_modules/clipanion/lib/advanced/options/utils.mjs
|
|
8864
|
-
var isOptionSymbol = Symbol(`clipanion/isOption`);
|
|
8865
|
-
function makeCommandOption(spec) {
|
|
8866
|
-
return { ...spec, [isOptionSymbol]: true };
|
|
8867
|
-
}
|
|
8868
|
-
function cleanValidationError(message, { mergeName = false } = {}) {
|
|
8869
|
-
const match = message.match(/^([^:]+): (.*)$/m);
|
|
8870
|
-
if (!match)
|
|
8871
|
-
return `validation failed`;
|
|
8872
|
-
let [, path, line] = match;
|
|
8873
|
-
if (mergeName)
|
|
8874
|
-
line = line[0].toLowerCase() + line.slice(1);
|
|
8875
|
-
line = path !== `.` || !mergeName ? `${path.replace(/^\.(\[|$)/, `$1`)}: ${line}` : `: ${line}`;
|
|
8876
|
-
return line;
|
|
8877
|
-
}
|
|
8878
|
-
function formatError(message, errors) {
|
|
8879
|
-
if (errors.length === 1) {
|
|
8880
|
-
return new UsageError(`${message}${cleanValidationError(errors[0], { mergeName: true })}`);
|
|
8881
|
-
} else {
|
|
8882
|
-
return new UsageError(`${message}:
|
|
8883
|
-
${errors.map((error) => `
|
|
8884
|
-
- ${cleanValidationError(error)}`).join(``)}`);
|
|
8885
|
-
}
|
|
8886
|
-
}
|
|
8887
|
-
|
|
8888
|
-
// node_modules/clipanion/lib/advanced/Command.mjs
|
|
8889
|
-
class Command {
|
|
8890
|
-
constructor() {
|
|
8891
|
-
this.help = false;
|
|
8892
|
-
}
|
|
8893
|
-
static Usage(usage) {
|
|
8894
|
-
return usage;
|
|
8895
|
-
}
|
|
8896
|
-
async catch(error) {
|
|
8897
|
-
throw error;
|
|
8898
|
-
}
|
|
8899
|
-
async validateAndExecute() {
|
|
8900
|
-
const commandClass = this.constructor;
|
|
8901
|
-
const cascade = commandClass.schema;
|
|
8902
|
-
if (Array.isArray(cascade)) {
|
|
8903
|
-
const { isDict, isUnknown, applyCascade } = await Promise.resolve().then(() => __toESM(require_lib(), 1));
|
|
8904
|
-
const schema = applyCascade(isDict(isUnknown()), cascade);
|
|
8905
|
-
const errors = [];
|
|
8906
|
-
const coercions = [];
|
|
8907
|
-
const check = schema(this, { errors, coercions });
|
|
8908
|
-
if (!check)
|
|
8909
|
-
throw formatError(`Invalid option schema`, errors);
|
|
8910
|
-
for (const [, op] of coercions) {
|
|
8911
|
-
op();
|
|
8912
|
-
}
|
|
8913
|
-
} else if (cascade != null) {
|
|
8914
|
-
throw new Error(`Invalid command schema`);
|
|
8915
|
-
}
|
|
8916
|
-
const exitCode = await this.execute();
|
|
8917
|
-
if (typeof exitCode !== `undefined`) {
|
|
8918
|
-
return exitCode;
|
|
8919
|
-
} else {
|
|
8920
|
-
return 0;
|
|
8921
|
-
}
|
|
8922
|
-
}
|
|
8923
|
-
}
|
|
8924
|
-
Command.isOption = isOptionSymbol;
|
|
8925
|
-
Command.Default = [];
|
|
8926
|
-
|
|
8927
8952
|
// node_modules/clipanion/lib/advanced/HelpCommand.mjs
|
|
8928
8953
|
class HelpCommand extends Command {
|
|
8929
8954
|
static from(state, contexts) {
|
|
@@ -9389,19 +9414,208 @@ VersionCommand.paths = [[`-v`], [`--version`]];
|
|
|
9389
9414
|
var exports_options = {};
|
|
9390
9415
|
__export(exports_options, {
|
|
9391
9416
|
rerouteArguments: () => rerouteArguments,
|
|
9392
|
-
makeCommandOption: () =>
|
|
9393
|
-
isOptionSymbol: () =>
|
|
9394
|
-
formatError: () =>
|
|
9395
|
-
cleanValidationError: () =>
|
|
9417
|
+
makeCommandOption: () => makeCommandOption,
|
|
9418
|
+
isOptionSymbol: () => isOptionSymbol,
|
|
9419
|
+
formatError: () => formatError,
|
|
9420
|
+
cleanValidationError: () => cleanValidationError,
|
|
9396
9421
|
applyValidator: () => applyValidator,
|
|
9397
9422
|
String: () => String2,
|
|
9398
9423
|
Rest: () => Rest,
|
|
9399
|
-
Proxy: () =>
|
|
9424
|
+
Proxy: () => Proxy,
|
|
9400
9425
|
Counter: () => Counter,
|
|
9401
9426
|
Boolean: () => Boolean2,
|
|
9402
9427
|
Array: () => Array2
|
|
9403
9428
|
});
|
|
9404
9429
|
|
|
9430
|
+
// node_modules/clipanion/lib/advanced/options/Array.mjs
|
|
9431
|
+
function Array2(descriptor, initialValueBase, optsBase) {
|
|
9432
|
+
const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== undefined ? optsBase : {});
|
|
9433
|
+
const { arity = 1 } = opts;
|
|
9434
|
+
const optNames = descriptor.split(`,`);
|
|
9435
|
+
const nameSet = new Set(optNames);
|
|
9436
|
+
return makeCommandOption({
|
|
9437
|
+
definition(builder) {
|
|
9438
|
+
builder.addOption({
|
|
9439
|
+
names: optNames,
|
|
9440
|
+
arity,
|
|
9441
|
+
hidden: opts === null || opts === undefined ? undefined : opts.hidden,
|
|
9442
|
+
description: opts === null || opts === undefined ? undefined : opts.description,
|
|
9443
|
+
required: opts.required
|
|
9444
|
+
});
|
|
9445
|
+
},
|
|
9446
|
+
transformer(builder, key, state) {
|
|
9447
|
+
let usedName;
|
|
9448
|
+
let currentValue = typeof initialValue !== `undefined` ? [...initialValue] : undefined;
|
|
9449
|
+
for (const { name, value } of state.options) {
|
|
9450
|
+
if (!nameSet.has(name))
|
|
9451
|
+
continue;
|
|
9452
|
+
usedName = name;
|
|
9453
|
+
currentValue = currentValue !== null && currentValue !== undefined ? currentValue : [];
|
|
9454
|
+
currentValue.push(value);
|
|
9455
|
+
}
|
|
9456
|
+
if (typeof currentValue !== `undefined`) {
|
|
9457
|
+
return applyValidator(usedName !== null && usedName !== undefined ? usedName : key, currentValue, opts.validator);
|
|
9458
|
+
} else {
|
|
9459
|
+
return currentValue;
|
|
9460
|
+
}
|
|
9461
|
+
}
|
|
9462
|
+
});
|
|
9463
|
+
}
|
|
9464
|
+
// node_modules/clipanion/lib/advanced/options/Boolean.mjs
|
|
9465
|
+
function Boolean2(descriptor, initialValueBase, optsBase) {
|
|
9466
|
+
const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== undefined ? optsBase : {});
|
|
9467
|
+
const optNames = descriptor.split(`,`);
|
|
9468
|
+
const nameSet = new Set(optNames);
|
|
9469
|
+
return makeCommandOption({
|
|
9470
|
+
definition(builder) {
|
|
9471
|
+
builder.addOption({
|
|
9472
|
+
names: optNames,
|
|
9473
|
+
allowBinding: false,
|
|
9474
|
+
arity: 0,
|
|
9475
|
+
hidden: opts.hidden,
|
|
9476
|
+
description: opts.description,
|
|
9477
|
+
required: opts.required
|
|
9478
|
+
});
|
|
9479
|
+
},
|
|
9480
|
+
transformer(builer, key, state) {
|
|
9481
|
+
let currentValue = initialValue;
|
|
9482
|
+
for (const { name, value } of state.options) {
|
|
9483
|
+
if (!nameSet.has(name))
|
|
9484
|
+
continue;
|
|
9485
|
+
currentValue = value;
|
|
9486
|
+
}
|
|
9487
|
+
return currentValue;
|
|
9488
|
+
}
|
|
9489
|
+
});
|
|
9490
|
+
}
|
|
9491
|
+
// node_modules/clipanion/lib/advanced/options/Counter.mjs
|
|
9492
|
+
function Counter(descriptor, initialValueBase, optsBase) {
|
|
9493
|
+
const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== undefined ? optsBase : {});
|
|
9494
|
+
const optNames = descriptor.split(`,`);
|
|
9495
|
+
const nameSet = new Set(optNames);
|
|
9496
|
+
return makeCommandOption({
|
|
9497
|
+
definition(builder) {
|
|
9498
|
+
builder.addOption({
|
|
9499
|
+
names: optNames,
|
|
9500
|
+
allowBinding: false,
|
|
9501
|
+
arity: 0,
|
|
9502
|
+
hidden: opts.hidden,
|
|
9503
|
+
description: opts.description,
|
|
9504
|
+
required: opts.required
|
|
9505
|
+
});
|
|
9506
|
+
},
|
|
9507
|
+
transformer(builder, key, state) {
|
|
9508
|
+
let currentValue = initialValue;
|
|
9509
|
+
for (const { name, value } of state.options) {
|
|
9510
|
+
if (!nameSet.has(name))
|
|
9511
|
+
continue;
|
|
9512
|
+
currentValue !== null && currentValue !== undefined || (currentValue = 0);
|
|
9513
|
+
if (!value) {
|
|
9514
|
+
currentValue = 0;
|
|
9515
|
+
} else {
|
|
9516
|
+
currentValue += 1;
|
|
9517
|
+
}
|
|
9518
|
+
}
|
|
9519
|
+
return currentValue;
|
|
9520
|
+
}
|
|
9521
|
+
});
|
|
9522
|
+
}
|
|
9523
|
+
// node_modules/clipanion/lib/advanced/options/Rest.mjs
|
|
9524
|
+
function Rest(opts = {}) {
|
|
9525
|
+
return makeCommandOption({
|
|
9526
|
+
definition(builder, key) {
|
|
9527
|
+
var _a;
|
|
9528
|
+
builder.addRest({
|
|
9529
|
+
name: (_a = opts.name) !== null && _a !== undefined ? _a : key,
|
|
9530
|
+
required: opts.required
|
|
9531
|
+
});
|
|
9532
|
+
},
|
|
9533
|
+
transformer(builder, key, state) {
|
|
9534
|
+
const isRestPositional = (index) => {
|
|
9535
|
+
const positional = state.positionals[index];
|
|
9536
|
+
if (positional.extra === NoLimits)
|
|
9537
|
+
return true;
|
|
9538
|
+
if (positional.extra === false && index < builder.arity.leading.length)
|
|
9539
|
+
return true;
|
|
9540
|
+
return false;
|
|
9541
|
+
};
|
|
9542
|
+
let count = 0;
|
|
9543
|
+
while (count < state.positionals.length && isRestPositional(count))
|
|
9544
|
+
count += 1;
|
|
9545
|
+
return state.positionals.splice(0, count).map(({ value }) => value);
|
|
9546
|
+
}
|
|
9547
|
+
});
|
|
9548
|
+
}
|
|
9549
|
+
// node_modules/clipanion/lib/advanced/options/String.mjs
|
|
9550
|
+
function StringOption(descriptor, initialValueBase, optsBase) {
|
|
9551
|
+
const [initialValue, opts] = rerouteArguments(initialValueBase, optsBase !== null && optsBase !== undefined ? optsBase : {});
|
|
9552
|
+
const { arity = 1 } = opts;
|
|
9553
|
+
const optNames = descriptor.split(`,`);
|
|
9554
|
+
const nameSet = new Set(optNames);
|
|
9555
|
+
return makeCommandOption({
|
|
9556
|
+
definition(builder) {
|
|
9557
|
+
builder.addOption({
|
|
9558
|
+
names: optNames,
|
|
9559
|
+
arity: opts.tolerateBoolean ? 0 : arity,
|
|
9560
|
+
hidden: opts.hidden,
|
|
9561
|
+
description: opts.description,
|
|
9562
|
+
required: opts.required
|
|
9563
|
+
});
|
|
9564
|
+
},
|
|
9565
|
+
transformer(builder, key, state, context) {
|
|
9566
|
+
let usedName;
|
|
9567
|
+
let currentValue = initialValue;
|
|
9568
|
+
if (typeof opts.env !== `undefined` && context.env[opts.env]) {
|
|
9569
|
+
usedName = opts.env;
|
|
9570
|
+
currentValue = context.env[opts.env];
|
|
9571
|
+
}
|
|
9572
|
+
for (const { name, value } of state.options) {
|
|
9573
|
+
if (!nameSet.has(name))
|
|
9574
|
+
continue;
|
|
9575
|
+
usedName = name;
|
|
9576
|
+
currentValue = value;
|
|
9577
|
+
}
|
|
9578
|
+
if (typeof currentValue === `string`) {
|
|
9579
|
+
return applyValidator(usedName !== null && usedName !== undefined ? usedName : key, currentValue, opts.validator);
|
|
9580
|
+
} else {
|
|
9581
|
+
return currentValue;
|
|
9582
|
+
}
|
|
9583
|
+
}
|
|
9584
|
+
});
|
|
9585
|
+
}
|
|
9586
|
+
function StringPositional(opts = {}) {
|
|
9587
|
+
const { required = true } = opts;
|
|
9588
|
+
return makeCommandOption({
|
|
9589
|
+
definition(builder, key) {
|
|
9590
|
+
var _a;
|
|
9591
|
+
builder.addPositional({
|
|
9592
|
+
name: (_a = opts.name) !== null && _a !== undefined ? _a : key,
|
|
9593
|
+
required: opts.required
|
|
9594
|
+
});
|
|
9595
|
+
},
|
|
9596
|
+
transformer(builder, key, state) {
|
|
9597
|
+
var _a;
|
|
9598
|
+
for (let i = 0;i < state.positionals.length; ++i) {
|
|
9599
|
+
if (state.positionals[i].extra === NoLimits)
|
|
9600
|
+
continue;
|
|
9601
|
+
if (required && state.positionals[i].extra === true)
|
|
9602
|
+
continue;
|
|
9603
|
+
if (!required && state.positionals[i].extra === false)
|
|
9604
|
+
continue;
|
|
9605
|
+
const [positional] = state.positionals.splice(i, 1);
|
|
9606
|
+
return applyValidator((_a = opts.name) !== null && _a !== undefined ? _a : key, positional.value, opts.validator);
|
|
9607
|
+
}
|
|
9608
|
+
return;
|
|
9609
|
+
}
|
|
9610
|
+
});
|
|
9611
|
+
}
|
|
9612
|
+
function String2(descriptor, ...args) {
|
|
9613
|
+
if (typeof descriptor === `string`) {
|
|
9614
|
+
return StringOption(descriptor, ...args);
|
|
9615
|
+
} else {
|
|
9616
|
+
return StringPositional(descriptor);
|
|
9617
|
+
}
|
|
9618
|
+
}
|
|
9405
9619
|
// src/lib/config.ts
|
|
9406
9620
|
import { mkdir } from "node:fs/promises";
|
|
9407
9621
|
import { resolve } from "node:path";
|
|
@@ -11395,16 +11609,6 @@ class RootCommand extends Command {
|
|
|
11395
11609
|
}
|
|
11396
11610
|
}
|
|
11397
11611
|
|
|
11398
|
-
// src/lib/errors.ts
|
|
11399
|
-
class RmrError2 extends Error {
|
|
11400
|
-
code;
|
|
11401
|
-
constructor(code, message) {
|
|
11402
|
-
super(message);
|
|
11403
|
-
this.name = "RmrError";
|
|
11404
|
-
this.code = code;
|
|
11405
|
-
}
|
|
11406
|
-
}
|
|
11407
|
-
|
|
11408
11612
|
// src/lib/logger.ts
|
|
11409
11613
|
var colors = {
|
|
11410
11614
|
reset: "\x1B[0m",
|
|
@@ -11579,37 +11783,11 @@ class RunCommand extends Command {
|
|
|
11579
11783
|
}
|
|
11580
11784
|
}
|
|
11581
11785
|
|
|
11582
|
-
// src/lib/version.ts
|
|
11583
|
-
import { readFileSync as readFileSync2 } from "node:fs";
|
|
11584
|
-
import { dirname as dirname4, resolve as resolve9 } from "node:path";
|
|
11585
|
-
import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
11586
|
-
var cached2;
|
|
11587
|
-
function getVersion2() {
|
|
11588
|
-
if (cached2)
|
|
11589
|
-
return cached2;
|
|
11590
|
-
const thisDir = dirname4(fileURLToPath3(import.meta.url));
|
|
11591
|
-
const candidates = [
|
|
11592
|
-
resolve9(thisDir, "..", "package.json"),
|
|
11593
|
-
resolve9(thisDir, "..", "..", "package.json")
|
|
11594
|
-
];
|
|
11595
|
-
for (const candidate of candidates) {
|
|
11596
|
-
try {
|
|
11597
|
-
const pkg = JSON.parse(readFileSync2(candidate, "utf8"));
|
|
11598
|
-
if (pkg.version) {
|
|
11599
|
-
cached2 = pkg.version;
|
|
11600
|
-
return cached2;
|
|
11601
|
-
}
|
|
11602
|
-
} catch {}
|
|
11603
|
-
}
|
|
11604
|
-
cached2 = "0.0.0";
|
|
11605
|
-
return cached2;
|
|
11606
|
-
}
|
|
11607
|
-
|
|
11608
11786
|
// src/index.ts
|
|
11609
11787
|
var [, , ...args] = process.argv;
|
|
11610
11788
|
var cli = new Cli({
|
|
11611
11789
|
binaryName: "rmr",
|
|
11612
|
-
binaryVersion:
|
|
11790
|
+
binaryVersion: getVersion(),
|
|
11613
11791
|
enableColors: false
|
|
11614
11792
|
});
|
|
11615
11793
|
cli.register(exports_builtins.HelpCommand);
|
|
@@ -11624,7 +11802,7 @@ try {
|
|
|
11624
11802
|
const exitCode = await cli.run(args);
|
|
11625
11803
|
process.exitCode = exitCode;
|
|
11626
11804
|
} catch (error) {
|
|
11627
|
-
if (error instanceof
|
|
11805
|
+
if (error instanceof RmrError) {
|
|
11628
11806
|
logger.error(`${error.code}: ${error.message}`);
|
|
11629
11807
|
process.exitCode = 1;
|
|
11630
11808
|
} else if (error instanceof Error) {
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@klaudworks/rex",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "@klaudworks/rex",
|
|
9
|
-
"version": "0.4.
|
|
9
|
+
"version": "0.4.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"clipanion": "^4.0.0-rc.4",
|
|
12
12
|
"yaml": "^2.8.2"
|