@capxul/cli 4.20.0-beta.8 → 4.20.0-beta.9
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/dist/main.mjs +46 -34
- package/dist/main.mjs.map +1 -1
- package/package.json +3 -3
package/dist/main.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import process$1, { arch, exit, platform, stderr, versions } from "node:process";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { Cause, Clock, Config, Console, Context, Crypto, Data, Deferred, Duration, Effect, Exit, Fiber, FiberSet, FileSystem, Layer, LogLevel, Logger, Metric, Option, Path, Queue, Redacted, Ref, References, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaParser, Scope, Stdio, Stream, Tracer } from "effect";
|
|
5
|
+
import { Cause, Clock, Config, Console, Context, Crypto, Data, Deferred, Duration, Effect, Exit, Fiber, FiberSet, FileSystem, Layer, LogLevel, Logger, Metric, Option, Path, Queue, Redacted, Ref, References, Result, Schedule, Schema, SchemaGetter, SchemaIssue, SchemaParser, Scope, Stdio, Stream, Terminal, Tracer } from "effect";
|
|
6
6
|
import { NodeRuntime, NodeServices } from "@effect/platform-node";
|
|
7
7
|
import { CliConfig, CliError, Command, Flag, GlobalFlag, Primitive, Prompt } from "effect/unstable/cli";
|
|
8
8
|
import * as nc from "node:crypto";
|
|
@@ -13237,7 +13237,7 @@ function subscribeActivity(deps, actor, controls, onChange) {
|
|
|
13237
13237
|
}
|
|
13238
13238
|
//#endregion
|
|
13239
13239
|
//#region ../../packages/sdk/package.json
|
|
13240
|
-
var version$1 = "4.20.0-beta.
|
|
13240
|
+
var version$1 = "4.20.0-beta.9";
|
|
13241
13241
|
//#endregion
|
|
13242
13242
|
//#region ../../packages/sdk/src/telemetry/exception-projection.ts
|
|
13243
13243
|
/** Fixed fallback for failures that have no safe message. */
|
|
@@ -51695,8 +51695,8 @@ function captureException(telemetry, error, context) {
|
|
|
51695
51695
|
}
|
|
51696
51696
|
//#endregion
|
|
51697
51697
|
//#region src/version.ts
|
|
51698
|
-
const cliVersion = "4.20.0-beta.
|
|
51699
|
-
const sdkVersion = "4.20.0-beta.
|
|
51698
|
+
const cliVersion = "4.20.0-beta.9";
|
|
51699
|
+
const sdkVersion = "4.20.0-beta.9";
|
|
51700
51700
|
const ReleaseVersion = Schema.String.check(Schema.isMaxLength(256), Schema.isPattern(/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/u)).pipe(Schema.brand("CliReleaseVersion"));
|
|
51701
51701
|
const parts = (version) => {
|
|
51702
51702
|
const [core = "", ...prerelease] = version.split("+")[0].split("-");
|
|
@@ -52336,13 +52336,13 @@ const configurationFailure = (message) => new CliFailure({
|
|
|
52336
52336
|
outcome: "refused"
|
|
52337
52337
|
});
|
|
52338
52338
|
function classifyFailure(cause, command) {
|
|
52339
|
-
|
|
52339
|
+
const error = Cause.squash(cause);
|
|
52340
|
+
if (Cause.hasInterruptsOnly(cause) || Terminal.isQuitError(error)) return {
|
|
52340
52341
|
code: "CANCELLED",
|
|
52341
52342
|
message: "The command was interrupted.",
|
|
52342
52343
|
exitCode: 130,
|
|
52343
52344
|
outcome: "cancelled"
|
|
52344
52345
|
};
|
|
52345
|
-
const error = Cause.squash(cause);
|
|
52346
52346
|
if (error instanceof CliFailure) return error;
|
|
52347
52347
|
if (error instanceof StateFileError) return {
|
|
52348
52348
|
code: "CLI_STORAGE",
|
|
@@ -52782,10 +52782,10 @@ function observeInvocation(input, work) {
|
|
|
52782
52782
|
});
|
|
52783
52783
|
yield* Effect.annotateCurrentSpan(completion);
|
|
52784
52784
|
yield* logEngineeringInfo("cli.command.completed", completion);
|
|
52785
|
-
for (const diagnostic of sdkDiagnostics) yield*
|
|
52785
|
+
for (const diagnostic of sdkDiagnostics) yield* logEngineeringInfo("cli.sdk.operation.failed", {
|
|
52786
52786
|
...engineeringEnvelope,
|
|
52787
52787
|
...diagnostic
|
|
52788
|
-
})
|
|
52788
|
+
});
|
|
52789
52789
|
const metricAttributes = {
|
|
52790
52790
|
command: input.command,
|
|
52791
52791
|
capability: input.capability,
|
|
@@ -52975,6 +52975,39 @@ function metadataAtPath(root, path) {
|
|
|
52975
52975
|
};
|
|
52976
52976
|
}
|
|
52977
52977
|
//#endregion
|
|
52978
|
+
//#region src/runtime/format.ts
|
|
52979
|
+
const jsonFlag = Flag.boolean("json").pipe(Flag.withDefault(false), Flag.withDescription("Print a versioned JSON result"));
|
|
52980
|
+
const JsonOutput = GlobalFlag.setting("json")({ flag: jsonFlag });
|
|
52981
|
+
/** Local diagnostics require an explicit debug level. */
|
|
52982
|
+
const localDiagnosticsEnabled = (args) => {
|
|
52983
|
+
const terminator = args.indexOf("--");
|
|
52984
|
+
const flags = terminator < 0 ? args : args.slice(0, terminator);
|
|
52985
|
+
let level;
|
|
52986
|
+
for (const [index, arg] of flags.entries()) if (arg.startsWith("--log-level=")) level = arg.slice(12);
|
|
52987
|
+
else if (arg.startsWith("--logLevel=")) level = arg.slice(11);
|
|
52988
|
+
else if (arg === "--log-level" || arg === "--logLevel") level = flags[index + 1];
|
|
52989
|
+
return level === "debug";
|
|
52990
|
+
};
|
|
52991
|
+
/** Negotiate only the global format before native CLI error rendering.
|
|
52992
|
+
* Native Flag decoding remains the value authority; the command runner parses everything else.
|
|
52993
|
+
*/
|
|
52994
|
+
const outputMode = (args) => Effect.gen(function* () {
|
|
52995
|
+
const terminator = args.indexOf("--");
|
|
52996
|
+
const flags = terminator < 0 ? args : args.slice(0, terminator);
|
|
52997
|
+
const values = [];
|
|
52998
|
+
for (const [index, arg] of flags.entries()) if (arg === "--no-json") values.push("false");
|
|
52999
|
+
else if (arg.startsWith("--json=")) values.push(arg.slice(7));
|
|
53000
|
+
else if (arg === "--json") {
|
|
53001
|
+
const next = flags[index + 1];
|
|
53002
|
+
const value = next === void 0 ? "true" : yield* Primitive.boolean.parse(next).pipe(Effect.as(next), Effect.catch(() => Effect.succeed("true")));
|
|
53003
|
+
values.push(value);
|
|
53004
|
+
}
|
|
53005
|
+
return yield* jsonFlag.parse({
|
|
53006
|
+
flags: { json: values },
|
|
53007
|
+
arguments: []
|
|
53008
|
+
}).pipe(Effect.map(([, json]) => json ? "json" : "human"), Effect.catch(() => Effect.succeed(values.includes("true") ? "json" : "human")));
|
|
53009
|
+
});
|
|
53010
|
+
//#endregion
|
|
52978
53011
|
//#region src/runtime/run-command.ts
|
|
52979
53012
|
var CliRuntime = class extends Context.Service()("capxul-cli/Runtime") {};
|
|
52980
53013
|
const acquireInvocationIdentity = (config, eligible) => Effect.gen(function* () {
|
|
@@ -52996,9 +53029,10 @@ const runInvocation = (runtime, metadata, kind, work, network = false) => Effect
|
|
|
52996
53029
|
yield* Ref.set(runtime.current, invocation);
|
|
52997
53030
|
const config = runtime.observation;
|
|
52998
53031
|
const identity = yield* acquireInvocationIdentity(config, !silent);
|
|
53032
|
+
const debug = localDiagnosticsEnabled(runtime.args ?? []);
|
|
52999
53033
|
let dropped = 0;
|
|
53000
53034
|
let engineeringDropped = 0;
|
|
53001
|
-
|
|
53035
|
+
const observed = observeInvocation({
|
|
53002
53036
|
command: metadata.name,
|
|
53003
53037
|
capability: metadata.capability,
|
|
53004
53038
|
kind: invocationKind,
|
|
@@ -53038,7 +53072,9 @@ const runInvocation = (runtime, metadata, kind, work, network = false) => Effect
|
|
|
53038
53072
|
onFinalize
|
|
53039
53073
|
});
|
|
53040
53074
|
return yield* work(host, onFinalize);
|
|
53041
|
-
}))
|
|
53075
|
+
}));
|
|
53076
|
+
return yield* (debug ? observed : observed.pipe(Effect.provideService(References.MinimumLogLevel, "None"))).pipe(Effect.onExit(() => {
|
|
53077
|
+
if (!debug) return Effect.void;
|
|
53042
53078
|
const notice = (dropped > 0 ? `Telemetry dropped ${dropped} records.\n` : "") + (engineeringDropped > 0 ? `Engineering telemetry dropped ${engineeringDropped} items.\n` : "");
|
|
53043
53079
|
return notice === "" ? Effect.void : writeStderr(notice).pipe(Effect.catchCause(() => Effect.void));
|
|
53044
53080
|
}));
|
|
@@ -53059,7 +53095,6 @@ const runCommand = (options, work) => Effect.gen(function* () {
|
|
|
53059
53095
|
//#endregion
|
|
53060
53096
|
//#region src/platform/capxul.ts
|
|
53061
53097
|
const resultValue = (result) => result.ok ? Effect.succeed(result.value) : Effect.fail(result.error);
|
|
53062
|
-
const localDiagnosticsEnabled = (args) => args.some((arg, index) => arg === "--log-level=debug" || arg === "--logLevel=debug" || (arg === "--log-level" || arg === "--logLevel") && args[index + 1] === "debug");
|
|
53063
53098
|
const acquireClient = (input, onFinalize) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
|
|
53064
53099
|
const runtime = yield* CliRuntime;
|
|
53065
53100
|
const created = yield* restore(Effect.promise(async (signal) => {
|
|
@@ -56441,29 +56476,6 @@ const org = Command.make("org").pipe(Command.annotate(CliCommandMetadata, metada
|
|
|
56441
56476
|
retry
|
|
56442
56477
|
]));
|
|
56443
56478
|
//#endregion
|
|
56444
|
-
//#region src/runtime/format.ts
|
|
56445
|
-
const jsonFlag = Flag.boolean("json").pipe(Flag.withDefault(false), Flag.withDescription("Print a versioned JSON result"));
|
|
56446
|
-
const JsonOutput = GlobalFlag.setting("json")({ flag: jsonFlag });
|
|
56447
|
-
/** Negotiate only the global format before native CLI error rendering.
|
|
56448
|
-
* Native Flag decoding remains the value authority; the command runner parses everything else.
|
|
56449
|
-
*/
|
|
56450
|
-
const outputMode = (args) => Effect.gen(function* () {
|
|
56451
|
-
const terminator = args.indexOf("--");
|
|
56452
|
-
const flags = terminator < 0 ? args : args.slice(0, terminator);
|
|
56453
|
-
const values = [];
|
|
56454
|
-
for (const [index, arg] of flags.entries()) if (arg === "--no-json") values.push("false");
|
|
56455
|
-
else if (arg.startsWith("--json=")) values.push(arg.slice(7));
|
|
56456
|
-
else if (arg === "--json") {
|
|
56457
|
-
const next = flags[index + 1];
|
|
56458
|
-
const value = next === void 0 ? "true" : yield* Primitive.boolean.parse(next).pipe(Effect.as(next), Effect.catch(() => Effect.succeed("true")));
|
|
56459
|
-
values.push(value);
|
|
56460
|
-
}
|
|
56461
|
-
return yield* jsonFlag.parse({
|
|
56462
|
-
flags: { json: values },
|
|
56463
|
-
arguments: []
|
|
56464
|
-
}).pipe(Effect.map(([, json]) => json ? "json" : "human"), Effect.catch(() => Effect.succeed(values.includes("true") ? "json" : "human")));
|
|
56465
|
-
});
|
|
56466
|
-
//#endregion
|
|
56467
56479
|
//#region src/command.ts
|
|
56468
56480
|
const command = Command.make("capxul").pipe(Command.annotate(CliCommandMetadata, {
|
|
56469
56481
|
name: "capxul",
|