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