@sylphx/cli 0.14.0 → 0.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/main.js +183 -34
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @sylphx/cli
|
|
2
2
|
|
|
3
|
+
## 0.14.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1230](https://github.com/SylphxAI/platform/pull/1230) [`793ff13`](https://github.com/SylphxAI/platform/commit/793ff1302e87c3578e70ee5a9ebdc131a69dde82) Thanks [@shtse8](https://github.com/shtse8)! - Make `sylphx org` a first-class alias, prefer the linked project's organization before the stored default org, and suppress `[object Object]` for CLI parse errors.
|
|
8
|
+
|
|
9
|
+
- [#1225](https://github.com/SylphxAI/platform/pull/1225) [`54efb0f`](https://github.com/SylphxAI/platform/commit/54efb0f69827ca9fa80e60506f456223cabaeb00) Thanks [@shtse8](https://github.com/shtse8)! - Revalidate cached positive update notices against npm latest before printing exact target versions.
|
|
10
|
+
|
|
3
11
|
## 0.14.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/dist/main.js
CHANGED
|
@@ -15,7 +15,7 @@ var init_package = __esm({
|
|
|
15
15
|
"package.json"() {
|
|
16
16
|
package_default = {
|
|
17
17
|
name: "@sylphx/cli",
|
|
18
|
-
version: "0.14.
|
|
18
|
+
version: "0.14.1",
|
|
19
19
|
description: "Sylphx Platform CLI \u2014 deploy and manage your applications from the terminal. 63 commands across deployment, logs, env vars, domains, databases, storage, monitoring, self-service (user), admin (users/quotas/audit/invitations/jwt-keys/project-migrate), and more.",
|
|
20
20
|
type: "module",
|
|
21
21
|
homepage: "https://sylphx.com",
|
|
@@ -12249,7 +12249,14 @@ var init_project_manifest = __esm({
|
|
|
12249
12249
|
* apps that need one migration/release hook tied to a specific image.
|
|
12250
12250
|
*/
|
|
12251
12251
|
release_command: Schema91.optional(Schema91.String),
|
|
12252
|
-
/**
|
|
12252
|
+
/**
|
|
12253
|
+
* Advanced internal app listen-port override.
|
|
12254
|
+
*
|
|
12255
|
+
* Public URLs never expose this value — HTTP(S) remains 80/443 via platform
|
|
12256
|
+
* routing. When omitted for `type="web"`, the platform injects a default PORT
|
|
12257
|
+
* and wires the runtime to it.
|
|
12258
|
+
* `type="worker"` services must omit the field.
|
|
12259
|
+
*/
|
|
12253
12260
|
port: Schema91.optional(Schema91.Number.pipe(Schema91.int(), Schema91.between(1, 65535))),
|
|
12254
12261
|
/** Explicit instance count. */
|
|
12255
12262
|
instances: Schema91.optional(ManifestServiceInstanceCount),
|
|
@@ -12379,6 +12386,7 @@ var init_project_manifest = __esm({
|
|
|
12379
12386
|
name: Slug2,
|
|
12380
12387
|
type: Schema91.optional(ServiceType),
|
|
12381
12388
|
command: Schema91.optional(Schema91.String),
|
|
12389
|
+
/** Advanced internal app listen-port override; see ManifestServiceSection.port. */
|
|
12382
12390
|
port: Schema91.optional(Schema91.Number.pipe(Schema91.int(), Schema91.between(1, 65535))),
|
|
12383
12391
|
instances: Schema91.optional(ManifestServiceInstanceCount),
|
|
12384
12392
|
instance_type: Schema91.optional(MachineSize),
|
|
@@ -18758,6 +18766,13 @@ function readLinkedProject(filePath) {
|
|
|
18758
18766
|
...orgSlug ? { orgSlug } : {}
|
|
18759
18767
|
};
|
|
18760
18768
|
}
|
|
18769
|
+
function readProjectManifestOrg(filePath) {
|
|
18770
|
+
const manifest = parseManifestFile(filePath);
|
|
18771
|
+
const project = getProjectSection(manifest, filePath);
|
|
18772
|
+
if (!project) return void 0;
|
|
18773
|
+
const org = readString("project", project, "org")?.trim();
|
|
18774
|
+
return org && org.length > 0 ? org : void 0;
|
|
18775
|
+
}
|
|
18761
18776
|
function requireLinkMetadata(link, key) {
|
|
18762
18777
|
const value = link[key];
|
|
18763
18778
|
if (typeof value === "string" && value.length > 0) return value;
|
|
@@ -18924,6 +18939,10 @@ var init_config = __esm({
|
|
|
18924
18939
|
const manifestPath = findManifestPath(dir ?? process.cwd());
|
|
18925
18940
|
return manifestPath ? readLinkedProject(manifestPath) : void 0;
|
|
18926
18941
|
},
|
|
18942
|
+
getProjectManifestOrg(dir) {
|
|
18943
|
+
const manifestPath = findManifestPath(dir ?? process.cwd());
|
|
18944
|
+
return manifestPath ? readProjectManifestOrg(manifestPath) : void 0;
|
|
18945
|
+
},
|
|
18927
18946
|
linkProject(link, dir) {
|
|
18928
18947
|
writeLinkedProject(link, dir ?? process.cwd());
|
|
18929
18948
|
},
|
|
@@ -19358,6 +19377,8 @@ function resolvePreferredOrgId() {
|
|
|
19358
19377
|
const value = process.env[key]?.trim();
|
|
19359
19378
|
if (value) return value;
|
|
19360
19379
|
}
|
|
19380
|
+
const linked = config.getLinkedProject();
|
|
19381
|
+
if (linked?.orgId) return linked.orgId;
|
|
19361
19382
|
return config.getDefaultOrg();
|
|
19362
19383
|
}
|
|
19363
19384
|
function mapRefreshFailure(cause) {
|
|
@@ -19966,7 +19987,7 @@ var init_oidc4 = __esm({
|
|
|
19966
19987
|
|
|
19967
19988
|
// src/main.ts
|
|
19968
19989
|
init_package();
|
|
19969
|
-
import { Command as Command71 } from "@effect/cli";
|
|
19990
|
+
import { Command as Command71, HelpDoc, ValidationError } from "@effect/cli";
|
|
19970
19991
|
import { BunContext, BunRuntime } from "@effect/platform-bun";
|
|
19971
19992
|
import { Console as Console71, Effect as Effect81, Layer as Layer5 } from "effect";
|
|
19972
19993
|
|
|
@@ -20747,6 +20768,7 @@ var ConfigServiceLive = Layer3.succeed(ConfigService, {
|
|
|
20747
20768
|
getDefaultOrg: Effect8.sync(() => config.getDefaultOrg()),
|
|
20748
20769
|
setDefaultOrg: (org) => Effect8.sync(() => config.setDefaultOrg(org)),
|
|
20749
20770
|
getLinkedProject: (dir) => Effect8.sync(() => config.getLinkedProject(dir)),
|
|
20771
|
+
getProjectManifestOrg: (dir) => Effect8.sync(() => config.getProjectManifestOrg(dir)),
|
|
20750
20772
|
linkProject: (link, dir) => Effect8.sync(() => config.linkProject(link, dir)),
|
|
20751
20773
|
unlinkProject: (dir) => Effect8.sync(() => config.unlinkProject(dir)),
|
|
20752
20774
|
getConfigPath: Effect8.sync(() => config.getConfigPath()),
|
|
@@ -26392,29 +26414,45 @@ async function fetchLatestVersion() {
|
|
|
26392
26414
|
return void 0;
|
|
26393
26415
|
}
|
|
26394
26416
|
}
|
|
26395
|
-
async function
|
|
26396
|
-
|
|
26397
|
-
const
|
|
26398
|
-
const
|
|
26399
|
-
|
|
26400
|
-
let latest = cache?.latestKnown ?? void 0;
|
|
26417
|
+
async function resolveLatestVersionForNotice(opts) {
|
|
26418
|
+
const fetchLatest = opts.fetchLatestVersion ?? fetchLatestVersion;
|
|
26419
|
+
const persistCache = opts.writeCache ?? writeCache;
|
|
26420
|
+
const hitRegistry = shouldHitRegistry(opts.now, opts.cache);
|
|
26421
|
+
let latest = opts.cache?.latestKnown ?? void 0;
|
|
26401
26422
|
if (hitRegistry) {
|
|
26402
|
-
const fetched = await
|
|
26423
|
+
const fetched = await fetchLatest();
|
|
26424
|
+
latest = fetched;
|
|
26425
|
+
persistCache({
|
|
26426
|
+
lastCheck: opts.now,
|
|
26427
|
+
latestKnown: fetched ?? null
|
|
26428
|
+
});
|
|
26429
|
+
} else if (latest && compareSemver(opts.current, latest) < 0) {
|
|
26430
|
+
const fetched = await fetchLatest();
|
|
26403
26431
|
latest = fetched;
|
|
26404
|
-
|
|
26405
|
-
lastCheck: now,
|
|
26432
|
+
persistCache({
|
|
26433
|
+
lastCheck: opts.now,
|
|
26406
26434
|
latestKnown: fetched ?? null
|
|
26407
26435
|
});
|
|
26408
26436
|
}
|
|
26409
|
-
if (!latest) return;
|
|
26437
|
+
if (!latest) return void 0;
|
|
26438
|
+
return compareSemver(opts.current, latest) < 0 ? latest : void 0;
|
|
26439
|
+
}
|
|
26440
|
+
async function runUpdateCheck() {
|
|
26441
|
+
if (!shouldRunUpdateCheckForInvocation()) return;
|
|
26442
|
+
const now = Date.now();
|
|
26443
|
+
const cache = readCache();
|
|
26410
26444
|
const current2 = currentCliVersion();
|
|
26411
|
-
|
|
26412
|
-
|
|
26413
|
-
|
|
26445
|
+
const latest = await resolveLatestVersionForNotice({
|
|
26446
|
+
current: current2,
|
|
26447
|
+
now,
|
|
26448
|
+
cache
|
|
26449
|
+
});
|
|
26450
|
+
if (!latest) return;
|
|
26451
|
+
process.stderr.write(
|
|
26452
|
+
`
|
|
26414
26453
|
[sylphx] Update available: ${current2} \u2192 ${latest}. Run \`bun add -g @sylphx/cli@latest\` (or \`npm i -g @sylphx/cli\`) to upgrade. Set SYLPHX_NO_UPDATE_CHECK=1 to silence.
|
|
26415
26454
|
`
|
|
26416
|
-
|
|
26417
|
-
}
|
|
26455
|
+
);
|
|
26418
26456
|
}
|
|
26419
26457
|
|
|
26420
26458
|
// src/programs/doctor.ts
|
|
@@ -31677,14 +31715,10 @@ var orgsShowEffect = orgsShowEffectWith("pretty");
|
|
|
31677
31715
|
function orgsShowEffectWith(output) {
|
|
31678
31716
|
return Effect48.gen(function* () {
|
|
31679
31717
|
yield* requireAuthEffect;
|
|
31680
|
-
const
|
|
31681
|
-
const [org, me] = yield* withSpinner(
|
|
31682
|
-
"Fetching org info...",
|
|
31683
|
-
Effect48.all([api2.getCurrentOrg, api2.whoami])
|
|
31684
|
-
);
|
|
31718
|
+
const { org, orgs } = yield* withSpinner("Fetching org info...", resolveOrgDisplayContext);
|
|
31685
31719
|
const formatter = makeFormatter(output);
|
|
31686
31720
|
yield* formatter.print(
|
|
31687
|
-
{ org, orgs
|
|
31721
|
+
{ org, orgs },
|
|
31688
31722
|
() => Effect48.gen(function* () {
|
|
31689
31723
|
yield* Console38.log("");
|
|
31690
31724
|
yield* Console38.log(chalk_default.bold(" Organization"));
|
|
@@ -31693,9 +31727,9 @@ function orgsShowEffectWith(output) {
|
|
|
31693
31727
|
yield* Console38.log(` ${chalk_default.bold("Slug")} ${chalk_default.cyan(org.slug)}`);
|
|
31694
31728
|
yield* Console38.log(` ${chalk_default.bold("ID")} ${chalk_default.dim(org.id)}`);
|
|
31695
31729
|
yield* Console38.log("");
|
|
31696
|
-
if (
|
|
31697
|
-
yield* Console38.log(chalk_default.dim(` You are a member of ${
|
|
31698
|
-
for (const o of
|
|
31730
|
+
if (orgs.length > 1) {
|
|
31731
|
+
yield* Console38.log(chalk_default.dim(` You are a member of ${orgs.length} organizations:`));
|
|
31732
|
+
for (const o of orgs) {
|
|
31699
31733
|
const isCurrent = o.id === org.id;
|
|
31700
31734
|
yield* Console38.log(
|
|
31701
31735
|
` ${isCurrent ? chalk_default.green("\u2192") : " "} ${chalk_default.bold(o.name)} ${chalk_default.dim(`(${o.slug})`)}`
|
|
@@ -31707,10 +31741,51 @@ function orgsShowEffectWith(output) {
|
|
|
31707
31741
|
);
|
|
31708
31742
|
});
|
|
31709
31743
|
}
|
|
31744
|
+
var resolveOrgDisplayContext = Effect48.gen(function* () {
|
|
31745
|
+
const api2 = yield* ApiService;
|
|
31746
|
+
const cfg = yield* ConfigService;
|
|
31747
|
+
const linked = yield* cfg.getLinkedProject();
|
|
31748
|
+
if (linked) {
|
|
31749
|
+
const me2 = yield* api2.whoami;
|
|
31750
|
+
const org2 = findOrg3(me2.orgs, linked.orgId, linked.orgSlug);
|
|
31751
|
+
if (!org2) {
|
|
31752
|
+
return yield* Effect48.fail(
|
|
31753
|
+
new CliCommandError({
|
|
31754
|
+
command: "orgs",
|
|
31755
|
+
reason: "no-org",
|
|
31756
|
+
message: `Linked project organization '${linked.orgSlug ?? linked.orgId}' was not found for the current account.`
|
|
31757
|
+
})
|
|
31758
|
+
);
|
|
31759
|
+
}
|
|
31760
|
+
return { org: { ...org2, email: null }, orgs: me2.orgs };
|
|
31761
|
+
}
|
|
31762
|
+
const manifestOrg = cfg.getProjectManifestOrg ? yield* cfg.getProjectManifestOrg() : void 0;
|
|
31763
|
+
if (manifestOrg) {
|
|
31764
|
+
const me2 = yield* api2.whoami;
|
|
31765
|
+
const org2 = findOrg3(me2.orgs, manifestOrg);
|
|
31766
|
+
if (!org2) {
|
|
31767
|
+
return yield* Effect48.fail(
|
|
31768
|
+
new CliCommandError({
|
|
31769
|
+
command: "orgs",
|
|
31770
|
+
reason: "no-org",
|
|
31771
|
+
message: `Project manifest organization '${manifestOrg}' was not found for the current account.`
|
|
31772
|
+
})
|
|
31773
|
+
);
|
|
31774
|
+
}
|
|
31775
|
+
return { org: { ...org2, email: null }, orgs: me2.orgs };
|
|
31776
|
+
}
|
|
31777
|
+
const [org, me] = yield* Effect48.all([api2.getCurrentOrg, api2.whoami]);
|
|
31778
|
+
return { org, orgs: me.orgs };
|
|
31779
|
+
});
|
|
31780
|
+
var resolveActiveOrg = Effect48.map(resolveOrgDisplayContext, ({ org }) => org);
|
|
31781
|
+
function findOrg3(orgs, primaryRef, secondaryRef) {
|
|
31782
|
+
const refs = new Set([primaryRef, secondaryRef].filter((ref) => Boolean(ref)));
|
|
31783
|
+
return orgs.find((candidate) => refs.has(candidate.id) || refs.has(candidate.slug));
|
|
31784
|
+
}
|
|
31710
31785
|
var membersListEffect = Effect48.gen(function* () {
|
|
31711
31786
|
yield* requireAuthEffect;
|
|
31712
31787
|
const api2 = yield* ApiService;
|
|
31713
|
-
const org = yield*
|
|
31788
|
+
const org = yield* resolveActiveOrg;
|
|
31714
31789
|
const members = yield* withSpinner("Fetching members...", api2.listOrgMembers(org.id));
|
|
31715
31790
|
if (members.length === 0) {
|
|
31716
31791
|
yield* Console38.log(chalk_default.dim("\n No members found.\n"));
|
|
@@ -31748,7 +31823,7 @@ function membersInviteEffect(input) {
|
|
|
31748
31823
|
}
|
|
31749
31824
|
yield* requireAuthEffect;
|
|
31750
31825
|
const api2 = yield* ApiService;
|
|
31751
|
-
const org = yield*
|
|
31826
|
+
const org = yield* resolveActiveOrg;
|
|
31752
31827
|
yield* withSpinner(
|
|
31753
31828
|
`Inviting ${input.email}...`,
|
|
31754
31829
|
api2.inviteOrgMember(org.id, input.email, input.role)
|
|
@@ -31765,7 +31840,7 @@ function membersRemoveEffect(userId) {
|
|
|
31765
31840
|
return Effect48.gen(function* () {
|
|
31766
31841
|
yield* requireAuthEffect;
|
|
31767
31842
|
const api2 = yield* ApiService;
|
|
31768
|
-
const org = yield*
|
|
31843
|
+
const org = yield* resolveActiveOrg;
|
|
31769
31844
|
yield* withSpinner(`Removing member ${userId}...`, api2.removeOrgMember(org.id, userId));
|
|
31770
31845
|
yield* Console38.log(
|
|
31771
31846
|
chalk_default.green(`\u2713 Removed member ${chalk_default.bold(userId)} from ${chalk_default.bold(org.name)}`)
|
|
@@ -31785,7 +31860,7 @@ function membersSetRoleEffect(input) {
|
|
|
31785
31860
|
}
|
|
31786
31861
|
yield* requireAuthEffect;
|
|
31787
31862
|
const api2 = yield* ApiService;
|
|
31788
|
-
const org = yield*
|
|
31863
|
+
const org = yield* resolveActiveOrg;
|
|
31789
31864
|
const needsConfirm = !input.yes && (input.role === "super_admin" || input.role === "admin");
|
|
31790
31865
|
if (needsConfirm) {
|
|
31791
31866
|
const ok = yield* confirmEffect(
|
|
@@ -31851,7 +31926,7 @@ var orgsBillingEffect = Effect48.gen(function* () {
|
|
|
31851
31926
|
const api2 = yield* ApiService;
|
|
31852
31927
|
const [org, snap] = yield* withSpinner(
|
|
31853
31928
|
"Fetching billing snapshot...",
|
|
31854
|
-
Effect48.all([
|
|
31929
|
+
Effect48.all([resolveActiveOrg, api2.getOrgBillingSnapshot])
|
|
31855
31930
|
);
|
|
31856
31931
|
yield* Console38.log("");
|
|
31857
31932
|
yield* Console38.log(chalk_default.bold(` Billing \u2014 ${org.name}`));
|
|
@@ -31927,7 +32002,7 @@ function teamEffect(input) {
|
|
|
31927
32002
|
}
|
|
31928
32003
|
yield* requireAuthEffect;
|
|
31929
32004
|
const api2 = yield* ApiService;
|
|
31930
|
-
const org = yield*
|
|
32005
|
+
const org = yield* resolveActiveOrg;
|
|
31931
32006
|
const all = yield* withSpinner("Fetching team...", api2.listOrgMembers(org.id));
|
|
31932
32007
|
const members = input.role ? all.filter((m) => m.role.toLowerCase() === input.role?.toLowerCase()) : all;
|
|
31933
32008
|
if (members.length === 0) {
|
|
@@ -32047,6 +32122,14 @@ var orgsCommand = Command38.make(
|
|
|
32047
32122
|
Command38.withDescription("Manage organizations"),
|
|
32048
32123
|
Command38.withSubcommands([membersCmd, billingCmd, sessionsCmd, teamCmd, auditCmd2])
|
|
32049
32124
|
);
|
|
32125
|
+
var orgCommand = Command38.make(
|
|
32126
|
+
"org",
|
|
32127
|
+
{ output: outputOption },
|
|
32128
|
+
({ output }) => orgsShowEffectWith(output)
|
|
32129
|
+
).pipe(
|
|
32130
|
+
Command38.withDescription("Alias for `orgs`"),
|
|
32131
|
+
Command38.withSubcommands([membersCmd, billingCmd, sessionsCmd, teamCmd, auditCmd2])
|
|
32132
|
+
);
|
|
32050
32133
|
|
|
32051
32134
|
// src/programs/plan.ts
|
|
32052
32135
|
import { Args as Args25, Command as Command39, Options as Options40 } from "@effect/cli";
|
|
@@ -39256,7 +39339,7 @@ function buildErrorEnvelope(err) {
|
|
|
39256
39339
|
};
|
|
39257
39340
|
}
|
|
39258
39341
|
function buildDefectEnvelope(cause) {
|
|
39259
|
-
const message =
|
|
39342
|
+
const message = renderUnknownCause(cause);
|
|
39260
39343
|
return {
|
|
39261
39344
|
code: "INTERNAL_ERROR",
|
|
39262
39345
|
message,
|
|
@@ -39265,6 +39348,28 @@ function buildDefectEnvelope(cause) {
|
|
|
39265
39348
|
exitCode: ExitCode.GENERIC
|
|
39266
39349
|
};
|
|
39267
39350
|
}
|
|
39351
|
+
function renderUnknownCause(cause) {
|
|
39352
|
+
if (cause instanceof Error) return cause.message;
|
|
39353
|
+
if (typeof cause === "string") return cause;
|
|
39354
|
+
if (cause === null) return "null";
|
|
39355
|
+
if (cause === void 0) return "undefined";
|
|
39356
|
+
if (typeof cause === "object") {
|
|
39357
|
+
const record = cause;
|
|
39358
|
+
if (typeof record.message === "string" && record.message.trim().length > 0) {
|
|
39359
|
+
return record.message;
|
|
39360
|
+
}
|
|
39361
|
+
const json = safeJsonStringify(cause);
|
|
39362
|
+
if (json) return json;
|
|
39363
|
+
}
|
|
39364
|
+
return String(cause);
|
|
39365
|
+
}
|
|
39366
|
+
function safeJsonStringify(value) {
|
|
39367
|
+
try {
|
|
39368
|
+
return JSON.stringify(value);
|
|
39369
|
+
} catch {
|
|
39370
|
+
return void 0;
|
|
39371
|
+
}
|
|
39372
|
+
}
|
|
39268
39373
|
function emitErrorEnvelope(envelope, format = resolveErrorOutputFormat()) {
|
|
39269
39374
|
if (format === "json") {
|
|
39270
39375
|
process.stderr.write(`${JSON.stringify({ error: envelope }, null, 2)}
|
|
@@ -39322,6 +39427,7 @@ var root = Command71.make(
|
|
|
39322
39427
|
unlinkCommand,
|
|
39323
39428
|
openCommand,
|
|
39324
39429
|
projectsCommand,
|
|
39430
|
+
orgCommand,
|
|
39325
39431
|
orgsCommand,
|
|
39326
39432
|
// deployment
|
|
39327
39433
|
deployCommand,
|
|
@@ -39399,12 +39505,55 @@ var cli = Command71.run(root, {
|
|
|
39399
39505
|
name: "Sylphx Platform CLI",
|
|
39400
39506
|
version: package_default.version
|
|
39401
39507
|
});
|
|
39508
|
+
var ANSI_ESCAPE_PATTERN = /\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g;
|
|
39509
|
+
function renderValidationErrorMessage(err) {
|
|
39510
|
+
return HelpDoc.toAnsiText(err.error).replace(ANSI_ESCAPE_PATTERN, "").trimEnd();
|
|
39511
|
+
}
|
|
39512
|
+
function suppressEffectConsoleErrorsForMachineOutput(effect) {
|
|
39513
|
+
if (resolveErrorOutputFormat() === "pretty") return effect;
|
|
39514
|
+
return Console71.consoleWith(
|
|
39515
|
+
(current2) => effect.pipe(
|
|
39516
|
+
Console71.withConsole({
|
|
39517
|
+
...current2,
|
|
39518
|
+
error: () => Effect81.void,
|
|
39519
|
+
unsafe: {
|
|
39520
|
+
...current2.unsafe,
|
|
39521
|
+
error: () => void 0
|
|
39522
|
+
}
|
|
39523
|
+
})
|
|
39524
|
+
)
|
|
39525
|
+
);
|
|
39526
|
+
}
|
|
39402
39527
|
cli(process.argv).pipe(
|
|
39528
|
+
suppressEffectConsoleErrorsForMachineOutput,
|
|
39403
39529
|
Effect81.catchAll(
|
|
39404
39530
|
(err) => Effect81.sync(() => {
|
|
39405
39531
|
const format = resolveErrorOutputFormat();
|
|
39406
39532
|
if (err instanceof CliCommandError) {
|
|
39407
39533
|
process.exitCode = renderCliCommandError(err, format);
|
|
39534
|
+
} else if (err instanceof CliArgError) {
|
|
39535
|
+
process.exitCode = renderCliCommandError(
|
|
39536
|
+
new CliCommandError({
|
|
39537
|
+
command: err.command,
|
|
39538
|
+
reason: "invalid-input",
|
|
39539
|
+
message: err.message
|
|
39540
|
+
}),
|
|
39541
|
+
format
|
|
39542
|
+
);
|
|
39543
|
+
} else if (ValidationError.isValidationError(err)) {
|
|
39544
|
+
process.exitCode = ExitCode.USAGE;
|
|
39545
|
+
if (format !== "pretty") {
|
|
39546
|
+
emitErrorEnvelope(
|
|
39547
|
+
{
|
|
39548
|
+
code: "INVALID_INPUT",
|
|
39549
|
+
message: renderValidationErrorMessage(err),
|
|
39550
|
+
reason: "invalid-input",
|
|
39551
|
+
command: "cli",
|
|
39552
|
+
exitCode: ExitCode.USAGE
|
|
39553
|
+
},
|
|
39554
|
+
format
|
|
39555
|
+
);
|
|
39556
|
+
}
|
|
39408
39557
|
} else {
|
|
39409
39558
|
const envelope = buildDefectEnvelope(err);
|
|
39410
39559
|
emitErrorEnvelope(envelope, format);
|