@akterjs/cli 0.0.0-stage → 0.1.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.
Files changed (108) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +47 -2
  3. package/dist/Argument-D81dqizB.mjs +57 -0
  4. package/dist/Array-B4kuTQeW.mjs +2323 -0
  5. package/dist/Boolean-kILIvmhE.mjs +26 -0
  6. package/dist/ChildProcess-BCIwxPGc.mjs +577 -0
  7. package/dist/CliError-Cf5xqkkj.mjs +633 -0
  8. package/dist/Command-Dzq9KM-h.mjs +5135 -0
  9. package/dist/Config-B6OND9WR.mjs +854 -0
  10. package/dist/Console-BKHUkH6a.mjs +141 -0
  11. package/dist/Data-CeCULr0-.mjs +251 -0
  12. package/dist/Digest-CBd3uv5B.mjs +348 -0
  13. package/dist/Duration-EH9Vy4U6.mjs +791 -0
  14. package/dist/Effect-CKFpqbmw.mjs +12911 -0
  15. package/dist/FileSystem-4pPcEb_i.mjs +1366 -0
  16. package/dist/HttpClientError-BUeMWx70.mjs +303 -0
  17. package/dist/HttpClientResponse-D5ZKICVV.mjs +855 -0
  18. package/dist/Match-CGPLZYrV.mjs +434 -0
  19. package/dist/MutableHashMap-f8nW8AJR.mjs +376 -0
  20. package/dist/MutableHashSet-_HI572Ya.mjs +155 -0
  21. package/dist/MutableRef-D4Qv592C.mjs +107 -0
  22. package/dist/Number-BvkRkfc-.mjs +137 -0
  23. package/dist/Option-DkxSnBhp.mjs +3967 -0
  24. package/dist/Order-C1JC991I.mjs +481 -0
  25. package/dist/Path-Djdv_eF5.mjs +130 -0
  26. package/dist/Queue-CO5UQ6os.mjs +1394 -0
  27. package/dist/Redacted-RkJrG5Me.mjs +160 -0
  28. package/dist/Ref-BIPOxJNH.mjs +267 -0
  29. package/dist/Runtime-BInIAwK3.mjs +297 -0
  30. package/dist/Schema-MiKt5K1v.mjs +10999 -0
  31. package/dist/SecureRandom-B_U4ysO3.mjs +279 -0
  32. package/dist/Semaphore-DOVJ4ZGS.mjs +177 -0
  33. package/dist/Stdio-KylmOBX_.mjs +74 -0
  34. package/dist/Stream-bK9QIETN.mjs +4012 -0
  35. package/dist/String-q5dcsVe4.mjs +351 -0
  36. package/dist/TerminalCapabilities-w_44MAca.mjs +1769 -0
  37. package/dist/WebCrypto-ZI_GNVlw.mjs +33 -0
  38. package/dist/actor-call.service-CGM_vD9u.mjs +1269 -0
  39. package/dist/actor-client.adapter-Coem7gF1.mjs +3691 -0
  40. package/dist/akter-program.config-C4cXx4Fr.mjs +7034 -0
  41. package/dist/akter.cli.mjs +5 -0
  42. package/dist/app-cli.config.mjs +49 -0
  43. package/dist/app-entry.pure.mjs +31 -0
  44. package/dist/archive/akter-archive.schema.mjs +65 -0
  45. package/dist/archive/akter-archive.service.mjs +309 -0
  46. package/dist/archive/archive-cli.config.mjs +45 -0
  47. package/dist/archive/archive-invalid.errors.mjs +5 -0
  48. package/dist/archive/archived-lineage.pure.mjs +13 -0
  49. package/dist/archive/tar.pure.mjs +291 -0
  50. package/dist/archive/zstd.adapter.mjs +46 -0
  51. package/dist/bench/bench-report.pure.mjs +120 -0
  52. package/dist/bench/bench-runner.pure.mjs +89 -0
  53. package/dist/bench/bench.service.mjs +301 -0
  54. package/dist/cli-runtime.layer-BqK2mmVL.mjs +1191 -0
  55. package/dist/cli-runtime.layer.mjs +1 -0
  56. package/dist/cloud-client.adapter-Cy1BjDbG.mjs +3186 -0
  57. package/dist/cloud-client.adapter-DOVMoYAj.mjs +304 -0
  58. package/dist/command/akter-commands.config.mjs +32 -0
  59. package/dist/command/akter-program.config.mjs +1 -0
  60. package/dist/credentials/credentials.service.mjs +226 -0
  61. package/dist/credentials/keychain.adapter.mjs +92 -0
  62. package/dist/credentials/login.config.mjs +251 -0
  63. package/dist/deploy/auth/api-attempt.service.mjs +30 -0
  64. package/dist/deploy/auth/token-refresh.errors.mjs +4 -0
  65. package/dist/deploy/build-bundle.adapter.mjs +133 -0
  66. package/dist/deploy/build-manifest.pure.mjs +44 -0
  67. package/dist/deploy/cloud-client.adapter.mjs +1 -0
  68. package/dist/deploy/cloud-url.pure.mjs +17 -0
  69. package/dist/deploy/deploy-failed.errors.mjs +17 -0
  70. package/dist/deploy/deploy.service.mjs +156 -0
  71. package/dist/deploy/request-failure.pure.mjs +87 -0
  72. package/dist/dev-runner.pure.mjs +30 -0
  73. package/dist/docs/doc-topics.pure.mjs +21 -0
  74. package/dist/docs/docs.config.mjs +1 -0
  75. package/dist/docs.config-_21Xi6HU.mjs +190 -0
  76. package/dist/export/actor-export.service.mjs +267 -0
  77. package/dist/export/export-failed.errors.mjs +4 -0
  78. package/dist/export/export-failure.pure.mjs +18 -0
  79. package/dist/export/ordered-lines.pure.mjs +43 -0
  80. package/dist/export/ranged-download.pure.mjs +66 -0
  81. package/dist/export/snapshot-download.pure.mjs +86 -0
  82. package/dist/history-runner.pure.mjs +186 -0
  83. package/dist/history-since.pure.mjs +17 -0
  84. package/dist/hosted-runtime.layer-Cx3IPsEd.mjs +16358 -0
  85. package/dist/local/environment-cli.config.mjs +90 -0
  86. package/dist/local/environment-runner.pure.mjs +75 -0
  87. package/dist/local/local-cli.config.mjs +159 -0
  88. package/dist/logs/log-follow.config.mjs +21 -0
  89. package/dist/logs/log-follow.service.mjs +87 -0
  90. package/dist/logs/log-lines.pure.mjs +44 -0
  91. package/dist/migrate-runner.pure.mjs +28 -0
  92. package/dist/operation-input.pure-CS9iUhqK.mjs +1383 -0
  93. package/dist/operation-registry.pure-DVC8EDgj.mjs +283 -0
  94. package/dist/registry/actor-call.service.mjs +1 -0
  95. package/dist/registry/actor-commands.config.mjs +127 -0
  96. package/dist/registry/actor-refusal.pure.mjs +34 -0
  97. package/dist/registry/approval.service.mjs +80 -0
  98. package/dist/registry/cloud-commands.config.mjs +151 -0
  99. package/dist/registry/cloud-served.pure.mjs +31 -0
  100. package/dist/registry/operation-call.service.mjs +262 -0
  101. package/dist/registry/operation-input.pure.mjs +1 -0
  102. package/dist/registry/operation-output.pure.mjs +91 -0
  103. package/dist/registry/served-command.config.mjs +57 -0
  104. package/dist/runner-exited.errors.mjs +10 -0
  105. package/dist/terminal/cli-exit.errors.mjs +38 -0
  106. package/dist/terminal/cli-failure.pure.mjs +31 -0
  107. package/dist/terminal/confirm.adapter.mjs +27 -0
  108. package/package.json +61 -3
