t3code-cli 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +87 -1
- package/dist/application.d.ts +2 -0
- package/dist/application.js +1 -1
- package/dist/auth.d.ts +50 -0
- package/dist/auth.js +1 -1
- package/dist/bin.d.ts +1 -0
- package/dist/bin.js +348 -603
- package/dist/cli.d.ts +66 -0
- package/dist/cli.js +1 -1
- package/dist/client-runtime/authorization.d.ts +2 -0
- package/dist/client-runtime/authorization.js +2 -0
- package/dist/client-runtime/connection.d.ts +2 -0
- package/dist/client-runtime/connection.js +2 -0
- package/dist/client-runtime/environment.d.ts +57 -0
- package/dist/client-runtime/environment.js +2 -0
- package/dist/client-runtime/errors.d.ts +28 -0
- package/dist/client-runtime/errors.js +35 -0
- package/dist/client-runtime/operations/projects.d.ts +2 -0
- package/dist/client-runtime/operations/projects.js +2 -0
- package/dist/client-runtime/operations.d.ts +2 -0
- package/dist/client-runtime/operations.js +2 -0
- package/dist/client-runtime/platform.d.ts +26 -0
- package/dist/client-runtime/platform.js +74 -0
- package/dist/client-runtime/relay.d.ts +121 -0
- package/dist/client-runtime/relay.js +245 -0
- package/dist/client-runtime/rpc.d.ts +2 -0
- package/dist/client-runtime/rpc.js +2 -0
- package/dist/client-runtime/state/assets.d.ts +40 -0
- package/dist/client-runtime/state/assets.js +53 -0
- package/dist/client-runtime/state/auth.d.ts +98 -0
- package/dist/client-runtime/state/auth.js +48 -0
- package/dist/client-runtime/state/connections.d.ts +2 -0
- package/dist/client-runtime/state/connections.js +52 -0
- package/dist/client-runtime/state/entities.d.ts +33 -0
- package/dist/client-runtime/state/entities.js +2 -0
- package/dist/client-runtime/state/filesystem.d.ts +42 -0
- package/dist/client-runtime/state/filesystem.js +48 -0
- package/dist/client-runtime/state/git.d.ts +43 -0
- package/dist/client-runtime/state/git.js +18 -0
- package/dist/client-runtime/state/models.d.ts +2 -0
- package/dist/client-runtime/state/models.js +2 -0
- package/dist/client-runtime/state/orchestration.d.ts +128 -0
- package/dist/client-runtime/state/orchestration.js +20 -0
- package/dist/client-runtime/state/presentation.d.ts +277 -0
- package/dist/client-runtime/state/presentation.js +34 -0
- package/dist/client-runtime/state/preview.d.ts +447 -0
- package/dist/client-runtime/state/preview.js +103 -0
- package/dist/client-runtime/state/project-grouping.d.ts +26 -0
- package/dist/client-runtime/state/project-grouping.js +73 -0
- package/dist/client-runtime/state/projects.d.ts +192 -0
- package/dist/client-runtime/state/projects.js +2 -0
- package/dist/client-runtime/state/relay.d.ts +10 -0
- package/dist/client-runtime/state/relay.js +19 -0
- package/dist/client-runtime/state/review.d.ts +28 -0
- package/dist/client-runtime/state/review.js +11 -0
- package/dist/client-runtime/state/runtime.d.ts +2 -0
- package/dist/client-runtime/state/runtime.js +2 -0
- package/dist/client-runtime/state/server.d.ts +1495 -0
- package/dist/client-runtime/state/server.js +207 -0
- package/dist/client-runtime/state/session.d.ts +532 -0
- package/dist/client-runtime/state/session.js +21 -0
- package/dist/client-runtime/state/shell.d.ts +529 -0
- package/dist/client-runtime/state/shell.js +2 -0
- package/dist/client-runtime/state/source-control.d.ts +92 -0
- package/dist/client-runtime/state/source-control.js +36 -0
- package/dist/client-runtime/state/terminal.d.ts +237 -0
- package/dist/client-runtime/state/terminal.js +173 -0
- package/dist/client-runtime/state/thread-settled.d.ts +104 -0
- package/dist/client-runtime/state/thread-settled.js +157 -0
- package/dist/client-runtime/state/thread-sort.d.ts +23 -0
- package/dist/client-runtime/state/thread-sort.js +47 -0
- package/dist/client-runtime/state/threads.d.ts +538 -0
- package/dist/client-runtime/state/threads.js +934 -0
- package/dist/client-runtime/state/vcs.d.ts +442 -0
- package/dist/client-runtime/state/vcs.js +756 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.js +1 -1
- package/dist/connection.d.ts +7 -0
- package/dist/connection.js +1 -1
- package/dist/contracts.d.ts +2 -0
- package/dist/contracts.js +2 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -1
- package/dist/node.d.ts +6 -0
- package/dist/node.js +1 -1
- package/dist/orchestration.d.ts +1420 -0
- package/dist/orchestration.js +1 -1
- package/dist/preview.d.ts +2 -0
- package/dist/preview.js +2 -0
- package/dist/rpc.d.ts +6043 -0
- package/dist/rpc.js +1 -1
- package/dist/runtime.d.ts +2 -0
- package/dist/runtime.js +2 -2
- package/dist/shared/DrainableWorker.d.ts +28 -0
- package/dist/shared/DrainableWorker.js +24 -0
- package/dist/shared/KeyedCoalescingWorker.d.ts +13 -0
- package/dist/shared/KeyedCoalescingWorker.js +89 -0
- package/dist/shared/Net.d.ts +43 -0
- package/dist/shared/Net.js +126 -0
- package/dist/shared/String.d.ts +4 -0
- package/dist/shared/String.js +8 -0
- package/dist/shared/Struct.d.ts +5 -0
- package/dist/shared/Struct.js +2 -0
- package/dist/shared/advertisedEndpoint.d.ts +2 -0
- package/dist/shared/advertisedEndpoint.js +2 -0
- package/dist/shared/agentAwareness.d.ts +27 -0
- package/dist/shared/agentAwareness.js +54 -0
- package/dist/shared/backgroundActivitySettings.d.ts +23 -0
- package/dist/shared/backgroundActivitySettings.js +2 -0
- package/dist/shared/chatList.d.ts +12 -0
- package/dist/shared/chatList.js +14 -0
- package/dist/shared/cliArgs.d.ts +33 -0
- package/dist/shared/cliArgs.js +103 -0
- package/dist/shared/composerInlineTokens.d.ts +20 -0
- package/dist/shared/composerInlineTokens.js +72 -0
- package/dist/shared/composerTrigger.d.ts +26 -0
- package/dist/shared/composerTrigger.js +97 -0
- package/dist/shared/connectAuth.d.ts +58 -0
- package/dist/shared/connectAuth.js +89 -0
- package/dist/shared/devHome.d.ts +21 -0
- package/dist/shared/devHome.js +65 -0
- package/dist/shared/devProxy.d.ts +15 -0
- package/dist/shared/devProxy.js +22 -0
- package/dist/shared/dpop.d.ts +32 -0
- package/dist/shared/dpop.js +2724 -0
- package/dist/shared/dpopCommon.d.ts +2 -0
- package/dist/shared/dpopCommon.js +2 -0
- package/dist/shared/filePreview.d.ts +8 -0
- package/dist/shared/filePreview.js +31 -0
- package/dist/shared/git.d.ts +41 -0
- package/dist/shared/git.js +2 -0
- package/dist/shared/hostProcess.d.ts +13 -0
- package/dist/shared/hostProcess.js +2 -0
- package/dist/shared/httpObservability.d.ts +5 -0
- package/dist/shared/httpObservability.js +2 -0
- package/dist/shared/httpReadiness.d.ts +38 -0
- package/dist/shared/httpReadiness.js +110 -0
- package/dist/shared/keybindings.d.ts +35 -0
- package/dist/shared/keybindings.js +330 -0
- package/dist/shared/logging.d.ts +39 -0
- package/dist/shared/logging.js +2 -0
- package/dist/shared/model.d.ts +44 -0
- package/dist/shared/model.js +2 -0
- package/dist/shared/oauthScope.d.ts +23 -0
- package/dist/shared/oauthScope.js +2 -0
- package/dist/shared/observability.d.ts +105 -0
- package/dist/shared/observability.js +346 -0
- package/dist/shared/orchestrationTiming.d.ts +16 -0
- package/dist/shared/orchestrationTiming.js +32 -0
- package/dist/shared/path.d.ts +2 -0
- package/dist/shared/path.js +2 -0
- package/dist/shared/preview.d.ts +35 -0
- package/dist/shared/preview.js +103 -0
- package/dist/shared/previewViewport.d.ts +16 -0
- package/dist/shared/previewViewport.js +159 -0
- package/dist/shared/projectFavicon.d.ts +5 -0
- package/dist/shared/projectFavicon.js +13 -0
- package/dist/shared/projectScripts.d.ts +19 -0
- package/dist/shared/projectScripts.js +18 -0
- package/dist/shared/qrCode.d.ts +87 -0
- package/dist/shared/qrCode.js +870 -0
- package/dist/shared/relayAuth.d.ts +27 -0
- package/dist/shared/relayAuth.js +83 -0
- package/dist/shared/relayClient.d.ts +58 -0
- package/dist/shared/relayClient.js +245 -0
- package/dist/shared/relayJwt.d.ts +39 -0
- package/dist/shared/relayJwt.js +2 -0
- package/dist/shared/relaySigning.d.ts +4 -0
- package/dist/shared/relaySigning.js +2 -0
- package/dist/shared/relayTracing.d.ts +25 -0
- package/dist/shared/relayTracing.js +2 -0
- package/dist/shared/relayUrl.d.ts +5 -0
- package/dist/shared/relayUrl.js +2 -0
- package/dist/shared/remote.d.ts +57 -0
- package/dist/shared/remote.js +2 -0
- package/dist/shared/schemaJson.d.ts +35 -0
- package/dist/shared/schemaJson.js +2 -0
- package/dist/shared/schemaYaml.d.ts +86 -0
- package/dist/shared/schemaYaml.js +99 -0
- package/dist/shared/searchRanking.d.ts +30 -0
- package/dist/shared/searchRanking.js +99 -0
- package/dist/shared/semver.d.ts +23 -0
- package/dist/shared/semver.js +124 -0
- package/dist/shared/serverSettings.d.ts +19 -0
- package/dist/shared/serverSettings.js +103 -0
- package/dist/shared/shell.d.ts +51 -0
- package/dist/shared/shell.js +408 -0
- package/dist/shared/sourceControl.d.ts +26 -0
- package/dist/shared/sourceControl.js +2 -0
- package/dist/shared/t3ProjectFile.d.ts +27 -0
- package/dist/shared/t3ProjectFile.js +25 -0
- package/dist/shared/terminalLabels.d.ts +16 -0
- package/dist/shared/terminalLabels.js +28 -0
- package/dist/shared/toolActivity.d.ts +16 -0
- package/dist/shared/toolActivity.js +159 -0
- package/dist/shared.d.ts +43036 -0
- package/dist/shared.js +25428 -12277
- package/dist/t3tools.d.ts +2 -0
- package/dist/t3tools.js +1 -1
- package/package.json +39 -21
- package/src/auth/index.ts +2 -0
- package/src/auth/pairing.ts +8 -5
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +4 -0
- package/src/auth/type.ts +6 -0
- package/src/cli/auth.ts +7 -1
- package/src/contracts/index.ts +8 -0
- package/src/orchestration/layer.ts +36 -0
- package/src/orchestration/service.ts +5 -0
- package/src/preview/index.ts +11 -0
- package/src/preview/service.ts +52 -0
- package/src/rpc/error.ts +2 -0
- package/src/rpc/layer.ts +5 -4
- package/src/rpc/operation.ts +5 -4
- package/src/rpc/ws-group.ts +6 -0
- package/src/runtime/index.ts +1 -0
- package/src/runtime/layer.ts +5 -0
- package/src/sql/node-sqlite-client.ts +3 -0
- package/dist/src/application/actions.d.ts +0 -25
- package/dist/src/application/error.d.ts +0 -3
- package/dist/src/application/index.d.ts +0 -4
- package/dist/src/application/layer.d.ts +0 -117
- package/dist/src/application/model-selection.d.ts +0 -34
- package/dist/src/application/models.d.ts +0 -8
- package/dist/src/application/project-commands.d.ts +0 -44
- package/dist/src/application/projects.d.ts +0 -23
- package/dist/src/application/service.d.ts +0 -243
- package/dist/src/application/shell-sequence.d.ts +0 -96
- package/dist/src/application/terminals.d.ts +0 -66
- package/dist/src/application/thread-commands.d.ts +0 -157
- package/dist/src/application/thread-update.d.ts +0 -8
- package/dist/src/application/thread-wait.d.ts +0 -106
- package/dist/src/application/threads.d.ts +0 -660
- package/dist/src/auth/error.d.ts +0 -50
- package/dist/src/auth/index.d.ts +0 -10
- package/dist/src/auth/layer.d.ts +0 -53
- package/dist/src/auth/local-base-dir.d.ts +0 -8
- package/dist/src/auth/local-origin.d.ts +0 -18
- package/dist/src/auth/local-token.d.ts +0 -26
- package/dist/src/auth/local.d.ts +0 -24
- package/dist/src/auth/pairing.d.ts +0 -22
- package/dist/src/auth/remote-error.d.ts +0 -3
- package/dist/src/auth/schema.d.ts +0 -58
- package/dist/src/auth/service.d.ts +0 -27
- package/dist/src/auth/transport.d.ts +0 -22
- package/dist/src/auth/type.d.ts +0 -83
- package/dist/src/cli/env/flag.d.ts +0 -2
- package/dist/src/cli/env/index.d.ts +0 -2
- package/dist/src/cli/env/selection-layer.d.ts +0 -3
- package/dist/src/cli/flags.d.ts +0 -20
- package/dist/src/cli/format/index.d.ts +0 -1
- package/dist/src/cli/format/output.d.ts +0 -12
- package/dist/src/cli/index.d.ts +0 -5
- package/dist/src/cli/runtime/index.d.ts +0 -1
- package/dist/src/cli/runtime/service.d.ts +0 -16
- package/dist/src/cli/scope/index.d.ts +0 -1
- package/dist/src/cli/scope/resolve.d.ts +0 -20
- package/dist/src/cli-path/layer.d.ts +0 -3
- package/dist/src/cli-path/service.d.ts +0 -8
- package/dist/src/config/config.d.ts +0 -49
- package/dist/src/config/credential/cipher-node.d.ts +0 -3
- package/dist/src/config/credential/cipher-web.d.ts +0 -3
- package/dist/src/config/credential/cipher.d.ts +0 -29
- package/dist/src/config/credential/env.d.ts +0 -3
- package/dist/src/config/credential/error.d.ts +0 -8
- package/dist/src/config/credential/index.d.ts +0 -6
- package/dist/src/config/credential/service.d.ts +0 -34
- package/dist/src/config/env/env.d.ts +0 -55
- package/dist/src/config/env/index.d.ts +0 -2
- package/dist/src/config/env/layout.d.ts +0 -11
- package/dist/src/config/environment-name/index.d.ts +0 -1
- package/dist/src/config/environment-name/name.d.ts +0 -10
- package/dist/src/config/error.d.ts +0 -11
- package/dist/src/config/index.d.ts +0 -10
- package/dist/src/config/keystore/error.d.ts +0 -8
- package/dist/src/config/keystore/file.d.ts +0 -9
- package/dist/src/config/keystore/index.d.ts +0 -4
- package/dist/src/config/keystore/keyring-node.d.ts +0 -4
- package/dist/src/config/keystore/service.d.ts +0 -33
- package/dist/src/config/paths/index.d.ts +0 -1
- package/dist/src/config/paths/paths.d.ts +0 -6
- package/dist/src/config/persist/file-mode.d.ts +0 -4
- package/dist/src/config/persist/migration.d.ts +0 -68
- package/dist/src/config/persist/persist.d.ts +0 -40
- package/dist/src/config/persist/schema.d.ts +0 -68
- package/dist/src/config/resolve/resolve.d.ts +0 -40
- package/dist/src/config/selection/index.d.ts +0 -1
- package/dist/src/config/selection/resolve.d.ts +0 -4
- package/dist/src/config/selection/service.d.ts +0 -10
- package/dist/src/config/types.d.ts +0 -36
- package/dist/src/config/url/error.d.ts +0 -10
- package/dist/src/config/url/index.d.ts +0 -2
- package/dist/src/config/url/url.d.ts +0 -6
- package/dist/src/connection/error.d.ts +0 -10
- package/dist/src/connection/index.d.ts +0 -4
- package/dist/src/connection/layer.d.ts +0 -3
- package/dist/src/connection/prepared.d.ts +0 -14
- package/dist/src/connection/service.d.ts +0 -13
- package/dist/src/connection/type.d.ts +0 -10
- package/dist/src/contracts/index.d.ts +0 -1
- package/dist/src/domain/error.d.ts +0 -57
- package/dist/src/domain/helpers.d.ts +0 -179
- package/dist/src/domain/model-config.d.ts +0 -330
- package/dist/src/domain/thread-activities.d.ts +0 -14
- package/dist/src/domain/thread-lifecycle.d.ts +0 -120
- package/dist/src/index.d.ts +0 -3
- package/dist/src/node/connection.d.ts +0 -2
- package/dist/src/node/index.d.ts +0 -1
- package/dist/src/orchestration/index.d.ts +0 -2
- package/dist/src/orchestration/layer.d.ts +0 -1419
- package/dist/src/orchestration/service.d.ts +0 -28
- package/dist/src/rpc/error.d.ts +0 -16
- package/dist/src/rpc/index.d.ts +0 -6
- package/dist/src/rpc/layer.d.ts +0 -5862
- package/dist/src/rpc/operation.d.ts +0 -24
- package/dist/src/rpc/service.d.ts +0 -15
- package/dist/src/rpc/session.d.ts +0 -22
- package/dist/src/rpc/ws-group.d.ts +0 -1984
- package/dist/src/runtime/index.d.ts +0 -1
- package/dist/src/runtime/layer.d.ts +0 -15
- package/dist/src/sql/node-sqlite-client.d.ts +0 -10
- package/dist/src/sql/service.d.ts +0 -17
- package/dist/src/t3tools/index.d.ts +0 -1
package/dist/bin.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { a as __toESM, i as __require, t as __commonJSMin } from "./rolldown-runtime.js";
|
|
3
|
-
import { $
|
|
3
|
+
import { $D as flatMap, $E as runDrain, $O as mergeAll, $T as Struct, $k as hasProperty, $w as extractSingleParams, AE as Size, AO as tapError, AT as isTrueValue, Ak as empty$1, BD as andThen, BE as filter, Bk as isSome, Bw as toImpl, CC as T3Config, CD as BadArgument, CE as make$6, CO as scoped, CT as magenta, Ck as isSuccess, DE as FileDescriptor, DO as suspend, DT as getTypeName, EE as TypeId$2, EO as succeed, ET as getChoiceKeys, Es as layerNode$1, Ew as T3Application, FD as value$2, FT as UnrecognizedOption, Fk as getOrElse, Fn as BaseAppLayer, Fw as getGlobalFlagsForCommandTree, GE as isStream, Gw as optional$2, HD as as, HT as isQuitError, Hk as match, Hw as boolean, ID as makeRunMain, IT as isCliError, Iw as getHelpForCommandPath, JD as catchTags, Jw as withDescription$1, KD as catchFilter, KE as map$1, Kw as string$2, LD as acquireRelease, LE as decodeText, LO as uninterruptible, Lw as TypeId$3, ME as make$8, MO as timeoutOrElse, MT as InvalidValue, Mk as flatMap$1, Mw as LogLevel, NE as callback$1, NO as tryPromise, NT as ShowHelp, Nb as ProviderUserInputAnswers, Nk as fromNullishOr, Ns as latestAssistantMessage, Nw as Wizard, OE as FileSystem, OO as sync, OT as isBoolean, Ok as Reference, PO as try_, PT as UnknownSubcommand, Pk as fromUndefinedOr, Ps as threadStatus, Pw as getGlobalFlagsForCommandPath, QD as fail, QE as run$2, QO as effect, QT as String$1, Qw as argumentKind, RD as addFinalizer, RO as void_, Rk as getOrUndefined, Rw as checkForDuplicateFlags, SC as layer$12, SD as unbounded, SE as ProcessId, SO as runFork, ST as green, Sk as isResult, Sw as resolveOutputFormat, TD as systemError, TE as Path$1, TT as white, UD as asVoid, UE as fromIterable, UT as make$11, Uk as none, Uw as choice, VT as Terminal, Vw as parseConfig, WD as callback, WE as fromQueue, Wk as some, Ww as integer$1, XD as effectify, Xw as error, YD as catch_, YE as merge, Yw as Formatter, Zw as log, _C as resolveThreadId, _D as make$10, _E as fdName, _T as toggle, aA as isUndefined, aD as succeed$5, aO as gen, aT as mapEffect$1, ak as _await, aw as formatFlag, bC as ThreadSessionError, bD as shutdown, bE as ChildProcessSpawner, bO as provideService, bT as bold, bw as isAgentEnvironment, cA as pipe, cD as transduce, cT as variadic$1, ck as make$13, cw as projectPathFlag, dD as make$9, dE as optionalKey, dO as mapError, dT as float, dw as threadFlag, eA as isNotNull, eD as runFold, eE as TaggedErrorClass, eO as fn, ek as provide, fC as CliPath, fD as drain, fO as match$1, fT as integer, fk as succeed$1, fw as threadFormatFlag, gD as failCauseUnsafe, gE as fromWritable, gO as orDie, gT as text, gw as canRenderLiveTerminal, hC as resolveCommandProjectRef, hD as endUnsafe, hE as fromReadable, hT as select, hw as yesFlag, iE as decodeUnknownEffect, iO as forkScoped, iT as isParam, ik as MinimumLogLevel, iw as forceFlag, jE as WatchBackend, jk as make$12, js as layer$13, jw as BuiltIns, kE as FileTypeId, kT as isFalseValue, kk as Service, ks as layerNode, lA as pipeArguments, lD as unwrap, lT as confirm, lk as makeUnsafe, lw as replaceFlag, mC as T3Auth, mE as make$7, mT as run$3, mw as worktreeFlag, nA as isNullish, nD as runHead, nO as forEach, nT as getUnderlyingSingleOrThrow, nk as succeed$2, oA as dual, oE as decodeUnknownSync, oO as ignore, oT as optional$1, ok as doneUnsafe, ow as modelFlags, pC as cliEnvironmentSetting, pD as isSink, pE as Crypto, pO as matchEffect, pT as password, pw as waitFormatFlag, qD as catchTag, qO as fail$1, qT as Literal, qw as withDefault, rD as runLast, rT as isFlagParam, rk as sync$1, rw as envNameFlag, sA as identity$1, sD as tap, sE as fromJsonString, sO as interrupt, sT as string$1, sk as isDone, sw as projectFlag, tA as isNotUndefined, tD as runForEach, tO as fnUntraced, tT as getParamMetadata, tk as provideMerge, uD as get$1, uO as map, uT as date, uk as succeed$4, uw as selfActionForceFlag, vC as resolveWorktreePath, vD as offer, vE as make$5, vO as provide$1, vT as annotate, wD as badArgument, wE as makeHandle, wO as serviceOption, wT as red, wk as succeed$3, ww as loadT3CliEnv, xC as CliRuntime, xE as ExitCode, xO as result$1, xT as cyanBright, xw as isInteractiveHumanTerminal, yC as ProjectLookupError, yD as offerUnsafe, yE as parseFdName, yO as provideContext, yT as blackBright, yk as fail$2, zE as empty, zk as isNone, zw as makeCommand } from "./shared.js";
|
|
4
4
|
import * as OS from "node:os";
|
|
5
5
|
import os, { homedir } from "node:os";
|
|
6
6
|
import * as NodeChildProcess from "node:child_process";
|
|
7
|
+
import { PassThrough } from "node:stream";
|
|
7
8
|
import * as NodeCrypto from "node:crypto";
|
|
8
9
|
import * as NFS from "node:fs";
|
|
9
10
|
import * as Path from "node:path";
|
|
@@ -13,35 +14,14 @@ import * as readline from "node:readline";
|
|
|
13
14
|
import process$1 from "node:process";
|
|
14
15
|
import tty from "node:tty";
|
|
15
16
|
//#endregion
|
|
16
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
17
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodeRuntime.js
|
|
17
18
|
/**
|
|
18
|
-
* Node.js process runner for
|
|
19
|
-
* edge.
|
|
19
|
+
* Node.js process runner for Effect programs.
|
|
20
20
|
*
|
|
21
|
-
* This module
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
* **Mental model**
|
|
27
|
-
*
|
|
28
|
-
* `runMain` is the last call in `main.ts`: build the effect, provide the layers
|
|
29
|
-
* it needs, then hand the self-contained program to this module. The function
|
|
30
|
-
* does not provide Node services itself; use `NodeServices.layer` or narrower
|
|
31
|
-
* platform layers before launching.
|
|
32
|
-
*
|
|
33
|
-
* **Common tasks**
|
|
34
|
-
*
|
|
35
|
-
* - Run a CLI command or script and let failures become process failures.
|
|
36
|
-
* - Keep a server or worker fiber alive as the process main program.
|
|
37
|
-
* - Override teardown or disable automatic error reporting at the boundary.
|
|
38
|
-
*
|
|
39
|
-
* **Gotchas**
|
|
40
|
-
*
|
|
41
|
-
* `SIGINT` and `SIGTERM` interrupt the main fiber so scoped finalizers can run.
|
|
42
|
-
* Clean success lets the event loop drain naturally, while signal-triggered
|
|
43
|
-
* interruption or a non-zero teardown code exits the process. Keep long-lived
|
|
44
|
-
* resources in Effect scopes and avoid finalizers that never complete.
|
|
21
|
+
* This module exports `runMain`, which runs one Effect as the main process
|
|
22
|
+
* fiber in Node.js. It reuses the shared Node runtime runner, including its
|
|
23
|
+
* error reporting, `SIGINT` / `SIGTERM` interruption, and optional teardown
|
|
24
|
+
* behavior.
|
|
45
25
|
*
|
|
46
26
|
* @since 4.0.0
|
|
47
27
|
*/
|
|
@@ -86,326 +66,7 @@ const runMain = /* @__PURE__ */ makeRunMain(({ fiber, teardown }) => {
|
|
|
86
66
|
process.on("SIGTERM", onSigint);
|
|
87
67
|
});
|
|
88
68
|
//#endregion
|
|
89
|
-
//#region node_modules/.pnpm
|
|
90
|
-
/**
|
|
91
|
-
* Service contract and helpers for running child processes through Effect.
|
|
92
|
-
*
|
|
93
|
-
* This module defines the {@link ChildProcessSpawner} service used by child
|
|
94
|
-
* process commands to start operating-system processes. A spawner turns a
|
|
95
|
-
* command description into a {@link ChildProcessHandle}, which exposes scoped
|
|
96
|
-
* lifecycle operations: write to stdin, stream stdout and stderr, wait for the
|
|
97
|
-
* exit code, kill the process, inspect whether it is still running, and
|
|
98
|
-
* temporarily unreference it from the parent process.
|
|
99
|
-
*
|
|
100
|
-
* Use this module when implementing a platform-specific process backend or
|
|
101
|
-
* when code needs direct access to the process service. Most applications build
|
|
102
|
-
* commands with the `ChildProcess` module; this service is the lower-level
|
|
103
|
-
* execution boundary and also provides convenience methods for collecting exit
|
|
104
|
-
* codes, strings, and output lines. The {@link make} constructor derives those
|
|
105
|
-
* helpers from one primitive `spawn` implementation, so adapters only need to
|
|
106
|
-
* supply process creation.
|
|
107
|
-
*
|
|
108
|
-
* @since 4.0.0
|
|
109
|
-
*/
|
|
110
|
-
/**
|
|
111
|
-
* Constructs branded child process `ExitCode` values.
|
|
112
|
-
*
|
|
113
|
-
* @category constructors
|
|
114
|
-
* @since 4.0.0
|
|
115
|
-
*/
|
|
116
|
-
const ExitCode = /*#__PURE__*/ nominal();
|
|
117
|
-
/**
|
|
118
|
-
* Constructs branded child process `ProcessId` values.
|
|
119
|
-
*
|
|
120
|
-
* @category constructors
|
|
121
|
-
* @since 4.0.0
|
|
122
|
-
*/
|
|
123
|
-
const ProcessId = /*#__PURE__*/ nominal();
|
|
124
|
-
const HandleTypeId = "~effect/ChildProcessSpawner/ChildProcessHandle";
|
|
125
|
-
const HandleProto = {
|
|
126
|
-
[HandleTypeId]: HandleTypeId,
|
|
127
|
-
...BaseProto,
|
|
128
|
-
toJSON() {
|
|
129
|
-
return {
|
|
130
|
-
_id: "ChildProcessHandle",
|
|
131
|
-
pid: this.pid
|
|
132
|
-
};
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Constructs a new `ChildProcessHandle`.
|
|
137
|
-
*
|
|
138
|
-
* @category constructors
|
|
139
|
-
* @since 4.0.0
|
|
140
|
-
*/
|
|
141
|
-
const makeHandle = (params) => Object.assign(Object.create(HandleProto), params);
|
|
142
|
-
/**
|
|
143
|
-
* Creates a `ChildProcessSpawner` service from a `spawn` function, deriving
|
|
144
|
-
* helpers for exit codes and output collection from that implementation.
|
|
145
|
-
*
|
|
146
|
-
* @category models
|
|
147
|
-
* @since 4.0.0
|
|
148
|
-
*/
|
|
149
|
-
const make$6 = (spawn) => {
|
|
150
|
-
const streamString = (command, options) => spawn(command).pipe(map((handle) => decodeText(options?.includeStderr === true ? handle.all : handle.stdout)), unwrap);
|
|
151
|
-
const streamLines = (command, options) => splitLines(streamString(command, options));
|
|
152
|
-
return ChildProcessSpawner.of({
|
|
153
|
-
spawn,
|
|
154
|
-
exitCode: (command) => scoped(flatMap(spawn(command), (handle) => handle.exitCode)),
|
|
155
|
-
streamString,
|
|
156
|
-
streamLines,
|
|
157
|
-
lines: (command, options) => runCollect(streamLines(command, options)),
|
|
158
|
-
string: (command, options) => mkString(streamString(command, options))
|
|
159
|
-
});
|
|
160
|
-
};
|
|
161
|
-
/**
|
|
162
|
-
* Service tag for child process spawning.
|
|
163
|
-
*
|
|
164
|
-
* @category services
|
|
165
|
-
* @since 4.0.0
|
|
166
|
-
*/
|
|
167
|
-
var ChildProcessSpawner = class extends Service()("effect/process/ChildProcessSpawner") {};
|
|
168
|
-
//#endregion
|
|
169
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/process/ChildProcess.js
|
|
170
|
-
/**
|
|
171
|
-
* An Effect-native module for working with child processes.
|
|
172
|
-
*
|
|
173
|
-
* This module uses an AST-based approach where commands are built first
|
|
174
|
-
* using `make` and `pipeTo`, then executed using `spawn`.
|
|
175
|
-
*
|
|
176
|
-
* **Example** (Spawning and piping commands)
|
|
177
|
-
*
|
|
178
|
-
* ```ts
|
|
179
|
-
* import { Effect, Stream } from "effect"
|
|
180
|
-
* import { NodeServices } from "@effect/platform-node"
|
|
181
|
-
* import { ChildProcess } from "effect/unstable/process"
|
|
182
|
-
*
|
|
183
|
-
* // Build a command
|
|
184
|
-
* const command = ChildProcess.make`echo "hello world"`
|
|
185
|
-
*
|
|
186
|
-
* // Spawn and collect output
|
|
187
|
-
* const program = Effect.gen(function*() {
|
|
188
|
-
* // You can `yield*` a command, which calls `ChildProcess.spawn`
|
|
189
|
-
* const handle = yield* command
|
|
190
|
-
* const chunks = yield* Stream.runCollect(handle.stdout)
|
|
191
|
-
* const exitCode = yield* handle.exitCode
|
|
192
|
-
* return { chunks, exitCode }
|
|
193
|
-
* }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))
|
|
194
|
-
*
|
|
195
|
-
* // With options
|
|
196
|
-
* const withOptions = ChildProcess.make({ cwd: "/tmp" })`ls -la`
|
|
197
|
-
*
|
|
198
|
-
* // Piping commands
|
|
199
|
-
* const pipeline = ChildProcess.make`cat package.json`.pipe(
|
|
200
|
-
* ChildProcess.pipeTo(ChildProcess.make`grep name`)
|
|
201
|
-
* )
|
|
202
|
-
*
|
|
203
|
-
* // Spawn the pipeline
|
|
204
|
-
* const pipelineProgram = Effect.gen(function*() {
|
|
205
|
-
* const handle = yield* pipeline
|
|
206
|
-
* const chunks = yield* Stream.runCollect(handle.stdout)
|
|
207
|
-
* return chunks
|
|
208
|
-
* }).pipe(Effect.scoped, Effect.provide(NodeServices.layer))
|
|
209
|
-
* ```
|
|
210
|
-
*
|
|
211
|
-
* @since 4.0.0
|
|
212
|
-
*/
|
|
213
|
-
const TypeId$2 = "~effect/unstable/process/ChildProcess";
|
|
214
|
-
const Proto = {
|
|
215
|
-
.../*#__PURE__*/ Prototype({
|
|
216
|
-
label: "Command",
|
|
217
|
-
evaluate(fiber) {
|
|
218
|
-
return getUnsafe(fiber.context, ChildProcessSpawner).spawn(this);
|
|
219
|
-
}
|
|
220
|
-
}),
|
|
221
|
-
[TypeId$2]: TypeId$2
|
|
222
|
-
};
|
|
223
|
-
const makeStandardCommand = (command, args, options) => Object.assign(Object.create(Proto), {
|
|
224
|
-
_tag: "StandardCommand",
|
|
225
|
-
command,
|
|
226
|
-
args,
|
|
227
|
-
options
|
|
228
|
-
});
|
|
229
|
-
/**
|
|
230
|
-
* Create a command from a template literal, options + template, or array form.
|
|
231
|
-
*
|
|
232
|
-
* **Details**
|
|
233
|
-
*
|
|
234
|
-
* This function supports three calling conventions:
|
|
235
|
-
* 1. Template literal: `make\`npm run build\``
|
|
236
|
-
* 2. Options + template literal: `make({ cwd: "/app" })\`npm run build\``
|
|
237
|
-
* 3. Array form: `make("npm", ["run", "build"], options?)`
|
|
238
|
-
*
|
|
239
|
-
* Template literals are not parsed until execution time, allowing parsing
|
|
240
|
-
* errors to flow through Effect's error channel.
|
|
241
|
-
*
|
|
242
|
-
* **Example** (Creating commands)
|
|
243
|
-
*
|
|
244
|
-
* ```ts
|
|
245
|
-
* import { ChildProcess } from "effect/unstable/process"
|
|
246
|
-
*
|
|
247
|
-
* // Template literal form
|
|
248
|
-
* const cmd1 = ChildProcess.make`echo "hello"`
|
|
249
|
-
*
|
|
250
|
-
* // With options
|
|
251
|
-
* const cmd2 = ChildProcess.make({ cwd: "/tmp" })`ls -la`
|
|
252
|
-
*
|
|
253
|
-
* // Array form
|
|
254
|
-
* const cmd3 = ChildProcess.make("git", ["status"])
|
|
255
|
-
* ```
|
|
256
|
-
*
|
|
257
|
-
* @category constructors
|
|
258
|
-
* @since 4.0.0
|
|
259
|
-
*/
|
|
260
|
-
const make$5 = function make(...args) {
|
|
261
|
-
if (isTemplateString(args[0])) {
|
|
262
|
-
const [templates, ...expressions] = args;
|
|
263
|
-
const tokens = parseTemplates(templates, expressions);
|
|
264
|
-
return makeStandardCommand(tokens[0] ?? "", tokens.slice(1), {});
|
|
265
|
-
}
|
|
266
|
-
if (typeof args[0] === "object" && !Array.isArray(args[0]) && !isTemplateString(args[0])) {
|
|
267
|
-
const options = args[0];
|
|
268
|
-
return function(templates, ...expressions) {
|
|
269
|
-
const tokens = parseTemplates(templates, expressions);
|
|
270
|
-
return makeStandardCommand(tokens[0] ?? "", tokens.slice(1), options);
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
if (typeof args[0] === "string" && !Array.isArray(args[1])) {
|
|
274
|
-
const [command, options = {}] = args;
|
|
275
|
-
return makeStandardCommand(command, [], options);
|
|
276
|
-
}
|
|
277
|
-
const [command, cmdArgs = [], options = {}] = args;
|
|
278
|
-
return makeStandardCommand(command, cmdArgs, options);
|
|
279
|
-
};
|
|
280
|
-
const isTemplateString = (u) => Array.isArray(u) && "raw" in u && Array.isArray(u.raw);
|
|
281
|
-
/**
|
|
282
|
-
* Parses an fd name like "fd3" to its numeric index.
|
|
283
|
-
* Returns undefined if the name is invalid.
|
|
284
|
-
*
|
|
285
|
-
* @category converting
|
|
286
|
-
* @since 4.0.0
|
|
287
|
-
*/
|
|
288
|
-
const parseFdName = (name) => {
|
|
289
|
-
const match = /^fd(\d+)$/.exec(name);
|
|
290
|
-
if (match === null) return void 0;
|
|
291
|
-
const fd = parseInt(match[1], 10);
|
|
292
|
-
return fd >= 3 ? fd : void 0;
|
|
293
|
-
};
|
|
294
|
-
/**
|
|
295
|
-
* Create an fd name from its numeric index.
|
|
296
|
-
*
|
|
297
|
-
* @category converting
|
|
298
|
-
* @since 4.0.0
|
|
299
|
-
*/
|
|
300
|
-
const fdName = (fd) => `fd${fd}`;
|
|
301
|
-
const parseTemplates = (templates, expressions) => {
|
|
302
|
-
let tokens = [];
|
|
303
|
-
for (const [index, template] of templates.entries()) tokens = parseTemplate(templates, expressions, tokens, template, index);
|
|
304
|
-
return tokens;
|
|
305
|
-
};
|
|
306
|
-
const parseTemplate = (templates, expressions, prevTokens, template, index) => {
|
|
307
|
-
const rawTemplate = templates.raw[index];
|
|
308
|
-
if (rawTemplate === void 0) throw new Error(`Invalid backslash sequence: ${templates.raw[index]}`);
|
|
309
|
-
const { hasLeadingWhitespace, hasTrailingWhitespace, tokens } = splitByWhitespaces(template, rawTemplate);
|
|
310
|
-
const nextTokens = concatTokens(prevTokens, tokens, hasLeadingWhitespace);
|
|
311
|
-
if (index === expressions.length) return nextTokens;
|
|
312
|
-
const expression = expressions[index];
|
|
313
|
-
const expressionTokens = Array.isArray(expression) ? expression.map((expression) => parseExpression(expression)) : [parseExpression(expression)];
|
|
314
|
-
return concatTokens(nextTokens, expressionTokens, hasTrailingWhitespace);
|
|
315
|
-
};
|
|
316
|
-
/**
|
|
317
|
-
* Convert valid expressions defined in a template string command (i.e. using
|
|
318
|
-
* `${expression}` into strings.
|
|
319
|
-
*/
|
|
320
|
-
const parseExpression = (expression) => {
|
|
321
|
-
if (typeof expression === "string") return expression;
|
|
322
|
-
return String(expression);
|
|
323
|
-
};
|
|
324
|
-
const DELIMITERS = /*#__PURE__*/ new Set([
|
|
325
|
-
" ",
|
|
326
|
-
" ",
|
|
327
|
-
"\r",
|
|
328
|
-
"\n"
|
|
329
|
-
]);
|
|
330
|
-
/**
|
|
331
|
-
* Number of characters in backslash escape sequences: \0 \xXX or \uXXXX
|
|
332
|
-
* \cX is allowed in RegExps but not in strings
|
|
333
|
-
* Octal sequences are not allowed in strict mode
|
|
334
|
-
*/
|
|
335
|
-
const ESCAPE_LENGTH = {
|
|
336
|
-
x: 3,
|
|
337
|
-
u: 5
|
|
338
|
-
};
|
|
339
|
-
/**
|
|
340
|
-
* Splits a template string by whitespace while also properly handling escape
|
|
341
|
-
* sequences.
|
|
342
|
-
*
|
|
343
|
-
* As an example, let's review the following valid commands:
|
|
344
|
-
*
|
|
345
|
-
* ```ts
|
|
346
|
-
* ChildProcess.exec`echo foo\n bar`
|
|
347
|
-
* // We should run `["echo", "foo\n", "bar"]`
|
|
348
|
-
*
|
|
349
|
-
* ChildProcess.exec`echo foo
|
|
350
|
-
* bar`
|
|
351
|
-
* // We should run `["echo", "foo", "bar]`
|
|
352
|
-
* ```
|
|
353
|
-
*
|
|
354
|
-
* The problem is that when we evaluate the template string for both of the above
|
|
355
|
-
* commands, we will end up with the same string "echo foo\n bar".
|
|
356
|
-
*
|
|
357
|
-
* What we really want is to include the escaped character in the arguments for
|
|
358
|
-
* the first command, since it was written explicitly by the user.
|
|
359
|
-
*
|
|
360
|
-
* This is why also having access to the raw template string is useful - in a
|
|
361
|
-
* template string, there are two representations of the same string:
|
|
362
|
-
* 1. `template` - The processed string (escape sequences are evaluated).
|
|
363
|
-
* 2. `template.raw` - The raw string (escape sequences are literal).
|
|
364
|
-
*/
|
|
365
|
-
const splitByWhitespaces = (template, rawTemplate) => {
|
|
366
|
-
if (rawTemplate.length === 0) return {
|
|
367
|
-
tokens: [],
|
|
368
|
-
hasLeadingWhitespace: false,
|
|
369
|
-
hasTrailingWhitespace: false
|
|
370
|
-
};
|
|
371
|
-
const hasLeadingWhitespace = DELIMITERS.has(rawTemplate[0]);
|
|
372
|
-
const tokens = [];
|
|
373
|
-
let templateCursor = 0;
|
|
374
|
-
for (let templateIndex = 0, rawIndex = 0; templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
|
|
375
|
-
const rawCharacter = rawTemplate[rawIndex];
|
|
376
|
-
if (DELIMITERS.has(rawCharacter)) {
|
|
377
|
-
if (templateCursor !== templateIndex) tokens.push(template.slice(templateCursor, templateIndex));
|
|
378
|
-
templateCursor = templateIndex + 1;
|
|
379
|
-
} else if (rawCharacter === "\\") {
|
|
380
|
-
const nextRawCharacter = rawTemplate[rawIndex + 1];
|
|
381
|
-
if (nextRawCharacter === "\n") {
|
|
382
|
-
templateIndex -= 1;
|
|
383
|
-
rawIndex += 1;
|
|
384
|
-
} else if (nextRawCharacter === "u" && rawTemplate[rawIndex + 2] === "{") rawIndex = rawTemplate.indexOf("}", rawIndex + 3);
|
|
385
|
-
else rawIndex += ESCAPE_LENGTH[nextRawCharacter] ?? 1;
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
const hasTrailingWhitespace = templateCursor === template.length;
|
|
389
|
-
if (!hasTrailingWhitespace) tokens.push(template.slice(templateCursor));
|
|
390
|
-
return {
|
|
391
|
-
tokens,
|
|
392
|
-
hasLeadingWhitespace,
|
|
393
|
-
hasTrailingWhitespace
|
|
394
|
-
};
|
|
395
|
-
};
|
|
396
|
-
/**
|
|
397
|
-
* Concatenates two separate sets of string tokens together.
|
|
398
|
-
*
|
|
399
|
-
* If either set is empty or `isSeparated=false`, the last element of `prevTokens`
|
|
400
|
-
* and the first element of `nextTokens` will be joined into a single token.
|
|
401
|
-
*/
|
|
402
|
-
const concatTokens = (prevTokens, nextTokens, isSeparated) => isSeparated || prevTokens.length === 0 || nextTokens.length === 0 ? [...prevTokens, ...nextTokens] : [
|
|
403
|
-
...prevTokens.slice(0, -1),
|
|
404
|
-
`${prevTokens.at(-1)}${nextTokens.at(0)}`,
|
|
405
|
-
...nextTokens.slice(1)
|
|
406
|
-
];
|
|
407
|
-
//#endregion
|
|
408
|
-
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.78_effect@4.0.0-beta.78/node_modules/@effect/platform-node-shared/dist/internal/utils.js
|
|
69
|
+
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.102_effect@4.0.0-beta.102_patch_hash=71215759e1_3273714b76c575f5c82a5a72c5bb5418/node_modules/@effect/platform-node-shared/dist/internal/utils.js
|
|
409
70
|
/** @internal */
|
|
410
71
|
const handleErrnoException = (module, method) => (err, [path]) => {
|
|
411
72
|
let reason = "Unknown";
|
|
@@ -442,7 +103,7 @@ const handleErrnoException = (module, method) => (err, [path]) => {
|
|
|
442
103
|
});
|
|
443
104
|
};
|
|
444
105
|
//#endregion
|
|
445
|
-
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.
|
|
106
|
+
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.102_effect@4.0.0-beta.102_patch_hash=71215759e1_3273714b76c575f5c82a5a72c5bb5418/node_modules/@effect/platform-node-shared/dist/NodeChildProcessSpawner.js
|
|
446
107
|
const toError = (error) => error instanceof globalThis.Error ? error : new globalThis.Error(String(error));
|
|
447
108
|
const toPlatformError = (method, error, command) => {
|
|
448
109
|
const { commands } = flattenCommand(command);
|
|
@@ -542,16 +203,21 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
542
203
|
evaluate: () => nodeStream,
|
|
543
204
|
onError: (error) => toPlatformError(`fromWritable(fd${fd})`, toError(error), command)
|
|
544
205
|
});
|
|
545
|
-
if (config.stream) yield* forkScoped(run$
|
|
206
|
+
if (config.stream) yield* forkScoped(run$2(config.stream, sink));
|
|
546
207
|
inputSinks.set(fd, sink);
|
|
547
208
|
break;
|
|
548
209
|
}
|
|
549
210
|
case "output": {
|
|
550
211
|
let stream = empty;
|
|
551
|
-
if (nodeStream && "read" in nodeStream)
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
212
|
+
if (nodeStream && "read" in nodeStream) {
|
|
213
|
+
const passThrough = new PassThrough();
|
|
214
|
+
nodeStream.on("error", (error) => passThrough.destroy(error));
|
|
215
|
+
nodeStream.pipe(passThrough);
|
|
216
|
+
stream = fromReadable({
|
|
217
|
+
evaluate: () => passThrough,
|
|
218
|
+
onError: (error) => toPlatformError(`fromReadable(fd${fd})`, toError(error), command)
|
|
219
|
+
});
|
|
220
|
+
}
|
|
555
221
|
if (config.sink) stream = transduce(stream, config.sink);
|
|
556
222
|
outputStreams.set(fd, stream);
|
|
557
223
|
break;
|
|
@@ -571,18 +237,28 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
571
237
|
endOnDone: config.endOnDone,
|
|
572
238
|
encoding: config.encoding
|
|
573
239
|
});
|
|
574
|
-
if (isStream(config.stream)) return as(forkScoped(run$
|
|
240
|
+
if (isStream(config.stream)) return as(forkScoped(run$2(config.stream, sink)), sink);
|
|
575
241
|
return succeed(sink);
|
|
576
242
|
});
|
|
577
243
|
const setupChildOutputStreams = (command, childProcess, stdoutConfig, stderrConfig) => {
|
|
578
|
-
let stdout = childProcess.stdout ?
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
244
|
+
let stdout = childProcess.stdout ? (() => {
|
|
245
|
+
const passThrough = new PassThrough();
|
|
246
|
+
childProcess.stdout.on("error", (error) => passThrough.destroy(error));
|
|
247
|
+
childProcess.stdout.pipe(passThrough);
|
|
248
|
+
return fromReadable({
|
|
249
|
+
evaluate: () => passThrough,
|
|
250
|
+
onError: (error) => toPlatformError("fromReadable(stdout)", toError(error), command)
|
|
251
|
+
});
|
|
252
|
+
})() : empty;
|
|
253
|
+
let stderr = childProcess.stderr ? (() => {
|
|
254
|
+
const passThrough = new PassThrough();
|
|
255
|
+
childProcess.stderr.on("error", (error) => passThrough.destroy(error));
|
|
256
|
+
childProcess.stderr.pipe(passThrough);
|
|
257
|
+
return fromReadable({
|
|
258
|
+
evaluate: () => passThrough,
|
|
259
|
+
onError: (error) => toPlatformError("fromReadable(stderr)", toError(error), command)
|
|
260
|
+
});
|
|
261
|
+
})() : empty;
|
|
586
262
|
if (isSink(stdoutConfig.stream)) stdout = transduce(stdout, stdoutConfig.stream);
|
|
587
263
|
if (isSink(stderrConfig.stream)) stderr = transduce(stderr, stderrConfig.stream);
|
|
588
264
|
const all = merge(stdout, stderr);
|
|
@@ -670,7 +346,6 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
670
346
|
const stderrConfig = resolveOutputOption(cmd.options, "stderr");
|
|
671
347
|
const resolvedAdditionalFds = resolveAdditionalFds(cmd.options);
|
|
672
348
|
let isReferenced = true;
|
|
673
|
-
let cleanupOnNonZeroExit = false;
|
|
674
349
|
const cwd = yield* resolveWorkingDirectory(cmd.options);
|
|
675
350
|
const env = resolveEnvironment(cmd.options);
|
|
676
351
|
const stdio = buildStdioArray(stdinConfig, stdoutConfig, stderrConfig, resolvedAdditionalFds);
|
|
@@ -689,24 +364,22 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
689
364
|
return yield* void_;
|
|
690
365
|
}
|
|
691
366
|
if (!isReferenced) return yield* void_;
|
|
692
|
-
return yield* killWithTimeout((command, childProcess, signal) =>
|
|
367
|
+
return yield* killWithTimeout((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(ignore);
|
|
693
368
|
}));
|
|
694
369
|
const pid = ProcessId(childProcess.pid);
|
|
695
370
|
childProcess.on("exit", (code) => {
|
|
696
|
-
if (
|
|
371
|
+
if (code !== 0 && isNotNull(code)) killProcessGroupOnExit(childProcess, cmd.options.killSignal ?? "SIGTERM");
|
|
697
372
|
});
|
|
698
373
|
const reref = sync(() => {
|
|
699
374
|
if (!isReferenced) {
|
|
700
375
|
childProcess.ref();
|
|
701
376
|
isReferenced = true;
|
|
702
|
-
cleanupOnNonZeroExit = false;
|
|
703
377
|
}
|
|
704
378
|
});
|
|
705
379
|
const unref = sync(() => {
|
|
706
380
|
if (isReferenced) {
|
|
707
381
|
childProcess.unref();
|
|
708
382
|
isReferenced = false;
|
|
709
|
-
cleanupOnNonZeroExit = true;
|
|
710
383
|
}
|
|
711
384
|
return reref;
|
|
712
385
|
});
|
|
@@ -720,7 +393,7 @@ const layer$11 = /*#__PURE__*/ effect(ChildProcessSpawner, /* @__PURE__ */ gen(f
|
|
|
720
393
|
return fail(toPlatformError("exitCode", error, cmd));
|
|
721
394
|
});
|
|
722
395
|
const kill = (options) => {
|
|
723
|
-
return withTimeout(childProcess, cmd, options)((command, childProcess, signal) =>
|
|
396
|
+
return withTimeout(childProcess, cmd, options)((command, childProcess, signal) => killProcessGroup(command, childProcess, signal).pipe(catch_(() => killProcess(command, childProcess, signal)), andThen(_await(exitSignal)))).pipe(asVoid);
|
|
724
397
|
};
|
|
725
398
|
return makeHandle({
|
|
726
399
|
pid,
|
|
@@ -832,29 +505,14 @@ const flattenCommand = (command) => {
|
|
|
832
505
|
};
|
|
833
506
|
};
|
|
834
507
|
//#endregion
|
|
835
|
-
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.
|
|
508
|
+
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.102_effect@4.0.0-beta.102_patch_hash=71215759e1_3273714b76c575f5c82a5a72c5bb5418/node_modules/@effect/platform-node-shared/dist/NodeCrypto.js
|
|
836
509
|
/**
|
|
837
|
-
*
|
|
838
|
-
* Node-compatible `node:crypto` APIs. It exports {@link make} as the concrete
|
|
839
|
-
* service value and {@link layer} for providing that service to programs that
|
|
840
|
-
* need cryptographic random bytes, UUID generation, random values, or SHA
|
|
841
|
-
* digests over `Uint8Array` input.
|
|
842
|
-
*
|
|
843
|
-
* **Common tasks**
|
|
510
|
+
* Node-compatible implementation of Effect's `Crypto` service.
|
|
844
511
|
*
|
|
845
|
-
*
|
|
846
|
-
*
|
|
847
|
-
*
|
|
848
|
-
*
|
|
849
|
-
* `effect/Crypto` after the layer is provided
|
|
850
|
-
*
|
|
851
|
-
* **Gotchas**
|
|
852
|
-
*
|
|
853
|
-
* - Random bytes come from `node:crypto.randomBytes`
|
|
854
|
-
* - Digests use `node:crypto.createHash`; hash failures become platform
|
|
855
|
-
* errors
|
|
856
|
-
* - SHA-1 is included for interoperability with existing protocols, not for
|
|
857
|
-
* new security-sensitive designs
|
|
512
|
+
* This module builds the service from `node:crypto`, using `randomBytes` for
|
|
513
|
+
* random data and `createHash` for supported digest algorithms. It exports
|
|
514
|
+
* `make` as the concrete service value and `layer` for providing it through
|
|
515
|
+
* Effect context.
|
|
858
516
|
*
|
|
859
517
|
* @since 1.0.0
|
|
860
518
|
*/
|
|
@@ -877,7 +535,7 @@ const digest = (algorithm, data) => try_({
|
|
|
877
535
|
})
|
|
878
536
|
});
|
|
879
537
|
//#endregion
|
|
880
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
538
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodeCrypto.js
|
|
881
539
|
/**
|
|
882
540
|
* The `NodeCrypto` module provides the Node.js `Crypto` service layer for
|
|
883
541
|
* Effect programs. Provide {@link layer} at the edge of a Node application,
|
|
@@ -902,7 +560,7 @@ const layer$9 = /* @__PURE__ */ succeed$2(Crypto, /* @__PURE__ */ make$7({
|
|
|
902
560
|
digest
|
|
903
561
|
}));
|
|
904
562
|
//#endregion
|
|
905
|
-
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.
|
|
563
|
+
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.102_effect@4.0.0-beta.102_patch_hash=71215759e1_3273714b76c575f5c82a5a72c5bb5418/node_modules/@effect/platform-node-shared/dist/NodeFileSystem.js
|
|
906
564
|
/**
|
|
907
565
|
* Shared Node-compatible implementation of Effect's `FileSystem` service.
|
|
908
566
|
*
|
|
@@ -912,29 +570,6 @@ const layer$9 = /* @__PURE__ */ succeed$2(Crypto, /* @__PURE__ */ make$7({
|
|
|
912
570
|
* links, metadata, temporary files and directories, and file watching through
|
|
913
571
|
* the shared `FileSystem` service.
|
|
914
572
|
*
|
|
915
|
-
* **Mental model**
|
|
916
|
-
*
|
|
917
|
-
* {@link layer} installs a process-backed `FileSystem` service. Each operation
|
|
918
|
-
* delegates to the corresponding Node filesystem API, then maps Node failures
|
|
919
|
-
* into `PlatformError` values and invalid arguments into `BadArgument` failures.
|
|
920
|
-
* Paths keep Node's normal behavior: relative paths resolve from the current
|
|
921
|
-
* working directory and platform path rules still apply.
|
|
922
|
-
*
|
|
923
|
-
* **Common tasks**
|
|
924
|
-
*
|
|
925
|
-
* Provide {@link layer} at the Node runtime boundary, then depend on the
|
|
926
|
-
* `FileSystem` service from application code. Use the service for ordinary
|
|
927
|
-
* reads and writes, directory management, metadata inspection, links, temporary
|
|
928
|
-
* resources, and file watching without importing Node's `fs` APIs directly.
|
|
929
|
-
*
|
|
930
|
-
* **Gotchas**
|
|
931
|
-
*
|
|
932
|
-
* Open files are scoped resources with tracked read and write positions; append
|
|
933
|
-
* mode lets the operating system choose the write offset. File watching follows
|
|
934
|
-
* `node:fs.watch` semantics unless a custom watch backend is supplied, so
|
|
935
|
-
* recursive support, event coalescing, and reported paths vary by runtime and
|
|
936
|
-
* platform.
|
|
937
|
-
*
|
|
938
573
|
* @since 4.0.0
|
|
939
574
|
*/
|
|
940
575
|
const handleBadArgument = (method) => (err) => badArgument({
|
|
@@ -971,6 +606,13 @@ const chown = /*#__PURE__*/ (() => {
|
|
|
971
606
|
const nodeChown = /*#__PURE__*/ effectify(NFS.chown, /*#__PURE__*/ handleErrnoException("FileSystem", "chown"), /*#__PURE__*/ handleBadArgument("chown"));
|
|
972
607
|
return (path, uid, gid) => nodeChown(path, uid, gid);
|
|
973
608
|
})();
|
|
609
|
+
const glob = /*#__PURE__*/ (() => {
|
|
610
|
+
const nodeGlob = /*#__PURE__*/ effectify(NFS.glob, /*#__PURE__*/ handleErrnoException("FileSystem", "glob"), /*#__PURE__*/ handleBadArgument("glob"));
|
|
611
|
+
return (pattern, options) => nodeGlob(pattern, {
|
|
612
|
+
cwd: options?.root,
|
|
613
|
+
exclude: options?.exclude
|
|
614
|
+
});
|
|
615
|
+
})();
|
|
974
616
|
const link$2 = /*#__PURE__*/ (() => {
|
|
975
617
|
const nodeLink = /*#__PURE__*/ effectify(NFS.link, /*#__PURE__*/ handleErrnoException("FileSystem", "link"), /*#__PURE__*/ handleBadArgument("link"));
|
|
976
618
|
return (existingPath, newPath) => nodeLink(existingPath, newPath);
|
|
@@ -1248,6 +890,7 @@ const makeFileSystem = /*#__PURE__*/ map(/*#__PURE__*/ serviceOption(WatchBacken
|
|
|
1248
890
|
chown,
|
|
1249
891
|
copy,
|
|
1250
892
|
copyFile,
|
|
893
|
+
glob,
|
|
1251
894
|
link: link$2,
|
|
1252
895
|
makeDirectory,
|
|
1253
896
|
makeTempDirectory,
|
|
@@ -1271,7 +914,7 @@ const makeFileSystem = /*#__PURE__*/ map(/*#__PURE__*/ serviceOption(WatchBacken
|
|
|
1271
914
|
writeFile
|
|
1272
915
|
}));
|
|
1273
916
|
//#endregion
|
|
1274
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
917
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodeFileSystem.js
|
|
1275
918
|
/**
|
|
1276
919
|
* Node.js `FileSystem` layer for programs that perform real filesystem I/O.
|
|
1277
920
|
*
|
|
@@ -1280,24 +923,6 @@ const makeFileSystem = /*#__PURE__*/ map(/*#__PURE__*/ serviceOption(WatchBacken
|
|
|
1280
923
|
* links, temporary paths, and path watching. Effects still call the service from
|
|
1281
924
|
* `effect/FileSystem`; this module only chooses the Node implementation.
|
|
1282
925
|
*
|
|
1283
|
-
* **Mental model**
|
|
1284
|
-
*
|
|
1285
|
-
* Provide `NodeFileSystem.layer` at the process boundary when filesystem
|
|
1286
|
-
* effects should touch the host filesystem. Use `NodeServices.layer` instead
|
|
1287
|
-
* when the same program also needs the standard Node path, stdio, terminal,
|
|
1288
|
-
* crypto, and child process services. Tests that need isolation can provide a
|
|
1289
|
-
* different `FileSystem` layer without changing the code that performs the
|
|
1290
|
-
* reads and writes.
|
|
1291
|
-
*
|
|
1292
|
-
* **Gotchas**
|
|
1293
|
-
*
|
|
1294
|
-
* Paths are interpreted by Node, so relative paths resolve against the current
|
|
1295
|
-
* working directory and platform-specific path rules apply. Filesystem failures
|
|
1296
|
-
* are reported through Effect platform errors rather than thrown exceptions.
|
|
1297
|
-
* File watching uses `FileSystem.WatchBackend` when one is available; otherwise
|
|
1298
|
-
* it follows `node:fs.watch`, whose recursive support, event batching, and
|
|
1299
|
-
* reported path names vary across operating systems.
|
|
1300
|
-
*
|
|
1301
926
|
* @since 4.0.0
|
|
1302
927
|
*/
|
|
1303
928
|
/**
|
|
@@ -1308,30 +933,14 @@ const makeFileSystem = /*#__PURE__*/ map(/*#__PURE__*/ serviceOption(WatchBacken
|
|
|
1308
933
|
*/
|
|
1309
934
|
const layer$7 = /* @__PURE__ */ effect(FileSystem)(makeFileSystem);
|
|
1310
935
|
//#endregion
|
|
1311
|
-
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.
|
|
936
|
+
//#region node_modules/.pnpm/@effect+platform-node-shared@4.0.0-beta.102_effect@4.0.0-beta.102_patch_hash=71215759e1_3273714b76c575f5c82a5a72c5bb5418/node_modules/@effect/platform-node-shared/dist/NodePath.js
|
|
1312
937
|
/**
|
|
1313
938
|
* Node-backed provider for Effect's `Path` service.
|
|
1314
939
|
*
|
|
1315
|
-
* This module turns Node's `node:path` and `node:url` APIs into `
|
|
1316
|
-
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
* URL conversion.
|
|
1320
|
-
*
|
|
1321
|
-
* **Mental model**
|
|
1322
|
-
*
|
|
1323
|
-
* `layer` follows the platform semantics of the current Node runtime. The
|
|
1324
|
-
* `layerPosix` and `layerWin32` variants pin the syntax rules to POSIX or
|
|
1325
|
-
* Windows, which is useful for deterministic parsing, formatting, and tests.
|
|
1326
|
-
* All three layers include `fromFileUrl` and `toFileUrl` behavior backed by
|
|
1327
|
-
* Node's URL conversion functions.
|
|
1328
|
-
*
|
|
1329
|
-
* **Gotchas**
|
|
1330
|
-
*
|
|
1331
|
-
* Path operations are syntactic: they normalize separators, roots, drive
|
|
1332
|
-
* letters, UNC segments, extensions, and relative segments without checking the
|
|
1333
|
-
* filesystem. File URL conversion follows Node's validation and encoding
|
|
1334
|
-
* rules, and invalid conversions fail with `BadArgument`.
|
|
940
|
+
* This module turns Node's `node:path` and `node:url` APIs into `Path` layers.
|
|
941
|
+
* `layer` uses the host platform path implementation, while `layerPosix` and
|
|
942
|
+
* `layerWin32` provide fixed POSIX and Windows variants. All three layers also
|
|
943
|
+
* include helpers for converting between file paths and file URLs.
|
|
1335
944
|
*
|
|
1336
945
|
* @since 4.0.0
|
|
1337
946
|
*/
|
|
@@ -1354,34 +963,14 @@ const toFileUrl = (path) => try_({
|
|
|
1354
963
|
({ ...Path.posix });
|
|
1355
964
|
({ ...Path.win32 });
|
|
1356
965
|
//#endregion
|
|
1357
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
966
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodePath.js
|
|
1358
967
|
/**
|
|
1359
968
|
* Node.js layers for Effect's `Path` service.
|
|
1360
969
|
*
|
|
1361
|
-
* This module
|
|
1362
|
-
* platform-independent `Path` service
|
|
1363
|
-
*
|
|
1364
|
-
*
|
|
1365
|
-
*
|
|
1366
|
-
* **Mental model**
|
|
1367
|
-
*
|
|
1368
|
-
* `Path` is a syntactic service: it manipulates strings and `file:` URLs. It
|
|
1369
|
-
* does not read the filesystem, check permissions, or validate that paths
|
|
1370
|
-
* exist. The selected layer decides which separator, drive-letter, UNC, and URL
|
|
1371
|
-
* conversion rules are used.
|
|
1372
|
-
*
|
|
1373
|
-
* **Common tasks**
|
|
1374
|
-
*
|
|
1375
|
-
* Use `layer` for host-platform Node semantics, `layerPosix` for stable POSIX
|
|
1376
|
-
* behavior, and `layerWin32` for stable Windows behavior. `NodeServices.layer`
|
|
1377
|
-
* already includes `layer`, so import this module directly when a program wants
|
|
1378
|
-
* only path support or a platform-specific variant.
|
|
1379
|
-
*
|
|
1380
|
-
* **Gotchas**
|
|
1381
|
-
*
|
|
1382
|
-
* Results that are correct on one platform may not be portable to another.
|
|
1383
|
-
* `fromFileUrl` and `toFileUrl` use Node's `node:url` conversion rules and
|
|
1384
|
-
* report invalid conversions as `BadArgument` failures.
|
|
970
|
+
* This module provides the default, POSIX, and Windows variants of the
|
|
971
|
+
* platform-independent `Path` service by reusing the shared Node path
|
|
972
|
+
* implementation. The provided path services include Node file URL conversion
|
|
973
|
+
* behavior.
|
|
1385
974
|
*
|
|
1386
975
|
* @since 4.0.0
|
|
1387
976
|
*/
|
|
@@ -1393,42 +982,23 @@ const toFileUrl = (path) => try_({
|
|
|
1393
982
|
* @since 4.0.0
|
|
1394
983
|
*/
|
|
1395
984
|
const layer$5 = /* @__PURE__ */ succeed$2(Path$1)({
|
|
1396
|
-
[TypeId$
|
|
985
|
+
[TypeId$2]: TypeId$2,
|
|
1397
986
|
...Path,
|
|
1398
987
|
fromFileUrl,
|
|
1399
988
|
toFileUrl
|
|
1400
989
|
});
|
|
1401
990
|
//#endregion
|
|
1402
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
991
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/Stdio.js
|
|
1403
992
|
/**
|
|
1404
|
-
* Service contract for
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1407
|
-
* `Stdio` lets command-line programs depend on standard I/O through the Effect
|
|
993
|
+
* Service contract for command-line arguments and standard input, output, and
|
|
994
|
+
* error output. It lets programs depend on standard I/O through the Effect
|
|
1408
995
|
* environment instead of reading from or writing to global process handles
|
|
1409
|
-
* directly.
|
|
1410
|
-
* `Sink`s that accept strings or bytes, and stdin as a byte `Stream`.
|
|
1411
|
-
*
|
|
1412
|
-
* **Mental model**
|
|
1413
|
-
*
|
|
1414
|
-
* Application code describes what it needs from standard I/O, and a runtime
|
|
1415
|
-
* layer supplies the concrete streams. Platform packages provide real process
|
|
1416
|
-
* implementations, while tests can use `Stdio.layerTest` to replace only the
|
|
1417
|
-
* fields that matter for a scenario and keep the rest inert.
|
|
1418
|
-
*
|
|
1419
|
-
* **Common tasks**
|
|
1420
|
-
*
|
|
1421
|
-
* - Read command-line arguments from the service's `args` effect.
|
|
1422
|
-
* - Write text or bytes by running values into the service's `stdout()` or
|
|
1423
|
-
* `stderr()` sinks.
|
|
1424
|
-
* - Consume `stdin` as a stream of `Uint8Array` chunks.
|
|
1425
|
-
* - Build deterministic tests with `Stdio.layerTest`.
|
|
1426
|
-
*
|
|
1427
|
-
* **Gotchas**
|
|
996
|
+
* directly.
|
|
1428
997
|
*
|
|
1429
|
-
*
|
|
1430
|
-
*
|
|
1431
|
-
*
|
|
998
|
+
* The service exposes arguments as an `Effect`, stdout and stderr as `Sink`s
|
|
999
|
+
* that accept strings or bytes, and stdin as a byte `Stream`. This module also
|
|
1000
|
+
* provides a constructor for service values and a small test layer with
|
|
1001
|
+
* overridable defaults.
|
|
1432
1002
|
*
|
|
1433
1003
|
* @since 4.0.0
|
|
1434
1004
|
*/
|
|
@@ -1483,31 +1053,14 @@ const make$2 = (options) => ({
|
|
|
1483
1053
|
...options
|
|
1484
1054
|
});
|
|
1485
1055
|
//#endregion
|
|
1486
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
1056
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodeStdio.js
|
|
1487
1057
|
/**
|
|
1488
1058
|
* Node.js `Stdio` layer for the current process.
|
|
1489
1059
|
*
|
|
1490
|
-
* The exported layer
|
|
1491
|
-
*
|
|
1492
|
-
* `process.
|
|
1493
|
-
* `process.stderr`.
|
|
1494
|
-
* runners, and tests that intentionally communicate through the host process.
|
|
1495
|
-
*
|
|
1496
|
-
* **Mental model**
|
|
1497
|
-
*
|
|
1498
|
-
* Effects should depend on `Stdio`; this module decides that the backing
|
|
1499
|
-
* streams are the global Node process handles. Provide `NodeStdio.layer` when a
|
|
1500
|
-
* program only needs standard input and output, or `NodeServices.layer` when the
|
|
1501
|
-
* same entrypoint also needs the other default Node services.
|
|
1502
|
-
*
|
|
1503
|
-
* **Gotchas**
|
|
1504
|
-
*
|
|
1505
|
-
* The process stdio streams are shared resources. The layer leaves stdin open
|
|
1506
|
-
* and does not end stdout or stderr by default, avoiding accidental closure of
|
|
1507
|
-
* handles that other code in the same process may still use. Stdio might be a
|
|
1508
|
-
* pipe, file, or TTY; terminal-specific behavior such as raw mode, echo, color
|
|
1509
|
-
* detection, and cursor movement belongs with terminal APIs rather than this
|
|
1510
|
-
* service.
|
|
1060
|
+
* The exported layer reuses the shared Node stdio implementation. It satisfies
|
|
1061
|
+
* the platform-independent `Stdio` service by reading command-line arguments
|
|
1062
|
+
* from `process.argv`, consuming input from `process.stdin`, and writing output
|
|
1063
|
+
* streams to `process.stdout` and `process.stderr`.
|
|
1511
1064
|
*
|
|
1512
1065
|
* @since 4.0.0
|
|
1513
1066
|
*/
|
|
@@ -1620,7 +1173,7 @@ function defaultShouldQuit(input) {
|
|
|
1620
1173
|
return input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
|
|
1621
1174
|
}
|
|
1622
1175
|
//#endregion
|
|
1623
|
-
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.
|
|
1176
|
+
//#region node_modules/.pnpm/@effect+platform-node@4.0.0-beta.102_patch_hash=cae7efcda6fd29f4db2efd357cb7dc6c41cb6ad_5ec7f92fdb36a12db81428ea9ead6984/node_modules/@effect/platform-node/dist/NodeServices.js
|
|
1624
1177
|
/**
|
|
1625
1178
|
* Provides the default Node implementations for child process spawning,
|
|
1626
1179
|
* filesystem, path, stdio, and terminal services.
|
|
@@ -1630,7 +1183,7 @@ function defaultShouldQuit(input) {
|
|
|
1630
1183
|
*/
|
|
1631
1184
|
const layer = /*#__PURE__*/ provideMerge(layer$11, /*#__PURE__*/ mergeAll(layer$7, layer$9, layer$5, layer$3, layer$2));
|
|
1632
1185
|
//#endregion
|
|
1633
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
1186
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/Argument.js
|
|
1634
1187
|
/**
|
|
1635
1188
|
* Creates a positional string argument.
|
|
1636
1189
|
*
|
|
@@ -1714,7 +1267,34 @@ const variadic = /*#__PURE__*/ dual((args) => isParam(args[0]), (self, options)
|
|
|
1714
1267
|
*/
|
|
1715
1268
|
const mapEffect = /*#__PURE__*/ dual(2, (self, f) => mapEffect$1(self, f));
|
|
1716
1269
|
//#endregion
|
|
1717
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
1270
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/CliConfig.js
|
|
1271
|
+
/**
|
|
1272
|
+
* Configuration for Effect CLI command execution.
|
|
1273
|
+
*
|
|
1274
|
+
* @since 4.0.0
|
|
1275
|
+
*/
|
|
1276
|
+
/**
|
|
1277
|
+
* Context reference for configuration shared by CLI parsing, help generation,
|
|
1278
|
+
* and command execution.
|
|
1279
|
+
*
|
|
1280
|
+
* **When to use**
|
|
1281
|
+
*
|
|
1282
|
+
* Use when you need to customize runner-wide CLI behavior, such as which
|
|
1283
|
+
* built-in global flags are available.
|
|
1284
|
+
*
|
|
1285
|
+
* @category services
|
|
1286
|
+
* @since 4.0.0
|
|
1287
|
+
*/
|
|
1288
|
+
var CliConfig = class extends Reference("effect/unstable/cli/CliConfig", { defaultValue: () => defaults }) {};
|
|
1289
|
+
/**
|
|
1290
|
+
* Default CLI configuration containing every built-in global flag.
|
|
1291
|
+
*
|
|
1292
|
+
* @category defaults
|
|
1293
|
+
* @since 4.0.0
|
|
1294
|
+
*/
|
|
1295
|
+
const defaults = { builtIns: BuiltIns };
|
|
1296
|
+
//#endregion
|
|
1297
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/internal/lexer.js
|
|
1718
1298
|
/** @internal */
|
|
1719
1299
|
function lex(argv) {
|
|
1720
1300
|
const endIndex = argv.indexOf("--");
|
|
@@ -1765,7 +1345,7 @@ const lexTokens = (args) => {
|
|
|
1765
1345
|
return tokens;
|
|
1766
1346
|
};
|
|
1767
1347
|
//#endregion
|
|
1768
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
1348
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/internal/auto-suggest.js
|
|
1769
1349
|
/**
|
|
1770
1350
|
* Simple Levenshtein distance implementation (small N, no perf worries)
|
|
1771
1351
|
*/
|
|
@@ -1793,7 +1373,7 @@ const suggest = (input, candidates) => {
|
|
|
1793
1373
|
return distances.filter(([d]) => d === minDistance).map(([, c]) => c);
|
|
1794
1374
|
};
|
|
1795
1375
|
//#endregion
|
|
1796
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
1376
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/internal/parser.js
|
|
1797
1377
|
/**
|
|
1798
1378
|
* Parsing Pipeline for CLI Commands
|
|
1799
1379
|
* ==================================
|
|
@@ -1956,6 +1536,15 @@ const invalidNegatedFlagValue = (token, spec, value) => new InvalidValue({
|
|
|
1956
1536
|
expected: `omit the value and use ${token.raw} by itself to set --${spec.name} to false`,
|
|
1957
1537
|
kind: "flag"
|
|
1958
1538
|
});
|
|
1539
|
+
const missingFlagValue = (spec) => {
|
|
1540
|
+
const choices = getChoiceKeys(spec.primitiveType);
|
|
1541
|
+
return new InvalidValue({
|
|
1542
|
+
option: spec.name,
|
|
1543
|
+
value: "",
|
|
1544
|
+
expected: choices === void 0 ? spec.typeName ?? getTypeName(spec.primitiveType) : choices.join(" | "),
|
|
1545
|
+
kind: "flag"
|
|
1546
|
+
});
|
|
1547
|
+
};
|
|
1959
1548
|
/**
|
|
1960
1549
|
* Checks whether a token is a boolean literal value.
|
|
1961
1550
|
* Recognizes: true/false, yes/no, on/off, 1/0
|
|
@@ -2028,8 +1617,8 @@ const consumeFlagValueWithTokens = (cursor, token, spec, negated = false) => {
|
|
|
2028
1617
|
};
|
|
2029
1618
|
}
|
|
2030
1619
|
return {
|
|
2031
|
-
_tag: "
|
|
2032
|
-
|
|
1620
|
+
_tag: "Error",
|
|
1621
|
+
error: missingFlagValue(spec),
|
|
2033
1622
|
tokens: []
|
|
2034
1623
|
};
|
|
2035
1624
|
};
|
|
@@ -2312,7 +1901,167 @@ const scanCommandLevel = (tokens, context) => {
|
|
|
2312
1901
|
return toLeafResult(state);
|
|
2313
1902
|
};
|
|
2314
1903
|
//#endregion
|
|
2315
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
1904
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/internal/wizard.js
|
|
1905
|
+
const run$1 = /*#__PURE__*/ fnUntraced(function* (command, options) {
|
|
1906
|
+
const commandPath = options?.commandPath ?? [command.name];
|
|
1907
|
+
const selected = getCommandAtPath(command, commandPath);
|
|
1908
|
+
const commandLine = [...options?.prefix ?? commandPath];
|
|
1909
|
+
yield* logCurrentCommand(commandLine);
|
|
1910
|
+
yield* promptCommand(selected, commandLine, selected === command ? "ROOT" : selected.name);
|
|
1911
|
+
return commandLine;
|
|
1912
|
+
});
|
|
1913
|
+
const getCommandAtPath = (command, commandPath) => {
|
|
1914
|
+
let current = command;
|
|
1915
|
+
for (const name of commandPath.slice(1)) {
|
|
1916
|
+
const child = current.subcommands.flatMap((group) => group.commands).find((candidate) => candidate.name === name || candidate.alias === name);
|
|
1917
|
+
if (child === void 0) break;
|
|
1918
|
+
current = child;
|
|
1919
|
+
}
|
|
1920
|
+
return current;
|
|
1921
|
+
};
|
|
1922
|
+
const promptCommand = /*#__PURE__*/ fnUntraced(function* (command, commandLine, sectionName) {
|
|
1923
|
+
const impl = toImpl(command);
|
|
1924
|
+
const visibleSubcommands = command.subcommands.flatMap((group) => group.commands.filter((child) => !child.hidden));
|
|
1925
|
+
const config = visibleSubcommands.length === 0 ? impl.config : impl.contextConfig;
|
|
1926
|
+
if (config.flags.length > 0) {
|
|
1927
|
+
yield* log(renderSection(sectionName, "FLAGS"));
|
|
1928
|
+
for (const param of config.flags) commandLine.push(...yield* promptParam(param));
|
|
1929
|
+
if (config.arguments.length > 0 || visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine);
|
|
1930
|
+
}
|
|
1931
|
+
if (config.arguments.length > 0) {
|
|
1932
|
+
yield* log(renderSection(sectionName, "ARGUMENTS"));
|
|
1933
|
+
for (const param of config.arguments) commandLine.push(...yield* promptParam(param));
|
|
1934
|
+
if (visibleSubcommands.length > 0) yield* logCurrentCommand(commandLine);
|
|
1935
|
+
}
|
|
1936
|
+
if (visibleSubcommands.length === 0) return;
|
|
1937
|
+
const child = yield* run$3(select({
|
|
1938
|
+
message: "Command",
|
|
1939
|
+
choices: visibleSubcommands.map((command) => ({
|
|
1940
|
+
title: command.name,
|
|
1941
|
+
value: command,
|
|
1942
|
+
...command.shortDescription !== void 0 ? { description: command.shortDescription } : command.description !== void 0 ? { description: command.description } : {}
|
|
1943
|
+
}))
|
|
1944
|
+
}));
|
|
1945
|
+
yield* log();
|
|
1946
|
+
commandLine.push(child.name);
|
|
1947
|
+
if (hasWizardSteps(child)) yield* logCurrentCommand(commandLine);
|
|
1948
|
+
yield* promptCommand(child, commandLine, child.name);
|
|
1949
|
+
});
|
|
1950
|
+
const hasWizardSteps = (command) => {
|
|
1951
|
+
return command.subcommands.some((group) => group.commands.some((child) => !child.hidden)) || toImpl(command).config.orderedParams.length > 0;
|
|
1952
|
+
};
|
|
1953
|
+
const promptParam = /*#__PURE__*/ fnUntraced(function* (param) {
|
|
1954
|
+
const single = getUnderlyingSingleOrThrow(param);
|
|
1955
|
+
const metadata = getParamMetadata(param);
|
|
1956
|
+
if (metadata.isOptional) {
|
|
1957
|
+
if (!(yield* run$3(confirm({
|
|
1958
|
+
message: `Set ${renderParamLabel(single)}?`,
|
|
1959
|
+
initial: false
|
|
1960
|
+
})))) {
|
|
1961
|
+
yield* log();
|
|
1962
|
+
return [];
|
|
1963
|
+
}
|
|
1964
|
+
}
|
|
1965
|
+
const count = !metadata.isVariadic ? 1 : yield* run$3(integer({
|
|
1966
|
+
message: `${renderParamLabel(single)} count`,
|
|
1967
|
+
default: getOrElse(metadata.variadicMin, () => 0),
|
|
1968
|
+
min: getOrElse(metadata.variadicMin, () => 0),
|
|
1969
|
+
...isSome(metadata.variadicMax) ? { max: metadata.variadicMax.value } : {}
|
|
1970
|
+
}));
|
|
1971
|
+
const values = [];
|
|
1972
|
+
for (let i = 0; i < count; i++) values.push(yield* promptSingle(single));
|
|
1973
|
+
const parsed = single.kind === "flag" ? {
|
|
1974
|
+
flags: { [single.name]: values },
|
|
1975
|
+
arguments: []
|
|
1976
|
+
} : {
|
|
1977
|
+
flags: {},
|
|
1978
|
+
arguments: values
|
|
1979
|
+
};
|
|
1980
|
+
yield* param.parse(parsed);
|
|
1981
|
+
yield* log();
|
|
1982
|
+
if (single.kind === "argument") return values;
|
|
1983
|
+
return values.flatMap((value) => [`--${single.name}`, value]);
|
|
1984
|
+
});
|
|
1985
|
+
const promptSingle = (single) => {
|
|
1986
|
+
const message = renderParamMessage(single);
|
|
1987
|
+
switch (single.primitiveType._tag) {
|
|
1988
|
+
case "Boolean": return map(run$3(confirm({
|
|
1989
|
+
message,
|
|
1990
|
+
label: {
|
|
1991
|
+
confirm: "true",
|
|
1992
|
+
deny: "false"
|
|
1993
|
+
},
|
|
1994
|
+
placeholder: {
|
|
1995
|
+
defaultConfirm: "(T/f)",
|
|
1996
|
+
defaultDeny: "(t/F)"
|
|
1997
|
+
}
|
|
1998
|
+
})), String);
|
|
1999
|
+
case "Choice": return run$3(select({
|
|
2000
|
+
message,
|
|
2001
|
+
choices: (getChoiceKeys(single.primitiveType) ?? []).map((choice) => ({
|
|
2002
|
+
title: choice,
|
|
2003
|
+
value: choice
|
|
2004
|
+
}))
|
|
2005
|
+
}));
|
|
2006
|
+
case "Date": return map(run$3(date({ message })), (date) => date.toISOString());
|
|
2007
|
+
case "Float": return map(run$3(float({ message })), String);
|
|
2008
|
+
case "Integer": return map(run$3(integer({ message })), String);
|
|
2009
|
+
case "Redacted": return map(run$3(password({ message })), value$2);
|
|
2010
|
+
default: return run$3(text({ message }));
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
const formatName = (single) => single.kind === "flag" ? `--${single.name}` : single.name;
|
|
2014
|
+
const renderParamMessage = (single) => renderParamLabel(single);
|
|
2015
|
+
const renderParamLabel = (single) => {
|
|
2016
|
+
const description = getOrUndefined(single.description)?.trim();
|
|
2017
|
+
const label = single.kind === "flag" && description !== void 0 && description.length <= 32 ? description : humanize(single.name);
|
|
2018
|
+
return single.kind === "flag" ? `${label} (${formatName(single)})` : label;
|
|
2019
|
+
};
|
|
2020
|
+
const humanize = (name) => {
|
|
2021
|
+
const words = name.split(/[-_]+/).filter((word) => word.length > 0);
|
|
2022
|
+
if (words.length === 0) return name;
|
|
2023
|
+
return [words[0][0].toUpperCase() + words[0].slice(1), ...words.slice(1)].join(" ");
|
|
2024
|
+
};
|
|
2025
|
+
const logCurrentCommand = (commandLine) => log(renderCommandBlock("Current command", commandLine, magenta));
|
|
2026
|
+
const renderSection = (commandName, section) => `${annotate(commandName.toUpperCase(), bold, cyanBright)} ${annotate("·", blackBright)} ${annotate(section, bold, white)}`;
|
|
2027
|
+
const renderIntroduction = (name, version, summary) => {
|
|
2028
|
+
return [
|
|
2029
|
+
`${annotate(name, bold, cyanBright)} ${annotate(`v${version}`, white)} ${annotate("· Command wizard", bold, white)}`,
|
|
2030
|
+
...summary === void 0 || summary.length === 0 ? [] : [summary],
|
|
2031
|
+
annotate("Build a command interactively. Press Ctrl+C to cancel.", blackBright),
|
|
2032
|
+
""
|
|
2033
|
+
].join("\n");
|
|
2034
|
+
};
|
|
2035
|
+
const renderCompletion = (commandLine) => renderCommandBlock("Command ready", commandLine, cyanBright, green);
|
|
2036
|
+
const renderQuit = () => `\n${annotate("Wizard cancelled.", red)}`;
|
|
2037
|
+
const renderCommandBlock = (label, commandLine, commandColor, labelColor = white) => {
|
|
2038
|
+
const lines = wrapCommand(commandLine);
|
|
2039
|
+
return [
|
|
2040
|
+
annotate(label, bold, labelColor),
|
|
2041
|
+
...lines.map((line) => annotate(line, commandColor)),
|
|
2042
|
+
""
|
|
2043
|
+
].join("\n");
|
|
2044
|
+
};
|
|
2045
|
+
const wrapCommand = (commandLine) => {
|
|
2046
|
+
const width = 88;
|
|
2047
|
+
const firstIndent = " $ ";
|
|
2048
|
+
const continuationIndent = " ";
|
|
2049
|
+
const args = commandLine.map(formatShellArg);
|
|
2050
|
+
const lines = [];
|
|
2051
|
+
let current = firstIndent;
|
|
2052
|
+
for (const arg of args) {
|
|
2053
|
+
const separator = current === firstIndent || current === continuationIndent ? "" : " ";
|
|
2054
|
+
if (current.length + separator.length + arg.length > width && current !== firstIndent) {
|
|
2055
|
+
lines.push(`${current} \\`);
|
|
2056
|
+
current = `${continuationIndent}${arg}`;
|
|
2057
|
+
} else current += `${separator}${arg}`;
|
|
2058
|
+
}
|
|
2059
|
+
if (current !== firstIndent) lines.push(current);
|
|
2060
|
+
return lines;
|
|
2061
|
+
};
|
|
2062
|
+
const formatShellArg = (arg) => /^[A-Za-z0-9_./:@%+=,-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'"'"'`)}'`;
|
|
2063
|
+
//#endregion
|
|
2064
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/unstable/cli/Command.js
|
|
2316
2065
|
/**
|
|
2317
2066
|
* Returns `true` if the provided value is a `Command`.
|
|
2318
2067
|
*
|
|
@@ -2324,7 +2073,7 @@ const scanCommandLevel = (tokens, context) => {
|
|
|
2324
2073
|
* @category guards
|
|
2325
2074
|
* @since 4.0.0
|
|
2326
2075
|
*/
|
|
2327
|
-
const isCommand = (u) => hasProperty(u, TypeId$
|
|
2076
|
+
const isCommand = (u) => hasProperty(u, TypeId$3);
|
|
2328
2077
|
/**
|
|
2329
2078
|
* Creates a `Command` from a name, an optional configuration, and an optional
|
|
2330
2079
|
* handler.
|
|
@@ -2476,10 +2225,13 @@ const withSubcommands = /*#__PURE__*/ dual(2, (self, subcommands) => {
|
|
|
2476
2225
|
if (!sub) return yield* impl.parse(raw);
|
|
2477
2226
|
const context = yield* impl.parseContext(raw);
|
|
2478
2227
|
const result = yield* sub.parse(raw.subcommand.value.parsedInput);
|
|
2479
|
-
return
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2228
|
+
return {
|
|
2229
|
+
...context,
|
|
2230
|
+
[SubcommandStateSymbol]: {
|
|
2231
|
+
name: sub.name,
|
|
2232
|
+
result
|
|
2233
|
+
}
|
|
2234
|
+
};
|
|
2483
2235
|
});
|
|
2484
2236
|
const handle = fnUntraced(function* (input, path) {
|
|
2485
2237
|
const selectedSubcommand = input[SubcommandStateSymbol];
|
|
@@ -2582,8 +2334,9 @@ const getOutOfScopeGlobalFlagErrors = (allFlags, activeFlags, flagMap, commandPa
|
|
|
2582
2334
|
return errors;
|
|
2583
2335
|
};
|
|
2584
2336
|
const showHelp = (command, error$1) => gen(function* () {
|
|
2337
|
+
const { builtIns } = yield* CliConfig;
|
|
2585
2338
|
const formatter = yield* Formatter;
|
|
2586
|
-
const helpDoc = yield* getHelpForCommandPath(command, error$1.commandPath,
|
|
2339
|
+
const helpDoc = yield* getHelpForCommandPath(command, error$1.commandPath, builtIns);
|
|
2587
2340
|
yield* log(formatter.formatHelpDoc(helpDoc));
|
|
2588
2341
|
if (error$1.errors.length > 0) yield* error(formatter.formatErrors(error$1.errors));
|
|
2589
2342
|
});
|
|
@@ -2665,8 +2418,9 @@ const run = /*#__PURE__*/ dual(2, (command, config) => Stdio.use(({ args }) => f
|
|
|
2665
2418
|
const runWith = (command, config) => {
|
|
2666
2419
|
const commandImpl = toImpl(command);
|
|
2667
2420
|
return fnUntraced(function* (args) {
|
|
2421
|
+
const { builtIns } = yield* CliConfig;
|
|
2668
2422
|
const { tokens, trailingOperands } = lex(args);
|
|
2669
|
-
const allFlags = getGlobalFlagsForCommandTree(command,
|
|
2423
|
+
const allFlags = getGlobalFlagsForCommandTree(command, builtIns);
|
|
2670
2424
|
const allFlagParams = allFlags.flatMap((f) => extractSingleParams(f.flag));
|
|
2671
2425
|
const globalRegistry = createFlagRegistry(allFlagParams.filter(isFlagParam));
|
|
2672
2426
|
const { flagMap, remainder, errors: globalFlagErrors } = consumeGlobalFlags(tokens, command, globalRegistry);
|
|
@@ -2680,11 +2434,12 @@ const runWith = (command, config) => {
|
|
|
2680
2434
|
}, command);
|
|
2681
2435
|
const commandPath = [command.name, ...getCommandPath(parsedArgs)];
|
|
2682
2436
|
const handlerCtx = {
|
|
2437
|
+
builtIns,
|
|
2683
2438
|
command,
|
|
2684
2439
|
commandPath,
|
|
2685
2440
|
version: config.version
|
|
2686
2441
|
};
|
|
2687
|
-
const activeFlags = getGlobalFlagsForCommandPath(command, commandPath,
|
|
2442
|
+
const activeFlags = getGlobalFlagsForCommandPath(command, commandPath, builtIns);
|
|
2688
2443
|
const outOfScopeErrors = getOutOfScopeGlobalFlagErrors(allFlags, activeFlags, flagMap, commandPath);
|
|
2689
2444
|
if (outOfScopeErrors.length > 0 || globalFlagErrors.length > 0) {
|
|
2690
2445
|
const parseErrors = parsedArgs.errors ?? [];
|
|
@@ -2704,6 +2459,24 @@ const runWith = (command, config) => {
|
|
|
2704
2459
|
return entries !== void 0 && entries.length > 0;
|
|
2705
2460
|
})) continue;
|
|
2706
2461
|
const [, value] = yield* flag.flag.parse(emptyArgs);
|
|
2462
|
+
if (flag === Wizard) return yield* gen(function* () {
|
|
2463
|
+
yield* log(renderIntroduction(command.name, config.version, command.description));
|
|
2464
|
+
const prefix = [command.name, ...args.filter((arg) => arg !== "--wizard" && !arg.startsWith("--wizard="))];
|
|
2465
|
+
const wizardArgs = yield* run$1(command, {
|
|
2466
|
+
commandPath,
|
|
2467
|
+
prefix
|
|
2468
|
+
});
|
|
2469
|
+
yield* log(renderCompletion(wizardArgs));
|
|
2470
|
+
if (yield* run$3(toggle({
|
|
2471
|
+
message: "Run this command?",
|
|
2472
|
+
initial: true,
|
|
2473
|
+
active: "yes",
|
|
2474
|
+
inactive: "no"
|
|
2475
|
+
}))) {
|
|
2476
|
+
yield* log();
|
|
2477
|
+
yield* runWith(command, config)(wizardArgs.slice(1));
|
|
2478
|
+
}
|
|
2479
|
+
}).pipe(catchTag("QuitError", () => log(renderQuit())));
|
|
2707
2480
|
yield* flag.run(value, handlerCtx);
|
|
2708
2481
|
return;
|
|
2709
2482
|
}
|
|
@@ -2717,13 +2490,13 @@ const runWith = (command, config) => {
|
|
|
2717
2490
|
errors: [parseResult.failure]
|
|
2718
2491
|
});
|
|
2719
2492
|
let program = commandImpl.handle(parseResult.success, [command.name]);
|
|
2493
|
+
const logLevel = activeFlags.includes(LogLevel) ? (yield* LogLevel.flag.parse(emptyArgs))[1] : none();
|
|
2494
|
+
program = provideService(program, LogLevel, logLevel);
|
|
2720
2495
|
for (const flag of activeFlags) {
|
|
2721
|
-
if (flag._tag !== "Setting") continue;
|
|
2496
|
+
if (flag._tag !== "Setting" || flag === LogLevel) continue;
|
|
2722
2497
|
const [, value] = yield* flag.flag.parse(emptyArgs);
|
|
2723
2498
|
program = provideService(program, flag, value);
|
|
2724
2499
|
}
|
|
2725
|
-
const [, logLevel] = yield* LogLevel.flag.parse(emptyArgs);
|
|
2726
|
-
program = provideService(program, LogLevel, logLevel);
|
|
2727
2500
|
const services = match(logLevel, {
|
|
2728
2501
|
onNone: () => empty$1(),
|
|
2729
2502
|
onSome: (level) => make$12(MinimumLogLevel, level)
|
|
@@ -86394,7 +86167,7 @@ const requireDestructiveConfirmation = fn("requireDestructiveConfirmation")(func
|
|
|
86394
86167
|
yield* fail(new DestructiveConfirmationRequiredError({ message: "destructive action requires --yes in non-interactive mode" }));
|
|
86395
86168
|
return;
|
|
86396
86169
|
}
|
|
86397
|
-
if (yield* run$
|
|
86170
|
+
if (yield* run$3(confirm({
|
|
86398
86171
|
message: input.message,
|
|
86399
86172
|
initial: false
|
|
86400
86173
|
}))) return;
|
|
@@ -86406,7 +86179,7 @@ const requireEnvironmentReplaceConfirmation = fn("requireEnvironmentReplaceConfi
|
|
|
86406
86179
|
yield* fail(new DestructiveConfirmationRequiredError({ message: `environment '${input.name}' already exists: pass --replace` }));
|
|
86407
86180
|
return;
|
|
86408
86181
|
}
|
|
86409
|
-
if (yield* run$
|
|
86182
|
+
if (yield* run$3(confirm({
|
|
86410
86183
|
message: `Environment '${input.name}' already exists. Replace?`,
|
|
86411
86184
|
initial: false
|
|
86412
86185
|
}))) return;
|
|
@@ -86547,50 +86320,16 @@ const result = (self) => {
|
|
|
86547
86320
|
};
|
|
86548
86321
|
};
|
|
86549
86322
|
//#endregion
|
|
86550
|
-
//#region node_modules/.pnpm/effect@4.0.0-beta.
|
|
86323
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.102_patch_hash=71215759e1ac0a7f65d7b75d816986687ae6c3a6cba02d928d184ca71790d488/node_modules/effect/dist/Match.js
|
|
86551
86324
|
/**
|
|
86552
|
-
*
|
|
86553
|
-
*
|
|
86554
|
-
* `Match` turns branching logic into a matcher that is built from ordered
|
|
86555
|
-
* cases and finished with an explicit finalizer. Use `Match.type` to define a
|
|
86556
|
-
* reusable matcher for a type, or `Match.value` to classify one value
|
|
86557
|
-
* immediately. Cases can match literal values, predicates, object patterns,
|
|
86558
|
-
* discriminators, tags, or negated patterns.
|
|
86559
|
-
*
|
|
86560
|
-
* **Mental model**
|
|
86325
|
+
* Builds pattern matchers for TypeScript values.
|
|
86561
86326
|
*
|
|
86562
|
-
*
|
|
86563
|
-
*
|
|
86564
|
-
*
|
|
86565
|
-
*
|
|
86566
|
-
*
|
|
86567
|
-
*
|
|
86568
|
-
*
|
|
86569
|
-
* **Common tasks**
|
|
86570
|
-
*
|
|
86571
|
-
* - Use `Match.type<Union>()` when a branch table should be reusable and
|
|
86572
|
-
* exhaustiveness-checked.
|
|
86573
|
-
* - Use `Match.value(value)` when a single value should be matched immediately.
|
|
86574
|
-
* - Use `Match.tag`, `Match.tags`, or `Match.discriminator` for discriminated
|
|
86575
|
-
* unions and domain objects with tag fields.
|
|
86576
|
-
* - Use `Match.orElse`, `Match.option`, or `Match.result` when unmatched input
|
|
86577
|
-
* should be handled explicitly instead of requiring full exhaustiveness.
|
|
86578
|
-
*
|
|
86579
|
-
* **Example** (Matching a tagged union)
|
|
86580
|
-
*
|
|
86581
|
-
* ```ts
|
|
86582
|
-
* import { Match } from "effect"
|
|
86583
|
-
*
|
|
86584
|
-
* type Event =
|
|
86585
|
-
* | { readonly _tag: "UserCreated"; readonly id: string }
|
|
86586
|
-
* | { readonly _tag: "UserDeleted"; readonly id: string }
|
|
86587
|
-
*
|
|
86588
|
-
* const describe = Match.type<Event>().pipe(
|
|
86589
|
-
* Match.tag("UserCreated", (event) => `created ${event.id}`),
|
|
86590
|
-
* Match.tag("UserDeleted", (event) => `deleted ${event.id}`),
|
|
86591
|
-
* Match.exhaustive
|
|
86592
|
-
* )
|
|
86593
|
-
* ```
|
|
86327
|
+
* `Match` lets you add ordered cases and then finish them with a result,
|
|
86328
|
+
* fallback, `Option`, or exhaustive check. Use `Match.type` to define a
|
|
86329
|
+
* reusable matcher for a type, or `Match.value` to match one value immediately.
|
|
86330
|
+
* Cases can match literal values, predicates, object shapes, tags, negated
|
|
86331
|
+
* patterns, and common checks such as strings, numbers, records, and class
|
|
86332
|
+
* instances.
|
|
86594
86333
|
*
|
|
86595
86334
|
* @since 4.0.0
|
|
86596
86335
|
*/
|
|
@@ -86654,7 +86393,7 @@ const value = value$1;
|
|
|
86654
86393
|
* pattern matches, the associated function is executed and the matched input is
|
|
86655
86394
|
* removed from the remaining cases tracked by the matcher.
|
|
86656
86395
|
*
|
|
86657
|
-
* **Example** (Matching with
|
|
86396
|
+
* **Example** (Matching with values and predicates)
|
|
86658
86397
|
*
|
|
86659
86398
|
* ```ts
|
|
86660
86399
|
* import { Match } from "effect"
|
|
@@ -86704,7 +86443,7 @@ const when = when$1;
|
|
|
86704
86443
|
* `"_tag"` as their discriminator field. Use {@link discriminator} for a
|
|
86705
86444
|
* different discriminator field.
|
|
86706
86445
|
*
|
|
86707
|
-
* **Example** (Matching a
|
|
86446
|
+
* **Example** (Matching a discriminated union by tag)
|
|
86708
86447
|
*
|
|
86709
86448
|
* ```ts
|
|
86710
86449
|
* import { Match } from "effect"
|
|
@@ -86750,7 +86489,7 @@ const tag = tag$1;
|
|
|
86750
86489
|
* `default` clause in a `switch` statement or the final `else` in an `if-else`
|
|
86751
86490
|
* chain.
|
|
86752
86491
|
*
|
|
86753
|
-
* **Example** (Providing a
|
|
86492
|
+
* **Example** (Providing a default value when no patterns match)
|
|
86754
86493
|
*
|
|
86755
86494
|
* ```ts
|
|
86756
86495
|
* import { Match } from "effect"
|
|
@@ -87336,7 +87075,13 @@ const pairCommand = make("pair", {
|
|
|
87336
87075
|
const t3CliEnv = yield* loadT3CliEnv;
|
|
87337
87076
|
const output = yield* T3Output;
|
|
87338
87077
|
const resolvedFormat = resolveOutputFormat(format, cliRuntime, t3CliEnv, "json");
|
|
87339
|
-
const result = yield* auth.pair(
|
|
87078
|
+
const result = yield* auth.pair({
|
|
87079
|
+
pairingUrl: url,
|
|
87080
|
+
clientMetadata: {
|
|
87081
|
+
label: "t3cli",
|
|
87082
|
+
deviceType: "bot"
|
|
87083
|
+
}
|
|
87084
|
+
});
|
|
87340
87085
|
const fallbackName = yield* auth.defaultNameFromUrl(result.url);
|
|
87341
87086
|
const environmentName = yield* persistAuthEnvironment({
|
|
87342
87087
|
explicitName: name,
|
|
@@ -87645,7 +87390,7 @@ const readTerminalCommand = make("read", {
|
|
|
87645
87390
|
terminalId: string("terminal-id"),
|
|
87646
87391
|
history: boolean("history"),
|
|
87647
87392
|
follow: boolean("follow"),
|
|
87648
|
-
fromSequence: integer("from-sequence").pipe(optional$2),
|
|
87393
|
+
fromSequence: integer$1("from-sequence").pipe(optional$2),
|
|
87649
87394
|
format: choice("format", ["json", "ndjson"]).pipe(withDefault("json")),
|
|
87650
87395
|
...extraArgsConfig
|
|
87651
87396
|
}, ({ thread, terminalId, history, follow, fromSequence, format }) => gen(function* () {
|
|
@@ -87683,7 +87428,7 @@ const readTerminalCommand = make("read", {
|
|
|
87683
87428
|
const streamTerminalCommand = make("stream", {
|
|
87684
87429
|
thread: threadFlag,
|
|
87685
87430
|
terminalId: string("terminal-id"),
|
|
87686
|
-
fromSequence: integer("from-sequence").pipe(optional$2),
|
|
87431
|
+
fromSequence: integer$1("from-sequence").pipe(optional$2),
|
|
87687
87432
|
format: choice("format", ["ndjson"]).pipe(withDefault("ndjson")),
|
|
87688
87433
|
...extraArgsConfig
|
|
87689
87434
|
}, ({ thread, terminalId, fromSequence }) => gen(function* () {
|
|
@@ -88952,7 +88697,7 @@ const startThreadCommand = make("start", {
|
|
|
88952
88697
|
//#region src/cli/threads/messages.ts
|
|
88953
88698
|
const getThreadTranscriptCommand = make("transcript", {
|
|
88954
88699
|
thread: threadFlag,
|
|
88955
|
-
limit: integer("limit").pipe(withDefault(20)),
|
|
88700
|
+
limit: integer$1("limit").pipe(withDefault(20)),
|
|
88956
88701
|
full: boolean("full"),
|
|
88957
88702
|
format: formatFlag,
|
|
88958
88703
|
...extraArgsConfig
|
|
@@ -89061,7 +88806,7 @@ var OutputError = class extends TaggedErrorClass()("OutputError", {
|
|
|
89061
88806
|
const T3OutputLive = effect(T3Output, fn("makeT3Output")(function* () {
|
|
89062
88807
|
const stdio = yield* Stdio;
|
|
89063
88808
|
const writeStdout = fn("T3OutputLive.writeStdout")(function* (text) {
|
|
89064
|
-
yield* succeed$5(text).pipe(run$
|
|
88809
|
+
yield* succeed$5(text).pipe(run$2(stdio.stdout()), catchTags({ PlatformError: (error) => fail(new OutputError({
|
|
89065
88810
|
message: "failed to write output",
|
|
89066
88811
|
cause: error
|
|
89067
88812
|
})) }));
|
|
@@ -89069,7 +88814,7 @@ const T3OutputLive = effect(T3Output, fn("makeT3Output")(function* () {
|
|
|
89069
88814
|
return {
|
|
89070
88815
|
writeStdout,
|
|
89071
88816
|
writeStderr: fn("T3OutputLive.writeStderr")(function* (text) {
|
|
89072
|
-
yield* succeed$5(text).pipe(run$
|
|
88817
|
+
yield* succeed$5(text).pipe(run$2(stdio.stderr()), catchTags({ PlatformError: (error) => fail(new OutputError({
|
|
89073
88818
|
message: "failed to write output",
|
|
89074
88819
|
cause: error
|
|
89075
88820
|
})) }));
|
|
@@ -89148,7 +88893,7 @@ var T3Version = class extends Service()("t3cli/T3Version") {};
|
|
|
89148
88893
|
//#endregion
|
|
89149
88894
|
//#region src/version/layer.ts
|
|
89150
88895
|
const PackageJsonSchema = fromJsonString(Struct({ version: String$1 }));
|
|
89151
|
-
const T3VersionBundledLive = sync$1(T3Version, () => ({ version: "0.
|
|
88896
|
+
const T3VersionBundledLive = sync$1(T3Version, () => ({ version: "0.14.0" }));
|
|
89152
88897
|
effect(T3Version, gen(function* () {
|
|
89153
88898
|
const packageJson = yield* (yield* FileSystem).readFileString(fileURLToPath(new URL("../../package.json", import.meta.url)));
|
|
89154
88899
|
return { version: (yield* decodeUnknownEffect(PackageJsonSchema)(packageJson)).version };
|