@sylphx/cli 0.6.0 → 0.7.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/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @sylphx/cli
2
2
 
3
+ ## 0.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#586](https://github.com/SylphxAI/platform/pull/586) [`2e55a61`](https://github.com/SylphxAI/platform/commit/2e55a6194628c5ca3ca78290cbf62610231ccee6) Thanks [@shtse8](https://github.com/shtse8)! - Expose authenticated build detail through the deployments contract, Management SDK, and `sylphx deployments build` so failed builds return structured, redacted diagnostics.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies []:
12
+ - @sylphx/sdk@0.10.2
13
+
3
14
  ## 0.6.0
4
15
 
5
16
  ### 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.6.0",
18
+ version: "0.7.0",
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",
@@ -71,7 +71,7 @@ var init_package = __esm({
71
71
  "@effect/cli": "0.75.1",
72
72
  "@effect/platform": "0.96.0",
73
73
  "@effect/platform-bun": "0.89.0",
74
- "@sylphx/sdk": "0.10.1",
74
+ "@sylphx/sdk": "0.10.2",
75
75
  chalk: "^5.3.0",
76
76
  effect: "3.21.0",
77
77
  eventsource: "^2.0.2",
@@ -1596,7 +1596,7 @@ var init_admin_bootstrap2 = __esm({
1596
1596
 
1597
1597
  // ../contract/dist/schemas/ids.js
1598
1598
  import { Schema as Schema7 } from "effect";
1599
- var brandedId, OrgId, ProjectId, EnvironmentId, ServiceId, UserId, SessionId, DeploymentId, DomainId, HostnameId, SecretId, DatabaseId, BranchDatabaseId, ResourceId, InvitationId;
1599
+ var brandedId, OrgId, ProjectId, EnvironmentId, ServiceId, UserId, SessionId, DeploymentId, BuildId, DomainId, HostnameId, SecretId, DatabaseId, BranchDatabaseId, ResourceId, InvitationId;
1600
1600
  var init_ids = __esm({
1601
1601
  "../contract/dist/schemas/ids.js"() {
1602
1602
  "use strict";
@@ -1608,6 +1608,7 @@ var init_ids = __esm({
1608
1608
  UserId = brandedId("UserId");
1609
1609
  SessionId = brandedId("SessionId");
1610
1610
  DeploymentId = brandedId("DeploymentId");
1611
+ BuildId = brandedId("BuildId");
1611
1612
  DomainId = brandedId("DomainId");
1612
1613
  HostnameId = brandedId("HostnameId");
1613
1614
  SecretId = brandedId("SecretId");
@@ -6460,7 +6461,7 @@ var init_databases = __esm({
6460
6461
 
6461
6462
  // ../contract/dist/schemas/deployment.js
6462
6463
  import { Schema as Schema51 } from "effect";
6463
- var DeploymentEnvironmentStatus, DeploymentStatus, DeployResult, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, ProjectStatusEnvironment, ProjectStatus, DeploymentServiceStatus, DeploymentDetail, TriggerDeploymentInput, RollbackDeploymentInput, DeployServiceStatus, EnvScopedAppEnvInfo, EnvScopedAppDeployments, EnvScopedTriggerDeployResult, EnvScopedRollbackByCommitInput, EnvScopedRollbackByCommitResult, CancelBuildResult, EnvScopedEnvVar, EnvScopedListEnvVarsResult, EnvScopedSetEnvVarInput, EnvScopedSetEnvVarResult, EnvScopedDeleteEnvVarResult, EnvScopedDeploymentView, EnvScopedDeploymentHistory, EnvScopedAppHealthStatus, EnvServiceRollbackInput, EnvServiceRollbackResult, PromoteArtifactInput, PromoteArtifactResult, DeployStatusLiteral, TriggerSourceLiteral, EnvServiceHistoryDeployment, EnvServiceHistoryResult;
6464
+ var DeploymentEnvironmentStatus, DeploymentStatus, DeployResult, DeploymentHistoryItem, DeploymentHistoryResult, RollbackResult, ProjectStatusEnvironment, ProjectStatus, DeploymentServiceStatus, DeploymentDetail, TriggerDeploymentInput, RollbackDeploymentInput, DeployServiceStatus, EnvScopedAppEnvInfo, EnvScopedAppDeployments, EnvScopedTriggerDeployResult, EnvScopedRollbackByCommitInput, EnvScopedRollbackByCommitResult, CancelBuildResult, BuildDetail, EnvScopedEnvVar, EnvScopedListEnvVarsResult, EnvScopedSetEnvVarInput, EnvScopedSetEnvVarResult, EnvScopedDeleteEnvVarResult, EnvScopedDeploymentView, EnvScopedDeploymentHistory, EnvScopedAppHealthStatus, EnvServiceRollbackInput, EnvServiceRollbackResult, PromoteArtifactInput, PromoteArtifactResult, DeployStatusLiteral, TriggerSourceLiteral, EnvServiceHistoryDeployment, EnvServiceHistoryResult;
6464
6465
  var init_deployment = __esm({
6465
6466
  "../contract/dist/schemas/deployment.js"() {
6466
6467
  "use strict";
@@ -6629,6 +6630,57 @@ var init_deployment = __esm({
6629
6630
  cancelled: Schema51.Boolean,
6630
6631
  buildId: Schema51.String
6631
6632
  });
6633
+ BuildDetail = Schema51.Struct({
6634
+ id: BuildId,
6635
+ status: Schema51.String,
6636
+ projectId: ProjectId,
6637
+ envId: EnvironmentId,
6638
+ environment: Schema51.Struct({
6639
+ id: EnvironmentId,
6640
+ name: Schema51.String,
6641
+ type: Schema51.String
6642
+ }),
6643
+ service: Schema51.NullOr(Schema51.Struct({
6644
+ id: ServiceId,
6645
+ name: Schema51.String,
6646
+ slug: Schema51.NullOr(Schema51.String),
6647
+ sourceKind: Schema51.NullOr(Schema51.String),
6648
+ buildContext: Schema51.NullOr(Schema51.String),
6649
+ dockerfilePath: Schema51.NullOr(Schema51.String)
6650
+ })),
6651
+ git: Schema51.Struct({
6652
+ sha: Schema51.String,
6653
+ branch: Schema51.String,
6654
+ commitMessage: Schema51.NullOr(Schema51.String)
6655
+ }),
6656
+ image: Schema51.Struct({
6657
+ digest: Schema51.NullOr(Schema51.String)
6658
+ }),
6659
+ build: Schema51.Struct({
6660
+ actualBuildKind: Schema51.NullOr(Schema51.String),
6661
+ buildpackPlanDigest: Schema51.NullOr(Schema51.String),
6662
+ logsAvailable: Schema51.Boolean
6663
+ }),
6664
+ timing: Schema51.Struct({
6665
+ createdAt: Schema51.String,
6666
+ startedAt: Schema51.NullOr(Schema51.String),
6667
+ finishedAt: Schema51.NullOr(Schema51.String),
6668
+ cancelledAt: Schema51.NullOr(Schema51.String),
6669
+ durationMs: Schema51.NullOr(Schema51.Number)
6670
+ }),
6671
+ diagnostics: Schema51.Struct({
6672
+ failureSummary: Schema51.NullOr(Schema51.String),
6673
+ cancellationReason: Schema51.NullOr(Schema51.String),
6674
+ supersededByBuildId: Schema51.NullOr(BuildId),
6675
+ supersededByGitSha: Schema51.NullOr(Schema51.String)
6676
+ }),
6677
+ deployment: Schema51.NullOr(Schema51.Struct({
6678
+ id: DeploymentId,
6679
+ status: Schema51.String,
6680
+ createdAt: Schema51.String,
6681
+ finishedAt: Schema51.NullOr(Schema51.String)
6682
+ }))
6683
+ });
6632
6684
  EnvScopedEnvVar = Schema51.Struct({
6633
6685
  key: Schema51.String,
6634
6686
  value: Schema51.String
@@ -6844,6 +6896,14 @@ var init_deployments = __esm({
6844
6896
  summary: "Cancel an in-flight build job (idempotent)",
6845
6897
  tags: ["deployments"]
6846
6898
  }),
6899
+ envScopedBuildDetail: defineEndpoint({
6900
+ method: "GET",
6901
+ path: "/deployments/builds/:buildId",
6902
+ params: BuildIdPath,
6903
+ response: BuildDetail,
6904
+ summary: "Build detail and failure summary for an authenticated project member",
6905
+ tags: ["deployments"]
6906
+ }),
6847
6907
  envScopedListEnvVars: defineEndpoint({
6848
6908
  method: "GET",
6849
6909
  path: "/deployments/projects/:envId/env",
@@ -14488,6 +14548,7 @@ var deployments_exports = {};
14488
14548
  __export(deployments_exports, {
14489
14549
  cancel: () => cancel,
14490
14550
  get: () => get2,
14551
+ getBuild: () => getBuild,
14491
14552
  history: () => history2,
14492
14553
  rollback: () => rollback,
14493
14554
  status: () => status,
@@ -14508,7 +14569,7 @@ function normalizeHistoryRow(row) {
14508
14569
  function isHistoryEnvelope(response) {
14509
14570
  return !Array.isArray(response);
14510
14571
  }
14511
- var status, get2, trigger2, history2, rollback, cancel;
14572
+ var status, get2, getBuild, trigger2, history2, rollback, cancel;
14512
14573
  var init_deployments2 = __esm({
14513
14574
  "../management/dist/deployments.js"() {
14514
14575
  "use strict";
@@ -14526,6 +14587,12 @@ var init_deployments2 = __esm({
14526
14587
  headers: { "x-preferred-org-id": options.orgId }
14527
14588
  });
14528
14589
  };
14590
+ getBuild = (client, buildId, options = {}) => {
14591
+ const { method, path: path6 } = deploymentsEndpoints.envScopedBuildDetail;
14592
+ return request(client, method, interpolatePath(path6, { buildId }), {
14593
+ headers: { "x-preferred-org-id": options.orgId }
14594
+ });
14595
+ };
14529
14596
  trigger2 = (client, projectId, envType, options = {}) => {
14530
14597
  const { method, path: path6 } = deploymentsEndpoints.trigger;
14531
14598
  return request(client, method, interpolatePath(path6, { id: projectId }), {
@@ -16838,6 +16905,7 @@ var init_api = __esm({
16838
16905
  getDeploymentStatus: (projectId, options) => withClient((c2) => deployments_exports.status(c2, projectId, options)),
16839
16906
  triggerDeploy: (projectId, envType) => withClient((c2) => deployments_exports.trigger(c2, projectId, envType)),
16840
16907
  getDeploymentHistory: (projectId, envType, options) => withClient((c2) => deployments_exports.history(c2, projectId, envType, options)),
16908
+ getBuild: (buildId, options) => withClient((c2) => deployments_exports.getBuild(c2, buildId, options)),
16841
16909
  rollback: (projectId, body, options) => withClient(
16842
16910
  (c2) => deployments_exports.rollback(
16843
16911
  c2,
@@ -17491,6 +17559,10 @@ var ApiServiceLive = Layer2.succeed(ApiService, {
17491
17559
  try: () => withAuthedSdk((c2) => deployments_exports.get(c2, deploymentId2, options)),
17492
17560
  catch: mapApiError("deployments")
17493
17561
  }),
17562
+ getBuild: (buildId, options) => Effect6.tryPromise({
17563
+ try: () => withAuthedSdk((c2) => deployments_exports.getBuild(c2, buildId, options)),
17564
+ catch: mapApiError("deployments")
17565
+ }),
17494
17566
  rollback: (projectId, body, options) => Effect6.tryPromise({
17495
17567
  try: () => withAuthedSdk((c2) => deployments_exports.rollback(c2, projectId, body, options)),
17496
17568
  catch: mapApiError("rollback")
@@ -22975,6 +23047,41 @@ function printDeploymentDetail(d) {
22975
23047
  yield* Console17.log("");
22976
23048
  });
22977
23049
  }
23050
+ function buildFailureLine(build) {
23051
+ return build.diagnostics.failureSummary ?? build.diagnostics.cancellationReason ?? "-";
23052
+ }
23053
+ function printBuildDetail(build) {
23054
+ return Effect27.gen(function* () {
23055
+ yield* Console17.log("");
23056
+ yield* Console17.log(chalk_default.bold(` Build ${chalk_default.white(build.id)}`));
23057
+ yield* Console17.log(chalk_default.dim(` ${"\u2500".repeat(56)}`));
23058
+ yield* Console17.log(` Status : ${statusColour3(build.status)}`);
23059
+ yield* Console17.log(` Project : ${chalk_default.white(build.projectId)}`);
23060
+ yield* Console17.log(
23061
+ ` Environment : ${chalk_default.white(`${build.environment.name} (${build.environment.type})`)}`
23062
+ );
23063
+ if (build.service) yield* Console17.log(` Service : ${chalk_default.white(build.service.name)}`);
23064
+ yield* Console17.log(` Commit : ${chalk_default.white(build.git.sha)}`);
23065
+ yield* Console17.log(` Branch : ${chalk_default.white(build.git.branch)}`);
23066
+ if (build.git.commitMessage)
23067
+ yield* Console17.log(` Message : ${chalk_default.white(build.git.commitMessage)}`);
23068
+ if (build.image.digest)
23069
+ yield* Console17.log(` Image : ${chalk_default.white(build.image.digest)}`);
23070
+ yield* Console17.log(` Build kind : ${chalk_default.white(build.build.actualBuildKind ?? "unknown")}`);
23071
+ yield* Console17.log(
23072
+ ` Started : ${chalk_default.white(build.timing.startedAt ? new Date(build.timing.startedAt).toLocaleString() : "-")}`
23073
+ );
23074
+ yield* Console17.log(
23075
+ ` Finished : ${chalk_default.white(build.timing.finishedAt ? new Date(build.timing.finishedAt).toLocaleString() : "-")}`
23076
+ );
23077
+ yield* Console17.log(` Duration : ${chalk_default.white(formatDuration(build.timing.durationMs))}`);
23078
+ yield* Console17.log(` Diagnostics : ${chalk_default.white(buildFailureLine(build))}`);
23079
+ if (build.diagnostics.supersededByBuildId) {
23080
+ yield* Console17.log(` Superseded by: ${chalk_default.white(build.diagnostics.supersededByBuildId)}`);
23081
+ }
23082
+ yield* Console17.log("");
23083
+ });
23084
+ }
22978
23085
  function deploymentsListEffect(opts) {
22979
23086
  return Effect27.gen(function* () {
22980
23087
  yield* requireAuthEffect;
@@ -23044,6 +23151,18 @@ function deploymentsGetEffect(opts) {
23044
23151
  yield* makeFormatter(output).print(detail, printDeploymentDetail);
23045
23152
  });
23046
23153
  }
23154
+ function deploymentsBuildEffect(opts) {
23155
+ return Effect27.gen(function* () {
23156
+ yield* requireAuthEffect;
23157
+ const orgId = yield* resolveOrgScopeEffect("deployments", opts.org);
23158
+ const api2 = yield* ApiService;
23159
+ const output = opts.output ?? "pretty";
23160
+ const isHumanOutput = output === "pretty" || output === "table";
23161
+ const request2 = orgId ? api2.getBuild(opts.id, { orgId }) : api2.getBuild(opts.id);
23162
+ const build = yield* isHumanOutput ? withSpinner(`Fetching build ${chalk_default.bold(opts.id)}...`, request2) : request2;
23163
+ yield* makeFormatter(output).print(build, printBuildDetail);
23164
+ });
23165
+ }
23047
23166
  function deploymentsWaitEffect(opts) {
23048
23167
  return Effect27.gen(function* () {
23049
23168
  yield* requireAuthEffect;
@@ -23141,6 +23260,11 @@ var getCmd3 = Command17.make(
23141
23260
  { id: Args14.text({ name: "id" }), org: orgOption4, output: outputOption },
23142
23261
  ({ id, org, output }) => deploymentsGetEffect({ id, org: org._tag === "Some" ? org.value : void 0, output })
23143
23262
  ).pipe(Command17.withDescription("Show details for a single deployment"));
23263
+ var buildCmd = Command17.make(
23264
+ "build",
23265
+ { id: Args14.text({ name: "id" }), org: orgOption4, output: outputOption },
23266
+ ({ id, org, output }) => deploymentsBuildEffect({ id, org: org._tag === "Some" ? org.value : void 0, output })
23267
+ ).pipe(Command17.withDescription("Show details for a single build"));
23144
23268
  function parseTimeoutMs(raw) {
23145
23269
  const m = raw.match(/^\s*(\d+)\s*(ms|s|m|h)?\s*$/i);
23146
23270
  if (!m) return WAIT_DEFAULT_TIMEOUT_MS;
@@ -23177,7 +23301,7 @@ var deploymentsCommand = Command17.make(
23177
23301
  () => Console17.log("Run `sylphx deployments --help` for usage")
23178
23302
  ).pipe(
23179
23303
  Command17.withDescription("Browse deployment history"),
23180
- Command17.withSubcommands([listCmd7, getCmd3, waitCmd])
23304
+ Command17.withSubcommands([listCmd7, getCmd3, buildCmd, waitCmd])
23181
23305
  );
23182
23306
 
23183
23307
  // src/programs/doctor.ts