@@ -0,0 +1,297 @@
1
+ import { Or as isSuccess, Rt as runFork, at as isEffect, ci as squash, gn as void_, nn as tapCause, qr as hasInterruptsOnly, st as logError, yn as withFiber } from "./Effect-CKFpqbmw.mjs";
2
+ import { bn as dual, vn as constVoid } from "./Option-DkxSnBhp.mjs";
3
+ // ../../node_modules/.pnpm/effect@4.1.2_patch_hash=0e61176203bb1256381ce1c5b488d7951983ce38ff698647d3f4617383abbf07/node_modules/effect/dist/Runtime.js
4
+ /**
5
+ * Helpers for turning an `Effect` program into a host application's main entry
6
+ * point. This module is the low-level layer used by platform adapters to run a
7
+ * main effect, observe its fiber, report unhandled failures, and translate the
8
+ * resulting `Exit` into an application or process exit code. It provides
9
+ * `makeRunMain`, the default teardown behavior, and error markers for custom
10
+ * exit codes and already-reported failures. Application code usually calls the
11
+ * platform-provided runner instead of using this module directly.
12
+ *
13
+ * @stability stable
14
+ * @since 4.0.0
15
+ */
16
+ /**
17
+ * The default teardown function that determines exit codes from an Effect exit.
18
+ *
19
+ * **When to use**
20
+ *
21
+ * Use as the standard teardown for main programs with conventional process
22
+ * exit codes and support for {@link errorExitCode}.
23
+ *
24
+ * **Details**
25
+ *
26
+ * This teardown follows these exit-code rules:
27
+ *
28
+ * - `0` for successful completion.
29
+ * - `130` for interruption-only failures.
30
+ * - The squashed error's {@link errorExitCode} value for other failures when
31
+ * present.
32
+ * - `1` for other failures.
33
+ *
34
+ * **Gotchas**
35
+ *
36
+ * The `130` code is used only when the Cause contains interruptions and no
37
+ * other failure reasons. Mixed causes use the squashed error path instead.
38
+ *
39
+ * **Example** (Referencing default teardown)
40
+ *
41
+ * ```ts import.meta.vitest
42
+ * import { Exit, Runtime } from "effect"
43
+ *
44
+ * const exitCodes: Array<number> = []
45
+ * const collectExitCode = (exit: Exit.Exit<any, any>) =>
46
+ * Runtime.defaultTeardown(exit, (code) => exitCodes.push(code))
47
+ *
48
+ * collectExitCode(Exit.succeed(42))
49
+ * collectExitCode(Exit.fail("error"))
50
+ * collectExitCode(Exit.interrupt(123))
51
+ *
52
+ * exitCodes // => [0, 1, 130]
53
+ * ```
54
+ *
55
+ * @see {@link errorExitCode} for customizing failure exit codes
56
+ *
57
+ * @stability stable
58
+ * @category running
59
+ * @since 4.0.0
60
+ */
61
+ const defaultTeardown = (exit, onExit) => {
62
+ if (isSuccess(exit)) return onExit(0);
63
+ if (hasInterruptsOnly(exit.cause)) return onExit(130);
64
+ return onExit(getErrorExitCode(squash(exit.cause)));
65
+ };
66
+ /**
67
+ * Creates a platform-specific main program runner that handles Effect execution lifecycle.
68
+ *
69
+ * **When to use**
70
+ *
71
+ * Use when building a runtime adapter for a host platform.
72
+ *
73
+ * **Details**
74
+ *
75
+ * The setup function runs before user code and receives the main fiber and a
76
+ * teardown callback to install platform-specific signal handlers, observers,
77
+ * and exit behavior.
78
+ *
79
+ * Most applications should use a platform-provided runner, such as
80
+ * `NodeRuntime.runMain`, rather than constructing one directly.
81
+ *
82
+ * `disableErrorReporting` disables the automatic log emitted for unreported
83
+ * non-interruption failures. It does not change exit-code calculation or the
84
+ * custom teardown callback.
85
+ *
86
+ * **Gotchas**
87
+ *
88
+ * The setup function is responsible for observing the fiber and eventually
89
+ * invoking teardown. `makeRunMain` also tries to keep the host process alive
90
+ * with a long interval while the main fiber is running; if the host blocks
91
+ * timers, the runner still starts but cannot use that keep-alive fallback.
92
+ *
93
+ * **Example** (Creating platform runners)
94
+ *
95
+ * ```ts import.meta.vitest
96
+ * import { Effect, Exit, Runtime } from "effect"
97
+ *
98
+ * const events: Array<string> = []
99
+ * const completed = new Promise<readonly [Exit.Exit<unknown, unknown>, number]>((resolve) => {
100
+ * // Create a simple runner for a hypothetical platform
101
+ * const runMain = Runtime.makeRunMain(({ fiber, teardown }) => {
102
+ * // Handle fiber completion
103
+ * fiber.addObserver((exit) => {
104
+ * teardown(exit, (code) => resolve([exit, code]))
105
+ * })
106
+ * })
107
+ *
108
+ * // Use the runner
109
+ * const program = Effect.sync(() => {
110
+ * events.push("Starting program", "Program completed")
111
+ * return "success"
112
+ * })
113
+ *
114
+ * runMain(program, {
115
+ * teardown: (exit, onExit) => {
116
+ * events.push("Custom teardown logic")
117
+ * Runtime.defaultTeardown(exit, onExit)
118
+ * }
119
+ * })
120
+ * })
121
+ *
122
+ * const result = await completed
123
+ * result // => [Exit.succeed("success"), 0]
124
+ * events // => ["Starting program", "Program completed", "Custom teardown logic"]
125
+ * ```
126
+ *
127
+ * @stability stable
128
+ * @category running
129
+ * @since 4.0.0
130
+ */
131
+ const makeRunMain = (f) => dual((args) => isEffect(args[0]), (effect, options) => {
132
+ const main = options?.disableErrorReporting === true ? effect : tapCause(effect, (cause) => {
133
+ if (hasInterruptsOnly(cause)) return void_;
134
+ return getErrorReported(squash(cause)) ? logError(cause) : void_;
135
+ });
136
+ const teardown = options?.teardown ?? defaultTeardown;
137
+ runFork(withFiber((fiber) => {
138
+ try {
139
+ const keepAlive = globalThis.setInterval(constVoid, 2147483647);
140
+ fiber.addObserver(() => {
141
+ clearInterval(keepAlive);
142
+ });
143
+ } catch {}
144
+ f({
145
+ fiber,
146
+ teardown
147
+ });
148
+ return main;
149
+ }));
150
+ });
151
+ /**
152
+ * Allows associating an exit code with an error for determining the process
153
+ * exit code on failure.
154
+ *
155
+ * **When to use**
156
+ *
157
+ * Use when error classes should map failures to a specific process exit code
158
+ * when handled by {@link defaultTeardown}.
159
+ *
160
+ * **Details**
161
+ *
162
+ * Attach this marker as a readonly property on an error object. When the main
163
+ * program fails, {@link defaultTeardown} squashes the Cause and reads the marker
164
+ * from the resulting error value.
165
+ *
166
+ * **Gotchas**
167
+ *
168
+ * The marker is read from the squashed failure value. If a Cause contains
169
+ * multiple failures, the selected squashed error determines the exit code.
170
+ *
171
+ * **Example** (Setting a process exit code)
172
+ *
173
+ * ```ts import.meta.vitest
174
+ * import { Data, Runtime } from "effect"
175
+ *
176
+ * class MyError extends Data.TaggedError("MyError") {
177
+ * readonly [Runtime.errorExitCode] = 42
178
+ * }
179
+ *
180
+ * Runtime.getErrorExitCode(new MyError()) // => 42
181
+ * ```
182
+ *
183
+ * @see {@link errorReported} for controlling automatic error logging
184
+ * @see {@link defaultTeardown} for the default failure exit-code rules that read this marker
185
+ * @see {@link getErrorExitCode} for reading the marker from unknown error values
186
+ *
187
+ * @stability stable
188
+ * @category symbols
189
+ * @since 4.0.0
190
+ */
191
+ const errorExitCode = "~effect/Runtime/errorExitCode";
192
+ /**
193
+ * Reads the runtime exit-code marker from an unknown error value.
194
+ *
195
+ * **When to use**
196
+ *
197
+ * Use to read a custom failure exit code from an unknown error value, falling
198
+ * back to the default failure code.
199
+ *
200
+ * **Details**
201
+ *
202
+ * Returns the numeric `[Runtime.errorExitCode]` property when it is present on
203
+ * an object. Otherwise returns `1`, the default failure exit code used by
204
+ * `defaultTeardown`.
205
+ *
206
+ * **Gotchas**
207
+ *
208
+ * Non-object values, missing markers, and non-number marker values all return
209
+ * `1`.
210
+ *
211
+ * @see {@link errorExitCode} for the marker read by this function
212
+ *
213
+ * @stability stable
214
+ * @category getters
215
+ * @since 4.0.0
216
+ */
217
+ const getErrorExitCode = (u) => {
218
+ if (typeof u === "object" && u !== null && "~effect/Runtime/errorExitCode" in u) {
219
+ const code = u[errorExitCode];
220
+ if (typeof code === "number") return code;
221
+ }
222
+ return 1;
223
+ };
224
+ /**
225
+ * Defines the runtime marker that controls default `runMain` error logging for an error.
226
+ *
227
+ * **When to use**
228
+ *
229
+ * Use when you need error classes reported by application code to avoid being
230
+ * logged again by the default main runner.
231
+ *
232
+ * **Details**
233
+ *
234
+ * Set `[Runtime.errorReported]` to `false` on an error object to suppress the
235
+ * runtime log because the error has already been reported. Omitted or
236
+ * non-boolean values are treated as `true`, so failures are logged by default.
237
+ *
238
+ * **Gotchas**
239
+ *
240
+ * This marker controls only automatic error logging. It does not change the
241
+ * failure Cause or the process exit code.
242
+ * `makeRunMain` reads the marker from `Cause.squash(cause)`, so for causes
243
+ * with multiple failures, the squashed error determines whether default logging
244
+ * is suppressed.
245
+ *
246
+ * **Example** (Suppressing error reporting)
247
+ *
248
+ * ```ts import.meta.vitest
249
+ * import { Data, Runtime } from "effect"
250
+ *
251
+ * class MyError extends Data.TaggedError("MyError") {
252
+ * readonly [Runtime.errorReported] = false
253
+ * }
254
+ *
255
+ * Runtime.getErrorReported(new MyError()) // => false
256
+ * ```
257
+ *
258
+ * @see {@link errorExitCode} for controlling failure exit codes
259
+ * @see {@link getErrorReported} for reading the marker from unknown error values
260
+ *
261
+ * @stability stable
262
+ * @category symbols
263
+ * @since 4.0.0
264
+ */
265
+ const errorReported = "~effect/Runtime/errorReported";
266
+ /**
267
+ * Reads the runtime error-reporting marker from an unknown error value.
268
+ *
269
+ * **When to use**
270
+ *
271
+ * Use to read whether an unknown error value should be treated as already
272
+ * reported by the default main runner.
273
+ *
274
+ * **Details**
275
+ *
276
+ * Returns a boolean `[Runtime.errorReported]` property when it is present on an
277
+ * object. Otherwise returns `true`, so failures are logged by default.
278
+ *
279
+ * **Gotchas**
280
+ *
281
+ * Non-object values, missing markers, and non-boolean marker values all return
282
+ * `true`.
283
+ *
284
+ * @see {@link errorReported} for the marker read by this function
285
+ *
286
+ * @stability stable
287
+ * @category getters
288
+ * @since 4.0.0
289
+ */
290
+ const getErrorReported = (u) => {
291
+ if (typeof u === "object" && u !== null && "~effect/Runtime/errorReported" in u) {
292
+ const isReported = u[errorReported];
293
+ if (typeof isReported === "boolean") return isReported;
294
+ }
295
+ return true;
296
+ };
297
+ export { makeRunMain as i, errorReported as n, getErrorExitCode as r, errorExitCode as t };