diff --git a/.oxfmtrc.json b/.oxfmtrc.json index 5dd0b48a..a7152edd 100644 --- a/.oxfmtrc.json +++ b/.oxfmtrc.json @@ -9,6 +9,7 @@ "scripts/tests/fixtures/**", "**/npm/**", "packages/workflow/vendor/cloudflare-computer-dofs/**", - "packages/acp/vendor/acpx/**" + "packages/acp/vendor/acpx/**", + "packages/cli/vendor/configliere-pr32/**" ] } diff --git a/deno.json b/deno.json index 923155a7..b755e144 100644 --- a/deno.json +++ b/deno.json @@ -7,9 +7,11 @@ "packages/workflow/vendor/cloudflare-computer-dofs/upstream", "packages/workflow/vendor/cloudflare-computer-dofs/generated/**/*.d.ts", "packages/acp/vendor/acpx/upstream", - "packages/acp/vendor/acpx/generated/**/*.d.ts" + "packages/acp/vendor/acpx/generated/**/*.d.ts", + "packages/cli/vendor/configliere-pr32" ], "nodeModulesDir": "auto", + "links": ["./packages/cli/vendor/configliere-pr32"], "lock": { "frozen": true }, @@ -38,7 +40,7 @@ "@effectionx/scope-eval": "npm:@effectionx/scope-eval@0.1.3", "@effectionx/stream-helpers": "npm:@effectionx/stream-helpers@0.8.3", "@effectionx/timebox": "npm:@effectionx/timebox@0.4.3", - "configliere": "npm:configliere@^0.4.0", + "configliere": "npm:configliere@^0.4.0-pr", "expect": "npm:expect@^30", "@std/encoding/base64": "jsr:@std/encoding@^1/base64", "@std/expect": "npm:expect@^30", diff --git a/deno.lock b/deno.lock index 7772922e..f05319f1 100644 --- a/deno.lock +++ b/deno.lock @@ -79,7 +79,7 @@ "npm:acpx@0.12.0": "0.12.0", "npm:ajv@8.20.0": "8.20.0", "npm:ajv@^8.17.1": "8.20.0", - "npm:configliere@0.4": "0.4.0", + "npm:configliere@~0.4.0-pr": "0.4.0-pr+08b3a6835a0c8be9c7b946e26f0e4f0706155964", "npm:effection@4.1.0": "4.1.0", "npm:esbuild-wasm@~0.25.11": "0.25.12", "npm:esbuild@0.25.7": "0.25.7", @@ -2431,8 +2431,7 @@ "commander@15.0.0": { "integrity": "sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==" }, - "configliere@0.4.0": { - "integrity": "sha512-4bxK3+L+FHr9Xm/d69Syvvpvkj7lj7a4zz3B+tchuohg5WKeudyBS+4Oob5Zdgoh8I7+n2lj0lfa8I6cUXfcEg==", + "configliere@0.4.0-pr+08b3a6835a0c8be9c7b946e26f0e4f0706155964": { "dependencies": [ "@standard-schema/spec" ] @@ -3983,7 +3982,7 @@ "npm:@secretlint/types@13.0.4", "npm:@types/node@^24.5.2", "npm:ajv@^8.17.1", - "npm:configliere@0.4", + "npm:configliere@~0.4.0-pr", "npm:effection@4.1.0", "npm:expect@30", "npm:mdast-util-to-string@4", @@ -4054,7 +4053,6 @@ "dependencies": [ "npm:@effectionx/stream-helpers@0.8.3", "npm:@standard-schema/spec@1", - "npm:configliere@0.4", "npm:effection@4.1.0", "npm:semver@^7.8.5", "npm:zod@^4.3.6" @@ -4230,6 +4228,13 @@ "npm:vite@^7.1.3" ] } + }, + "links": { + "npm:configliere@0.4.0-pr+08b3a6835a0c8be9c7b946e26f0e4f0706155964": { + "dependencies": [ + "npm:@standard-schema/spec@^1.1.0" + ] + } } } } diff --git a/package.json b/package.json index d17b1b1f..e234e332 100644 --- a/package.json +++ b/package.json @@ -73,7 +73,7 @@ "test:node": "tsx scripts/runtime-tests.ts node", "test:bun": "bun scripts/runtime-tests.ts bun", "test:deno": "deno task test", - "lint": "oxlint -c .oxlintrc.json --ignore-pattern 'scripts/tests/fixtures/**' --ignore-pattern '**/npm/**' --ignore-pattern 'packages/workflow/vendor/cloudflare-computer-dofs/**' --ignore-pattern 'packages/acp/vendor/acpx/**' packages scripts .reviews/components && oxfmt --check packages scripts .reviews/components/*.ts", + "lint": "oxlint -c .oxlintrc.json --ignore-pattern 'scripts/tests/fixtures/**' --ignore-pattern '**/npm/**' --ignore-pattern 'packages/workflow/vendor/cloudflare-computer-dofs/**' --ignore-pattern 'packages/acp/vendor/acpx/**' --ignore-pattern 'packages/cli/vendor/configliere-pr32/**' packages scripts .reviews/components && oxfmt --check packages scripts .reviews/components/*.ts", "fmt": "oxfmt --write packages scripts .reviews/components/*.ts" }, "workspaces": [ diff --git a/packages/cli/package.json b/packages/cli/package.json index 05a973f7..e1a2e3ad 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,7 +21,7 @@ "@executablemd/web": "workspace:*", "@executablemd/workflow": "workspace:*", "@standard-schema/spec": "^1.0.0", - "configliere": "^0.4.0", + "configliere": "https://pkg.pr.new/configliere@32", "effection": "4.1.0", "semver": "^7.8.5", "zod": "^4.3.6" diff --git a/packages/cli/src/cli-route.ts b/packages/cli/src/cli-route.ts new file mode 100644 index 00000000..b1cecc5f --- /dev/null +++ b/packages/cli/src/cli-route.ts @@ -0,0 +1,980 @@ +/** + * The `xmd` command tree, expressed through Configliere's proposed route API. + * + * This module owns the immutable route definitions, the synchronous parse + * driver, and the presentation that keeps help and version output identical to + * the released CLI's. Execution, I/O and process lifetime stay where they + * already are. + * + * Two definitions are exported rather than one. Configliere selects a child + * route from any unclaimed word in the current segment, while `xmd` selects a + * top-level command only from the first token — a word in any other position + * is a document reference. {@link definitionFor} picks between them, which is + * what keeps `xmd --raw run -e '# Probe'` naming a document called `run` + * rather than the named `run` command. + */ + +import { + argument, + cli, + command, + description, + extend, + multiple, + name, + option, + parse, + route, + routes, + schema, + toggle, + version, +} from "configliere"; +import type { + AnyRoute, + Execute, + Help, + Intent, + IntentsOf, + Issue, + ModelsByRoute, + Outcome, + Param, + RoutePath, + Schema, + ValueSource, + Version, +} from "configliere"; +import { z } from "zod"; +import { EVAL_ALIAS, EVAL_OPTION } from "./eval-source.ts"; +import denoJson from "../deno.json" with { type: "json" }; + +/** The version this build reports, from the manifest it was built with. */ +export const XMD_VERSION: string = denoJson.version; + +/** + * A Standard Schema that answers `undefined` with a default. + * + * `schema()` accepts `StandardSchemaV1`, so a Zod schema carrying + * `.default()` is rejected: the default widens the input type to `T | + * undefined` while the output stays `T`. Defaults are therefore expressed + * here, over the same Standard Schema interface the parser validates through. + */ +interface MarkedSchema extends Schema { + readonly xmd: { readonly required?: boolean; readonly display?: unknown }; +} + +function withDefault(inner: Schema, value: T, required = false): Schema { + const marked: MarkedSchema = { + "~standard": { + version: 1, + vendor: "xmd", + validate(input) { + if (input === undefined) { + return { value }; + } + return inner["~standard"].validate(input); + }, + }, + // Help distinguishes a value the schema itself supplies from one supplied + // beside it: `xmd test [path]` has always been optional and + // `--agent-provider ` has always been required, though both + // resolve to a value when nobody writes one. The proposed API expresses + // only the first, so the second is recorded here. + xmd: { required }, + }; + return marked; +} + +/** + * A schema that keeps absence absent, and the default help displays for it. + * + * `--pattern` is the one parameter whose absence is a fact the command needs: + * `xmd test` refuses a pattern written against a single document, and a default + * is a real value indistinguishable from a written one. So the value cannot + * come from the schema — but help has always shown the glob the command would + * apply, and that display is carried here. + */ +function shownDefault(inner: Schema, display: T): Schema { + const marked: MarkedSchema = { + "~standard": inner["~standard"], + xmd: { display }, + }; + return marked; +} + +/** The marker help reads when the schema alone does not say enough. */ +function helpMarker(param: Param): MarkedSchema["xmd"] | undefined { + const schema: unknown = param.schema; + if (typeof schema !== "object" || schema === null || !("xmd" in schema)) { + return undefined; + } + const marker = schema.xmd; + return typeof marker === "object" && marker !== null ? marker : undefined; +} + +/** Whether help describes this parameter as one a caller must supply. */ +function describedAsRequired(param: Param): boolean { + const marker = helpMarker(param); + return marker !== undefined && "required" in marker && marker.required === true; +} + +/** + * `--include`, as `run`, `test`, `plan` and `syntax` each declare it. + * + * `multiple()` is what makes a repeatable option expressible: the binding loop + * shows a multiple parameter the whole phase rather than truncating its view at + * the first unclaimed word, so an occurrence written after the document binds, + * and the reader returns the occurrences in the order they were written. + */ +const includeOption = option( + { ...name("include"), description: "component search directory" }, + multiple(), + schema(withDefault(z.array(z.string()), ["components", "."])), +); + +const secretDetectionToggle = toggle( + { + ...name("secretDetection"), + description: + "scan durable events for credentials before they persist; " + + "disable with --no-secret-detection", + }, + schema(withDefault(z.boolean(), true)), +); + +const verboseSwitch = option( + { ...name("verbose"), description: "log journal entries to stderr" }, + cli(["-V", "--verbose"], { switch: true }), + schema(withDefault(z.boolean(), false)), +); + +const journalOption = option( + { ...name("journal"), description: "write a diagnostic JSONL trace (path must not exist)" }, + cli(["-j", "--journal"]), + schema(z.string().optional()), +); + +const rawSwitch = option( + { + ...name("raw"), + description: "output raw markdown without normalization or terminal formatting", + }, + cli(["--raw"], { switch: true }), + schema(withDefault(z.boolean(), false)), +); + +/** + * Everything a document execution configures. + * + * One group, folded into both the shorthand root and the named `run` command, + * so the two forms cannot drift. Each route holds its own copy: parameters + * belong to the route that owns them, and no model is merged with another + * after parsing. + */ +const executionGrammar = extend( + includeOption, + verboseSwitch, + journalOption, + rawSwitch, + option( + { ...name("agentProvider"), description: "agent provider for agent components" }, + schema(withDefault(z.string(), "acpx", true)), + ), + option( + { + ...name("defaultAgent"), + description: "default agent name (overrides DEFAULT_AGENT_NAME)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("timeout"), + description: "deadline for the whole run, as a duration (500ms, 30s, 5min)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("timeoutExec"), + description: "default timeout for each exec block, as a duration (500ms, 30s, 5min)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("timeoutFetch"), + description: "default timeout for each fetch, as a duration (500ms, 30s, 5min)", + }, + schema(z.string().optional()), + ), + option( + { ...name("approveAll"), description: "approve every agent permission request" }, + cli(["--approve-all"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + option( + { + ...name("approveReads"), + description: "approve read and search agent permissions, ask for the rest (default)", + }, + cli(["--approve-reads"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + option( + { ...name("denyAll"), description: "deny every agent permission request" }, + cli(["--deny-all"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + secretDetectionToggle, +); + +/** The root document argument, and the inline document that replaces it. */ +const runSourceGrammar = extend( + argument( + { + ...name("path"), + description: + "markdown document to execute, optionally `#` and one target selector; " + + "`xmd run -` reads the document from standard input instead", + }, + schema(z.string().optional()), + ), + // Declared so `xmd run --help` lists it with every other option. The value + // is lifted out of argv by readEvalFlags before parsing — see + // eval-source.ts — so this parameter is never the source of the document. + option( + { ...name("eval"), description: "inline markdown document to execute, in place of a path" }, + cli([EVAL_ALIAS, EVAL_OPTION]), + schema(z.string().optional()), + ), +); + +/** What `xmd --help` says the plan command is for. */ +export const PLAN_DESCRIPTION = + "Turn a request into an XMD Plan, review it, and write the approved source."; + +/** What `xmd --help` says the upgrade command is for. */ +export const UPGRADE_DESCRIPTION = + "Upgrade the standalone xmd binary to the latest stable or a specified release."; + +const runCommand = command(name("run"), runSourceGrammar, executionGrammar); + +const planCommand = command( + name("plan"), + description(PLAN_DESCRIPTION), + argument( + { + ...name("request"), + description: "the request the coding agent should turn into an XMD Plan", + }, + schema(z.string().optional()), + ), + option( + { + ...name("output"), + description: "write the approved source here instead of to stdout (path must not exist)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("session"), + description: "logical name for the assistant session (default: unique to this invocation)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("verbose"), + description: "show generated drafts and XMD check diagnostics on stderr", + }, + cli(["--verbose"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + option( + { + ...name("journal"), + description: "record the planning process as diagnostic JSONL (path must not exist)", + }, + cli(["--journal"]), + schema(z.string().optional()), + ), + includeOption, + option( + { ...name("agentProvider"), description: "agent provider for Plan authorship" }, + schema(withDefault(z.string(), "acpx", true)), + ), + option( + { + ...name("defaultAgent"), + description: "default agent name (overrides DEFAULT_AGENT_NAME)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("timeout"), + description: "deadline for the whole planning invocation, as a duration (500ms, 30s, 5min)", + }, + schema(z.string().optional()), + ), +); + +const testCommand = command( + name("test"), + argument( + { + ...name("path"), + description: "markdown document or directory to test (defaults to the current directory)", + }, + schema(withDefault(z.string(), ".")), + ), + option( + { + ...name("pattern"), + description: "glob for test documents, relative to a directory target (repeatable)", + }, + multiple(), + schema(shownDefault(z.array(z.string()).optional(), ["**/*.test.md"])), + ), + includeOption, + verboseSwitch, + journalOption, + rawSwitch, + secretDetectionToggle, +); + +const syntaxCommand = command( + name("syntax"), + argument( + { + ...name("component"), + description: + "component to describe in full — `xmd syntax Elicit` renders its catalog " + + "metadata and long-form documentation instead of the compact catalog", + }, + schema(z.string().optional()), + ), + includeOption, + option( + { ...name("json"), description: "write the symbols as version-2 JSON instead of markdown" }, + cli(["--json"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), +); + +const upgradeCommand = command( + name("upgrade"), + description(UPGRADE_DESCRIPTION), + argument( + { + ...name("tag"), + description: "exact release tag to install, such as v1.2.3 (default: the latest stable)", + }, + schema(z.string().optional()), + ), + option( + { + ...name("status"), + description: "report how the selected release compares, and change nothing", + }, + cli(["--status"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + option( + { + ...name("allowDowngrade"), + description: "consent to installing a release older than the installed one", + }, + cli(["--allow-downgrade"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + option( + { + ...name("allowPrerelease"), + description: "consent to installing the exact prerelease tag named", + }, + cli(["--allow-prerelease"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + journalOption, +); + +const testAgentCommand = command( + name("test-agent"), + option( + { + ...name("connect"), + description: "opaque controller route (controller-launched workers only)", + }, + schema(z.string()), + ), +); + +/** The options every workflow action that executes a run accepts. */ +const workflowExecutionGrammar = extend(verboseSwitch, rawSwitch, secretDetectionToggle); + +const runIdOption = option( + { + ...name("id"), + description: "run id to create or address (start and fork only; generated when absent)", + }, + schema(z.string().optional()), +); + +const jsonSwitch = option( + { + ...name("json"), + description: "write the inspection result as JSON (status, list and history only)", + }, + cli(["--json"], { switch: true }), + schema(withDefault(z.boolean(), false)), +); + +const artifactOption = option( + { + ...name("artifact"), + description: + "inspect this sealed .xmd artifact instead of a retained run (status and history only)", + }, + schema(z.string().optional()), +); + +const workflowStart = command( + name("start"), + argument( + { ...name("target"), description: "markdown definition to start" }, + schema(z.string().optional()), + ), + runIdOption, + workflowExecutionGrammar, +); + +const workflowResume = command( + name("resume"), + argument( + { ...name("target"), description: "the run to continue" }, + schema(z.string().optional()), + ), + workflowExecutionGrammar, +); + +const workflowFork = command( + name("fork"), + argument( + { ...name("target"), description: "the run a fork continues" }, + schema(z.string().optional()), + ), + argument( + { ...name("argument"), description: "the definition a fork runs" }, + schema(z.string().optional()), + ), + runIdOption, + option( + { ...name("at"), description: "the retained event a fork continues from (fork only)" }, + schema(z.string().optional()), + ), + workflowExecutionGrammar, +); + +const workflowAnswer = command( + name("answer"), + argument( + { ...name("target"), description: "the run an answer is delivered to" }, + schema(z.string().optional()), + ), + argument( + { ...name("argument"), description: "the wait an answer is delivered to" }, + schema(z.string().optional()), + ), + argument( + { ...name("value"), description: "the answer itself, as one JSON value" }, + schema(z.string().optional()), + ), + secretDetectionToggle, +); + +const workflowStatus = command( + name("status"), + argument({ ...name("target"), description: "the run to inspect" }, schema(z.string().optional())), + jsonSwitch, + artifactOption, +); + +const workflowList = command( + name("list"), + jsonSwitch, + option( + { ...name("status"), description: "list only runs retaining this status" }, + schema(z.string().optional()), + ), +); + +const workflowHistory = command( + name("history"), + argument( + { ...name("target"), description: "the run to read history from" }, + schema(z.string().optional()), + ), + jsonSwitch, + option( + { + ...name("forkable"), + description: "add each event's forkability to the history (history only)", + }, + cli(["--forkable"], { switch: true }), + schema(withDefault(z.boolean(), false)), + ), + artifactOption, +); + +const workflowCancel = command( + name("cancel"), + argument({ ...name("target"), description: "the run to cancel" }, schema(z.string().optional())), +); + +const workflowDelete = command( + name("delete"), + argument({ ...name("target"), description: "the run to delete" }, schema(z.string().optional())), +); + +const workflowExport = command( + name("export"), + argument({ ...name("target"), description: "the run to export" }, schema(z.string().optional())), + option( + { + ...name("output"), + description: + "the .xmd file to write the artifact to (export only); the artifact contains " + + "this run's complete retained Workspace, which may include source, generated files and " + + "secrets — treat it as confidential", + }, + schema(z.string().optional()), + ), +); + +/** + * `xmd workflow` addresses a run rather than executing one, so the route + * supports help and nothing else. Every action beneath it executes. + */ +const workflowRoute = route( + name("workflow"), + description("start, resume, fork, answer, status, list, history, cancel, delete or export"), + routes( + workflowStart, + workflowResume, + workflowFork, + workflowAnswer, + workflowStatus, + workflowList, + workflowHistory, + workflowCancel, + workflowDelete, + workflowExport, + ), +); + +/** The whole tree, parsed against when the first token names a command. */ +export const xmdCommands = command( + name("xmd"), + version(XMD_VERSION), + runSourceGrammar, + executionGrammar, + routes( + runCommand, + planCommand, + testCommand, + syntaxCommand, + upgradeCommand, + testAgentCommand, + workflowRoute, + ), +); + +/** + * The shorthand run form, parsed against when the first token names no + * command. + * + * The same grammar as the root of {@link xmdCommands} with no children at all, + * because Configliere would otherwise select `/run` from a later `run` token — + * a document reference in this form, not a command. + */ +export const xmdShorthand = command( + name("xmd"), + version(XMD_VERSION), + runSourceGrammar, + executionGrammar, +); + +/** Every intent the full tree can produce. */ +export type XmdIntent = IntentsOf; + +/** Every intent the shorthand form can produce. */ +export type ShorthandIntent = IntentsOf; + +/** Every command name the first token may carry. */ +export const COMMAND_NAMES: readonly string[] = [ + "run", + "plan", + "test", + "syntax", + "upgrade", + "test-agent", + "workflow", +]; + +/** The control flags Configliere lifts out of argv before it routes anything. */ +const CONTROLS = new Set(["-h", "--help", "-v", "--version"]); + +/** + * The command this invocation names, read from the first token. + * + * Configliere's route search accepts any unclaimed word in the segment, and + * `xmd` accepts a command only in first position. The controls are skipped + * because the parser lifts them wherever they appear, so `xmd --help run` and + * `xmd run --help` have always named the same command. + */ +export function commandToken(args: readonly string[]): string | undefined { + for (const arg of args) { + if (arg === "--") { + return undefined; + } + if (CONTROLS.has(arg)) { + continue; + } + return COMMAND_NAMES.includes(arg) ? arg : undefined; + } + return undefined; +} + +/** What one invocation is parsed against. */ +export function namesCommand(args: readonly string[]): boolean { + return commandToken(args) !== undefined; +} + +/** + * Every flag in the tree that takes a separated value. + * + * Read from the definitions rather than listed, so a scanner that has to skip + * `--journal -` cannot fall behind the grammar it is skipping. + */ +export function valueFlags(): Set { + const flags = new Set(); + const pending: AnyRoute[] = [xmdCommands]; + while (pending.length > 0) { + const current = pending.pop(); + if (current === undefined) { + continue; + } + for (const phase of current.phases) { + pending.push(...phase.routes); + for (const param of Object.values(phase.params) as Param[]) { + const syntax = param.cli.syntax; + if (syntax?.type !== "option" || !syntax.label.endsWith(VALUE)) { + continue; + } + for (const flag of syntax.label.slice(0, -VALUE.length).split(", ")) { + flags.add(flag); + } + } + } + } + return flags; +} + +/** + * Parse one command line against the tree its first token selects. + * + * Synchronous and free of I/O, exactly as the API requires. The caller has + * already lifted every token this grammar cannot express — the inline + * document, the repeatable options and the generated document properties — + * and supplies the lifted lists back as `values`. + */ +export function parseCommands( + argv: readonly string[], + values: readonly ValueSource[] = [], +): Outcome { + return parse(xmdCommands, { argv: [...argv], values }); +} + +/** The same, for a command line whose first token names no command. */ +export function parseShorthand( + argv: readonly string[], + values: readonly ValueSource[] = [], +): Outcome { + return parse(xmdShorthand, { argv: [...argv], values }); +} + +/** Every parse outcome either driver can produce. */ +export type ParseOutcome = Outcome | Outcome; + +/** An intent, whatever tree produced it. */ +export type AnyXmdIntent = XmdIntent | ShorthandIntent; + +/** + * Configliere reports a parse failure as its own structural result. It is + * adapted here, once, to the `Error` the rest of the CLI already reports. + */ +export function parseFailure(outcome: Exclude): Error { + if (outcome.code === "method-not-allowed") { + return new Error( + `xmd${outcome.path.length > 0 ? ` ${outcome.path.join(" ")}` : ""} does not support ` + + outcome.method, + ); + } + return new Error(describeIssues(outcome.issues)); +} + +/** + * Whether a failure reports nothing but tokens the grammar did not expect. + * + * The released parser stopped at the first token it did not define and + * refused none of them, so a run written with a mistyped option refused for + * want of a root rather than naming the option. The proposed API refuses the + * token instead, which is a better answer to a different question — and not + * the answer `xmd` has been giving. + */ +export function unexpectedOnly(outcome: ParseOutcome): boolean { + return ( + !outcome.ok && + outcome.code === "unprocessable-content" && + outcome.issues.length > 0 && + outcome.issues.every((issue) => readUnexpected(issue.message) !== undefined) + ); +} + +/** Every issue one failure carries, in the order the parser found them. */ +export function describeIssues(issues: readonly Issue[]): string { + return issues.map(describeIssue).join("\n"); +} + +function describeIssue(issue: Issue): string { + const at = issue.path + ?.map((segment) => (typeof segment === "object" && segment !== null ? segment.key : segment)) + .join("."); + const unexpected = readUnexpected(issue.message); + if (unexpected !== undefined) { + return `unrecognized argument: ${unexpected}`; + } + return at ? `${at}: ${issue.message}` : issue.message; +} + +/** The token an `unexpected "…"` diagnostic names, when it names one. */ +function readUnexpected(message: string): string | undefined { + if (!message.startsWith('unexpected "')) { + return undefined; + } + const encoded = message.slice("unexpected ".length); + try { + const token: unknown = JSON.parse(encoded); + return typeof token === "string" ? token : undefined; + } catch { + return undefined; + } +} + +/** The definition one route path addresses, when the tree holds one. */ +export function routeFor(path: readonly string[]): AnyRoute | undefined { + let current: AnyRoute = xmdCommands; + for (const segment of path) { + const child: AnyRoute | undefined = current.phases + .flatMap((phase) => phase.routes) + .find((candidate) => candidate.name === segment); + if (child === undefined) { + return undefined; + } + current = child; + } + return current; +} + +/** + * `xmd --help`: the commands, and nothing the shorthand run form configures. + * + * The root is executable, so every option a run takes is declared on it. The + * program page has never listed them — a caller reading it is choosing a + * command — so this renders the commands alone, exactly as before. + */ +export function renderProgramHelp(): string { + const children = xmdCommands.phases.flatMap((phase) => phase.routes); + return [ + "Usage: xmd [OPTIONS]", + "", + ["Commands:", ...children.map((child) => row(child.name, child.description))].join("\n"), + "", + ["Options:", row(HELP_LABEL, "show help"), row("-v, --version", "show version")].join("\n"), + ].join("\n"); +} + +/** + * Help for one route, in the shape the released CLI printed. + * + * The proposed API's own `printHelp` renders a different one — a wrapped + * description block, `Usage:` on its own line, `` for an optional + * argument — so presentation stays here. Every fact it needs comes from the + * definition: whether a parameter is optional is answered by validating + * `undefined` against its schema, and the default is whatever that validation + * returns. + */ +export function renderRouteHelp(definition: AnyRoute, path: readonly string[]): string { + const label = ["xmd", ...path].join(" "); + const children = definition.phases.flatMap((phase) => phase.routes); + const params = paramsOf(definition); + // An address that executes nothing declares nothing either, and its page has + // always listed the grammar its actions accept. The union is presentation: + // parsing binds each parameter on the action that owns it, and no model is + // merged with another. + if (!definition.methods.includes("execute")) { + const seen = new Set(params.map((param) => param.name)); + for (const child of children) { + for (const param of paramsOf(child)) { + if (seen.has(param.name)) { + continue; + } + seen.add(param.name); + params.push(param); + } + } + } + const args = params.filter((param) => param.cli.syntax?.type === "argument"); + const opts = params.filter((param) => param.cli.syntax?.type === "option"); + + const usage = [`Usage: ${label}`]; + if (children.length > 0) { + usage.push(""); + } + // Every page offers help, so every page has an option section. + usage.push("[OPTIONS]"); + for (const arg of args) { + usage.push(argumentLabel(arg)); + } + + const sections = [usage.join(" ")]; + + if (children.length > 0) { + sections.push( + ["Commands:", ...children.map((child) => row(child.name, child.description))].join("\n"), + ); + } + + if (args.length > 0) { + sections.push( + ["Arguments:", ...args.map((arg) => row(argumentLabel(arg), describeParam(arg)))].join("\n"), + ); + } + + sections.push( + [ + "Options:", + ...opts.map((opt) => row(optionLabel(opt), describeParam(opt))), + row(HELP_LABEL, "show help"), + ].join("\n"), + ); + + return sections.join("\n\n"); +} + +/** The control every route answers, listed last as it always has been. */ +const HELP_LABEL = "-h, --help"; + +/** Every parameter one route declares, in declaration order. */ +function paramsOf(definition: AnyRoute): Param[] { + return definition.phases.flatMap( + (phase) => Object.values(phase.params) as Param[], + ); +} + +function row(label: string, right?: string): string { + return ` ${label.padEnd(25)} ${right ?? ""}`; +} + +function describeParam(param: Param): string { + const fallback = defaultOf(param); + const stated = fallback === undefined ? "" : `[default: ${fallback}]`; + return [param.description ?? "", stated].filter(Boolean).join(" "); +} + +/** What the parameter resolves to when nothing supplies it, if anything. */ +function defaultOf(param: Param): string | undefined { + const display = helpMarker(param)?.display; + if (display !== undefined) { + return `${display}`; + } + const validated = param.schema["~standard"].validate(undefined); + if (validated instanceof Promise || validated.issues || validated.value === undefined) { + return undefined; + } + return `${validated.value}`; +} + +function accepts(param: Param, value: unknown): boolean { + const validated = param.schema["~standard"].validate(value); + return !(validated instanceof Promise) && !validated.issues; +} + +function argumentLabel(param: Param): string { + // A repeatable parameter says so itself now, rather than being inferred from + // the shape of whatever its schema returns for absence. + if (param.multiple === true) { + return `<${param.name}>...`; + } + if (describedAsRequired(param)) { + return `<${param.name}>`; + } + return accepts(param, undefined) ? `[${param.name}]` : `<${param.name}>`; +} + +function defaultValue(param: Param): unknown { + const validated = param.schema["~standard"].validate(undefined); + if (validated instanceof Promise || validated.issues) { + return undefined; + } + return validated.value; +} + +/** + * The flags a parameter answers to, followed by the value form. + * + * `cli()` and `toggle()` write the flags into `syntax.label` and append + * ` ` when the option takes one, which is the one part of the stock + * label this rendering replaces. + */ +function optionLabel(param: Param): string { + const label = param.cli.syntax?.label ?? `--${param.name}`; + const takesValue = label.endsWith(VALUE); + const flags = takesValue ? label.slice(0, -VALUE.length) : label; + return takesValue ? `${flags} ${argumentLabel(param).toUpperCase()}` : flags; +} + +const VALUE = " "; + +/** The bare version, which is what `xmd --version` has always written. */ +export function renderVersion(intent: Version): string { + return intent.definition.version ?? XMD_VERSION; +} + +/** Whether one intent asks for help. */ +export function isHelp(intent: AnyXmdIntent): intent is Extract> { + return intent.method === "help"; +} + +/** Whether one intent asks for the version. */ +export function isVersion( + intent: AnyXmdIntent, +): intent is Extract> { + return intent.method === "version"; +} + +/** Whether one intent executes a command. */ +export function isExecute( + intent: AnyXmdIntent, +): intent is Extract> { + return intent.method === "execute"; +} + +/** The route one intent selected, as the path the caller wrote. */ +export function intentPath(intent: Intent<"help" | "version" | "execute", RoutePath>): string[] { + return [...intent.path]; +} diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index f7b05d8a..a3ca5727 100755 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -54,8 +54,23 @@ import { open } from "node:fs/promises"; import type { FileHandle } from "node:fs/promises"; import { inspect } from "node:util"; import process from "node:process"; -import { program, object, field, cli, commands } from "configliere"; -import { z } from "zod"; +import type { ValueSource } from "configliere"; +import { + commandToken, + isExecute, + isHelp, + isVersion, + parseCommands, + parseFailure, + parseShorthand, + renderProgramHelp, + renderRouteHelp, + renderVersion, + routeFor, + unexpectedOnly, + valueFlags, +} from "./cli-route.ts"; +import type { AnyXmdIntent, ParseOutcome } from "./cli-route.ts"; import { AgentProviders, Config, @@ -148,14 +163,12 @@ import { runWorkflow, UNSUPPORTED_WORKFLOW_HOST, unsupportedWorkflowHost, - workflowConfig, } from "./workflow.ts"; import type { HostWorkflowInstaller, WorkflowHost, WorkflowStart } from "./workflow.ts"; import { runWorkflowManagement } from "./workflow-management.ts"; import { establishDefinition } from "./workflow-definition.ts"; import type { EstablishedDefinition } from "./workflow-definition.ts"; import { useCompositionComponents, useWorkflowServiceDenial } from "@executablemd/workflow"; -import denoJson from "../deno.json" with { type: "json" }; const SECRET_DETECTION_OPTION = "--secret-detection"; const NEGATED_SECRET_DETECTION = "--no-secret-detection"; @@ -164,283 +177,8 @@ const NEGATED_SECRET_DETECTION = "--no-secret-detection"; const SECRET_DETECTION_WARNING = "WARNING: secret detection is disabled; credentials may be persisted."; -/** - * `--no-secret-detection` — the host's opt-out, on both commands. - * - * Declared as an ordinary boolean switch because that is what configliere - * negates: a `secretDetection` field makes `--no-secret-detection` resolve to - * `false` with no argv reading of our own. It takes no aliases — adding - * `--no-secret-detection` as one makes the parser read it as the positive - * switch, and the opt-out silently stops working. - * - * Help lists the positive spelling only, so the description carries the one a - * caller actually writes. - */ -const SECRET_DETECTION_FIELD = { - description: - "scan durable events for credentials before they persist; " + - `disable with ${NEGATED_SECRET_DETECTION}`, - ...field(z.boolean(), field.default(true)), -}; - -/** - * Everything a document execution configures. - * - * `xmd run` alone. `xmd plan` writes a program rather than running one, so it - * declares the few of these that describe *authorship* — the includes the - * catalog is built from, who writes, and one deadline — and none of the rest: - * a journal, a permission mode, an exec deadline or a presentation option would - * each configure work this command never performs. - */ -const executionFields = { - include: { - description: "component search directory", - ...field(z.array(z.string()), field.default(["components", "."]), field.array()), - }, - verbose: { - description: "log journal entries to stderr", - aliases: ["-V"], - ...field(z.boolean(), field.default(false)), - }, - journal: { - description: "write a diagnostic JSONL trace (path must not exist)", - aliases: ["-j"], - ...field(z.string().optional()), - }, - raw: { - description: "output raw markdown without normalization or terminal formatting", - ...field(z.boolean(), field.default(false)), - }, - agentProvider: { - description: "agent provider for agent components", - ...field(z.string(), field.default("acpx")), - }, - defaultAgent: { - description: "default agent name (overrides DEFAULT_AGENT_NAME)", - ...field(z.string().optional()), - }, - timeout: { - description: "deadline for the whole run, as a duration (500ms, 30s, 5min)", - ...field(z.string().optional()), - }, - timeoutExec: { - description: "default timeout for each exec block, as a duration (500ms, 30s, 5min)", - ...field(z.string().optional()), - }, - timeoutFetch: { - description: "default timeout for each fetch, as a duration (500ms, 30s, 5min)", - ...field(z.string().optional()), - }, - approveAll: { - description: "approve every agent permission request", - ...field(z.boolean(), field.default(false)), - }, - approveReads: { - description: "approve read and search agent permissions, ask for the rest (default)", - ...field(z.boolean(), field.default(false)), - }, - denyAll: { - description: "deny every agent permission request", - ...field(z.boolean(), field.default(false)), - }, - secretDetection: SECRET_DETECTION_FIELD, -}; - -const runConfig = object({ - path: { - description: - "markdown document to execute, optionally `#` and one target selector; " + - "`xmd run -` reads the document from standard input instead", - ...field(z.string().optional(), cli.argument()), - }, - // Declared so `xmd run --help` lists it with every other option. The value is - // lifted out of argv by readEvalFlags before parsing — see eval-source.ts — - // so this field is never the source of the document. - eval: { - description: "inline markdown document to execute, in place of a path", - aliases: ["-e"], - ...field(z.string().optional()), - }, - ...executionFields, -}); - -/** What `xmd --help` says the plan command is for. */ -const PLAN_DESCRIPTION = - "Turn a request into an XMD Plan, review it, and write the approved source."; - -/** - * `xmd plan` — the request, where the approved source goes, and who writes it. - * - * Every option that configured *running* a Plan is absent, because this command - * runs nothing: the program it writes is run by a later `xmd run`, and that is - * where a permission mode, an exec deadline and a root property are configured. - * The generated `--props-*` options are absent for the same reason, and for one - * more — they exist only once a document does, and this command's result is the - * document. - * - * `--verbose` and `--journal` describe writing the Plan rather than running it. - * They observe this invocation's own authorship and nothing after it, which is - * why they are spelled in full: `-V` and `-j` are `xmd run`'s aliases for - * options about a program's run. - */ -const planConfig = object({ - request: { - description: "the request the coding agent should turn into an XMD Plan", - ...field(z.string().optional(), cli.argument()), - }, - output: { - description: "write the approved source here instead of to stdout (path must not exist)", - ...field(z.string().optional()), - }, - session: { - description: "logical name for the assistant session (default: unique to this invocation)", - ...field(z.string().optional()), - }, - verbose: { - description: "show generated drafts and XMD check diagnostics on stderr", - ...field(z.boolean(), field.default(false)), - }, - journal: { - description: "record the planning process as diagnostic JSONL (path must not exist)", - ...field(z.string().optional()), - }, - include: { - description: "component search directory", - ...field(z.array(z.string()), field.default(["components", "."]), field.array()), - }, - agentProvider: { - description: "agent provider for Plan authorship", - ...field(z.string(), field.default("acpx")), - }, - defaultAgent: { - description: "default agent name (overrides DEFAULT_AGENT_NAME)", - ...field(z.string().optional()), - }, - timeout: { - description: "deadline for the whole planning invocation, as a duration (500ms, 30s, 5min)", - ...field(z.string().optional()), - }, -}); - -const testConfig = object({ - path: { - description: "markdown document or directory to test (defaults to the current directory)", - ...field(z.string().default("."), cli.argument(), field.default(".")), - }, - pattern: { - description: "glob for test documents, relative to a directory target (repeatable)", - ...field(z.array(z.string()), field.default(["**/*.test.md"]), field.array()), - }, - include: { - description: "component search directory", - ...field(z.array(z.string()), field.default(["components", "."]), field.array()), - }, - verbose: { - description: "log journal entries to stderr", - aliases: ["-V"], - ...field(z.boolean(), field.default(false)), - }, - journal: { - description: "write a diagnostic JSONL trace (path must not exist)", - aliases: ["-j"], - ...field(z.string().optional()), - }, - raw: { - description: "output raw markdown without normalization or terminal formatting", - ...field(z.boolean(), field.default(false)), - }, - secretDetection: SECRET_DETECTION_FIELD, -}); - -/** - * `xmd syntax` — inspection only, so its grammar is only what selection needs. - * - * No document, props, agent, timeout, journal, raw, testing, workflow or - * secret-detection option: the command runs nothing, so there is nothing for - * any of them to configure. `--include` is the same ordered, repeatable field - * `run` and `test` declare, and explicit values replace the defaults. - */ -const syntaxConfig = object({ - component: { - description: - "component to describe in full — `xmd syntax Elicit` renders its catalog metadata " + - "and long-form documentation instead of the compact catalog", - ...field(z.string().optional(), cli.argument()), - }, - include: { - description: "component search directory", - ...field(z.array(z.string()), field.default(["components", "."]), field.array()), - }, - json: { - description: "write the symbols as version-2 JSON instead of markdown", - ...field(z.boolean(), field.default(false)), - }, -}); - -const testAgentConfig = object({ - connect: { - description: "opaque controller route (controller-launched workers only)", - ...field(z.string()), - }, -}); - -/** What `xmd --help` says the upgrade command is for. */ -const UPGRADE_DESCRIPTION = - "Upgrade the standalone xmd binary to the latest stable or a specified release."; - -/** - * `xmd upgrade` — one optional tag and three switches, and nothing else. - * - * Every option a run configures is deliberately absent. This command executes - * no caller's document, writes no journal, starts no agent and installs no - * permission mode, so an option describing any of those would be answered by a - * command that does none of it. The values are read from argv by - * {@link scanUpgradeArgs} rather than from this parse; what is declared here is - * what `xmd upgrade --help` lists. - */ -const upgradeConfig = object({ - tag: { - description: "exact release tag to install, such as v1.2.3 (default: the latest stable)", - ...field(z.string().optional(), cli.argument()), - }, - status: { - description: "report how the selected release compares, and change nothing", - ...field(z.boolean(), field.default(false)), - }, - allowDowngrade: { - description: "consent to installing a release older than the installed one", - ...field(z.boolean(), field.default(false)), - }, - allowPrerelease: { - description: "consent to installing the exact prerelease tag named", - ...field(z.boolean(), field.default(false)), - }, - journal: { - description: "write a diagnostic JSONL trace (path must not exist)", - aliases: ["-j"], - ...field(z.string().optional()), - }, -}); - /** The version this build reports, from the manifest it was built with. */ -export const XMD_VERSION: string = denoJson.version; - -const xmd = program({ - name: "xmd", - version: XMD_VERSION, - config: commands( - { - run: runConfig, - plan: { ...planConfig, description: PLAN_DESCRIPTION }, - test: testConfig, - syntax: syntaxConfig, - upgrade: { ...upgradeConfig, description: UPGRADE_DESCRIPTION }, - "test-agent": testAgentConfig, - workflow: workflowConfig, - }, - { default: "run" }, - ), -}); +export { XMD_VERSION } from "./cli-route.ts"; /** The switches `xmd upgrade` defines, and the whole of what it accepts. */ const UPGRADE_SWITCHES: readonly string[] = ["--status", "--allow-downgrade", "--allow-prerelease"]; @@ -1293,7 +1031,13 @@ interface TestConfig extends Omit { * schema still produces "." for an omitted argument. */ path?: string; - pattern: string[]; + /** + * Absent when the caller wrote no `--pattern`, which is a fact this command + * needs: a pattern written against a single document is refused, so the + * default cannot come from the schema. {@link DEFAULT_PATTERN} is applied + * here instead. + */ + pattern?: string[]; } /** @@ -1305,31 +1049,26 @@ interface TestConfig extends Omit { */ function* test( config: TestConfig, - args: string[], installService: HostServiceInstaller, /** What a `` child installs. This command installs none. */ installRepositories: RepositoryInstaller, ): Operation { - const patterns = readPatternFlags(args); - if (patterns.missingValue) { - console.error( - `${PATTERN_OPTION} requires a value — write \`${PATTERN_OPTION} \`, or ` + - `\`${PATTERN_OPTION}=\` for a glob that begins with "-"`, - ); - yield* exit(1); - return; - } - if (patterns.values.some((value) => value.length === 0)) { + // What the caller wrote, which the model states directly: the parameter is + // declared repeatable and carries no schema default, so absence is absence. + // A missing or dash-leading value was already refused by the parse. + const written = config.pattern ?? []; + if (written.some((value) => value.length === 0)) { console.error(`${PATTERN_OPTION} requires a glob — an empty pattern matches nothing`); yield* exit(1); return; } const path = config.path ?? "."; - const target = yield* resolveTestTarget(path, config.pattern); + const patterns = written.length > 0 ? written : DEFAULT_PATTERN; + const target = yield* resolveTestTarget(path, patterns); if (target.kind === "file") { - if (patterns.values.length > 0) { + if (written.length > 0) { console.error( `unrecognized option for xmd test: ${PATTERN_OPTION} — ${path} is a single document, ` + `so there is nothing to search`, @@ -1367,7 +1106,7 @@ function* test( } if (target.documents.length === 0) { - console.error(`no documents matched ${config.pattern.join(", ")} in ${path}`); + console.error(`no documents matched ${patterns.join(", ")} in ${path}`); yield* exit(1); return; } @@ -1448,6 +1187,12 @@ interface HelpRequest { /** * Remove `--help` wherever it appears so document-aware help works in * every documented position. `--version` keeps its own handling. + * + * Retained under the route API rather than retired to it. Configliere lifts + * both controls itself and settles a method from them, but a help intent + * carries no model, and every document-aware page is built from the document + * the command line named. So the controls are removed here for the parse that + * produces a model, and reinstated for the parse that produces the intent. */ function takeHelpFlag(args: string[]): HelpRequest { const kept: string[] = []; @@ -1474,48 +1219,158 @@ function findPropsFlag(args: string[]): string | undefined { const PATTERN_OPTION = "--pattern"; -interface PatternFlags { - /** Values the caller wrote, in the order they wrote them. */ - values: string[]; - /** A `--pattern` that ran out of argv or was followed by another option. */ - missingValue: boolean; -} +/** The globs `xmd test` searches a directory with when nobody writes one. */ +const DEFAULT_PATTERN = ["**/*.test.md"]; /** - * Read `--pattern` from argv. - * - * The resolved configuration answers none of the questions this serves. It - * cannot say whether the option was given at all — the default is a real - * value, indistinguishable from a typed one — and it hides unusable input: the - * parser picks the last *valid* source, so an empty pattern falls back to the - * default, and it happily reads the next option as the glob. + * The refusal a command owns for an option that belongs to another one. * - * A separated value that begins with `-` is another option, not a glob; - * `--pattern=` expresses a glob that really does begin with one. + * Each of these names the command, the option and where the option does + * belong, which is more than "unexpected token" says. They are read from raw + * argv, so they answer before a parse does and stay the invocation's first + * failure whether or not the route grammar also refused the token. */ -function readPatternFlags(args: string[]): PatternFlags { - const values: string[] = []; - let missingValue = false; +function strayCommandOption(command: string, args: string[]): string | undefined { + if (command === "test") { + const strayTimeout = findTimeoutFlag(args); + if (strayTimeout) { + return ( + `unrecognized option for xmd test: ${strayTimeout} — timeout options are exclusive ` + + `to ${belongsTo(strayTimeout)}` + ); + } + } + const agentFlag = findAgentOnlyFlag(args); + if (agentFlag) { + return ( + `unrecognized option for xmd ${command}: ${agentFlag} — agent options are exclusive ` + + `to ${belongsTo(agentFlag)}` + ); + } + if (command === "test") { + const propsFlag = findPropsFlag(args); + if (propsFlag) { + return ( + `unrecognized option for xmd test: ${propsFlag} — document properties are ` + + "exclusive to xmd run" + ); + } + } + return undefined; +} - for (const [index, arg] of args.entries()) { +/** What a run says when the command line named no root document. */ +const MISSING_ROOT_DOCUMENT = + "xmd run requires a root document — `xmd run `, `xmd run -`, or " + + `\`xmd run ${EVAL_OPTION} ''\``; + +/** + * The command line up to its first document property. + * + * A document's generated options exist only once the document does, and the + * document is what this parse is being asked to find. The released parser + * stopped at the first token it did not define, which is exactly the first + * `--props` occurrence; the tokens after it are read later, by + * `extractPropsArgs`, against the bindings the inspected document declares. + * A `--props` written after `--` is a literal and stops nothing. + */ +function beforeProperties(args: readonly string[]): string[] { + const kept: string[] = []; + for (const arg of args) { if (arg === "--") { + kept.push(...args.slice(kept.length)); break; } - if (arg === PATTERN_OPTION) { - const value = args[index + 1]; - if (value === undefined || value.startsWith("-")) { - missingValue = true; - continue; - } - values.push(value); - continue; - } - if (arg.startsWith(`${PATTERN_OPTION}=`)) { - values.push(arg.slice(PATTERN_OPTION.length + 1)); + if (arg === AGGREGATE_OPTION || arg.startsWith(`${AGGREGATE_OPTION}`)) { + break; } + kept.push(arg); + } + return kept; +} + +/** Everything one command line carries that the route grammar cannot bind. */ +interface LiftedArgs { + /** argv with every lifted token removed, ready to parse. */ + args: string[]; + /** + * argv with the root references removed and nothing else. + * + * What the document phase reads. Truncating at the first property serves the + * parse alone: the properties are classified later, against the bindings the + * document declares. + */ + retained: string[]; + /** Every root document reference the option grammar leaves unwritable. */ + references: string[]; + /** Whether the caller wrote a version control anywhere in argv. */ + version: boolean; +} + +const VERSION_CONTROLS = new Set(["-v", "--version"]); + +/** + * Lift what the route grammar cannot bind, and say what was lifted. + * + * Two things only: the version control, because the parse this produces is the + * one that has to yield a model, and the root document references the option + * grammar leaves unwritable. Repeatable options are the routes' own now. + */ +function liftArgs(args: string[]): LiftedArgs { + const command = commandToken(args); + const version = args.some((arg) => VERSION_CONTROLS.has(arg)); + const controlled = beforeProperties(args).filter((arg) => !VERSION_CONTROLS.has(arg)); + // Only a run names a root document, and only a run's grammar leaves `-` + // unwritable. Every other command keeps the meaning it already gives the + // token, which is what `xmd test -` relies on. + const recover = command === undefined || command === "run"; + const recovered = readDocumentArguments(controlled, recover); + return { + args: recovered.args, + retained: readDocumentArguments(args, recover).args, + references: recovered.references, + version, + }; +} + +/** + * The intent the controls settle, when the caller wrote one. + * + * The same command line, parsed with the control reinstated, so Configliere + * chooses the route the control applies to and refuses the route that does + * not offer the method. + */ +function controlOutcome(help: boolean, lifted: LiftedArgs): ParseOutcome | undefined { + const control = help ? "--help" : lifted.version ? "--version" : undefined; + if (control === undefined) { + return undefined; } + // Written first, because `--` quotes everything after it: a control written + // past the separator is a literal and is never lifted. + return parseLifted({ ...lifted, args: [control, ...lifted.args] }); +} + +/** Parse one lifted command line against the tree its first token selects. */ +function parseLifted(lifted: LiftedArgs): ParseOutcome { + return commandToken(lifted.args) === undefined + ? parseShorthand(lifted.args) + : parseCommands(lifted.args); +} - return { values, missingValue }; +/** The intent one parse settled on, when it settled on one. */ +function settledIntent(outcome: ParseOutcome): AnyXmdIntent | undefined { + return outcome.ok ? outcome : undefined; +} + +/** The root document reference one execute intent bound, when it bound one. */ +function boundPath(intent: AnyXmdIntent | undefined): string | undefined { + if (intent === undefined || !isExecute(intent)) { + return undefined; + } + if (intent.route === "/" || intent.route === "/run") { + return intent.model.path; + } + return undefined; } interface PropsPhase { @@ -1578,85 +1433,81 @@ function namesRun(args: string[]): boolean { return args[0] === "run"; } -interface DocumentArgument { - /** The reference the caller wrote, as they wrote it. */ - reference: string; - /** argv with that token, and the separator protecting it, removed. */ - rest: string[]; -} - /** A reference's path half: everything before its first raw `#`. */ function referencePath(reference: string): string { const fragment = reference.indexOf("#"); return fragment === -1 ? reference : reference.slice(0, fragment); } -/** - * The document argument a run named that the parser could not take. - * - * Configliere refuses every positional beginning with `-` and defines no - * end-of-options separator, so `-` is the one filename its option grammar - * leaves unwritable — and a reference selecting a section of that file is - * written the same way. Both are read out of the parser's own remainder, the - * tokens it did not consume, rather than out of raw argv, where a `-` another - * option took as its value (`--journal -`) looks identical. - * - * Nothing else beginning with `-` is one. A mistyped option stays an option the - * parser does not define, so a run written with one still refuses for want of a - * root rather than going looking for a file named after the flag. - * - * Removing the token is what lets everything written around it — before it or - * after it — parse as it would around an ordinary path. - */ -function takeDocumentArgument(args: string[], remainder: string[]): DocumentArgument | undefined { - const separated = remainder[0] === "--"; - const [reference] = separated ? remainder.slice(1, 2) : remainder; - if (reference === undefined || referencePath(reference) !== STANDARD_INPUT_ARGUMENT) { - return undefined; - } - const at = args.length - remainder.length; - if (args[at] !== remainder[0]) { - return undefined; - } - return { reference, rest: [...args.slice(0, at), ...remainder.slice(separated ? 2 : 1)] }; -} - interface RunGrammar { - /** Every reference the parser could not take, in the order written. */ + /** Every reference the route grammar could not take, in the order written. */ references: string[]; /** argv with all of them removed. */ args: string[]; - /** The parse of that argv. */ - parsed: ReturnType; } /** - * Read every document argument a run named, not just the first. + * Read every document argument a run named that the route grammar cannot take. * - * The parser stops at the first token it does not define, so one pass sees one - * of them. A run that named two roots — a path and a `-`, two `-`s, a reference - * and a path — has to refuse whichever order they were written in, and it can - * only do that once all of them are known. Each pass removes one token, so this - * terminates; what comes back is what the run actually wrote. + * Tokenization decides this, and it decides it before routing: a bare `-` is a + * word an `argument()` can claim, `-#Section` is a flag no argument will ever + * see, and every token after `--` is a literal that reaches the intent instead + * of a parameter. All three spell the same thing here — the one filename the + * option grammar leaves unwritable, optionally carrying a target selector — so + * all three are lifted out of argv before the parse and reported together. + * + * A value another option took (`--journal -`) is not one, which is why the + * scan skips each value-taking flag with its value. Nothing else beginning + * with `-` is one either: a mistyped option stays an option, and a run written + * with one refuses for want of a root rather than looking for a file named + * after the flag. */ function readDocumentArguments(head: string[], recover: boolean): RunGrammar { - let args = head; - let parsed = xmd.parse({ args }); + const takesValue = valueFlags(); const references: string[] = []; - while (recover) { - const config = parsed.ok && !parsed.value.config.help ? parsed.value.config : undefined; - if (config?.name !== "run") { - break; + const args: string[] = []; + let separated = false; + + for (let index = 0; index < head.length; index += 1) { + const token = head[index]; + if (token === undefined) { + continue; } - const taken = takeDocumentArgument(args, parsed.remainder.args ?? []); - if (taken === undefined) { - break; + if (!separated && token === "--") { + const next = head[index + 1]; + if (recover && next !== undefined && referencePath(next) === STANDARD_INPUT_ARGUMENT) { + references.push(next); + index += 1; + continue; + } + separated = true; + args.push(token); + continue; } - references.push(taken.reference); - args = taken.rest; - parsed = xmd.parse({ args }); + if (!separated && takesValue.has(token)) { + args.push(token); + const value = head[index + 1]; + if (value !== undefined) { + args.push(value); + index += 1; + } + continue; + } + if (!separated && referencePath(token) === STANDARD_INPUT_ARGUMENT) { + // A command that names no root document is not offered the token + // either. The released parser refused every positional beginning with + // `-`, so `xmd test -` searched for documents rather than opening a + // file called `-`, and a bare `-` is a word this tokenizer would hand + // straight to that command's own argument. + if (recover) { + references.push(token); + } + continue; + } + args.push(token); } - return { references, args, parsed }; + + return { references, args }; } /** @@ -1723,42 +1574,29 @@ function* preparePropsPhase( return { args: scan.fixed, bindings: [], plan: scan }; } - // `xmd workflow` reads its options from the head and its remaining positionals - // from the tail. The parser only ever sees the head, so a dash-leading token - // after `--` is never offered to it as an option; the grammar check below - // still sees the argv that had the separator, because where options stopped - // is what decides whether a later token is a third positional. + // A `workflow` positional written after `--` reaches the intent as a + // literal rather than as an argument, so the whole argv is offered to the + // parse and the tail is read back from the intent. A run's roots are lifted + // instead: every other command keeps whatever `-` already means to it. const workflow = namesWorkflow(args); - const separated = separateArgs(args); - const head = workflow ? separated.head : args; - // A run's parse takes at most one path, and a token beginning with `-` it - // takes none of. Every other command keeps whatever `-` already means to it. - const recovered = readDocumentArguments(head, !workflow); - const fixed = recovered.references.length === 0 ? args : recovered.args; - const parsed = recovered.args; - const provisional = recovered.parsed; - // `program` short-circuits on `--version` and leaves no configuration - // behind, so there is nothing to inspect. - const selected = provisional.ok ? provisional.value.config : undefined; - const command = selected && !selected.help ? selected.name : undefined; - const parsedPath = - selected && !selected.help && selected.name === "run" ? selected.config.path : undefined; - const roots = writtenRoots(head, recovered.references, parsedPath); + const lifted = liftArgs(args); + const fixed = lifted.retained; + const parsed = lifted.retained; + const outcome = parseLifted(lifted); + const intent = settledIntent(outcome); + const command = commandToken(args); + const parsedPath = boundPath(intent); + const roots = writtenRoots(args, lifted.references, parsedPath); // The sentinel is one exact argument on one command form. Only the form the // caller wrote separates `xmd run -` from the shorthand `xmd -`, which - // resolves to the same parsed command and names a file called `-`. - const standardInput = namesRun(args) && recovered.references.includes(STANDARD_INPUT_ARGUMENT); + // resolves to the same route and names a file called `-`. + const standardInput = namesRun(args) && lifted.references.includes(STANDARD_INPUT_ARGUMENT); const describeRoot = (root: string): string => standardInput && root === STANDARD_INPUT_ARGUMENT ? "standard input" : root; const [supplied] = evalFlags.values; - if (selected && !selected.help && selected.name === "workflow") { - return yield* prepareWorkflowProps( - args, - parsed, - { ...selected.config, ...workflowPositionals(selected.config, separated.tail) }, - supplied, - ); + if (workflow) { + return yield* prepareWorkflowProps(args, parsed, workflowRequestOf(intent, args), supplied); } if (supplied !== undefined && command !== undefined && command !== "run") { @@ -2075,44 +1913,201 @@ function extraWorkflowArgument(args: string[], action?: string): string | undefi return undefined; } +/** Everything one `xmd workflow` invocation asks for, by the action it names. */ +interface WorkflowConfig { + action?: string; + target?: string; + argument?: string; + value?: string; + id?: string; + at?: string; + verbose: boolean; + raw: boolean; + secretDetection: boolean; + json: boolean; + forkable: boolean; + status?: string; + artifact?: string; + output?: string; +} + +/** What an invocation that named no action at all asks for. */ +const NO_WORKFLOW_ACTION: WorkflowConfig = { + verbose: false, + raw: false, + secretDetection: true, + json: false, + forkable: false, +}; + /** - * An argv split at its end-of-options separator. + * The action, its positionals and its options, read from the intent. * - * The tail is carried rather than folded back in. Dropping the separator and - * rejoining would hand a dash-leading positional — `-run-id`, `-definition.md` - * — back to a parser that reads a leading dash as an option, which is exactly - * what `--` was written to prevent. + * Every action is its own route, so each model holds only what that action + * accepts and the action itself is the route rather than a field. A positional + * written after `--` reaches the intent as a literal instead of an argument; + * the literals fill the remaining positional slots in the order they were + * written, because after the separator a token is positional by position + * rather than by spelling. */ -interface SeparatedArgs { - /** Everything before `--`: the options, and any positionals written early. */ - head: string[]; - /** Everything after it, each token positional however it is spelled. */ - tail: string[]; -} - -function separateArgs(args: string[]): SeparatedArgs { - const at = args.indexOf("--"); - return at === -1 - ? { head: args, tail: [] } - : { head: args.slice(0, at), tail: args.slice(at + 1) }; +function workflowRequestOf( + intent: AnyXmdIntent | undefined, + args: readonly string[], +): WorkflowConfig { + if (intent === undefined || !isExecute(intent)) { + return { ...NO_WORKFLOW_ACTION, action: workflowActionOf(args) }; + } + const literals = [...intent.literals].map((token) => token.text); + + switch (intent.route) { + case "/workflow/start": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "start", + target: intent.model.target, + id: intent.model.id, + verbose: intent.model.verbose, + raw: intent.model.raw, + secretDetection: intent.model.secretDetection, + }, + literals, + ); + case "/workflow/resume": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "resume", + target: intent.model.target, + verbose: intent.model.verbose, + raw: intent.model.raw, + secretDetection: intent.model.secretDetection, + }, + literals, + ); + case "/workflow/fork": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "fork", + target: intent.model.target, + argument: intent.model.argument, + id: intent.model.id, + at: intent.model.at, + verbose: intent.model.verbose, + raw: intent.model.raw, + secretDetection: intent.model.secretDetection, + }, + literals, + ); + case "/workflow/answer": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "answer", + target: intent.model.target, + argument: intent.model.argument, + value: intent.model.value, + secretDetection: intent.model.secretDetection, + }, + literals, + ); + case "/workflow/status": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "status", + target: intent.model.target, + json: intent.model.json, + artifact: intent.model.artifact, + }, + literals, + ); + case "/workflow/list": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "list", + json: intent.model.json, + status: intent.model.status, + }, + literals, + ); + case "/workflow/history": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "history", + target: intent.model.target, + json: intent.model.json, + forkable: intent.model.forkable, + artifact: intent.model.artifact, + }, + literals, + ); + case "/workflow/cancel": + return positioned( + { ...NO_WORKFLOW_ACTION, action: "cancel", target: intent.model.target }, + literals, + ); + case "/workflow/delete": + return positioned( + { ...NO_WORKFLOW_ACTION, action: "delete", target: intent.model.target }, + literals, + ); + case "/workflow/export": + return positioned( + { + ...NO_WORKFLOW_ACTION, + action: "export", + target: intent.model.target, + output: intent.model.output, + }, + literals, + ); + default: + return { ...NO_WORKFLOW_ACTION, action: workflowActionOf(args) }; + } } /** - * The subcommand and target one `xmd workflow` invocation names. + * The subcommand token one `xmd workflow` invocation wrote. * - * The parser classifies what it can — everything before `--` — and the tail - * supplies the rest in order. A token's spelling decides nothing here: after the - * separator it is positional because of where it is. + * Read from argv rather than from the intent, because the intent may not + * exist: a fourth positional or an unknown action is a parse failure, and + * both of those are refusals this command words itself. An action that names + * no route still has to be named back to the caller. */ -function workflowPositionals( - config: { action?: string; target?: string; argument?: string; value?: string }, - tail: string[], -): { action?: string; target?: string; argument?: string; value?: string } { - const named = [config.action, config.target, config.argument, config.value].filter( - (written) => written !== undefined, +function workflowActionOf(args: readonly string[]): string | undefined { + const takesValue = valueFlags(); + const start = args.indexOf("workflow"); + if (start === -1) { + return undefined; + } + for (let index = start + 1; index < args.length; index += 1) { + const token = args[index]; + if (token === undefined || token === "--") { + continue; + } + if (takesValue.has(token)) { + index += 1; + continue; + } + if (token.startsWith("-") && token !== "-") { + continue; + } + return token; + } + return undefined; +} + +/** The positional slots an action leaves open, filled from the literals. */ +function positioned(config: WorkflowConfig, literals: readonly string[]): WorkflowConfig { + const written = [config.target, config.argument, config.value].filter( + (slot) => slot !== undefined, ); - const [action, target, argument, value] = [...named, ...tail]; - return { action, target, argument, value }; + const [target, argument, value] = [...written, ...literals]; + return { ...config, target, argument, value }; } /** @@ -2168,8 +2163,6 @@ const UPGRADE_HELP = [ "leaves the installed xmd exactly as it was.", ].join("\n"); -const COMMAND_NAMES = ["run", "plan", "test", "syntax", "upgrade", "test-agent", "workflow"]; - /** * What a caller has to know to write a filename that contains reference * syntax, and where the sections it can select are listed. @@ -2249,24 +2242,31 @@ const PLAN_REQUEST_HELP = [ * during the props phase is reinstated there rather than falling back to * program help. */ -function renderHelp(phase: PropsPhase): string { - const [first] = phase.args; - const command = COMMAND_NAMES.includes(first) ? first : phase.root ? "run" : undefined; +function renderHelp(phase: PropsPhase, intent: AnyXmdIntent | undefined): string { + // The help intent names the deepest route the caller selected, which is the + // definition to describe. A shorthand run selects the root, and the root is + // the program page unless a document was named — in which case the page is + // the named `run` command's, exactly as it has always been. + const selected = intent !== undefined && isHelp(intent) ? [...intent.path] : []; + const path = selected.length > 0 ? selected : phase.root ? ["run"] : []; - if (!command) { - return xmd.help({ args: phase.args }); + if (path.length === 0) { + return renderProgramHelp(); } - const help = xmd.parse({ args: [command, "--help"] }); - const base = help.ok && help.value.config.help ? help.value.config.text : xmd.help({ args: [] }); + const definition = routeFor(path); + const base = definition === undefined ? renderProgramHelp() : renderRouteHelp(definition, path); + const [command] = path; const epilogue = - command === "run" - ? RUN_SOURCE_HELP - : command === "plan" - ? PLAN_REQUEST_HELP - : command === "upgrade" - ? UPGRADE_HELP - : ""; + path.length > 1 + ? "" + : command === "run" + ? RUN_SOURCE_HELP + : command === "plan" + ? PLAN_REQUEST_HELP + : command === "upgrade" + ? UPGRADE_HELP + : ""; const withSource = epilogue === "" ? base : `${base}\n\n${epilogue}`; if (!phase.root) { @@ -2346,7 +2346,7 @@ function* resolveRunProps( */ function* dispatch( evalFlags: EvalFlags, - helpRequest: { requested: boolean; args: string[] }, + helpRequest: HelpRequest, installService: HostServiceInstaller, upgrade: UpgradeAssembly, installRepositories: RepositoryInstaller, @@ -2376,31 +2376,111 @@ function* dispatch( return; } - const parsed = xmd.parse({ args: propsPhase.args }); + // The second parse of this invocation, and the dynamic-phase typing gap is + // why there is one. The first ran in the props phase to find the document; + // this one runs against the argv that phase stripped of the options that + // document declares. + // + // `dynamic()` can add those options at runtime — measured, including nested + // routes at arbitrary depth. What it cannot do is describe them: when the + // resolver's element list is derived at runtime, as a document's declared + // properties are, the parse type collapses to a fully resolved union. The + // increment disappears from it, `resume` types as `unknown`, and the model + // reports the phase after the boundary instead of the one before it. Driving + // it would take a cast, so the argv is prepared before parsing instead. + // + // Two parses of the same command line, and they answer different questions. + // The control parse keeps `-h` and `--version` in argv, so Configliere + // settles the method and the route it applies to. The model parse has them + // removed, because a help or version intent carries no model and every + // document-aware page needs the document the command line named. + const lifted = liftArgs(propsPhase.args); + const settled = parseLifted(lifted); + const controls = controlOutcome(helpRequest.requested, lifted); + const intent = settledIntent(controls ?? settled); if (helpRequest.requested) { - console.log(renderHelp(propsPhase)); + console.log(renderHelp(propsPhase, intent)); yield* exit(0); return; } - if (!parsed.ok) { - console.error(parsed.error.message); - yield* exit(1); + // A root version request writes the bare version. Every other route answers + // it the way it always has: `--version` is an option that route does not + // define, and its own grammar reports it. + if (lifted.version && intent !== undefined && isVersion(intent) && intent.route === "/") { + console.log(renderVersion(intent)); + yield* exit(0); return; } - const { version, config: command } = parsed.value; + // Before the parse is answered, because the `=` spelling reaches the toggle + // as a setter it does not read and is then reported as an unexpected token. + // The safety message is the one a caller who wrote it needs. + const secretDetectionError = secretDetectionGrammarError(evalFlags.rest); + if (secretDetectionError) { + console.error(secretDetectionError); + yield* exit(1); + return; + } - if (version) { - console.log(version); - yield* exit(0); + if (!settled.ok) { + // The released parser stopped at the first token it did not define and + // refused none of them, so a run written with a mistyped option refused + // for want of a root. That refusal is the accepted message, and the stock + // diagnostic does not replace it. + const runForm = + commandToken(propsPhase.args) === undefined || commandToken(propsPhase.args) === "run"; + if (runForm && propsPhase.root === undefined && unexpectedOnly(settled)) { + console.error(MISSING_ROOT_DOCUMENT); + yield* exit(1); + return; + } + // An option that belongs to another command is refused by name, because + // the command knows where it does belong and the route layer only knows + // that it did not expect it. + const command = commandToken(propsPhase.args); + const stray = command === undefined ? undefined : strayCommandOption(command, evalFlags.rest); + if (stray !== undefined) { + console.error(stray); + yield* exit(1); + return; + } + // `xmd upgrade` reads its own fixed grammar, and it enumerates what the + // command accepts. That sentence is the one a caller needs, and it is + // written before the packaged policy exists. + if (command === "upgrade") { + const scan = scanUpgradeArgs(helpRequest.args); + if (scan.error !== undefined) { + console.error(scan.error); + yield* exit(1); + return; + } + } + // `xmd workflow` names its own refusals — a missing subcommand, one it + // does not define, an option belonging to another action. The route layer + // reports that the address supports no execution, which is true and is + // not what a caller who wrote `xmd workflow` needs to read. + if (namesWorkflow(propsPhase.args)) { + const refused = parseWorkflowRequest( + { ...workflowRequestOf(undefined, propsPhase.args), ...propsPhase.workflow }, + evalFlags.rest, + ); + if (!refused.ok) { + console.error(refused.error.message); + yield* exit(1); + return; + } + } + console.error(parseFailure(settled).message); + yield* exit(1); return; } - if (command.help) { - console.log(command.text); - yield* exit(0); + const command = settled; + if (!isExecute(command)) { + console.error(`xmd does not support ${command.method}`); + yield* exit(1); return; } @@ -2414,24 +2494,15 @@ function* dispatch( return; } - const secretDetectionError = secretDetectionGrammarError(evalFlags.rest); - if (secretDetectionError) { - console.error(secretDetectionError); - yield* exit(1); - return; - } - - switch (command.name) { - case "run": { - const config = command.config; + switch (command.route) { + case "/": + case "/run": { + const config = command.model; // Reported here rather than in the props phase: `xmd run --help` and // `xmd --help` describe the command without one, and they are handled // above. if (!propsPhase.root) { - console.error( - "xmd run requires a root document — `xmd run `, `xmd run -`, or " + - `\`xmd run ${EVAL_OPTION} ''\``, - ); + console.error(MISSING_ROOT_DOCUMENT); yield* exit(1); break; } @@ -2492,8 +2563,8 @@ function* dispatch( } break; } - case "plan": { - const config = command.config; + case "/plan": { + const config = command.model; const scan = propsPhase.plan; if (scan?.request === undefined) { console.error('xmd plan names the command first — write `xmd plan "" [options]`'); @@ -2545,7 +2616,7 @@ function* dispatch( } break; } - case "upgrade": { + case "/upgrade": { // Fixed grammar first, and it reads nothing: a command line this command // does not define is answered before the packaged policy exists, before // the installation is opened and before GitHub is asked anything. @@ -2606,63 +2677,39 @@ function* dispatch( } break; } - case "test": { - const strayTimeout = findTimeoutFlag(evalFlags.rest); - if (strayTimeout) { - console.error( - `unrecognized option for xmd test: ${strayTimeout} — timeout options are exclusive to ` + - belongsTo(strayTimeout), - ); - yield* exit(1); - break; - } - const agentFlag = findAgentOnlyFlag(evalFlags.rest); - if (agentFlag) { - console.error( - `unrecognized option for xmd test: ${agentFlag} — agent options are exclusive to ` + - belongsTo(agentFlag), - ); - yield* exit(1); - break; - } - const propsFlag = findPropsFlag(evalFlags.rest); - if (propsFlag) { - console.error( - `unrecognized option for xmd test: ${propsFlag} — document properties are exclusive to ` + - "xmd run", - ); + case "/test": { + const stray = strayCommandOption("test", evalFlags.rest); + if (stray !== undefined) { + console.error(stray); yield* exit(1); break; } yield* test( - { ...command.config, retainProcessOutput: keepsProcessOutput(command.config.journal) }, - evalFlags.rest, + { ...command.model, retainProcessOutput: keepsProcessOutput(command.model.journal) }, installService, installRepositories, ); break; } - case "syntax": { + case "/syntax": { // One inspection per invocation, then one complete document. A failure // writes nothing to stdout: a healthy subset printed as though it were // the whole set of symbols would read as complete. let rendered: string; try { - const named = command.config.component; + const named = command.model.component; if (named === undefined) { // The compact list of symbols, unchanged: routine discovery output and // every default Plan prompt read it, and long documentation would make // both unnecessarily large. - const catalog = yield* syntaxSymbols(command.config.include); - rendered = command.config.json - ? renderSyntaxJson(catalog) - : renderSyntaxMarkdown(catalog); + const catalog = yield* syntaxSymbols(command.model.include); + rendered = command.model.json ? renderSyntaxJson(catalog) : renderSyntaxMarkdown(catalog); } else { // The same selection, index and renderer `` uses, so // the command and the component cannot describe one component two // ways. JSON stays the compact projection; it is the symbols' shape, // and documentation is prose rather than a symbol member. - rendered = yield* renderSyntaxDocumentation(command.config.include, [named]); + rendered = yield* renderSyntaxDocumentation(command.model.include, [named]); } } catch (error) { console.error(describeError(error)); @@ -2681,20 +2728,27 @@ function* dispatch( } break; } - case "test-agent": - yield* runTestAgentWorker({ connect: command.config.connect }); + case "/test-agent": + yield* runTestAgentWorker({ connect: command.model.connect }); break; - case "workflow": { - // The parser saw only the head, so the positionals the separator carried - // come from the props phase rather than from a second parse of an argv - // they are not in. - const config = { ...command.config, ...propsPhase.workflow }; - const agentFlag = findAgentOnlyFlag(evalFlags.rest); - if (agentFlag) { - console.error( - `unrecognized option for xmd workflow: ${agentFlag} — agent options are exclusive to ` + - belongsTo(agentFlag), - ); + case "/workflow/start": + case "/workflow/resume": + case "/workflow/fork": + case "/workflow/answer": + case "/workflow/status": + case "/workflow/list": + case "/workflow/history": + case "/workflow/cancel": + case "/workflow/delete": + case "/workflow/export": { + // Every action is its own route, so the model is that action's alone and + // the action itself is the route. The positionals the props phase + // established stay authoritative: they were read from the argv that + // still had its separator. + const config = { ...workflowRequestOf(command, propsPhase.args), ...propsPhase.workflow }; + const stray = strayCommandOption("workflow", evalFlags.rest); + if (stray !== undefined) { + console.error(stray); yield* exit(1); break; } @@ -2855,18 +2909,15 @@ export function* runXmd( // Help, `--version`, and the commands that execute nothing stay outside a run // lifecycle, which is why the timeout options are read only for the two that // end in one. - const provisional = xmd.parse({ args: helpRequest.args }); - const selected = provisional.ok ? provisional.value.config : undefined; + const provisional = settledIntent(parseLifted(liftArgs(helpRequest.args))); + const selected = + provisional !== undefined && isExecute(provisional) ? provisional.route : undefined; // The two commands a `--timeout` bounds. `xmd plan`'s deadline encloses // something different from a run's — the symbols, the assistant session, // every repair, the human review, provider teardown, final validation and the // artifact — and covers no later program, because it starts none. - const planning = selected !== undefined && !selected.help && selected.name === "plan"; - const bounded = - !helpRequest.requested && - selected !== undefined && - !selected.help && - (selected.name === "run" || planning); + const planning = selected === "/plan"; + const bounded = !helpRequest.requested && (selected === "/" || selected === "/run" || planning); if (!bounded) { return yield* dispatch( diff --git a/packages/cli/src/props.ts b/packages/cli/src/props.ts index 909e791e..8be2a466 100644 --- a/packages/cli/src/props.ts +++ b/packages/cli/src/props.ts @@ -3,12 +3,11 @@ * `props` schema to command-line and environment configuration sources * (specs/root-document-props-spec.md). * - * Configliere owns precedence, provenance, and diagnostics. This module - * supplies it with sources. + * This module owns precedence, provenance, and diagnostics. The route API + * reports a model and a flat list of issues and has no per-source inspection, + * so which source supplied a value cannot be recovered from a parse. */ import type { StandardSchemaV1 } from "@standard-schema/spec"; -import { createContext, field, object } from "configliere"; -import type { Parser } from "configliere"; import type { Json } from "@executablemd/durable-streams"; import { env as readEnv } from "@executablemd/runtime"; import type { Operation } from "effection"; @@ -665,53 +664,6 @@ function toJson(value: unknown, source: string): Json { throw new PropsError(`${source} supplied a value that is not JSON`); } -interface Source { - sourceName: string; - sourceType: string; - issues?: readonly StandardSchemaV1.Issue[]; -} - -interface FieldView { - sources: Source[]; - value?: unknown; - ok: boolean; -} - -function readSources(value: unknown): Source[] { - if (!Array.isArray(value)) { - return []; - } - const sources: Source[] = []; - for (const entry of value) { - if (typeof entry !== "object" || entry === null) { - continue; - } - if (!("sourceName" in entry) || !("sourceType" in entry)) { - continue; - } - const { sourceName, sourceType } = entry; - if (typeof sourceName !== "string" || typeof sourceType !== "string") { - continue; - } - const issues = "issues" in entry && Array.isArray(entry.issues) ? entry.issues : undefined; - sources.push({ sourceName, sourceType, issues }); - } - return sources; -} - -function readField(info: unknown): FieldView | undefined { - if (typeof info !== "object" || info === null || !("result" in info)) { - return undefined; - } - const { result } = info; - if (typeof result !== "object" || result === null || !("ok" in result)) { - return undefined; - } - const sources = "sources" in info ? readSources(info.sources) : []; - const ok = result.ok === true; - return { sources, ok, value: ok && "value" in result ? result.value : undefined }; -} - export interface ResolveOptions { propsSchema: unknown; bindings: Binding[]; @@ -722,12 +674,20 @@ export interface ResolveOptions { } /** - * Resolve every declared property through Configliere, then hand the - * result to core for authoritative validation. + * Resolve every declared property, then hand the result to core for + * authoritative validation. + * + * Sources are collected in ascending priority, one sparse entry per + * individual binding so a diagnostic names the exact option or variable that + * supplied the offending value. The highest-priority source that supplied a + * property decides it, and an invalid value there is reported rather than + * passed over for a valid lower-priority one. * - * Sources are supplied in ascending priority, one sparse entry per - * individual binding so a diagnostic names the exact option or variable - * that supplied the offending value. + * The walk is XMD's own. The proposed route API reports a model and a flat + * list of issues; it has no per-source inspection at all, so which source + * supplied a value — and which of several failed — cannot be recovered from + * a parse. Nothing here is a command line: these sources are the properties + * the CLI already lifted out of argv and the environment. */ export function resolveProps(options: ResolveOptions): Record { const { propsSchema, bindings, individual, aggregateCli, aggregateEnv, individualEnv } = options; @@ -736,7 +696,7 @@ export function resolveProps(options: ResolveOptions): Record { const properties = schema.properties ?? {}; const arrayBindings = new Map(bindings.map((binding) => [binding.property, binding])); - const attrs: Record>> = {}; + const attrs: Record> = {}; for (const [property, declaration] of Object.entries(properties)) { const members = readSchema(deref(declaration, propsSchema)).enum; const native = @@ -746,10 +706,10 @@ export function resolveProps(options: ResolveOptions): Record { } const binding = arrayBindings.get(property); const item = binding?.array ? elementOf(native) : undefined; - attrs[property] = { ...field(lossless(native, item)) }; + attrs[property] = lossless(native, item); } - const values: { name: string; value: unknown }[] = []; + const values: { name: string; value: Record }[] = []; const aggregates: Record[] = []; if (aggregateEnv !== undefined) { @@ -779,12 +739,10 @@ export function resolveProps(options: ResolveOptions): Record { }); } - const parser = object>(attrs); - const info = parser.inspect(createContext({ args: [], values })); const props: Record = {}; - // Undeclared keys never reach a field, so they are merged first and - // then overwritten by anything a declared field resolved. Whole-object + // Undeclared keys reach no schema, so they are merged first and then + // overwritten by anything a declared property resolved. Whole-object // validation decides whether `additionalProperties` accepts them. for (const aggregate of aggregates) { for (const [key, value] of Object.entries(aggregate)) { @@ -795,32 +753,39 @@ export function resolveProps(options: ResolveOptions): Record { } for (const property of Object.keys(properties)) { - const child = readField(info.attrs[property]); - if (!child) { + const native = attrs[property]; + if (!native) { continue; } - const supplied = child.sources.filter( - (source) => source.sourceType !== "none" && source.sourceType !== "default", - ); - if (supplied.length === 0) { + const highest = highestSource(values, property); + if (highest === undefined) { continue; } - // Configliere selects the last valid source, so an invalid - // higher-priority value would otherwise disappear behind a valid - // lower-priority one. - const highest = supplied[supplied.length - 1]; - if (highest.issues) { - const detail = highest.issues.map((issue) => issue.message).join("; "); - throw new PropsError(`${highest.sourceName}: ${detail}`); - } - if (child.ok) { - props[property] = toJson(child.value, highest.sourceName); + const validated = validate(native, highest.value); + if (validated.issues) { + const detail = validated.issues.map((issue) => issue.message).join("; "); + throw new PropsError(`${highest.name}: ${detail}`); } + props[property] = toJson(validated.value, highest.name); } return props; } +/** The last source that supplied this property, which is the highest one. */ +function highestSource( + values: readonly { name: string; value: Record }[], + property: string, +): { name: string; value: unknown } | undefined { + for (let index = values.length - 1; index >= 0; index -= 1) { + const source = values[index]; + if (source !== undefined && Object.hasOwn(source.value, property)) { + return { name: source.name, value: source.value[property] }; + } + } + return undefined; +} + /** * Resolve one document's properties from every source this host offers. * diff --git a/packages/cli/src/workflow.ts b/packages/cli/src/workflow.ts index a585232b..c1ad2626 100644 --- a/packages/cli/src/workflow.ts +++ b/packages/cli/src/workflow.ts @@ -66,7 +66,6 @@ import { Err, Ok, ensure, scoped, until } from "effection"; import type { Operation, Result } from "effection"; -import { field, object, cli } from "configliere"; import { z } from "zod"; import type { DurableEvent, DurableStream, Json } from "@executablemd/durable-streams"; import { retainedSource, validateProps } from "@executablemd/core"; @@ -219,74 +218,6 @@ const OPTIONS_BY_ACTION: Readonly> = Object.fr export: ["--output"], }); -export const workflowConfig = object({ - action: { - description: "start, resume, fork, answer, status, list, history, cancel, delete or export", - ...field(z.string().optional(), cli.argument()), - }, - target: { - description: - "markdown definition to start, the run a fork continues, or the run id every other " + - "action addresses", - ...field(z.string().optional(), cli.argument()), - }, - argument: { - description: "the definition a fork runs, or the wait an answer is delivered to", - ...field(z.string().optional(), cli.argument()), - }, - value: { - description: "the answer itself, as one JSON value (answer only)", - ...field(z.string().optional(), cli.argument()), - }, - id: { - description: "run id to create or address (start and fork only; generated when absent)", - ...field(z.string().optional()), - }, - at: { - description: "the retained event a fork continues from (fork only)", - ...field(z.string().optional()), - }, - verbose: { - description: "log journal entries to stderr", - aliases: ["-V"], - ...field(z.boolean(), field.default(false)), - }, - raw: { - description: "output raw markdown without normalization or terminal formatting", - ...field(z.boolean(), field.default(false)), - }, - secretDetection: { - description: - "scan durable events for credentials before they persist; " + - "disable with --no-secret-detection", - ...field(z.boolean(), field.default(true)), - }, - json: { - description: "write the inspection result as JSON (status, list and history only)", - ...field(z.boolean(), field.default(false)), - }, - forkable: { - description: "add each event's forkability to the history (history only)", - ...field(z.boolean(), field.default(false)), - }, - status: { - description: "list only runs retaining this status", - ...field(z.string().optional()), - }, - artifact: { - description: - "inspect this sealed .xmd artifact instead of a retained run (status and history only)", - ...field(z.string().optional()), - }, - output: { - description: - "the .xmd file to write the artifact to (export only); the artifact contains this " + - "run's complete retained Workspace, which may include source, generated files and " + - "secrets — treat it as confidential", - ...field(z.string().optional()), - }, -}); - /** What one execution invocation asks for, after the grammar has been read. */ export interface WorkflowRequest { readonly action: "start" | "resume" | "fork"; diff --git a/packages/cli/tests/configliere-route-api.test.ts b/packages/cli/tests/configliere-route-api.test.ts new file mode 100644 index 00000000..0c39c07c --- /dev/null +++ b/packages/cli/tests/configliere-route-api.test.ts @@ -0,0 +1,545 @@ +/** + * Tier CFE — the `xmd` command tree expressed through Configliere's proposed + * route API (issue #796). + * + * This is a production-boundary test for one evaluation: it exercises the real + * definitions in `packages/cli/src/cli-route.ts`, not a tree written for the + * occasion. What it proves is what the route API can and cannot express about + * the released `xmd` grammar. Behaviour a caller observes stays the business of + * the black-box suites, which are unchanged. + */ +import { describe, it } from "@executablemd/test-support/bdd"; +import { expect } from "@executablemd/test-support/expect"; +import { + argument, + checkpoint, + cli, + command, + dynamic, + extend, + name, + option, + parse, + routes, + schema, +} from "configliere"; +import type { AnyRoute, Execute, ModelsByRoute, Result, RoutePath, ValueSource } from "configliere"; +import { z } from "zod"; +import { + commandToken, + isExecute, + isHelp, + isVersion, + parseCommands, + parseFailure, + parseShorthand, + renderProgramHelp, + renderRouteHelp, + renderVersion, + routeFor, + unexpectedOnly, + valueFlags, + XMD_VERSION, +} from "../src/cli-route.ts"; +import type { AnyXmdIntent, ParseOutcome, XmdIntent } from "../src/cli-route.ts"; + +/** One command line, parsed the way the CLI parses it. */ +function run(argv: string[], values: readonly ValueSource[] = []): ParseOutcome { + return commandToken(argv) === undefined + ? parseShorthand(argv, values) + : parseCommands(argv, values); +} + +/** The intent one command line settles on, or a failure this test can read. */ +function intent(argv: string[], values: readonly ValueSource[] = []): AnyXmdIntent { + const outcome = run(argv, values); + if (!outcome.ok) { + throw new Error(`${argv.join(" ")}: ${parseFailure(outcome).message}`); + } + return outcome; +} + +/** The method and route one command line selects, as one readable string. */ +function selection(argv: string[]): string { + const outcome = run(argv); + if (!outcome.ok) { + return `${outcome.code} ${outcome.route}`; + } + return `${outcome.method.toUpperCase()} ${outcome.route}`; +} + +/** What one command line refuses with, or the empty string when it does not. */ +function refusal(argv: string[]): string { + const outcome = run(argv); + return outcome.ok ? "" : parseFailure(outcome).message; +} + +/** A settled parse, read back from a value whose type stopped describing it. */ +interface Settled { + route: string; + model: Record; +} + +/** + * Drive a definition whose dynamic phase builds its elements from the run. + * + * Every step here is read back by parsing the value rather than by reading a + * declared member, and that is the finding rather than a style choice: for a + * runtime-derived element list the parse type carries no increment, `resume` + * types as `unknown`, and the model type describes the wrong phase. A cast + * would hide exactly what this test exists to show. + */ +function driveDynamic(app: AnyRoute, argv: string[], declared: string[]): Settled | undefined { + let step: unknown = parse(app, { argv }); + for (let guard = 0; guard < 8; guard += 1) { + const resume = readResume(step); + if (resume === undefined) { + return readSettled(step); + } + step = resume({ ok: true, value: declared }); + } + return undefined; +} + +/** The resume of an increment, when the value is one. */ +function readResume( + step: unknown, +): ((result: { ok: true; value: string[] }) => unknown) | undefined { + if (typeof step !== "object" || step === null || !("resume" in step)) { + return undefined; + } + const { resume } = step; + if (typeof resume !== "function") { + return undefined; + } + return (result) => resume(result); +} + +function readSettled(step: unknown): Settled | undefined { + if (typeof step !== "object" || step === null || !("route" in step) || !("model" in step)) { + return undefined; + } + const { route, model } = step; + if (typeof route !== "string" || typeof model !== "object" || model === null) { + return undefined; + } + const entries = Object.entries(model).filter(([, value]) => value !== undefined); + return { route, model: Object.fromEntries(entries) }; +} + +/** + * Handlers written against one entry point each. + * + * Their parameter types are the only proof CFE3 needs: each one names the + * exact intent it accepts, reads its own model, and would not compile against + * another route's. Nothing here casts, re-checks a name, or reconstructs an + * optional field. + */ +type ExecuteAt

= Extract>; + +function shorthandHandler(command: ExecuteAt<"/">): string { + return `${command.model.path ?? ""} raw=${command.model.raw}`; +} + +function runHandler(command: ExecuteAt<"/run">): string { + return `${command.model.path ?? ""} include=${command.model.include.join(",")}`; +} + +function planHandler(command: ExecuteAt<"/plan">): string { + return `${command.model.request ?? ""} output=${command.model.output ?? ""}`; +} + +function workflowStartHandler(command: ExecuteAt<"/workflow/start">): string { + return `${command.model.target ?? ""} id=${command.model.id ?? ""}`; +} + +function workflowStatusHandler(command: ExecuteAt<"/workflow/status">): string { + return `${command.model.target ?? ""} json=${command.model.json}`; +} + +describe("Tier CFE — the xmd route definitions", () => { + it("CFE1: the first token alone selects a top-level command", function* () { + // A shorthand run, the named run, another named command, and a command + // name written where a document belongs. The last is the one Configliere + // would otherwise route on, because its search accepts any word in the + // segment rather than the first token. + expect({ + shorthand: selection(["doc.md"]), + named: selection(["run", "doc.md"]), + other: selection(["syntax"]), + later: selection(["--raw", "run"]), + laterWord: selection(["doc.md", "run"]), + }).toEqual({ + shorthand: "EXECUTE /", + named: "EXECUTE /run", + other: "EXECUTE /syntax", + later: "EXECUTE /", + laterWord: "unprocessable-content /", + }); + + // And the document really is the token, not the command. + const shorthand = intent(["--raw", "run"]); + expect(isExecute(shorthand) && shorthand.route === "/" ? shorthand.model.path : undefined).toBe( + "run", + ); + }); + + it("CFE2: each workflow action is its own route", function* () { + expect({ + status: selection(["workflow", "status", "abc", "--json"]), + start: selection(["workflow", "start", "flow.md", "--id", "one"]), + resume: selection(["workflow", "resume", "run-1"]), + answer: selection(["workflow", "answer", "run-1", "wait-1", "{}"]), + bare: selection(["workflow"]), + }).toEqual({ + status: "EXECUTE /workflow/status", + start: "EXECUTE /workflow/start", + resume: "EXECUTE /workflow/resume", + answer: "EXECUTE /workflow/answer", + // The address exists and executes nothing, which is what `route()` says. + bare: "method-not-allowed /workflow", + }); + + const status = intent(["workflow", "status", "abc", "--json"]); + expect( + isExecute(status) && status.route === "/workflow/status" ? status.model : undefined, + ).toEqual({ target: "abc", json: true, artifact: undefined }); + }); + + it("CFE3: method and route narrow the intent to one model", function* () { + const shorthand = intent(["doc.md", "--raw"]); + const named = intent(["run", "doc.md"]); + const planned = intent(["plan", "prepare the release", "--output", "out.md"]); + const started = intent(["workflow", "start", "flow.md", "--id", "one"]); + const inspected = intent(["workflow", "status", "abc", "--json"]); + + const described: string[] = []; + for (const settled of [shorthand, named, planned, started, inspected]) { + if (!isExecute(settled)) { + continue; + } + switch (settled.route) { + case "/": + described.push(shorthandHandler(settled)); + break; + case "/run": + described.push(runHandler(settled)); + break; + case "/plan": + described.push(planHandler(settled)); + break; + case "/workflow/start": + described.push(workflowStartHandler(settled)); + break; + case "/workflow/status": + described.push(workflowStatusHandler(settled)); + break; + default: + described.push(`unhandled ${settled.route}`); + } + } + + expect(described).toEqual([ + "doc.md raw=true", + "doc.md include=components,.", + "prepare the release output=out.md", + "flow.md id=one", + "abc json=true", + ]); + + // Help and version narrow by method, and carry no model to narrow. + const help = intent(["run", "--help"]); + const version = intent(["--version"]); + expect({ + help: isHelp(help) && help.route === "/run", + version: isVersion(version) && version.route === "/", + executeIsNeither: isHelp(named) || isVersion(named), + }).toEqual({ help: true, version: true, executeIsNeither: false }); + + // A parent's model is reachable from the child's intent without merging + // the two definitions. + const started2 = intent(["workflow", "start", "flow.md"]); + expect( + isExecute(started2) && started2.route === "/workflow/start" ? started2.models : {}, + ).toHaveProperty("/workflow"); + }); + + it("CFE4: a checkpoint carries values and cannot add a parameter or a route", function* () { + // The supported dynamic phase, exercised exactly as the guide describes: + // parse, perform the work, resume with a `Result`. + const app = command( + name("probe"), + option({ ...name("config") }, schema(z.string().optional())), + checkpoint(), + option({ ...name("channel") }, schema(z.string().optional())), + ); + + const step = parse(app, { argv: ["--config", "app.json", "--channel", "beta"] }); + if (!("resume" in step)) { + throw new Error("the checkpoint produced no increment"); + } + expect(step.model.config).toBe("app.json"); + + const loaded: Result = { + ok: true, + value: [{ name: "app.json", value: { channel: "stable", generated: "value" } }], + }; + const settled = step.resume(loaded); + if (!settled.ok || settled.method !== "execute") { + throw new Error("the checkpoint did not settle an execute intent"); + } + + // A declared parameter takes the loaded value when the command line wrote + // none, and the command line still outranks it when it did. + expect(settled.model.channel).toBe("beta"); + + // A value source cannot make a parameter exist: `generated` is in the + // loaded object and in no model, and no `--generated` option was created + // for the command line to write. + expect(Object.hasOwn(settled.model, "generated")).toBe(false); + const generated = parse(app, { argv: ["--generated", "value"] }); + expect("resume" in generated).toBe(true); + }); + + it("CFE4b: a dynamic phase adds options and routes, and loses their type", function* () { + // `dynamic()` is what `checkpoint()` is built from, and it does add + // parameters and routes — at runtime. This is the phase the document + // properties would migrate into. + const app = command( + name("probe"), + argument({ ...name("path") }, schema(z.string().optional())), + dynamic((declared: string[]) => + extend( + ...declared.map((property) => + option({ ...name(property) }, cli([`--${property}`]), schema(z.string().optional())), + ), + routes(command(name("child"))), + ), + ), + option({ ...name("raw") }, cli(["--raw"], { switch: true }), schema(z.boolean().optional())), + ); + + // A generated option binds, even written before the phase that declares it. + expect(driveDynamic(app, ["doc.md", "--props-name", "Ada"], ["props-name"])).toEqual({ + route: "/", + model: { path: "doc.md", "props-name": "Ada" }, + }); + + // A route the phase introduced is *not* reachable here, and the reason is + // ordering rather than depth: the argument in the earlier phase claims the + // word before the route it names exists. + expect(driveDynamic(app, ["child"], [])).toEqual({ route: "/", model: { path: "child" } }); + + // Without a positional competing for the token, the same construction + // reaches a dynamic route, and one nested below it. + const addressed = command( + name("probe"), + dynamic(() => + extend( + routes( + command( + name("child"), + dynamic(() => extend(routes(command(name("deeper"))))), + ), + ), + ), + ), + ); + expect(driveDynamic(addressed, ["child"], [])).toEqual({ route: "/child", model: {} }); + expect(driveDynamic(addressed, ["child", "deeper"], [])).toEqual({ + route: "/child/deeper", + model: {}, + }); + + // What stops the migration is the *type*, not the behaviour. With a + // runtime-derived element list the parse type collapses to a fully resolved + // union: the increment is absent from it, `resume` types as `unknown`, and + // the model describes the phase after the boundary rather than the one + // before it. Driving this would take a cast, which is why the CLI still + // prepares argv before parsing — see `dispatch` in cli.ts. + // + // The same definition with a statically known element list types exactly, + // so the limitation is specific to a list only the run knows. + expect(driveDynamic(app, ["doc.md", "--props-name", "Ada", "--raw"], ["props-name"])).toEqual({ + route: "/", + model: { path: "doc.md", raw: true, "props-name": "Ada" }, + }); + }); + + it("CFE5: help and version render what the released CLI rendered", function* () { + const program = renderProgramHelp(); + expect(program).toContain("Usage: xmd [OPTIONS]"); + for (const listed of ["run", "plan", "test", "syntax", "upgrade", "test-agent", "workflow"]) { + expect(program).toContain(listed); + } + // The program page lists commands and nothing a shorthand run configures. + expect(program).not.toContain("--raw"); + + const runPage = renderRouteHelp(routeFor(["run"])!, ["run"]); + expect(runPage).toContain("Usage: xmd run [OPTIONS] [path]"); + expect(runPage).toContain("-e, --eval"); + expect(runPage).toContain("--include ..."); + expect(runPage).toContain("[default: components,.]"); + + const syntaxPage = renderRouteHelp(routeFor(["syntax"])!, ["syntax"]); + expect(syntaxPage).toContain("Usage: xmd syntax [OPTIONS] [component]"); + for (const absent of ["--verbose", "--journal", "--raw", "--timeout", "--secret-detection"]) { + expect(syntaxPage).not.toContain(absent); + } + + // Only the root offers a version, and it writes the bare version rather + // than the stock `xmd 0.12.0`. + const version = intent(["--version"]); + expect(isVersion(version) ? renderVersion(version) : "").toBe(XMD_VERSION); + expect(selection(["run", "--version"])).toBe("method-not-allowed /run"); + expect(selection(["upgrade", "--version"])).toBe("method-not-allowed /upgrade"); + }); + + it("CFE6: the separator, the sentinel and a selector keep their meanings", function* () { + // A bare `-` is a word an argument can take. + const stdin = intent(["run", "-"]); + expect(isExecute(stdin) && stdin.route === "/run" ? stdin.model.path : undefined).toBe("-"); + + // After `--` it is a literal instead, and reaches the intent as one. + const separated = intent(["run", "--", "-"]); + expect( + isExecute(separated) && separated.route === "/run" ? separated.model.path : "unset", + ).toBe(undefined); + expect([...separated.literals].map((token) => token.text)).toEqual(["-"]); + + // A selector is a flag to this tokenizer, so no argument can ever take it. + // The CLI lifts it out of argv before parsing for exactly this reason. + expect(selection(["run", "-#Section"])).toBe("unprocessable-content /run"); + + // A dash-leading plan request survives the separator as a literal. + const planned = intent(["plan", "--", "-request"]); + expect([...planned.literals].map((token) => token.text)).toEqual(["-request"]); + }); + + it("CFE7: a repeatable option binds every occurrence from argv, in order", function* () { + // `multiple()` shows the parameter the whole phase, so an occurrence + // written after the document binds. Under the previous preview this was the + // case no reader could see, and the CLI had to lift the tokens out of argv + // and hand them back as a value source. + const named = intent(["run", "doc.md", "--include", "a", "--include", "b"]); + expect(isExecute(named) && named.route === "/run" ? named.model.include : []).toEqual([ + "a", + "b", + ]); + + const straddling = intent(["--include", "a", "doc.md", "--include", "b"]); + expect( + isExecute(straddling) && straddling.route === "/" ? straddling.model.include : [], + ).toEqual(["a", "b"]); + + const mixed = intent(["run", "doc.md", "--include=a", "--include", "b"]); + expect(isExecute(mixed) && mixed.route === "/run" ? mixed.model.include : []).toEqual([ + "a", + "b", + ]); + + // Absent, the schema's default stands. + const bare = intent(["run", "doc.md"]); + expect(isExecute(bare) && bare.route === "/run" ? bare.model.include : []).toEqual([ + "components", + ".", + ]); + + // A missing value is refused by the parse rather than by a scanner. + expect(refusal(["run", "doc.md", "--include"])).toContain("--include requires a value"); + expect(refusal(["run", "doc.md", "--include", "--raw"])).toContain( + "--include requires a value", + ); + + // `--pattern` carries no schema default, because `xmd test` needs to know + // whether the caller wrote one: a pattern against a single document is + // refused, and a default is not a refusal. + const patterned = intent(["test", "suite", "--pattern", "a", "--pattern", "b"]); + expect( + isExecute(patterned) && patterned.route === "/test" ? patterned.model.pattern : [], + ).toEqual(["a", "b"]); + + const unpatterned = intent(["test", "suite"]); + expect( + isExecute(unpatterned) && unpatterned.route === "/test" + ? unpatterned.model.pattern + : ["unset"], + ).toBe(undefined); + }); + + it("CFE8: malformed input fails with the first thing wrong", function* () { + expect(refusal(["upgrade", "--nope"])).toContain("--nope"); + expect(refusal(["run", "doc.md", "--journal"])).toContain("--journal requires a value"); + + // A required option that was never written is a schema failure, not a + // routing one. + const required = run(["test-agent"]); + expect(required.ok).toBe(false); + expect(unexpectedOnly(required)).toBe(false); + + // An option belonging to another command is an unexpected token here. + const misplaced = run(["syntax", "--raw"]); + expect(misplaced.ok).toBe(false); + expect(unexpectedOnly(misplaced)).toBe(true); + }); + + it("CFE11: every value-taking flag is read from the definitions", function* () { + const flags = valueFlags(); + for (const takesValue of ["--journal", "-j", "--eval", "-e", "--include", "--id", "--at"]) { + expect({ flag: takesValue, listed: flags.has(takesValue) }).toEqual({ + flag: takesValue, + listed: true, + }); + } + for (const switched of ["--raw", "--verbose", "-V", "--json", "--secret-detection"]) { + expect({ flag: switched, listed: flags.has(switched) }).toEqual({ + flag: switched, + listed: false, + }); + } + }); + + it("CFE13: no document-declared positional is defined by any route", function* () { + // #173 stays out of this spike. Every positional in the tree is one the + // command itself declares, and a document contributes none. + const positional = new Set(); + const pending = [{ definition: routeFor([])!, path: [] as string[] }]; + while (pending.length > 0) { + const current = pending.pop(); + if (current === undefined) { + continue; + } + for (const phase of current.definition.phases) { + for (const child of phase.routes) { + pending.push({ definition: child, path: [...current.path, child.name] }); + } + for (const param of Object.values(phase.params)) { + if (param.cli.syntax?.type === "argument") { + positional.add(`${["", ...current.path].join("/") || "/"}:${param.name}`); + } + } + } + } + + expect([...positional].sort()).toEqual([ + "/:path", + "/plan:request", + "/run:path", + "/syntax:component", + "/test:path", + "/upgrade:tag", + "/workflow/answer:argument", + "/workflow/answer:target", + "/workflow/answer:value", + "/workflow/cancel:target", + "/workflow/delete:target", + "/workflow/export:target", + "/workflow/fork:argument", + "/workflow/fork:target", + "/workflow/history:target", + "/workflow/resume:target", + "/workflow/start:target", + "/workflow/status:target", + ]); + }); +}); diff --git a/packages/cli/vendor/configliere-pr32/README.md b/packages/cli/vendor/configliere-pr32/README.md new file mode 100644 index 00000000..81f1d186 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/README.md @@ -0,0 +1,362 @@ +# Configliere + +**A statically typed entry-point router for command-line applications.** + +An argument parser tells you what the user typed. Configliere tells you where +and how they intend to enter your program. For execution, it marshals a +validated, statically typed model for that entry point. + +Configliere matches input to an intent: a method at an application-relative +route, such as: + +```text +HELP / +VERSION / +EXECUTE /serve +HELP /database/clean +EXECUTE /database/clean +``` + +Every reachable intent appears in the result type. Narrow `method` and `route`, +and TypeScript knows the exact model available at that entry point. + +Configliere is not a CLI framework. It does not own handlers, effects, output, +or process lifetime. It is not a CLI parser whose product is a bag of flags. Its +product is a typed intent; your application decides what that intent does. + +```text +input → bind and expand phases → resolve route + method → intent +``` + +## Define every way into the program + +`route()` declares an address. `command()` declares an executable route. Every +route supports help; version and execution exist only where they are explicitly +added. + +Definitions are immutable composition pipelines, not handler registrations: + +```ts +import { + command, + description, + multiple, + name, + option, + route, + routes, + schema, + toggle, + version, +} from "@frontside/configliere"; +import * as z from "zod"; + +export const app = command( + name("simulacrum"), + description("Run and manage local service simulators."), + version("1.0.0"), + toggle(name("verbose")), + routes( + command( + name("serve"), + option(name("port"), schema(z.number().default(4000))), + ), + route( + name("database"), + routes( + command( + name("clean"), + toggle(name("dryRun")), + ), + ), + ), + ), +); +``` + +That definition makes these entry points—and no others—reachable: + +```text +HELP / VERSION / EXECUTE / +HELP /serve EXECUTE /serve +HELP /database +HELP /database/clean EXECUTE /database/clean +``` + +The root name identifies the executable; it is not repeated in route IDs. +`simulacrum serve` therefore selects `/serve`, not `/simulacrum/serve`. + +## Route an intent + +`parse()` returns a discriminated union of the reachable entry points. Dispatch +can stay flat even when the route tree is deep: + +```ts +import process from "node:process"; +import { + parse, + printErrors, + printHelp, + printVersion, +} from "@frontside/configliere"; +import { app } from "./app.ts"; + +const result = parse(app, { argv: process.argv.slice(2) }); + +if (!result.ok) { + console.error(printErrors(result)); + process.exit(1); +} + +switch (result.method) { + case "help": + console.log(printHelp(result)); + break; + + case "version": + console.log(printVersion(result)); + break; + + case "execute": + switch (result.route) { + case "/": + result.model.verbose; // boolean + break; + + case "/serve": + result.model.port; // number + result.models["/"].verbose; // boolean + break; + + case "/database/clean": + result.model.dryRun; // boolean + result.models["/"]; // { verbose: boolean } + result.models["/database"]; // {} + break; + } +} +``` + +An execute intent has two views of configuration: + +- `model` is owned by the selected route. +- `models` contains the statically typed model for every route along the + selected path. Sibling routes are absent from both the value and its type. + +| Invocation | Intent and model | +| ------------------------------------- | ------------------------------------------------------------------- | +| `simulacrum --verbose` | `EXECUTE /` with `{ verbose: true }` | +| `simulacrum serve --port 4100` | `EXECUTE /serve` with `{ port: 4100 }` | +| `simulacrum database clean --dry-run` | `EXECUTE /database/clean` with `{ dryRun: true }` | +| `simulacrum --help database clean` | `HELP /database/clean`; controls target the deepest selected route | +| `simulacrum database` | `method-not-allowed`; `/database` does not support execution | +| `simulacrum serve --port nope` | `unprocessable-content`; invalid data never reaches the application | + +Command literals are routing tokens, not positional arguments. As route segments +become discoverable, Configliere scopes parameter binding to the segment that +owns each token. This makes identical option names on parent and child routes +unambiguous. + +## Marshal configuration into the route + +CLI arguments are only one source. Configliere can marshal JavaScript values and +flat environment records into the same route-local models: + +```ts +const result = parse(app, { + argv: process.argv.slice(2), + values: [{ + name: "config.json", + value: { serve: { port: 4200 } }, + }], + envs: [{ + name: "process", + value: process.env, + }], +}); +``` + +For `/serve`, `serve.port` and `SERVE_PORT` both address its `port` parameter. +CLI text and environment text are decoded; JavaScript values are used directly. +The resulting value is then validated by its +[Standard Schema](https://standardschema.dev/) schema. Zod, ArkType, Valibot, +and other conforming libraries work without adapters. + +Source precedence is explicit: + +```text +CLI → environment → JavaScript values → schema default +``` + +Use `multiple()` when an option may be supplied more than once. The option's +schema must describe the resulting array: + +```ts +const app = command( + name("simulacrum"), + option( + name("config"), + multiple(), + schema(z.array(z.string())), + ), +); +``` + +`--config one.yml --config two.yml` produces +`{ config: ["one.yml", "two.yml"] }` in argv order. + +`transform()` groups a set of options and folds their captured values into the +model. It takes the transform function first, followed by the options it scopes: + +```ts +const app = command( + name("server"), + checkpoint(), + transform( + (options: { port: number }, model: { port: number }, phase) => ({ + ...model, + port: options.port ?? model.port, + }), + option(name("port"), description("server port"), schema(z.number())), + ), +); +``` + +Inside the function: + +- `options` is scoped to exactly the options declared inside the `transform()`. +- `model` is the route model built so far. +- `phase` exposes the active phase parameters, including their schemas. + +The function returns the new model, or it may mutate `model` in place. + +## Pause without surrendering the type system + +Sometimes the route cannot be fully configured, or even fully discovered, until +the application performs I/O. Configliere can pause at a typed checkpoint and +resume with the result. + +Dynamic phases serve two common cases: + +- Load a configuration file, then use its contents as value sources for later + parameters. +- Load plugins, then extend the route graph with their options and routes. + +`checkpoint()` is the configuration-file convenience; `dynamic()` is the general +route-extension mechanism. Both keep I/O in the application while preserving the +exact type of what parsing can produce next. + +When loading multiple configuration files, resume with one `ValueSource` per +file. Sources are layered during parameter resolution, and the first source +containing a parameter wins. Reverse the files before resuming if later files +should override earlier files: + +```ts +const values = files + .map((file) => ({ name: file, value: readConfig(file) })) + .reverse(); + +const result = increment.resume({ ok: true, value: values }); +``` + +Each file can provide different parameters, which are combined automatically. +Configliere validates those parameters individually, but it does not recursively +merge nested objects. If required, merge per your requirements before passing +the resulting `value`. + +### Help and version cross checkpoints + +`--help` and `--version` request methods; they do not settle an intent or bypass +parsing. Configliere cannot produce either intent until it knows the deepest +selected route. A dynamic phase may introduce that route, its options, or its +version. + +The driver must therefore resume every increment until parsing returns an +intent—even when the arguments contain `--help` or `--version`. This applies +recursively when one continuation exposes another increment. + +```text +app --config app.json auth0 --help + → bind the configuration phase + → load configuration and resume + → discover /auth0 + → HELP /auth0 +``` + +Help and version are not escape hatches around configuration loading. Do not +inspect `argv` to skip a checkpoint. A phase may be required by `HELP`, +`VERSION`, or `EXECUTE`, so its driver work must be safe for all three: return +loading and validation failures as `Result` issues, avoid command side effects, +and defer execution until an `EXECUTE` intent. If discovery fails, report that +failure rather than printing incomplete help for an unresolved route graph. +Routes without dynamic phases still resolve directly; the rule is to stop only +at an intent or failure, never merely because the arguments look informational. + +```ts +import process from "node:process"; +import { + checkpoint, + command, + name, + option, + parse, + printErrors, + printHelp, + printVersion, + type Result, + schema, + type ValueSource, + version, +} from "@frontside/configliere"; +import * as z from "zod"; + +const app = command( + name("server"), + version("1.0.0"), + option(name("config"), schema(z.string())), + checkpoint(), + option(name("port"), schema(z.number())), +); + +const step = parse(app, { argv: process.argv.slice(2) }); + +if (!step.ok) { + console.error(printErrors(step)); + process.exit(1); +} + +step.model.config; // string—the model resolved before the checkpoint + +const loaded = await load(step.model.config); +const result = step.resume(loaded); + +if (!result.ok) { + console.error(printErrors(result)); + process.exit(1); +} + +switch (result.method) { + case "help": + console.log(printHelp(result)); + break; + + case "version": + console.log(printVersion(result)); + break; + + case "execute": + result.model; // { config: string; port: number } + break; +} + +declare function load(path: string): Promise>; +``` + +The parser remains synchronous and performs no I/O. The caller loads the file +and resumes with a `Result`; loader failures enter the ordinary issue path. +Unconsumed CLI input survives the pause, so a later `--port 5000` can override +the value loaded from the file. + +The same phase mechanism can add options or routes from runtime data. Parsing +then continues against the expanded route graph, and the continuation type +describes the entry points that can appear next. diff --git a/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts new file mode 100644 index 00000000..88554f87 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts @@ -0,0 +1,29 @@ +declare global { + interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param o An object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; + } +} +export {}; +declare global { + interface String { + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replaceAll(searchValue: string | RegExp, replaceValue: string): string; + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + } +} +export {}; +//# sourceMappingURL=_dnt.polyfills.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts.map new file mode 100644 index 00000000..78997460 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAeA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;;;WAIG;QACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC;AACV,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd;;;;WAIG;QACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;QAEvE;;;;WAIG;QACH,UAAU,CACR,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GACtD,MAAM,CAAC;KACX;CACF;AAsBD,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js new file mode 100644 index 00000000..518ed458 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js @@ -0,0 +1,32 @@ +// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js +if (!Object.hasOwn) { + Object.defineProperty(Object, "hasOwn", { + value: function (object, property) { + if (object == null) { + throw new TypeError("Cannot convert undefined or null to object"); + } + return Object.prototype.hasOwnProperty.call(Object(object), property); + }, + configurable: true, + enumerable: false, + writable: true, + }); +} +/** + * String.prototype.replaceAll() polyfill + * https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/ + * @author Chris Ferdinandi + * @license MIT + */ +if (!String.prototype.replaceAll) { + String.prototype.replaceAll = function (str, newStr) { + // If a regex pattern + if (Object.prototype.toString.call(str).toLowerCase() === "[object regexp]") { + return this.replace(str, newStr); + } + // If a string + return this.replace(new RegExp(str, "g"), newStr); + }; +} +export {}; +//# sourceMappingURL=_dnt.polyfills.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js.map b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js.map new file mode 100644 index 00000000..81be7d39 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/_dnt.polyfills.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_dnt.polyfills.js","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAAA,0FAA0F;AAC1F,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;QACtC,KAAK,EAAE,UAAU,MAAW,EAAE,QAAa;YACzC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC;QACD,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAoCD;;;;;GAKG;AACH,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACjC,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,GAAQ,EAAE,MAAW;QAC3D,qBAAqB;QACrB,IACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,iBAAiB,EACvE,CAAC;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;QAED,cAAc;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts new file mode 100644 index 00000000..03ac729e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts @@ -0,0 +1,8 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function argument(named: Definition, ...elements: E & Check, E>): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=argument.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts.map new file mode 100644 index 00000000..5c31b095 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/argument.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../src/lib/argument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAC/C,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,QAAQ,CACtB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAC3C,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAwB1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/argument.js b/packages/cli/vendor/configliere-pr32/esm/lib/argument.js new file mode 100644 index 00000000..9c4aeecb --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/argument.js @@ -0,0 +1,58 @@ +import { param } from "./param.js"; +import { brand, } from "./pipeline.js"; +export function argument(named, ...elements) { + const added = elements.reduce((value, element) => element(value), param(named, positional)); + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +function positional(param) { + return { + ...param, + cli: { + read, + syntax: { + type: "argument", + label: `<${param.name.toUpperCase()}>`, + }, + }, + }; +} +const read = (tokens) => { + let claim = tokens.claimOne((token) => token.type === "word"); + let [word] = claim.tokens; + return word + ? { + claim, + result: { + ok: true, + value: { exists: true, value: word.text }, + issues: [], + }, + } + : nothing(tokens); +}; +function nothing(tokens) { + let claim = tokens.claimAll(() => false); + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} +//# sourceMappingURL=argument.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/argument.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/argument.js.map new file mode 100644 index 00000000..880254da --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/argument.js.map @@ -0,0 +1 @@ +{"version":3,"file":"argument.js","sourceRoot":"","sources":["../../src/lib/argument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,KAAK,GAKN,MAAM,eAAe,CAAC;AAKvB,MAAM,UAAU,QAAQ,CAItB,KAAoB,EACpB,GAAG,QAAyC;IAE5C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CAAC,KAAK,EAAE,UAAU,CAAC,CACC,CAAC;IAE5B,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAA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AAE;YACxB,MAAM,EAAE,EAAE;SACX;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts new file mode 100644 index 00000000..ca5c03ca --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts @@ -0,0 +1,42 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import type { Symbol } from "./read.js"; +import type { Rest } from "./rest.js"; +import type { Result } from "./result.js"; +import type { TokenInput, TokenRange } from "./tokenizer.js"; +import type { AnyPhase, Issue, Path } from "./types.js"; +export interface Binding { + readonly rest: Rest; + readonly result: Result; +} +export interface PhaseBinding { + readonly rest: Rest; + readonly model: Record; + readonly issues: Issue[]; + readonly valid: boolean; +} +export interface PhaseSegment { + readonly range: TokenRange; + readonly path: Path; +} +export declare function fromCLI(options: { + readonly param: Param; + readonly view: TokenInput; + readonly rest: Rest; +}): Maybe>; +export declare function fromValues(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe>; +export declare function fromEnv(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe>; +export declare function bindPhase(options: { + readonly phase: AnyPhase; + readonly segment: PhaseSegment; + readonly rest: Rest; +}): PhaseBinding; +//# sourceMappingURL=bind.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts.map new file mode 100644 index 00000000..720e8a5f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/bind.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/lib/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC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QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAqBpB;AAED,wBAAgB,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1D,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAwBpB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE;IACjC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,YAAY,CAyGf"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/bind.js b/packages/cli/vendor/configliere-pr32/esm/lib/bind.js new file mode 100644 index 00000000..39aac253 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/bind.js @@ -0,0 +1,238 @@ +export function fromCLI(options) { + let { param, view, rest } = options; + return fromRead(param, param.cli.read(view), rest); +} +export function fromValues(options) { + let { param, route, rest } = options; + let claim = rest.values.claim({ + route, + address: [param.name], + }); + if (!claim.result.exists) { + return { exists: false }; + } + return { + exists: true, + value: { + rest: { + ...rest, + values: claim.rest, + }, + result: validate(param, claim.result.value.value, [param.name]), + }, + }; +} +export function fromEnv(options) { + let { param, route, rest } = options; + let claim = rest.envs.claim({ + route, + address: [param.name], + key: param.env, + }); + if (!claim.result.exists) { + return { exists: false }; + } + let value = claim.result.value.value; + return { + exists: true, + value: { + rest: { + ...rest, + envs: claim.rest, + }, + result: decode(param, value, param.decode(value), [param.name]), + }, + }; +} +export function bindPhase(options) { + let { phase, segment } = options; + let rest = options.rest; + let params = Object.values(phase.params); + let pending = new Map(params.map((param) => [param.name, param])); + let results = new Map(); + function settle(param, binding) { + rest = binding.rest; + results.set(param.name, binding.result); + pending.delete(param.name); + } + function accept(param, attempt) { + if (!attempt.exists) { + return; + } + settle(param, attempt.value); + } + // Every pending reader proposes a claim against the same immutable view. + // Commit the proposal beginning earliest in argv, then recompute the view. + // This lets `--port 9000` outrank a positional claim on `9000` without + // attaching binding-policy metadata to either reader. + while (true) { + let horizon = first(rest.tokens, segment.range); + let offer; + for (let param of pending.values()) { + let view = rest.tokens.view({ + range: segment.range, + // Repeated options must see every occurrence in the phase, not only + // the first option/value pair before the binding horizon. + through: param.multiple ? undefined : horizon?.index, + }); + let read = param.cli.read(view, param.multiple); + if (read.result.ok && !read.result.value.exists) { + continue; + } + let index = earliest(read.claim.tokens); + if (!offer || index < offer.index) { + offer = { param, read, index }; + } + } + if (!offer) { + break; + } + accept(offer.param, fromRead(offer.param, offer.read, rest)); + } + // Address sources have stable visibility once the route is known. They are + // tried only after CLI has reached its fixed point so a provisional CLI miss + // cannot let a lower-priority source settle the parameter too early. + for (let source of [fromEnv, fromValues]) { + for (let param of pending.values()) { + accept(param, source({ + param, + route: segment.path, + rest, + })); + } + } + // Only total absence reaches the schema as undefined. This is where required, + // optional, and defaulting parameters diverge. + for (let param of pending.values()) { + results.set(param.name, validate(param, undefined, [param.name])); + } + let model = {}; + let issues = []; + let valid = true; + // Collect in declaration order, independent of the source or sweep that + // settled each parameter. + for (let param of params) { + let result = results.get(param.name); + issues.push(...result.issues ?? []); + if (result.ok) { + model[param.name] = result.value; + } + else { + valid = false; + } + } + return { rest, model, issues, valid }; +} +function fromRead(param, read, rest) { + let path = [param.name]; + if (!read.result.ok) { + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result: read.result, + }, + }; + } + if (!read.result.value.exists) { + return { exists: false }; + } + let value = read.result.value.value; + let result = Array.isArray(value) ? decodeMany(param, value, path) : decode(param, value, typeof value === "string" ? param.decode(value) : [value], path); + result = merge(result, read.result.issues); + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result, + }, + }; +} +function decodeMany(param, values, path) { + let candidates = [[]]; + for (let value of values) { + let decoded = typeof value === "string" ? param.decode(value) : [value]; + candidates = candidates.flatMap((prefix) => decoded.map((candidate) => [...prefix, candidate])); + } + return decode(param, values, candidates, path); +} +function decode(param, value, candidates, path) { + if (candidates.length === 0) { + return { + ok: false, + issues: [{ + message: `unable to decode ${JSON.stringify(value)}`, + path, + }], + }; + } + let issues; + for (let candidate of candidates) { + let result = validate(param, candidate, path); + if (result.ok) { + return result; + } + issues = issues ?? result.issues; + } + return { + ok: false, + issues: issues ?? [], + }; +} +function validate(param, value, path) { + let validated = param.schema["~standard"].validate(value); + if (validated instanceof Promise) { + return { + ok: false, + issues: [{ + message: `async schemas are not allowed`, + path, + }], + }; + } + if (validated.issues) { + return { + ok: false, + issues: validated.issues.map((issue) => ({ + ...issue, + message: issue.message, + path, + })), + }; + } + return { + ok: true, + issues: [], + value: validated.value, + }; +} +function merge(result, issues) { + if (!issues || issues.length === 0) { + return result; + } + return { + ...result, + issues: [...issues, ...(result.issues ?? [])], + }; +} +function first(tokens, range) { + for (let token of tokens.view({ range })) { + if (token.type === "word") { + return token; + } + } +} +function earliest(tokens) { + let first = Infinity; + for (let token of tokens) { + first = Math.min(first, token.index); + } + return first; +} +//# sourceMappingURL=bind.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/bind.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/bind.js.map new file mode 100644 index 00000000..7c1cf539 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/bind.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bind.js","s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AC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,MAAyB;IACzC,IAAI,KAAK,GAAG,QAAQ,CAAC;IAErB,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts new file mode 100644 index 00000000..9e102601 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts @@ -0,0 +1,4 @@ +import type { DynamicElement } from "./pipeline.js"; +import { type ValueSource, withValues } from "./values.js"; +export declare function checkpoint(): DynamicElement>; +//# sourceMappingURL=checkpoint.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts.map new file mode 100644 index 00000000..dda3e967 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/lib/checkpoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,wBAAgB,UAAU,IAAI,cAAc,CAC1C,WAAW,EAAE,EACb,UAAU,CAAC,OAAO,UAAU,CAAC,CAC9B,CAEA"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js new file mode 100644 index 00000000..19f8cdcb --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js @@ -0,0 +1,6 @@ +import { dynamic } from "./dynamic.js"; +import { withValues } from "./values.js"; +export function checkpoint() { + return dynamic((values) => withValues(values)); +} +//# sourceMappingURL=checkpoint.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js.map new file mode 100644 index 00000000..38b5b528 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/checkpoint.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../src/lib/checkpoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAoB,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,MAAM,UAAU,UAAU;IAIxB,OAAO,OAAO,CAAC,CAAC,MAAqB,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts new file mode 100644 index 00000000..b830c091 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts @@ -0,0 +1,8 @@ +import type { Check, Fold, Materialize, Unary } from "./pipeline.js"; +import type { Definition, Done, Route } from "./types.js"; +export type CommandZero = Route +]>; +export declare function command(start: Definition, ...elements: E & Check, E>): Materialize, E>>; +//# sourceMappingURL=command.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts.map new file mode 100644 index 00000000..b8ed27c6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/command.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/lib/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CACxD,CAAC,EACD,MAAM,GAAG,SAAS,EAClB,EAAE,EACF;CAAE,EACF;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;CAAC,CACf,CAAC;AAEF,wBAAgB,OAAO,CACrB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACxC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAgBtC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/command.js b/packages/cli/vendor/configliere-pr32/esm/lib/command.js new file mode 100644 index 00000000..93b8bc19 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/command.js @@ -0,0 +1,14 @@ +export function command(start, ...elements) { + let zero = { + ...start, + methods: ["help", "execute"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + return elements.reduce((value, element) => element(value), zero); +} +//# sourceMappingURL=command.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/command.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/command.js.map new file mode 100644 index 00000000..5249d94d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/lib/command.ts"],"names":[],"mappings":"AAYA,MAAM,UAAU,OAAO,CAIrB,KAAoB,EACpB,GAAG,QAAsC;IAEzC,IAAI,IAAI,GAAmB;QACzB,GAAG,KAAK;QACR,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;QAC5B,MAAM,EAAE,CAAC;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT,CAAC;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAI,CACmC,CAAC;AAC5C,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts new file mode 100644 index 00000000..1030ec68 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts @@ -0,0 +1,2 @@ +export declare function dasherize(name: string): string; +//# sourceMappingURL=dasherize.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts.map new file mode 100644 index 00000000..09e7ce84 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dasherize.d.ts","sourceRoot":"","sources":["../../src/lib/dasherize.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM9C"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js new file mode 100644 index 00000000..9828ef1a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js @@ -0,0 +1,8 @@ +export function dasherize(name) { + return name + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2") + .replace(/([a-z\d])([A-Z])/g, "$1-$2") + .replace(/[\s_]+/g, "-") + .toLowerCase(); +} +//# sourceMappingURL=dasherize.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js.map new file mode 100644 index 00000000..98d23e46 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dasherize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dasherize.js","sourceRoot":"","sources":["../../src/lib/dasherize.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,WAAW,EAAE,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts new file mode 100644 index 00000000..69a15d4c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts @@ -0,0 +1,5 @@ +export type Decoder = (value: string) => unknown[]; +export declare const number: Decoder; +export declare const scalar: Decoder; +export declare const boolean: Decoder; +//# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts.map new file mode 100644 index 00000000..fdfe30f1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/lib/decode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;AAEnD,eAAO,MAAM,MAAM,EAAE,OAOpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,OAEpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAQrB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/decode.js b/packages/cli/vendor/configliere-pr32/esm/lib/decode.js new file mode 100644 index 00000000..83a25f5e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/decode.js @@ -0,0 +1,21 @@ +export const number = (value) => { + if (!numeric.test(value)) { + return []; + } + let decoded = Number(value); + return Number.isFinite(decoded) ? [decoded] : []; +}; +export const scalar = (value) => { + return [...number(value), value]; +}; +export const boolean = (value) => { + if (value === "true") { + return [true]; + } + if (value === "false") { + return [false]; + } + return []; +}; +const numeric = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/; +//# sourceMappingURL=decode.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/decode.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/decode.js.map new file mode 100644 index 00000000..366f6e6c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/lib/decode.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,MAAM,GAAY,CAAC,KAAK,EAAE,EAAE;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAY,CAAC,KAAK,EAAE,EAAE;IACvC,OAAO,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAY,CAAC,KAAK,EAAE,EAAE;IACxC,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,MAAM,OAAO,GAAG,oCAAoC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts new file mode 100644 index 00000000..244cc1b6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts @@ -0,0 +1,5 @@ +import { type IdentityElement } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function name(name: N): Definition; +export declare function description(description: string): IdentityElement>; +//# sourceMappingURL=definition.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts.map new file mode 100644 index 00000000..24001485 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/definition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/lib/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAE7D;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,GAClB,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAOrC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/definition.js b/packages/cli/vendor/configliere-pr32/esm/lib/definition.js new file mode 100644 index 00000000..2db08691 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/definition.js @@ -0,0 +1,11 @@ +import { brand } from "./pipeline.js"; +export function name(name) { + return { name }; +} +export function description(description) { + return brand((definition) => ({ + ...definition, + description, + })); +} +//# sourceMappingURL=definition.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/definition.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/definition.js.map new file mode 100644 index 00000000..106c2536 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/definition.js.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/lib/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAwB,MAAM,eAAe,CAAC;AAG5D,MAAM,UAAU,IAAI,CAAmB,IAAO;IAC5C,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,WAAW,CACzB,WAAmB;IAEnB,OAAO,KAAK,CAAsC,CAChD,UAA8B,EAC9B,EAAE,CAAC,CAAC;QACJ,GAAG,UAAU;QACb,WAAW;KACZ,CAAC,CAAC,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts new file mode 100644 index 00000000..6cbb893d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts @@ -0,0 +1,7 @@ +import type { AnyRoute } from "./types.js"; +import { type AnyElement, type DynamicElement } from "./pipeline.js"; +export type { ConjoinPhases, Seed } from "./pipeline.js"; +export type PhaseOf = R["phases"][0]; +export type PhasesOf = R["phases"]; +export declare function dynamic(extension: (requires: Requirement) => E, ..._valid: E extends AnyElement ? [] : [never]): DynamicElement>; +//# sourceMappingURL=dynamic.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts.map new file mode 100644 index 00000000..ffe29059 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic.d.ts","sourceRoot":"","sources":["../../src/lib/dynamic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,UAAU,EAAS,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5E,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEvD,wBAAgB,OAAO,CACrB,WAAW,EACX,CAAC,EAED,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,CAAC,EACvC,GAAG,MAAM,EAAE,CAAC,SAAS,UAAU,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAC7C,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAsBrD"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js new file mode 100644 index 00000000..968fc69a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js @@ -0,0 +1,19 @@ +import { brand } from "./pipeline.js"; +export function dynamic(extension, ..._valid) { + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + resolver: extension, + }); + phases.push({ + params: {}, + routes: [], + values: [], + envs: [], + }); + return { ...route, phases }; + }); +} +//# sourceMappingURL=dynamic.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js.map new file mode 100644 index 00000000..f08f0ca0 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../src/lib/dynamic.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,EAAuB,MAAM,eAAe,CAAC;AAM5E,MAAM,UAAU,OAAO,CAIrB,SAAuC,EACvC,GAAG,MAA2C;IAE9C,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAE1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,QAAQ,EAAE,SAEqB;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts new file mode 100644 index 00000000..f3a661ac --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts @@ -0,0 +1,35 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; +export interface EnvSource { + readonly name: string; + readonly value: Environment; +} +export type Environment = Readonly>; +export interface EnvClaim { + readonly result: Maybe<{ + readonly source: string; + readonly address: readonly string[]; + readonly key: string; + readonly value: string; + }>; + readonly rest: Envs; +} +export interface EnvClaimOptions { + readonly route: readonly string[]; + readonly address: readonly string[]; + readonly key?: string; +} +export declare function env(key: string): IdentityElement>; +export declare function withEnvs(envs: readonly EnvSource[]): IdentityElement; +export declare class Envs { + mounts: Map; + claims: Set; + constructor(mounts?: Map, claims?: Set); + mount(path: readonly string[], sources: readonly EnvSource[]): Envs; + claim({ route, address, key }: EnvClaimOptions): EnvClaim; +} +type ClaimId = string; +export {}; +//# sourceMappingURL=env.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts.map new file mode 100644 index 00000000..8bab5de7 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/env.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;CAC7B;AAED,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,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r32/esm/lib/env.js new file mode 100644 index 00000000..429141be --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/env.js @@ -0,0 +1,94 @@ +import { brand } from "./pipeline.js"; +export function env(key) { + return brand((param) => ({ ...param, env: key })); +} +export function withEnvs(envs) { + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + envs: phase.envs.concat(envs), + }); + return { + ...route, + phases, + }; + }); +} +export class Envs { + constructor(mounts = new Map(), claims = new Set()) { + Object.defineProperty(this, "mounts", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claims", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.mounts = mounts; + this.claims = claims; + } + mount(path, sources) { + if (sources.length === 0) { + return this; + } + let id = routeId(path); + return new Envs(new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), this.claims); + } + claim({ route, address, key = envKey([...route, ...address]) }) { + let id = claimId([...route, ...address]); + let nope = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + for (let end = route.length; end >= 0; end--) { + let mount = routeId(route.slice(0, end)); + let sources = this.mounts.get(mount) ?? []; + for (let { name, value } of sources) { + if (!Object.hasOwn(value, key) || typeof value[key] === "undefined") { + continue; + } + let rest = new Envs(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + key, + value: value[key], + }, + }, + rest, + }; + } + } + return nope; + } +} +function routeId(path) { + return `/${path.join("/")}`; +} +function claimId(address) { + return JSON.stringify(address); +} +function envKey(address) { + return address.map(normalize).filter(Boolean).join("_"); +} +function normalize(value) { + return value + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2") + .replace(/([a-z\d])([A-Z])/g, "$1_$2") + .replace(/[^A-Za-z\d]+/g, "_") + .replace(/^_+|_+$/g, "") + .toUpperCase(); +} +//# sourceMappingURL=env.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/env.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/env.js.map new file mode 100644 index 00000000..47e1f65e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/env.js.map @@ -0,0 +1 @@ +{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAwB,MAAM,eAAe,CAAC;AA0B5D,MAAM,UAAU,GAAG,CACjB,GAAW;IAEX,OAAO,KAAK,CACV,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,QAAQ,CACtB,IAA0B;IAE1B,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;SAC9B,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,OAAO,IAAI;IAIf,YACE,SAAsC,IAAI,GAAG,EAAE,EAC/C,SAAuB,IAAI,GAAG,EAAE;QALlC;;;;;WAAoC;QACpC;;;;;WAAqB;QAMnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,IAAuB,EAAE,OAA6B;QAC1D,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,EAAE,GAAG,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AAE,CAAC;oBACpE,SAAS;gBACX,CAAC;gBAED,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;gBAChE,OAAO;oBACL,MAAM,EAAE;wBACN,MAAM,EAAE,IAAI;wBACZ,KAAK,EAAE;4BACL,MAAM,EAAE,IAAI;4BACZ,OAAO;4BACP,GAAG;4BACH,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC;yBAClB;qBACF;oBACD,IAAI;iBACL,CAAC;YACJ,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAID,SAAS,OAAO,CAAC,IAAuB;IACtC,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;AAC9B,CAAC;AAED,SAAS,OAAO,CAAC,OAA0B;IACzC,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;AACjC,CAAC;AAED,SAAS,MAAM,CAAC,OAA0B;IACxC,OAAO,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,WAAW,EAAE,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts new file mode 100644 index 00000000..36572bb7 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts @@ -0,0 +1,3 @@ +import { type Extension, type Unary } from "./pipeline.js"; +export declare function extend(...elements: E): Extension; +//# sourceMappingURL=extend.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts.map new file mode 100644 index 00000000..018bbdd4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/extend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../src/lib/extend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAElE,wBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EACrD,GAAG,QAAQ,EAAE,CAAC,GACb,SAAS,CAAC,CAAC,CAAC,CAOd"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/extend.js b/packages/cli/vendor/configliere-pr32/esm/lib/extend.js new file mode 100644 index 00000000..c45c496b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/extend.js @@ -0,0 +1,5 @@ +import { brand } from "./pipeline.js"; +export function extend(...elements) { + return brand((start) => elements.reduce((value, element) => element(value), start)); +} +//# sourceMappingURL=extend.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/extend.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/extend.js.map new file mode 100644 index 00000000..ad558704 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/extend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../src/lib/extend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA8B,MAAM,eAAe,CAAC;AAElE,MAAM,UAAU,MAAM,CACpB,GAAG,QAAW;IAEd,OAAO,KAAK,CAAe,CAAC,KAAc,EAAW,EAAE,CACrD,QAAQ,CAAC,MAAM,CACb,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CACN,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts new file mode 100644 index 00000000..ac54acdc --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts @@ -0,0 +1,10 @@ +export type Maybe = { + readonly exists: false; +} | { + readonly exists: true; + readonly value: T; +}; +export declare function Just(): Maybe; +export declare function Just(value: T): Maybe; +export declare function Nothing(): Maybe; +//# sourceMappingURL=maybe.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts.map new file mode 100644 index 00000000..ceac87e5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"maybe.d.ts","sourceRoot":"","sources":["../../src/lib/maybe.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACxB,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,wBAAgB,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AACpC,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAS5C,wBAAgB,OAAO,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAE5C"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js new file mode 100644 index 00000000..a81ce83a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js @@ -0,0 +1,13 @@ +export function Just(value) { + if (typeof value === "undefined") { + return { exists: true }; + } + else { + return { exists: true, value }; + } +} +export function Nothing() { + return nothing; +} +const nothing = { exists: false }; +//# sourceMappingURL=maybe.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js.map new file mode 100644 index 00000000..4057a6ec --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/maybe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maybe.js","sourceRoot":"","sources":["../../src/lib/maybe.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,IAAI,CAAI,KAAS;IAC/B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAc,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC;AACH,CAAC;AAED,MAAM,UAAU,OAAO;IACrB,OAAO,OAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts new file mode 100644 index 00000000..5bec4807 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts @@ -0,0 +1,11 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function option(named: Definition, ...elements: E & Check, E> & Valid): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type Valid = [ + Fold, E> +] extends [never] ? never : unknown; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=option.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts.map new file mode 100644 index 00000000..a5241ace --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/option.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../src/lib/option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAE/C,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,MAAM,CACpB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GACtD,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAuB1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,IAAI;IACvC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;CAChC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpC,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/option.js b/packages/cli/vendor/configliere-pr32/esm/lib/option.js new file mode 100644 index 00000000..f49f8a37 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/option.js @@ -0,0 +1,23 @@ +import { param } from "./param.js"; +import { dasherize } from "./dasherize.js"; +import { brand, } from "./pipeline.js"; +import { cli } from "./read.js"; +export function option(named, ...elements) { + const added = elements.reduce((value, element) => element(value), param(named, cli([`--${dasherize(named.name)}`]))); + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +//# sourceMappingURL=option.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/option.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/option.js.map new file mode 100644 index 00000000..c74bd334 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/option.js.map @@ -0,0 +1 @@ +{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/lib/option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EACL,KAAK,GAKN,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAGhC,MAAM,UAAU,MAAM,CAIpB,KAAoB,EACpB,GAAG,QAAoD;IAEvD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,KAAK,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CACxB,CAAC;IAE5B,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,MAAM;gBACf,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK;aACpB;SACF,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts new file mode 100644 index 00000000..d233b7ae --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts @@ -0,0 +1,27 @@ +import { type Decoder } from "./decode.js"; +import { type Check, type Fold, type Transform, type TransformElement, type Unary } from "./pipeline.js"; +import type { CLIBinding } from "./read.js"; +import type { Definition, Schema } from "./types.js"; +export interface Param extends Definition { + schema: Schema; + cli: CLIBinding; + decode: Decoder; + env?: string; + multiple?: boolean; +} +export interface MultipleParam extends Param { + multiple: true; +} +export declare function param(start: Definition, ...elements: E & Check, E>): Fold, E>; +export declare function schema(schema: Schema): TransformElement>; +export interface SchemaTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends MultipleParam ? T extends (infer E)[] ? MultipleParam : never : this["input"] extends Param ? Param : never; +} +interface MultipleTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends Param ? unknown extends T ? MultipleParam : T extends (infer E)[] ? MultipleParam : never : never; +} +export declare function multiple(): TransformElement; +export {}; +//# sourceMappingURL=param.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts.map new file mode 100644 index 00000000..f3e50062 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/param.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/lib/param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,KAAK,KAAK,EACV,KAAK,IAAI,EAET,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,UAAU,CAAC,CAAC,CAAC;IAC/D,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAClB,GAAG,EAAE,UAAU,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACvE,QAAQ,EAAE,IAAI,CAAC;CAChB;AAED,wBAAgB,KAAK,CACnB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAA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AAC,CAK9D"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/param.js b/packages/cli/vendor/configliere-pr32/esm/lib/param.js new file mode 100644 index 00000000..ed0bab43 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/param.js @@ -0,0 +1,43 @@ +import { scalar } from "./decode.js"; +import { mark, } from "./pipeline.js"; +export function param(start, ...elements) { + let zero = { + ...start, + schema: unknown, + cli: { + read(tokens) { + let claim = tokens.claimAll(() => false); + return { + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + claim, + }; + }, + }, + decode: scalar, + }; + return elements.reduce((value, element) => element(value), zero); +} +export function schema(schema) { + return mark((param) => ({ + ...param, + schema, + })); +} +export function multiple() { + return mark((param) => ({ + ...param, + multiple: true, + })); +} +const unknown = { + "~standard": { + version: 1, + vendor: "configliere", + validate: (value) => ({ value }), + }, +}; +//# sourceMappingURL=param.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/param.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/param.js.map new file mode 100644 index 00000000..5c1084c6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/param.js.map @@ -0,0 +1 @@ +{"version":3,"file":"param.js","sourceRoot":"","sources":["../../src/lib/param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAGL,IAAI,GAIL,MAAM,eAAe,CAAC;AAgBvB,MAAM,UAAU,KAAK,CAInB,KAAoB,EACpB,GAAG,QAAyC;IAE5C,IAAI,IAAI,GAAsB;QAC5B,GAAG,KAAK;QACR,MAAM,EAAE,OAAO;QACf,GAAG,EAAE;YACH,IAAI,CAAC,MAAM;gBACT,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;gBACzC,OAAO;oBACL,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI;wBACR,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;wBACxB,MAAM,EAAE,EAAE;qBACX;oBACD,KAAK;iBACN,CAAC;YACJ,CAAC;SACF;QACD,MAAM,EAAE,MAAM;KACf,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAI,CACyB,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,MAAiB;IAEjB,OAAO,IAAI,CAAqB,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC;QAClE,GAAG,KAAK;QACR,MAAM;KACP,CAAC,CAAC,CAAC;AACN,CAAC;AAmBD,MAAM,UAAU,QAAQ;IACtB,OAAO,IAAI,CAAoB,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC;QACjE,GAAG,KAAK;QACR,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,OAAO,GAAoB;IAC/B,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KACjC;CACF,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts new file mode 100644 index 00000000..8f49be3e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts @@ -0,0 +1,3 @@ +import type { AnyRoute, Input, Parse } from "./types.js"; +export declare function parse(route: R, input: Input): Parse; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts.map new file mode 100644 index 00000000..8adcef9a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/lib/parse.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAIV,QAAQ,EACR,KAAK,EAKL,KAAK,EAIN,MAAM,YAAY,CAAC;AAEpB,wBAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,QAAQ,EAC5C,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,GACX,KAAK,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/parse.js b/packages/cli/vendor/configliere-pr32/esm/lib/parse.js new file mode 100644 index 00000000..100805d1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/parse.js @@ -0,0 +1,390 @@ +import { bindPhase } from "./bind.js"; +import { Envs } from "./env.js"; +import { tokenize } from "./tokenize.js"; +import { Tokenizer } from "./tokenizer.js"; +import { Values } from "./values.js"; +export function parse(route, input) { + let tokenizer = new Tokenizer(tokenize(input.argv)); + let help = tokenizer.claimAll(flags("-h", "--help")); + let version = help.rest.claimAll(flags("-v", "--version")); + let escape = version.rest.claimAll((t) => t.type === "separator"); + let literals = escape.rest.claimAll((t) => t.type === "literal"); + let method = "execute"; + if (help.tokens.length > 0) { + method = "help"; + } + else if (version.tokens.length > 0) { + method = "version"; + } + let rest = { + tokens: literals.rest, + values: new Values().mount([], input.values ?? []), + envs: new Envs().mount([], input.envs ?? []), + }; + return resume({ + segments: [{ + id: "/", + route, + phases: route.phases, + tokens: Array.from(rest.tokens), + path: [], + start: -1, + model: {}, + issues: [], + history: [], + }], + active: 0, + rest, + models: {}, + method, + literals: literals.tokens, + }); +} +function resume(state) { + while (true) { + // Starting from the deepest open segment, synchronously descend through + // routes visible on each segment's head phase. + state = search(state); + let index = state.active; + let segment = state.segments[index]; + let [phase] = segment.phases; + state = { + ...state, + rest: { + ...state.rest, + values: state.rest.values.mount(segment.path, phase.values), + envs: state.rest.envs.mount(segment.path, phase.envs), + }, + }; + // Controls are free of ordinary configuration validation. A dynamic phase + // is the exception: its model is needed by the caller before the remaining + // route graph (and therefore the final control target) can be known. + if (state.method !== "execute" && !phase.resolver) { + let models = { + ...state.models, + [segment.id]: segment.model, + }; + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + continue; + } + return resolve({ ...state, models }, segment); + } + // Bind only this phase, within this segment's token view. + // + // For an open dynamic segment, binding may consume the horizon but may not + // look beyond it. For a committed segment, `end` is the hard boundary. + let binding = bindPhase({ + phase, + segment: { + range: { + start: segment.start, + end: segment.end, + }, + path: segment.path, + }, + rest: state.rest, + }); + segment = { + ...segment, + model: { + ...segment.model, + ...binding.model, + }, + issues: [ + ...segment.issues, + ...binding.issues, + ], + }; + state = { + ...state, + rest: binding.rest, + segments: replace(state.segments, index, segment), + }; + if (!binding.valid) { + let issues = phase.resolver + ? binding.issues + : [...unexpected(state, segment), ...binding.issues]; + return unprocessableContent(state.segments[state.segments.length - 1], issues); + } + let modeled = applyTransforms(segment); + if (!modeled.ok) { + return unprocessableContent(segment, modeled.issues); + } + segment = { + ...segment, + model: modeled.value, + }; + if (phase.resolver) { + // Binding the phase succeeded, but the requirement is still needed. + let suspended = state; + return { + ok: true, + route: segment.id, + model: phase.transforms?.length ? modeled.value : binding.model, + resume(result) { + if (!result.ok) { + return unprocessableContent(segment, result.issues); + } + // AnyPhase erases these exact types with `never`; dynamic() already + // proved them at its public boundary. + let resolver = phase.resolver; + // The extension operates against the same aggregate route metadata, + // but begins with one fresh, empty phase. + let continuation = resolver(result.value)(seed(segment.route)); + let phases = stitch(continuation.phases, segment.phases.slice(1)); + let history = [...segment.history, phase]; + let next = { + ...segment, + route: { + ...continuation, + phases: [...history, ...phases], + }, + phases, + history, + issues: [ + ...segment.issues, + ...(result.issues ?? []), + ], + }; + return resume({ + ...suspended, + segments: replace(suspended.segments, index, next), + }); + }, + }; + } + // A phase without a resolver is the final phase of this segment. + let issues = unexpected(state, segment); + if (issues.length > 0) { + return unprocessableContent(state.segments[state.segments.length - 1], issues); + } + let id = `/${segment.path.join("/")}`; + let models = { + ...state.models, + [id]: segment.model, + }; + // There is already a synchronously matched child segment. + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + continue; + } + // The deepest selected segment is fully resolved. + return resolve({ + ...state, + models, + }, segment); + } +} +function search(state) { + let segments = [...state.segments]; + let rest = state.rest; + while (true) { + let index = segments.length - 1; + let segment = segments[index]; + let [phase] = segment.phases; + let remaining = new Set(Array.from(rest.tokens, (token) => token.index)); + let selector = segment.tokens.find((token) => { + return remaining.has(token.index) && token.type === "word" && + phase.routes.some((route) => route.name === token.text); + }); + if (!selector) { + return { ...state, segments, rest }; + } + let child = phase.routes.find((route) => route.name === selector.text); + let path = [...segment.path, child.name]; + let before = segment.tokens.filter((token) => token.index < selector.index); + let after = segment.tokens.filter((token) => token.index > selector.index); + segments[index] = { + ...segment, + tokens: before, + end: selector.index, + }; + segments.push({ + id: `/${path.join("/")}`, + route: child, + path, + phases: child.phases, + tokens: after, + start: selector.index, + model: {}, + issues: [], + history: [], + }); + rest = { + ...rest, + tokens: rest.tokens.claimOne((token) => token.index === selector.index) + .rest, + }; + } +} +function flags(...texts) { + return (token) => token.type === "flag" && texts.includes(token.text); +} +function stitch(before, after) { + if (after.length === 0) { + return before; + } + let phases = [...before]; + let phase = phases.pop(); + let [next, ...rest] = after; + phases.push({ + ...phase, + ...next, + params: { + ...phase.params, + ...next.params, + }, + routes: [ + ...phase.routes, + ...next.routes, + ], + values: [ + ...phase.values, + ...next.values, + ], + envs: [ + ...phase.envs, + ...next.envs, + ], + }); + phases.push(...rest); + return phases; +} +function resolve(state, segment) { + let route = `/${segment.path.join("/")}`; + let definition = segment.route; + if (!definition.methods.includes(state.method)) { + return { + ok: false, + code: "method-not-allowed", + route, + definition, + path: segment.path, + method: state.method, + allowed: definition.methods, + }; + } + let intent = { + ok: true, + route, + definition, + path: segment.path, + literals: state.literals, + }; + switch (state.method) { + case "help": + return { + ...intent, + method: "help", + }; + case "version": + return { + ...intent, + method: "version", + }; + case "execute": + return { + ...intent, + method: "execute", + model: state.models[route], + models: state.models, + issues: state.segments.flatMap((segment) => segment.issues), + }; + } +} +function applyTransforms(segment) { + let operations = segment.phases[0].transforms ?? []; + let model = segment.model; + for (let op of operations) { + if (typeof op.transform === "function") { + let result = op.transform(pick(model, op.keys), model, segment.phases[0].params); + if (result !== undefined) { + if (!record(result)) { + return invalidTransformResult(); + } + model = result; + } + continue; + } + let result = op.transform["~standard"].validate(model); + if (result instanceof Promise) { + return { + ok: false, + issues: [{ message: "async schemas are not allowed" }], + }; + } + if (result.issues) { + return { ok: false, issues: result.issues }; + } + if (!record(result.value)) { + return invalidTransformResult(); + } + model = result.value; + } + if (operations.length === 0) { + return { ok: true, value: segment.model }; + } + return { ok: true, value: model }; +} +function invalidTransformResult() { + return { + ok: false, + issues: [{ message: "model transforms must return records" }], + }; +} +function record(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} +function pick(model, keys) { + let options = {}; + for (let key of keys) { + if (key in model) { + options[key] = model[key]; + } + } + return options; +} +function seed(route) { + return { + ...route, + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; +} +function replace(items, index, value) { + let result = [...items]; + result[index] = value; + return result; +} +function unprocessableContent(segment, issues) { + return { + ok: false, + code: "unprocessable-content", + route: segment.id, + definition: segment.route, + path: segment.path, + issues: [...issues], + }; +} +function unexpected(state, segment) { + let members = new Set(segment.tokens.map((token) => token.index)); + return Array.from(state.rest.tokens) + .filter((token) => members.has(token.index)) + .map((token) => ({ + message: `unexpected ${JSON.stringify(token.text)}`, + })); +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/parse.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/parse.js.map new file mode 100644 index 00000000..2f5cc0cd --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/parse.js.map @@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U,EAAE,OAAO,CAAC,KAAK;QACzB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,MAAM,EAAE,CAAC,GAAG,MAAM,CAAC;KACpB,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,KAAkB,EAClB,OAAgB;IAEhB,IAAI,OAAO,GAAG,IAAI,GAAG,CACnB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAC3C,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC;SACjC,MAAM,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SAC3C,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACf,OAAO,EAAE,cAAc,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;KACpD,CAAC,CAAC,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts new file mode 100644 index 00000000..7ad587a5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts @@ -0,0 +1,197 @@ +import type { AddField, AddParamToLast, AddRoutesToLast, AnyPhase, AnyPhases, AnyRoute, ChildrenOf, Done, Method, MethodsOf, ModelOf, ModelSchema, Next, Phase, Route } from "./types.js"; +export type Element = { + readonly [operation]: D; +}; +export type AnyElement = Element; +export type Unary = (value: never) => unknown; +export type AnyPipelineElement = Unary; +export interface Transform { + readonly input: unknown; + readonly output: unknown; +} +export type ApplyTransform = (F & { + readonly input: S; +})["output"]; +export interface TransformElement { + readonly [operation]: Custom; + (value: S): ApplyTransform; +} +export interface IdentityElement { + readonly [operation]: Identity; + (value: T): T; +} +export interface MethodElement { + readonly [operation]: AddMethod; + (route: Route): Route; +} +export interface ParamElement { + readonly [operation]: AddParam; + (route: Route): Route, C, AddParamToLast>; +} +export interface RoutesElement { + readonly [operation]: AddRoutes; + (route: Route): Route>; +} +export interface ModelTransformElement { + readonly [operation]: AddModelTransform; + (route: Route): Apply, AddModelTransform>; +} +type ModelTransformOutput = F extends ModelSchema ? Output extends Record ? Output : T : F extends (options: never, model: infer Input, phase: never) => infer Output ? T extends Input ? (Output extends Record ? Output : T) : never : never; +export type Extension = Element> & (E extends readonly AnyElement[] ? GenericExtension : ConcreteExtension); +interface GenericExtension { + readonly [operation]: Batch; + >(value: S): Fold; +} +interface ConcreteExtension { + (value: [Fold, E>] extends [never] ? never : InputOfPipeline): Fold, E>; +} +export interface DynamicElement { + readonly [operation]: Dynamic; + (route: R): Apply>; +} +export type Seed = Route, ModelOf, ChildrenOf, readonly [Phase<{}, [], never>]>; +export type ConjoinPhases = ConcatPhases, B["phases"]>; +export type Fold = number extends E["length"] ? Conservative : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? true extends IsUnion ? Conservative : Head extends AnyElement ? S extends AnyRoute ? DeltaOf extends StaticDelta ? TakeStatic extends readonly [ + infer Fields extends object, + infer Routes extends readonly AnyRoute[], + infer Methods extends Method, + infer Rest extends readonly AnyPipelineElement[] +] ? Fold, Rest> : never : Fold>, Tail> : Fold>, Tail> : Head extends (value: S) => infer Output ? Fold : never : S; +export type Materialize = AnyRoute extends S ? S : S extends Route ? WithExtras : Phases[K]; +}>, S> : S; +export type Check = number extends E["length"] ? unknown : E extends readonly AnyElement[] ? [Fold] extends [never] ? CheckMixed : E : CheckMixed; +export declare function mark(element: (value: never) => unknown): TransformElement; +export declare function brand(element: unknown): E; +declare const operation: unique symbol; +type Delta = Identity | AddMethod | AddParam | AddRoutes | AddModelTransform | Batch | Dynamic | Custom; +type StaticDelta = Identity | AddMethod | AddParam | AddRoutes; +interface Identity { + readonly type: "identity"; + readonly input: S; +} +interface AddMethod { + readonly type: "method"; + readonly method: M; +} +interface AddParam { + readonly type: "param"; + readonly key: K; + readonly value: V; +} +interface AddRoutes { + readonly type: "routes"; + readonly children: C; +} +interface AddModelTransform { + readonly type: "model-transform"; + readonly transform: F; + readonly elements: E; +} +interface Batch { + readonly type: "batch"; + readonly elements: E; +} +interface Dynamic { + readonly type: "dynamic"; + readonly requirement: Requirement; + readonly element: E; +} +interface Custom { + readonly type: "custom"; + readonly transform: F; +} +type Apply = Delta extends D ? Conservative : D extends Identity ? S extends Input ? S : never : D extends AddMethod ? S extends AnyRoute ? Route | M, ModelOf, ChildrenOf, S["phases"]> : never : D extends AddParam ? S extends AnyRoute ? WithParams : never : D extends AddRoutes ? S extends AnyRoute ? Route, ModelOf, readonly [...ChildrenOf, ...C], AddRoutesToLast> : never : D extends AddModelTransform ? S extends AnyRoute ? Fold extends infer After extends AnyRoute ? Route, ModelTransformOutput>, ChildrenOf, TransformModelInLast>>> : never : never : D extends Batch ? Fold : D extends Dynamic ? S extends AnyRoute ? Apply, DeltaOf> extends infer After extends AnyRoute ? Route, ModelOf, ChildrenOf, ConjoinPhases> : never : never : D extends Custom ? S extends F["input"] ? ApplyTransform : never : never; +type DeltaOf = E[typeof operation]; +type IsUnion = T extends unknown ? [Whole] extends [T] ? false : true : never; +type Conservative = S extends AnyRoute ? AnyRoute : unknown; +type CheckMixed = E extends readonly [] ? E : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? [Fold] extends [never] ? readonly [never, ...Tail] : readonly [Head, ...CheckTail, Tail>] : never; +type CheckTail = number extends E["length"] ? E : E extends readonly AnyElement[] ? E : CheckMixed; +type InputOf = E extends AnyElement ? InputOfDelta> : E extends (value: infer Input) => unknown ? Input : never; +type InputOfPipeline = E extends readonly [ + infer Head extends AnyPipelineElement, + ...readonly AnyPipelineElement[] +] ? InputOf : unknown; +type InputOfDelta = D extends Identity ? Input : D extends AddMethod | AddParam | AddRoutes | AddModelTransform | Dynamic ? AnyRoute : D extends Batch ? InputOfPipeline : D extends Custom ? F["input"] : never; +type TakeStatic = Count["length"] extends 20 ? readonly [MergeFields, Routes, Methods, E] : E extends readonly [ + infer Head extends AnyElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? DeltaOf extends Identity ? TakeStatic : DeltaOf extends AddMethod ? TakeStatic : DeltaOf extends AddParam ? TakeStatic : DeltaOf extends AddRoutes ? TakeStatic : readonly [MergeFields, Routes, Methods, E] : readonly [MergeFields, Routes, Methods, E]; +type MergeFields = { + [K in FieldKeys]: FieldValue; +}; +type FieldKeys = F extends readonly [ + infer Head extends object, + ...infer Tail extends readonly object[] +] ? keyof Head | FieldKeys : never; +type FieldValue = F extends readonly [ + ...infer Rest extends readonly object[], + infer Last extends object +] ? K extends keyof Last ? Last[K] : FieldValue : never; +type WithStatic = Route | Methods, keyof Fields extends never ? ModelOf : Merge, Fields>, Routes extends readonly [] ? ChildrenOf : readonly [...ChildrenOf, ...Routes], AddStaticToLast>; +type AddStaticToLast

= keyof Fields extends never ? Routes extends readonly [] ? P : AddRoutesToLast : Routes extends readonly [] ? AddFieldsToLast : AddRoutesToLast, Routes>; +type WithParams = Route, Merge, Fields>, ChildrenOf, AddFieldsToLast>; +type AddFieldsToLast

= P extends readonly [infer Only extends AnyPhase] ? readonly [AddFields] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [First, ...Middle, AddFields, Fields>] : never; +type TransformModelInLast

= P extends readonly [AnyPhase] ? readonly [ + TransformModelPhase +] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [ + First, + ...Middle, + TransformModelPhase, Output> +] : never; +type TransformModelPhase

= P extends Next ? Next : P extends Done ? Done : never; +type AddFields

= P extends Next ? Next, Routes, Requirement> : P extends Done ? Done, Routes> : never; +type Last

= P extends readonly [ + ...AnyPhase[], + infer Tail extends AnyPhase +] ? Tail : never; +type ContinueLast

= P extends readonly [infer Only extends AnyPhase] ? readonly [WithRequirement] : P extends readonly [ + infer Head extends AnyPhase, + ...infer Middle extends readonly AnyPhase[], + infer Tail extends AnyPhase +] ? readonly [ + Head, + ...Middle, + WithRequirement +] : never; +type ConcatPhases = A extends readonly [ + infer AHead extends AnyPhase, + ...infer ATail extends AnyPhase[] +] ? B extends readonly [ + infer BHead extends AnyPhase, + ...infer BTail extends AnyPhase[] +] ? readonly [AHead, ...ATail, BHead, ...BTail] : never : never; +type WithRequirement

= P extends Phase ? Phase : never; +type Merge = Simplify & B>; +type Simplify = { + [K in keyof T]: T[K]; +}; +type MaterializePhase

= P extends Next ? Next<{ + [K in keyof Model]: Model[K]; +}, Routes, Requirement> : P extends Done ? Done<{ + [K in keyof Model]: Model[K]; +}, Routes> : never; +type RouteKeys = keyof Route; +type WithExtras = keyof Omit extends never ? R : R & Omit; +export {}; +//# sourceMappingURL=pipeline.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts.map new file mode 100644 index 00000000..0a36a308 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/lib/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,IAAI,EACJ,KAAK,EACL,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,KAAK,IAAI;IACrC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OA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gBAAgB,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,SAAS,IAAI,CACxD,MAAM,KAAK,EACX,MAAM,MAAM,EACZ,MAAM,WAAW,CAClB,GAAG,IAAI,CACJ;KAAG,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAAE,EAChC,MAAM,EACN,WAAW,CACZ,GACC,CAAC,SAAS,IAAI,CAAC,MAAM,KAAK,EAAE,MAAM,MAAM,CAAC,GAAG,IAAI,CAC9C;KAAG,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAAE,EAChC,MAAM,CACP,GACD,KAAK,CAAC;AAEV,KAAK,SAAS,GAAG,MAAM,KAAK,CAC1B,MAAM,EACN,MAAM,EACN,MAAM,EACN,SAAS,QAAQ,EAAE,EACnB,SAAS,CACV,CAAC;AAEF,KAAK,UAAU,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,SAAS,KAAK,GAC3E,CAAC,GACD,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js new file mode 100644 index 00000000..f74dff5d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js @@ -0,0 +1,7 @@ +export function mark(element) { + return element; +} +export function brand(element) { + return element; +} +//# sourceMappingURL=pipeline.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js.map new file mode 100644 index 00000000..96b4f0b1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/pipeline.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/lib/pipeline.ts"],"names":[],"mappings":"AA2NA,MAAM,UAAU,IAAI,CAClB,OAAkC;IAElC,OAAO,OAA8B,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,KAAK,CAAuB,OAAgB;IAC1D,OAAO,OAAY,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts new file mode 100644 index 00000000..0d1bb160 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts @@ -0,0 +1,8 @@ +/** + * 😵‍💫 This file has been vibe coded 😵‍💫 + */ +import type { Help, MethodNotAllowed, RoutePath, UnprocessableContent, Version } from "./types.js"; +export declare function printHelp>(intent: H): string; +export declare function printVersion>(intent: V): string; +export declare function printErrors(result: MethodNotAllowed | UnprocessableContent): string; +//# sourceMappingURL=print.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts.map new file mode 100644 index 00000000..db19388d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/print.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../src/lib/print.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAEV,IAAI,EAEJ,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,wBAAgB,SAAS,CACvB,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,EAC/B,MAAM,EAAE,CAAC,GAAG,MAAM,CAyDnB;AAED,wBAAgB,YAAY,CAC1B,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,SAAS,CAAC,EAClC,MAAM,EAAE,CAAC,GAAG,MAAM,CAOnB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAC9C,MAAM,CAgBR"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/print.js b/packages/cli/vendor/configliere-pr32/esm/lib/print.js new file mode 100644 index 00000000..8e5436c2 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/print.js @@ -0,0 +1,157 @@ +/** + * 😵‍💫 This file has been vibe coded 😵‍💫 + */ +export function printHelp(intent) { + let route = intent.definition; + let subject = title(intent); + let heading = route.version ? `${subject} ${route.version}` : subject; + let children = route.phases.flatMap((phase) => phase.routes); + let args = []; + let options = []; + for (let param of params(route)) { + let syntax = param.cli.syntax; + if (!syntax) { + continue; + } + let row = [syntax.label, param.description]; + if (syntax.type === "argument") { + args.push(row); + } + else { + options.push(row); + } + } + let usage = [subject, "[OPTIONS]", ...args.map(([label]) => label)].join(" "); + if (children.length > 0) { + usage += route.methods.includes("execute") ? " [COMMAND]" : " "; + } + let lines = [heading]; + if (route.description) { + lines.push(...wrap(route.description, width)); + } + lines.push("", "Usage:", ` ${usage}`); + if (args.length > 0) { + lines.push("", "Arguments:", ...list(args)); + } + if (children.length > 0) { + lines.push("", "Commands:", ...list(children.map((child) => [child.name, child.description]))); + } + options.push(["-h, --help", "Print help"]); + if (route.methods.includes("version")) { + options.push(["-v, --version", "Print version"]); + } + lines.push("", "Options:", ...list(options)); + return lines.join("\n"); +} +export function printVersion(intent) { + let version = intent.definition.version; + if (!version) { + throw new TypeError(`route ${JSON.stringify(intent.route)} has no version`); + } + return `${title(intent)} ${version}`; +} +export function printErrors(result) { + let subject = title(result); + switch (result.code) { + case "method-not-allowed": + return [ + `${subject} does not support ${result.method.toUpperCase()}`, + "", + "Available methods:", + ...result.allowed.map((method) => ` ${method.toUpperCase()}`), + ].join("\n"); + case "unprocessable-content": { + return result.issues.map(problem).join("\n"); + } + } +} +function params(route) { + return route.phases.flatMap((phase) => Object.values(phase.params)); +} +function title(intent) { + return intent.path.length > 0 + ? intent.path.join(" ") + : intent.definition.name; +} +function list(rows) { + let size = Math.max(...rows.map(([label]) => label.length)); + let available = Math.max(24, width - size - 4); + let lines = []; + for (let [label, description] of rows) { + let prefix = ` ${label.padEnd(size)}`; + if (!description) { + lines.push(prefix.trimEnd()); + continue; + } + let [first, ...rest] = wrap(description, available); + lines.push(`${prefix} ${first}`); + lines.push(...rest.map((line) => `${" ".repeat(size + 4)}${line}`)); + } + return lines; +} +function wrap(text, size) { + let words = text.trim().split(/\s+/); + let lines = []; + let line = ""; + for (let word of words) { + if (line.length === 0) { + line = word; + } + else if (line.length + word.length + 1 <= size) { + line += ` ${word}`; + } + else { + lines.push(line); + line = word; + } + } + if (line) { + lines.push(line); + } + return lines; +} +function problem(issue) { + let location = address(issue.path); + return location ? `${location}: ${issue.message}` : message(issue.message); +} +function message(value) { + if (value.startsWith("unexpected ")) { + let encoded = value.slice("unexpected ".length); + try { + let token = JSON.parse(encoded); + if (typeof token === "string") { + return `unexpected: \`${token.replaceAll("`", "\\`")}\``; + } + } + catch { + // Keep non-JSON diagnostics intact. + } + } + return value; +} +function address(path) { + if (!path || path.length === 0) { + return; + } + let result = ""; + for (let segment of path) { + let key = typeof segment === "object" && segment !== null + ? segment.key + : segment; + if (typeof key === "number") { + result += `[${key}]`; + } + else if (typeof key === "symbol") { + result += `[${String(key)}]`; + } + else if (/^[A-Za-z_$][\w$]*$/.test(key)) { + result += result ? `.${key}` : key; + } + else { + result += `[${JSON.stringify(key)}]`; + } + } + return result; +} +const width = 80; +//# sourceMappingURL=print.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/print.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/print.js.map new file mode 100644 index 00000000..91312858 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/print.js.map @@ -0,0 +1 @@ +{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/lib/print.ts"],"names":[],"mappings":"AAAA;;GAEG;AAaH,MAAM,UAAU,SAAS,CAEvB,MAAS;IACT,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,C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AAI,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC/B,OAAO;IACT,CAAC;IAED,IAAI,MAAM,GAAG,EAAE,CAAC;IAEhB,KAAK,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACzB,IAAI,GAAG,GAAG,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI;YACvD,CAAC,CAAC,OAAO,CAAC,GAAG;YACb,CAAC,CAAC,OAAO,CAAC;QAEZ,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YAC5B,MAAM,IAAI,IAAI,GAAG,GAAG,CAAC;QACvB,CAAC;aAAM,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;YACnC,MAAM,IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAC/B,CAAC;aAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,KAAK,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts new file mode 100644 index 00000000..deed10a4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts @@ -0,0 +1,28 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { Result } from "./result.js"; +import type { Flag, Setter, Word } from "./tokenize.js"; +import type { Claim, TokenInput } from "./tokenizer.js"; +export type Symbol = Flag | Setter | Word; +export type ReadCLI = (tokens: TokenInput, multiple?: boolean) => CLIRead; +export interface CLIBinding { + readonly read: ReadCLI; + readonly syntax?: CLISyntax; +} +export type CLISyntax = { + readonly type: "argument"; + readonly label: string; +} | { + readonly type: "option"; + readonly label: string; +}; +export interface CLIRead { + result: Result>; + claim: Claim; +} +export interface CLIOptions { + switch?: true; +} +export declare function cli(names: readonly string[], options?: CLIOptions): IdentityElement>; +//# sourceMappingURL=read.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts.map new file mode 100644 index 00000000..2130c5de --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/read.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/lib/read.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExD,MAAM,MAAM,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;AAE1C,MAAM,MAAM,OAAO,GAAG,CACpB,MAAM,EAAE,UAAU,CAAC,MAAM,CAAC,EAC1B,QAAQ,CAAC,EAAE,OAAO,KACf,OAAO,CAAC;AAEb,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC;CAC7B;AAED,MAAM,MAAM,SAAS,GACjB;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACrD;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAExD,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,GAAG,OAAO,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC;IACpD,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,CAAC,EAAE,IAAI,CAAC;CACf;AAED,wBAAgB,GAAG,CACjB,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,UAAe,GACvB,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2FzC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/read.js b/packages/cli/vendor/configliere-pr32/esm/lib/read.js new file mode 100644 index 00000000..00b7d931 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/read.js @@ -0,0 +1,101 @@ +import { brand } from "./pipeline.js"; +export function cli(names, options = {}) { + const readOne = (tokens) => { + let [match] = matches(tokens); + return match ? result(tokens, match) : nothing(tokens); + }; + const readMany = (tokens) => { + let found = matches(tokens); + if (found.length === 0) { + return nothing(tokens); + } + let claimed = new Set(found.flatMap((match) => match.indices)); + let issues = found.flatMap((match) => "issue" in match ? [match.issue] : []); + return { + claim: tokens.claimAll((token) => claimed.has(token.index)), + result: issues.length > 0 ? { ok: false, issues } : { + ok: true, + value: { + exists: true, + value: found.map((match) => "value" in match ? match.value : undefined), + }, + issues: [], + }, + }; + }; + function matches(tokens) { + let visible = Array.from(tokens); + let found = []; + for (let index = 0; index < visible.length; index++) { + let token = visible[index]; + if (!options.switch && token.type === "setter" && + names.includes(`--${token.nameText}`)) { + found.push({ indices: [token.index], value: token.valueText }); + continue; + } + if (token.type !== "flag" || !names.includes(token.text)) { + continue; + } + if (options.switch) { + found.push({ indices: [token.index], value: true }); + continue; + } + let value = visible[index + 1]; + if (value?.type === "word" && value.index === token.index + 1) { + found.push({ + indices: [token.index, value.index], + value: value.text, + }); + index++; + } + else { + found.push({ + indices: [token.index], + issue: { message: `${token.text} requires a value` }, + }); + } + } + return found; + } + const read = (tokens, multiple = false) => { + return multiple ? readMany(tokens) : readOne(tokens); + }; + return brand((param) => ({ + ...param, + cli: { + read, + syntax: { + type: "option", + label: options.switch + ? names.join(", ") + : `${names.join(", ")} `, + }, + }, + })); +} +function result(tokens, match) { + let claim = tokens.claimAll((token) => match.indices.includes(token.index)); + if ("issue" in match) { + return { claim, result: { ok: false, issues: [match.issue] } }; + } + return { + claim, + result: { + ok: true, + value: { exists: true, value: match.value }, + issues: [], + }, + }; +} +function nothing(tokenizer) { + let claim = tokenizer.claimAll(() => false); + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} +//# sourceMappingURL=read.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/read.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/read.js.map new file mode 100644 index 00000000..5827db74 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/read.js.map @@ -0,0 +1 @@ +{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/lib/read.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAwB,MAAM,eAAe,CAAC;AA8B5D,MAAM,UAAU,GAAG,CACjB,KAAwB,EACxB,UAAsB,EAAE;IAExB,MAAM,OAAO,GAAY,CAAC,MAAM,EAAE,EAAE;QAClC,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,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IAAI;YACR,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE;YAC3C,MAAM,EAAE,EAAE;SACX;KACF,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,SAA6B;IAC5C,IAAI,KAAK,GAAG,SAAS,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAE5C,OAAO;QACL,KAAK;QACL,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;YACxB,MAAM,EAAE,EAAE;SACX;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts new file mode 100644 index 00000000..32c973bd --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts @@ -0,0 +1,10 @@ +import type { Envs } from "./env.js"; +import type { Symbol } from "./read.js"; +import type { Tokenizer } from "./tokenizer.js"; +import type { Values } from "./values.js"; +export interface Rest { + readonly tokens: Tokenizer; + readonly values: Values; + readonly envs: Envs; +} +//# sourceMappingURL=rest.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts.map new file mode 100644 index 00000000..111a78aa --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/rest.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/lib/rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/rest.js b/packages/cli/vendor/configliere-pr32/esm/lib/rest.js new file mode 100644 index 00000000..7c1f8a13 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/rest.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=rest.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/rest.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/rest.js.map new file mode 100644 index 00000000..7016a9d5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/rest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/lib/rest.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts new file mode 100644 index 00000000..c7495933 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts @@ -0,0 +1,10 @@ +import type { Issue } from "./types.js"; +export type Result = { + ok: true; + value: T; + issues?: readonly Issue[]; +} | { + ok: false; + issues: readonly Issue[]; +}; +//# sourceMappingURL=result.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts.map new file mode 100644 index 00000000..d0801957 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/result.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;CAC3B,GAAG;IACF,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;CAC1B,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/result.js b/packages/cli/vendor/configliere-pr32/esm/lib/result.js new file mode 100644 index 00000000..77a7051b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/result.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=result.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/result.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/result.js.map new file mode 100644 index 00000000..f1c4f414 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/result.js.map @@ -0,0 +1 @@ +{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts new file mode 100644 index 00000000..cebe6b74 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts @@ -0,0 +1,13 @@ +import { type Check, type Fold, type Materialize, type MethodElement, type ModelTransformElement, type RoutesElement, type Unary } from "./pipeline.js"; +import type { AnyRoute, Definition, Done, ModelOf, ModelParams, ModelSchema, Route } from "./types.js"; +export type RouteZero = Route +]>; +export declare function route(start: Definition, ...elements: E & Check, E>): Materialize, E>>; +export declare function version(semver: string): MethodElement<"version">; +export declare function executable(): MethodElement<"execute">; +export declare function routes(...children: C): RoutesElement; +export declare function transform(transform: ModelSchema, ...elements: E & Check): ModelTransformElement, E>; +export declare function transform>, model: never, phase: ModelParams) => Record | void)>(transform: F, ...elements: E & Check): ModelTransformElement; +//# sourceMappingURL=route.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts.map new file mode 100644 index 00000000..5807aa60 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/route.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/lib/route.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,WAAW,EAChB,KAAK,aAAa,EAClB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,OAAO,EACP,WAAW,EACX,WAAW,EAEX,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CACtD,CAAC,EACD,MAAM,EACN,EAAE,EACF;CAAE,EACF;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;CAAC,CACf,CAAC;AAEF,wBAAgB,KAAK,CACnB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACtC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAgBpC;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC,SAAS,CAAC,CAMhE;AAED,wBAAgB,UAAU,IAAI,aAAa,CAAC,SAAS,CAAC,CAKrD;AAED,wBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,QAAQ,EAAE,EACxD,GAAG,QAAQ,EAAE,CAAC,GACb,aAAa,CAAC,CAAC,CAAC,CAclB;AAED,wBAAgB,SAAS,CACvB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,EACzB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,GACnC,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,wBAAgB,SAAS,CACvB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAChC,KAAK,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EACpC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,KACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAEpC,SAAS,EAAE,CAAC,EACZ,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,GACnC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/route.js b/packages/cli/vendor/configliere-pr32/esm/lib/route.js new file mode 100644 index 00000000..3d99aeb6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/route.js @@ -0,0 +1,73 @@ +// deno-lint-ignore-file ban-types +import { brand, } from "./pipeline.js"; +export function route(start, ...elements) { + let zero = { + ...start, + methods: ["help"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + return elements.reduce((value, element) => element(value), zero); +} +export function version(semver) { + return brand((route) => ({ + ...route, + methods: [...route.methods, "version"], + version: semver, + })); +} +export function executable() { + return brand((route) => ({ + ...route, + methods: [...route.methods, "execute"], + })); +} +export function routes(...children) { + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + routes: [...phase.routes, ...children], + }); + return { + ...route, + phases, + }; + }); +} +export function transform(transform, ...elements) { + return brand((route) => { + let before = params(route); + let next = apply(route, elements); + let nextParams = params(next); + let added = keys(next).filter((key) => before[key] !== nextParams[key]); + let phases = [...next.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + transforms: [ + ...(phase.transforms ?? []), + { transform, keys: added }, + ], + }); + return { + ...next, + phases, + }; + }); +} +function apply(route, elements) { + return elements.reduce((value, element) => element(value), route); +} +function params(route) { + return route.phases[route.phases.length - 1].params; +} +function keys(route) { + return Object.keys(params(route)); +} +//# sourceMappingURL=route.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/route.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/route.js.map new file mode 100644 index 00000000..bc4bf6f4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/route.js.map @@ -0,0 +1 @@ +{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/lib/route.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,OAAO,EACL,KAAK,GAQN,MAAM,eAAe,CAAC;AAoBvB,MAAM,UAAU,KAAK,CAInB,KAAoB,EACpB,GAAG,QAAoC;IAEvC,IAAI,IAAI,GAAiB;QACvB,GAAG,KAAK;QACR,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT,CAAC;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,C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C9B,IAAI,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;QAExE,IAAI,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;QAC9B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,UAAU,EAAE;gBACV,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC;gBAC3B,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE;aAC3B;SACF,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,IAAI;YACP,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,KAAe,EAAE,QAA0B;IACxD,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CACM,CAAC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,KAAe;IAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,SAAS,IAAI,CAAC,KAAe;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACpC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts new file mode 100644 index 00000000..ca60ec21 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts @@ -0,0 +1,8 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function toggle(named: Definition, ...elements: E & Check, E>): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=toggle.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts.map new file mode 100644 index 00000000..72cf3f28 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/lib/toggle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAiB,MAAM,YAAY,CAAC;AACvD,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAY,UAAU,EAAU,MAAM,YAAY,CAAC;AAE/D,wBAAgB,MAAM,CACpB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAC3C,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CA2B1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js new file mode 100644 index 00000000..411df397 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js @@ -0,0 +1,83 @@ +import { boolean as decode } from "./decode.js"; +import { dasherize } from "./dasherize.js"; +import { param, schema } from "./param.js"; +import { brand, } from "./pipeline.js"; +export function toggle(named, ...elements) { + const added = elements.reduce((value, element) => element(value), { + ...param(named, binding(named.name), schema(bool)), + decode, + }); + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +function binding(name) { + const stem = dasherize(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + return (param) => ({ + ...param, + cli: { + read: reader(name), + syntax: { + type: "option", + label: `${yes}, ${no}`, + }, + }, + }); +} +function reader(name) { + const stem = dasherize(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + return (tokens) => { + let claim = tokens.claimOne((token) => { + return token.type === "flag" && + (token.text === yes || token.text === no); + }); + let [flag] = claim.tokens; + return flag + ? { + claim, + result: { + ok: true, + value: { exists: true, value: flag.text === yes }, + issues: [], + }, + } + : { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; + }; +} +const bool = { + "~standard": { + version: 1, + vendor: "configliere", + validate(value) { + return typeof value === "undefined" + ? { value: false } + : typeof value === "boolean" + ? { value } + : { issues: [{ message: "expected boolean" }] }; + }, + }, +}; +//# sourceMappingURL=toggle.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js.map new file mode 100644 index 00000000..cfce181b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/toggle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../src/lib/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAc,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,EACL,KAAK,GAKN,MAAM,eAAe,CAAC;AAKvB,MAAM,UAAU,MAAM,CAIpB,KAAoB,EACpB,GAAG,QAAyC;IAE5C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C;QACE,GAAG,KAAK,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;QAClD,MAAM;KACP,CACwB,CAAC;IAE5B,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,MAAM;gBACf,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK;aACpB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAQD,SAAS,OAAO,CACd,IAAY;IAEZ,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,GAAG,GAAG,KAAK,IAAI,EAAE,CAAC;IACxB,MAAM,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AI,GAAoB;IAC5B,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,aAAa;QACrB,QAAQ,CAAC,KAAK;YACZ,OAAO,OAAO,KAAK,KAAK,WAAW;gBACjC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;gBAClB,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS;oBAC5B,CAAC,CAAC,EAAE,KAAK,EAAE;oBACX,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;QACpD,CAAC;KACF;CACF,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts new file mode 100644 index 00000000..67162392 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts @@ -0,0 +1,21 @@ +export interface Token { + type: T; + index: number; + text: string; +} +export type AnyToken = Word | Flag | Setter | Separator | Literal; +export interface Setter extends Token<"setter"> { + nameText: string; + valueText: string; +} +export interface Flag extends Token<"flag"> { + flagText: string; + flagType: "short" | "long"; +} +export type Word = Token<"word">; +export interface Separator extends Token<"separator"> { + readonly text: "--"; +} +export type Literal = Token<"literal">; +export declare function tokenize(argv: string[]): readonly AnyToken[]; +//# sourceMappingURL=tokenize.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts.map new file mode 100644 index 00000000..242777d5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../src/lib/tokenize.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM;IACrC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,MAAO,SAAQ,KAAK,CAAC,QAAQ,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,IAAK,SAAQ,KAAK,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAEjC,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,WAAW,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,QAAQ,EAAE,CAqC5D"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js new file mode 100644 index 00000000..75447b05 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js @@ -0,0 +1,42 @@ +export function tokenize(argv) { + let quote = false; + let tokens = []; + for (let i = 0; i < argv.length; i++) { + let index = i; + let text = argv[i]; + if (quote) { + tokens.push({ type: "literal", index, text }); + continue; + } + if (text === "--") { + tokens.push({ type: "separator", index, text }); + quote = true; + continue; + } + let matchSetter = setterMatch.exec(text); + if (matchSetter?.groups) { + let { nameText, valueText } = matchSetter.groups; + tokens.push({ type: "setter", index, text, nameText, valueText }); + continue; + } + let matchFlag = flagMatch.exec(text); + if (matchFlag?.groups) { + let { prefix, flagText } = matchFlag.groups; + tokens.push({ + type: "flag", + index, + text, + flagText, + flagType: prefix === "-" ? "short" : "long", + }); + continue; + } + tokens.push({ type: "word", index, text }); + } + return tokens; +} +// deno-lint-ignore no-invalid-regexp +const flagMatch = /^(?--?)(?[^-=\s][^=\s]*)$/; +// deno-lint-ignore no-invalid-regexp +const setterMatch = /^--(?[^-=\s][^=\s]*)=(?[\s\S]*)$/; +//# sourceMappingURL=tokenize.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js.map new file mode 100644 index 00000000..47f58f02 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenize.js","sourceRoot":"","sources":["../../src/lib/tokenize.ts"],"names":[],"mappings":"AA8BA,MAAM,UAAU,QAAQ,CAAC,IAAc;IACrC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,MAAM,GAAe,EAAE,CAAC;IAE5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,KAAK,GAAG,IAAI,CAAC;YACb,SAAS;QACX,CAAC;QACD,IAAI,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;YACxB,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YAClE,SAAS;QACX,CAAC;QACD,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,SAAS,EAAE,MAAM,EAAE,CAAC;YACtB,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;YAC5C,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,MAAM;gBACZ,KAAK;gBACL,IAAI;gBACJ,QAAQ;gBACR,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;aAC5C,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qCAAqC;AACrC,MAAM,SAAS,GAAG,6CAA6C,CAAC;AAEhE,qCAAqC;AACrC,MAAM,WAAW,GAAG,uDAAuD,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts new file mode 100644 index 00000000..622ca7d9 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts @@ -0,0 +1,35 @@ +import type { AnyToken } from "./tokenize.js"; +export interface TokenInput extends Iterable { + claimNext(): Claim; + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimPair(match: (a: T, b: T) => boolean): Claim; + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; +} +export interface TokenRange { + readonly start: number; + readonly end?: number; +} +export interface ViewOptions { + readonly range: TokenRange; + readonly through?: number; +} +export declare class Tokenizer implements TokenInput { + readonly tokens: readonly T[]; + readonly claimed: ReadonlySet; + constructor(tokens: readonly T[], claimed?: ReadonlySet); + claimNext(): Claim; + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimPair(match: (a: T, b: T) => boolean): Claim; + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; + view(options: ViewOptions): TokenInput; + [Symbol.iterator](): Generator; +} +export interface Claim { + tokens: T[]; + rest: Tokenizer; +} +//# sourceMappingURL=tokenizer.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts.map new file mode 100644 index 00000000..cbfbf5d2 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../src/lib/tokenizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACjE,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE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,CAAC,EAAE,CAAC,CAAC;IAanD,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAkBtD,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACnE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAgBnD,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC;IAIxC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC;CAOlD;AAED,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,GAAG,CAAC;IAC/D,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpB"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js new file mode 100644 index 00000000..2fd9beeb --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js @@ -0,0 +1,149 @@ +export class Tokenizer { + constructor(tokens, claimed = new Set()) { + Object.defineProperty(this, "tokens", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claimed", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.tokens = tokens; + this.claimed = new Set(claimed); + } + claimNext() { + return this.claimOne(() => true); + } + claimOne(match) { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this, [token.index]), + }; + } + } + return { tokens: [], rest: this }; + } + claimPair(match) { + let previous; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this }; + } + claimAll(match) { + let tokens = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this, claimed) : this, + }; + } + view(options) { + return new View(this, options); + } + *[Symbol.iterator]() { + for (let token of this.tokens) { + if (!this.claimed.has(token.index)) { + yield token; + } + } + } +} +class View { + constructor(source, options) { + Object.defineProperty(this, "source", { + enumerable: true, + configurable: true, + writable: true, + value: source + }); + Object.defineProperty(this, "options", { + enumerable: true, + configurable: true, + writable: true, + value: options + }); + } + claimNext() { + return this.claimOne(() => true); + } + claimOne(match) { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this.source, [token.index]), + }; + } + } + return { tokens: [], rest: this.source }; + } + claimPair(match) { + let previous; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this.source, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this.source }; + } + claimAll(match) { + let tokens = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this.source, claimed) : this.source, + }; + } + *[Symbol.iterator]() { + let { start, end } = this.options.range; + let { through } = this.options; + for (let token of this.source) { + if (token.index > start && + (end === undefined || token.index < end) && + (through === undefined || token.index <= through)) { + yield token; + } + } + } +} +function remainder(source, claimed) { + return new Tokenizer(source.tokens, new Set([...source.claimed, ...claimed])); +} +//# sourceMappingURL=tokenizer.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js.map new file mode 100644 index 00000000..e42096a3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/tokenizer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../../src/lib/tokenizer.ts"],"names":[],"mappings":"AAwBA,MAAM,OAAO,SAAS;IAIpB,YACE,MAAoB,EACpB,UAA+B,IAAI,GAAG,EAAE;QALjC;;;;;WAAqB;QACrB;;;;;WAA6B;QAMpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAID,QAAQ,CAAC,KAA4B;QACnC,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,OAAO;oBACL,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACrC,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,SAAS,CAAC,KAA8B;QACtC,IAAI,QAAuB,CAAC;QAC5B,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,KAAK,CAAC;gBACjB,SAAS;YACX,CAAC;YACD,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;gBACjE,OAAO;o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diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts new file mode 100644 index 00000000..36a0b98c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts @@ -0,0 +1,175 @@ +import type { StandardSchemaV1 } from "@standard-schema/spec"; +import type { EnvSource } from "./env.js"; +import type { Literal } from "./tokenize.js"; +import type { Param } from "./param.js"; +import type { Result } from "./result.js"; +import type { ValueSource } from "./values.js"; +export type Issue = StandardSchemaV1.Issue; +export type Schema = StandardSchemaV1; +export type ModelSchema = StandardSchemaV1; +export type ModelParams = Params>; +export type ModelTransformFunction = (options: Record, model: Record, phase: ModelParams) => Record | void; +export type ModelTransform = ModelSchema | ModelTransformFunction; +export interface ModelOperation { + readonly transform: ModelTransform; + readonly keys: readonly string[]; +} +export interface Definition { + readonly name: N; + readonly description?: string; +} +export interface Route extends Definition { + readonly methods: readonly M[]; + readonly version?: string; + readonly phases: P; + readonly model?: T; + readonly children?: C; +} +export type Parse = Outcome>; +export type Phase = [Requirement] extends [never] ? Done : Next; +export type Next = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver: (requirement: T) => (input: AnyRoute) => AnyRoute; +}; +export type Done = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; +}; +export type Params = { + [K in keyof Model]: K extends string ? Param : never; +}; +export interface ParseIncrement { + readonly ok: true; + readonly route: P; + readonly model: IncrementModelOf; + resume(result: Result>): Outcome, P, Models>>; +} +export type ContinuationOf = R extends Route ? Route, ChildrenOf, readonly [Next, ...Tail]> : never; +export type ModelOf = R extends Route ? T : never; +export type ChildrenOf = R extends Route ? Children : never; +export type RequirementsOf = RequirementsIn; +export type RequirementOf = RequirementIn; +export interface AnyRoute extends Definition { + readonly methods: readonly Method[]; + readonly version?: string; + readonly phases: AnyPhases; +} +export interface AnyPhase { + readonly params: ModelParams; + readonly routes: readonly AnyRoute[]; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver?: (requirement: never) => (route: never) => AnyRoute; +} +export type AnyPhases = readonly [AnyPhase, ...AnyPhase[]]; +export type Method = "help" | "version" | "execute"; +export type MethodsOf = R["methods"][number]; +export type Path = readonly string[]; +export type Input = { + argv: string[]; + values?: readonly ValueSource[]; + envs?: readonly EnvSource[]; +}; +export interface Failure { + readonly ok: false; + readonly code: C; +} +export type Outcome = T | MethodNotAllowed | UnprocessableContent; +export type IntentsOf = IntentsAt; +export type RoutePath = `/${string}`; +export type ModelsByRoute = { + readonly [path: RoutePath]: object; +}; +export type PathOf = R extends "/" ? [] : R extends `/${infer Rest}` ? Split : never; +export type AnyIntent = Help | Version | Execute; +export type ChildIntents = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[] +] ? (IntentsAt, Models> | ChildIntents) : never; +export interface Intent { + readonly ok: true; + readonly method: M; + readonly route: P; + readonly definition: AnyRoute; + readonly path: PathOf

; + readonly literals: Iterable; +} +export type Help

= Intent<"help", P>; +export type Version

= Intent<"version", P>; +export interface Execute

extends Intent<"execute", P> { + readonly issues: readonly Issue[]; + readonly model: Models[P]; + readonly models: Models; +} +export type Status = "method-not-allowed" | "unprocessable-content"; +export interface MethodNotAllowed extends Failure<"method-not-allowed"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly method: Method; + readonly allowed: readonly Method[]; +} +export interface UnprocessableContent extends Failure<"unprocessable-content"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly issues: Issue[]; +} +type RequirementIn

= P extends { + readonly resolver: (requirement: infer Requirement) => (route: AnyRoute) => AnyRoute; +} ? Requirement : never; +type IncrementModelOf = R["phases"][0] extends Next ? Model : never; +type ParseAt = [RequirementOf] extends [never] ? (Help

| ("version" extends MethodsOf ? Version

: never) | ("execute" extends MethodsOf ? AddModel> extends infer Bound extends ModelsByRoute ? Execute : never : never) | ParseChildren, P, AddModel>>) : ParseIncrement; +type ParseChildren = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[] +] ? (ParseAt, Models> | ParseChildren) : never; +type RequirementsIn

= P extends readonly [ + infer Head extends AnyPhase, + ...infer Tail extends AnyPhase[] +] ? [RequirementIn] extends [never] ? readonly [] : readonly [RequirementIn, ...RequirementsIn] : readonly []; +type AddModel = { + [K in keyof Models | P]: K extends P ? T : K extends keyof Models ? Models[K] : never; +}; +type Split = string extends S ? Path : S extends `${infer Head}/${infer Tail}` ? [Head, ...Split] : S extends "" ? [] : [S]; +type Append = A extends "/" ? `/${N}` : `${A}/${N}`; +type AddParam

= P extends Next ? Next, Routes, Requirement> : P extends Done ? Done, Routes> : never; +export type AddParamToLast

= ReplaceLast, K, V>>; +export type AddRoutesToLast

= ReplaceLast, C>>; +type LastOf

= P extends readonly [ + ...AnyPhase[], + infer Last extends AnyPhase +] ? Last : never; +type ReplaceLast

= P extends readonly [AnyPhase] ? readonly [Last] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [First, ...Middle, Last] : never; +type AddRoutes = Phase extends Next ? Next : Phase extends Done ? Done : never; +export type AddField = Simplify & { + [P in K]: V; +}>; +type Simplify = { + [P in keyof T]: T[P]; +}; +type IntentsAt = Help

| ("version" extends MethodsOf ? Version

: never) | ("execute" extends MethodsOf ? AddModel> extends infer Bound extends ModelsByRoute ? Execute : never : never) | ChildIntents, P, AddModel>>; +export {}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts.map new file mode 100644 index 00000000..ca268e6f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/types.d.ts.map @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C,EACD,OAAO,CAAC,CAAC,CAAC,CACX,SAAS,MAAM,KAAK,SAAS,aAAa,GAAG,OAAO,CACjD,CAAC,EACD;KAAG,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAAE,CACjC,GACD,KAAK,GACL,KAAK,CACV,GACC,YAAY,CACZ,UAAU,CAAC,CAAC,CAAC,EACb,CAAC,EACD,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAChC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/types.js b/packages/cli/vendor/configliere-pr32/esm/lib/types.js new file mode 100644 index 00000000..718fd38a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/types.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/types.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/types.js.map new file mode 100644 index 00000000..95612423 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts b/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts new file mode 100644 index 00000000..bae0e969 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts @@ -0,0 +1,30 @@ +import type { Maybe } from "./maybe.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; +export type ValueSource = { + name: string; + value: unknown; +}; +export declare function withValues(values: readonly ValueSource[]): IdentityElement; +export type ValueClaim = { + result: Maybe<{ + source: string; + address: readonly string[]; + value: unknown; + }>; + rest: Values; +}; +export declare class Values { + mounts: Map; + claims: Set; + constructor(mounts?: Map, claims?: Set); + mount(path: readonly string[], sources: readonly ValueSource[]): Values; + claim({ route, address }: ClaimOptions): ValueClaim; +} +export interface ClaimOptions { + route: readonly string[]; + address: readonly string[]; +} +type ClaimId = string; +export {}; +//# sourceMappingURL=values.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts.map new file mode 100644 index 00000000..3ba7281b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/values.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,WAAW,EAAE,GAC7B,eAAe,CAAC,QAAQ,CAAC,CAe3B;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,KAAK,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QAC3B,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC,CAAC;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,MAAM;IACjB,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;gBAGnB,MAAM,GAAE,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,CAAa,EACjD,MAAM,GAAE,GAAG,CAAC,OAAO,CAAa;IAMlC,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM;IAevE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,UAAU;CA8BpD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,KAAK,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/values.js b/packages/cli/vendor/configliere-pr32/esm/lib/values.js new file mode 100644 index 00000000..093bd378 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/values.js @@ -0,0 +1,94 @@ +import { brand } from "./pipeline.js"; +export function withValues(values) { + return brand((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + values: phase.values.concat(values), + }); + return { + ...route, + phases, + }; + }); +} +export class Values { + constructor(mounts = new Map(), claims = new Set()) { + Object.defineProperty(this, "mounts", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claims", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.mounts = mounts; + this.claims = claims; + } + mount(path, sources) { + if (sources.length === 0) { + return this; + } + const id = routeId(path); + return new Values(new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), this.claims); + } + claim({ route, address }) { + let id = claimId([...route, ...address]); + const nope = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + for (let end = route.length; end >= 0; end--) { + let mountId = routeId(route.slice(0, end)); + let sources = this.mounts.get(mountId) ?? []; + for (let { name, value } of sources) { + let result = find(value, [...route.slice(end), ...address]); + if (result.exists) { + let rest = new Values(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + value: result.value, + }, + }, + rest, + }; + } + } + } + return nope; + } +} +function routeId(address) { + return `/${address.join("/")}`; +} +function claimId(address) { + return JSON.stringify(address); +} +function find(value, path) { + let current = value; + for (let key of path) { + if (current === null || + (typeof current !== "object" && typeof current !== "function") || + !Object.hasOwn(current, key)) { + return { exists: false }; + } + current = current[key]; + } + return { + exists: true, + value: current, + }; +} +//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/lib/values.js.map b/packages/cli/vendor/configliere-pr32/esm/lib/values.js.map new file mode 100644 index 00000000..f819b8e5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/lib/values.js.map @@ -0,0 +1 @@ +{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAwB,MAAM,eAAe,CAAC;AAQ5D,MAAM,UAAU,UAAU,CACxB,MAA8B;IAE9B,OAAO,KAAK,CACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAWD,MAAM,OAAO,MAAM;IAIjB,YACE,SAAwC,IAAI,GAAG,EAAE,EACjD,SAAuB,IAAI,GAAG,EAAE;QALlC;;;;;WAAsC;QACtC;;;;;WAAqB;QAMnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,IAAuB,EAAE,OAA+B;QAC5D,IAAI,OAAO,C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pr32/esm/mod.d.ts b/packages/cli/vendor/configliere-pr32/esm/mod.d.ts new file mode 100644 index 00000000..27b887a3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/mod.d.ts @@ -0,0 +1,29 @@ +import "./_dnt.polyfills.js"; +export { argument } from "./lib/argument.js"; +export { extend } from "./lib/extend.js"; +export { command } from "./lib/command.js"; +export type { CommandZero } from "./lib/command.js"; +export { checkpoint } from "./lib/checkpoint.js"; +export { dynamic } from "./lib/dynamic.js"; +export { description, name } from "./lib/definition.js"; +export { env, withEnvs } from "./lib/env.js"; +export type { Environment, EnvSource } from "./lib/env.js"; +export { option } from "./lib/option.js"; +export { multiple, param, schema } from "./lib/param.js"; +export type { Param } from "./lib/param.js"; +export { parse } from "./lib/parse.js"; +export { mark } from "./lib/pipeline.js"; +export type { ModelTransformElement, Transform, TransformElement, } from "./lib/pipeline.js"; +export { printErrors, printHelp, printVersion } from "./lib/print.js"; +export type { Rest } from "./lib/rest.js"; +export { cli } from "./lib/read.js"; +export type { CLIOptions, CLIRead, ReadCLI, Symbol as CLISymbol, } from "./lib/read.js"; +export { executable, route, routes, transform, version } from "./lib/route.js"; +export type { RouteZero } from "./lib/route.js"; +export { toggle } from "./lib/toggle.js"; +export { withValues } from "./lib/values.js"; +export type { ValueSource } from "./lib/values.js"; +export type { Literal } from "./lib/tokenize.js"; +export type { Result } from "./lib/result.js"; +export type { AnyIntent, AnyRoute, Definition, Execute, Help, Input, Intent, IntentsOf, Issue, Method, MethodNotAllowed, MethodsOf, ModelOf, ModelParams, ModelsByRoute, ModelSchema, Outcome, Path, PathOf, Route, RoutePath, Schema, UnprocessableContent, Version, } from "./lib/types.js"; +//# sourceMappingURL=mod.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/mod.d.ts.map b/packages/cli/vendor/configliere-pr32/esm/mod.d.ts.map new file mode 100644 index 00000000..b5c0b8f9 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/mod.d.ts.map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vB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,YAAY,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,WAAW,EACX,aAAa,EACb,WAAW,EACX,OAAO,EACP,IAAI,EACJ,MAAM,EACN,KAAK,EACL,SAAS,EACT,MAAM,EACN,oBAAoB,EACpB,OAAO,GACR,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/mod.js b/packages/cli/vendor/configliere-pr32/esm/mod.js new file mode 100644 index 00000000..dad1707d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/mod.js @@ -0,0 +1,18 @@ +import "./_dnt.polyfills.js"; +export { argument } from "./lib/argument.js"; +export { extend } from "./lib/extend.js"; +export { command } from "./lib/command.js"; +export { checkpoint } from "./lib/checkpoint.js"; +export { dynamic } from "./lib/dynamic.js"; +export { description, name } from "./lib/definition.js"; +export { env, withEnvs } from "./lib/env.js"; +export { option } from "./lib/option.js"; +export { multiple, param, schema } from "./lib/param.js"; +export { parse } from "./lib/parse.js"; +export { mark } from "./lib/pipeline.js"; +export { printErrors, printHelp, printVersion } from "./lib/print.js"; +export { cli } from "./lib/read.js"; +export { executable, route, routes, transform, version } from "./lib/route.js"; +export { toggle } from "./lib/toggle.js"; +export { withValues } from "./lib/values.js"; +//# sourceMappingURL=mod.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/mod.js.map b/packages/cli/vendor/configliere-pr32/esm/mod.js.map new file mode 100644 index 00000000..a84567ff --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/mod.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE3C,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAG7C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAOzC,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAItE,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAQpC,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG/E,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/esm/package.json b/packages/cli/vendor/configliere-pr32/esm/package.json new file mode 100644 index 00000000..3dbc1ca5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/esm/package.json @@ -0,0 +1,3 @@ +{ + "type": "module" +} diff --git a/packages/cli/vendor/configliere-pr32/package.json b/packages/cli/vendor/configliere-pr32/package.json new file mode 100644 index 00000000..457a3945 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/package.json @@ -0,0 +1,31 @@ +{ + "name": "configliere", + "version": "0.4.0-pr+08b3a6835a0c8be9c7b946e26f0e4f0706155964", + "description": "Configuration for programs", + "author": "engineering@frontside.com", + "repository": { + "type": "git", + "url": "git+https://github.com/thefrontside/configliere.git" + }, + "license": "MIT", + "bugs": { + "url": "https://github.com/thefrontside/configliere/issues" + }, + "main": "./script/mod.js", + "module": "./esm/mod.js", + "exports": { + ".": { + "import": "./esm/mod.js", + "require": "./script/mod.js" + } + }, + "scripts": {}, + "engines": { + "node": ">= 16" + }, + "sideEffects": false, + "dependencies": { + "@standard-schema/spec": "^1.1.0" + }, + "_generatedBy": "dnt@dev" +} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts new file mode 100644 index 00000000..88554f87 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts @@ -0,0 +1,29 @@ +declare global { + interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param o An object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; + } +} +export {}; +declare global { + interface String { + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replaceAll(searchValue: string | RegExp, replaceValue: string): string; + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replaceAll(searchValue: string | RegExp, replacer: (substring: string, ...args: any[]) => string): string; + } +} +export {}; +//# sourceMappingURL=_dnt.polyfills.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts.map b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts.map new file mode 100644 index 00000000..78997460 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"_dnt.polyfills.d.ts","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":"AAeA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd;;;;WAIG;QACH,MAAM,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC;KAC5C;CACF;AAED,OAAO,EAAE,CAAC;AACV,OAAO,CAAC,MAAM,CAAC;IAEb,UAAU,MAAM;QACd;;;;WAIG;QACH,UAAU,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;QAEvE;;;;WAIG;QACH,UAAU,CACR,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,MAAM,GACtD,MAAM,CAAC;KACX;CACF;AAsBD,OAAO,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js new file mode 100644 index 00000000..199446ae --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js +if (!Object.hasOwn) { + Object.defineProperty(Object, "hasOwn", { + value: function (object, property) { + if (object == null) { + throw new TypeError("Cannot convert undefined or null to object"); + } + return Object.prototype.hasOwnProperty.call(Object(object), property); + }, + configurable: true, + enumerable: false, + writable: true, + }); +} +/** + * String.prototype.replaceAll() polyfill + * https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/ + * @author Chris Ferdinandi + * @license MIT + */ +if (!String.prototype.replaceAll) { + String.prototype.replaceAll = function (str, newStr) { + // If a regex pattern + if (Object.prototype.toString.call(str).toLowerCase() === "[object regexp]") { + return this.replace(str, newStr); + } + // If a string + return this.replace(new RegExp(str, "g"), newStr); + }; +} +//# sourceMappingURL=_dnt.polyfills.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js.map b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js.map new file mode 100644 index 00000000..98e127db --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/_dnt.polyfills.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_dnt.polyfills.js","sourceRoot":"","sources":["../src/_dnt.polyfills.ts"],"names":[],"mappings":";;AAAA,0FAA0F;AAC1F,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IACnB,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,EAAE;QACtC,KAAK,EAAE,UAAU,MAAW,EAAE,QAAa;YACzC,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;gBACnB,MAAM,IAAI,SAAS,CAAC,4CAA4C,CAAC,CAAC;YACpE,CAAC;YACD,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;QACxE,CAAC;QACD,YAAY,EAAE,IAAI;QAClB,UAAU,EAAE,KAAK;QACjB,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC;AAoCD;;;;;GAKG;AACH,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAAE,CAAC;IACjC,MAAM,CAAC,SAAS,CAAC,UAAU,GAAG,UAAU,GAAQ,EAAE,MAAW;QAC3D,qBAAqB;QACrB,IACE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,KAAK,iBAAiB,EACvE,CAAC;YACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACnC,CAAC;QAED,cAAc;QACd,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;IACpD,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts new file mode 100644 index 00000000..03ac729e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts @@ -0,0 +1,8 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function argument(named: Definition, ...elements: E & Check, E>): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=argument.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts.map new file mode 100644 index 00000000..5c31b095 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/argument.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../src/lib/argument.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAC/C,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,QAAQ,CACtB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAC3C,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAwB1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/argument.js b/packages/cli/vendor/configliere-pr32/script/lib/argument.js new file mode 100644 index 00000000..d28e3d10 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/argument.js @@ -0,0 +1,61 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.argument = argument; +const param_js_1 = require("./param.js"); +const pipeline_js_1 = require("./pipeline.js"); +function argument(named, ...elements) { + const added = elements.reduce((value, element) => element(value), (0, param_js_1.param)(named, positional)); + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +function positional(param) { + return { + ...param, + cli: { + read, + syntax: { + type: "argument", + label: `<${param.name.toUpperCase()}>`, + }, + }, + }; +} +const read = (tokens) => { + let claim = tokens.claimOne((token) => token.type === "word"); + let [word] = claim.tokens; + return word + ? { + claim, + result: { + ok: true, + value: { exists: true, value: word.text }, + issues: [], + }, + } + : nothing(tokens); +}; +function nothing(tokens) { + let claim = tokens.claimAll(() => false); + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} +//# sourceMappingURL=argument.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/argument.js.map b/packages/cli/vendor/configliere-pr32/script/lib/argument.js.map new file mode 100644 index 00000000..5631b827 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/argument.js.map @@ -0,0 +1 @@ +{"version":3,"file":"argument.js","sourceRoot":"","sources":["../../src/lib/argument.ts"],"names":[],"mappings":";;AAYA,4BA8BC;AA1CD,yCAA+C;AAC/C,+CAMuB;AAKvB,SAAgB,QAAQ,CAItB,KAAoB,EACpB,GAAG,QAAyC;IAE5C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAA,gBAAK,EAAC,KAAK,EAAE,UAAU,CAAC,CACC,CAAC;IAE5B,OAAO,IAAA,mBAAK,EACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,MAAM;gBACf,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK;aACpB;SACF,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAQD,SAAS,UAAU,CAAmC,KAAQ;IAC5D,OAAO;QACL,GAAG,KAAK;QACR,GAAG,EAAE;YACH,IAAI;YACJ,MAAM,EAAE;gBACN,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG;aACvC;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,IAAI,GAAY,CAAC,MAAM,EAAW,EAAE;IACxC,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAiB,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC;IAC7E,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IAE1B,OAAO,IAAI;QACT,CAAC,CAAC;YACA,KAAK;YACL,MAAM,EAAE;gBACN,EAAE,EAAE,IAAI;gBACR,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE;gBACzC,MAAM,EAAE,EAAE;aACX;SACF;QACD,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AACtB,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,MAA8B;IAC7C,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;IAEzC,OAAO;QACL,KAAK;QACL,MAAM,EAAE;YACN,EAAE,EAAE,IAAI;YACR,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;YACxB,MAAM,EAAE,EAAE;SACX;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts new file mode 100644 index 00000000..ca5c03ca --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts @@ -0,0 +1,42 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import type { Symbol } from "./read.js"; +import type { Rest } from "./rest.js"; +import type { Result } from "./result.js"; +import type { TokenInput, TokenRange } from "./tokenizer.js"; +import type { AnyPhase, Issue, Path } from "./types.js"; +export interface Binding { + readonly rest: Rest; + readonly result: Result; +} +export interface PhaseBinding { + readonly rest: Rest; + readonly model: Record; + readonly issues: Issue[]; + readonly valid: boolean; +} +export interface PhaseSegment { + readonly range: TokenRange; + readonly path: Path; +} +export declare function fromCLI(options: { + readonly param: Param; + readonly view: TokenInput; + readonly rest: Rest; +}): Maybe>; +export declare function fromValues(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe>; +export declare function fromEnv(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe>; +export declare function bindPhase(options: { + readonly phase: AnyPhase; + readonly segment: PhaseSegment; + readonly rest: Rest; +}): PhaseBinding; +//# sourceMappingURL=bind.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts.map new file mode 100644 index 00000000..720e8a5f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/bind.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../src/lib/bind.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAW,MAAM,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,UAAU,EAAa,UA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CAAC,CAAC,CAqBpB;AAED,wBAAgB,OAAO,CAAC,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE;IAC1D,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAwBpB;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE;IACjC,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB,GAAG,YAAY,CAyGf"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/bind.js b/packages/cli/vendor/configliere-pr32/script/lib/bind.js new file mode 100644 index 00000000..55e2f027 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/bind.js @@ -0,0 +1,244 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.fromCLI = fromCLI; +exports.fromValues = fromValues; +exports.fromEnv = fromEnv; +exports.bindPhase = bindPhase; +function fromCLI(options) { + let { param, view, rest } = options; + return fromRead(param, param.cli.read(view), rest); +} +function fromValues(options) { + let { param, route, rest } = options; + let claim = rest.values.claim({ + route, + address: [param.name], + }); + if (!claim.result.exists) { + return { exists: false }; + } + return { + exists: true, + value: { + rest: { + ...rest, + values: claim.rest, + }, + result: validate(param, claim.result.value.value, [param.name]), + }, + }; +} +function fromEnv(options) { + let { param, route, rest } = options; + let claim = rest.envs.claim({ + route, + address: [param.name], + key: param.env, + }); + if (!claim.result.exists) { + return { exists: false }; + } + let value = claim.result.value.value; + return { + exists: true, + value: { + rest: { + ...rest, + envs: claim.rest, + }, + result: decode(param, value, param.decode(value), [param.name]), + }, + }; +} +function bindPhase(options) { + let { phase, segment } = options; + let rest = options.rest; + let params = Object.values(phase.params); + let pending = new Map(params.map((param) => [param.name, param])); + let results = new Map(); + function settle(param, binding) { + rest = binding.rest; + results.set(param.name, binding.result); + pending.delete(param.name); + } + function accept(param, attempt) { + if (!attempt.exists) { + return; + } + settle(param, attempt.value); + } + // Every pending reader proposes a claim against the same immutable view. + // Commit the proposal beginning earliest in argv, then recompute the view. + // This lets `--port 9000` outrank a positional claim on `9000` without + // attaching binding-policy metadata to either reader. + while (true) { + let horizon = first(rest.tokens, segment.range); + let offer; + for (let param of pending.values()) { + let view = rest.tokens.view({ + range: segment.range, + // Repeated options must see every occurrence in the phase, not only + // the first option/value pair before the binding horizon. + through: param.multiple ? undefined : horizon?.index, + }); + let read = param.cli.read(view, param.multiple); + if (read.result.ok && !read.result.value.exists) { + continue; + } + let index = earliest(read.claim.tokens); + if (!offer || index < offer.index) { + offer = { param, read, index }; + } + } + if (!offer) { + break; + } + accept(offer.param, fromRead(offer.param, offer.read, rest)); + } + // Address sources have stable visibility once the route is known. They are + // tried only after CLI has reached its fixed point so a provisional CLI miss + // cannot let a lower-priority source settle the parameter too early. + for (let source of [fromEnv, fromValues]) { + for (let param of pending.values()) { + accept(param, source({ + param, + route: segment.path, + rest, + })); + } + } + // Only total absence reaches the schema as undefined. This is where required, + // optional, and defaulting parameters diverge. + for (let param of pending.values()) { + results.set(param.name, validate(param, undefined, [param.name])); + } + let model = {}; + let issues = []; + let valid = true; + // Collect in declaration order, independent of the source or sweep that + // settled each parameter. + for (let param of params) { + let result = results.get(param.name); + issues.push(...result.issues ?? []); + if (result.ok) { + model[param.name] = result.value; + } + else { + valid = false; + } + } + return { rest, model, issues, valid }; +} +function fromRead(param, read, rest) { + let path = [param.name]; + if (!read.result.ok) { + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result: read.result, + }, + }; + } + if (!read.result.value.exists) { + return { exists: false }; + } + let value = read.result.value.value; + let result = Array.isArray(value) ? decodeMany(param, value, path) : decode(param, value, typeof value === "string" ? param.decode(value) : [value], path); + result = merge(result, read.result.issues); + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result, + }, + }; +} +function decodeMany(param, values, path) { + let candidates = [[]]; + for (let value of values) { + let decoded = typeof value === "string" ? param.decode(value) : [value]; + candidates = candidates.flatMap((prefix) => decoded.map((candidate) => [...prefix, candidate])); + } + return decode(param, values, candidates, path); +} +function decode(param, value, candidates, path) { + if (candidates.length === 0) { + return { + ok: false, + issues: [{ + message: `unable to decode ${JSON.stringify(value)}`, + path, + }], + }; + } + let issues; + for (let candidate of candidates) { + let result = validate(param, candidate, path); + if (result.ok) { + return result; + } + issues = issues ?? result.issues; + } + return { + ok: false, + issues: issues ?? [], + }; +} +function validate(param, value, path) { + let validated = param.schema["~standard"].validate(value); + if (validated instanceof Promise) { + return { + ok: false, + issues: [{ + message: `async schemas are not allowed`, + path, + }], + }; + } + if (validated.issues) { + return { + ok: false, + issues: validated.issues.map((issue) => ({ + ...issue, + message: issue.message, + path, + })), + }; + } + return { + ok: true, + issues: [], + value: validated.value, + }; +} +function merge(result, issues) { + if (!issues || issues.length === 0) { + return result; + } + return { + ...result, + issues: [...issues, ...(result.issues ?? [])], + }; +} +function first(tokens, range) { + for (let token of tokens.view({ range })) { + if (token.type === "word") { + return token; + } + } +} +function earliest(tokens) { + let first = Infinity; + for (let token of tokens) { + first = Math.min(first, token.index); + } + return first; +} +//# sourceMappingURL=bind.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/bind.js.map b/packages/cli/vendor/configliere-pr32/script/lib/bind.js.map new file mode 100644 index 00000000..b46d6f7e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/bind.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bind.js","sourceRoot":"","sources":["../../src/lib/bind.ts"],"names":[],"mappings":";;AA0BA,0BAOC;AAED,gCAyBC;AAED,0BA4BC;AAED,8BA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AAK,GAAG,QAAQ,CAAC;IAErB,KAAK,IAAI,KAAK,IAAI,MAAM,EAAE,CAAC;QACzB,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts new file mode 100644 index 00000000..9e102601 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts @@ -0,0 +1,4 @@ +import type { DynamicElement } from "./pipeline.js"; +import { type ValueSource, withValues } from "./values.js"; +export declare function checkpoint(): DynamicElement>; +//# sourceMappingURL=checkpoint.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts.map new file mode 100644 index 00000000..dda3e967 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checkpoint.d.ts","sourceRoot":"","sources":["../../src/lib/checkpoint.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,KAAK,WAAW,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE3D,wBAAgB,UAAU,IAAI,cAAc,CAC1C,WAAW,EAAE,EACb,UAAU,CAAC,OAAO,UAAU,CAAC,CAC9B,CAEA"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js new file mode 100644 index 00000000..17356e02 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.checkpoint = checkpoint; +const dynamic_js_1 = require("./dynamic.js"); +const values_js_1 = require("./values.js"); +function checkpoint() { + return (0, dynamic_js_1.dynamic)((values) => (0, values_js_1.withValues)(values)); +} +//# sourceMappingURL=checkpoint.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js.map b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js.map new file mode 100644 index 00000000..e0edadc6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/checkpoint.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checkpoint.js","sourceRoot":"","sources":["../../src/lib/checkpoint.ts"],"names":[],"mappings":";;AAIA,gCAKC;AATD,6CAAuC;AAEvC,2CAA2D;AAE3D,SAAgB,UAAU;IAIxB,OAAO,IAAA,oBAAO,EAAC,CAAC,MAAqB,EAAE,EAAE,CAAC,IAAA,sBAAU,EAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts new file mode 100644 index 00000000..b830c091 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts @@ -0,0 +1,8 @@ +import type { Check, Fold, Materialize, Unary } from "./pipeline.js"; +import type { Definition, Done, Route } from "./types.js"; +export type CommandZero = Route +]>; +export declare function command(start: Definition, ...elements: E & Check, E>): Materialize, E>>; +//# sourceMappingURL=command.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts.map new file mode 100644 index 00000000..b8ed27c6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/command.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/lib/command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1D,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,KAAK,CACxD,CAAC,EACD,MAAM,GAAG,SAAS,EAClB,EAAE,EACF;CAAE,EACF;IAAC,IAAI,CAAC,EAAE,EAAE,EAAE,CAAC;CAAC,CACf,CAAC;AAEF,wBAAgB,OAAO,CACrB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACxC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAgBtC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/command.js b/packages/cli/vendor/configliere-pr32/script/lib/command.js new file mode 100644 index 00000000..b0fa0aeb --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/command.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.command = command; +function command(start, ...elements) { + let zero = { + ...start, + methods: ["help", "execute"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + return elements.reduce((value, element) => element(value), zero); +} +//# sourceMappingURL=command.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/command.js.map b/packages/cli/vendor/configliere-pr32/script/lib/command.js.map new file mode 100644 index 00000000..dcb6d10f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/command.js.map @@ -0,0 +1 @@ +{"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/lib/command.ts"],"names":[],"mappings":";;AAYA,0BAsBC;AAtBD,SAAgB,OAAO,CAIrB,KAAoB,EACpB,GAAG,QAAsC;IAEzC,IAAI,IAAI,GAAmB;QACzB,GAAG,KAAK;QACR,OAAO,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;QAC5B,MAAM,EAAE,CAAC;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT,CAAC;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAI,CACmC,CAAC;AAC5C,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts new file mode 100644 index 00000000..1030ec68 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts @@ -0,0 +1,2 @@ +export declare function dasherize(name: string): string; +//# sourceMappingURL=dasherize.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts.map new file mode 100644 index 00000000..09e7ce84 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dasherize.d.ts","sourceRoot":"","sources":["../../src/lib/dasherize.ts"],"names":[],"mappings":"AAAA,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAM9C"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js new file mode 100644 index 00000000..e7f0625d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dasherize = dasherize; +function dasherize(name) { + return name + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2") + .replace(/([a-z\d])([A-Z])/g, "$1-$2") + .replace(/[\s_]+/g, "-") + .toLowerCase(); +} +//# sourceMappingURL=dasherize.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js.map b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js.map new file mode 100644 index 00000000..18f1fc32 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dasherize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dasherize.js","sourceRoot":"","sources":["../../src/lib/dasherize.ts"],"names":[],"mappings":";;AAAA,8BAMC;AAND,SAAgB,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI;SACR,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;SACvB,WAAW,EAAE,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts new file mode 100644 index 00000000..69a15d4c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts @@ -0,0 +1,5 @@ +export type Decoder = (value: string) => unknown[]; +export declare const number: Decoder; +export declare const scalar: Decoder; +export declare const boolean: Decoder; +//# sourceMappingURL=decode.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts.map new file mode 100644 index 00000000..fdfe30f1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.d.ts","sourceRoot":"","sources":["../../src/lib/decode.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,CAAC;AAEnD,eAAO,MAAM,MAAM,EAAE,OAOpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,OAEpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,OAQrB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/decode.js b/packages/cli/vendor/configliere-pr32/script/lib/decode.js new file mode 100644 index 00000000..759276d8 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/decode.js @@ -0,0 +1,27 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.boolean = exports.scalar = exports.number = void 0; +const number = (value) => { + if (!numeric.test(value)) { + return []; + } + let decoded = Number(value); + return Number.isFinite(decoded) ? [decoded] : []; +}; +exports.number = number; +const scalar = (value) => { + return [...(0, exports.number)(value), value]; +}; +exports.scalar = scalar; +const boolean = (value) => { + if (value === "true") { + return [true]; + } + if (value === "false") { + return [false]; + } + return []; +}; +exports.boolean = boolean; +const numeric = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/; +//# sourceMappingURL=decode.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/decode.js.map b/packages/cli/vendor/configliere-pr32/script/lib/decode.js.map new file mode 100644 index 00000000..f383b279 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode.js","sourceRoot":"","sources":["../../src/lib/decode.ts"],"names":[],"mappings":";;;AAEO,MAAM,MAAM,GAAY,CAAC,KAAK,EAAE,EAAE;IACvC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,IAAI,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC5B,OAAO,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AACnD,CAAC,CAAC;AAPW,QAAA,MAAM,UAOjB;AAEK,MAAM,MAAM,GAAY,CAAC,KAAK,EAAE,EAAE;IACvC,OAAO,CAAC,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC;AACnC,CAAC,CAAC;AAFW,QAAA,MAAM,UAEjB;AAEK,MAAM,OAAO,GAAY,CAAC,KAAK,EAAE,EAAE;IACxC,IAAI,KAAK,KAAK,MAAM,EAAE,CAAC;QACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IACD,IAAI,KAAK,KAAK,OAAO,EAAE,CAAC;QACtB,OAAO,CAAC,KAAK,CAAC,CAAC;IACjB,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AARW,QAAA,OAAO,WAQlB;AAEF,MAAM,OAAO,GAAG,oCAAoC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts new file mode 100644 index 00000000..244cc1b6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts @@ -0,0 +1,5 @@ +import { type IdentityElement } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function name(name: N): Definition; +export declare function description(description: string): IdentityElement>; +//# sourceMappingURL=definition.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts.map new file mode 100644 index 00000000..24001485 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/definition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.d.ts","sourceRoot":"","sources":["../../src/lib/definition.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAE7D;AAED,wBAAgB,WAAW,CACzB,WAAW,EAAE,MAAM,GAClB,eAAe,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAOrC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/definition.js b/packages/cli/vendor/configliere-pr32/script/lib/definition.js new file mode 100644 index 00000000..2debe309 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/definition.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.name = name; +exports.description = description; +const pipeline_js_1 = require("./pipeline.js"); +function name(name) { + return { name }; +} +function description(description) { + return (0, pipeline_js_1.brand)((definition) => ({ + ...definition, + description, + })); +} +//# sourceMappingURL=definition.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/definition.js.map b/packages/cli/vendor/configliere-pr32/script/lib/definition.js.map new file mode 100644 index 00000000..26824220 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/definition.js.map @@ -0,0 +1 @@ +{"version":3,"file":"definition.js","sourceRoot":"","sources":["../../src/lib/definition.ts"],"names":[],"mappings":";;AAGA,oBAEC;AAED,kCASC;AAhBD,+CAA4D;AAG5D,SAAgB,IAAI,CAAmB,IAAO;IAC5C,OAAO,EAAE,IAAI,EAAE,CAAC;AAClB,CAAC;AAED,SAAgB,WAAW,CACzB,WAAmB;IAEnB,OAAO,IAAA,mBAAK,EAAsC,CAChD,UAA8B,EAC9B,EAAE,CAAC,CAAC;QACJ,GAAG,UAAU;QACb,WAAW;KACZ,CAAC,CAAC,CAAC;AACN,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts new file mode 100644 index 00000000..6cbb893d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts @@ -0,0 +1,7 @@ +import type { AnyRoute } from "./types.js"; +import { type AnyElement, type DynamicElement } from "./pipeline.js"; +export type { ConjoinPhases, Seed } from "./pipeline.js"; +export type PhaseOf = R["phases"][0]; +export type PhasesOf = R["phases"]; +export declare function dynamic(extension: (requires: Requirement) => E, ..._valid: E extends AnyElement ? [] : [never]): DynamicElement>; +//# sourceMappingURL=dynamic.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts.map new file mode 100644 index 00000000..ffe29059 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic.d.ts","sourceRoot":"","sources":["../../src/lib/dynamic.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,KAAK,UAAU,EAAS,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAE5E,YAAY,EAAE,aAAa,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACzD,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,QAAQ,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC;AAEvD,wBAAgB,OAAO,CACrB,WAAW,EACX,CAAC,EAED,SAAS,EAAE,CAAC,QAAQ,EAAE,WAAW,KAAK,CAAC,EACvC,GAAG,MAAM,EAAE,CAAC,SAAS,UAAU,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAC7C,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAsBrD"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js new file mode 100644 index 00000000..5a8fb089 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js @@ -0,0 +1,22 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dynamic = dynamic; +const pipeline_js_1 = require("./pipeline.js"); +function dynamic(extension, ..._valid) { + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + resolver: extension, + }); + phases.push({ + params: {}, + routes: [], + values: [], + envs: [], + }); + return { ...route, phases }; + }); +} +//# sourceMappingURL=dynamic.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js.map b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js.map new file mode 100644 index 00000000..78b9bb15 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/dynamic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dynamic.js","sourceRoot":"","sources":["../../src/lib/dynamic.ts"],"names":[],"mappings":";;AAOA,0BA4BC;AAlCD,+CAA4E;AAM5E,SAAgB,OAAO,CAIrB,SAAuC,EACvC,GAAG,MAA2C;IAE9C,OAAO,IAAA,mBAAK,EACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAE1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,QAAQ,EAAE,SAEqB;SAChC,CAAC,CAAC;QACH,MAAM,CAAC,IAAI,CAAC;YACV,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,EAAE;SACT,CAAC,CAAC;QAEH,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC;IAC9B,CAAC,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts new file mode 100644 index 00000000..f3a661ac --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts @@ -0,0 +1,35 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; +export interface EnvSource { + readonly name: string; + readonly value: Environment; +} +export type Environment = Readonly>; +export interface EnvClaim { + readonly result: Maybe<{ + readonly source: string; + readonly address: readonly string[]; + readonly key: string; + readonly value: string; + }>; + readonly rest: Envs; +} +export interface EnvClaimOptions { + readonly route: readonly string[]; + readonly address: readonly string[]; + readonly key?: string; +} +export declare function env(key: string): IdentityElement>; +export declare function withEnvs(envs: readonly EnvSource[]): IdentityElement; +export declare class Envs { + mounts: Map; + claims: Set; + constructor(mounts?: Map, claims?: Set); + mount(path: readonly string[], sources: readonly EnvSource[]): Envs; + claim({ route, address, key }: EnvClaimOptions): EnvClaim; +} +type ClaimId = string; +export {}; +//# sourceMappingURL=env.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts.map new file mode 100644 index 00000000..8bab5de7 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/env.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,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Aa;IAMlC,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,SAAS,EAAE,GAAG,IAAI;IAenE,KAAK,CACH,EAAE,KAAK,EAAE,OAAO,EAAE,GAAoC,EAAE,EAAE,eAAe,GACxE,QAAQ;CAkCZ;AAED,KAAK,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/env.js b/packages/cli/vendor/configliere-pr32/script/lib/env.js new file mode 100644 index 00000000..e991c338 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/env.js @@ -0,0 +1,100 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Envs = void 0; +exports.env = env; +exports.withEnvs = withEnvs; +const pipeline_js_1 = require("./pipeline.js"); +function env(key) { + return (0, pipeline_js_1.brand)((param) => ({ ...param, env: key })); +} +function withEnvs(envs) { + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + envs: phase.envs.concat(envs), + }); + return { + ...route, + phases, + }; + }); +} +class Envs { + constructor(mounts = new Map(), claims = new Set()) { + Object.defineProperty(this, "mounts", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claims", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.mounts = mounts; + this.claims = claims; + } + mount(path, sources) { + if (sources.length === 0) { + return this; + } + let id = routeId(path); + return new Envs(new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), this.claims); + } + claim({ route, address, key = envKey([...route, ...address]) }) { + let id = claimId([...route, ...address]); + let nope = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + for (let end = route.length; end >= 0; end--) { + let mount = routeId(route.slice(0, end)); + let sources = this.mounts.get(mount) ?? []; + for (let { name, value } of sources) { + if (!Object.hasOwn(value, key) || typeof value[key] === "undefined") { + continue; + } + let rest = new Envs(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + key, + value: value[key], + }, + }, + rest, + }; + } + } + return nope; + } +} +exports.Envs = Envs; +function routeId(path) { + return `/${path.join("/")}`; +} +function claimId(address) { + return JSON.stringify(address); +} +function envKey(address) { + return address.map(normalize).filter(Boolean).join("_"); +} +function normalize(value) { + return value + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2") + .replace(/([a-z\d])([A-Z])/g, "$1_$2") + .replace(/[^A-Za-z\d]+/g, "_") + .replace(/^_+|_+$/g, "") + .toUpperCase(); +} +//# sourceMappingURL=env.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/env.js.map b/packages/cli/vendor/configliere-pr32/script/lib/env.js.map new file mode 100644 index 00000000..4412c5f0 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/env.js.map @@ -0,0 +1 @@ +{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/lib/env.ts"],"names":[],"mappings":";;;AA4BA,kBAMC;AAED,4BAiBC;AAnDD,+CAA4D;AA0B5D,SAAgB,GAAG,CACjB,GAAW;IAEX,OAAO,IAAA,mBAAK,EACV,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,CAC5D,CAAC;AACJ,CAAC;AAED,SAAgB,QAAQ,CACtB,IAA0B;IAE1B,OAAO,IAAA,mBAAK,EACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;SAC9B,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;Y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AC,CAAC;AAC1D,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,KAAK;SACT,OAAO,CAAC,uBAAuB,EAAE,OAAO,CAAC;SACzC,OAAO,CAAC,mBAAmB,EAAE,OAAO,CAAC;SACrC,OAAO,CAAC,eAAe,EAAE,GAAG,CAAC;SAC7B,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,WAAW,EAAE,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts new file mode 100644 index 00000000..36572bb7 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts @@ -0,0 +1,3 @@ +import { type Extension, type Unary } from "./pipeline.js"; +export declare function extend(...elements: E): Extension; +//# sourceMappingURL=extend.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts.map new file mode 100644 index 00000000..018bbdd4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/extend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extend.d.ts","sourceRoot":"","sources":["../../src/lib/extend.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,eAAe,CAAC;AAElE,wBAAgB,MAAM,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EACrD,GAAG,QAAQ,EAAE,CAAC,GACb,SAAS,CAAC,CAAC,CAAC,CAOd"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/extend.js b/packages/cli/vendor/configliere-pr32/script/lib/extend.js new file mode 100644 index 00000000..87c18c47 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/extend.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.extend = extend; +const pipeline_js_1 = require("./pipeline.js"); +function extend(...elements) { + return (0, pipeline_js_1.brand)((start) => elements.reduce((value, element) => element(value), start)); +} +//# sourceMappingURL=extend.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/extend.js.map b/packages/cli/vendor/configliere-pr32/script/lib/extend.js.map new file mode 100644 index 00000000..f92d9397 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/extend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extend.js","sourceRoot":"","sources":["../../src/lib/extend.ts"],"names":[],"mappings":";;AAEA,wBASC;AAXD,+CAAkE;AAElE,SAAgB,MAAM,CACpB,GAAG,QAAW;IAEd,OAAO,IAAA,mBAAK,EAAe,CAAC,KAAc,EAAW,EAAE,CACrD,QAAQ,CAAC,MAAM,CACb,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CACN,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts new file mode 100644 index 00000000..ac54acdc --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts @@ -0,0 +1,10 @@ +export type Maybe = { + readonly exists: false; +} | { + readonly exists: true; + readonly value: T; +}; +export declare function Just(): Maybe; +export declare function Just(value: T): Maybe; +export declare function Nothing(): Maybe; +//# sourceMappingURL=maybe.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts.map new file mode 100644 index 00000000..ceac87e5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/maybe.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"maybe.d.ts","sourceRoot":"","sources":["../../src/lib/maybe.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI;IACrB,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC;CACxB,GAAG;IACF,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;CACnB,CAAC;AAEF,wBAAgB,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC;AACpC,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;AAS5C,wBAAgB,OAAO,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAE5C"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/maybe.js b/packages/cli/vendor/configliere-pr32/script/lib/maybe.js new file mode 100644 index 00000000..69530a07 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/maybe.js @@ -0,0 +1,17 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Just = Just; +exports.Nothing = Nothing; +function Just(value) { + if (typeof value === "undefined") { + return { exists: true }; + } + else { + return { exists: true, value }; + } +} +function Nothing() { + return nothing; +} +const nothing = { exists: false }; +//# sourceMappingURL=maybe.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/maybe.js.map b/packages/cli/vendor/configliere-pr32/script/lib/maybe.js.map new file mode 100644 index 00000000..ac75bca9 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/maybe.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maybe.js","sourceRoot":"","sources":["../../src/lib/maybe.ts"],"names":[],"mappings":";;AASA,oBAMC;AAED,0BAEC;AAVD,SAAgB,IAAI,CAAI,KAAS;IAC/B,IAAI,OAAO,KAAK,KAAK,WAAW,EAAE,CAAC;QACjC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAc,CAAC;IACtC,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACjC,CAAC;AACH,CAAC;AAED,SAAgB,OAAO;IACrB,OAAO,OAAmB,CAAC;AAC7B,CAAC;AAED,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts new file mode 100644 index 00000000..5bec4807 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts @@ -0,0 +1,11 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function option(named: Definition, ...elements: E & Check, E> & Valid): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type Valid = [ + Fold, E> +] extends [never] ? never : unknown; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=option.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts.map new file mode 100644 index 00000000..a5241ace --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/option.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"option.d.ts","sourceRoot":"","sources":["../../src/lib/option.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAAS,MAAM,YAAY,CAAC;AAE/C,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAY,UAAU,EAAE,MAAM,YAAY,CAAC;AAEvD,wBAAgB,MAAM,CACpB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GACtD,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAuB1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,IAAI;IACvC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC;CAChC,SAAS,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC;AAEpC,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/option.js b/packages/cli/vendor/configliere-pr32/script/lib/option.js new file mode 100644 index 00000000..9de70182 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/option.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.option = option; +const param_js_1 = require("./param.js"); +const dasherize_js_1 = require("./dasherize.js"); +const pipeline_js_1 = require("./pipeline.js"); +const read_js_1 = require("./read.js"); +function option(named, ...elements) { + const added = elements.reduce((value, element) => element(value), (0, param_js_1.param)(named, (0, read_js_1.cli)([`--${(0, dasherize_js_1.dasherize)(named.name)}`]))); + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +//# sourceMappingURL=option.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/option.js.map b/packages/cli/vendor/configliere-pr32/script/lib/option.js.map new file mode 100644 index 00000000..cf153aea --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/option.js.map @@ -0,0 +1 @@ +{"version":3,"file":"option.js","sourceRoot":"","sources":["../../src/lib/option.ts"],"names":[],"mappings":";;AAYA,wBA6BC;AAzCD,yCAA+C;AAC/C,iDAA2C;AAC3C,+CAMuB;AACvB,uCAAgC;AAGhC,SAAgB,MAAM,CAIpB,KAAoB,EACpB,GAAG,QAAoD;IAEvD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAA,gBAAK,EAAC,KAAK,EAAE,IAAA,aAAG,EAAC,CAAC,KAAK,IAAA,wBAAS,EAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CACxB,CAAC;IAE5B,OAAO,IAAA,mBAAK,EACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,MAAM;gBACf,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,KAAK;aACpB;SACF,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts new file mode 100644 index 00000000..d233b7ae --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts @@ -0,0 +1,27 @@ +import { type Decoder } from "./decode.js"; +import { type Check, type Fold, type Transform, type TransformElement, type Unary } from "./pipeline.js"; +import type { CLIBinding } from "./read.js"; +import type { Definition, Schema } from "./types.js"; +export interface Param extends Definition { + schema: Schema; + cli: CLIBinding; + decode: Decoder; + env?: string; + multiple?: boolean; +} +export interface MultipleParam extends Param { + multiple: true; +} +export declare function param(start: Definition, ...elements: E & Check, E>): Fold, E>; +export declare function schema(schema: Schema): TransformElement>; +export interface SchemaTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends MultipleParam ? T extends (infer E)[] ? MultipleParam : never : this["input"] extends Param ? Param : never; +} +interface MultipleTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends Param ? unknown extends T ? MultipleParam : T extends (infer E)[] ? MultipleParam : never : never; +} +export declare function multiple(): TransformElement; +export {}; +//# sourceMappingURL=param.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts.map new file mode 100644 index 00000000..f3e50062 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/param.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"param.d.ts","sourceRoot":"","sources":["../../src/lib/param.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAU,MAAM,aAAa,CAAC;AACnD,OAAO,EACL,KAAK,KAAK,EACV,KAAK,IAAI,EAET,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAErD,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,CAA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AC,EAAE,OAAO,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3D,KAAK,CAAC;CACX;AAED,UAAU,iBAAkB,SAAQ,SAAS;IAC3C,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,GAC1D,OAAO,SAAS,CAAC,GAAG,aAAa,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7C,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,aAAa,CAAC,CAAC,EAAE,CAAC,CAAC,GAC3C,KAAK,GACL,KAAK,CAAC;CACX;AAED,wBAAgB,QAAQ,IAAI,gBAAgB,CAAC,iBAAiB,CAAC,CAK9D"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/param.js b/packages/cli/vendor/configliere-pr32/script/lib/param.js new file mode 100644 index 00000000..1c5de925 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/param.js @@ -0,0 +1,48 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.param = param; +exports.schema = schema; +exports.multiple = multiple; +const decode_js_1 = require("./decode.js"); +const pipeline_js_1 = require("./pipeline.js"); +function param(start, ...elements) { + let zero = { + ...start, + schema: unknown, + cli: { + read(tokens) { + let claim = tokens.claimAll(() => false); + return { + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + claim, + }; + }, + }, + decode: decode_js_1.scalar, + }; + return elements.reduce((value, element) => element(value), zero); +} +function schema(schema) { + return (0, pipeline_js_1.mark)((param) => ({ + ...param, + schema, + })); +} +function multiple() { + return (0, pipeline_js_1.mark)((param) => ({ + ...param, + multiple: true, + })); +} +const unknown = { + "~standard": { + version: 1, + vendor: "configliere", + validate: (value) => ({ value }), + }, +}; +//# sourceMappingURL=param.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/param.js.map b/packages/cli/vendor/configliere-pr32/script/lib/param.js.map new file mode 100644 index 00000000..0bd65e99 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/param.js.map @@ -0,0 +1 @@ +{"version":3,"file":"param.js","sourceRoot":"","sources":["../../src/lib/param.ts"],"names":[],"mappings":";;AAwBA,sBA8BC;AAED,wBAOC;AAmBD,4BAKC;AAvFD,2CAAmD;AACnD,+CAOuB;AAgBvB,SAAgB,KAAK,CAInB,KAAoB,EACpB,GAAG,QAAyC;IAE5C,IAAI,IAAI,GAAsB;QAC5B,GAAG,KAAK;QACR,MAAM,EAAE,OAAO;QACf,GAAG,EAAE;YACH,IAAI,CAAC,MAAM;gBACT,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;gBACzC,OAAO;oBACL,MAAM,EAAE;wBACN,EAAE,EAAE,IAAI;wBACR,KAAK,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;wBACxB,MAAM,EAAE,EAAE;qBACX;oBACD,KAAK;iBACN,CAAC;YACJ,CAAC;SACF;QACD,MAAM,EAAE,kBAAM;KACf,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAI,CACyB,CAAC;AAClC,CAAC;AAED,SAAgB,MAAM,CACpB,MAAiB;IAEjB,OAAO,IAAA,kBAAI,EAAqB,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC;QAClE,GAAG,KAAK;QACR,MAAM;KACP,CAAC,CAAC,CAAC;AACN,CAAC;AAmBD,SAAgB,QAAQ;IACtB,OAAO,IAAA,kBAAI,EAAoB,CAAC,KAA6B,EAAE,EAAE,CAAC,CAAC;QACjE,GAAG,KAAK;QACR,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC,CAAC;AACN,CAAC;AAED,MAAM,OAAO,GAAoB;IAC/B,WAAW,EAAE;QACX,OAAO,EAAE,CAAC;QACV,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;KACjC;CACF,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts new file mode 100644 index 00000000..8f49be3e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts @@ -0,0 +1,3 @@ +import type { AnyRoute, Input, Parse } from "./types.js"; +export declare function parse(route: R, input: Input): Parse; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts.map new file mode 100644 index 00000000..8adcef9a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/lib/parse.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAIV,QAAQ,EACR,KAAK,EAKL,KAAK,EAIN,MAAM,YAAY,CAAC;AAEpB,wBAAgB,KAAK,CAAC,KAAK,CAAC,CAAC,SAAS,QAAQ,EAC5C,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,GACX,KAAK,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/parse.js b/packages/cli/vendor/configliere-pr32/script/lib/parse.js new file mode 100644 index 00000000..17ccebbf --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/parse.js @@ -0,0 +1,393 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parse = parse; +const bind_js_1 = require("./bind.js"); +const env_js_1 = require("./env.js"); +const tokenize_js_1 = require("./tokenize.js"); +const tokenizer_js_1 = require("./tokenizer.js"); +const values_js_1 = require("./values.js"); +function parse(route, input) { + let tokenizer = new tokenizer_js_1.Tokenizer((0, tokenize_js_1.tokenize)(input.argv)); + let help = tokenizer.claimAll(flags("-h", "--help")); + let version = help.rest.claimAll(flags("-v", "--version")); + let escape = version.rest.claimAll((t) => t.type === "separator"); + let literals = escape.rest.claimAll((t) => t.type === "literal"); + let method = "execute"; + if (help.tokens.length > 0) { + method = "help"; + } + else if (version.tokens.length > 0) { + method = "version"; + } + let rest = { + tokens: literals.rest, + values: new values_js_1.Values().mount([], input.values ?? []), + envs: new env_js_1.Envs().mount([], input.envs ?? []), + }; + return resume({ + segments: [{ + id: "/", + route, + phases: route.phases, + tokens: Array.from(rest.tokens), + path: [], + start: -1, + model: {}, + issues: [], + history: [], + }], + active: 0, + rest, + models: {}, + method, + literals: literals.tokens, + }); +} +function resume(state) { + while (true) { + // Starting from the deepest open segment, synchronously descend through + // routes visible on each segment's head phase. + state = search(state); + let index = state.active; + let segment = state.segments[index]; + let [phase] = segment.phases; + state = { + ...state, + rest: { + ...state.rest, + values: state.rest.values.mount(segment.path, phase.values), + envs: state.rest.envs.mount(segment.path, phase.envs), + }, + }; + // Controls are free of ordinary configuration validation. A dynamic phase + // is the exception: its model is needed by the caller before the remaining + // route graph (and therefore the final control target) can be known. + if (state.method !== "execute" && !phase.resolver) { + let models = { + ...state.models, + [segment.id]: segment.model, + }; + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + continue; + } + return resolve({ ...state, models }, segment); + } + // Bind only this phase, within this segment's token view. + // + // For an open dynamic segment, binding may consume the horizon but may not + // look beyond it. For a committed segment, `end` is the hard boundary. + let binding = (0, bind_js_1.bindPhase)({ + phase, + segment: { + range: { + start: segment.start, + end: segment.end, + }, + path: segment.path, + }, + rest: state.rest, + }); + segment = { + ...segment, + model: { + ...segment.model, + ...binding.model, + }, + issues: [ + ...segment.issues, + ...binding.issues, + ], + }; + state = { + ...state, + rest: binding.rest, + segments: replace(state.segments, index, segment), + }; + if (!binding.valid) { + let issues = phase.resolver + ? binding.issues + : [...unexpected(state, segment), ...binding.issues]; + return unprocessableContent(state.segments[state.segments.length - 1], issues); + } + let modeled = applyTransforms(segment); + if (!modeled.ok) { + return unprocessableContent(segment, modeled.issues); + } + segment = { + ...segment, + model: modeled.value, + }; + if (phase.resolver) { + // Binding the phase succeeded, but the requirement is still needed. + let suspended = state; + return { + ok: true, + route: segment.id, + model: phase.transforms?.length ? modeled.value : binding.model, + resume(result) { + if (!result.ok) { + return unprocessableContent(segment, result.issues); + } + // AnyPhase erases these exact types with `never`; dynamic() already + // proved them at its public boundary. + let resolver = phase.resolver; + // The extension operates against the same aggregate route metadata, + // but begins with one fresh, empty phase. + let continuation = resolver(result.value)(seed(segment.route)); + let phases = stitch(continuation.phases, segment.phases.slice(1)); + let history = [...segment.history, phase]; + let next = { + ...segment, + route: { + ...continuation, + phases: [...history, ...phases], + }, + phases, + history, + issues: [ + ...segment.issues, + ...(result.issues ?? []), + ], + }; + return resume({ + ...suspended, + segments: replace(suspended.segments, index, next), + }); + }, + }; + } + // A phase without a resolver is the final phase of this segment. + let issues = unexpected(state, segment); + if (issues.length > 0) { + return unprocessableContent(state.segments[state.segments.length - 1], issues); + } + let id = `/${segment.path.join("/")}`; + let models = { + ...state.models, + [id]: segment.model, + }; + // There is already a synchronously matched child segment. + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + continue; + } + // The deepest selected segment is fully resolved. + return resolve({ + ...state, + models, + }, segment); + } +} +function search(state) { + let segments = [...state.segments]; + let rest = state.rest; + while (true) { + let index = segments.length - 1; + let segment = segments[index]; + let [phase] = segment.phases; + let remaining = new Set(Array.from(rest.tokens, (token) => token.index)); + let selector = segment.tokens.find((token) => { + return remaining.has(token.index) && token.type === "word" && + phase.routes.some((route) => route.name === token.text); + }); + if (!selector) { + return { ...state, segments, rest }; + } + let child = phase.routes.find((route) => route.name === selector.text); + let path = [...segment.path, child.name]; + let before = segment.tokens.filter((token) => token.index < selector.index); + let after = segment.tokens.filter((token) => token.index > selector.index); + segments[index] = { + ...segment, + tokens: before, + end: selector.index, + }; + segments.push({ + id: `/${path.join("/")}`, + route: child, + path, + phases: child.phases, + tokens: after, + start: selector.index, + model: {}, + issues: [], + history: [], + }); + rest = { + ...rest, + tokens: rest.tokens.claimOne((token) => token.index === selector.index) + .rest, + }; + } +} +function flags(...texts) { + return (token) => token.type === "flag" && texts.includes(token.text); +} +function stitch(before, after) { + if (after.length === 0) { + return before; + } + let phases = [...before]; + let phase = phases.pop(); + let [next, ...rest] = after; + phases.push({ + ...phase, + ...next, + params: { + ...phase.params, + ...next.params, + }, + routes: [ + ...phase.routes, + ...next.routes, + ], + values: [ + ...phase.values, + ...next.values, + ], + envs: [ + ...phase.envs, + ...next.envs, + ], + }); + phases.push(...rest); + return phases; +} +function resolve(state, segment) { + let route = `/${segment.path.join("/")}`; + let definition = segment.route; + if (!definition.methods.includes(state.method)) { + return { + ok: false, + code: "method-not-allowed", + route, + definition, + path: segment.path, + method: state.method, + allowed: definition.methods, + }; + } + let intent = { + ok: true, + route, + definition, + path: segment.path, + literals: state.literals, + }; + switch (state.method) { + case "help": + return { + ...intent, + method: "help", + }; + case "version": + return { + ...intent, + method: "version", + }; + case "execute": + return { + ...intent, + method: "execute", + model: state.models[route], + models: state.models, + issues: state.segments.flatMap((segment) => segment.issues), + }; + } +} +function applyTransforms(segment) { + let operations = segment.phases[0].transforms ?? []; + let model = segment.model; + for (let op of operations) { + if (typeof op.transform === "function") { + let result = op.transform(pick(model, op.keys), model, segment.phases[0].params); + if (result !== undefined) { + if (!record(result)) { + return invalidTransformResult(); + } + model = result; + } + continue; + } + let result = op.transform["~standard"].validate(model); + if (result instanceof Promise) { + return { + ok: false, + issues: [{ message: "async schemas are not allowed" }], + }; + } + if (result.issues) { + return { ok: false, issues: result.issues }; + } + if (!record(result.value)) { + return invalidTransformResult(); + } + model = result.value; + } + if (operations.length === 0) { + return { ok: true, value: segment.model }; + } + return { ok: true, value: model }; +} +function invalidTransformResult() { + return { + ok: false, + issues: [{ message: "model transforms must return records" }], + }; +} +function record(value) { + return typeof value === "object" && value !== null && !Array.isArray(value); +} +function pick(model, keys) { + let options = {}; + for (let key of keys) { + if (key in model) { + options[key] = model[key]; + } + } + return options; +} +function seed(route) { + return { + ...route, + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; +} +function replace(items, index, value) { + let result = [...items]; + result[index] = value; + return result; +} +function unprocessableContent(segment, issues) { + return { + ok: false, + code: "unprocessable-content", + route: segment.id, + definition: segment.route, + path: segment.path, + issues: [...issues], + }; +} +function unexpected(state, segment) { + let members = new Set(segment.tokens.map((token) => token.index)); + return Array.from(state.rest.tokens) + .filter((token) => members.has(token.index)) + .map((token) => ({ + message: `unexpected ${JSON.stringify(token.text)}`, + })); +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/parse.js.map b/packages/cli/vendor/configliere-pr32/script/lib/parse.js.map new file mode 100644 index 00000000..5f3868b4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../src/lib/parse.ts"],"names":[],"mappings":";;AA6BA,sBA0CC;AAvED,uCAAsC;AACtC,qCAAgC;AAIhC,+CAAsE;AACtE,iDAA2C;AAC3C,2CAAqC;AAsBrC,SAAgB,KAAK,CACnB,KAAe,EACf,KAAY;IAEZ,IAAI,SAAS,GAAG,IAAI,wBAAS,CAAC,IAAA,sBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;IACpD,IAAI,IAAI,GAAG,SAAS,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrD,IAAI,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,I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AC,CAAC,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts new file mode 100644 index 00000000..7ad587a5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts @@ -0,0 +1,197 @@ +import type { AddField, AddParamToLast, AddRoutesToLast, AnyPhase, AnyPhases, AnyRoute, ChildrenOf, Done, Method, MethodsOf, ModelOf, ModelSchema, Next, Phase, Route } from "./types.js"; +export type Element = { + readonly [operation]: D; +}; +export type AnyElement = Element; +export type Unary = (value: never) => unknown; +export type AnyPipelineElement = Unary; +export interface Transform { + readonly input: unknown; + readonly output: unknown; +} +export type ApplyTransform = (F & { + readonly input: S; +})["output"]; +export interface TransformElement { + readonly [operation]: Custom; + (value: S): ApplyTransform; +} +export interface IdentityElement { + readonly [operation]: Identity; + (value: T): T; +} +export interface MethodElement { + readonly [operation]: AddMethod; + (route: Route): Route; +} +export interface ParamElement { + readonly [operation]: AddParam; + (route: Route): Route, C, AddParamToLast>; +} +export interface RoutesElement { + readonly [operation]: AddRoutes; + (route: Route): Route>; +} +export interface ModelTransformElement { + readonly [operation]: AddModelTransform; + (route: Route): Apply, AddModelTransform>; +} +type ModelTransformOutput = F extends ModelSchema ? Output extends Record ? Output : T : F extends (options: never, model: infer Input, phase: never) => infer Output ? T extends Input ? (Output extends Record ? Output : T) : never : never; +export type Extension = Element> & (E extends readonly AnyElement[] ? GenericExtension : ConcreteExtension); +interface GenericExtension { + readonly [operation]: Batch; + >(value: S): Fold; +} +interface ConcreteExtension { + (value: [Fold, E>] extends [never] ? never : InputOfPipeline): Fold, E>; +} +export interface DynamicElement { + readonly [operation]: Dynamic; + (route: R): Apply>; +} +export type Seed = Route, ModelOf, ChildrenOf, readonly [Phase<{}, [], never>]>; +export type ConjoinPhases = ConcatPhases, B["phases"]>; +export type Fold = number extends E["length"] ? Conservative : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? true extends IsUnion ? Conservative : Head extends AnyElement ? S extends AnyRoute ? DeltaOf extends StaticDelta ? TakeStatic extends readonly [ + infer Fields extends object, + infer Routes extends readonly AnyRoute[], + infer Methods extends Method, + infer Rest extends readonly AnyPipelineElement[] +] ? Fold, Rest> : never : Fold>, Tail> : Fold>, Tail> : Head extends (value: S) => infer Output ? Fold : never : S; +export type Materialize = AnyRoute extends S ? S : S extends Route ? WithExtras : Phases[K]; +}>, S> : S; +export type Check = number extends E["length"] ? unknown : E extends readonly AnyElement[] ? [Fold] extends [never] ? CheckMixed : E : CheckMixed; +export declare function mark(element: (value: never) => unknown): TransformElement; +export declare function brand(element: unknown): E; +declare const operation: unique symbol; +type Delta = Identity | AddMethod | AddParam | AddRoutes | AddModelTransform | Batch | Dynamic | Custom; +type StaticDelta = Identity | AddMethod | AddParam | AddRoutes; +interface Identity { + readonly type: "identity"; + readonly input: S; +} +interface AddMethod { + readonly type: "method"; + readonly method: M; +} +interface AddParam { + readonly type: "param"; + readonly key: K; + readonly value: V; +} +interface AddRoutes { + readonly type: "routes"; + readonly children: C; +} +interface AddModelTransform { + readonly type: "model-transform"; + readonly transform: F; + readonly elements: E; +} +interface Batch { + readonly type: "batch"; + readonly elements: E; +} +interface Dynamic { + readonly type: "dynamic"; + readonly requirement: Requirement; + readonly element: E; +} +interface Custom { + readonly type: "custom"; + readonly transform: F; +} +type Apply = Delta extends D ? Conservative : D extends Identity ? S extends Input ? S : never : D extends AddMethod ? S extends AnyRoute ? Route | M, ModelOf, ChildrenOf, S["phases"]> : never : D extends AddParam ? S extends AnyRoute ? WithParams : never : D extends AddRoutes ? S extends AnyRoute ? Route, ModelOf, readonly [...ChildrenOf, ...C], AddRoutesToLast> : never : D extends AddModelTransform ? S extends AnyRoute ? Fold extends infer After extends AnyRoute ? Route, ModelTransformOutput>, ChildrenOf, TransformModelInLast>>> : never : never : D extends Batch ? Fold : D extends Dynamic ? S extends AnyRoute ? Apply, DeltaOf> extends infer After extends AnyRoute ? Route, ModelOf, ChildrenOf, ConjoinPhases> : never : never : D extends Custom ? S extends F["input"] ? ApplyTransform : never : never; +type DeltaOf = E[typeof operation]; +type IsUnion = T extends unknown ? [Whole] extends [T] ? false : true : never; +type Conservative = S extends AnyRoute ? AnyRoute : unknown; +type CheckMixed = E extends readonly [] ? E : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? [Fold] extends [never] ? readonly [never, ...Tail] : readonly [Head, ...CheckTail, Tail>] : never; +type CheckTail = number extends E["length"] ? E : E extends readonly AnyElement[] ? E : CheckMixed; +type InputOf = E extends AnyElement ? InputOfDelta> : E extends (value: infer Input) => unknown ? Input : never; +type InputOfPipeline = E extends readonly [ + infer Head extends AnyPipelineElement, + ...readonly AnyPipelineElement[] +] ? InputOf : unknown; +type InputOfDelta = D extends Identity ? Input : D extends AddMethod | AddParam | AddRoutes | AddModelTransform | Dynamic ? AnyRoute : D extends Batch ? InputOfPipeline : D extends Custom ? F["input"] : never; +type TakeStatic = Count["length"] extends 20 ? readonly [MergeFields, Routes, Methods, E] : E extends readonly [ + infer Head extends AnyElement, + ...infer Tail extends readonly AnyPipelineElement[] +] ? DeltaOf extends Identity ? TakeStatic : DeltaOf extends AddMethod ? TakeStatic : DeltaOf extends AddParam ? TakeStatic : DeltaOf extends AddRoutes ? TakeStatic : readonly [MergeFields, Routes, Methods, E] : readonly [MergeFields, Routes, Methods, E]; +type MergeFields = { + [K in FieldKeys]: FieldValue; +}; +type FieldKeys = F extends readonly [ + infer Head extends object, + ...infer Tail extends readonly object[] +] ? keyof Head | FieldKeys : never; +type FieldValue = F extends readonly [ + ...infer Rest extends readonly object[], + infer Last extends object +] ? K extends keyof Last ? Last[K] : FieldValue : never; +type WithStatic = Route | Methods, keyof Fields extends never ? ModelOf : Merge, Fields>, Routes extends readonly [] ? ChildrenOf : readonly [...ChildrenOf, ...Routes], AddStaticToLast>; +type AddStaticToLast

= keyof Fields extends never ? Routes extends readonly [] ? P : AddRoutesToLast : Routes extends readonly [] ? AddFieldsToLast : AddRoutesToLast, Routes>; +type WithParams = Route, Merge, Fields>, ChildrenOf, AddFieldsToLast>; +type AddFieldsToLast

= P extends readonly [infer Only extends AnyPhase] ? readonly [AddFields] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [First, ...Middle, AddFields, Fields>] : never; +type TransformModelInLast

= P extends readonly [AnyPhase] ? readonly [ + TransformModelPhase +] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [ + First, + ...Middle, + TransformModelPhase, Output> +] : never; +type TransformModelPhase

= P extends Next ? Next : P extends Done ? Done : never; +type AddFields

= P extends Next ? Next, Routes, Requirement> : P extends Done ? Done, Routes> : never; +type Last

= P extends readonly [ + ...AnyPhase[], + infer Tail extends AnyPhase +] ? Tail : never; +type ContinueLast

= P extends readonly [infer Only extends AnyPhase] ? readonly [WithRequirement] : P extends readonly [ + infer Head extends AnyPhase, + ...infer Middle extends readonly AnyPhase[], + infer Tail extends AnyPhase +] ? readonly [ + Head, + ...Middle, + WithRequirement +] : never; +type ConcatPhases = A extends readonly [ + infer AHead extends AnyPhase, + ...infer ATail extends AnyPhase[] +] ? B extends readonly [ + infer BHead extends AnyPhase, + ...infer BTail extends AnyPhase[] +] ? readonly [AHead, ...ATail, BHead, ...BTail] : never : never; +type WithRequirement

= P extends Phase ? Phase : never; +type Merge = Simplify & B>; +type Simplify = { + [K in keyof T]: T[K]; +}; +type MaterializePhase

= P extends Next ? Next<{ + [K in keyof Model]: Model[K]; +}, Routes, Requirement> : P extends Done ? Done<{ + [K in keyof Model]: Model[K]; +}, Routes> : never; +type RouteKeys = keyof Route; +type WithExtras = keyof Omit extends never ? R : R & Omit; +export {}; +//# sourceMappingURL=pipeline.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts.map new file mode 100644 index 00000000..0a36a308 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../../src/lib/pipeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EACf,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,MAAM,EACN,SAAS,EACT,OAAO,EACP,WAAW,EACX,IAAI,EACJ,KAAK,EACL,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,KAAK,IAAI;IACrC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;AAExC,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,KAAK,KAAK,OAAO,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAEvC,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,IAAI,CACnD,CAAC,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAC1B,CAAC,QAAQ,CAAC,CAAC;AAEZ,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,SAAS;IACnD,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IAEhC,CAAC,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,cAAc,C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KAAK,GAC3E,CAAC,GACD,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js new file mode 100644 index 00000000..b33bde8d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js @@ -0,0 +1,11 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.mark = mark; +exports.brand = brand; +function mark(element) { + return element; +} +function brand(element) { + return element; +} +//# sourceMappingURL=pipeline.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js.map b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js.map new file mode 100644 index 00000000..3697c0e1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/pipeline.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../../src/lib/pipeline.ts"],"names":[],"mappings":";;AA2NA,oBAIC;AAED,sBAEC;AARD,SAAgB,IAAI,CAClB,OAAkC;IAElC,OAAO,OAA8B,CAAC;AACxC,CAAC;AAED,SAAgB,KAAK,CAAuB,OAAgB;IAC1D,OAAO,OAAY,CAAC;AACtB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts new file mode 100644 index 00000000..0d1bb160 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts @@ -0,0 +1,8 @@ +/** + * 😵‍💫 This file has been vibe coded 😵‍💫 + */ +import type { Help, MethodNotAllowed, RoutePath, UnprocessableContent, Version } from "./types.js"; +export declare function printHelp>(intent: H): string; +export declare function printVersion>(intent: V): string; +export declare function printErrors(result: MethodNotAllowed | UnprocessableContent): string; +//# sourceMappingURL=print.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts.map new file mode 100644 index 00000000..db19388d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/print.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"print.d.ts","sourceRoot":"","sources":["../../src/lib/print.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,KAAK,EAEV,IAAI,EAEJ,gBAAgB,EAChB,SAAS,EACT,oBAAoB,EACpB,OAAO,EACR,MAAM,YAAY,CAAC;AAEpB,wBAAgB,SAAS,CACvB,KAAK,CAAC,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,EAC/B,MAAM,EAAE,CAAC,GAAG,MAAM,CAyDnB;AAED,wBAAgB,YAAY,CAC1B,KAAK,CAAC,CAAC,SAAS,OAAO,CAAC,SAAS,CAAC,EAClC,MAAM,EAAE,CAAC,GAAG,MAAM,CAOnB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,gBAAgB,GAAG,oBAAoB,GAC9C,MAAM,CAgBR"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/print.js b/packages/cli/vendor/configliere-pr32/script/lib/print.js new file mode 100644 index 00000000..19674552 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/print.js @@ -0,0 +1,162 @@ +"use strict"; +/** + * 😵‍💫 This file has been vibe coded 😵‍💫 + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.printHelp = printHelp; +exports.printVersion = printVersion; +exports.printErrors = printErrors; +function printHelp(intent) { + let route = intent.definition; + let subject = title(intent); + let heading = route.version ? `${subject} ${route.version}` : subject; + let children = route.phases.flatMap((phase) => phase.routes); + let args = []; + let options = []; + for (let param of params(route)) { + let syntax = param.cli.syntax; + if (!syntax) { + continue; + } + let row = [syntax.label, param.description]; + if (syntax.type === "argument") { + args.push(row); + } + else { + options.push(row); + } + } + let usage = [subject, "[OPTIONS]", ...args.map(([label]) => label)].join(" "); + if (children.length > 0) { + usage += route.methods.includes("execute") ? " [COMMAND]" : " "; + } + let lines = [heading]; + if (route.description) { + lines.push(...wrap(route.description, width)); + } + lines.push("", "Usage:", ` ${usage}`); + if (args.length > 0) { + lines.push("", "Arguments:", ...list(args)); + } + if (children.length > 0) { + lines.push("", "Commands:", ...list(children.map((child) => [child.name, child.description]))); + } + options.push(["-h, --help", "Print help"]); + if (route.methods.includes("version")) { + options.push(["-v, --version", "Print version"]); + } + lines.push("", "Options:", ...list(options)); + return lines.join("\n"); +} +function printVersion(intent) { + let version = intent.definition.version; + if (!version) { + throw new TypeError(`route ${JSON.stringify(intent.route)} has no version`); + } + return `${title(intent)} ${version}`; +} +function printErrors(result) { + let subject = title(result); + switch (result.code) { + case "method-not-allowed": + return [ + `${subject} does not support ${result.method.toUpperCase()}`, + "", + "Available methods:", + ...result.allowed.map((method) => ` ${method.toUpperCase()}`), + ].join("\n"); + case "unprocessable-content": { + return result.issues.map(problem).join("\n"); + } + } +} +function params(route) { + return route.phases.flatMap((phase) => Object.values(phase.params)); +} +function title(intent) { + return intent.path.length > 0 + ? intent.path.join(" ") + : intent.definition.name; +} +function list(rows) { + let size = Math.max(...rows.map(([label]) => label.length)); + let available = Math.max(24, width - size - 4); + let lines = []; + for (let [label, description] of rows) { + let prefix = ` ${label.padEnd(size)}`; + if (!description) { + lines.push(prefix.trimEnd()); + continue; + } + let [first, ...rest] = wrap(description, available); + lines.push(`${prefix} ${first}`); + lines.push(...rest.map((line) => `${" ".repeat(size + 4)}${line}`)); + } + return lines; +} +function wrap(text, size) { + let words = text.trim().split(/\s+/); + let lines = []; + let line = ""; + for (let word of words) { + if (line.length === 0) { + line = word; + } + else if (line.length + word.length + 1 <= size) { + line += ` ${word}`; + } + else { + lines.push(line); + line = word; + } + } + if (line) { + lines.push(line); + } + return lines; +} +function problem(issue) { + let location = address(issue.path); + return location ? `${location}: ${issue.message}` : message(issue.message); +} +function message(value) { + if (value.startsWith("unexpected ")) { + let encoded = value.slice("unexpected ".length); + try { + let token = JSON.parse(encoded); + if (typeof token === "string") { + return `unexpected: \`${token.replaceAll("`", "\\`")}\``; + } + } + catch { + // Keep non-JSON diagnostics intact. + } + } + return value; +} +function address(path) { + if (!path || path.length === 0) { + return; + } + let result = ""; + for (let segment of path) { + let key = typeof segment === "object" && segment !== null + ? segment.key + : segment; + if (typeof key === "number") { + result += `[${key}]`; + } + else if (typeof key === "symbol") { + result += `[${String(key)}]`; + } + else if (/^[A-Za-z_$][\w$]*$/.test(key)) { + result += result ? `.${key}` : key; + } + else { + result += `[${JSON.stringify(key)}]`; + } + } + return result; +} +const width = 80; +//# sourceMappingURL=print.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/print.js.map b/packages/cli/vendor/configliere-pr32/script/lib/print.js.map new file mode 100644 index 00000000..017aba31 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/print.js.map @@ -0,0 +1 @@ +{"version":3,"file":"print.js","sourceRoot":"","sources":["../../src/lib/print.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAaH,8BA2DC;AAED,oCASC;AAED,kCAkBC;AA1FD,SAAgB,SAAS,CAEvB,MAAS;IACT,IAAI,KAAK,GAAG,MAAM,CAAC,UAAU,CAAC;IAC9B,IAAI,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;IACtE,IAAI,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7D,IAAI,IAAI,GAAU,EAAE,CAAC;IACrB,IAAI,OAAO,GAAU,EAAE,CAAC;IAExB,KAAK,IAAI,KAAK,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QAChC,IAAI,MA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IAAI,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAC/B,CAAC;aAAM,IAAI,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1C,MAAM,IAAI,MAAM,CAAC,CAAC,CAAC,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;QACrC,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC;QACvC,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,KAAK,GAAG,EAAE,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts new file mode 100644 index 00000000..deed10a4 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts @@ -0,0 +1,28 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { Result } from "./result.js"; +import type { Flag, Setter, Word } from "./tokenize.js"; +import type { Claim, TokenInput } from "./tokenizer.js"; +export type Symbol = Flag | Setter | Word; +export type ReadCLI = (tokens: TokenInput, multiple?: boolean) => CLIRead; +export interface CLIBinding { + readonly read: ReadCLI; + readonly syntax?: CLISyntax; +} +export type CLISyntax = { + readonly type: "argument"; + readonly label: string; +} | { + readonly type: "option"; + readonly label: string; +}; +export interface CLIRead { + result: Result>; + claim: Claim; +} +export interface CLIOptions { + switch?: true; +} +export declare function cli(names: readonly string[], options?: CLIOptions): IdentityElement>; +//# sourceMappingURL=read.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts.map new file mode 100644 index 00000000..2130c5de --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/read.d.ts.map @@ -0,0 +1 @@ +{"version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AAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,GAAE,UAAe,GACvB,eAAe,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CA2FzC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/read.js b/packages/cli/vendor/configliere-pr32/script/lib/read.js new file mode 100644 index 00000000..39137008 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/read.js @@ -0,0 +1,104 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.cli = cli; +const pipeline_js_1 = require("./pipeline.js"); +function cli(names, options = {}) { + const readOne = (tokens) => { + let [match] = matches(tokens); + return match ? result(tokens, match) : nothing(tokens); + }; + const readMany = (tokens) => { + let found = matches(tokens); + if (found.length === 0) { + return nothing(tokens); + } + let claimed = new Set(found.flatMap((match) => match.indices)); + let issues = found.flatMap((match) => "issue" in match ? [match.issue] : []); + return { + claim: tokens.claimAll((token) => claimed.has(token.index)), + result: issues.length > 0 ? { ok: false, issues } : { + ok: true, + value: { + exists: true, + value: found.map((match) => "value" in match ? match.value : undefined), + }, + issues: [], + }, + }; + }; + function matches(tokens) { + let visible = Array.from(tokens); + let found = []; + for (let index = 0; index < visible.length; index++) { + let token = visible[index]; + if (!options.switch && token.type === "setter" && + names.includes(`--${token.nameText}`)) { + found.push({ indices: [token.index], value: token.valueText }); + continue; + } + if (token.type !== "flag" || !names.includes(token.text)) { + continue; + } + if (options.switch) { + found.push({ indices: [token.index], value: true }); + continue; + } + let value = visible[index + 1]; + if (value?.type === "word" && value.index === token.index + 1) { + found.push({ + indices: [token.index, value.index], + value: value.text, + }); + index++; + } + else { + found.push({ + indices: [token.index], + issue: { message: `${token.text} requires a value` }, + }); + } + } + return found; + } + const read = (tokens, multiple = false) => { + return multiple ? readMany(tokens) : readOne(tokens); + }; + return (0, pipeline_js_1.brand)((param) => ({ + ...param, + cli: { + read, + syntax: { + type: "option", + label: options.switch + ? names.join(", ") + : `${names.join(", ")} `, + }, + }, + })); +} +function result(tokens, match) { + let claim = tokens.claimAll((token) => match.indices.includes(token.index)); + if ("issue" in match) { + return { claim, result: { ok: false, issues: [match.issue] } }; + } + return { + claim, + result: { + ok: true, + value: { exists: true, value: match.value }, + issues: [], + }, + }; +} +function nothing(tokenizer) { + let claim = tokenizer.claimAll(() => false); + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} +//# sourceMappingURL=read.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/read.js.map b/packages/cli/vendor/configliere-pr32/script/lib/read.js.map new file mode 100644 index 00000000..c70f47e3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/read.js.map @@ -0,0 +1 @@ +{"version":3,"file":"read.js","sourceRoot":"","sources":["../../src/lib/read.ts"],"names":[],"mappings":";;AAgCA,kBA8FC;AA5HD,+CAA4D;AA8B5D,SAAgB,GAAG,CACjB,KAAwB,EACxB,UAAsB,EAAE;IAExB,MAAM,OAAO,GAAY,CAAC,MAAM,EAAE,EAAE;QAClC,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAY,CAAC,MAAM,EAAE,EAAE;QACnC,IAAI,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACvB,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;QACzB,CAAC;QAED,IAAI,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/D,IAAI,MAAM,GAAG,K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--git a/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts new file mode 100644 index 00000000..32c973bd --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts @@ -0,0 +1,10 @@ +import type { Envs } from "./env.js"; +import type { Symbol } from "./read.js"; +import type { Tokenizer } from "./tokenizer.js"; +import type { Values } from "./values.js"; +export interface Rest { + readonly tokens: Tokenizer; + readonly values: Values; + readonly envs: Envs; +} +//# sourceMappingURL=rest.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts.map new file mode 100644 index 00000000..111a78aa --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/rest.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rest.d.ts","sourceRoot":"","sources":["../../src/lib/rest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,IAAI;IACnB,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/rest.js b/packages/cli/vendor/configliere-pr32/script/lib/rest.js new file mode 100644 index 00000000..2453a486 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/rest.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=rest.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/rest.js.map b/packages/cli/vendor/configliere-pr32/script/lib/rest.js.map new file mode 100644 index 00000000..7016a9d5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/rest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rest.js","sourceRoot":"","sources":["../../src/lib/rest.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts new file mode 100644 index 00000000..c7495933 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts @@ -0,0 +1,10 @@ +import type { Issue } from "./types.js"; +export type Result = { + ok: true; + value: T; + issues?: readonly Issue[]; +} | { + ok: false; + issues: readonly Issue[]; +}; +//# sourceMappingURL=result.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts.map new file mode 100644 index 00000000..d0801957 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/result.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAExC,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI;IACtB,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,CAAC,CAAC;IACT,MAAM,CAAC,EAAE,SAAS,KAAK,EAAE,CAAC;CAC3B,GAAG;IACF,EAAE,EAAE,KAAK,CAAC;IACV,MAAM,EAAE,SAAS,KAAK,EAAE,CAAC;CAC1B,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/result.js b/packages/cli/vendor/configliere-pr32/script/lib/result.js new file mode 100644 index 00000000..597898ef --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/result.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=result.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/result.js.map b/packages/cli/vendor/configliere-pr32/script/lib/result.js.map new file mode 100644 index 00000000..f1c4f414 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/result.js.map @@ -0,0 +1 @@ +{"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/lib/result.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts new file mode 100644 index 00000000..cebe6b74 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts @@ -0,0 +1,13 @@ +import { type Check, type Fold, type Materialize, type MethodElement, type ModelTransformElement, type RoutesElement, type Unary } from "./pipeline.js"; +import type { AnyRoute, Definition, Done, ModelOf, ModelParams, ModelSchema, Route } from "./types.js"; +export type RouteZero = Route +]>; +export declare function route(start: Definition, ...elements: E & Check, E>): Materialize, E>>; +export declare function version(semver: string): MethodElement<"version">; +export declare function executable(): MethodElement<"execute">; +export declare function routes(...children: C): RoutesElement; +export declare function transform(transform: ModelSchema, ...elements: E & Check): ModelTransformElement, E>; +export declare function transform>, model: never, phase: ModelParams) => Record | void)>(transform: F, ...elements: E & Check): ModelTransformElement; +//# sourceMappingURL=route.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts.map new file mode 100644 index 00000000..5807aa60 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/route.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../src/lib/route.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,WAAW,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,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC5C,wBAAgB,SAAS,CACvB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAChC,KAAK,CAAC,CAAC,SAAS,CAAC,CACf,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EACpC,KAAK,EAAE,KAAK,EACZ,KAAK,EAAE,WAAW,KACf,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAEpC,SAAS,EAAE,CAAC,EACZ,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,GACnC,qBAAqB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/route.js b/packages/cli/vendor/configliere-pr32/script/lib/route.js new file mode 100644 index 00000000..d98ee823 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/route.js @@ -0,0 +1,80 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.route = route; +exports.version = version; +exports.executable = executable; +exports.routes = routes; +exports.transform = transform; +// deno-lint-ignore-file ban-types +const pipeline_js_1 = require("./pipeline.js"); +function route(start, ...elements) { + let zero = { + ...start, + methods: ["help"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + return elements.reduce((value, element) => element(value), zero); +} +function version(semver) { + return (0, pipeline_js_1.brand)((route) => ({ + ...route, + methods: [...route.methods, "version"], + version: semver, + })); +} +function executable() { + return (0, pipeline_js_1.brand)((route) => ({ + ...route, + methods: [...route.methods, "execute"], + })); +} +function routes(...children) { + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + routes: [...phase.routes, ...children], + }); + return { + ...route, + phases, + }; + }); +} +function transform(transform, ...elements) { + return (0, pipeline_js_1.brand)((route) => { + let before = params(route); + let next = apply(route, elements); + let nextParams = params(next); + let added = keys(next).filter((key) => before[key] !== nextParams[key]); + let phases = [...next.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + transforms: [ + ...(phase.transforms ?? []), + { transform, keys: added }, + ], + }); + return { + ...next, + phases, + }; + }); +} +function apply(route, elements) { + return elements.reduce((value, element) => element(value), route); +} +function params(route) { + return route.phases[route.phases.length - 1].params; +} +function keys(route) { + return Object.keys(params(route)); +} +//# sourceMappingURL=route.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/route.js.map b/packages/cli/vendor/configliere-pr32/script/lib/route.js.map new file mode 100644 index 00000000..7b3b2cf0 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/route.js.map @@ -0,0 +1 @@ +{"version":3,"file":"route.js","sourceRoot":"","sources":["../../src/lib/route.ts"],"names":[],"mappings":";;AA8BA,sBAsBC;AAED,0BAMC;AAED,gCAKC;AAED,wBAgBC;AAoBD,8BA2BC;AApID,kCAAkC;AAClC,+CASuB;AAoBvB,SAAgB,KAAK,CAInB,KAAoB,EACpB,GAAG,QAAoC;IAEvC,IAAI,IAAI,GAAiB;QACvB,GAAG,KAAK;QACR,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,MAAM,EAAE,CAAC;gBACP,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;aACT,CAAC;KACH,CAAC;IAEF,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,IAAI,CACiC,CAAC;AAC1C,CAAC;AAED,SAAgB,OAAO,CAAC,MAAc;IACpC,OAAO,IAAA,mBAAK,EAA2B,CAAC,KAAe,EAAE,EAAE,CAAC,CAAC;QAC3D,GAAG,KAAK;QACR,OAAO,EAAE,CAAC,GAAG,KAAK,CAAC,OAAO,EA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C;QAC9B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,UAAU,EAAE;gBACV,GAAG,CAAC,KAAK,CAAC,UAAU,IAAI,EAAE,CAAC;gBAC3B,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE;aAC3B;SACF,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,IAAI;YACP,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,SAAS,KAAK,CAAC,KAAe,EAAE,QAA0B;IACxD,OAAO,QAAQ,CAAC,MAAM,CACpB,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAc,CAAC,EAC3C,KAAK,CACM,CAAC;AAChB,CAAC;AAED,SAAS,MAAM,CAAC,KAAe;IAC7B,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC;AACtD,CAAC;AAED,SAAS,IAAI,CAAC,KAAe;IAC3B,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;AACpC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts new file mode 100644 index 00000000..ca60ec21 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts @@ -0,0 +1,8 @@ +import { type Param } from "./param.js"; +import { type Check, type Fold, type ParamElement, type Unary } from "./pipeline.js"; +import type { Definition } from "./types.js"; +export declare function toggle(named: Definition, ...elements: E & Check, E>): ElementOf, E>>; +type ValueOf

= P extends Param ? T : never; +type ElementOf = P extends Param ? ParamElement> : never; +export {}; +//# sourceMappingURL=toggle.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts.map new file mode 100644 index 00000000..72cf3f28 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/toggle.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../src/lib/toggle.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,KAAK,EAAiB,MAAM,YAAY,CAAC;AACvD,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,KAAK,EACX,MAAM,eAAe,CAAC;AAGvB,OAAO,KAAK,EAAY,UAAU,EAAU,MAAM,YAAY,CAAC;AAE/D,wBAAgB,MAAM,CACpB,KAAK,CAAC,CAAC,SAAS,MAAM,EACtB,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAEhC,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,GAAG,QAAQ,EAAE,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,GAC3C,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CA2B1C;AAED,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;AAE/D,KAAK,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,YAAY,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,GAC3B,KAAK,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/toggle.js b/packages/cli/vendor/configliere-pr32/script/lib/toggle.js new file mode 100644 index 00000000..97545737 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/toggle.js @@ -0,0 +1,86 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toggle = toggle; +const decode_js_1 = require("./decode.js"); +const dasherize_js_1 = require("./dasherize.js"); +const param_js_1 = require("./param.js"); +const pipeline_js_1 = require("./pipeline.js"); +function toggle(named, ...elements) { + const added = elements.reduce((value, element) => element(value), { + ...(0, param_js_1.param)(named, binding(named.name), (0, param_js_1.schema)(bool)), + decode: decode_js_1.boolean, + }); + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }); +} +function binding(name) { + const stem = (0, dasherize_js_1.dasherize)(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + return (param) => ({ + ...param, + cli: { + read: reader(name), + syntax: { + type: "option", + label: `${yes}, ${no}`, + }, + }, + }); +} +function reader(name) { + const stem = (0, dasherize_js_1.dasherize)(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + return (tokens) => { + let claim = tokens.claimOne((token) => { + return token.type === "flag" && + (token.text === yes || token.text === no); + }); + let [flag] = claim.tokens; + return flag + ? { + claim, + result: { + ok: true, + value: { exists: true, value: flag.text === yes }, + issues: [], + }, + } + : { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; + }; +} +const bool = { + "~standard": { + version: 1, + vendor: "configliere", + validate(value) { + return typeof value === "undefined" + ? { value: false } + : typeof value === "boolean" + ? { value } + : { issues: [{ message: "expected boolean" }] }; + }, + }, +}; +//# sourceMappingURL=toggle.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/toggle.js.map b/packages/cli/vendor/configliere-pr32/script/lib/toggle.js.map new file mode 100644 index 00000000..75eaa05e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/toggle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.js","sourceRoot":"","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AClB,CAAC,CAAC,OAAO,KAAK,KAAK,SAAS;oBAC5B,CAAC,CAAC,EAAE,KAAK,EAAE;oBACX,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,EAAE,CAAC;QACpD,CAAC;KACF;CACF,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts new file mode 100644 index 00000000..67162392 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts @@ -0,0 +1,21 @@ +export interface Token { + type: T; + index: number; + text: string; +} +export type AnyToken = Word | Flag | Setter | Separator | Literal; +export interface Setter extends Token<"setter"> { + nameText: string; + valueText: string; +} +export interface Flag extends Token<"flag"> { + flagText: string; + flagType: "short" | "long"; +} +export type Word = Token<"word">; +export interface Separator extends Token<"separator"> { + readonly text: "--"; +} +export type Literal = Token<"literal">; +export declare function tokenize(argv: string[]): readonly AnyToken[]; +//# sourceMappingURL=tokenize.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts.map new file mode 100644 index 00000000..242777d5 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenize.d.ts","sourceRoot":"","sources":["../../src/lib/tokenize.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,MAAM;IACrC,IAAI,EAAE,CAAC,CAAC;IACR,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AACD,MAAM,MAAM,QAAQ,GAChB,IAAI,GACJ,IAAI,GACJ,MAAM,GACN,SAAS,GACT,OAAO,CAAC;AAEZ,MAAM,WAAW,MAAO,SAAQ,KAAK,CAAC,QAAQ,CAAC;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,IAAK,SAAQ,KAAK,CAAC,MAAM,CAAC;IACzC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,OAAO,GAAG,MAAM,CAAC;CAC5B;AAED,MAAM,MAAM,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAEjC,MAAM,WAAW,SAAU,SAAQ,KAAK,CAAC,WAAW,CAAC;IACnD,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;AAEvC,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAS,QAAQ,EAAE,CAqC5D"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js new file mode 100644 index 00000000..70db8750 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.tokenize = tokenize; +function tokenize(argv) { + let quote = false; + let tokens = []; + for (let i = 0; i < argv.length; i++) { + let index = i; + let text = argv[i]; + if (quote) { + tokens.push({ type: "literal", index, text }); + continue; + } + if (text === "--") { + tokens.push({ type: "separator", index, text }); + quote = true; + continue; + } + let matchSetter = setterMatch.exec(text); + if (matchSetter?.groups) { + let { nameText, valueText } = matchSetter.groups; + tokens.push({ type: "setter", index, text, nameText, valueText }); + continue; + } + let matchFlag = flagMatch.exec(text); + if (matchFlag?.groups) { + let { prefix, flagText } = matchFlag.groups; + tokens.push({ + type: "flag", + index, + text, + flagText, + flagType: prefix === "-" ? "short" : "long", + }); + continue; + } + tokens.push({ type: "word", index, text }); + } + return tokens; +} +// deno-lint-ignore no-invalid-regexp +const flagMatch = /^(?--?)(?[^-=\s][^=\s]*)$/; +// deno-lint-ignore no-invalid-regexp +const setterMatch = /^--(?[^-=\s][^=\s]*)=(?[\s\S]*)$/; +//# sourceMappingURL=tokenize.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js.map b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js.map new file mode 100644 index 00000000..fa8e1975 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenize.js","sourceRoot":"","sources":["../../src/lib/tokenize.ts"],"names":[],"mappings":";;AA8BA,4BAqCC;AArCD,SAAgB,QAAQ,CAAC,IAAc;IACrC,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,MAAM,GAAe,EAAE,CAAC;IAE5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAC9C,SAAS;QACX,CAAC;QACD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YAChD,KAAK,GAAG,IAAI,CAAC;YACb,SAAS;QACX,CAAC;QACD,IAAI,WAAW,GAAG,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACzC,IAAI,WAAW,EAAE,MAAM,EAAE,CAAC;YACxB,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,WAAW,CAAC,MAAM,CAAC;YACjD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YAClE,SAAS;QACX,CAAC;QACD,IAAI,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,SAAS,EAAE,MAAM,EAAE,CAAC;YACtB,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,SAAS,CAAC,MAAM,CAAC;YAC5C,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,MAAM;gBACZ,KAAK;gBACL,IAAI;gBACJ,QAAQ;gBACR,QAAQ,EAAE,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;aAC5C,CAAC,CAAC;YACH,SAAS;QACX,CAAC;QACD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,qCAAqC;AACrC,MAAM,SAAS,GAAG,6CAA6C,CAAC;AAEhE,qCAAqC;AACrC,MAAM,WAAW,GAAG,uDAAuD,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts new file mode 100644 index 00000000..622ca7d9 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts @@ -0,0 +1,35 @@ +import type { AnyToken } from "./tokenize.js"; +export interface TokenInput extends Iterable { + claimNext(): Claim; + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimPair(match: (a: T, b: T) => boolean): Claim; + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; +} +export interface TokenRange { + readonly start: number; + readonly end?: number; +} +export interface ViewOptions { + readonly range: TokenRange; + readonly through?: number; +} +export declare class Tokenizer implements TokenInput { + readonly tokens: readonly T[]; + readonly claimed: ReadonlySet; + constructor(tokens: readonly T[], claimed?: ReadonlySet); + claimNext(): Claim; + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimPair(match: (a: T, b: T) => boolean): Claim; + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; + view(options: ViewOptions): TokenInput; + [Symbol.iterator](): Generator; +} +export interface Claim { + tokens: T[]; + rest: Tokenizer; +} +//# sourceMappingURL=tokenizer.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts.map new file mode 100644 index 00000000..cbfbf5d2 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenizer.d.ts","sourceRoot":"","sources":["../../src/lib/tokenizer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,QAAQ,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IACjE,SAAS,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC;IAEtB,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACpE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAEpD,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAA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,CAAC,CAAC;IAkBtD,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IACnE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;IAgBnD,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC;IAIxC,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC;CAOlD;AAED,MAAM,WAAW,KAAK,CAAC,CAAC,SAAS,QAAQ,EAAE,CAAC,SAAS,QAAQ,GAAG,CAAC;IAC/D,MAAM,EAAE,CAAC,EAAE,CAAC;IACZ,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;CACpB"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js new file mode 100644 index 00000000..f11d6449 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js @@ -0,0 +1,153 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Tokenizer = void 0; +class Tokenizer { + constructor(tokens, claimed = new Set()) { + Object.defineProperty(this, "tokens", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claimed", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.tokens = tokens; + this.claimed = new Set(claimed); + } + claimNext() { + return this.claimOne(() => true); + } + claimOne(match) { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this, [token.index]), + }; + } + } + return { tokens: [], rest: this }; + } + claimPair(match) { + let previous; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this }; + } + claimAll(match) { + let tokens = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this, claimed) : this, + }; + } + view(options) { + return new View(this, options); + } + *[Symbol.iterator]() { + for (let token of this.tokens) { + if (!this.claimed.has(token.index)) { + yield token; + } + } + } +} +exports.Tokenizer = Tokenizer; +class View { + constructor(source, options) { + Object.defineProperty(this, "source", { + enumerable: true, + configurable: true, + writable: true, + value: source + }); + Object.defineProperty(this, "options", { + enumerable: true, + configurable: true, + writable: true, + value: options + }); + } + claimNext() { + return this.claimOne(() => true); + } + claimOne(match) { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this.source, [token.index]), + }; + } + } + return { tokens: [], rest: this.source }; + } + claimPair(match) { + let previous; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this.source, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this.source }; + } + claimAll(match) { + let tokens = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this.source, claimed) : this.source, + }; + } + *[Symbol.iterator]() { + let { start, end } = this.options.range; + let { through } = this.options; + for (let token of this.source) { + if (token.index > start && + (end === undefined || token.index < end) && + (through === undefined || token.index <= through)) { + yield token; + } + } + } +} +function remainder(source, claimed) { + return new Tokenizer(source.tokens, new Set([...source.claimed, ...claimed])); +} +//# sourceMappingURL=tokenizer.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js.map b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js.map new file mode 100644 index 00000000..55316459 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/tokenizer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tokenizer.js","sourceRoot":"","sources":["../../src/lib/tokenizer.ts"],"names":[],"mappings":";;;AAwBA,MAAa,SAAS;IAIpB,YACE,MAAoB,EACpB,UAA+B,IAAI,GAAG,EAAE;QALjC;;;;;WAAqB;QACrB;;;;;WAA6B;QAMpC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAClC,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAID,QAAQ,CAAC,KAA4B;QACnC,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,OAAO;oBACL,MAAM,EAAE,CAAC,KAAK,CAAC;oBACf,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;iBACrC,CAAC;YACJ,CAAC;QACH,CAAC;QACD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;IACpC,CAAC;IAED,SAAS,CAAC,KAA8B;QACtC,IAAI,QAAuB,CAAC;QAC5B,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,QAAQ,GAAG,KAAK,CAAC;gBACjB,SAAS;YACX,CAAC;YACD,IAAI,KAAK,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC;gBACjE,OAAO;oBACL,MAAM,EAAE,CAAC,QAAQ,EAAE,KAAK,CAAC;oBACzB,IAAI,EAAE,SAAS,CAAC,IA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,GAAG,EAAU,CAAC;QAChC,KAAK,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YACvB,IAAI,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBACjB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBACzB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YACrB,CAAC;QACH,CAAC;QACD,OAAO;YACL,MAAM;YACN,IAAI,EAAE,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM;SACxE,CAAC;IACJ,CAAC;IAED,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC;QAChB,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACxC,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC;QAE/B,KAAK,IAAI,KAAK,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAC9B,IACE,KAAK,CAAC,KAAK,GAAG,KAAK;gBACnB,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,GAAG,GAAG,CAAC;gBACxC,CAAC,OAAO,KAAK,SAAS,IAAI,KAAK,CAAC,KAAK,IAAI,OAAO,CAAC,EACjD,CAAC;gBACD,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;CACF;AAED,SAAS,SAAS,CAChB,MAAoB,EACpB,OAAyB;IAEzB,OAAO,IAAI,SAAS,CAClB,MAAM,CAAC,MAAM,EACb,IAAI,GAAG,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,GAAG,OAAO,CAAC,CAAC,CACzC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts new file mode 100644 index 00000000..36a0b98c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts @@ -0,0 +1,175 @@ +import type { StandardSchemaV1 } from "@standard-schema/spec"; +import type { EnvSource } from "./env.js"; +import type { Literal } from "./tokenize.js"; +import type { Param } from "./param.js"; +import type { Result } from "./result.js"; +import type { ValueSource } from "./values.js"; +export type Issue = StandardSchemaV1.Issue; +export type Schema = StandardSchemaV1; +export type ModelSchema = StandardSchemaV1; +export type ModelParams = Params>; +export type ModelTransformFunction = (options: Record, model: Record, phase: ModelParams) => Record | void; +export type ModelTransform = ModelSchema | ModelTransformFunction; +export interface ModelOperation { + readonly transform: ModelTransform; + readonly keys: readonly string[]; +} +export interface Definition { + readonly name: N; + readonly description?: string; +} +export interface Route extends Definition { + readonly methods: readonly M[]; + readonly version?: string; + readonly phases: P; + readonly model?: T; + readonly children?: C; +} +export type Parse = Outcome>; +export type Phase = [Requirement] extends [never] ? Done : Next; +export type Next = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver: (requirement: T) => (input: AnyRoute) => AnyRoute; +}; +export type Done = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; +}; +export type Params = { + [K in keyof Model]: K extends string ? Param : never; +}; +export interface ParseIncrement { + readonly ok: true; + readonly route: P; + readonly model: IncrementModelOf; + resume(result: Result>): Outcome, P, Models>>; +} +export type ContinuationOf = R extends Route ? Route, ChildrenOf, readonly [Next, ...Tail]> : never; +export type ModelOf = R extends Route ? T : never; +export type ChildrenOf = R extends Route ? Children : never; +export type RequirementsOf = RequirementsIn; +export type RequirementOf = RequirementIn; +export interface AnyRoute extends Definition { + readonly methods: readonly Method[]; + readonly version?: string; + readonly phases: AnyPhases; +} +export interface AnyPhase { + readonly params: ModelParams; + readonly routes: readonly AnyRoute[]; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver?: (requirement: never) => (route: never) => AnyRoute; +} +export type AnyPhases = readonly [AnyPhase, ...AnyPhase[]]; +export type Method = "help" | "version" | "execute"; +export type MethodsOf = R["methods"][number]; +export type Path = readonly string[]; +export type Input = { + argv: string[]; + values?: readonly ValueSource[]; + envs?: readonly EnvSource[]; +}; +export interface Failure { + readonly ok: false; + readonly code: C; +} +export type Outcome = T | MethodNotAllowed | UnprocessableContent; +export type IntentsOf = IntentsAt; +export type RoutePath = `/${string}`; +export type ModelsByRoute = { + readonly [path: RoutePath]: object; +}; +export type PathOf = R extends "/" ? [] : R extends `/${infer Rest}` ? Split : never; +export type AnyIntent = Help | Version | Execute; +export type ChildIntents = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[] +] ? (IntentsAt, Models> | ChildIntents) : never; +export interface Intent { + readonly ok: true; + readonly method: M; + readonly route: P; + readonly definition: AnyRoute; + readonly path: PathOf

; + readonly literals: Iterable; +} +export type Help

= Intent<"help", P>; +export type Version

= Intent<"version", P>; +export interface Execute

extends Intent<"execute", P> { + readonly issues: readonly Issue[]; + readonly model: Models[P]; + readonly models: Models; +} +export type Status = "method-not-allowed" | "unprocessable-content"; +export interface MethodNotAllowed extends Failure<"method-not-allowed"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly method: Method; + readonly allowed: readonly Method[]; +} +export interface UnprocessableContent extends Failure<"unprocessable-content"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly issues: Issue[]; +} +type RequirementIn

= P extends { + readonly resolver: (requirement: infer Requirement) => (route: AnyRoute) => AnyRoute; +} ? Requirement : never; +type IncrementModelOf = R["phases"][0] extends Next ? Model : never; +type ParseAt = [RequirementOf] extends [never] ? (Help

| ("version" extends MethodsOf ? Version

: never) | ("execute" extends MethodsOf ? AddModel> extends infer Bound extends ModelsByRoute ? Execute : never : never) | ParseChildren, P, AddModel>>) : ParseIncrement; +type ParseChildren = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[] +] ? (ParseAt, Models> | ParseChildren) : never; +type RequirementsIn

= P extends readonly [ + infer Head extends AnyPhase, + ...infer Tail extends AnyPhase[] +] ? [RequirementIn] extends [never] ? readonly [] : readonly [RequirementIn, ...RequirementsIn] : readonly []; +type AddModel = { + [K in keyof Models | P]: K extends P ? T : K extends keyof Models ? Models[K] : never; +}; +type Split = string extends S ? Path : S extends `${infer Head}/${infer Tail}` ? [Head, ...Split] : S extends "" ? [] : [S]; +type Append = A extends "/" ? `/${N}` : `${A}/${N}`; +type AddParam

= P extends Next ? Next, Routes, Requirement> : P extends Done ? Done, Routes> : never; +export type AddParamToLast

= ReplaceLast, K, V>>; +export type AddRoutesToLast

= ReplaceLast, C>>; +type LastOf

= P extends readonly [ + ...AnyPhase[], + infer Last extends AnyPhase +] ? Last : never; +type ReplaceLast

= P extends readonly [AnyPhase] ? readonly [Last] : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase +] ? readonly [First, ...Middle, Last] : never; +type AddRoutes = Phase extends Next ? Next : Phase extends Done ? Done : never; +export type AddField = Simplify & { + [P in K]: V; +}>; +type Simplify = { + [P in keyof T]: T[P]; +}; +type IntentsAt = Help

| ("version" extends MethodsOf ? Version

: never) | ("execute" extends MethodsOf ? AddModel> extends infer Bound extends ModelsByRoute ? Execute : never : never) | ChildIntents, P, AddModel>>; +export {}; +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts.map new file mode 100644 index 00000000..ca268e6f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[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AAO,CACjD,CAAC,EACD;KAAG,CAAC,IAAI,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC;CAAE,CACjC,GACD,KAAK,GACL,KAAK,CACV,GACC,YAAY,CACZ,UAAU,CAAC,CAAC,CAAC,EACb,CAAC,EACD,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAChC,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/types.js b/packages/cli/vendor/configliere-pr32/script/lib/types.js new file mode 100644 index 00000000..11e638d1 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/types.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/types.js.map b/packages/cli/vendor/configliere-pr32/script/lib/types.js.map new file mode 100644 index 00000000..95612423 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts b/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts new file mode 100644 index 00000000..bae0e969 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts @@ -0,0 +1,30 @@ +import type { Maybe } from "./maybe.js"; +import { type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; +export type ValueSource = { + name: string; + value: unknown; +}; +export declare function withValues(values: readonly ValueSource[]): IdentityElement; +export type ValueClaim = { + result: Maybe<{ + source: string; + address: readonly string[]; + value: unknown; + }>; + rest: Values; +}; +export declare class Values { + mounts: Map; + claims: Set; + constructor(mounts?: Map, claims?: Set); + mount(path: readonly string[], sources: readonly ValueSource[]): Values; + claim({ route, address }: ClaimOptions): ValueClaim; +} +export interface ClaimOptions { + route: readonly string[]; + address: readonly string[]; +} +type ClaimId = string; +export {}; +//# sourceMappingURL=values.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts.map b/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts.map new file mode 100644 index 00000000..3ba7281b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/values.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"values.d.ts","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAS,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,WAAW,EAAE,GAC7B,eAAe,CAAC,QAAQ,CAAC,CAe3B;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,KAAK,CAAC;QACZ,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;QAC3B,KAAK,EAAE,OAAO,CAAC;KAChB,CAAC,CAAC;IACH,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAAa,MAAM;IACjB,MAAM,EAAE,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,CAAC,CAAC;IACtC,MAAM,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;gBAGnB,MAAM,GAAE,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,CAAa,EACjD,MAAM,GAAE,GAAG,CAAC,OAAO,CAAa;IAMlC,KAAK,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,WAAW,EAAE,GAAG,MAAM;IAevE,KAAK,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,YAAY,GAAG,UAAU;CA8BpD;AAED,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IACzB,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CAC5B;AAED,KAAK,OAAO,GAAG,MAAM,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/values.js b/packages/cli/vendor/configliere-pr32/script/lib/values.js new file mode 100644 index 00000000..a2cabb80 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/values.js @@ -0,0 +1,99 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Values = void 0; +exports.withValues = withValues; +const pipeline_js_1 = require("./pipeline.js"); +function withValues(values) { + return (0, pipeline_js_1.brand)((route) => { + let phases = [...route.phases]; + let phase = phases.pop(); + phases.push({ + ...phase, + values: phase.values.concat(values), + }); + return { + ...route, + phases, + }; + }); +} +class Values { + constructor(mounts = new Map(), claims = new Set()) { + Object.defineProperty(this, "mounts", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + Object.defineProperty(this, "claims", { + enumerable: true, + configurable: true, + writable: true, + value: void 0 + }); + this.mounts = mounts; + this.claims = claims; + } + mount(path, sources) { + if (sources.length === 0) { + return this; + } + const id = routeId(path); + return new Values(new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), this.claims); + } + claim({ route, address }) { + let id = claimId([...route, ...address]); + const nope = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + for (let end = route.length; end >= 0; end--) { + let mountId = routeId(route.slice(0, end)); + let sources = this.mounts.get(mountId) ?? []; + for (let { name, value } of sources) { + let result = find(value, [...route.slice(end), ...address]); + if (result.exists) { + let rest = new Values(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + value: result.value, + }, + }, + rest, + }; + } + } + } + return nope; + } +} +exports.Values = Values; +function routeId(address) { + return `/${address.join("/")}`; +} +function claimId(address) { + return JSON.stringify(address); +} +function find(value, path) { + let current = value; + for (let key of path) { + if (current === null || + (typeof current !== "object" && typeof current !== "function") || + !Object.hasOwn(current, key)) { + return { exists: false }; + } + current = current[key]; + } + return { + exists: true, + value: current, + }; +} +//# sourceMappingURL=values.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/lib/values.js.map b/packages/cli/vendor/configliere-pr32/script/lib/values.js.map new file mode 100644 index 00000000..35d9f981 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/lib/values.js.map @@ -0,0 +1 @@ +{"version":3,"file":"values.js","sourceRoot":"","sources":["../../src/lib/values.ts"],"names":[],"mappings":";;;AASA,gCAiBC;AAzBD,+CAA4D;AAQ5D,SAAgB,UAAU,CACxB,MAA8B;IAE9B,OAAO,IAAA,mBAAK,EACV,CAAC,KAAe,EAAE,EAAE;QAClB,IAAI,MAAM,GAAG,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,EAAG,CAAC;QAC1B,MAAM,CAAC,IAAI,CAAC;YACV,GAAG,KAAK;YACR,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;SACpC,CAAC,CAAC;QACH,OAAO;YACL,GAAG,KAAK;YACR,MAAM;SACP,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAWD,MAAa,MAAM;IAIjB,YACE,SAAwC,IAAI,GAAG,EAAE,EACjD,SAAuB,IAAI,GAAG,EAAE;QALlC;;;;;WAAsC;QACtC;;;;;WAAqB;QAMnB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,KAAK,CAAC,IAAuB,EAAE,OAA+B;QA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 No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/mod.d.ts b/packages/cli/vendor/configliere-pr32/script/mod.d.ts new file mode 100644 index 00000000..27b887a3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/mod.d.ts @@ -0,0 +1,29 @@ +import "./_dnt.polyfills.js"; +export { argument } from "./lib/argument.js"; +export { extend } from "./lib/extend.js"; +export { command } from "./lib/command.js"; +export type { CommandZero } from "./lib/command.js"; +export { checkpoint } from "./lib/checkpoint.js"; +export { dynamic } from "./lib/dynamic.js"; +export { description, name } from "./lib/definition.js"; +export { env, withEnvs } from "./lib/env.js"; +export type { Environment, EnvSource } from "./lib/env.js"; +export { option } from "./lib/option.js"; +export { multiple, param, schema } from "./lib/param.js"; +export type { Param } from "./lib/param.js"; +export { parse } from "./lib/parse.js"; +export { mark } from "./lib/pipeline.js"; +export type { ModelTransformElement, Transform, TransformElement, } from "./lib/pipeline.js"; +export { printErrors, printHelp, printVersion } from "./lib/print.js"; +export type { Rest } from "./lib/rest.js"; +export { cli } from "./lib/read.js"; +export type { CLIOptions, CLIRead, ReadCLI, Symbol as CLISymbol, } from "./lib/read.js"; +export { executable, route, routes, transform, version } from "./lib/route.js"; +export type { RouteZero } from "./lib/route.js"; +export { toggle } from "./lib/toggle.js"; +export { withValues } from "./lib/values.js"; +export type { ValueSource } from "./lib/values.js"; +export type { Literal } from "./lib/tokenize.js"; +export type { Result } from "./lib/result.js"; +export type { AnyIntent, AnyRoute, Definition, Execute, Help, Input, Intent, IntentsOf, Issue, Method, MethodNotAllowed, MethodsOf, ModelOf, ModelParams, ModelsByRoute, ModelSchema, Outcome, Path, PathOf, Route, RoutePath, Schema, UnprocessableContent, Version, } from "./lib/types.js"; +//# sourceMappingURL=mod.d.ts.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/mod.d.ts.map b/packages/cli/vendor/configliere-pr32/script/mod.d.ts.map new file mode 100644 index 00000000..b5c0b8f9 --- /dev/null +++ b/packages/cli/v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ACpB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC/E,YAAY,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEnD,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAE9C,YAAY,EACV,SAAS,EACT,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,MAAM,EACN,gBAAgB,EAChB,SAAS,EACT,OAAO,EACP,WAAW,EACX,aAAa,EACb,WAAW,EACX,OAAO,EACP,IAAI,EACJ,MAAM,EACN,KAAK,EACL,SAAS,EACT,MAAM,EACN,oBAAoB,EACpB,OAAO,GACR,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/mod.js b/packages/cli/vendor/configliere-pr32/script/mod.js new file mode 100644 index 00000000..b43d017b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/mod.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.withValues = exports.toggle = exports.version = exports.transform = exports.routes = exports.route = exports.executable = exports.cli = exports.printVersion = exports.printHelp = exports.printErrors = exports.mark = exports.parse = exports.schema = exports.param = exports.multiple = exports.option = exports.withEnvs = exports.env = exports.name = exports.description = exports.dynamic = exports.checkpoint = exports.command = exports.extend = exports.argument = void 0; +require("./_dnt.polyfills.js"); +var argument_js_1 = require("./lib/argument.js"); +Object.defineProperty(exports, "argument", { enumerable: true, get: function () { return argument_js_1.argument; } }); +var extend_js_1 = require("./lib/extend.js"); +Object.defineProperty(exports, "extend", { enumerable: true, get: function () { return extend_js_1.extend; } }); +var command_js_1 = require("./lib/command.js"); +Object.defineProperty(exports, "command", { enumerable: true, get: function () { return command_js_1.command; } }); +var checkpoint_js_1 = require("./lib/checkpoint.js"); +Object.defineProperty(exports, "checkpoint", { enumerable: true, get: function () { return checkpoint_js_1.checkpoint; } }); +var dynamic_js_1 = require("./lib/dynamic.js"); +Object.defineProperty(exports, "dynamic", { enumerable: true, get: function () { return dynamic_js_1.dynamic; } }); +var definition_js_1 = require("./lib/definition.js"); +Object.defineProperty(exports, "description", { enumerable: true, get: function () { return definition_js_1.description; } }); +Object.defineProperty(exports, "name", { enumerable: true, get: function () { return definition_js_1.name; } }); +var env_js_1 = require("./lib/env.js"); +Object.defineProperty(exports, "env", { enumerable: true, get: function () { return env_js_1.env; } }); +Object.defineProperty(exports, "withEnvs", { enumerable: true, get: function () { return env_js_1.withEnvs; } }); +var option_js_1 = require("./lib/option.js"); +Object.defineProperty(exports, "option", { enumerable: true, get: function () { return option_js_1.option; } }); +var param_js_1 = require("./lib/param.js"); +Object.defineProperty(exports, "multiple", { enumerable: true, get: function () { return param_js_1.multiple; } }); +Object.defineProperty(exports, "param", { enumerable: true, get: function () { return param_js_1.param; } }); +Object.defineProperty(exports, "schema", { enumerable: true, get: function () { return param_js_1.schema; } }); +var parse_js_1 = require("./lib/parse.js"); +Object.defineProperty(exports, "parse", { enumerable: true, get: function () { return parse_js_1.parse; } }); +var pipeline_js_1 = require("./lib/pipeline.js"); +Object.defineProperty(exports, "mark", { enumerable: true, get: function () { return pipeline_js_1.mark; } }); +var print_js_1 = require("./lib/print.js"); +Object.defineProperty(exports, "printErrors", { enumerable: true, get: function () { return print_js_1.printErrors; } }); +Object.defineProperty(exports, "printHelp", { enumerable: true, get: function () { return print_js_1.printHelp; } }); +Object.defineProperty(exports, "printVersion", { enumerable: true, get: function () { return print_js_1.printVersion; } }); +var read_js_1 = require("./lib/read.js"); +Object.defineProperty(exports, "cli", { enumerable: true, get: function () { return read_js_1.cli; } }); +var route_js_1 = require("./lib/route.js"); +Object.defineProperty(exports, "executable", { enumerable: true, get: function () { return route_js_1.executable; } }); +Object.defineProperty(exports, "route", { enumerable: true, get: function () { return route_js_1.route; } }); +Object.defineProperty(exports, "routes", { enumerable: true, get: function () { return route_js_1.routes; } }); +Object.defineProperty(exports, "transform", { enumerable: true, get: function () { return route_js_1.transform; } }); +Object.defineProperty(exports, "version", { enumerable: true, get: function () { return route_js_1.version; } }); +var toggle_js_1 = require("./lib/toggle.js"); +Object.defineProperty(exports, "toggle", { enumerable: true, get: function () { return toggle_js_1.toggle; } }); +var values_js_1 = require("./lib/values.js"); +Object.defineProperty(exports, "withValues", { enumerable: true, get: function () { return values_js_1.withValues; } }); +//# sourceMappingURL=mod.js.map \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/mod.js.map b/packages/cli/vendor/configliere-pr32/script/mod.js.map new file mode 100644 index 00000000..f3a2ecf7 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/mod.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mod.js","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAC7B,iDAA6C;AAApC,uGAAA,QAAQ,OAAA;AAEjB,6CAAyC;AAAhC,mGAAA,MAAM,OAAA;AACf,+CAA2C;AAAlC,qGAAA,OAAO,OAAA;AAGhB,qDAAiD;AAAxC,2GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,qGAAA,OAAO,OAAA;AAEhB,qDAAwD;AAA/C,4GAAA,WAAW,OAAA;AAAE,qGAAA,IAAI,OAAA;AAE1B,uCAA6C;AAApC,6FAAA,GAAG,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAGtB,6CAAyC;AAAhC,mGAAA,MAAM,OAAA;AAEf,2CAAyD;AAAhD,oGAAA,QAAQ,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,kGAAA,MAAM,OAAA;AAGhC,2CAAuC;AAA9B,iGAAA,KAAK,OAAA;AAEd,iDAAyC;AAAhC,mGAAA,IAAI,OAAA;AAOb,2CAAsE;AAA7D,uGAAA,WAAW,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,wGAAA,YAAY,OAAA;AAI7C,yCAAoC;AAA3B,8FAAA,GAAG,OAAA;AAQZ,2CAA+E;AAAtE,sGAAA,UAAU,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,mGAAA,OAAO,OAAA;AAGtD,6CAAyC;AAAhC,mGAAA,MAAM,OAAA;AAEf,6CAA6C;AAApC,uGAAA,UAAU,OAAA"} \ No newline at end of file diff --git a/packages/cli/vendor/configliere-pr32/script/package.json b/packages/cli/vendor/configliere-pr32/script/package.json new file mode 100644 index 00000000..5bbefffb --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/script/package.json @@ -0,0 +1,3 @@ +{ + "type": "commonjs" +} diff --git a/packages/cli/vendor/configliere-pr32/src/_dnt.polyfills.ts b/packages/cli/vendor/configliere-pr32/src/_dnt.polyfills.ts new file mode 100644 index 00000000..1f736f45 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/_dnt.polyfills.ts @@ -0,0 +1,70 @@ +// https://github.com/tc39/proposal-accessible-object-hasownproperty/blob/main/polyfill.js +if (!Object.hasOwn) { + Object.defineProperty(Object, "hasOwn", { + value: function (object: any, property: any) { + if (object == null) { + throw new TypeError("Cannot convert undefined or null to object"); + } + return Object.prototype.hasOwnProperty.call(Object(object), property); + }, + configurable: true, + enumerable: false, + writable: true, + }); +} + +declare global { + interface Object { + /** + * Determines whether an object has a property with the specified name. + * @param o An object. + * @param v A property name. + */ + hasOwn(o: object, v: PropertyKey): boolean; + } +} + +export {}; +declare global { + // https://github.com/microsoft/TypeScript/blob/main/lib/lib.es2021.string.d.ts + interface String { + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replaceValue A string containing the text to replace for every successful match of searchValue in this string. + */ + replaceAll(searchValue: string | RegExp, replaceValue: string): string; + + /** + * Replace all instances of a substring in a string, using a regular expression or search string. + * @param searchValue A string to search for. + * @param replacer A function that returns the replacement text. + */ + replaceAll( + searchValue: string | RegExp, + replacer: (substring: string, ...args: any[]) => string, + ): string; + } +} + +/** + * String.prototype.replaceAll() polyfill + * https://gomakethings.com/how-to-replace-a-section-of-a-string-with-another-one-with-vanilla-js/ + * @author Chris Ferdinandi + * @license MIT + */ +if (!String.prototype.replaceAll) { + String.prototype.replaceAll = function (str: any, newStr: any) { + // If a regex pattern + if ( + Object.prototype.toString.call(str).toLowerCase() === "[object regexp]" + ) { + return this.replace(str, newStr); + } + + // If a string + return this.replace(new RegExp(str, "g"), newStr); + }; +} + +export {}; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/argument.ts b/packages/cli/vendor/configliere-pr32/src/lib/argument.ts new file mode 100644 index 00000000..c174d99a --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/argument.ts @@ -0,0 +1,91 @@ +import { type Param, param } from "./param.js"; +import { + brand, + type Check, + type Fold, + type ParamElement, + type Unary, +} from "./pipeline.js"; +import type { CLIRead, ReadCLI } from "./read.js"; +import type { Word } from "./tokenize.js"; +import type { AnyRoute, Definition } from "./types.js"; + +export function argument< + const N extends string, + const E extends readonly Unary[], +>( + named: Definition, + ...elements: E & Check, E> +): ElementOf, E>> { + const added = elements.reduce( + (value, element) => element(value as never), + param(named, positional), + ) as Param; + + return brand, E>>>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + + return { + ...route, + phases, + }; + }, + ); +} + +type ValueOf

= P extends Param ? T : never; + +type ElementOf = P extends Param + ? ParamElement> + : never; + +function positional

>(param: P): P { + return { + ...param, + cli: { + read, + syntax: { + type: "argument", + label: `<${param.name.toUpperCase()}>`, + }, + }, + }; +} + +const read: ReadCLI = (tokens): CLIRead => { + let claim = tokens.claimOne((token): token is Word => token.type === "word"); + let [word] = claim.tokens; + + return word + ? { + claim, + result: { + ok: true, + value: { exists: true, value: word.text }, + issues: [], + }, + } + : nothing(tokens); +}; + +function nothing(tokens: Parameters[0]): CLIRead { + let claim = tokens.claimAll(() => false); + + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/bind.ts b/packages/cli/vendor/configliere-pr32/src/lib/bind.ts new file mode 100644 index 00000000..96645ca6 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/bind.ts @@ -0,0 +1,362 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import type { CLIRead, Symbol } from "./read.js"; +import type { Rest } from "./rest.js"; +import type { Result } from "./result.js"; +import type { Word } from "./tokenize.js"; +import type { TokenInput, Tokenizer, TokenRange } from "./tokenizer.js"; +import type { AnyPhase, Issue, Path } from "./types.js"; + +export interface Binding { + readonly rest: Rest; + readonly result: Result; +} + +export interface PhaseBinding { + readonly rest: Rest; + readonly model: Record; + readonly issues: Issue[]; + readonly valid: boolean; +} + +export interface PhaseSegment { + readonly range: TokenRange; + readonly path: Path; +} + +export function fromCLI(options: { + readonly param: Param; + readonly view: TokenInput; + readonly rest: Rest; +}): Maybe> { + let { param, view, rest } = options; + return fromRead(param, param.cli.read(view), rest); +} + +export function fromValues(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe> { + let { param, route, rest } = options; + let claim = rest.values.claim({ + route, + address: [param.name], + }); + + if (!claim.result.exists) { + return { exists: false }; + } + + return { + exists: true, + value: { + rest: { + ...rest, + values: claim.rest, + }, + result: validate(param, claim.result.value.value, [param.name]), + }, + }; +} + +export function fromEnv(options: { + readonly param: Param; + readonly route: Path; + readonly rest: Rest; +}): Maybe> { + let { param, route, rest } = options; + let claim = rest.envs.claim({ + route, + address: [param.name], + key: param.env, + }); + + if (!claim.result.exists) { + return { exists: false }; + } + + let value = claim.result.value.value; + + return { + exists: true, + value: { + rest: { + ...rest, + envs: claim.rest, + }, + result: decode(param, value, param.decode(value), [param.name]), + }, + }; +} + +export function bindPhase(options: { + readonly phase: AnyPhase; + readonly segment: PhaseSegment; + readonly rest: Rest; +}): PhaseBinding { + let { phase, segment } = options; + let rest = options.rest; + let params = Object.values(phase.params) as Param[]; + let pending = new Map(params.map((param) => [param.name, param])); + let results = new Map>(); + + function settle( + param: Param, + binding: Binding, + ): void { + rest = binding.rest; + results.set(param.name, binding.result); + pending.delete(param.name); + } + + function accept( + param: Param, + attempt: Maybe>, + ): void { + if (!attempt.exists) { + return; + } + + settle(param, attempt.value); + } + + // Every pending reader proposes a claim against the same immutable view. + // Commit the proposal beginning earliest in argv, then recompute the view. + // This lets `--port 9000` outrank a positional claim on `9000` without + // attaching binding-policy metadata to either reader. + while (true) { + let horizon = first(rest.tokens, segment.range); + let offer: { + param: Param; + read: CLIRead; + index: number; + } | undefined; + + for (let param of pending.values()) { + let view = rest.tokens.view({ + range: segment.range, + // Repeated options must see every occurrence in the phase, not only + // the first option/value pair before the binding horizon. + through: param.multiple ? undefined : horizon?.index, + }); + let read = param.cli.read(view, param.multiple); + + if (read.result.ok && !read.result.value.exists) { + continue; + } + + let index = earliest(read.claim.tokens); + if (!offer || index < offer.index) { + offer = { param, read, index }; + } + } + + if (!offer) { + break; + } + + accept(offer.param, fromRead(offer.param, offer.read, rest)); + } + + // Address sources have stable visibility once the route is known. They are + // tried only after CLI has reached its fixed point so a provisional CLI miss + // cannot let a lower-priority source settle the parameter too early. + for (let source of [fromEnv, fromValues]) { + for (let param of pending.values()) { + accept( + param, + source({ + param, + route: segment.path, + rest, + }), + ); + } + } + + // Only total absence reaches the schema as undefined. This is where required, + // optional, and defaulting parameters diverge. + for (let param of pending.values()) { + results.set(param.name, validate(param, undefined, [param.name])); + } + + let model: Record = {}; + let issues: Issue[] = []; + let valid = true; + + // Collect in declaration order, independent of the source or sweep that + // settled each parameter. + for (let param of params) { + let result = results.get(param.name)!; + issues.push(...result.issues ?? []); + + if (result.ok) { + model[param.name] = result.value; + } else { + valid = false; + } + } + + return { rest, model, issues, valid }; +} + +function fromRead( + param: Param, + read: CLIRead, + rest: Rest, +): Maybe> { + let path = [param.name]; + + if (!read.result.ok) { + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result: read.result, + }, + }; + } + + if (!read.result.value.exists) { + return { exists: false }; + } + + let value = read.result.value.value; + let result = Array.isArray(value) ? decodeMany(param, value, path) : decode( + param, + value, + typeof value === "string" ? param.decode(value) : [value], + path, + ); + result = merge(result, read.result.issues); + + return { + exists: true, + value: { + rest: { + ...rest, + tokens: read.claim.rest, + }, + result, + }, + }; +} + +function decodeMany( + param: Param, + values: unknown[], + path: string[], +): Result { + let candidates: unknown[][] = [[]]; + + for (let value of values) { + let decoded = typeof value === "string" ? param.decode(value) : [value]; + candidates = candidates.flatMap((prefix) => + decoded.map((candidate) => [...prefix, candidate]) + ); + } + + return decode(param, values, candidates, path); +} + +function decode( + param: Param, + value: unknown, + candidates: unknown[], + path: string[], +): Result { + if (candidates.length === 0) { + return { + ok: false, + issues: [{ + message: `unable to decode ${JSON.stringify(value)}`, + path, + }], + }; + } + + let issues: readonly Issue[] | undefined; + + for (let candidate of candidates) { + let result = validate(param, candidate, path); + if (result.ok) { + return result; + } + issues = issues ?? result.issues; + } + + return { + ok: false, + issues: issues ?? [], + }; +} + +function validate( + param: Param, + value: unknown, + path: string[], +): Result { + let validated = param.schema["~standard"].validate(value); + if (validated instanceof Promise) { + return { + ok: false, + issues: [{ + message: `async schemas are not allowed`, + path, + }], + }; + } + + if (validated.issues) { + return { + ok: false, + issues: validated.issues.map((issue) => ({ + ...issue, + message: issue.message, + path, + })), + }; + } + + return { + ok: true, + issues: [], + value: validated.value, + }; +} + +function merge( + result: Result, + issues: readonly Issue[] | undefined, +): Result { + if (!issues || issues.length === 0) { + return result; + } + + return { + ...result, + issues: [...issues, ...(result.issues ?? [])], + }; +} + +function first(tokens: Tokenizer, range: TokenRange): Word | undefined { + for (let token of tokens.view({ range })) { + if (token.type === "word") { + return token; + } + } +} + +function earliest(tokens: readonly Symbol[]): number { + let first = Infinity; + + for (let token of tokens) { + first = Math.min(first, token.index); + } + + return first; +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/checkpoint.ts b/packages/cli/vendor/configliere-pr32/src/lib/checkpoint.ts new file mode 100644 index 00000000..e0c989a3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/checkpoint.ts @@ -0,0 +1,10 @@ +import { dynamic } from "./dynamic.js"; +import type { DynamicElement } from "./pipeline.js"; +import { type ValueSource, withValues } from "./values.js"; + +export function checkpoint(): DynamicElement< + ValueSource[], + ReturnType +> { + return dynamic((values: ValueSource[]) => withValues(values)); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/command.ts b/packages/cli/vendor/configliere-pr32/src/lib/command.ts new file mode 100644 index 00000000..6d61a74b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/command.ts @@ -0,0 +1,35 @@ +// deno-lint-ignore-file ban-types +import type { Check, Fold, Materialize, Unary } from "./pipeline.js"; +import type { Definition, Done, Route } from "./types.js"; + +export type CommandZero = Route< + N, + "help" | "execute", + {}, + [], + [Done<{}, []>] +>; + +export function command< + const N extends string, + const E extends readonly Unary[], +>( + start: Definition, + ...elements: E & Check, E> +): Materialize, E>> { + let zero: CommandZero = { + ...start, + methods: ["help", "execute"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + + return elements.reduce( + (value, element) => element(value as never), + zero, + ) as Materialize, E>>; +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/dasherize.ts b/packages/cli/vendor/configliere-pr32/src/lib/dasherize.ts new file mode 100644 index 00000000..a35f0c5c --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/dasherize.ts @@ -0,0 +1,7 @@ +export function dasherize(name: string): string { + return name + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1-$2") + .replace(/([a-z\d])([A-Z])/g, "$1-$2") + .replace(/[\s_]+/g, "-") + .toLowerCase(); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/decode.ts b/packages/cli/vendor/configliere-pr32/src/lib/decode.ts new file mode 100644 index 00000000..674b6455 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/decode.ts @@ -0,0 +1,26 @@ +export type Decoder = (value: string) => unknown[]; + +export const number: Decoder = (value) => { + if (!numeric.test(value)) { + return []; + } + + let decoded = Number(value); + return Number.isFinite(decoded) ? [decoded] : []; +}; + +export const scalar: Decoder = (value) => { + return [...number(value), value]; +}; + +export const boolean: Decoder = (value) => { + if (value === "true") { + return [true]; + } + if (value === "false") { + return [false]; + } + return []; +}; + +const numeric = /^-?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/definition.ts b/packages/cli/vendor/configliere-pr32/src/lib/definition.ts new file mode 100644 index 00000000..4bf88620 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/definition.ts @@ -0,0 +1,17 @@ +import { brand, type IdentityElement } from "./pipeline.js"; +import type { Definition } from "./types.js"; + +export function name(name: N): Definition { + return { name }; +} + +export function description( + description: string, +): IdentityElement> { + return brand>>(( + definition: Definition, + ) => ({ + ...definition, + description, + })); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/dynamic.ts b/packages/cli/vendor/configliere-pr32/src/lib/dynamic.ts new file mode 100644 index 00000000..0f64a86f --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/dynamic.ts @@ -0,0 +1,36 @@ +import type { AnyRoute } from "./types.js"; +import { type AnyElement, brand, type DynamicElement } from "./pipeline.js"; + +export type { ConjoinPhases, Seed } from "./pipeline.js"; +export type PhaseOf = R["phases"][0]; +export type PhasesOf = R["phases"]; + +export function dynamic< + Requirement, + E, +>( + extension: (requires: Requirement) => E, + ..._valid: E extends AnyElement ? [] : [never] +): DynamicElement> { + return brand>>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + + phases.push({ + ...phase, + resolver: extension as unknown as ( + requirement: never, + ) => (input: never) => AnyRoute, + }); + phases.push({ + params: {}, + routes: [], + values: [], + envs: [], + }); + + return { ...route, phases }; + }, + ); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/env.ts b/packages/cli/vendor/configliere-pr32/src/lib/env.ts new file mode 100644 index 00000000..3b8cc4cc --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/env.ts @@ -0,0 +1,142 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { brand, type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; + +export interface EnvSource { + readonly name: string; + readonly value: Environment; +} + +export type Environment = Readonly>; + +export interface EnvClaim { + readonly result: Maybe<{ + readonly source: string; + readonly address: readonly string[]; + readonly key: string; + readonly value: string; + }>; + readonly rest: Envs; +} + +export interface EnvClaimOptions { + readonly route: readonly string[]; + readonly address: readonly string[]; + readonly key?: string; +} + +export function env( + key: string, +): IdentityElement> { + return brand>>( + (param: Param) => ({ ...param, env: key }), + ); +} + +export function withEnvs( + envs: readonly EnvSource[], +): IdentityElement { + return brand>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + envs: phase.envs.concat(envs), + }); + return { + ...route, + phases, + }; + }, + ); +} + +export class Envs { + mounts: Map; + claims: Set; + + constructor( + mounts: Map = new Map(), + claims: Set = new Set(), + ) { + this.mounts = mounts; + this.claims = claims; + } + + mount(path: readonly string[], sources: readonly EnvSource[]): Envs { + if (sources.length === 0) { + return this; + } + let id = routeId(path); + + return new Envs( + new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), + this.claims, + ); + } + + claim( + { route, address, key = envKey([...route, ...address]) }: EnvClaimOptions, + ): EnvClaim { + let id = claimId([...route, ...address]); + let nope: EnvClaim = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + + for (let end = route.length; end >= 0; end--) { + let mount = routeId(route.slice(0, end)); + let sources = this.mounts.get(mount) ?? []; + + for (let { name, value } of sources) { + if (!Object.hasOwn(value, key) || typeof value[key] === "undefined") { + continue; + } + + let rest = new Envs(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + key, + value: value[key], + }, + }, + rest, + }; + } + } + + return nope; + } +} + +type ClaimId = string; + +function routeId(path: readonly string[]): RoutePath { + return `/${path.join("/")}`; +} + +function claimId(address: readonly string[]): ClaimId { + return JSON.stringify(address); +} + +function envKey(address: readonly string[]): string { + return address.map(normalize).filter(Boolean).join("_"); +} + +function normalize(value: string): string { + return value + .replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2") + .replace(/([a-z\d])([A-Z])/g, "$1_$2") + .replace(/[^A-Za-z\d]+/g, "_") + .replace(/^_+|_+$/g, "") + .toUpperCase(); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/extend.ts b/packages/cli/vendor/configliere-pr32/src/lib/extend.ts new file mode 100644 index 00000000..87797059 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/extend.ts @@ -0,0 +1,12 @@ +import { brand, type Extension, type Unary } from "./pipeline.js"; + +export function extend( + ...elements: E +): Extension { + return brand>((start: unknown): unknown => + elements.reduce( + (value, element) => element(value as never), + start, + ) + ); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/maybe.ts b/packages/cli/vendor/configliere-pr32/src/lib/maybe.ts new file mode 100644 index 00000000..f384e574 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/maybe.ts @@ -0,0 +1,22 @@ +export type Maybe = { + readonly exists: false; +} | { + readonly exists: true; + readonly value: T; +}; + +export function Just(): Maybe; +export function Just(value: T): Maybe; +export function Just(value?: T): Maybe { + if (typeof value === "undefined") { + return { exists: true } as Maybe; + } else { + return { exists: true, value }; + } +} + +export function Nothing(): Maybe { + return nothing as Maybe; +} + +const nothing = { exists: false }; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/option.ts b/packages/cli/vendor/configliere-pr32/src/lib/option.ts new file mode 100644 index 00000000..8c85a506 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/option.ts @@ -0,0 +1,52 @@ +import { type Param, param } from "./param.js"; +import { dasherize } from "./dasherize.js"; +import { + brand, + type Check, + type Fold, + type ParamElement, + type Unary, +} from "./pipeline.js"; +import { cli } from "./read.js"; +import type { AnyRoute, Definition } from "./types.js"; + +export function option< + const N extends string, + const E extends readonly Unary[], +>( + named: Definition, + ...elements: E & Check, E> & Valid +): ElementOf, E>> { + const added = elements.reduce( + (value, element) => element(value as never), + param(named, cli([`--${dasherize(named.name)}`])), + ) as Param; + + return brand, E>>>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + return { + ...route, + phases, + }; + }, + ); +} + +type ValueOf

= P extends Param ? T : never; + +type Valid = [ + Fold, E>, +] extends [never] ? never : unknown; + +type ElementOf = P extends Param + ? ParamElement> + : never; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/param.ts b/packages/cli/vendor/configliere-pr32/src/lib/param.ts new file mode 100644 index 00000000..5c14039e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/param.ts @@ -0,0 +1,96 @@ +import { type Decoder, scalar } from "./decode.js"; +import { + type Check, + type Fold, + mark, + type Transform, + type TransformElement, + type Unary, +} from "./pipeline.js"; +import type { CLIBinding } from "./read.js"; +import type { Definition, Schema } from "./types.js"; + +export interface Param extends Definition { + schema: Schema; + cli: CLIBinding; + decode: Decoder; + env?: string; + multiple?: boolean; +} + +export interface MultipleParam extends Param { + multiple: true; +} + +export function param< + const K extends string, + const E extends readonly Unary[], +>( + start: Definition, + ...elements: E & Check, E> +): Fold, E> { + let zero: Param = { + ...start, + schema: unknown, + cli: { + read(tokens) { + let claim = tokens.claimAll(() => false); + return { + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + claim, + }; + }, + }, + decode: scalar, + }; + + return elements.reduce( + (value, element) => element(value as never), + zero, + ) as Fold, E>; +} + +export function schema( + schema: Schema, +): TransformElement> { + return mark>((param: Param) => ({ + ...param, + schema, + })); +} + +export interface SchemaTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends MultipleParam + ? T extends (infer E)[] ? MultipleParam : never + : this["input"] extends Param ? Param + : never; +} + +interface MultipleTransform extends Transform { + readonly input: Param; + readonly output: this["input"] extends Param + ? unknown extends T ? MultipleParam + : T extends (infer E)[] ? MultipleParam + : never + : never; +} + +export function multiple(): TransformElement { + return mark((param: Param) => ({ + ...param, + multiple: true, + })); +} + +const unknown: Schema = { + "~standard": { + version: 1, + vendor: "configliere", + validate: (value) => ({ value }), + }, +}; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/parse.ts b/packages/cli/vendor/configliere-pr32/src/lib/parse.ts new file mode 100644 index 00000000..12a711b3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/parse.ts @@ -0,0 +1,544 @@ +import { bindPhase } from "./bind.js"; +import { Envs } from "./env.js"; +import type { Symbol } from "./read.js"; +import type { Rest } from "./rest.js"; +import type { Result } from "./result.js"; +import { type AnyToken, type Literal, tokenize } from "./tokenize.js"; +import { Tokenizer } from "./tokenizer.js"; +import { Values } from "./values.js"; +import type { + AnyIntent, + AnyPhase, + AnyPhases, + AnyRoute, + Input, + Issue, + Method, + ModelsByRoute, + Outcome, + Parse, + Path, + RoutePath, + UnprocessableContent, +} from "./types.js"; + +export function parse( + route: R, + input: Input, +): Parse; + +export function parse( + route: AnyRoute, + input: Input, +): unknown { + let tokenizer = new Tokenizer(tokenize(input.argv)); + let help = tokenizer.claimAll(flags("-h", "--help")); + let version = help.rest.claimAll(flags("-v", "--version")); + let escape = version.rest.claimAll((t) => t.type === "separator"); + let literals = escape.rest.claimAll((t) => t.type === "literal"); + + let method: Method = "execute"; + + if (help.tokens.length > 0) { + method = "help"; + } else if (version.tokens.length > 0) { + method = "version"; + } + + let rest: Rest = { + tokens: literals.rest as Tokenizer, + values: new Values().mount([], input.values ?? []), + envs: new Envs().mount([], input.envs ?? []), + }; + + return resume({ + segments: [{ + id: "/", + route, + phases: route.phases, + tokens: Array.from(rest.tokens), + path: [], + start: -1, + model: {}, + issues: [], + history: [], + }], + active: 0, + rest, + models: {}, + method, + literals: literals.tokens, + }); +} +function resume( + state: ParserState, +): Outcome { + while (true) { + // Starting from the deepest open segment, synchronously descend through + // routes visible on each segment's head phase. + state = search(state); + + let index = state.active; + let segment = state.segments[index]; + let [phase] = segment.phases; + + state = { + ...state, + rest: { + ...state.rest, + values: state.rest.values.mount(segment.path, phase.values), + envs: state.rest.envs.mount(segment.path, phase.envs), + }, + }; + + // Controls are free of ordinary configuration validation. A dynamic phase + // is the exception: its model is needed by the caller before the remaining + // route graph (and therefore the final control target) can be known. + if (state.method !== "execute" && !phase.resolver) { + let models = { + ...state.models, + [segment.id]: segment.model, + }; + + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + + continue; + } + + return resolve({ ...state, models }, segment); + } + + // Bind only this phase, within this segment's token view. + // + // For an open dynamic segment, binding may consume the horizon but may not + // look beyond it. For a committed segment, `end` is the hard boundary. + let binding = bindPhase({ + phase, + segment: { + range: { + start: segment.start, + end: segment.end, + }, + path: segment.path, + }, + rest: state.rest, + }); + + segment = { + ...segment, + model: { + ...segment.model, + ...binding.model, + }, + issues: [ + ...segment.issues, + ...binding.issues, + ], + }; + + state = { + ...state, + rest: binding.rest, + segments: replace(state.segments, index, segment), + }; + + if (!binding.valid) { + let issues = phase.resolver + ? binding.issues + : [...unexpected(state, segment), ...binding.issues]; + + return unprocessableContent( + state.segments[state.segments.length - 1], + issues, + ); + } + + let modeled = applyTransforms(segment); + if (!modeled.ok) { + return unprocessableContent(segment, modeled.issues); + } + + segment = { + ...segment, + model: modeled.value, + }; + + if (phase.resolver) { + // Binding the phase succeeded, but the requirement is still needed. + let suspended = state; + + return { + ok: true, + route: segment.id, + model: phase.transforms?.length ? modeled.value : binding.model, + + resume(result) { + if (!result.ok) { + return unprocessableContent(segment, result.issues); + } + + // AnyPhase erases these exact types with `never`; dynamic() already + // proved them at its public boundary. + let resolver = phase.resolver as unknown as ( + requirement: unknown, + ) => (route: AnyRoute) => AnyRoute; + + // The extension operates against the same aggregate route metadata, + // but begins with one fresh, empty phase. + let continuation = resolver(result.value)( + seed(segment.route), + ); + let phases = stitch( + continuation.phases, + segment.phases.slice(1), + ); + let history = [...segment.history, phase]; + + let next: Segment = { + ...segment, + route: { + ...continuation, + phases: [...history, ...phases] as unknown as AnyPhases, + }, + phases, + history, + issues: [ + ...segment.issues, + ...(result.issues ?? []), + ], + }; + + return resume({ + ...suspended, + segments: replace(suspended.segments, index, next), + }); + }, + }; + } + + // A phase without a resolver is the final phase of this segment. + let issues = unexpected(state, segment); + + if (issues.length > 0) { + return unprocessableContent( + state.segments[state.segments.length - 1], + issues, + ); + } + + let id = `/${segment.path.join("/")}`; + let models = { + ...state.models, + [id]: segment.model, + }; + + // There is already a synchronously matched child segment. + if (index + 1 < state.segments.length) { + state = { + ...state, + active: index + 1, + models, + }; + + continue; + } + + // The deepest selected segment is fully resolved. + return resolve({ + ...state, + models, + }, segment); + } +} + +interface ParserState { + segments: [Segment, ...Segment[]]; + active: number; + rest: Rest; + models: ModelsByRoute; + method: Method; + literals: Literal[]; +} + +interface AnyIncrement { + readonly ok: true; + readonly route: RoutePath; + readonly model: object; + resume(result: Result): Outcome; +} + +interface Segment { + id: RoutePath; + route: AnyRoute; + path: Path; + phases: AnyPhases; + tokens: Symbol[]; + start: number; + end?: number; + model: Record; + issues: Issue[]; + history: AnyPhase[]; +} + +function search(state: ParserState): ParserState { + let segments = [...state.segments] as [Segment, ...Segment[]]; + let rest = state.rest; + + while (true) { + let index = segments.length - 1; + let segment = segments[index]; + let [phase] = segment.phases; + let remaining = new Set(Array.from(rest.tokens, (token) => token.index)); + let selector = segment.tokens.find((token) => { + return remaining.has(token.index) && token.type === "word" && + phase.routes.some((route) => route.name === token.text); + }); + + if (!selector) { + return { ...state, segments, rest }; + } + + let child = phase.routes.find((route) => route.name === selector.text)!; + let path = [...segment.path, child.name]; + let before = segment.tokens.filter((token) => token.index < selector.index); + let after = segment.tokens.filter((token) => token.index > selector.index); + + segments[index] = { + ...segment, + tokens: before, + end: selector.index, + }; + segments.push({ + id: `/${path.join("/")}`, + route: child, + path, + phases: child.phases, + tokens: after, + start: selector.index, + model: {}, + issues: [], + history: [], + }); + + rest = { + ...rest, + tokens: rest.tokens.claimOne((token) => token.index === selector.index) + .rest, + }; + } +} + +function flags(...texts: string[]): (token: AnyToken) => boolean { + return (token) => token.type === "flag" && texts.includes(token.text); +} + +function stitch( + before: AnyPhases, + after: readonly AnyPhase[], +): AnyPhases { + if (after.length === 0) { + return before; + } + + let phases = [...before]; + let phase = phases.pop()!; + let [next, ...rest] = after; + + phases.push({ + ...phase, + ...next, + params: { + ...phase.params, + ...next.params, + }, + routes: [ + ...phase.routes, + ...next.routes, + ], + values: [ + ...phase.values, + ...next.values, + ], + envs: [ + ...phase.envs, + ...next.envs, + ], + }); + phases.push(...rest); + + return phases as unknown as AnyPhases; +} + +function resolve( + state: ParserState, + segment: Segment, +): Outcome { + let route = `/${segment.path.join("/")}` as RoutePath; + let definition = segment.route; + + if (!definition.methods.includes(state.method)) { + return { + ok: false, + code: "method-not-allowed", + route, + definition, + path: segment.path, + method: state.method, + allowed: definition.methods, + }; + } + + let intent = { + ok: true as const, + route, + definition, + path: segment.path, + literals: state.literals, + }; + + switch (state.method) { + case "help": + return { + ...intent, + method: "help", + }; + + case "version": + return { + ...intent, + method: "version", + }; + + case "execute": + return { + ...intent, + method: "execute", + model: state.models[route], + models: state.models, + issues: state.segments.flatMap((segment) => segment.issues), + }; + } +} + +function applyTransforms(segment: Segment): Result> { + let operations = segment.phases[0].transforms ?? []; + let model = segment.model; + + for (let op of operations) { + if (typeof op.transform === "function") { + let result = op.transform( + pick(model, op.keys), + model, + segment.phases[0].params, + ); + if (result !== undefined) { + if (!record(result)) { + return invalidTransformResult(); + } + model = result; + } + continue; + } + + let result = op.transform["~standard"].validate(model); + if (result instanceof Promise) { + return { + ok: false, + issues: [{ message: "async schemas are not allowed" }], + }; + } + if (result.issues) { + return { ok: false, issues: result.issues }; + } + if (!record(result.value)) { + return invalidTransformResult(); + } + model = result.value; + } + + if (operations.length === 0) { + return { ok: true, value: segment.model }; + } + + return { ok: true, value: model }; +} + +function invalidTransformResult(): Result> { + return { + ok: false, + issues: [{ message: "model transforms must return records" }], + }; +} + +function record(value: unknown): value is Record { + return typeof value === "object" && value !== null && !Array.isArray(value); +} + +function pick( + model: Record, + keys: readonly string[], +): Record { + let options: Record = {}; + for (let key of keys) { + if (key in model) { + options[key] = model[key]; + } + } + return options; +} + +function seed(route: AnyRoute): AnyRoute { + return { + ...route, + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; +} + +function replace( + items: readonly [T, ...T[]], + index: number, + value: T, +): [T, ...T[]] { + let result = [...items] as [T, ...T[]]; + result[index] = value; + return result; +} + +function unprocessableContent( + segment: Segment, + issues: readonly Issue[], +): UnprocessableContent { + return { + ok: false, + code: "unprocessable-content", + route: segment.id, + definition: segment.route, + path: segment.path, + issues: [...issues], + }; +} + +function unexpected( + state: ParserState, + segment: Segment, +): Issue[] { + let members = new Set( + segment.tokens.map((token) => token.index), + ); + + return Array.from(state.rest.tokens) + .filter((token) => members.has(token.index)) + .map((token) => ({ + message: `unexpected ${JSON.stringify(token.text)}`, + })); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/pipeline.ts b/packages/cli/vendor/configliere-pr32/src/lib/pipeline.ts new file mode 100644 index 00000000..f822061e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/pipeline.ts @@ -0,0 +1,608 @@ +import type { + AddField, + AddParamToLast, + AddRoutesToLast, + AnyPhase, + AnyPhases, + AnyRoute, + ChildrenOf, + Done, + Method, + MethodsOf, + ModelOf, + ModelSchema, + Next, + Phase, + Route, +} from "./types.js"; + +export type Element = { + readonly [operation]: D; +}; + +export type AnyElement = Element; + +export type Unary = (value: never) => unknown; + +export type AnyPipelineElement = Unary; + +export interface Transform { + readonly input: unknown; + readonly output: unknown; +} + +export type ApplyTransform = ( + F & { readonly input: S } +)["output"]; + +export interface TransformElement { + readonly [operation]: Custom; + + (value: S): ApplyTransform; +} + +export interface IdentityElement { + readonly [operation]: Identity; + + (value: T): T; +} + +export interface MethodElement { + readonly [operation]: AddMethod; + + < + const N extends string, + const M extends Method, + const T extends object, + const C extends readonly AnyRoute[], + const P extends AnyPhases, + >(route: Route): Route; +} + +export interface ParamElement { + readonly [operation]: AddParam; + + < + const N extends string, + const M extends Method, + const T extends object, + const C extends readonly AnyRoute[], + const P extends AnyPhases, + >(route: Route): Route< + N, + M, + AddField, + C, + AddParamToLast + >; +} + +export interface RoutesElement { + readonly [operation]: AddRoutes; + + < + const N extends string, + const M extends Method, + const T extends object, + const C extends readonly AnyRoute[], + const P extends AnyPhases, + >(route: Route): Route< + N, + M, + T, + readonly [...C, ...Added], + AddRoutesToLast + >; +} + +export interface ModelTransformElement< + F, + E extends readonly Unary[], +> { + readonly [operation]: AddModelTransform; + + < + const N extends string, + const M extends Method, + const T extends object, + const C extends readonly AnyRoute[], + const P extends AnyPhases, + >(route: Route): Apply< + Route, + AddModelTransform + >; +} + +type ModelTransformOutput = F extends + ModelSchema + ? Output extends Record ? Output : T + : F extends (options: never, model: infer Input, phase: never) => infer Output + ? T extends Input ? (Output extends Record ? Output : T) + : never + : never; + +export type Extension = + & Element> + & (E extends readonly AnyElement[] ? GenericExtension + : ConcreteExtension); + +interface GenericExtension { + readonly [operation]: Batch; + + >(value: S): Fold; +} + +interface ConcreteExtension { + ( + value: [Fold, E>] extends [never] ? never + : InputOfPipeline, + ): Fold, E>; +} + +export interface DynamicElement { + readonly [operation]: Dynamic; + + (route: R): Apply>; +} + +export type Seed = Route< + R["name"], + MethodsOf, + ModelOf, + ChildrenOf, + readonly [Phase<{}, [], never>] +>; + +export type ConjoinPhases< + A extends AnyRoute, + B extends AnyRoute, + Requirement, +> = ConcatPhases< + ContinueLast, + B["phases"] +>; + +export type Fold< + S, + E extends readonly AnyPipelineElement[], +> = number extends E["length"] ? Conservative + : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[], + ] ? true extends IsUnion ? Conservative + : Head extends AnyElement + ? S extends AnyRoute + ? DeltaOf extends StaticDelta ? TakeStatic extends readonly [ + infer Fields extends object, + infer Routes extends readonly AnyRoute[], + infer Methods extends Method, + infer Rest extends readonly AnyPipelineElement[], + ] ? Fold, Rest> + : never + : Fold>, Tail> + : Fold>, Tail> + : Head extends (value: S) => infer Output ? Fold + : never + : S; + +export type Materialize = AnyRoute extends S ? S + : S extends Route< + infer N, + infer M, + infer Model, + infer Children, + infer Phases + > ? WithExtras< + Route< + N, + M, + { [K in keyof Model]: Model[K] }, + Children, + { + [K in keyof Phases]: Phases[K] extends AnyPhase + ? MaterializePhase + : Phases[K]; + } + >, + S + > + : S; + +export type Check< + S, + E extends readonly AnyPipelineElement[], +> = number extends E["length"] ? unknown + : E extends readonly AnyElement[] + ? [Fold] extends [never] ? CheckMixed + : E + : CheckMixed; + +export function mark( + element: (value: never) => unknown, +): TransformElement { + return element as TransformElement; +} + +export function brand(element: unknown): E { + return element as E; +} + +declare const operation: unique symbol; + +type Delta = + | Identity + | AddMethod + | AddParam + | AddRoutes + | AddModelTransform + | Batch + | Dynamic + | Custom; + +type StaticDelta = + | Identity + | AddMethod + | AddParam + | AddRoutes; + +interface Identity { + readonly type: "identity"; + readonly input: S; +} + +interface AddMethod { + readonly type: "method"; + readonly method: M; +} + +interface AddParam { + readonly type: "param"; + readonly key: K; + readonly value: V; +} + +interface AddRoutes { + readonly type: "routes"; + readonly children: C; +} + +interface AddModelTransform< + F, + E extends readonly Unary[], +> { + readonly type: "model-transform"; + readonly transform: F; + readonly elements: E; +} + +interface Batch { + readonly type: "batch"; + readonly elements: E; +} + +interface Dynamic { + readonly type: "dynamic"; + readonly requirement: Requirement; + readonly element: E; +} + +interface Custom { + readonly type: "custom"; + readonly transform: F; +} + +type Apply = Delta extends D ? Conservative + : D extends Identity ? S extends Input ? S : never + : D extends AddMethod ? S extends AnyRoute ? Route< + S["name"], + MethodsOf | M, + ModelOf, + ChildrenOf, + S["phases"] + > + : never + : D extends AddParam + ? S extends AnyRoute ? WithParams + : never + : D extends AddRoutes ? S extends AnyRoute ? Route< + S["name"], + MethodsOf, + ModelOf, + readonly [...ChildrenOf, ...C], + AddRoutesToLast + > + : never + : D extends AddModelTransform + ? S extends AnyRoute + ? Fold extends infer After extends AnyRoute ? Route< + After["name"], + MethodsOf, + ModelTransformOutput>, + ChildrenOf, + TransformModelInLast< + After["phases"], + ModelTransformOutput> + > + > + : never + : never + : D extends Batch ? Fold + : D extends Dynamic + ? S extends AnyRoute + ? Apply, DeltaOf> extends infer After extends AnyRoute ? Route< + After["name"], + MethodsOf, + ModelOf, + ChildrenOf, + ConjoinPhases + > + : never + : never + : D extends Custom ? S extends F["input"] ? ApplyTransform + : never + : never; + +type DeltaOf = E[typeof operation]; + +type IsUnion = T extends unknown ? [Whole] extends [T] ? false + : true + : never; + +type Conservative = S extends AnyRoute ? AnyRoute : unknown; + +type CheckMixed< + S, + E extends readonly AnyPipelineElement[], +> = E extends readonly [] ? E + : E extends readonly [ + infer Head extends AnyPipelineElement, + ...infer Tail extends readonly AnyPipelineElement[], + ] ? [Fold] extends [never] ? readonly [never, ...Tail] + : readonly [Head, ...CheckTail, Tail>] + : never; + +type CheckTail< + S, + E extends readonly AnyPipelineElement[], +> = number extends E["length"] ? E + : E extends readonly AnyElement[] ? E + : CheckMixed; + +type InputOf = E extends AnyElement + ? InputOfDelta> + : E extends (value: infer Input) => unknown ? Input + : never; + +type InputOfPipeline = E extends + readonly [ + infer Head extends AnyPipelineElement, + ...readonly AnyPipelineElement[], + ] ? InputOf + : unknown; + +type InputOfDelta = D extends Identity ? Input + : D extends + | AddMethod + | AddParam + | AddRoutes< + readonly AnyRoute[] + > + | AddModelTransform + | Dynamic ? AnyRoute + : D extends Batch ? InputOfPipeline + : D extends Custom ? F["input"] + : never; + +type TakeStatic< + E extends readonly AnyPipelineElement[], + Fields extends readonly object[] = readonly [], + Routes extends readonly AnyRoute[] = readonly [], + Methods extends Method = never, + Count extends readonly unknown[] = readonly [], +> = Count["length"] extends 20 + ? readonly [MergeFields, Routes, Methods, E] + : E extends readonly [ + infer Head extends AnyElement, + ...infer Tail extends readonly AnyPipelineElement[], + ] ? DeltaOf extends Identity ? TakeStatic< + Tail, + Fields, + Routes, + Methods, + readonly [...Count, unknown] + > + : DeltaOf extends AddMethod ? TakeStatic< + Tail, + Fields, + Routes, + Methods | M, + readonly [...Count, unknown] + > + : DeltaOf extends AddParam ? TakeStatic< + Tail, + readonly [...Fields, { [P in K]: V }], + Routes, + Methods, + readonly [...Count, unknown] + > + : DeltaOf extends AddRoutes ? TakeStatic< + Tail, + Fields, + readonly [...Routes, ...C], + Methods, + readonly [...Count, unknown] + > + : readonly [MergeFields, Routes, Methods, E] + : readonly [MergeFields, Routes, Methods, E]; + +// Collect fields before applying them so each static chunk builds the model once. +type MergeFields = { + [K in FieldKeys]: FieldValue; +}; + +type FieldKeys = F extends readonly [ + infer Head extends object, + ...infer Tail extends readonly object[], +] ? keyof Head | FieldKeys + : never; + +type FieldValue< + F extends readonly object[], + K extends PropertyKey, +> = F extends readonly [ + ...infer Rest extends readonly object[], + infer Last extends object, +] ? K extends keyof Last ? Last[K] : FieldValue + : never; + +type WithStatic< + R extends AnyRoute, + Fields extends object, + Routes extends readonly AnyRoute[], + Methods extends Method, +> = Route< + R["name"], + MethodsOf | Methods, + keyof Fields extends never ? ModelOf : Merge, Fields>, + Routes extends readonly [] ? ChildrenOf + : readonly [...ChildrenOf, ...Routes], + AddStaticToLast +>; + +type AddStaticToLast< + P extends AnyPhases, + Fields extends object, + Routes extends readonly AnyRoute[], +> = keyof Fields extends never ? Routes extends readonly [] ? P + : AddRoutesToLast + : Routes extends readonly [] ? AddFieldsToLast + : AddRoutesToLast, Routes>; + +type WithParams = Route< + R["name"], + MethodsOf, + Merge, Fields>, + ChildrenOf, + AddFieldsToLast +>; + +type AddFieldsToLast< + P extends AnyPhases, + Fields extends object, +> = P extends readonly [infer Only extends AnyPhase] + ? readonly [AddFields] + : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase, + ] ? readonly [First, ...Middle, AddFields, Fields>] + : never; + +type TransformModelInLast< + P extends AnyPhases, + Output extends object, +> = P extends readonly [AnyPhase] ? readonly [ + TransformModelPhase, + ] + : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase, + ] ? readonly [ + First, + ...Middle, + TransformModelPhase, Output>, + ] + : never; + +type TransformModelPhase

= P extends + Next + ? Next + : P extends Done ? Done + : never; + +type AddFields

= P extends Next< + infer Model, + infer Routes, + infer Requirement +> ? Next, Routes, Requirement> + : P extends Done ? Done< + Merge, + Routes + > + : never; + +type Last

= P extends readonly [ + ...AnyPhase[], + infer Tail extends AnyPhase, +] ? Tail + : never; + +type ContinueLast< + P extends AnyPhases, + Requirement, +> = P extends readonly [infer Only extends AnyPhase] + ? readonly [WithRequirement] + : P extends readonly [ + infer Head extends AnyPhase, + ...infer Middle extends readonly AnyPhase[], + infer Tail extends AnyPhase, + ] ? readonly [ + Head, + ...Middle, + WithRequirement, + ] + : never; + +type ConcatPhases< + A extends AnyPhases, + B extends AnyPhases, +> = A extends readonly [ + infer AHead extends AnyPhase, + ...infer ATail extends AnyPhase[], +] ? B extends readonly [ + infer BHead extends AnyPhase, + ...infer BTail extends AnyPhase[], + ] ? readonly [AHead, ...ATail, BHead, ...BTail] + : never + : never; + +type WithRequirement< + P extends AnyPhase, + Requirement, +> = P extends Phase + ? Phase + : never; + +type Merge = Simplify< + Omit & B +>; + +type Simplify = { [K in keyof T]: T[K] }; + +type MaterializePhase

= P extends Next< + infer Model, + infer Routes, + infer Requirement +> ? Next< + { [K in keyof Model]: Model[K] }, + Routes, + Requirement + > + : P extends Done ? Done< + { [K in keyof Model]: Model[K] }, + Routes + > + : never; + +type RouteKeys = keyof Route< + string, + Method, + object, + readonly AnyRoute[], + AnyPhases +>; + +type WithExtras = keyof Omit extends never + ? R + : R & Omit; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/print.ts b/packages/cli/vendor/configliere-pr32/src/lib/print.ts new file mode 100644 index 00000000..7474390e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/print.ts @@ -0,0 +1,216 @@ +/** + * 😵‍💫 This file has been vibe coded 😵‍💫 + */ + +import type { Param } from "./param.js"; +import type { + AnyRoute, + Help, + Issue, + MethodNotAllowed, + RoutePath, + UnprocessableContent, + Version, +} from "./types.js"; + +export function printHelp< + const H extends Help, +>(intent: H): string { + let route = intent.definition; + let subject = title(intent); + let heading = route.version ? `${subject} ${route.version}` : subject; + let children = route.phases.flatMap((phase) => phase.routes); + let args: Row[] = []; + let options: Row[] = []; + + for (let param of params(route)) { + let syntax = param.cli.syntax; + if (!syntax) { + continue; + } + + let row: Row = [syntax.label, param.description]; + if (syntax.type === "argument") { + args.push(row); + } else { + options.push(row); + } + } + + let usage = [subject, "[OPTIONS]", ...args.map(([label]) => label)].join( + " ", + ); + + if (children.length > 0) { + usage += route.methods.includes("execute") ? " [COMMAND]" : " "; + } + + let lines = [heading]; + if (route.description) { + lines.push(...wrap(route.description, width)); + } + + lines.push("", "Usage:", ` ${usage}`); + + if (args.length > 0) { + lines.push("", "Arguments:", ...list(args)); + } + + if (children.length > 0) { + lines.push( + "", + "Commands:", + ...list(children.map((child) => [child.name, child.description])), + ); + } + + options.push(["-h, --help", "Print help"]); + if (route.methods.includes("version")) { + options.push(["-v, --version", "Print version"]); + } + + lines.push("", "Options:", ...list(options)); + + return lines.join("\n"); +} + +export function printVersion< + const V extends Version, +>(intent: V): string { + let version = intent.definition.version; + if (!version) { + throw new TypeError(`route ${JSON.stringify(intent.route)} has no version`); + } + + return `${title(intent)} ${version}`; +} + +export function printErrors( + result: MethodNotAllowed | UnprocessableContent, +): string { + let subject = title(result); + + switch (result.code) { + case "method-not-allowed": + return [ + `${subject} does not support ${result.method.toUpperCase()}`, + "", + "Available methods:", + ...result.allowed.map((method) => ` ${method.toUpperCase()}`), + ].join("\n"); + + case "unprocessable-content": { + return result.issues.map(problem).join("\n"); + } + } +} + +type Row = readonly [label: string, description?: string]; + +function params(route: AnyRoute): Param[] { + return route.phases.flatMap((phase) => + Object.values(phase.params) as Param[] + ); +} + +function title(intent: { + readonly path: readonly string[]; + readonly definition: AnyRoute; +}): string { + return intent.path.length > 0 + ? intent.path.join(" ") + : intent.definition.name; +} + +function list(rows: readonly Row[]): string[] { + let size = Math.max(...rows.map(([label]) => label.length)); + let available = Math.max(24, width - size - 4); + let lines: string[] = []; + + for (let [label, description] of rows) { + let prefix = ` ${label.padEnd(size)}`; + if (!description) { + lines.push(prefix.trimEnd()); + continue; + } + + let [first, ...rest] = wrap(description, available); + lines.push(`${prefix} ${first}`); + lines.push(...rest.map((line) => `${" ".repeat(size + 4)}${line}`)); + } + + return lines; +} + +function wrap(text: string, size: number): string[] { + let words = text.trim().split(/\s+/); + let lines: string[] = []; + let line = ""; + + for (let word of words) { + if (line.length === 0) { + line = word; + } else if (line.length + word.length + 1 <= size) { + line += ` ${word}`; + } else { + lines.push(line); + line = word; + } + } + + if (line) { + lines.push(line); + } + + return lines; +} + +function problem(issue: Issue): string { + let location = address(issue.path); + return location ? `${location}: ${issue.message}` : message(issue.message); +} + +function message(value: string): string { + if (value.startsWith("unexpected ")) { + let encoded = value.slice("unexpected ".length); + + try { + let token = JSON.parse(encoded); + if (typeof token === "string") { + return `unexpected: \`${token.replaceAll("`", "\\`")}\``; + } + } catch { + // Keep non-JSON diagnostics intact. + } + } + + return value; +} + +function address(path: Issue["path"]): string | undefined { + if (!path || path.length === 0) { + return; + } + + let result = ""; + + for (let segment of path) { + let key = typeof segment === "object" && segment !== null + ? segment.key + : segment; + + if (typeof key === "number") { + result += `[${key}]`; + } else if (typeof key === "symbol") { + result += `[${String(key)}]`; + } else if (/^[A-Za-z_$][\w$]*$/.test(key)) { + result += result ? `.${key}` : key; + } else { + result += `[${JSON.stringify(key)}]`; + } + } + + return result; +} + +const width = 80; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/read.ts b/packages/cli/vendor/configliere-pr32/src/lib/read.ts new file mode 100644 index 00000000..1f193fc2 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/read.ts @@ -0,0 +1,167 @@ +import type { Maybe } from "./maybe.js"; +import type { Param } from "./param.js"; +import { brand, type IdentityElement } from "./pipeline.js"; +import type { Result } from "./result.js"; +import type { Flag, Setter, Word } from "./tokenize.js"; +import type { Claim, TokenInput } from "./tokenizer.js"; + +export type Symbol = Flag | Setter | Word; + +export type ReadCLI = ( + tokens: TokenInput, + multiple?: boolean, +) => CLIRead; + +export interface CLIBinding { + readonly read: ReadCLI; + readonly syntax?: CLISyntax; +} + +export type CLISyntax = + | { readonly type: "argument"; readonly label: string } + | { readonly type: "option"; readonly label: string }; + +export interface CLIRead { + result: Result>; + claim: Claim; +} + +export interface CLIOptions { + switch?: true; +} + +export function cli( + names: readonly string[], + options: CLIOptions = {}, +): IdentityElement> { + const readOne: ReadCLI = (tokens) => { + let [match] = matches(tokens); + return match ? result(tokens, match) : nothing(tokens); + }; + + const readMany: ReadCLI = (tokens) => { + let found = matches(tokens); + if (found.length === 0) { + return nothing(tokens); + } + + let claimed = new Set(found.flatMap((match) => match.indices)); + let issues = found.flatMap((match) => + "issue" in match ? [match.issue] : [] + ); + return { + claim: tokens.claimAll((token) => claimed.has(token.index)), + result: issues.length > 0 ? { ok: false, issues } : { + ok: true, + value: { + exists: true, + value: found.map((match) => + "value" in match ? match.value : undefined + ), + }, + issues: [], + }, + }; + }; + + function matches(tokens: TokenInput): OptionMatch[] { + let visible = Array.from(tokens); + let found: OptionMatch[] = []; + + for (let index = 0; index < visible.length; index++) { + let token = visible[index]; + + if ( + !options.switch && token.type === "setter" && + names.includes(`--${token.nameText}`) + ) { + found.push({ indices: [token.index], value: token.valueText }); + continue; + } + + if (token.type !== "flag" || !names.includes(token.text)) { + continue; + } + + if (options.switch) { + found.push({ indices: [token.index], value: true }); + continue; + } + + let value = visible[index + 1]; + if (value?.type === "word" && value.index === token.index + 1) { + found.push({ + indices: [token.index, value.index], + value: value.text, + }); + index++; + } else { + found.push({ + indices: [token.index], + issue: { message: `${token.text} requires a value` }, + }); + } + } + + return found; + } + + const read: ReadCLI = (tokens, multiple = false) => { + return multiple ? readMany(tokens) : readOne(tokens); + }; + + return brand>>( + (param: Param) => ({ + ...param, + cli: { + read, + syntax: { + type: "option", + label: options.switch + ? names.join(", ") + : `${names.join(", ")} `, + }, + }, + }), + ); +} + +type OptionMatch = { + indices: number[]; + value: string | boolean; +} | { + indices: number[]; + issue: { message: string }; +}; + +function result( + tokens: TokenInput, + match: OptionMatch, +): CLIRead { + let claim = tokens.claimAll((token) => match.indices.includes(token.index)); + if ("issue" in match) { + return { claim, result: { ok: false, issues: [match.issue] } }; + } + + return { + claim, + result: { + ok: true, + value: { exists: true, value: match.value }, + issues: [], + }, + }; +} + +function nothing(tokenizer: TokenInput): CLIRead { + let claim = tokenizer.claimAll(() => false); + + return { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/rest.ts b/packages/cli/vendor/configliere-pr32/src/lib/rest.ts new file mode 100644 index 00000000..5a2fa56d --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/rest.ts @@ -0,0 +1,10 @@ +import type { Envs } from "./env.js"; +import type { Symbol } from "./read.js"; +import type { Tokenizer } from "./tokenizer.js"; +import type { Values } from "./values.js"; + +export interface Rest { + readonly tokens: Tokenizer; + readonly values: Values; + readonly envs: Envs; +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/result.ts b/packages/cli/vendor/configliere-pr32/src/lib/result.ts new file mode 100644 index 00000000..befb9d6e --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/result.ts @@ -0,0 +1,10 @@ +import type { Issue } from "./types.js"; + +export type Result = { + ok: true; + value: T; + issues?: readonly Issue[]; +} | { + ok: false; + issues: readonly Issue[]; +}; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/route.ts b/packages/cli/vendor/configliere-pr32/src/lib/route.ts new file mode 100644 index 00000000..17db3675 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/route.ts @@ -0,0 +1,148 @@ +// deno-lint-ignore-file ban-types +import { + brand, + type Check, + type Fold, + type Materialize, + type MethodElement, + type ModelTransformElement, + type RoutesElement, + type Unary, +} from "./pipeline.js"; +import type { + AnyRoute, + Definition, + Done, + ModelOf, + ModelParams, + ModelSchema, + ModelTransform, + Route, +} from "./types.js"; + +export type RouteZero = Route< + N, + "help", + {}, + [], + [Done<{}, []>] +>; + +export function route< + const N extends string, + const E extends readonly Unary[], +>( + start: Definition, + ...elements: E & Check, E> +): Materialize, E>> { + let zero: RouteZero = { + ...start, + methods: ["help"], + phases: [{ + params: {}, + routes: [], + values: [], + envs: [], + }], + }; + + return elements.reduce( + (value, element) => element(value as never), + zero, + ) as Materialize, E>>; +} + +export function version(semver: string): MethodElement<"version"> { + return brand>((route: AnyRoute) => ({ + ...route, + methods: [...route.methods, "version"] as const, + version: semver, + })); +} + +export function executable(): MethodElement<"execute"> { + return brand>((route: AnyRoute) => ({ + ...route, + methods: [...route.methods, "execute"] as const, + })); +} + +export function routes( + ...children: C +): RoutesElement { + return brand>((route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + routes: [...phase.routes, ...children], + }); + + return { + ...route, + phases, + }; + }); +} + +export function transform< + const T extends object, + const E extends readonly Unary[], +>( + transform: ModelSchema, + ...elements: E & Check +): ModelTransformElement, E>; +export function transform< + const E extends readonly Unary[], + const F extends (( + options: ModelOf>, + model: never, + phase: ModelParams, + ) => Record | void), +>( + transform: F, + ...elements: E & Check +): ModelTransformElement; +export function transform( + transform: ModelTransform, + ...elements: readonly Unary[] +): ModelTransformElement { + return brand>( + (route: AnyRoute) => { + let before = params(route); + let next = apply(route, elements); + let nextParams = params(next); + let added = keys(next).filter((key) => before[key] !== nextParams[key]); + + let phases = [...next.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + transforms: [ + ...(phase.transforms ?? []), + { transform, keys: added }, + ], + }); + + return { + ...next, + phases, + }; + }, + ); +} + +function apply(route: AnyRoute, elements: readonly Unary[]): AnyRoute { + return elements.reduce( + (value, element) => element(value as never), + route, + ) as AnyRoute; +} + +function params(route: AnyRoute): ModelParams { + return route.phases[route.phases.length - 1].params; +} + +function keys(route: AnyRoute): string[] { + return Object.keys(params(route)); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/toggle.ts b/packages/cli/vendor/configliere-pr32/src/lib/toggle.ts new file mode 100644 index 00000000..da553bf2 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/toggle.ts @@ -0,0 +1,119 @@ +import { boolean as decode } from "./decode.js"; +import { dasherize } from "./dasherize.js"; +import { type Param, param, schema } from "./param.js"; +import { + brand, + type Check, + type Fold, + type ParamElement, + type Unary, +} from "./pipeline.js"; +import type { CLIRead, ReadCLI } from "./read.js"; +import type { Flag } from "./tokenize.js"; +import type { AnyRoute, Definition, Schema } from "./types.js"; + +export function toggle< + const N extends string, + const E extends readonly Unary[], +>( + named: Definition, + ...elements: E & Check, E> +): ElementOf, E>> { + const added = elements.reduce( + (value, element) => element(value as never), + { + ...param(named, binding(named.name), schema(bool)), + decode, + }, + ) as Param; + + return brand, E>>>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + params: { + ...phase.params, + [added.name]: added, + }, + }); + + return { + ...route, + phases, + }; + }, + ); +} + +type ValueOf

= P extends Param ? T : never; + +type ElementOf = P extends Param + ? ParamElement> + : never; + +function binding( + name: string, +):

>(param: P) => P { + const stem = dasherize(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + + return (param) => ({ + ...param, + cli: { + read: reader(name), + syntax: { + type: "option", + label: `${yes}, ${no}`, + }, + }, + }); +} + +function reader(name: string): ReadCLI { + const stem = dasherize(name); + const yes = `--${stem}`; + const no = `--no-${stem}`; + + return (tokens): CLIRead => { + let claim = tokens.claimOne((token): token is Flag => { + return token.type === "flag" && + (token.text === yes || token.text === no); + }); + let [flag] = claim.tokens; + + return flag + ? { + claim, + result: { + ok: true, + value: { exists: true, value: flag.text === yes }, + issues: [], + }, + } + : { + claim, + result: { + ok: true, + value: { exists: false }, + issues: [], + }, + }; + }; +} + +const bool: Schema = { + "~standard": { + version: 1, + vendor: "configliere", + validate(value) { + return typeof value === "undefined" + ? { value: false } + : typeof value === "boolean" + ? { value } + : { issues: [{ message: "expected boolean" }] }; + }, + }, +}; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/tokenize.ts b/packages/cli/vendor/configliere-pr32/src/lib/tokenize.ts new file mode 100644 index 00000000..31b457c9 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/tokenize.ts @@ -0,0 +1,74 @@ +export interface Token { + type: T; + index: number; + text: string; +} +export type AnyToken = + | Word + | Flag + | Setter + | Separator + | Literal; + +export interface Setter extends Token<"setter"> { + nameText: string; + valueText: string; +} + +export interface Flag extends Token<"flag"> { + flagText: string; + flagType: "short" | "long"; +} + +export type Word = Token<"word">; + +export interface Separator extends Token<"separator"> { + readonly text: "--"; +} + +export type Literal = Token<"literal">; + +export function tokenize(argv: string[]): readonly AnyToken[] { + let quote = false; + let tokens: AnyToken[] = []; + + for (let i = 0; i < argv.length; i++) { + let index = i; + let text = argv[i]; + if (quote) { + tokens.push({ type: "literal", index, text }); + continue; + } + if (text === "--") { + tokens.push({ type: "separator", index, text }); + quote = true; + continue; + } + let matchSetter = setterMatch.exec(text); + if (matchSetter?.groups) { + let { nameText, valueText } = matchSetter.groups; + tokens.push({ type: "setter", index, text, nameText, valueText }); + continue; + } + let matchFlag = flagMatch.exec(text); + if (matchFlag?.groups) { + let { prefix, flagText } = matchFlag.groups; + tokens.push({ + type: "flag", + index, + text, + flagText, + flagType: prefix === "-" ? "short" : "long", + }); + continue; + } + tokens.push({ type: "word", index, text }); + } + return tokens; +} + +// deno-lint-ignore no-invalid-regexp +const flagMatch = /^(?--?)(?[^-=\s][^=\s]*)$/; + +// deno-lint-ignore no-invalid-regexp +const setterMatch = /^--(?[^-=\s][^=\s]*)=(?[\s\S]*)$/; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/tokenizer.ts b/packages/cli/vendor/configliere-pr32/src/lib/tokenizer.ts new file mode 100644 index 00000000..f503d54b --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/tokenizer.ts @@ -0,0 +1,191 @@ +import type { AnyToken } from "./tokenize.js"; + +export interface TokenInput extends Iterable { + claimNext(): Claim; + + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + + claimPair(match: (a: T, b: T) => boolean): Claim; + + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; +} + +export interface TokenRange { + readonly start: number; + readonly end?: number; +} + +export interface ViewOptions { + readonly range: TokenRange; + readonly through?: number; +} + +export class Tokenizer implements TokenInput { + readonly tokens: readonly T[]; + readonly claimed: ReadonlySet; + + constructor( + tokens: readonly T[], + claimed: ReadonlySet = new Set(), + ) { + this.tokens = tokens; + this.claimed = new Set(claimed); + } + + claimNext(): Claim { + return this.claimOne(() => true); + } + + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimOne(match: (token: T) => boolean): Claim { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this, [token.index]), + }; + } + } + return { tokens: [], rest: this }; + } + + claimPair(match: (a: T, b: T) => boolean): Claim { + let previous: T | undefined; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this }; + } + + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; + claimAll(match: (token: T) => boolean): Claim { + let tokens: T[] = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this, claimed) : this, + }; + } + + view(options: ViewOptions): TokenInput { + return new View(this, options); + } + + *[Symbol.iterator](): Generator { + for (let token of this.tokens) { + if (!this.claimed.has(token.index)) { + yield token; + } + } + } +} + +export interface Claim { + tokens: T[]; + rest: Tokenizer; +} + +class View implements TokenInput { + constructor( + readonly source: Tokenizer, + readonly options: ViewOptions, + ) {} + + claimNext(): Claim { + return this.claimOne(() => true); + } + + claimOne(match: (token: T) => token is S): Claim; + claimOne(match: (token: T) => boolean): Claim; + claimOne(match: (token: T) => boolean): Claim { + for (let token of this) { + if (match(token)) { + return { + tokens: [token], + rest: remainder(this.source, [token.index]), + }; + } + } + return { tokens: [], rest: this.source }; + } + + claimPair(match: (a: T, b: T) => boolean): Claim { + let previous: T | undefined; + for (let token of this) { + if (!previous) { + previous = token; + continue; + } + if (token.index === previous.index + 1 && match(previous, token)) { + return { + tokens: [previous, token], + rest: remainder(this.source, [previous.index, token.index]), + }; + } + previous = token; + } + return { tokens: [], rest: this.source }; + } + + claimAll(match: (token: T) => token is S): Claim; + claimAll(match: (token: T) => boolean): Claim; + claimAll(match: (token: T) => boolean): Claim { + let tokens: T[] = []; + let claimed = new Set(); + for (let token of this) { + if (match(token)) { + claimed.add(token.index); + tokens.push(token); + } + } + return { + tokens, + rest: tokens.length > 0 ? remainder(this.source, claimed) : this.source, + }; + } + + *[Symbol.iterator](): Generator { + let { start, end } = this.options.range; + let { through } = this.options; + + for (let token of this.source) { + if ( + token.index > start && + (end === undefined || token.index < end) && + (through === undefined || token.index <= through) + ) { + yield token; + } + } + } +} + +function remainder( + source: Tokenizer, + claimed: Iterable, +): Tokenizer { + return new Tokenizer( + source.tokens, + new Set([...source.claimed, ...claimed]), + ); +} diff --git a/packages/cli/vendor/configliere-pr32/src/lib/types.ts b/packages/cli/vendor/configliere-pr32/src/lib/types.ts new file mode 100644 index 00000000..94856652 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/types.ts @@ -0,0 +1,436 @@ +import type { StandardSchemaV1 } from "@standard-schema/spec"; +import type { EnvSource } from "./env.js"; +import type { Literal } from "./tokenize.js"; +import type { Param } from "./param.js"; +import type { Result } from "./result.js"; +import type { ValueSource } from "./values.js"; + +export type Issue = StandardSchemaV1.Issue; +export type Schema = StandardSchemaV1; +export type ModelSchema = StandardSchemaV1; +export type ModelParams = Params>; +export type ModelTransformFunction = ( + options: Record, + model: Record, + phase: ModelParams, +) => Record | void; +export type ModelTransform = + | ModelSchema + | ModelTransformFunction; +export interface ModelOperation { + readonly transform: ModelTransform; + readonly keys: readonly string[]; +} + +export interface Definition { + readonly name: N; + readonly description?: string; +} + +export interface Route< + N extends string, + M extends Method, + T extends object, + C extends readonly AnyRoute[], + P extends AnyPhases, +> extends Definition { + readonly methods: readonly M[]; + readonly version?: string; + readonly phases: P; + readonly model?: T; + readonly children?: C; +} + +export type Parse = Outcome>; + +export type Phase< + Model extends object, + Routes extends readonly AnyRoute[], + Requirement = never, +> = [Requirement] extends [never] ? Done + : Next; + +export type Next< + Model extends object, + Routes extends readonly AnyRoute[], + T, +> = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver: ( + requirement: T, + ) => (input: AnyRoute) => AnyRoute; +}; + +export type Done< + Model extends object, + Routes extends readonly AnyRoute[], +> = { + readonly params: Params; + readonly routes: Routes; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; +}; + +export type Params = { + [K in keyof Model]: K extends string ? Param : never; +}; + +export interface ParseIncrement< + R extends AnyRoute, + P extends RoutePath = "/", + Models extends ModelsByRoute = {}, +> { + readonly ok: true; + readonly route: P; + readonly model: IncrementModelOf; + + resume( + result: Result>, + ): Outcome, P, Models>>; +} + +export type ContinuationOf = R extends Route< + string, + Method, + object, + readonly AnyRoute[], + readonly [ + AnyPhase, + infer Next extends AnyPhase, + ...infer Tail extends AnyPhase[], + ] +> ? Route< + R["name"], + R["methods"][number], + ModelOf, + ChildrenOf, + readonly [Next, ...Tail] + > + : never; + +export type ModelOf = R extends Route< + string, + Method, + infer T, + readonly AnyRoute[], + readonly [AnyPhase, ...readonly AnyPhase[]] +> ? T + : never; + +export type ChildrenOf = R extends + Route ? Children + : never; + +export type RequirementsOf = RequirementsIn; + +export type RequirementOf = RequirementIn; + +export interface AnyRoute extends Definition { + readonly methods: readonly Method[]; + readonly version?: string; + readonly phases: AnyPhases; +} + +export interface AnyPhase { + readonly params: ModelParams; + readonly routes: readonly AnyRoute[]; + readonly values: readonly ValueSource[]; + readonly envs: readonly EnvSource[]; + readonly transforms?: readonly ModelOperation[]; + readonly resolver?: (requirement: never) => (route: never) => AnyRoute; +} + +export type AnyPhases = readonly [AnyPhase, ...AnyPhase[]]; + +export type Method = "help" | "version" | "execute"; +export type MethodsOf = R["methods"][number]; + +export type Path = readonly string[]; + +export type Input = { + argv: string[]; + values?: readonly ValueSource[]; + envs?: readonly EnvSource[]; +}; + +export interface Failure { + readonly ok: false; + readonly code: C; +} + +export type Outcome = T | MethodNotAllowed | UnprocessableContent; + +export type IntentsOf = IntentsAt; + +export type RoutePath = `/${string}`; + +export type ModelsByRoute = { + readonly [path: RoutePath]: object; +}; + +export type PathOf = R extends "/" ? [] + : R extends `/${infer Rest}` ? Split + : never; + +export type AnyIntent = + | Help + | Version + | Execute; + +export type ChildIntents< + C extends readonly AnyRoute[], + P extends RoutePath, + Models extends ModelsByRoute, +> = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[], +] ? ( + | IntentsAt, Models> + | ChildIntents + ) + : never; + +export interface Intent< + M extends Method, + P extends RoutePath, +> { + readonly ok: true; + readonly method: M; + readonly route: P; + readonly definition: AnyRoute; + readonly path: PathOf

; + readonly literals: Iterable; +} + +export type Help

= Intent< + "help", + P +>; + +export type Version

= Intent< + "version", + P +>; + +export interface Execute< + P extends RoutePath, + Models extends ModelsByRoute, +> extends Intent<"execute", P> { + readonly issues: readonly Issue[]; + readonly model: Models[P]; + readonly models: Models; +} + +export type Status = + | "method-not-allowed" + | "unprocessable-content"; + +export interface MethodNotAllowed extends Failure<"method-not-allowed"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly method: Method; + readonly allowed: readonly Method[]; +} + +export interface UnprocessableContent extends Failure<"unprocessable-content"> { + readonly route: string; + readonly definition: AnyRoute; + readonly path: Path; + readonly issues: Issue[]; +} + +type RequirementIn

= P extends { + readonly resolver: ( + requirement: infer Requirement, + ) => (route: AnyRoute) => AnyRoute; +} ? Requirement + : never; + +type IncrementModelOf = R["phases"][0] extends Next< + infer Model, + readonly AnyRoute[], + infer Requirement +> ? Model + : never; + +type ParseAt< + R extends AnyRoute, + P extends RoutePath, + Models extends ModelsByRoute, +> = [RequirementOf] extends [never] ? ( + | Help

+ | ( + "version" extends MethodsOf ? Version

+ : never + ) + | ( + "execute" extends MethodsOf ? AddModel< + Models, + P, + ModelOf + > extends infer Bound extends ModelsByRoute ? Execute< + P, + { [K in keyof Bound]: Bound[K] } + > + : never + : never + ) + | ParseChildren< + ChildrenOf, + P, + AddModel> + > + ) + : ParseIncrement; + +type ParseChildren< + C extends readonly AnyRoute[], + P extends RoutePath, + Models extends ModelsByRoute, +> = C extends readonly [ + infer Head extends AnyRoute, + ...infer Tail extends readonly AnyRoute[], +] ? ( + | ParseAt, Models> + | ParseChildren + ) + : never; + +type RequirementsIn

= P extends readonly [ + infer Head extends AnyPhase, + ...infer Tail extends AnyPhase[], +] ? [RequirementIn] extends [never] ? readonly [] + : readonly [RequirementIn, ...RequirementsIn] + : readonly []; + +type AddModel< + Models extends ModelsByRoute, + P extends RoutePath, + T extends object, +> = { + [K in keyof Models | P]: K extends P ? T + : K extends keyof Models ? Models[K] + : never; +}; + +type Split = string extends S ? Path + : S extends `${infer Head}/${infer Tail}` ? [Head, ...Split] + : S extends "" ? [] + : [S]; + +type Append< + A extends RoutePath, + N extends string, +> = A extends "/" ? `/${N}` + : `${A}/${N}`; + +type AddParam< + P extends AnyPhase, + K extends string, + V, +> = P extends Next< + infer Model, + infer Routes, + infer Requirement +> ? Next< + AddField, + Routes, + Requirement + > + : P extends Done ? Done< + AddField, + Routes + > + : never; + +export type AddParamToLast< + P extends AnyPhases, + K extends string, + V, +> = ReplaceLast< + P, + AddParam, K, V> +>; + +export type AddRoutesToLast< + P extends AnyPhases, + C extends readonly AnyRoute[], +> = ReplaceLast< + P, + AddRoutes, C> +>; + +type LastOf

= P extends readonly [ + ...AnyPhase[], + infer Last extends AnyPhase, +] ? Last + : never; + +type ReplaceLast< + P extends AnyPhases, + Last extends AnyPhase, +> = P extends readonly [AnyPhase] ? readonly [Last] + : P extends readonly [ + infer First extends AnyPhase, + ...infer Middle extends AnyPhase[], + AnyPhase, + ] ? readonly [First, ...Middle, Last] + : never; + +type AddRoutes< + Phase extends AnyPhase, + Added extends readonly AnyRoute[], +> = Phase extends Next< + infer Model, + infer Routes, + infer Requirement +> ? Next< + Model, + readonly [...Routes, ...Added], + Requirement + > + : Phase extends Done ? Done< + Model, + readonly [...Routes, ...Added] + > + : never; + +export type AddField = Simplify< + Omit & { [P in K]: V } +>; + +type Simplify = { [P in keyof T]: T[P] }; + +type IntentsAt< + R extends AnyRoute, + P extends RoutePath, + Models extends ModelsByRoute, +> = + | Help

+ | ( + "version" extends MethodsOf ? Version

+ : never + ) + | ( + "execute" extends MethodsOf ? AddModel< + Models, + P, + ModelOf + > extends infer Bound extends ModelsByRoute ? Execute< + P, + { [K in keyof Bound]: Bound[K] } + > + : never + : never + ) + | ChildIntents< + ChildrenOf, + P, + AddModel> + >; diff --git a/packages/cli/vendor/configliere-pr32/src/lib/values.ts b/packages/cli/vendor/configliere-pr32/src/lib/values.ts new file mode 100644 index 00000000..55d28fa3 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/lib/values.ts @@ -0,0 +1,131 @@ +import type { Maybe } from "./maybe.js"; +import { brand, type IdentityElement } from "./pipeline.js"; +import type { AnyRoute, RoutePath } from "./types.js"; + +export type ValueSource = { + name: string; + value: unknown; +}; + +export function withValues( + values: readonly ValueSource[], +): IdentityElement { + return brand>( + (route: AnyRoute) => { + let phases = [...route.phases]; + let phase = phases.pop()!; + phases.push({ + ...phase, + values: phase.values.concat(values), + }); + return { + ...route, + phases, + }; + }, + ); +} + +export type ValueClaim = { + result: Maybe<{ + source: string; + address: readonly string[]; + value: unknown; + }>; + rest: Values; +}; + +export class Values { + mounts: Map; + claims: Set; + + constructor( + mounts: Map = new Map(), + claims: Set = new Set(), + ) { + this.mounts = mounts; + this.claims = claims; + } + + mount(path: readonly string[], sources: readonly ValueSource[]): Values { + if (sources.length === 0) { + return this; + } + const id = routeId(path); + + return new Values( + new Map([...this.mounts.entries(), [ + id, + (this.mounts.get(id) ?? []).concat(sources), + ]]), + this.claims, + ); + } + + claim({ route, address }: ClaimOptions): ValueClaim { + let id = claimId([...route, ...address]); + const nope: ValueClaim = { result: { exists: false }, rest: this }; + if (this.claims.has(id)) { + return nope; + } + + for (let end = route.length; end >= 0; end--) { + let mountId = routeId(route.slice(0, end)); + let sources = this.mounts.get(mountId) ?? []; + for (let { name, value } of sources) { + let result = find(value, [...route.slice(end), ...address]); + if (result.exists) { + let rest = new Values(this.mounts, new Set([...this.claims, id])); + return { + result: { + exists: true, + value: { + source: name, + address, + value: result.value, + }, + }, + rest, + }; + } + } + } + return nope; + } +} + +export interface ClaimOptions { + route: readonly string[]; + address: readonly string[]; +} + +type ClaimId = string; + +function routeId(address: readonly string[]): RoutePath { + return `/${address.join("/")}`; +} + +function claimId(address: readonly string[]): ClaimId { + return JSON.stringify(address); +} + +function find(value: unknown, path: readonly string[]): Maybe { + let current: unknown = value; + + for (let key of path) { + if ( + current === null || + (typeof current !== "object" && typeof current !== "function") || + !Object.hasOwn(current, key) + ) { + return { exists: false }; + } + + current = (current as Record)[key]; + } + + return { + exists: true, + value: current, + }; +} diff --git a/packages/cli/vendor/configliere-pr32/src/mod.ts b/packages/cli/vendor/configliere-pr32/src/mod.ts new file mode 100644 index 00000000..9985a181 --- /dev/null +++ b/packages/cli/vendor/configliere-pr32/src/mod.ts @@ -0,0 +1,78 @@ +import "./_dnt.polyfills.js"; +export { argument } from "./lib/argument.js"; + +export { extend } from "./lib/extend.js"; +export { command } from "./lib/command.js"; +export type { CommandZero } from "./lib/command.js"; + +export { checkpoint } from "./lib/checkpoint.js"; +export { dynamic } from "./lib/dynamic.js"; + +export { description, name } from "./lib/definition.js"; + +export { env, withEnvs } from "./lib/env.js"; +export type { Environment, EnvSource } from "./lib/env.js"; + +export { option } from "./lib/option.js"; + +export { multiple, param, schema } from "./lib/param.js"; +export type { Param } from "./lib/param.js"; + +export { parse } from "./lib/parse.js"; + +export { mark } from "./lib/pipeline.js"; +export type { + ModelTransformElement, + Transform, + TransformElement, +} from "./lib/pipeline.js"; + +export { printErrors, printHelp, printVersion } from "./lib/print.js"; + +export type { Rest } from "./lib/rest.js"; + +export { cli } from "./lib/read.js"; +export type { + CLIOptions, + CLIRead, + ReadCLI, + Symbol as CLISymbol, +} from "./lib/read.js"; + +export { executable, route, routes, transform, version } from "./lib/route.js"; +export type { RouteZero } from "./lib/route.js"; + +export { toggle } from "./lib/toggle.js"; + +export { withValues } from "./lib/values.js"; +export type { ValueSource } from "./lib/values.js"; + +export type { Literal } from "./lib/tokenize.js"; +export type { Result } from "./lib/result.js"; + +export type { + AnyIntent, + AnyRoute, + Definition, + Execute, + Help, + Input, + Intent, + IntentsOf, + Issue, + Method, + MethodNotAllowed, + MethodsOf, + ModelOf, + ModelParams, + ModelsByRoute, + ModelSchema, + Outcome, + Path, + PathOf, + Route, + RoutePath, + Schema, + UnprocessableContent, + Version, +} from "./lib/types.js"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ea97ff7..d07d5f66 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -190,8 +190,8 @@ importers: specifier: ^1.0.0 version: 1.1.0 configliere: - specifier: ^0.4.0 - version: 0.4.0 + specifier: https://pkg.pr.new/configliere@32 + version: https://pkg.pr.new/configliere@32 effection: specifier: 4.1.0 version: 4.1.0 @@ -1915,8 +1915,9 @@ packages: resolution: {integrity: sha512-z67u4ZhzCL/Tydu1lJARtEZYWbWaN7oYLHbsuzocr6y4N6WZAagG3RQ4FW61V1/0+jImpj293XfrcYnd1qxtPg==} engines: {node: '>=22.12.0'} - configliere@0.4.0: - resolution: {integrity: sha512-4bxK3+L+FHr9Xm/d69Syvvpvkj7lj7a4zz3B+tchuohg5WKeudyBS+4Oob5Zdgoh8I7+n2lj0lfa8I6cUXfcEg==} + configliere@https://pkg.pr.new/configliere@32: + resolution: {tarball: https://pkg.pr.new/configliere@32} + version: 0.4.0-pr engines: {node: '>= 16'} cross-spawn@7.0.6: @@ -3716,7 +3717,7 @@ snapshots: commander@15.0.0: {} - configliere@0.4.0: + configliere@https://pkg.pr.new/configliere@32: dependencies: '@standard-schema/spec': 1.1.0