@ai-hero/sandcastle 0.13.0 → 0.14.0
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 +3 -3
- package/dist/{SandboxProvider-YCL97qco.d.ts → SandboxProvider-Chsi-Zs6.d.ts} +3 -2
- package/dist/{chunk-767EAJVT.js → chunk-ATA2V2TC.js} +3 -3
- package/dist/{chunk-767EAJVT.js.map → chunk-ATA2V2TC.js.map} +1 -1
- package/dist/{chunk-4EIVTSOZ.js → chunk-BIF2X6QB.js} +4 -3
- package/dist/chunk-BIF2X6QB.js.map +1 -0
- package/dist/{chunk-XCYK7I45.js → chunk-BVZWLFFT.js} +2 -2
- package/dist/chunk-BVZWLFFT.js.map +1 -0
- package/dist/chunk-EXYXBRCX.js +60 -0
- package/dist/chunk-EXYXBRCX.js.map +1 -0
- package/dist/chunk-G2R53CVZ.js +3172 -0
- package/dist/chunk-G2R53CVZ.js.map +1 -0
- package/dist/{chunk-U42XXICG.js → chunk-GCLEXPXG.js} +7 -4
- package/dist/chunk-GCLEXPXG.js.map +1 -0
- package/dist/chunk-H2PEFS4W.js +1244 -0
- package/dist/chunk-H2PEFS4W.js.map +1 -0
- package/dist/{chunk-NMQ5Z6YG.js → chunk-HSXPRZKG.js} +5 -3
- package/dist/chunk-HSXPRZKG.js.map +1 -0
- package/dist/{chunk-J5J5YJ5S.js → chunk-IBK2XNSS.js} +3 -3
- package/dist/{chunk-J5J5YJ5S.js.map → chunk-IBK2XNSS.js.map} +1 -1
- package/dist/chunk-RDW7FNN6.js +792 -0
- package/dist/chunk-RDW7FNN6.js.map +1 -0
- package/dist/{chunk-A4C2FG74.js → chunk-S6UHPTRG.js} +43 -42
- package/dist/chunk-S6UHPTRG.js.map +1 -0
- package/dist/{chunk-LWNC4UTZ.js → chunk-STB2U7BB.js} +5414 -9389
- package/dist/chunk-STB2U7BB.js.map +1 -0
- package/dist/{chunk-XCWKLDH4.js → chunk-VRXR2T3S.js} +3 -3
- package/dist/{chunk-XCWKLDH4.js.map → chunk-VRXR2T3S.js.map} +1 -1
- package/dist/index.d.ts +6 -2
- package/dist/index.js +458 -1675
- package/dist/index.js.map +1 -1
- package/dist/main.js +262 -247
- package/dist/main.js.map +1 -1
- package/dist/sandboxes/bwrap.d.ts +1 -1
- package/dist/sandboxes/bwrap.js +9 -6
- package/dist/sandboxes/bwrap.js.map +1 -1
- package/dist/sandboxes/daytona.d.ts +1 -1
- package/dist/sandboxes/daytona.js +179 -135
- package/dist/sandboxes/daytona.js.map +1 -1
- package/dist/sandboxes/docker.d.ts +1 -1
- package/dist/sandboxes/docker.js +6 -3
- package/dist/sandboxes/e2b.d.ts +41 -0
- package/dist/sandboxes/e2b.js +202 -0
- package/dist/sandboxes/e2b.js.map +1 -0
- package/dist/sandboxes/modal.d.ts +78 -0
- package/dist/sandboxes/modal.js +171 -0
- package/dist/sandboxes/modal.js.map +1 -0
- package/dist/sandboxes/no-sandbox.d.ts +1 -1
- package/dist/sandboxes/podman.d.ts +1 -1
- package/dist/sandboxes/podman.js +6 -3
- package/dist/sandboxes/podman.js.map +1 -1
- package/dist/sandboxes/seatbelt.d.ts +1 -1
- package/dist/sandboxes/seatbelt.js +9 -6
- package/dist/sandboxes/seatbelt.js.map +1 -1
- package/dist/sandboxes/sprites.d.ts +54 -0
- package/dist/sandboxes/sprites.js +198 -0
- package/dist/sandboxes/sprites.js.map +1 -0
- package/dist/sandboxes/vercel.d.ts +1 -1
- package/dist/sandboxes/vercel.js +1 -1
- package/package.json +30 -2
- package/dist/chunk-4EIVTSOZ.js.map +0 -1
- package/dist/chunk-A4C2FG74.js.map +0 -1
- package/dist/chunk-LWNC4UTZ.js.map +0 -1
- package/dist/chunk-NMQ5Z6YG.js.map +0 -1
- package/dist/chunk-U42XXICG.js.map +0 -1
- package/dist/chunk-XCYK7I45.js.map +0 -1
package/dist/main.js
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import './chunk-
|
|
3
|
+
import { assertBwrapUsable } from './chunk-ATA2V2TC.js';
|
|
4
|
+
import { assertSeatbeltUsable } from './chunk-IBK2XNSS.js';
|
|
5
|
+
import { withFriendlyErrors } from './chunk-BIF2X6QB.js';
|
|
6
|
+
import { NodeContext_exports, NodeRuntime_exports } from './chunk-S6UHPTRG.js';
|
|
7
|
+
import { buildImage, removeImage } from './chunk-GCLEXPXG.js';
|
|
8
|
+
import { Display, ClackDisplay, defaultImageName, SANDBOX_REPO_DIR } from './chunk-G2R53CVZ.js';
|
|
9
|
+
import './chunk-EXYXBRCX.js';
|
|
10
|
+
import { InitError, FileSystem_exports, ConfigDirError, ImageNotFoundError, FileSystem, isQuitException, PodmanError, Terminal, QuitException, Path } from './chunk-RDW7FNN6.js';
|
|
11
|
+
import { CommitPrototype, dual, GenericTag, fromIterable, failSync, map2, reduce, Schema_exports, Effect_exports, Option_exports, Layer_exports, decode, mapError, TreeFormatter, empty, none, flatMap3, catchAll, match, fail3, map4 as map4$1, merge, some, right, left, isNonEmptyReadonlyArray, headNonEmpty, tailNonEmpty, isArray, identity, fromIterable2, fromIterable3, globalValue, contextWithEffect, getOrElse, getOption, appendAll, matchEffect, unify, catchSome, zipRight, matchLeft, pipe, zipLeft, log, succeed2 as succeed2$1, isOption, make4, update, repeatN, get2, getSomes, map, zipWith, make3, as, prepend, make, isEmpty, empty2, isEmptyReadonlyArray, of, catchTag, isTagged, die, isConfigError, isMissingDataOnly, filterMap, get, every, mapBoth, zip, forEach, _void, orElse, match2, join as join$1, isConfig, isObject, toStringUnknown, isSome, getOrThrow, try_, flatMap2, unsafeGet, drop, splitAt, tap, take, reduceRight, withMinimumLogLevel, error, mapInput, boolean, sort, contains, append, fromNullable, catchTags, when, set, pipeArguments, head, make10 as make10$1, suspend, get4, allocate, gen, updateAndGet, span, some2, sync, orElse2, has2, filter2, Config_exports, is, decodeUnknown, String$, fromString, make7 as make7$1, orElseFail, orDie, compose, NumberFromString, Int, Date$, findFirst, allLevels, updateEffect, flatten, fnUntraced, scoped, isNone, Literal, unlessEffect, asVoid, catchIf, runSync, of3 as of3$1, match3, filterOrDieMessage, filter3, isEffect, taggedEnum, round, ensuring, cons, dieMessage, value, when2, orElse3, isNil, matchRight, symbol2, symbol, cached, findFirstIndex, flatMap, findLast, equals, combine, hash, string, string2, provide, provideServiceEffect, provideService, int } from './chunk-STB2U7BB.js';
|
|
12
|
+
import './chunk-BVZWLFFT.js';
|
|
10
13
|
import { __commonJS, __require, __toESM, __export } from './chunk-6NQPCXSG.js';
|
|
11
14
|
import * as clack from '@clack/prompts';
|
|
12
15
|
import { execSync, execFile } from 'child_process';
|
|
@@ -11226,17 +11229,17 @@ var fileParsers = {
|
|
|
11226
11229
|
tml: (content) => Toml.parse(content)
|
|
11227
11230
|
};
|
|
11228
11231
|
var read = (path2) => flatMap3(FileSystem, (fs) => matchEffect(fs.readFile(path2), {
|
|
11229
|
-
onFailure: (error3) =>
|
|
11230
|
-
onSuccess: (content) =>
|
|
11232
|
+
onFailure: (error3) => fail3(`Could not read file (${path2}): ${error3}`),
|
|
11233
|
+
onSuccess: (content) => succeed2$1([path2, content])
|
|
11231
11234
|
}));
|
|
11232
11235
|
var readString = (path2) => flatMap3(FileSystem, (fs) => matchEffect(fs.readFileString(path2), {
|
|
11233
|
-
onFailure: (error3) =>
|
|
11234
|
-
onSuccess: (content) =>
|
|
11236
|
+
onFailure: (error3) => fail3(`Could not read file (${path2}): ${error3}`),
|
|
11237
|
+
onSuccess: (content) => succeed2$1([path2, content])
|
|
11235
11238
|
}));
|
|
11236
11239
|
var parse4 = (path2, content, format) => {
|
|
11237
11240
|
const parser = fileParsers[format ?? path2.split(".").pop()];
|
|
11238
11241
|
if (parser === void 0) {
|
|
11239
|
-
return
|
|
11242
|
+
return fail3(`Unsupported file format: ${format}`);
|
|
11240
11243
|
}
|
|
11241
11244
|
return try_({
|
|
11242
11245
|
try: () => parser(content),
|
|
@@ -11910,7 +11913,7 @@ var changesUponFlatteningSafe = (self) => gen(function* () {
|
|
|
11910
11913
|
throw new Error("[BUG]: Doc.changesUponFlattening - unable to flatten a Cat document - please open an issue at https://github.com/IMax153/contentlayer/issues/new");
|
|
11911
11914
|
}
|
|
11912
11915
|
case "Nest": {
|
|
11913
|
-
return yield* pipe(changesUponFlatteningSafe(self.doc),
|
|
11916
|
+
return yield* pipe(changesUponFlatteningSafe(self.doc), map4$1(map5((doc) => nest(doc, self.indent))));
|
|
11914
11917
|
}
|
|
11915
11918
|
case "Union": {
|
|
11916
11919
|
return flattened(self.left);
|
|
@@ -11928,7 +11931,7 @@ var changesUponFlatteningSafe = (self) => gen(function* () {
|
|
|
11928
11931
|
return flattened(doc);
|
|
11929
11932
|
}
|
|
11930
11933
|
case "Annotated": {
|
|
11931
|
-
return yield* pipe(changesUponFlatteningSafe(self.doc),
|
|
11934
|
+
return yield* pipe(changesUponFlatteningSafe(self.doc), map4$1(map5((doc) => annotate(doc, self.annotation))));
|
|
11932
11935
|
}
|
|
11933
11936
|
}
|
|
11934
11937
|
});
|
|
@@ -12182,7 +12185,7 @@ var selectNicer = (fits, lineIndent, currentColumn, left2, right2) => {
|
|
|
12182
12185
|
let rightStream = void 0;
|
|
12183
12186
|
return fits(leftStream, lineIndent, currentColumn, () => rightStream ?? (rightStream = runSync(right2), rightStream)) ? leftStream : rightStream ?? runSync(right2);
|
|
12184
12187
|
};
|
|
12185
|
-
var compact = (self) => runSync(compactSafe(
|
|
12188
|
+
var compact = (self) => runSync(compactSafe(of3$1(self), 0));
|
|
12186
12189
|
var compactSafe = (docs, i) => gen(function* () {
|
|
12187
12190
|
if (isNil(docs)) {
|
|
12188
12191
|
return empty4;
|
|
@@ -12446,7 +12449,7 @@ var render = /* @__PURE__ */ dual(2, (self, config) => {
|
|
|
12446
12449
|
}
|
|
12447
12450
|
}
|
|
12448
12451
|
});
|
|
12449
|
-
var renderStream = (self) => runSync(renderSafe(self,
|
|
12452
|
+
var renderStream = (self) => runSync(renderSafe(self, of3$1(none2)));
|
|
12450
12453
|
var unsafePeek = (stack) => {
|
|
12451
12454
|
if (isNil(stack)) {
|
|
12452
12455
|
throw new Error("BUG: AnsiRender.unsafePeek - peeked at an empty stack - please report an issue at https://github.com/Effect-TS/printer/issues");
|
|
@@ -12465,30 +12468,30 @@ var renderSafe = (self, stack) => {
|
|
|
12465
12468
|
return dieMessage("BUG: AnsiRender.renderSafe - attempted to render a failed doc stream - please report an issue at https://github.com/Effect-TS/printer/issues");
|
|
12466
12469
|
}
|
|
12467
12470
|
case "EmptyStream": {
|
|
12468
|
-
return
|
|
12471
|
+
return succeed2$1("");
|
|
12469
12472
|
}
|
|
12470
12473
|
case "CharStream": {
|
|
12471
|
-
return
|
|
12474
|
+
return map4$1(suspend(() => renderSafe(self.stream, stack)), (rest) => self.char + rest);
|
|
12472
12475
|
}
|
|
12473
12476
|
case "TextStream": {
|
|
12474
|
-
return
|
|
12477
|
+
return map4$1(suspend(() => renderSafe(self.stream, stack)), (rest) => self.text + rest);
|
|
12475
12478
|
}
|
|
12476
12479
|
case "LineStream": {
|
|
12477
12480
|
let indent3 = "\n";
|
|
12478
12481
|
for (let i = 0; i < self.indentation; i++) {
|
|
12479
12482
|
indent3 = indent3 += " ";
|
|
12480
12483
|
}
|
|
12481
|
-
return
|
|
12484
|
+
return map4$1(suspend(() => renderSafe(self.stream, stack)), (rest) => indent3 + rest);
|
|
12482
12485
|
}
|
|
12483
12486
|
case "PushAnnotationStream": {
|
|
12484
12487
|
const currentStyle = unsafePeek(stack);
|
|
12485
12488
|
const nextStyle = combine2(self.annotation, currentStyle);
|
|
12486
|
-
return
|
|
12489
|
+
return map4$1(suspend(() => renderSafe(self.stream, cons(self.annotation, stack))), (rest) => stringify(nextStyle) + rest);
|
|
12487
12490
|
}
|
|
12488
12491
|
case "PopAnnotationStream": {
|
|
12489
12492
|
const [, styles] = unsafePop(stack);
|
|
12490
12493
|
const nextStyle = unsafePeek(styles);
|
|
12491
|
-
return
|
|
12494
|
+
return map4$1(suspend(() => renderSafe(self.stream, styles)), (rest) => stringify(nextStyle) + rest);
|
|
12492
12495
|
}
|
|
12493
12496
|
}
|
|
12494
12497
|
};
|
|
@@ -12832,7 +12835,7 @@ var runWithInput = (prompt4, terminal, input) => suspend(() => {
|
|
|
12832
12835
|
return flatMap3(runWithInput(op.prompt, terminal, input), (a) => runWithInput(op.onSuccess(a), terminal, input));
|
|
12833
12836
|
}
|
|
12834
12837
|
case "Succeed": {
|
|
12835
|
-
return
|
|
12838
|
+
return succeed2$1(op.value);
|
|
12836
12839
|
}
|
|
12837
12840
|
}
|
|
12838
12841
|
});
|
|
@@ -12905,7 +12908,7 @@ var windowsFigures = {
|
|
|
12905
12908
|
line: /* @__PURE__ */ text3("\u2500"),
|
|
12906
12909
|
pointer: /* @__PURE__ */ text3(">")
|
|
12907
12910
|
};
|
|
12908
|
-
var figures = /* @__PURE__ */
|
|
12911
|
+
var figures = /* @__PURE__ */ map4$1(/* @__PURE__ */ sync(() => process.platform === "win32"), (isWindows) => isWindows ? windowsFigures : defaultFigures);
|
|
12909
12912
|
function eraseText(text9, columns) {
|
|
12910
12913
|
if (columns === 0) {
|
|
12911
12914
|
return cat2(eraseLine3, cursorTo3(0));
|
|
@@ -13098,7 +13101,7 @@ var defaultLocales = {
|
|
|
13098
13101
|
function handleRender(options3) {
|
|
13099
13102
|
return (state, action) => {
|
|
13100
13103
|
return Action.$match(action, {
|
|
13101
|
-
Beep: () =>
|
|
13104
|
+
Beep: () => succeed2$1(renderBeep),
|
|
13102
13105
|
NextFrame: ({
|
|
13103
13106
|
state: state2
|
|
13104
13107
|
}) => renderNextFrame(state2, options3),
|
|
@@ -13110,21 +13113,21 @@ function handleProcess(options3) {
|
|
|
13110
13113
|
return (input, state) => {
|
|
13111
13114
|
switch (input.key.name) {
|
|
13112
13115
|
case "left": {
|
|
13113
|
-
return
|
|
13116
|
+
return succeed2$1(processCursorLeft(state));
|
|
13114
13117
|
}
|
|
13115
13118
|
case "right": {
|
|
13116
|
-
return
|
|
13119
|
+
return succeed2$1(processCursorRight(state));
|
|
13117
13120
|
}
|
|
13118
13121
|
case "k":
|
|
13119
13122
|
case "up": {
|
|
13120
|
-
return
|
|
13123
|
+
return succeed2$1(processUp(state));
|
|
13121
13124
|
}
|
|
13122
13125
|
case "j":
|
|
13123
13126
|
case "down": {
|
|
13124
|
-
return
|
|
13127
|
+
return succeed2$1(processDown(state));
|
|
13125
13128
|
}
|
|
13126
13129
|
case "tab": {
|
|
13127
|
-
return
|
|
13130
|
+
return succeed2$1(processNext(state));
|
|
13128
13131
|
}
|
|
13129
13132
|
case "enter":
|
|
13130
13133
|
case "return": {
|
|
@@ -13142,7 +13145,7 @@ function handleProcess(options3) {
|
|
|
13142
13145
|
}
|
|
13143
13146
|
default: {
|
|
13144
13147
|
const value2 = getOrElse(input.input, () => "");
|
|
13145
|
-
return
|
|
13148
|
+
return succeed2$1(defaultProcessor(value2, state));
|
|
13146
13149
|
}
|
|
13147
13150
|
}
|
|
13148
13151
|
};
|
|
@@ -13151,7 +13154,7 @@ var date = (options3) => {
|
|
|
13151
13154
|
const opts = {
|
|
13152
13155
|
initial: /* @__PURE__ */ new Date(),
|
|
13153
13156
|
dateMask: "YYYY-MM-DD HH:mm:ss",
|
|
13154
|
-
validate:
|
|
13157
|
+
validate: succeed2$1,
|
|
13155
13158
|
...options3,
|
|
13156
13159
|
locales: {
|
|
13157
13160
|
...defaultLocales,
|
|
@@ -13429,7 +13432,7 @@ function resolveCurrentPath(path2, options3) {
|
|
|
13429
13432
|
orDie(fs.exists(path3)).pipe(filterOrDieMessage(identity, `The provided starting path '${path3}' does not exist`), as(path3))
|
|
13430
13433
|
))
|
|
13431
13434
|
}),
|
|
13432
|
-
onSome: (path3) =>
|
|
13435
|
+
onSome: (path3) => succeed2$1(path3)
|
|
13433
13436
|
});
|
|
13434
13437
|
}
|
|
13435
13438
|
function getFileList(directory3, options3) {
|
|
@@ -13439,12 +13442,12 @@ function getFileList(directory3, options3) {
|
|
|
13439
13442
|
const files = yield* orDie(fs.readDirectory(directory3)).pipe(
|
|
13440
13443
|
// Always prepend the `".."` option to the file list but allow it
|
|
13441
13444
|
// to be filtered out if the user so desires
|
|
13442
|
-
|
|
13445
|
+
map4$1((files2) => ["..", ...files2])
|
|
13443
13446
|
);
|
|
13444
|
-
return yield*
|
|
13447
|
+
return yield* filter3(files, (file4) => {
|
|
13445
13448
|
const result = options3.filter(file4);
|
|
13446
|
-
const userDefinedFilter = isEffect(result) ? result :
|
|
13447
|
-
const directoryFilter = options3.type === "directory" ?
|
|
13449
|
+
const userDefinedFilter = isEffect(result) ? result : succeed2$1(result);
|
|
13450
|
+
const directoryFilter = options3.type === "directory" ? map4$1(orDie(fs.stat(path2.join(directory3, file4))), (info) => info.type === "Directory") : succeed2$1(true);
|
|
13448
13451
|
return zipWith(userDefinedFilter, directoryFilter, (a, b) => a && b);
|
|
13449
13452
|
}, {
|
|
13450
13453
|
concurrency: files.length
|
|
@@ -13561,7 +13564,7 @@ function renderSubmission2(value2, options3) {
|
|
|
13561
13564
|
function handleRender2(options3) {
|
|
13562
13565
|
return (_, action) => {
|
|
13563
13566
|
return Action.$match(action, {
|
|
13564
|
-
Beep: () =>
|
|
13567
|
+
Beep: () => succeed2$1(renderBeep2),
|
|
13565
13568
|
NextFrame: ({
|
|
13566
13569
|
state
|
|
13567
13570
|
}) => renderNextFrame2(state, options3),
|
|
@@ -13573,7 +13576,7 @@ function handleRender2(options3) {
|
|
|
13573
13576
|
}
|
|
13574
13577
|
function processCursorUp(state) {
|
|
13575
13578
|
const cursor = state.cursor - 1;
|
|
13576
|
-
return
|
|
13579
|
+
return succeed2$1(Action.NextFrame({
|
|
13577
13580
|
state: {
|
|
13578
13581
|
...state,
|
|
13579
13582
|
cursor: cursor < 0 ? state.files.length - 1 : cursor
|
|
@@ -13581,7 +13584,7 @@ function processCursorUp(state) {
|
|
|
13581
13584
|
}));
|
|
13582
13585
|
}
|
|
13583
13586
|
function processCursorDown(state) {
|
|
13584
|
-
return
|
|
13587
|
+
return succeed2$1(Action.NextFrame({
|
|
13585
13588
|
state: {
|
|
13586
13589
|
...state,
|
|
13587
13590
|
cursor: (state.cursor + 1) % state.files.length
|
|
@@ -13683,7 +13686,7 @@ var file = (options3 = {}) => {
|
|
|
13683
13686
|
message: options3.message ?? `Choose a file`,
|
|
13684
13687
|
startingPath: fromNullable(options3.startingPath),
|
|
13685
13688
|
maxPerPage: options3.maxPerPage ?? 10,
|
|
13686
|
-
filter: options3.filter ?? (() =>
|
|
13689
|
+
filter: options3.filter ?? (() => succeed2$1(true))
|
|
13687
13690
|
};
|
|
13688
13691
|
const initialState3 = gen(function* () {
|
|
13689
13692
|
const path2 = none();
|
|
@@ -13800,10 +13803,10 @@ function renderSubmission3(nextState, options3) {
|
|
|
13800
13803
|
}
|
|
13801
13804
|
function processBackspace(state) {
|
|
13802
13805
|
if (state.value.length <= 0) {
|
|
13803
|
-
return
|
|
13806
|
+
return succeed2$1(Action.Beep());
|
|
13804
13807
|
}
|
|
13805
13808
|
const value2 = state.value.slice(0, state.value.length - 1);
|
|
13806
|
-
return
|
|
13809
|
+
return succeed2$1(Action.NextFrame({
|
|
13807
13810
|
state: {
|
|
13808
13811
|
...state,
|
|
13809
13812
|
value: value2,
|
|
@@ -13813,7 +13816,7 @@ function processBackspace(state) {
|
|
|
13813
13816
|
}
|
|
13814
13817
|
function defaultIntProcessor(state, input) {
|
|
13815
13818
|
if (state.value.length === 0 && input === "-") {
|
|
13816
|
-
return
|
|
13819
|
+
return succeed2$1(Action.NextFrame({
|
|
13817
13820
|
state: {
|
|
13818
13821
|
...state,
|
|
13819
13822
|
value: "-",
|
|
@@ -13834,10 +13837,10 @@ function defaultIntProcessor(state, input) {
|
|
|
13834
13837
|
}
|
|
13835
13838
|
function defaultFloatProcessor(state, input) {
|
|
13836
13839
|
if (input === "." && state.value.includes(".")) {
|
|
13837
|
-
return
|
|
13840
|
+
return succeed2$1(Action.Beep());
|
|
13838
13841
|
}
|
|
13839
13842
|
if (state.value.length === 0 && input === "-") {
|
|
13840
|
-
return
|
|
13843
|
+
return succeed2$1(Action.NextFrame({
|
|
13841
13844
|
state: {
|
|
13842
13845
|
...state,
|
|
13843
13846
|
value: "-",
|
|
@@ -13864,7 +13867,7 @@ var initialState = {
|
|
|
13864
13867
|
function handleRenderInteger(options3) {
|
|
13865
13868
|
return (state, action) => {
|
|
13866
13869
|
return Action.$match(action, {
|
|
13867
|
-
Beep: () =>
|
|
13870
|
+
Beep: () => succeed2$1(renderBeep3),
|
|
13868
13871
|
NextFrame: ({
|
|
13869
13872
|
state: state2
|
|
13870
13873
|
}) => renderNextFrame3(state2, options3),
|
|
@@ -13880,7 +13883,7 @@ function handleProcessInteger(options3) {
|
|
|
13880
13883
|
}
|
|
13881
13884
|
case "k":
|
|
13882
13885
|
case "up": {
|
|
13883
|
-
return
|
|
13886
|
+
return succeed2$1(Action.NextFrame({
|
|
13884
13887
|
state: {
|
|
13885
13888
|
...state,
|
|
13886
13889
|
value: state.value === "" || state.value === "-" ? `${options3.incrementBy}` : `${Number.parseInt(state.value) + options3.incrementBy}`,
|
|
@@ -13890,7 +13893,7 @@ function handleProcessInteger(options3) {
|
|
|
13890
13893
|
}
|
|
13891
13894
|
case "j":
|
|
13892
13895
|
case "down": {
|
|
13893
|
-
return
|
|
13896
|
+
return succeed2$1(Action.NextFrame({
|
|
13894
13897
|
state: {
|
|
13895
13898
|
...state,
|
|
13896
13899
|
value: state.value === "" || state.value === "-" ? `-${options3.decrementBy}` : `${Number.parseInt(state.value) - options3.decrementBy}`,
|
|
@@ -13901,7 +13904,7 @@ function handleProcessInteger(options3) {
|
|
|
13901
13904
|
case "enter":
|
|
13902
13905
|
case "return": {
|
|
13903
13906
|
return matchEffect(parseInt2(state.value), {
|
|
13904
|
-
onFailure: () =>
|
|
13907
|
+
onFailure: () => succeed2$1(Action.NextFrame({
|
|
13905
13908
|
state: {
|
|
13906
13909
|
...state,
|
|
13907
13910
|
error: some("Must provide an integer value")
|
|
@@ -13935,12 +13938,12 @@ var integer = (options3) => {
|
|
|
13935
13938
|
decrementBy: 1,
|
|
13936
13939
|
validate: (n) => {
|
|
13937
13940
|
if (n < opts.min) {
|
|
13938
|
-
return
|
|
13941
|
+
return fail3(`${n} must be greater than or equal to ${opts.min}`);
|
|
13939
13942
|
}
|
|
13940
13943
|
if (n > opts.max) {
|
|
13941
|
-
return
|
|
13944
|
+
return fail3(`${n} must be less than or equal to ${opts.max}`);
|
|
13942
13945
|
}
|
|
13943
|
-
return
|
|
13946
|
+
return succeed2$1(n);
|
|
13944
13947
|
},
|
|
13945
13948
|
...options3
|
|
13946
13949
|
};
|
|
@@ -13953,7 +13956,7 @@ var integer = (options3) => {
|
|
|
13953
13956
|
function handleRenderFloat(options3) {
|
|
13954
13957
|
return (state, action) => {
|
|
13955
13958
|
return Action.$match(action, {
|
|
13956
|
-
Beep: () =>
|
|
13959
|
+
Beep: () => succeed2$1(renderBeep3),
|
|
13957
13960
|
NextFrame: ({
|
|
13958
13961
|
state: state2
|
|
13959
13962
|
}) => renderNextFrame3(state2, options3),
|
|
@@ -13969,7 +13972,7 @@ function handleProcessFloat(options3) {
|
|
|
13969
13972
|
}
|
|
13970
13973
|
case "k":
|
|
13971
13974
|
case "up": {
|
|
13972
|
-
return
|
|
13975
|
+
return succeed2$1(Action.NextFrame({
|
|
13973
13976
|
state: {
|
|
13974
13977
|
...state,
|
|
13975
13978
|
value: state.value === "" || state.value === "-" ? `${options3.incrementBy}` : `${Number.parseFloat(state.value) + options3.incrementBy}`,
|
|
@@ -13979,7 +13982,7 @@ function handleProcessFloat(options3) {
|
|
|
13979
13982
|
}
|
|
13980
13983
|
case "j":
|
|
13981
13984
|
case "down": {
|
|
13982
|
-
return
|
|
13985
|
+
return succeed2$1(Action.NextFrame({
|
|
13983
13986
|
state: {
|
|
13984
13987
|
...state,
|
|
13985
13988
|
value: state.value === "" || state.value === "-" ? `-${options3.decrementBy}` : `${Number.parseFloat(state.value) - options3.decrementBy}`,
|
|
@@ -13990,7 +13993,7 @@ function handleProcessFloat(options3) {
|
|
|
13990
13993
|
case "enter":
|
|
13991
13994
|
case "return": {
|
|
13992
13995
|
return matchEffect(parseFloat2(state.value), {
|
|
13993
|
-
onFailure: () =>
|
|
13996
|
+
onFailure: () => succeed2$1(Action.NextFrame({
|
|
13994
13997
|
state: {
|
|
13995
13998
|
...state,
|
|
13996
13999
|
error: some("Must provide a floating point value")
|
|
@@ -14025,12 +14028,12 @@ var float = (options3) => {
|
|
|
14025
14028
|
precision: 2,
|
|
14026
14029
|
validate: (n) => {
|
|
14027
14030
|
if (n < opts.min) {
|
|
14028
|
-
return
|
|
14031
|
+
return fail3(`${n} must be greater than or equal to ${opts.min}`);
|
|
14029
14032
|
}
|
|
14030
14033
|
if (n > opts.max) {
|
|
14031
|
-
return
|
|
14034
|
+
return fail3(`${n} must be less than or equal to ${opts.max}`);
|
|
14032
14035
|
}
|
|
14033
|
-
return
|
|
14036
|
+
return succeed2$1(n);
|
|
14034
14037
|
},
|
|
14035
14038
|
...options3
|
|
14036
14039
|
};
|
|
@@ -14133,33 +14136,33 @@ function renderSubmission4(state, options3) {
|
|
|
14133
14136
|
}
|
|
14134
14137
|
function processCursorUp2(state, choices) {
|
|
14135
14138
|
if (state === 0) {
|
|
14136
|
-
return
|
|
14139
|
+
return succeed2$1(Action.NextFrame({
|
|
14137
14140
|
state: choices.length - 1
|
|
14138
14141
|
}));
|
|
14139
14142
|
}
|
|
14140
|
-
return
|
|
14143
|
+
return succeed2$1(Action.NextFrame({
|
|
14141
14144
|
state: state - 1
|
|
14142
14145
|
}));
|
|
14143
14146
|
}
|
|
14144
14147
|
function processCursorDown2(state, choices) {
|
|
14145
14148
|
if (state === choices.length - 1) {
|
|
14146
|
-
return
|
|
14149
|
+
return succeed2$1(Action.NextFrame({
|
|
14147
14150
|
state: 0
|
|
14148
14151
|
}));
|
|
14149
14152
|
}
|
|
14150
|
-
return
|
|
14153
|
+
return succeed2$1(Action.NextFrame({
|
|
14151
14154
|
state: state + 1
|
|
14152
14155
|
}));
|
|
14153
14156
|
}
|
|
14154
14157
|
function processNext2(state, choices) {
|
|
14155
|
-
return
|
|
14158
|
+
return succeed2$1(Action.NextFrame({
|
|
14156
14159
|
state: (state + 1) % choices.length
|
|
14157
14160
|
}));
|
|
14158
14161
|
}
|
|
14159
14162
|
function handleRender3(options3) {
|
|
14160
14163
|
return (state, action) => {
|
|
14161
14164
|
return Action.$match(action, {
|
|
14162
|
-
Beep: () =>
|
|
14165
|
+
Beep: () => succeed2$1(renderBeep4),
|
|
14163
14166
|
NextFrame: ({
|
|
14164
14167
|
state: state2
|
|
14165
14168
|
}) => renderNextFrame4(state2, options3),
|
|
@@ -14200,14 +14203,14 @@ function handleProcess3(options3) {
|
|
|
14200
14203
|
case "return": {
|
|
14201
14204
|
const selected = options3.choices[state];
|
|
14202
14205
|
if (selected.disabled) {
|
|
14203
|
-
return
|
|
14206
|
+
return succeed2$1(Action.Beep());
|
|
14204
14207
|
}
|
|
14205
|
-
return
|
|
14208
|
+
return succeed2$1(Action.Submit({
|
|
14206
14209
|
value: selected.value
|
|
14207
14210
|
}));
|
|
14208
14211
|
}
|
|
14209
14212
|
default: {
|
|
14210
|
-
return
|
|
14213
|
+
return succeed2$1(Action.Beep());
|
|
14211
14214
|
}
|
|
14212
14215
|
}
|
|
14213
14216
|
};
|
|
@@ -14360,13 +14363,13 @@ function renderSubmission5(state, options3) {
|
|
|
14360
14363
|
}
|
|
14361
14364
|
function processBackspace2(state) {
|
|
14362
14365
|
if (state.cursor <= 0) {
|
|
14363
|
-
return
|
|
14366
|
+
return succeed2$1(Action.Beep());
|
|
14364
14367
|
}
|
|
14365
14368
|
const beforeCursor = state.value.slice(0, state.cursor - 1);
|
|
14366
14369
|
const afterCursor = state.value.slice(state.cursor);
|
|
14367
14370
|
const cursor = state.cursor - 1;
|
|
14368
14371
|
const value2 = `${beforeCursor}${afterCursor}`;
|
|
14369
|
-
return
|
|
14372
|
+
return succeed2$1(Action.NextFrame({
|
|
14370
14373
|
state: {
|
|
14371
14374
|
...state,
|
|
14372
14375
|
cursor,
|
|
@@ -14377,10 +14380,10 @@ function processBackspace2(state) {
|
|
|
14377
14380
|
}
|
|
14378
14381
|
function processCursorLeft2(state) {
|
|
14379
14382
|
if (state.cursor <= 0) {
|
|
14380
|
-
return
|
|
14383
|
+
return succeed2$1(Action.Beep());
|
|
14381
14384
|
}
|
|
14382
14385
|
const cursor = state.cursor - 1;
|
|
14383
|
-
return
|
|
14386
|
+
return succeed2$1(Action.NextFrame({
|
|
14384
14387
|
state: {
|
|
14385
14388
|
...state,
|
|
14386
14389
|
cursor,
|
|
@@ -14390,10 +14393,10 @@ function processCursorLeft2(state) {
|
|
|
14390
14393
|
}
|
|
14391
14394
|
function processCursorRight2(state) {
|
|
14392
14395
|
if (state.cursor >= state.value.length) {
|
|
14393
|
-
return
|
|
14396
|
+
return succeed2$1(Action.Beep());
|
|
14394
14397
|
}
|
|
14395
14398
|
const cursor = Math.min(state.cursor + 1, state.value.length);
|
|
14396
|
-
return
|
|
14399
|
+
return succeed2$1(Action.NextFrame({
|
|
14397
14400
|
state: {
|
|
14398
14401
|
...state,
|
|
14399
14402
|
cursor,
|
|
@@ -14403,11 +14406,11 @@ function processCursorRight2(state) {
|
|
|
14403
14406
|
}
|
|
14404
14407
|
function processTab(state, options3) {
|
|
14405
14408
|
if (state.value === options3.default) {
|
|
14406
|
-
return
|
|
14409
|
+
return succeed2$1(Action.Beep());
|
|
14407
14410
|
}
|
|
14408
14411
|
const value2 = getValue(state, options3);
|
|
14409
14412
|
const cursor = value2.length;
|
|
14410
|
-
return
|
|
14413
|
+
return succeed2$1(Action.NextFrame({
|
|
14411
14414
|
state: {
|
|
14412
14415
|
...state,
|
|
14413
14416
|
value: value2,
|
|
@@ -14421,7 +14424,7 @@ function defaultProcessor2(input, state) {
|
|
|
14421
14424
|
const afterCursor = state.value.slice(state.cursor);
|
|
14422
14425
|
const value2 = `${beforeCursor}${input}${afterCursor}`;
|
|
14423
14426
|
const cursor = state.cursor + input.length;
|
|
14424
|
-
return
|
|
14427
|
+
return succeed2$1(Action.NextFrame({
|
|
14425
14428
|
state: {
|
|
14426
14429
|
...state,
|
|
14427
14430
|
cursor,
|
|
@@ -14438,7 +14441,7 @@ var initialState2 = {
|
|
|
14438
14441
|
function handleRender4(options3) {
|
|
14439
14442
|
return (state, action) => {
|
|
14440
14443
|
return Action.$match(action, {
|
|
14441
|
-
Beep: () =>
|
|
14444
|
+
Beep: () => succeed2$1(renderBeep5),
|
|
14442
14445
|
NextFrame: ({
|
|
14443
14446
|
state: state2
|
|
14444
14447
|
}) => renderNextFrame5(state2, options3),
|
|
@@ -14493,7 +14496,7 @@ function basePrompt(options3, type) {
|
|
|
14493
14496
|
const opts = {
|
|
14494
14497
|
default: "",
|
|
14495
14498
|
type,
|
|
14496
|
-
validate:
|
|
14499
|
+
validate: succeed2$1,
|
|
14497
14500
|
...options3
|
|
14498
14501
|
};
|
|
14499
14502
|
return custom(initialState2, {
|
|
@@ -14574,17 +14577,17 @@ function renderSubmission6(value2, options3) {
|
|
|
14574
14577
|
}));
|
|
14575
14578
|
});
|
|
14576
14579
|
}
|
|
14577
|
-
var activate = /* @__PURE__ */
|
|
14580
|
+
var activate = /* @__PURE__ */ succeed2$1(/* @__PURE__ */ Action.NextFrame({
|
|
14578
14581
|
state: true
|
|
14579
14582
|
}));
|
|
14580
|
-
var deactivate = /* @__PURE__ */
|
|
14583
|
+
var deactivate = /* @__PURE__ */ succeed2$1(/* @__PURE__ */ Action.NextFrame({
|
|
14581
14584
|
state: false
|
|
14582
14585
|
}));
|
|
14583
14586
|
function handleRender5(options3) {
|
|
14584
14587
|
return (state, action) => {
|
|
14585
14588
|
switch (action._tag) {
|
|
14586
14589
|
case "Beep": {
|
|
14587
|
-
return
|
|
14590
|
+
return succeed2$1(renderBeep6);
|
|
14588
14591
|
}
|
|
14589
14592
|
case "NextFrame": {
|
|
14590
14593
|
return renderNextFrame6(state, options3);
|
|
@@ -14616,12 +14619,12 @@ function handleProcess5(input, state) {
|
|
|
14616
14619
|
}
|
|
14617
14620
|
case "enter":
|
|
14618
14621
|
case "return": {
|
|
14619
|
-
return
|
|
14622
|
+
return succeed2$1(Action.Submit({
|
|
14620
14623
|
value: state
|
|
14621
14624
|
}));
|
|
14622
14625
|
}
|
|
14623
14626
|
default: {
|
|
14624
|
-
return
|
|
14627
|
+
return succeed2$1(Action.Beep());
|
|
14625
14628
|
}
|
|
14626
14629
|
}
|
|
14627
14630
|
}
|
|
@@ -14829,7 +14832,7 @@ var validateInternal = (self, value2, config) => {
|
|
|
14829
14832
|
case "Bool": {
|
|
14830
14833
|
return map(value2, (str) => normalizeCase(config, str)).pipe(match({
|
|
14831
14834
|
onNone: () => orElseFail(self.defaultValue, () => `Missing default value for boolean parameter`),
|
|
14832
|
-
onSome: (value3) => isTrueValue(value3) ?
|
|
14835
|
+
onSome: (value3) => isTrueValue(value3) ? succeed2$1(true) : isFalseValue(value3) ? succeed2$1(false) : fail3(`Unable to recognize '${value3}' as a valid boolean`)
|
|
14833
14836
|
}));
|
|
14834
14837
|
}
|
|
14835
14838
|
case "Choice": {
|
|
@@ -14858,10 +14861,10 @@ var validateInternal = (self, value2, config) => {
|
|
|
14858
14861
|
});
|
|
14859
14862
|
}
|
|
14860
14863
|
case "Redacted": {
|
|
14861
|
-
return attempt(value2, getTypeNameInternal(self), decodeUnknown(String$)).pipe(
|
|
14864
|
+
return attempt(value2, getTypeNameInternal(self), decodeUnknown(String$)).pipe(map4$1((value3) => make7$1(value3)));
|
|
14862
14865
|
}
|
|
14863
14866
|
case "Secret": {
|
|
14864
|
-
return attempt(value2, getTypeNameInternal(self), decodeUnknown(String$)).pipe(
|
|
14867
|
+
return attempt(value2, getTypeNameInternal(self), decodeUnknown(String$)).pipe(map4$1((value3) => fromString(value3)));
|
|
14865
14868
|
}
|
|
14866
14869
|
case "Text": {
|
|
14867
14870
|
return attempt(value2, getTypeNameInternal(self), decodeUnknown(String$));
|
|
@@ -14871,22 +14874,22 @@ var validateInternal = (self, value2, config) => {
|
|
|
14871
14874
|
var attempt = (option, typeName, parse8) => orElseFail(option, () => `${typeName} options do not have a default value`).pipe(flatMap3((value2) => orElseFail(parse8(value2), () => `'${value2}' is not a ${typeName}`)));
|
|
14872
14875
|
var validatePathExistence = (path2, shouldPathExist, pathExists) => {
|
|
14873
14876
|
if (shouldPathExist === "no" && pathExists) {
|
|
14874
|
-
return
|
|
14877
|
+
return fail3(`Path '${path2}' must not exist`);
|
|
14875
14878
|
}
|
|
14876
14879
|
if (shouldPathExist === "yes" && !pathExists) {
|
|
14877
|
-
return
|
|
14880
|
+
return fail3(`Path '${path2}' must exist`);
|
|
14878
14881
|
}
|
|
14879
14882
|
return _void;
|
|
14880
14883
|
};
|
|
14881
14884
|
var validatePathType = (path2, pathType, fileSystem) => {
|
|
14882
14885
|
switch (pathType) {
|
|
14883
14886
|
case "file": {
|
|
14884
|
-
const checkIsFile = fileSystem.stat(path2).pipe(
|
|
14885
|
-
return
|
|
14887
|
+
const checkIsFile = fileSystem.stat(path2).pipe(map4$1((info) => info.type === "File"), orDie);
|
|
14888
|
+
return fail3(`Expected path '${path2}' to be a regular file`).pipe(unlessEffect(checkIsFile), asVoid);
|
|
14886
14889
|
}
|
|
14887
14890
|
case "directory": {
|
|
14888
|
-
const checkIsDirectory = fileSystem.stat(path2).pipe(
|
|
14889
|
-
return
|
|
14891
|
+
const checkIsDirectory = fileSystem.stat(path2).pipe(map4$1((info) => info.type === "Directory"), orDie);
|
|
14892
|
+
return fail3(`Expected path '${path2}' to be a directory`).pipe(unlessEffect(checkIsDirectory), asVoid);
|
|
14890
14893
|
}
|
|
14891
14894
|
case "either": {
|
|
14892
14895
|
return _void;
|
|
@@ -15165,7 +15168,7 @@ var render3 = (self, config) => {
|
|
|
15165
15168
|
onNone: () => empty6,
|
|
15166
15169
|
onSome: (s) => concat(space3, text4(s))
|
|
15167
15170
|
}) : empty6;
|
|
15168
|
-
const namesToShow = config.showAllNames ? self.names : self.names.length > 1 ? pipe(
|
|
15171
|
+
const namesToShow = config.showAllNames ? self.names : self.names.length > 1 ? pipe(filter2(self.names, (name) => name.startsWith("--")), head, map(of), getOrElse(() => self.names)) : self.names;
|
|
15169
15172
|
const nameInfo = text4(join$1(namesToShow, ", "));
|
|
15170
15173
|
return config.showAllNames && self.names.length > 1 ? of(spans([text4("("), nameInfo, typeInfo, text4(")")])) : of(concat(nameInfo, typeInfo));
|
|
15171
15174
|
}
|
|
@@ -15305,7 +15308,7 @@ var none3 = /* @__PURE__ */ (() => {
|
|
|
15305
15308
|
})();
|
|
15306
15309
|
var getHelp3 = (self) => getHelpInternal2(self);
|
|
15307
15310
|
var getUsage = (self) => getUsageInternal(self);
|
|
15308
|
-
var map9 = /* @__PURE__ */ dual(2, (self, f) => mapEffect(self, (a) =>
|
|
15311
|
+
var map9 = /* @__PURE__ */ dual(2, (self, f) => mapEffect(self, (a) => succeed2$1(f(a))));
|
|
15309
15312
|
var mapEffect = /* @__PURE__ */ dual(2, (self, f) => makeMap(self, f));
|
|
15310
15313
|
var validate2 = /* @__PURE__ */ dual(3, (self, args, config) => validateInternal2(self, args, config));
|
|
15311
15314
|
var wizard2 = /* @__PURE__ */ dual(2, (self, config) => wizardInternal2(self, config));
|
|
@@ -15453,7 +15456,7 @@ var makeBoth = (left2, right2) => {
|
|
|
15453
15456
|
var validateInternal2 = (self, args, config) => {
|
|
15454
15457
|
switch (self._tag) {
|
|
15455
15458
|
case "Empty": {
|
|
15456
|
-
return
|
|
15459
|
+
return succeed2$1([args, void 0]);
|
|
15457
15460
|
}
|
|
15458
15461
|
case "Single": {
|
|
15459
15462
|
return suspend(() => {
|
|
@@ -15461,15 +15464,15 @@ var validateInternal2 = (self, args, config) => {
|
|
|
15461
15464
|
onEmpty: () => {
|
|
15462
15465
|
const choices = getChoices(self.primitiveType);
|
|
15463
15466
|
if (isSome(self.pseudoName) && isSome(choices)) {
|
|
15464
|
-
return
|
|
15467
|
+
return fail3(missingValue(p(`Missing argument <${self.pseudoName.value}> with choices ${choices.value}`)));
|
|
15465
15468
|
}
|
|
15466
15469
|
if (isSome(self.pseudoName)) {
|
|
15467
|
-
return
|
|
15470
|
+
return fail3(missingValue(p(`Missing argument <${self.pseudoName.value}>`)));
|
|
15468
15471
|
}
|
|
15469
15472
|
if (isSome(choices)) {
|
|
15470
|
-
return
|
|
15473
|
+
return fail3(missingValue(p(`Missing argument ${getTypeName(self.primitiveType)} with choices ${choices.value}`)));
|
|
15471
15474
|
}
|
|
15472
|
-
return
|
|
15475
|
+
return fail3(missingValue(p(`Missing argument ${getTypeName(self.primitiveType)}`)));
|
|
15473
15476
|
},
|
|
15474
15477
|
onNonEmpty: (head2, tail) => validate(self.primitiveType, some(head2), config).pipe(mapBoth({
|
|
15475
15478
|
onFailure: (text9) => invalidArgument(p(text9)),
|
|
@@ -15480,38 +15483,38 @@ var validateInternal2 = (self, args, config) => {
|
|
|
15480
15483
|
}
|
|
15481
15484
|
case "Map": {
|
|
15482
15485
|
return validateInternal2(self.args, args, config).pipe(flatMap3(([leftover, a]) => matchEffect(self.f(a), {
|
|
15483
|
-
onFailure: (doc) =>
|
|
15484
|
-
onSuccess: (b) =>
|
|
15486
|
+
onFailure: (doc) => fail3(invalidArgument(doc)),
|
|
15487
|
+
onSuccess: (b) => succeed2$1([leftover, b])
|
|
15485
15488
|
})));
|
|
15486
15489
|
}
|
|
15487
15490
|
case "Both": {
|
|
15488
|
-
return validateInternal2(self.left, args, config).pipe(flatMap3(([args2, a]) => validateInternal2(self.right, args2, config).pipe(
|
|
15491
|
+
return validateInternal2(self.left, args, config).pipe(flatMap3(([args2, a]) => validateInternal2(self.right, args2, config).pipe(map4$1(([args3, b]) => [args3, [a, b]]))));
|
|
15489
15492
|
}
|
|
15490
15493
|
case "Variadic": {
|
|
15491
15494
|
const min1 = getOrElse(self.min, () => 0);
|
|
15492
15495
|
const max1 = getOrElse(self.max, () => Number.MAX_SAFE_INTEGER);
|
|
15493
15496
|
const loop = (args2, acc) => {
|
|
15494
15497
|
if (acc.length >= max1) {
|
|
15495
|
-
return
|
|
15498
|
+
return succeed2$1([args2, acc]);
|
|
15496
15499
|
}
|
|
15497
15500
|
return validateInternal2(self.args, args2, config).pipe(matchEffect({
|
|
15498
|
-
onFailure: (failure) => acc.length >= min1 && isEmptyReadonlyArray(args2) ?
|
|
15501
|
+
onFailure: (failure) => acc.length >= min1 && isEmptyReadonlyArray(args2) ? succeed2$1([args2, acc]) : fail3(failure),
|
|
15499
15502
|
onSuccess: ([args3, a]) => loop(args3, append(acc, a))
|
|
15500
15503
|
}));
|
|
15501
15504
|
};
|
|
15502
|
-
return loop(args, empty()).pipe(
|
|
15505
|
+
return loop(args, empty()).pipe(map4$1(([args2, acc]) => [args2, acc]));
|
|
15503
15506
|
}
|
|
15504
15507
|
case "WithDefault": {
|
|
15505
|
-
return validateInternal2(self.args, args, config).pipe(catchTag("MissingValue", () =>
|
|
15508
|
+
return validateInternal2(self.args, args, config).pipe(catchTag("MissingValue", () => succeed2$1([args, self.fallback])));
|
|
15506
15509
|
}
|
|
15507
15510
|
case "WithFallbackConfig": {
|
|
15508
|
-
return validateInternal2(self.args, args, config).pipe(catchTag("MissingValue", (e) =>
|
|
15511
|
+
return validateInternal2(self.args, args, config).pipe(catchTag("MissingValue", (e) => map4$1(catchAll(self.config, (e2) => {
|
|
15509
15512
|
if (isMissingDataOnly(e2)) {
|
|
15510
15513
|
const help = p(String(e2));
|
|
15511
15514
|
const error3 = invalidValue(help);
|
|
15512
|
-
return
|
|
15515
|
+
return fail3(error3);
|
|
15513
15516
|
}
|
|
15514
|
-
return
|
|
15517
|
+
return fail3(e);
|
|
15515
15518
|
}), (value2) => [args, value2])));
|
|
15516
15519
|
}
|
|
15517
15520
|
}
|
|
@@ -15519,7 +15522,7 @@ var validateInternal2 = (self, args, config) => {
|
|
|
15519
15522
|
var wizardInternal2 = (self, config) => {
|
|
15520
15523
|
switch (self._tag) {
|
|
15521
15524
|
case "Empty": {
|
|
15522
|
-
return
|
|
15525
|
+
return succeed2$1(empty());
|
|
15523
15526
|
}
|
|
15524
15527
|
case "Single": {
|
|
15525
15528
|
const help = getHelpInternal2(self);
|
|
@@ -15541,7 +15544,7 @@ var wizardInternal2 = (self, config) => {
|
|
|
15541
15544
|
message: toAnsiText(message).trimEnd(),
|
|
15542
15545
|
min: getMinSizeInternal(self),
|
|
15543
15546
|
max: getMaxSizeInternal(self)
|
|
15544
|
-
}).pipe(zipLeft(log()), flatMap3((n) => n <= 0 ?
|
|
15547
|
+
}).pipe(zipLeft(log()), flatMap3((n) => n <= 0 ? succeed2$1(empty()) : make4(empty()).pipe(flatMap3((ref) => wizardInternal2(self.args, config).pipe(flatMap3((args) => update(ref, appendAll(args))), repeatN(n - 1), zipRight(get2(ref)), tap((args) => validateInternal2(self, args, config)))))));
|
|
15545
15548
|
}
|
|
15546
15549
|
case "WithDefault": {
|
|
15547
15550
|
const defaultHelp = p(`This argument is optional - use the default?`);
|
|
@@ -15555,7 +15558,7 @@ var wizardInternal2 = (self, config) => {
|
|
|
15555
15558
|
title: "Custom",
|
|
15556
15559
|
value: false
|
|
15557
15560
|
}]
|
|
15558
|
-
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ?
|
|
15561
|
+
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ? succeed2$1(empty()) : wizardInternal2(self.args, config)));
|
|
15559
15562
|
}
|
|
15560
15563
|
case "WithFallbackConfig": {
|
|
15561
15564
|
const defaultHelp = p(`Try load this option from the environment?`);
|
|
@@ -15569,7 +15572,7 @@ var wizardInternal2 = (self, config) => {
|
|
|
15569
15572
|
title: "Custom",
|
|
15570
15573
|
value: false
|
|
15571
15574
|
}]
|
|
15572
|
-
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ?
|
|
15575
|
+
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ? succeed2$1(empty()) : wizardInternal2(self.args, config)));
|
|
15573
15576
|
}
|
|
15574
15577
|
}
|
|
15575
15578
|
};
|
|
@@ -15812,9 +15815,9 @@ var orElse4 = /* @__PURE__ */ dual(2, (self, that) => orElseEither(self, that).p
|
|
|
15812
15815
|
var orElseEither = /* @__PURE__ */ dual(2, (self, that) => makeOrElse(self, that));
|
|
15813
15816
|
var parse5 = /* @__PURE__ */ dual(3, (self, args, config) => parseInternal(self, args, config));
|
|
15814
15817
|
var processCommandLine = /* @__PURE__ */ dual(3, (self, args, config) => matchOptions(args, toParseableInstruction(self), config).pipe(flatMap3(([error3, commandArgs, matchedOptions]) => parseInternal(self, matchedOptions, config).pipe(catchAll((e) => match(error3, {
|
|
15815
|
-
onNone: () =>
|
|
15816
|
-
onSome: (err) =>
|
|
15817
|
-
})),
|
|
15818
|
+
onNone: () => fail3(e),
|
|
15819
|
+
onSome: (err) => fail3(err)
|
|
15820
|
+
})), map4$1((a) => [error3, commandArgs, a])))));
|
|
15818
15821
|
var repeated2 = (self) => makeVariadic(self, none(), none());
|
|
15819
15822
|
var withAlias = /* @__PURE__ */ dual(2, (self, alias) => modifySingle(self, (single) => {
|
|
15820
15823
|
const aliases = append(single.aliases, alias);
|
|
@@ -16214,26 +16217,26 @@ var parseInternal = (self, args, config) => {
|
|
|
16214
16217
|
const value2 = headNonEmpty(head2);
|
|
16215
16218
|
return validate(self.primitiveType, some(value2), config).pipe(mapError((e) => invalidValue(p(e))));
|
|
16216
16219
|
}
|
|
16217
|
-
return
|
|
16220
|
+
return fail3(multipleValuesDetected(empty7, head2));
|
|
16218
16221
|
}
|
|
16219
16222
|
const error4 = p(`More than one reference to option '${self.fullName}' detected`);
|
|
16220
|
-
return
|
|
16223
|
+
return fail3(invalidValue(error4));
|
|
16221
16224
|
}
|
|
16222
16225
|
const error3 = p(`Expected to find option: '${self.fullName}'`);
|
|
16223
|
-
return
|
|
16226
|
+
return fail3(missingValue(error3));
|
|
16224
16227
|
}
|
|
16225
16228
|
case "KeyValueMap": {
|
|
16226
16229
|
const extractKeyValue = (value2) => {
|
|
16227
16230
|
const split = value2.trim().split(keyValueSplitter, 2);
|
|
16228
16231
|
if (isNonEmptyReadonlyArray(split) && split.length === 2 && split[1] !== "") {
|
|
16229
|
-
return
|
|
16232
|
+
return succeed2$1(split);
|
|
16230
16233
|
}
|
|
16231
16234
|
const error3 = p(`Expected a key/value pair but received '${value2}'`);
|
|
16232
|
-
return
|
|
16235
|
+
return fail3(invalidArgument(error3));
|
|
16233
16236
|
};
|
|
16234
16237
|
return parseInternal(self.argumentOption, args, config).pipe(matchEffect({
|
|
16235
|
-
onFailure: (e) => isMultipleValuesDetected(e) ? forEach(e.values, (kv) => extractKeyValue(kv)).pipe(
|
|
16236
|
-
onSuccess: (kv) => extractKeyValue(kv).pipe(
|
|
16238
|
+
onFailure: (e) => isMultipleValuesDetected(e) ? forEach(e.values, (kv) => extractKeyValue(kv)).pipe(map4$1(fromIterable3)) : fail3(e),
|
|
16239
|
+
onSuccess: (kv) => extractKeyValue(kv).pipe(map4$1(make3))
|
|
16237
16240
|
}));
|
|
16238
16241
|
}
|
|
16239
16242
|
case "Map": {
|
|
@@ -16243,9 +16246,9 @@ var parseInternal = (self, args, config) => {
|
|
|
16243
16246
|
return parseInternal(self.left, args, config).pipe(catchAll((err1) => parseInternal(self.right, args, config).pipe(matchEffect({
|
|
16244
16247
|
onFailure: (err2) => {
|
|
16245
16248
|
const error3 = sequence(err1.error, err2.error);
|
|
16246
|
-
return
|
|
16249
|
+
return fail3(missingValue(error3));
|
|
16247
16250
|
},
|
|
16248
|
-
onSuccess: () =>
|
|
16251
|
+
onSuccess: () => fail3(err1)
|
|
16249
16252
|
}))), zip(parseInternal(self.right, args, config)));
|
|
16250
16253
|
}
|
|
16251
16254
|
case "OrElse": {
|
|
@@ -16258,12 +16261,12 @@ var parseInternal = (self, args, config) => {
|
|
|
16258
16261
|
onSuccess: (b) => right(b)
|
|
16259
16262
|
})),
|
|
16260
16263
|
onSuccess: (a) => parseInternal(self.right, args, config).pipe(matchEffect({
|
|
16261
|
-
onFailure: () =>
|
|
16264
|
+
onFailure: () => succeed2$1(left(a)),
|
|
16262
16265
|
onSuccess: () => {
|
|
16263
16266
|
const leftUid = getOrElse(getIdentifierInternal(self.left), () => "???");
|
|
16264
16267
|
const rightUid = getOrElse(getIdentifierInternal(self.right), () => "???");
|
|
16265
16268
|
const error3 = p(`Collision between two options detected - you can only specify one of either: ['${leftUid}', '${rightUid}']`);
|
|
16266
|
-
return
|
|
16269
|
+
return fail3(invalidValue(error3));
|
|
16267
16270
|
}
|
|
16268
16271
|
}))
|
|
16269
16272
|
}));
|
|
@@ -16276,12 +16279,12 @@ var parseInternal = (self, args, config) => {
|
|
|
16276
16279
|
if (values.length < min2) {
|
|
16277
16280
|
const name = self.argumentOption.fullName;
|
|
16278
16281
|
const error3 = `Expected at least ${min2} value(s) for option: '${name}'`;
|
|
16279
|
-
return
|
|
16282
|
+
return fail3(invalidValue(p(error3)));
|
|
16280
16283
|
}
|
|
16281
16284
|
if (values.length > max2) {
|
|
16282
16285
|
const name = self.argumentOption.fullName;
|
|
16283
16286
|
const error3 = `Expected at most ${max2} value(s) for option: '${name}'`;
|
|
16284
|
-
return
|
|
16287
|
+
return fail3(invalidValue(p(error3)));
|
|
16285
16288
|
}
|
|
16286
16289
|
const primitive = self.argumentOption.primitiveType;
|
|
16287
16290
|
const validatePrimitive = (value2) => validate(primitive, some(value2), config).pipe(mapError((e) => invalidValue(p(e))));
|
|
@@ -16291,12 +16294,12 @@ var parseInternal = (self, args, config) => {
|
|
|
16291
16294
|
return validateMinMax(empty());
|
|
16292
16295
|
}
|
|
16293
16296
|
return parseInternal(self.argumentOption, args, config).pipe(matchEffect({
|
|
16294
|
-
onFailure: (error3) => isMultipleValuesDetected(error3) ? validateMinMax(error3.values) :
|
|
16297
|
+
onFailure: (error3) => isMultipleValuesDetected(error3) ? validateMinMax(error3.values) : fail3(error3),
|
|
16295
16298
|
onSuccess: (value2) => validateMinMax(of(value2))
|
|
16296
16299
|
}));
|
|
16297
16300
|
}
|
|
16298
16301
|
case "WithDefault": {
|
|
16299
|
-
return parseInternal(self.options, args, config).pipe(catchTag("MissingValue", () =>
|
|
16302
|
+
return parseInternal(self.options, args, config).pipe(catchTag("MissingValue", () => succeed2$1(self.fallback)));
|
|
16300
16303
|
}
|
|
16301
16304
|
case "WithFallback": {
|
|
16302
16305
|
return parseInternal(self.options, args, config).pipe(catchTag("MissingValue", (e) => self.effect.pipe(catchAll((e2) => {
|
|
@@ -16306,9 +16309,9 @@ var parseInternal = (self, args, config) => {
|
|
|
16306
16309
|
if (isConfigError(e2) && !isMissingDataOnly(e2)) {
|
|
16307
16310
|
const help = p(String(e2));
|
|
16308
16311
|
const error3 = invalidValue(help);
|
|
16309
|
-
return
|
|
16312
|
+
return fail3(error3);
|
|
16310
16313
|
}
|
|
16311
|
-
return
|
|
16314
|
+
return fail3(e);
|
|
16312
16315
|
}))));
|
|
16313
16316
|
}
|
|
16314
16317
|
}
|
|
@@ -16316,7 +16319,7 @@ var parseInternal = (self, args, config) => {
|
|
|
16316
16319
|
var wizardInternal3 = (self, config) => {
|
|
16317
16320
|
switch (self._tag) {
|
|
16318
16321
|
case "Empty": {
|
|
16319
|
-
return
|
|
16322
|
+
return succeed2$1(empty());
|
|
16320
16323
|
}
|
|
16321
16324
|
case "Single": {
|
|
16322
16325
|
const help = getHelpInternal3(self);
|
|
@@ -16361,7 +16364,7 @@ var wizardInternal3 = (self, config) => {
|
|
|
16361
16364
|
message: toAnsiText(message).trimEnd(),
|
|
16362
16365
|
min: getMinSizeInternal2(self),
|
|
16363
16366
|
max: getMaxSizeInternal2(self)
|
|
16364
|
-
}).pipe(flatMap3((n) => n <= 0 ?
|
|
16367
|
+
}).pipe(flatMap3((n) => n <= 0 ? succeed2$1(empty()) : make4(empty()).pipe(flatMap3((ref) => wizardInternal3(self.argumentOption, config).pipe(flatMap3((args) => update(ref, appendAll(args))), repeatN(n - 1), zipRight(get2(ref)))))));
|
|
16365
16368
|
}
|
|
16366
16369
|
case "WithDefault": {
|
|
16367
16370
|
if (isBoolInternal(self.options)) {
|
|
@@ -16383,7 +16386,7 @@ var wizardInternal3 = (self, config) => {
|
|
|
16383
16386
|
value: false,
|
|
16384
16387
|
description: "use a custom value"
|
|
16385
16388
|
}]
|
|
16386
|
-
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ?
|
|
16389
|
+
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ? succeed2$1(empty()) : wizardInternal3(self.options, config)));
|
|
16387
16390
|
}
|
|
16388
16391
|
case "WithFallback": {
|
|
16389
16392
|
if (isBoolInternal(self.options)) {
|
|
@@ -16403,7 +16406,7 @@ var wizardInternal3 = (self, config) => {
|
|
|
16403
16406
|
title: "Custom",
|
|
16404
16407
|
value: false
|
|
16405
16408
|
}]
|
|
16406
|
-
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ?
|
|
16409
|
+
}).pipe(zipLeft(log()), flatMap3((useFallback) => useFallback ? succeed2$1(empty()) : wizardInternal3(self.options, config)));
|
|
16407
16410
|
}
|
|
16408
16411
|
}
|
|
16409
16412
|
};
|
|
@@ -16411,47 +16414,47 @@ var matchOptions = (input, options3, config) => {
|
|
|
16411
16414
|
if (isNonEmptyReadonlyArray(options3)) {
|
|
16412
16415
|
return findOptions(input, options3, config).pipe(flatMap3(([otherArgs, otherOptions, map1]) => {
|
|
16413
16416
|
if (isEmpty(map1)) {
|
|
16414
|
-
return
|
|
16417
|
+
return succeed2$1([none(), input, map1]);
|
|
16415
16418
|
}
|
|
16416
|
-
return matchOptions(otherArgs, otherOptions, config).pipe(
|
|
16417
|
-
}), catchAll((e) =>
|
|
16419
|
+
return matchOptions(otherArgs, otherOptions, config).pipe(map4$1(([error3, otherArgs2, map22]) => [error3, otherArgs2, merge2(map1, fromIterable(map22))]));
|
|
16420
|
+
}), catchAll((e) => succeed2$1([some(e), input, empty2()])));
|
|
16418
16421
|
}
|
|
16419
|
-
return isEmptyReadonlyArray(input) ?
|
|
16422
|
+
return isEmptyReadonlyArray(input) ? succeed2$1([none(), empty(), empty2()]) : succeed2$1([none(), input, empty2()]);
|
|
16420
16423
|
};
|
|
16421
16424
|
var findOptions = (input, options3, config) => matchLeft(options3, {
|
|
16422
|
-
onEmpty: () =>
|
|
16425
|
+
onEmpty: () => succeed2$1([input, empty(), empty2()]),
|
|
16423
16426
|
onNonEmpty: (head2, tail) => parseCommandLine(head2, input, config).pipe(flatMap3(({
|
|
16424
16427
|
leftover,
|
|
16425
16428
|
parsed
|
|
16426
16429
|
}) => match(parsed, {
|
|
16427
|
-
onNone: () => findOptions(leftover, tail, config).pipe(
|
|
16430
|
+
onNone: () => findOptions(leftover, tail, config).pipe(map4$1(([nextArgs, nextOptions, map13]) => [nextArgs, prepend(nextOptions, head2), map13])),
|
|
16428
16431
|
onSome: ({
|
|
16429
16432
|
name,
|
|
16430
16433
|
values
|
|
16431
|
-
}) =>
|
|
16434
|
+
}) => succeed2$1([leftover, tail, make3([name, values])])
|
|
16432
16435
|
})), catchTags({
|
|
16433
|
-
CorrectedFlag: (e) => findOptions(input, tail, config).pipe(catchSome(() => some(
|
|
16434
|
-
MissingFlag: () => findOptions(input, tail, config).pipe(
|
|
16435
|
-
UnclusteredFlag: (e) => matchUnclustered(e.unclustered, e.rest, options3, config).pipe(catchAll(() =>
|
|
16436
|
+
CorrectedFlag: (e) => findOptions(input, tail, config).pipe(catchSome(() => some(fail3(e))), flatMap3(([otherArgs, otherOptions, map13]) => fail3(e).pipe(when(() => isEmpty(map13)), as([otherArgs, prepend(otherOptions, head2), map13])))),
|
|
16437
|
+
MissingFlag: () => findOptions(input, tail, config).pipe(map4$1(([otherArgs, otherOptions, map13]) => [otherArgs, prepend(otherOptions, head2), map13])),
|
|
16438
|
+
UnclusteredFlag: (e) => matchUnclustered(e.unclustered, e.rest, options3, config).pipe(catchAll(() => fail3(e)))
|
|
16436
16439
|
}))
|
|
16437
16440
|
});
|
|
16438
16441
|
var CLUSTERED_REGEX = /^-{1}([^-]{2,}$)/;
|
|
16439
16442
|
var FLAG_REGEX = /^(--[^=]+)(?:=(.+))?$/;
|
|
16440
16443
|
var processArgs = (args) => matchLeft(args, {
|
|
16441
|
-
onEmpty: () =>
|
|
16444
|
+
onEmpty: () => succeed2$1(empty()),
|
|
16442
16445
|
onNonEmpty: (head2, tail) => {
|
|
16443
16446
|
const value2 = head2.trim();
|
|
16444
16447
|
if (CLUSTERED_REGEX.test(value2)) {
|
|
16445
16448
|
const unclustered = value2.substring(1).split("").map((c) => `-${c}`);
|
|
16446
|
-
return
|
|
16449
|
+
return fail3(unclusteredFlag(empty7, unclustered, tail));
|
|
16447
16450
|
}
|
|
16448
16451
|
if (FLAG_REGEX.test(value2)) {
|
|
16449
16452
|
const result = FLAG_REGEX.exec(value2);
|
|
16450
16453
|
if (result !== null && result[2] !== void 0) {
|
|
16451
|
-
return
|
|
16454
|
+
return succeed2$1(appendAll([result[1], result[2]], tail));
|
|
16452
16455
|
}
|
|
16453
16456
|
}
|
|
16454
|
-
return
|
|
16457
|
+
return succeed2$1(args);
|
|
16455
16458
|
}
|
|
16456
16459
|
});
|
|
16457
16460
|
var parseCommandLine = (self, args, config) => {
|
|
@@ -16460,7 +16463,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16460
16463
|
return processArgs(args).pipe(flatMap3((args2) => matchLeft(args2, {
|
|
16461
16464
|
onEmpty: () => {
|
|
16462
16465
|
const error3 = p(`Expected to find option: '${self.fullName}'`);
|
|
16463
|
-
return
|
|
16466
|
+
return fail3(missingFlag(error3));
|
|
16464
16467
|
},
|
|
16465
16468
|
onNonEmpty: (head2, tail) => {
|
|
16466
16469
|
const normalize = (value2) => normalizeCase(config, value2);
|
|
@@ -16474,7 +16477,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16474
16477
|
name: head2,
|
|
16475
16478
|
values: empty()
|
|
16476
16479
|
});
|
|
16477
|
-
return
|
|
16480
|
+
return succeed2$1({
|
|
16478
16481
|
parsed: parsed2,
|
|
16479
16482
|
leftover: tail
|
|
16480
16483
|
});
|
|
@@ -16485,7 +16488,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16485
16488
|
name: head2,
|
|
16486
16489
|
values: of("true")
|
|
16487
16490
|
});
|
|
16488
|
-
return
|
|
16491
|
+
return succeed2$1({
|
|
16489
16492
|
parsed: parsed3,
|
|
16490
16493
|
leftover: leftover2
|
|
16491
16494
|
});
|
|
@@ -16495,7 +16498,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16495
16498
|
name: head2,
|
|
16496
16499
|
values: of("false")
|
|
16497
16500
|
});
|
|
16498
|
-
return
|
|
16501
|
+
return succeed2$1({
|
|
16499
16502
|
parsed: parsed3,
|
|
16500
16503
|
leftover: leftover2
|
|
16501
16504
|
});
|
|
@@ -16504,7 +16507,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16504
16507
|
name: head2,
|
|
16505
16508
|
values: empty()
|
|
16506
16509
|
});
|
|
16507
|
-
return
|
|
16510
|
+
return succeed2$1({
|
|
16508
16511
|
parsed: parsed2,
|
|
16509
16512
|
leftover: tail
|
|
16510
16513
|
});
|
|
@@ -16514,14 +16517,14 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16514
16517
|
return matchLeft(tail, {
|
|
16515
16518
|
onEmpty: () => {
|
|
16516
16519
|
const error3 = p(`Expected a value following option: '${self.fullName}'`);
|
|
16517
|
-
return
|
|
16520
|
+
return fail3(missingValue(error3));
|
|
16518
16521
|
},
|
|
16519
16522
|
onNonEmpty: (value2, leftover2) => {
|
|
16520
16523
|
const parsed2 = some({
|
|
16521
16524
|
name: head2,
|
|
16522
16525
|
values: of(value2)
|
|
16523
16526
|
});
|
|
16524
|
-
return
|
|
16527
|
+
return succeed2$1({
|
|
16525
16528
|
parsed: parsed2,
|
|
16526
16529
|
leftover: leftover2
|
|
16527
16530
|
});
|
|
@@ -16531,10 +16534,10 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16531
16534
|
if (head2.startsWith("-")) {
|
|
16532
16535
|
if (self.name.length > config.autoCorrectLimit + 1 && levensteinDistance(head2, self.fullName, config) <= config.autoCorrectLimit) {
|
|
16533
16536
|
const error4 = p(`The flag '${head2}' is not recognized. Did you mean '${self.fullName}'?`);
|
|
16534
|
-
return
|
|
16537
|
+
return fail3(correctedFlag(error4));
|
|
16535
16538
|
}
|
|
16536
16539
|
const error3 = p(`Expected to find option: '${self.fullName}'`);
|
|
16537
|
-
return
|
|
16540
|
+
return fail3(missingFlag(error3));
|
|
16538
16541
|
}
|
|
16539
16542
|
let optionIndex = -1;
|
|
16540
16543
|
let equalsValue = void 0;
|
|
@@ -16557,7 +16560,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16557
16560
|
}
|
|
16558
16561
|
if (optionIndex === -1) {
|
|
16559
16562
|
const error3 = p(`Expected to find option: '${self.fullName}'`);
|
|
16560
|
-
return
|
|
16563
|
+
return fail3(missingFlag(error3));
|
|
16561
16564
|
}
|
|
16562
16565
|
const rawArg = tail[optionIndex];
|
|
16563
16566
|
const optionName = equalsValue !== void 0 ? FLAG_REGEX.exec(rawArg)[1] : rawArg;
|
|
@@ -16571,7 +16574,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16571
16574
|
values: of("true")
|
|
16572
16575
|
});
|
|
16573
16576
|
const leftover3 = appendAll(beforeOption, afterOption);
|
|
16574
|
-
return
|
|
16577
|
+
return succeed2$1({
|
|
16575
16578
|
parsed: parsed3,
|
|
16576
16579
|
leftover: leftover3
|
|
16577
16580
|
});
|
|
@@ -16582,7 +16585,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16582
16585
|
values: of("false")
|
|
16583
16586
|
});
|
|
16584
16587
|
const leftover3 = appendAll(beforeOption, afterOption);
|
|
16585
|
-
return
|
|
16588
|
+
return succeed2$1({
|
|
16586
16589
|
parsed: parsed3,
|
|
16587
16590
|
leftover: leftover3
|
|
16588
16591
|
});
|
|
@@ -16596,7 +16599,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16596
16599
|
values: of("true")
|
|
16597
16600
|
});
|
|
16598
16601
|
const leftover3 = appendAll(beforeOption, afterOption.slice(1));
|
|
16599
|
-
return
|
|
16602
|
+
return succeed2$1({
|
|
16600
16603
|
parsed: parsed3,
|
|
16601
16604
|
leftover: leftover3
|
|
16602
16605
|
});
|
|
@@ -16607,7 +16610,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16607
16610
|
values: of("false")
|
|
16608
16611
|
});
|
|
16609
16612
|
const leftover3 = appendAll(beforeOption, afterOption.slice(1));
|
|
16610
|
-
return
|
|
16613
|
+
return succeed2$1({
|
|
16611
16614
|
parsed: parsed3,
|
|
16612
16615
|
leftover: leftover3
|
|
16613
16616
|
});
|
|
@@ -16618,7 +16621,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16618
16621
|
values: empty()
|
|
16619
16622
|
});
|
|
16620
16623
|
const leftover2 = appendAll(beforeOption, afterOption);
|
|
16621
|
-
return
|
|
16624
|
+
return succeed2$1({
|
|
16622
16625
|
parsed: parsed2,
|
|
16623
16626
|
leftover: leftover2
|
|
16624
16627
|
});
|
|
@@ -16629,14 +16632,14 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16629
16632
|
values: of(equalsValue)
|
|
16630
16633
|
});
|
|
16631
16634
|
const leftover2 = appendAll(beforeOption, afterOption);
|
|
16632
|
-
return
|
|
16635
|
+
return succeed2$1({
|
|
16633
16636
|
parsed: parsed2,
|
|
16634
16637
|
leftover: leftover2
|
|
16635
16638
|
});
|
|
16636
16639
|
}
|
|
16637
16640
|
if (afterOption.length === 0) {
|
|
16638
16641
|
const error3 = p(`Expected a value following option: '${self.fullName}'`);
|
|
16639
|
-
return
|
|
16642
|
+
return fail3(missingValue(error3));
|
|
16640
16643
|
}
|
|
16641
16644
|
const optionValue = afterOption[0];
|
|
16642
16645
|
const parsed = some({
|
|
@@ -16644,7 +16647,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16644
16647
|
values: of(optionValue)
|
|
16645
16648
|
});
|
|
16646
16649
|
const leftover = appendAll(beforeOption, afterOption.slice(1));
|
|
16647
|
-
return
|
|
16650
|
+
return succeed2$1({
|
|
16648
16651
|
parsed,
|
|
16649
16652
|
leftover
|
|
16650
16653
|
});
|
|
@@ -16654,7 +16657,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16654
16657
|
case "KeyValueMap": {
|
|
16655
16658
|
const normalizedNames = map2(getNames(self.argumentOption), (name) => normalizeCase(config, name));
|
|
16656
16659
|
return matchLeft(args, {
|
|
16657
|
-
onEmpty: () =>
|
|
16660
|
+
onEmpty: () => succeed2$1({
|
|
16658
16661
|
parsed: none(),
|
|
16659
16662
|
leftover: args
|
|
16660
16663
|
}),
|
|
@@ -16689,7 +16692,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16689
16692
|
const normalizedName = normalizeCase(config, head2);
|
|
16690
16693
|
if (contains(normalizedNames, normalizedName)) {
|
|
16691
16694
|
const [values2, leftover2] = loop(tail);
|
|
16692
|
-
return
|
|
16695
|
+
return succeed2$1({
|
|
16693
16696
|
parsed: some({
|
|
16694
16697
|
name: head2,
|
|
16695
16698
|
values: values2
|
|
@@ -16698,7 +16701,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16698
16701
|
});
|
|
16699
16702
|
}
|
|
16700
16703
|
if (head2.startsWith("-")) {
|
|
16701
|
-
return
|
|
16704
|
+
return succeed2$1({
|
|
16702
16705
|
parsed: none(),
|
|
16703
16706
|
leftover: args
|
|
16704
16707
|
});
|
|
@@ -16713,7 +16716,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16713
16716
|
}
|
|
16714
16717
|
}
|
|
16715
16718
|
if (optionIndex === -1) {
|
|
16716
|
-
return
|
|
16719
|
+
return succeed2$1({
|
|
16717
16720
|
parsed: none(),
|
|
16718
16721
|
leftover: args
|
|
16719
16722
|
});
|
|
@@ -16723,7 +16726,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16723
16726
|
const afterOption = tail.slice(optionIndex + 1);
|
|
16724
16727
|
const [values, remaining] = loop(afterOption);
|
|
16725
16728
|
const leftover = appendAll(beforeOption, remaining);
|
|
16726
|
-
return
|
|
16729
|
+
return succeed2$1({
|
|
16727
16730
|
parsed: some({
|
|
16728
16731
|
name: optionName,
|
|
16729
16732
|
values
|
|
@@ -16760,7 +16763,7 @@ var parseCommandLine = (self, args, config) => {
|
|
|
16760
16763
|
name,
|
|
16761
16764
|
values
|
|
16762
16765
|
})));
|
|
16763
|
-
return
|
|
16766
|
+
return succeed2$1({
|
|
16764
16767
|
parsed,
|
|
16765
16768
|
leftover
|
|
16766
16769
|
});
|
|
@@ -16773,12 +16776,12 @@ var matchUnclustered = (input, tail, options3, config) => {
|
|
|
16773
16776
|
const otherFlags = tailNonEmpty(input);
|
|
16774
16777
|
return findOptions(of(flag), options3, config).pipe(flatMap3(([_, opts1, map1]) => {
|
|
16775
16778
|
if (isEmpty(map1)) {
|
|
16776
|
-
return
|
|
16779
|
+
return fail3(unclusteredFlag(empty7, empty(), tail));
|
|
16777
16780
|
}
|
|
16778
|
-
return matchUnclustered(otherFlags, tail, opts1, config).pipe(
|
|
16781
|
+
return matchUnclustered(otherFlags, tail, opts1, config).pipe(map4$1(([_2, opts2, map22]) => [tail, opts2, merge2(map1, fromIterable(map22))]));
|
|
16779
16782
|
}));
|
|
16780
16783
|
}
|
|
16781
|
-
return
|
|
16784
|
+
return succeed2$1([tail, options3, empty2()]);
|
|
16782
16785
|
};
|
|
16783
16786
|
var merge2 = (map1, map22) => {
|
|
16784
16787
|
if (isNonEmptyReadonlyArray(map22)) {
|
|
@@ -17247,14 +17250,14 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17247
17250
|
const parseCommandLine2 = (self2, args2) => matchLeft(args2, {
|
|
17248
17251
|
onEmpty: () => {
|
|
17249
17252
|
const error3 = p(`Missing command name: '${self2.name}'`);
|
|
17250
|
-
return
|
|
17253
|
+
return fail3(commandMismatch(error3));
|
|
17251
17254
|
},
|
|
17252
17255
|
onNonEmpty: (head2, tail) => {
|
|
17253
17256
|
const normalizedArgv0 = normalizeCase(config, head2);
|
|
17254
17257
|
const normalizedCommandName = normalizeCase(config, self2.name);
|
|
17255
|
-
return
|
|
17258
|
+
return succeed2$1(tail).pipe(when(() => normalizedArgv0 === normalizedCommandName), flatten, catchTag("NoSuchElementException", () => {
|
|
17256
17259
|
const error3 = p(`Missing command name: '${self2.name}'`);
|
|
17257
|
-
return
|
|
17260
|
+
return fail3(commandMismatch(error3));
|
|
17258
17261
|
}));
|
|
17259
17262
|
}
|
|
17260
17263
|
});
|
|
@@ -17263,7 +17266,7 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17263
17266
|
const parseBuiltInArgs = (args2) => matchLeft(args2, {
|
|
17264
17267
|
onEmpty: () => {
|
|
17265
17268
|
const error3 = p(`Missing command name: '${self.name}'`);
|
|
17266
|
-
return
|
|
17269
|
+
return fail3(commandMismatch(error3));
|
|
17267
17270
|
},
|
|
17268
17271
|
onNonEmpty: (argv0) => {
|
|
17269
17272
|
const normalizedArgv0 = normalizeCase(config, argv0);
|
|
@@ -17275,19 +17278,19 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17275
17278
|
const argsWithoutCommand = drop(args2, 1);
|
|
17276
17279
|
return processCommandLine(options3, argsWithoutCommand, config).pipe(flatMap3((tuple3) => tuple3[2]), catchTag("NoSuchElementException", () => {
|
|
17277
17280
|
const error4 = p("No built-in option was matched");
|
|
17278
|
-
return
|
|
17279
|
-
}),
|
|
17281
|
+
return fail3(noBuiltInMatch(error4));
|
|
17282
|
+
}), map4$1(builtIn));
|
|
17280
17283
|
}
|
|
17281
17284
|
const error3 = p(`Missing command name: '${self.name}'`);
|
|
17282
|
-
return
|
|
17285
|
+
return fail3(commandMismatch(error3));
|
|
17283
17286
|
}
|
|
17284
17287
|
});
|
|
17285
17288
|
const parseUserDefinedArgs = (args2) => parseCommandLine2(self, args2).pipe(flatMap3((commandOptionsAndArgs) => {
|
|
17286
17289
|
const [optionsAndArgs, forcedCommandArgs] = splitForcedArgs(commandOptionsAndArgs);
|
|
17287
17290
|
return processCommandLine(self.options, optionsAndArgs, config).pipe(flatMap3(([error3, commandArgs, optionsType]) => validate2(self.args, appendAll(commandArgs, forcedCommandArgs), config).pipe(catchAll((e) => match(error3, {
|
|
17288
|
-
onNone: () =>
|
|
17289
|
-
onSome: (err) =>
|
|
17290
|
-
})),
|
|
17291
|
+
onNone: () => fail3(e),
|
|
17292
|
+
onSome: (err) => fail3(err)
|
|
17293
|
+
})), map4$1(([argsLeftover, argsType]) => userDefined(argsLeftover, {
|
|
17291
17294
|
name: self.name,
|
|
17292
17295
|
options: optionsType,
|
|
17293
17296
|
args: argsType
|
|
@@ -17304,20 +17307,20 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17304
17307
|
return parseBuiltInArgs(make(self.name, "--version"));
|
|
17305
17308
|
}
|
|
17306
17309
|
const error3 = p(`Missing command name: '${self.name}'`);
|
|
17307
|
-
return
|
|
17310
|
+
return fail3(commandMismatch(error3));
|
|
17308
17311
|
};
|
|
17309
17312
|
return parseBuiltInArgs(args).pipe(orElse2(() => parseUserDefinedArgs(args)), catchSome((e) => {
|
|
17310
17313
|
if (isValidationError(e)) {
|
|
17311
17314
|
if (config.finalCheckBuiltIn) {
|
|
17312
|
-
return some(exhaustiveSearch(args).pipe(catchSome((_) => isValidationError(_) ? some(
|
|
17315
|
+
return some(exhaustiveSearch(args).pipe(catchSome((_) => isValidationError(_) ? some(fail3(e)) : none())));
|
|
17313
17316
|
}
|
|
17314
|
-
return some(
|
|
17317
|
+
return some(fail3(e));
|
|
17315
17318
|
}
|
|
17316
17319
|
return none();
|
|
17317
17320
|
}));
|
|
17318
17321
|
}
|
|
17319
17322
|
case "GetUserInput": {
|
|
17320
|
-
return parseCommandLine2(self, args).pipe(zipRight(run(self.prompt)), catchTag("QuitException", (e) => die(e)),
|
|
17323
|
+
return parseCommandLine2(self, args).pipe(zipRight(run(self.prompt)), catchTag("QuitException", (e) => die(e)), map4$1((value2) => userDefined(drop(args, 1), {
|
|
17321
17324
|
name: self.name,
|
|
17322
17325
|
value: value2
|
|
17323
17326
|
})));
|
|
@@ -17325,9 +17328,9 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17325
17328
|
case "Map": {
|
|
17326
17329
|
return parseInternal2(self.command, args, config).pipe(flatMap3((directive) => {
|
|
17327
17330
|
if (isUserDefined(directive)) {
|
|
17328
|
-
return self.f(directive.value).pipe(
|
|
17331
|
+
return self.f(directive.value).pipe(map4$1((value2) => userDefined(directive.leftover, value2)));
|
|
17329
17332
|
}
|
|
17330
|
-
return
|
|
17333
|
+
return succeed2$1(directive);
|
|
17331
17334
|
}));
|
|
17332
17335
|
}
|
|
17333
17336
|
case "Subcommands": {
|
|
@@ -17339,7 +17342,7 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17339
17342
|
const loop = (next) => {
|
|
17340
17343
|
return parseInternal2(next, argsForChildren, config).pipe(catchIf(isCommandMismatch, (e) => {
|
|
17341
17344
|
const next2 = iterator.next();
|
|
17342
|
-
return next2.done ?
|
|
17345
|
+
return next2.done ? fail3(e) : loop(next2.value);
|
|
17343
17346
|
}));
|
|
17344
17347
|
};
|
|
17345
17348
|
return loop(iterator.next().value);
|
|
@@ -17352,16 +17355,16 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17352
17355
|
if (isBuiltIn(directive) && isShowHelp(directive.option)) {
|
|
17353
17356
|
const parentName = getOrElse(head(names), () => "");
|
|
17354
17357
|
const newDirective = builtIn(showHelp(concat2(named(of(parentName), none()), directive.option.usage), directive.option.helpDoc));
|
|
17355
|
-
return
|
|
17358
|
+
return succeed2$1(newDirective);
|
|
17356
17359
|
}
|
|
17357
|
-
return
|
|
17360
|
+
return fail3(invalidArgument(empty7));
|
|
17358
17361
|
}));
|
|
17359
17362
|
const wizardDirectiveForParent = sync(() => builtIn(showWizard(self)));
|
|
17360
17363
|
const wizardDirectiveForChild = parseChildren.pipe(flatMap3((directive) => {
|
|
17361
17364
|
if (isBuiltIn(directive) && isShowWizard(directive.option)) {
|
|
17362
|
-
return
|
|
17365
|
+
return succeed2$1(directive);
|
|
17363
17366
|
}
|
|
17364
|
-
return
|
|
17367
|
+
return fail3(invalidArgument(empty7));
|
|
17365
17368
|
}));
|
|
17366
17369
|
return suspend(() => parseInternal2(self.parent, parentArgs, config).pipe(flatMap3((directive) => {
|
|
17367
17370
|
switch (directive._tag) {
|
|
@@ -17372,18 +17375,18 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17372
17375
|
if (isShowWizard(directive.option)) {
|
|
17373
17376
|
return orElse2(wizardDirectiveForChild, () => wizardDirectiveForParent);
|
|
17374
17377
|
}
|
|
17375
|
-
return
|
|
17378
|
+
return succeed2$1(directive);
|
|
17376
17379
|
}
|
|
17377
17380
|
case "UserDefined": {
|
|
17378
17381
|
const args2 = appendAll(directive.leftover, childArgs);
|
|
17379
17382
|
if (isNonEmptyReadonlyArray(args2)) {
|
|
17380
17383
|
return parseChildrenWith(args2).pipe(flatMap3((childDirective) => {
|
|
17381
17384
|
if (!isUserDefined(childDirective)) {
|
|
17382
|
-
return
|
|
17385
|
+
return succeed2$1(childDirective);
|
|
17383
17386
|
}
|
|
17384
17387
|
const childLeftover = childDirective.leftover;
|
|
17385
17388
|
if (isEmptyReadonlyArray(childLeftover)) {
|
|
17386
|
-
return
|
|
17389
|
+
return succeed2$1(userDefined(childLeftover, {
|
|
17387
17390
|
...directive.value,
|
|
17388
17391
|
subcommand: some(childDirective.value)
|
|
17389
17392
|
}));
|
|
@@ -17391,16 +17394,16 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17391
17394
|
const parentArgsWithLeftover = appendAll(parentArgs, childLeftover);
|
|
17392
17395
|
return parseInternal2(self.parent, parentArgsWithLeftover, config).pipe(flatMap3((reParsedParentDirective) => {
|
|
17393
17396
|
if (!isUserDefined(reParsedParentDirective)) {
|
|
17394
|
-
return
|
|
17397
|
+
return succeed2$1(userDefined(childLeftover, {
|
|
17395
17398
|
...directive.value,
|
|
17396
17399
|
subcommand: some(childDirective.value)
|
|
17397
17400
|
}));
|
|
17398
17401
|
}
|
|
17399
|
-
return
|
|
17402
|
+
return succeed2$1(userDefined(reParsedParentDirective.leftover, {
|
|
17400
17403
|
...reParsedParentDirective.value,
|
|
17401
17404
|
subcommand: some(childDirective.value)
|
|
17402
17405
|
}));
|
|
17403
|
-
}), catchAll(() =>
|
|
17406
|
+
}), catchAll(() => succeed2$1(userDefined(childLeftover, {
|
|
17404
17407
|
...directive.value,
|
|
17405
17408
|
subcommand: some(childDirective.value)
|
|
17406
17409
|
}))));
|
|
@@ -17410,12 +17413,12 @@ var parseInternal2 = (self, args, config) => {
|
|
|
17410
17413
|
const childNames = map2(subcommands, ([name]) => `'${name}'`);
|
|
17411
17414
|
const oneOf = childNames.length === 1 ? "" : " one of";
|
|
17412
17415
|
const error3 = p(`Invalid subcommand for ${parentName} - use${oneOf} ${join$1(childNames, ", ")}`);
|
|
17413
|
-
return
|
|
17416
|
+
return fail3(commandMismatch(error3));
|
|
17414
17417
|
}
|
|
17415
|
-
return
|
|
17418
|
+
return fail3(err);
|
|
17416
17419
|
}));
|
|
17417
17420
|
}
|
|
17418
|
-
return
|
|
17421
|
+
return succeed2$1(userDefined(directive.leftover, {
|
|
17419
17422
|
...directive.value,
|
|
17420
17423
|
subcommand: none()
|
|
17421
17424
|
}));
|
|
@@ -17584,8 +17587,8 @@ var getBashCompletionsInternal = (self, executable) => traverseCommand(self, emp
|
|
|
17584
17587
|
const funcLines = isEmptyReadonlyArray(info.parentCommands) ? empty() : [`${caseName})`, ` cmd="${funcName}"`, " ;;"];
|
|
17585
17588
|
const cmdLines = [`${funcName})`, ` opts="${join$1(wordList, " ")}"`, ` if [[ \${cur} == -* || \${COMP_CWORD} -eq ${info.level + 1} ]] ; then`, ' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )', " return 0", " fi", ' case "${prev}" in', ...indentAll(optionCases, 8), " *)", " COMPREPLY=()", " ;;", " esac", ' COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") )', " return 0", " ;;"];
|
|
17586
17589
|
const lines2 = append(state, [funcLines, cmdLines]);
|
|
17587
|
-
return
|
|
17588
|
-
}).pipe(
|
|
17590
|
+
return succeed2$1(lines2);
|
|
17591
|
+
}).pipe(map4$1((lines2) => {
|
|
17589
17592
|
const rootCommand2 = unsafeGet(getNamesInternal(self), 0);
|
|
17590
17593
|
const scriptName = `_${rootCommand2}_bash_completions`;
|
|
17591
17594
|
const funcCases = flatMap2(lines2, ([funcLines]) => funcLines);
|
|
@@ -17604,7 +17607,7 @@ var getFishCompletionsInternal = (self, executable) => traverseCommand(self, emp
|
|
|
17604
17607
|
});
|
|
17605
17608
|
if (isEmptyReadonlyArray(info.parentCommands)) {
|
|
17606
17609
|
const conditionals2 = make("-n", '"__fish_use_subcommand"');
|
|
17607
|
-
return
|
|
17610
|
+
return succeed2$1(pipe(state, appendAll(rootCompletions(conditionals2)), appendAll(subcommandCompletions(conditionals2))));
|
|
17608
17611
|
}
|
|
17609
17612
|
const parentConditionals = pipe(
|
|
17610
17613
|
info.parentCommands,
|
|
@@ -17616,7 +17619,7 @@ var getFishCompletionsInternal = (self, executable) => traverseCommand(self, emp
|
|
|
17616
17619
|
const subcommandConditionals = map2(info.subcommands, ([name]) => `not __fish_seen_subcommand_from ${name}`);
|
|
17617
17620
|
const baseConditionals = pipe(appendAll(parentConditionals, subcommandConditionals), join$1("; and "));
|
|
17618
17621
|
const conditionals = make("-n", `"${baseConditionals}"`);
|
|
17619
|
-
return
|
|
17622
|
+
return succeed2$1(pipe(state, appendAll(rootCompletions(conditionals)), appendAll(subcommandCompletions(conditionals))));
|
|
17620
17623
|
});
|
|
17621
17624
|
var getZshCompletionsInternal = (self, executable) => traverseCommand(self, empty(), (state, info) => {
|
|
17622
17625
|
const preformatted = isEmptyReadonlyArray(info.parentCommands) ? of(info.command.name) : pipe(info.parentCommands, append(info.command.name), map2((command) => command.replace("-", "__")));
|
|
@@ -17630,8 +17633,8 @@ var getZshCompletionsInternal = (self, executable) => traverseCommand(self, empt
|
|
|
17630
17633
|
${join$1(indentAll(subcommands, 8), "\n")}
|
|
17631
17634
|
)`;
|
|
17632
17635
|
const handlerLines = [`(( $+functions[_${underscoreName}_commands] )) ||`, `_${underscoreName}_commands() {`, ` local commands; ${commands}`, ` _describe -t commands '${spaceName} commands' commands "$@"`, "}"];
|
|
17633
|
-
return
|
|
17634
|
-
}).pipe(
|
|
17636
|
+
return succeed2$1(appendAll(state, handlerLines));
|
|
17637
|
+
}).pipe(map4$1((handlers) => {
|
|
17635
17638
|
const rootCommand2 = unsafeGet(getNamesInternal(self), 0);
|
|
17636
17639
|
const cases = getZshSubcommandCases(self, empty(), empty());
|
|
17637
17640
|
const scriptName = `_${rootCommand2}_zsh_completions`;
|
|
@@ -17696,7 +17699,7 @@ var run2 = /* @__PURE__ */ dual(3, (self, args, execute) => contextWithEffect((c
|
|
|
17696
17699
|
const [executable, filteredArgs] = splitExecutable(self, args);
|
|
17697
17700
|
const prefixedArgs = appendAll(prefixCommand(self.command), filteredArgs);
|
|
17698
17701
|
return matchEffect(parse7(self.command, prefixedArgs, config), {
|
|
17699
|
-
onFailure: (e) => zipRight(printDocs(e.error),
|
|
17702
|
+
onFailure: (e) => zipRight(printDocs(e.error), fail3(e)),
|
|
17700
17703
|
onSuccess: unify((directive) => {
|
|
17701
17704
|
switch (directive._tag) {
|
|
17702
17705
|
case "UserDefined": {
|
|
@@ -17704,12 +17707,12 @@ var run2 = /* @__PURE__ */ dual(3, (self, args, execute) => contextWithEffect((c
|
|
|
17704
17707
|
onEmpty: () => execute(directive.value).pipe(catchSome((e) => isValidationError(e) && isHelpRequested(e) ? some(handleBuiltInOption(self, executable, filteredArgs, showHelp(getUsage4(e.command), getHelp6(e.command, config)), execute, config, args)) : none())),
|
|
17705
17708
|
onNonEmpty: (head2) => {
|
|
17706
17709
|
const error3 = p(`Received unknown argument: '${head2}'`);
|
|
17707
|
-
return zipRight(printDocs(error3),
|
|
17710
|
+
return zipRight(printDocs(error3), fail3(invalidValue(error3)));
|
|
17708
17711
|
}
|
|
17709
17712
|
});
|
|
17710
17713
|
}
|
|
17711
17714
|
case "BuiltIn": {
|
|
17712
|
-
return handleBuiltInOption(self, executable, filteredArgs, directive.option, execute, config, args).pipe(catchSome((e) => isValidationError(e) ? some(zipRight(printDocs(e.error),
|
|
17715
|
+
return handleBuiltInOption(self, executable, filteredArgs, directive.option, execute, config, args).pipe(catchSome((e) => isValidationError(e) ? some(zipRight(printDocs(e.error), fail3(e))) : none()));
|
|
17713
17716
|
}
|
|
17714
17717
|
}
|
|
17715
17718
|
})
|
|
@@ -17781,7 +17784,7 @@ var handleBuiltInOption = (self, executable, args, builtIn2, execute, config, or
|
|
|
17781
17784
|
const message = p(error2("\n\nQuitting wizard mode..."));
|
|
17782
17785
|
return log(toAnsiText(message));
|
|
17783
17786
|
}
|
|
17784
|
-
return
|
|
17787
|
+
return fail3(e);
|
|
17785
17788
|
}));
|
|
17786
17789
|
}
|
|
17787
17790
|
case "ShowVersion": {
|
|
@@ -17819,15 +17822,15 @@ var prefixCommand = (self) => {
|
|
|
17819
17822
|
};
|
|
17820
17823
|
var getWizardPrefix = (builtIn2, rootCommand2, commandLineArgs) => {
|
|
17821
17824
|
const subcommands = getSubcommands(builtIn2.command);
|
|
17822
|
-
const [parentArgs, childArgs] = span(commandLineArgs, (name) => !
|
|
17825
|
+
const [parentArgs, childArgs] = span(commandLineArgs, (name) => !has2(subcommands, name));
|
|
17823
17826
|
const args = matchLeft(childArgs, {
|
|
17824
|
-
onEmpty: () =>
|
|
17827
|
+
onEmpty: () => filter2(parentArgs, (arg) => arg !== "--wizard"),
|
|
17825
17828
|
onNonEmpty: (head2) => append(parentArgs, head2)
|
|
17826
17829
|
});
|
|
17827
17830
|
return appendAll(rootCommand2.split(/\s+/), args);
|
|
17828
17831
|
};
|
|
17829
17832
|
var renderWizardArgs = (args) => {
|
|
17830
|
-
const params = pipe(
|
|
17833
|
+
const params = pipe(filter2(args, (param) => param.length > 0), join$1(" "));
|
|
17831
17834
|
const executeMsg = text4("You may now execute your command directly with the following options and arguments:");
|
|
17832
17835
|
return blocks([p(strong(code("Wizard Mode Complete!"))), p(executeMsg), p(concat(text4(" "), highlight(params, cyan3)))]);
|
|
17833
17836
|
};
|
|
@@ -18160,7 +18163,7 @@ var detectPackageManager = (repoDir) => Effect_exports.gen(function* () {
|
|
|
18160
18163
|
const pkg = yield* readHostPackageJson(repoDir);
|
|
18161
18164
|
const field = Option_exports.getOrUndefined(pkg)?.["packageManager"];
|
|
18162
18165
|
if (typeof field === "string") {
|
|
18163
|
-
const name = field.split("@")
|
|
18166
|
+
const [name] = field.split("@");
|
|
18164
18167
|
const match6 = PACKAGE_MANAGERS.find((pm) => pm === name);
|
|
18165
18168
|
if (match6) {
|
|
18166
18169
|
return match6;
|
|
@@ -18709,29 +18712,43 @@ var envNotes = (issueTracker, agent, sandboxProvider) => [
|
|
|
18709
18712
|
` ${sandboxProvider.name}() hides your host's \`gh\` login from the agent, so put a GH_TOKEN in .sandcastle/.env for \`gh\` to use.`
|
|
18710
18713
|
] : []
|
|
18711
18714
|
];
|
|
18715
|
+
var customTrackerNextSteps = (agent, sandboxProvider) => {
|
|
18716
|
+
const hasImage = sandboxProvider.image !== void 0;
|
|
18717
|
+
return [
|
|
18718
|
+
"Next steps:",
|
|
18719
|
+
"1. Your custom issue tracker isn't wired up yet \u2014 runs hard-fail until you configure it.",
|
|
18720
|
+
`2. Feed the setup prompt to ${agent.label} on your host to finish wiring it up:`,
|
|
18721
|
+
` ${agent.setupCommand}`,
|
|
18722
|
+
hasImage ? ` (Runs on the host \u2014 you need the ${agent.label} CLI installed locally, since the sandbox image isn't built yet.)` : ` (Runs on the host \u2014 you need the ${agent.label} CLI installed locally.)`,
|
|
18723
|
+
hasImage ? `3. Follow .sandcastle/${SETUP_ISSUE_TRACKER_DOC} to edit the scaffolded files in place, build the image, and verify.` : `3. Follow .sandcastle/${SETUP_ISSUE_TRACKER_DOC} to edit the scaffolded files in place and verify.`
|
|
18724
|
+
];
|
|
18725
|
+
};
|
|
18726
|
+
var blankTemplateNextSteps = ({
|
|
18727
|
+
mainFilename,
|
|
18728
|
+
notes,
|
|
18729
|
+
runStep
|
|
18730
|
+
}) => [
|
|
18731
|
+
"Next steps:",
|
|
18732
|
+
`1. Set the required env vars in .sandcastle/.env (see .sandcastle/.env.example)`,
|
|
18733
|
+
...notes,
|
|
18734
|
+
"2. Read and customize .sandcastle/prompt.md to describe what you want the agent to do",
|
|
18735
|
+
`3. Customize .sandcastle/${mainFilename} \u2014 it uses the JS API (\`run()\`) to control how the agent runs`,
|
|
18736
|
+
`4. Add "sandcastle": "npx tsx .sandcastle/${mainFilename}" to your package.json scripts`,
|
|
18737
|
+
`5. ${runStep}`
|
|
18738
|
+
];
|
|
18739
|
+
var copyToWorktreeStep = (packageManager) => `Templates use \`copyToWorktree: ["node_modules"]\` to copy your host node_modules into the sandbox for fast startup \u2014 the \`npm install\` in the onSandboxReady hook is a safety net for platform-specific binaries. ${packageManager === "npm" ? "Adjust both if you use a different package manager" : `This project uses ${packageManager}, so change the hook to \`${installCommand(packageManager)}\` and check \`copyToWorktree\` suits it`}`;
|
|
18740
|
+
var planSchemaStep = (packageManager) => `Install a schema validator for the planner's \`<plan>\` output \u2014 the template uses Zod (\`${addDependencyCommand(packageManager, "zod")}\`), but Valibot, ArkType, or any Standard Schema library works (https://standardschema.dev)`;
|
|
18712
18741
|
var getNextStepsLines = (template, mainFilename, issueTracker, agent, packageManager, installedDependencies, sandboxProvider = SANDBOX_PROVIDER_REGISTRY[0]) => {
|
|
18713
18742
|
const runStep = `Run \`${runScriptCommand(packageManager, "sandcastle")}\` to start the agent`;
|
|
18714
18743
|
if (issueTracker.name === "custom") {
|
|
18715
|
-
|
|
18716
|
-
return [
|
|
18717
|
-
"Next steps:",
|
|
18718
|
-
"1. Your custom issue tracker isn't wired up yet \u2014 runs hard-fail until you configure it.",
|
|
18719
|
-
`2. Feed the setup prompt to ${agent.label} on your host to finish wiring it up:`,
|
|
18720
|
-
` ${agent.setupCommand}`,
|
|
18721
|
-
hasImage ? ` (Runs on the host \u2014 you need the ${agent.label} CLI installed locally, since the sandbox image isn't built yet.)` : ` (Runs on the host \u2014 you need the ${agent.label} CLI installed locally.)`,
|
|
18722
|
-
hasImage ? `3. Follow .sandcastle/${SETUP_ISSUE_TRACKER_DOC} to edit the scaffolded files in place, build the image, and verify.` : `3. Follow .sandcastle/${SETUP_ISSUE_TRACKER_DOC} to edit the scaffolded files in place and verify.`
|
|
18723
|
-
];
|
|
18744
|
+
return customTrackerNextSteps(agent, sandboxProvider);
|
|
18724
18745
|
}
|
|
18725
18746
|
if (template === "blank") {
|
|
18726
|
-
return
|
|
18727
|
-
|
|
18728
|
-
|
|
18729
|
-
|
|
18730
|
-
|
|
18731
|
-
`3. Customize .sandcastle/${mainFilename} \u2014 it uses the JS API (\`run()\`) to control how the agent runs`,
|
|
18732
|
-
`4. Add "sandcastle": "npx tsx .sandcastle/${mainFilename}" to your package.json scripts`,
|
|
18733
|
-
`5. ${runStep}`
|
|
18734
|
-
];
|
|
18747
|
+
return blankTemplateNextSteps({
|
|
18748
|
+
mainFilename,
|
|
18749
|
+
notes: envNotes(issueTracker, agent, sandboxProvider),
|
|
18750
|
+
runStep
|
|
18751
|
+
});
|
|
18735
18752
|
}
|
|
18736
18753
|
const hasReviewer = template.includes("review");
|
|
18737
18754
|
const needsPlanSchema = getTemplateDependencies(template).includes("zod") && !installedDependencies.includes("zod");
|
|
@@ -18741,12 +18758,10 @@ var getNextStepsLines = (template, mainFilename, issueTracker, agent, packageMan
|
|
|
18741
18758
|
`${step++}. Set the required env vars in .sandcastle/.env (see .sandcastle/.env.example)`,
|
|
18742
18759
|
...envNotes(issueTracker, agent, sandboxProvider),
|
|
18743
18760
|
`${step++}. Add "sandcastle": "npx tsx .sandcastle/${mainFilename}" to your package.json scripts`,
|
|
18744
|
-
`${step++}.
|
|
18761
|
+
`${step++}. ${copyToWorktreeStep(packageManager)}`
|
|
18745
18762
|
];
|
|
18746
18763
|
if (needsPlanSchema) {
|
|
18747
|
-
lines2.push(
|
|
18748
|
-
`${step++}. Install a schema validator for the planner's \`<plan>\` output \u2014 the template uses Zod (\`${addDependencyCommand(packageManager, "zod")}\`), but Valibot, ArkType, or any Standard Schema library works (https://standardschema.dev)`
|
|
18749
|
-
);
|
|
18764
|
+
lines2.push(`${step++}. ${planSchemaStep(packageManager)}`);
|
|
18750
18765
|
}
|
|
18751
18766
|
lines2.push(
|
|
18752
18767
|
`${step++}. Read and customize the prompt files in .sandcastle/ \u2014 they shape what the agent does`
|
|
@@ -19079,7 +19094,7 @@ var scaffold = (repoDir, options3) => Effect_exports.gen(function* () {
|
|
|
19079
19094
|
}
|
|
19080
19095
|
return { mainFilename };
|
|
19081
19096
|
});
|
|
19082
|
-
var VERSION = "0.
|
|
19097
|
+
var VERSION = "0.14.0";
|
|
19083
19098
|
|
|
19084
19099
|
// src/cli.ts
|
|
19085
19100
|
var imageNameOption = Options_exports.text("image-name").pipe(
|